aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INSTALL106
-rw-r--r--Makefile.am39
-rw-r--r--a11y/Makefile.am13
-rw-r--r--a11y/addressbook/Makefile.am35
-rw-r--r--a11y/calendar/Makefile.am56
-rw-r--r--a11y/e-table/Makefile.am44
-rw-r--r--a11y/e-text/Makefile.am15
-rw-r--r--a11y/widgets/Makefile.am36
-rw-r--r--a11y/widgets/ea-combo-button.c186
-rw-r--r--a11y/widgets/ea-combo-button.h52
-rw-r--r--addressbook/conduit/address-conduit.c1
-rw-r--r--addressbook/gui/Makefile.am2
-rw-r--r--addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in136
-rw-r--r--addressbook/gui/component/Makefile.am67
-rw-r--r--addressbook/gui/component/addressbook-component.c529
-rw-r--r--addressbook/gui/component/addressbook-component.h64
-rw-r--r--addressbook/gui/component/addressbook-config.c5
-rw-r--r--addressbook/gui/component/addressbook-config.h3
-rw-r--r--addressbook/gui/component/addressbook-view.c1534
-rw-r--r--addressbook/gui/component/addressbook-view.h65
-rw-r--r--addressbook/gui/component/autocompletion-config.c201
-rw-r--r--addressbook/gui/component/autocompletion-config.h9
-rw-r--r--addressbook/gui/component/component-factory.c75
-rw-r--r--addressbook/gui/component/e-book-shell-backend.c576
-rw-r--r--addressbook/gui/component/e-book-shell-backend.h70
-rw-r--r--addressbook/gui/component/e-book-shell-content.c492
-rw-r--r--addressbook/gui/component/e-book-shell-content.h110
-rw-r--r--addressbook/gui/component/e-book-shell-migrate.c (renamed from addressbook/gui/component/addressbook-migrate.c)63
-rw-r--r--addressbook/gui/component/e-book-shell-migrate.h (renamed from addressbook/gui/component/addressbook-migrate.h)20
-rw-r--r--addressbook/gui/component/e-book-shell-sidebar.c232
-rw-r--r--addressbook/gui/component/e-book-shell-sidebar.h79
-rw-r--r--addressbook/gui/component/e-book-shell-view-actions.c982
-rw-r--r--addressbook/gui/component/e-book-shell-view-actions.h91
-rw-r--r--addressbook/gui/component/e-book-shell-view-private.c621
-rw-r--r--addressbook/gui/component/e-book-shell-view-private.h129
-rw-r--r--addressbook/gui/component/e-book-shell-view.c318
-rw-r--r--addressbook/gui/component/e-book-shell-view.h66
-rw-r--r--addressbook/gui/component/eab-composer-util.c197
-rw-r--r--addressbook/gui/component/eab-composer-util.h (renamed from widgets/table/table-test.h)22
-rw-r--r--addressbook/gui/component/evolution-module-addressbook.c (renamed from shell/evolution-component.c)41
-rw-r--r--addressbook/gui/contact-editor/Makefile.am15
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c66
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h14
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c4
-rw-r--r--addressbook/gui/contact-editor/eab-editor.c47
-rw-r--r--addressbook/gui/contact-editor/eab-editor.h2
-rw-r--r--addressbook/gui/contact-editor/test-editor.c38
-rw-r--r--addressbook/gui/contact-list-editor/Makefile.am5
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c222
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.h2
-rw-r--r--addressbook/gui/merging/eab-contact-compare.c4
-rw-r--r--addressbook/gui/merging/eab-contact-merging.c14
-rw-r--r--addressbook/gui/widgets/Makefile.am34
-rw-r--r--addressbook/gui/widgets/a11y/ea-addressbook-view.c (renamed from a11y/addressbook/ea-addressbook-view.c)17
-rw-r--r--addressbook/gui/widgets/a11y/ea-addressbook-view.h (renamed from a11y/addressbook/ea-addressbook-view.h)0
-rw-r--r--addressbook/gui/widgets/a11y/ea-addressbook.c (renamed from a11y/addressbook/ea-addressbook.c)4
-rw-r--r--addressbook/gui/widgets/a11y/ea-addressbook.h (renamed from a11y/addressbook/ea-addressbook.h)0
-rw-r--r--addressbook/gui/widgets/a11y/ea-minicard-view.c (renamed from a11y/addressbook/ea-minicard-view.c)13
-rw-r--r--addressbook/gui/widgets/a11y/ea-minicard-view.h (renamed from a11y/addressbook/ea-minicard-view.h)0
-rw-r--r--addressbook/gui/widgets/a11y/ea-minicard.c (renamed from a11y/addressbook/ea-minicard.c)0
-rw-r--r--addressbook/gui/widgets/a11y/ea-minicard.h (renamed from a11y/addressbook/ea-minicard.h)0
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c1055
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.h149
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.c69
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.h11
-rw-r--r--addressbook/gui/widgets/e-addressbook-selector.c443
-rw-r--r--addressbook/gui/widgets/e-addressbook-selector.h73
-rw-r--r--addressbook/gui/widgets/e-addressbook-table-adapter.c36
-rw-r--r--addressbook/gui/widgets/e-addressbook-table-adapter.h4
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c2485
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h208
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c38
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.h2
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c60
-rw-r--r--addressbook/gui/widgets/e-minicard-view.h4
-rw-r--r--addressbook/gui/widgets/e-minicard.c78
-rw-r--r--addressbook/gui/widgets/e-minicard.h6
-rw-r--r--addressbook/gui/widgets/eab-contact-display.c733
-rw-r--r--addressbook/gui/widgets/eab-contact-display.h57
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c380
-rw-r--r--addressbook/gui/widgets/eab-gui-util.h30
-rw-r--r--addressbook/gui/widgets/eab-menu.c258
-rw-r--r--addressbook/gui/widgets/eab-menu.h110
-rw-r--r--addressbook/gui/widgets/eab-popup-control.c464
-rw-r--r--addressbook/gui/widgets/eab-popup-control.h84
-rw-r--r--addressbook/gui/widgets/eab-popup.c368
-rw-r--r--addressbook/gui/widgets/eab-popup.h201
-rw-r--r--addressbook/gui/widgets/gal-view-minicard.c294
-rw-r--r--addressbook/gui/widgets/gal-view-minicard.h65
-rw-r--r--addressbook/printing/Makefile.am6
-rw-r--r--addressbook/util/Makefile.am2
-rw-r--r--addressbook/util/addressbook.c (renamed from addressbook/gui/component/addressbook.c)0
-rw-r--r--addressbook/util/addressbook.h (renamed from addressbook/gui/component/addressbook.h)4
-rw-r--r--addressbook/util/eab-book-util.h2
-rw-r--r--calendar/Makefile.am2
-rw-r--r--calendar/gui/Makefile.am124
-rw-r--r--calendar/gui/a11y/ea-cal-view-event.c (renamed from a11y/calendar/ea-cal-view-event.c)0
-rw-r--r--calendar/gui/a11y/ea-cal-view-event.h (renamed from a11y/calendar/ea-cal-view-event.h)0
-rw-r--r--calendar/gui/a11y/ea-cal-view.c (renamed from a11y/calendar/ea-cal-view.c)0
-rw-r--r--calendar/gui/a11y/ea-cal-view.h (renamed from a11y/calendar/ea-cal-view.h)0
-rw-r--r--calendar/gui/a11y/ea-calendar-helpers.c (renamed from a11y/calendar/ea-calendar-helpers.c)0
-rw-r--r--calendar/gui/a11y/ea-calendar-helpers.h (renamed from a11y/calendar/ea-calendar-helpers.h)0
-rw-r--r--calendar/gui/a11y/ea-calendar.c (renamed from a11y/calendar/ea-calendar.c)2
-rw-r--r--calendar/gui/a11y/ea-calendar.h (renamed from a11y/calendar/ea-calendar.h)0
-rw-r--r--calendar/gui/a11y/ea-day-view-cell.c (renamed from a11y/calendar/ea-day-view-cell.c)2
-rw-r--r--calendar/gui/a11y/ea-day-view-cell.h (renamed from a11y/calendar/ea-day-view-cell.h)0
-rw-r--r--calendar/gui/a11y/ea-day-view-main-item.c (renamed from a11y/calendar/ea-day-view-main-item.c)0
-rw-r--r--calendar/gui/a11y/ea-day-view-main-item.h (renamed from a11y/calendar/ea-day-view-main-item.h)0
-rw-r--r--calendar/gui/a11y/ea-day-view.c (renamed from a11y/calendar/ea-day-view.c)0
-rw-r--r--calendar/gui/a11y/ea-day-view.h (renamed from a11y/calendar/ea-day-view.h)0
-rw-r--r--calendar/gui/a11y/ea-gnome-calendar.c (renamed from a11y/calendar/ea-gnome-calendar.c)0
-rw-r--r--calendar/gui/a11y/ea-gnome-calendar.h (renamed from a11y/calendar/ea-gnome-calendar.h)0
-rw-r--r--calendar/gui/a11y/ea-jump-button.c (renamed from a11y/calendar/ea-jump-button.c)0
-rw-r--r--calendar/gui/a11y/ea-jump-button.h (renamed from a11y/calendar/ea-jump-button.h)0
-rw-r--r--calendar/gui/a11y/ea-week-view-cell.c (renamed from a11y/calendar/ea-week-view-cell.c)2
-rw-r--r--calendar/gui/a11y/ea-week-view-cell.h (renamed from a11y/calendar/ea-week-view-cell.h)0
-rw-r--r--calendar/gui/a11y/ea-week-view-main-item.c (renamed from a11y/calendar/ea-week-view-main-item.c)0
-rw-r--r--calendar/gui/a11y/ea-week-view-main-item.h (renamed from a11y/calendar/ea-week-view-main-item.h)0
-rw-r--r--calendar/gui/a11y/ea-week-view.c (renamed from a11y/calendar/ea-week-view.c)0
-rw-r--r--calendar/gui/a11y/ea-week-view.h (renamed from a11y/calendar/ea-week-view.h)0
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c2
-rw-r--r--calendar/gui/apps_evolution_calendar.schemas.in22
-rw-r--r--calendar/gui/cal-search-bar.c12
-rw-r--r--calendar/gui/calendar-commands.c267
-rw-r--r--calendar/gui/calendar-component.c970
-rw-r--r--calendar/gui/calendar-component.h8
-rw-r--r--calendar/gui/calendar-config-keys.h8
-rw-r--r--calendar/gui/calendar-config.c180
-rw-r--r--calendar/gui/calendar-config.h29
-rw-r--r--calendar/gui/calendar-view-factory.c6
-rw-r--r--calendar/gui/calendar-view-factory.h4
-rw-r--r--calendar/gui/comp-editor-factory.c644
-rw-r--r--calendar/gui/comp-editor-factory.h62
-rw-r--r--calendar/gui/control-factory.c79
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c56
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.h32
-rw-r--r--calendar/gui/dialogs/comp-editor.c201
-rw-r--r--calendar/gui/dialogs/comp-editor.h5
-rw-r--r--calendar/gui/dialogs/event-editor.c14
-rw-r--r--calendar/gui/dialogs/event-editor.h1
-rw-r--r--calendar/gui/dialogs/event-page.c113
-rw-r--r--calendar/gui/dialogs/memo-editor.c14
-rw-r--r--calendar/gui/dialogs/memo-editor.h1
-rw-r--r--calendar/gui/dialogs/memo-page.c10
-rw-r--r--calendar/gui/dialogs/memo-page.glade1
-rw-r--r--calendar/gui/dialogs/task-details-page.c7
-rw-r--r--calendar/gui/dialogs/task-details-page.glade190
-rw-r--r--calendar/gui/dialogs/task-editor.c14
-rw-r--r--calendar/gui/dialogs/task-editor.h1
-rw-r--r--calendar/gui/dialogs/task-page.c92
-rw-r--r--calendar/gui/e-cal-component-memo-preview.c368
-rw-r--r--calendar/gui/e-cal-component-memo-preview.h67
-rw-r--r--calendar/gui/e-cal-component-preview.c319
-rw-r--r--calendar/gui/e-cal-component-preview.h64
-rw-r--r--calendar/gui/e-cal-event.c22
-rw-r--r--calendar/gui/e-cal-event.h16
-rw-r--r--calendar/gui/e-cal-list-view.c7
-rw-r--r--calendar/gui/e-cal-model-memos.c2
-rw-r--r--calendar/gui/e-cal-model-memos.h4
-rw-r--r--calendar/gui/e-cal-model-tasks.c2
-rw-r--r--calendar/gui/e-cal-model-tasks.h2
-rw-r--r--calendar/gui/e-cal-model.c2
-rw-r--r--calendar/gui/e-calendar-selector.c226
-rw-r--r--calendar/gui/e-calendar-selector.h66
-rw-r--r--calendar/gui/e-calendar-table-config.c282
-rw-r--r--calendar/gui/e-calendar-table-config.h46
-rw-r--r--calendar/gui/e-calendar-table.c1289
-rw-r--r--calendar/gui/e-calendar-table.h121
-rw-r--r--calendar/gui/e-calendar-view.c186
-rw-r--r--calendar/gui/e-calendar-view.h2
-rw-r--r--calendar/gui/e-cell-date-edit-config.h2
-rw-r--r--calendar/gui/e-day-view-main-item.c4
-rw-r--r--calendar/gui/e-day-view.c15
-rw-r--r--calendar/gui/e-itip-control.c17
-rw-r--r--calendar/gui/e-meeting-time-sel.c11
-rw-r--r--calendar/gui/e-memo-list-selector.c287
-rw-r--r--calendar/gui/e-memo-list-selector.h71
-rw-r--r--calendar/gui/e-memo-table.c1249
-rw-r--r--calendar/gui/e-memo-table.h103
-rw-r--r--calendar/gui/e-memos.c855
-rw-r--r--calendar/gui/e-memos.h4
-rw-r--r--calendar/gui/e-task-list-selector.c288
-rw-r--r--calendar/gui/e-task-list-selector.h71
-rw-r--r--calendar/gui/e-tasks.c848
-rw-r--r--calendar/gui/e-tasks.h15
-rw-r--r--calendar/gui/e-week-view-main-item.c4
-rw-r--r--calendar/gui/e-week-view.c21
-rw-r--r--calendar/gui/gnome-cal.c1167
-rw-r--r--calendar/gui/gnome-cal.h34
-rw-r--r--calendar/gui/goto.c9
-rw-r--r--calendar/gui/itip-bonobo-control.c265
-rw-r--r--calendar/gui/itip-bonobo-control.h34
-rw-r--r--calendar/gui/itip-utils.c3
-rw-r--r--calendar/gui/main.c196
-rw-r--r--calendar/gui/memos-component.c812
-rw-r--r--calendar/gui/memos-component.h4
-rw-r--r--calendar/gui/memos-control.c407
-rw-r--r--calendar/gui/memos-control.h36
-rw-r--r--calendar/gui/migration.h37
-rw-r--r--calendar/gui/print.c13
-rw-r--r--calendar/gui/tasks-component.c497
-rw-r--r--calendar/gui/tasks-component.h5
-rw-r--r--calendar/gui/tasks-control.c262
-rw-r--r--calendar/importers/main.c58
-rw-r--r--calendar/module/Makefile.am79
-rw-r--r--calendar/module/e-cal-shell-backend.c666
-rw-r--r--calendar/module/e-cal-shell-backend.h70
-rw-r--r--calendar/module/e-cal-shell-content.c827
-rw-r--r--calendar/module/e-cal-shell-content.h108
-rw-r--r--calendar/module/e-cal-shell-migrate.c (renamed from calendar/gui/migration.c)825
-rw-r--r--calendar/module/e-cal-shell-migrate.h (renamed from mail/em-migrate.h)29
-rw-r--r--calendar/module/e-cal-shell-settings.c59
-rw-r--r--calendar/module/e-cal-shell-settings.h (renamed from shell/e-shell-window-commands.h)18
-rw-r--r--calendar/module/e-cal-shell-sidebar.c759
-rw-r--r--calendar/module/e-cal-shell-sidebar.h101
-rw-r--r--calendar/module/e-cal-shell-view-actions.c1173
-rw-r--r--calendar/module/e-cal-shell-view-actions.h153
-rw-r--r--calendar/module/e-cal-shell-view-memopad.c526
-rw-r--r--calendar/module/e-cal-shell-view-private.c650
-rw-r--r--calendar/module/e-cal-shell-view-private.h170
-rw-r--r--calendar/module/e-cal-shell-view-taskpad.c654
-rw-r--r--calendar/module/e-cal-shell-view.c226
-rw-r--r--calendar/module/e-cal-shell-view.h69
-rw-r--r--calendar/module/e-memo-shell-backend.c613
-rw-r--r--calendar/module/e-memo-shell-backend.h70
-rw-r--r--calendar/module/e-memo-shell-content.c676
-rw-r--r--calendar/module/e-memo-shell-content.h96
-rw-r--r--calendar/module/e-memo-shell-migrate.c257
-rw-r--r--calendar/module/e-memo-shell-migrate.h (renamed from mail/mail-crypto.h)30
-rw-r--r--calendar/module/e-memo-shell-sidebar.c718
-rw-r--r--calendar/module/e-memo-shell-sidebar.h95
-rw-r--r--calendar/module/e-memo-shell-view-actions.c920
-rw-r--r--calendar/module/e-memo-shell-view-actions.h87
-rw-r--r--calendar/module/e-memo-shell-view-private.c524
-rw-r--r--calendar/module/e-memo-shell-view-private.h126
-rw-r--r--calendar/module/e-memo-shell-view.c222
-rw-r--r--calendar/module/e-memo-shell-view.h67
-rw-r--r--calendar/module/e-task-shell-backend.c621
-rw-r--r--calendar/module/e-task-shell-backend.h70
-rw-r--r--calendar/module/e-task-shell-content.c700
-rw-r--r--calendar/module/e-task-shell-content.h100
-rw-r--r--calendar/module/e-task-shell-migrate.c664
-rw-r--r--calendar/module/e-task-shell-migrate.h38
-rw-r--r--calendar/module/e-task-shell-sidebar.c696
-rw-r--r--calendar/module/e-task-shell-sidebar.h97
-rw-r--r--calendar/module/e-task-shell-view-actions.c1125
-rw-r--r--calendar/module/e-task-shell-view-actions.h105
-rw-r--r--calendar/module/e-task-shell-view-private.c744
-rw-r--r--calendar/module/e-task-shell-view-private.h141
-rw-r--r--calendar/module/e-task-shell-view.c255
-rw-r--r--calendar/module/e-task-shell-view.h67
-rw-r--r--calendar/module/evolution-module-calendar.c65
-rw-r--r--composer/Makefile.am7
-rw-r--r--composer/e-composer-actions.c33
-rw-r--r--composer/e-composer-header-table.c1
-rw-r--r--composer/e-composer-header.c6
-rw-r--r--composer/e-composer-header.h6
-rw-r--r--composer/e-composer-name-header.c35
-rw-r--r--composer/e-composer-post-header.c91
-rw-r--r--composer/e-composer-post-header.h5
-rw-r--r--composer/e-composer-private.c14
-rw-r--r--composer/e-composer-private.h4
-rw-r--r--composer/e-msg-composer.c575
-rw-r--r--composer/e-msg-composer.h16
-rw-r--r--configure.ac88
-rw-r--r--doc/Makefile.am2
-rw-r--r--doc/reference/Makefile.am1
-rw-r--r--doc/reference/shell/.gitignore15
-rw-r--r--doc/reference/shell/Makefile.am151
-rw-r--r--doc/reference/shell/eshell-docs.sgml43
-rw-r--r--doc/reference/shell/eshell-overrides.txt0
-rw-r--r--doc/reference/shell/eshell-sections.txt344
-rw-r--r--doc/reference/shell/eshell.types8
-rw-r--r--doc/reference/shell/tmpl/Evolution-DataServer.sgml1139
-rw-r--r--doc/reference/shell/tmpl/action-groups.sgml99
-rw-r--r--doc/reference/shell/tmpl/e-activity-handler.sgml19
-rw-r--r--doc/reference/shell/tmpl/e-config-upgrade.sgml32
-rw-r--r--doc/reference/shell/tmpl/e-shell-common.sgml21
-rw-r--r--doc/reference/shell/tmpl/e-shell-constants.sgml140
-rw-r--r--doc/reference/shell/tmpl/e-shell-content.sgml338
-rw-r--r--doc/reference/shell/tmpl/e-shell-importer.sgml27
-rw-r--r--doc/reference/shell/tmpl/e-shell-marshal.sgml41
-rw-r--r--doc/reference/shell/tmpl/e-shell-module.sgml180
-rw-r--r--doc/reference/shell/tmpl/e-shell-sidebar.sgml126
-rw-r--r--doc/reference/shell/tmpl/e-shell-switcher.sgml104
-rw-r--r--doc/reference/shell/tmpl/e-shell-taskbar.sgml79
-rw-r--r--doc/reference/shell/tmpl/e-shell-view.sgml267
-rw-r--r--doc/reference/shell/tmpl/e-shell-window-actions.sgml309
-rw-r--r--doc/reference/shell/tmpl/e-shell-window-private.sgml25
-rw-r--r--doc/reference/shell/tmpl/e-shell-window.sgml190
-rw-r--r--doc/reference/shell/tmpl/e-shell.sgml306
-rw-r--r--doc/reference/shell/tmpl/e-test-shell-view.sgml41
-rw-r--r--doc/reference/shell/tmpl/es-event.sgml147
-rw-r--r--doc/reference/shell/tmpl/eshell-unused.sgml2319
-rw-r--r--doc/reference/shell/tmpl/evolution-importer-client.sgml94
-rw-r--r--doc/reference/shell/tmpl/evolution-importer-listener.sgml56
-rw-r--r--doc/reference/shell/tmpl/evolution-importer.sgml117
-rw-r--r--doc/reference/shell/tmpl/evolution-intelligent-importer.sgml67
-rw-r--r--doc/reference/shell/tmpl/intelligent.sgml26
-rw-r--r--doc/reference/shell/tmpl/shell-actions.sgml291
-rw-r--r--e-util/Makefile.am24
-rw-r--r--e-util/e-account-utils.c96
-rw-r--r--e-util/e-account-utils.h (renamed from widgets/table/e-table-tree.h)35
-rw-r--r--e-util/e-corba-utils.h31
-rw-r--r--e-util/e-dialog-utils.c26
-rw-r--r--e-util/e-dialog-utils.h2
-rw-r--r--e-util/e-logger.c76
-rw-r--r--e-util/e-logger.h26
-rw-r--r--e-util/e-marshal.list2
-rw-r--r--e-util/e-module.c318
-rw-r--r--e-util/e-module.h81
-rw-r--r--e-util/e-non-intrusive-error-dialog.c1
-rw-r--r--e-util/e-non-intrusive-error-dialog.h2
-rw-r--r--e-util/e-plugin-ui.c438
-rw-r--r--e-util/e-plugin-ui.h9
-rw-r--r--e-util/e-signature-utils.c347
-rw-r--r--e-util/e-signature-utils.h (renamed from mail/mail-config-factory.h)40
-rw-r--r--e-util/e-unicode.c (renamed from widgets/misc/e-unicode.c)0
-rw-r--r--e-util/e-unicode.h (renamed from widgets/misc/e-unicode.h)0
-rw-r--r--e-util/e-util-labels.c592
-rw-r--r--e-util/e-util-labels.h54
-rw-r--r--e-util/e-util.c26
-rw-r--r--e-util/e-util.h8
-rw-r--r--e-util/gconf-bridge.c6
-rw-r--r--em-format/Makefile.am22
-rw-r--r--em-format/em-format-quote.c (renamed from mail/em-format-quote.c)82
-rw-r--r--em-format/em-format-quote.h (renamed from mail/em-format-quote.h)2
-rw-r--r--em-format/em-format.c (renamed from mail/em-format.c)384
-rw-r--r--em-format/em-format.h (renamed from mail/em-format.h)136
-rw-r--r--em-format/em-stripsig-filter.c (renamed from mail/em-stripsig-filter.c)0
-rw-r--r--em-format/em-stripsig-filter.h (renamed from mail/em-stripsig-filter.h)0
-rw-r--r--evolution-shell.pc.in3
-rw-r--r--filter/Makefile.am1
-rw-r--r--mail/Makefile.am397
-rw-r--r--mail/e-mail-attachment-bar.c3
-rw-r--r--mail/e-mail-browser.c751
-rw-r--r--mail/e-mail-browser.h72
-rw-r--r--mail/e-mail-display.c627
-rw-r--r--mail/e-mail-display.h83
-rw-r--r--mail/e-mail-label-dialog.c323
-rw-r--r--mail/e-mail-label-dialog.h77
-rw-r--r--mail/e-mail-label-list-store.c513
-rw-r--r--mail/e-mail-label-list-store.h85
-rw-r--r--mail/e-mail-label-manager.c479
-rw-r--r--mail/e-mail-label-manager.h81
-rw-r--r--mail/e-mail-label-tree-view.c136
-rw-r--r--mail/e-mail-label-tree-view.h66
-rw-r--r--mail/e-mail-reader-utils.c593
-rw-r--r--mail/e-mail-reader-utils.h56
-rw-r--r--mail/e-mail-reader.c2738
-rw-r--r--mail/e-mail-reader.h134
-rw-r--r--mail/e-mail-shell-backend.c1294
-rw-r--r--mail/e-mail-shell-backend.h122
-rw-r--r--mail/e-mail-shell-content.c1016
-rw-r--r--mail/e-mail-shell-content.h94
-rw-r--r--mail/e-mail-shell-migrate.c (renamed from mail/em-migrate.c)672
-rw-r--r--mail/e-mail-shell-migrate.h (renamed from e-util/e-corba-utils.c)35
-rw-r--r--mail/e-mail-shell-settings.c521
-rw-r--r--mail/e-mail-shell-settings.h (renamed from calendar/gui/control-factory.h)18
-rw-r--r--mail/e-mail-shell-sidebar.c347
-rw-r--r--mail/e-mail-shell-sidebar.h81
-rw-r--r--mail/e-mail-shell-view-actions.c1713
-rw-r--r--mail/e-mail-shell-view-actions.h257
-rw-r--r--mail/e-mail-shell-view-private.c898
-rw-r--r--mail/e-mail-shell-view-private.h170
-rw-r--r--mail/e-mail-shell-view.c260
-rw-r--r--mail/e-mail-shell-view.h72
-rw-r--r--mail/e-searching-tokenizer.c632
-rw-r--r--mail/e-searching-tokenizer.h82
-rw-r--r--mail/em-account-editor.c81
-rw-r--r--mail/em-account-prefs.c676
-rw-r--r--mail/em-account-prefs.h90
-rw-r--r--mail/em-composer-prefs.c823
-rw-r--r--mail/em-composer-prefs.h27
-rw-r--r--mail/em-composer-utils.c342
-rw-r--r--mail/em-composer-utils.h10
-rw-r--r--mail/em-filter-folder-element.c7
-rw-r--r--mail/em-folder-browser.c1491
-rw-r--r--mail/em-folder-properties.c69
-rw-r--r--mail/em-folder-properties.h17
-rw-r--r--mail/em-folder-selection-button.c585
-rw-r--r--mail/em-folder-selection-button.h104
-rw-r--r--mail/em-folder-selection.c5
-rw-r--r--mail/em-folder-selector.c139
-rw-r--r--mail/em-folder-selector.h40
-rw-r--r--mail/em-folder-tree-model.c514
-rw-r--r--mail/em-folder-tree-model.h62
-rw-r--r--mail/em-folder-tree.c803
-rw-r--r--mail/em-folder-tree.h68
-rw-r--r--mail/em-folder-utils.c24
-rw-r--r--mail/em-folder-utils.h2
-rw-r--r--mail/em-folder-view.c2424
-rw-r--r--mail/em-folder-view.h7
-rw-r--r--mail/em-format-hook.h2
-rw-r--r--mail/em-format-html-display.c984
-rw-r--r--mail/em-format-html-display.h54
-rw-r--r--mail/em-format-html-print.c24
-rw-r--r--mail/em-format-html.c1459
-rw-r--r--mail/em-format-html.h64
-rw-r--r--mail/em-html-stream.c147
-rw-r--r--mail/em-html-stream.h55
-rw-r--r--mail/em-inline-filter.c3
-rw-r--r--mail/em-mailer-prefs.c730
-rw-r--r--mail/em-mailer-prefs.h167
-rw-r--r--mail/em-message-browser.c421
-rw-r--r--mail/em-message-browser.h74
-rw-r--r--mail/em-network-prefs.c2
-rw-r--r--mail/em-network-prefs.h122
-rw-r--r--mail/em-popup.c417
-rw-r--r--mail/em-search-context.c84
-rw-r--r--mail/em-search-context.h41
-rw-r--r--mail/em-subscribe-editor.c10
-rw-r--r--mail/em-subscribe-editor.h2
-rw-r--r--mail/em-utils.c341
-rw-r--r--mail/em-utils.h106
-rw-r--r--mail/em-vfolder-editor.c4
-rw-r--r--mail/em-vfolder-editor.h2
-rw-r--r--mail/em-vfolder-rule.c7
-rw-r--r--mail/evolution-mail.schemas.in63
-rw-r--r--mail/evolution-module-mail.c59
-rw-r--r--mail/filtertypes.xml4
-rw-r--r--mail/importers/Makefile.am29
-rw-r--r--mail/importers/evolution-mbox-importer.c15
-rw-r--r--mail/importers/mail-importer.c15
-rw-r--r--mail/mail-autofilter.c25
-rw-r--r--mail/mail-component-factory.c125
-rw-r--r--mail/mail-component.c1234
-rw-r--r--mail/mail-component.h2
-rw-r--r--mail/mail-config-factory.c63
-rw-r--r--mail/mail-config.c509
-rw-r--r--mail/mail-config.glade15298
-rw-r--r--mail/mail-config.h67
-rw-r--r--mail/mail-folder-cache.c107
-rw-r--r--mail/mail-folder-cache.h4
-rw-r--r--mail/mail-mt.c82
-rw-r--r--mail/mail-ops.c53
-rw-r--r--mail/mail-ops.h3
-rw-r--r--mail/mail-send-recv.c71
-rw-r--r--mail/mail-send-recv.h8
-rw-r--r--mail/mail-session.c41
-rw-r--r--mail/mail-session.h17
-rw-r--r--mail/mail-tools.c10
-rw-r--r--mail/mail-types.h40
-rw-r--r--mail/mail-vfolder.c165
-rw-r--r--mail/mail-vfolder.h4
-rw-r--r--mail/message-list.c259
-rw-r--r--mail/message-list.h14
-rw-r--r--mail/message-tag-followup.c5
-rw-r--r--mail/searchtypes.xml2
-rw-r--r--mail/vfoldertypes.xml2
-rw-r--r--plugins/attachment-reminder/Makefile.am6
-rw-r--r--plugins/audio-inline/Makefile.am5
-rw-r--r--plugins/audio-inline/org-gnome-audio-inline.eplug.xml105
-rw-r--r--plugins/bbdb/Makefile.am3
-rw-r--r--plugins/bogo-junk-plugin/Makefile.am6
-rw-r--r--plugins/calendar-weather/Makefile.am10
-rw-r--r--plugins/calendar-weather/calendar-weather.c27
-rw-r--r--plugins/calendar-weather/category_weather_cloudy_16.pngbin597 -> 0 bytes
-rw-r--r--plugins/calendar-weather/category_weather_fog_16.pngbin217 -> 0 bytes
-rw-r--r--plugins/calendar-weather/category_weather_partly_cloudy_16.pngbin760 -> 0 bytes
-rw-r--r--plugins/calendar-weather/category_weather_rain_16.pngbin647 -> 0 bytes
-rw-r--r--plugins/calendar-weather/category_weather_snow_16.pngbin624 -> 0 bytes
-rw-r--r--plugins/calendar-weather/category_weather_sun_16.pngbin420 -> 0 bytes
-rw-r--r--plugins/calendar-weather/category_weather_tstorm_16.pngbin728 -> 0 bytes
-rw-r--r--plugins/email-custom-header/Makefile.am3
-rw-r--r--plugins/email-custom-header/email-custom-header.c6
-rw-r--r--plugins/external-editor/Makefile.am19
-rw-r--r--plugins/face/Makefile.am3
-rw-r--r--plugins/groupwise-features/Makefile.am5
-rw-r--r--plugins/groupwise-features/proxy-login.c3
-rw-r--r--plugins/imap-features/Makefile.am9
-rw-r--r--plugins/imap-features/imap-headers.c5
-rw-r--r--plugins/ipod-sync/Makefile.am2
-rw-r--r--plugins/mail-account-disable/ChangeLog62
-rw-r--r--plugins/mail-account-disable/Makefile.am23
-rw-r--r--plugins/mail-account-disable/mail-account-disable.c100
-rw-r--r--plugins/mail-account-disable/org-gnome-mail-account-disable.eplug.xml18
-rw-r--r--plugins/mail-notification/Makefile.am16
-rw-r--r--plugins/mark-all-read/Makefile.am3
-rw-r--r--plugins/mark-all-read/mark-all-read.c72
-rw-r--r--plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml31
-rw-r--r--plugins/mono/Makefile.am2
-rw-r--r--plugins/plugin-manager/Makefile.am8
-rw-r--r--plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml23
-rw-r--r--plugins/plugin-manager/org-gnome-plugin-manager.xml15
-rw-r--r--plugins/plugin-manager/plugin-manager.c83
-rw-r--r--plugins/profiler/Makefile.am2
-rw-r--r--plugins/pst-import/Makefile.am9
-rw-r--r--plugins/python/Makefile.am2
-rw-r--r--plugins/python/example/Makefile.am3
-rw-r--r--plugins/sa-junk-plugin/Makefile.am5
-rw-r--r--plugins/select-one-source/ChangeLog64
-rw-r--r--plugins/select-one-source/Makefile.am20
-rw-r--r--plugins/select-one-source/org-gnome-select-one-source.eplug.xml21
-rw-r--r--plugins/select-one-source/select-one-source.c54
-rw-r--r--plugins/tnef-attachments/Makefile.am12
-rw-r--r--plugins/tnef-attachments/tnef-plugin.c4
-rw-r--r--plugins/vcard-inline/Makefile.am9
-rw-r--r--plugins/vcard-inline/vcard-inline.c35
-rw-r--r--po/ChangeLog7
-rw-r--r--po/LINGUAS1
-rw-r--r--po/POTFILES.in165
-rw-r--r--po/be.po28
-rw-r--r--[-rwxr-xr-x]po/mai.po0
-rw-r--r--shell/Evolution-Component.idl137
-rw-r--r--shell/Evolution-ConfigControl.idl26
-rw-r--r--shell/Evolution-Shell.idl87
-rw-r--r--shell/Evolution.idl20
-rw-r--r--shell/Makefile.am117
-rw-r--r--shell/apps_evolution_shell.schemas.in24
-rw-r--r--shell/e-active-connection-dialog.glade193
-rw-r--r--shell/e-component-registry.c327
-rw-r--r--shell/e-component-registry.h104
-rw-r--r--shell/e-component-view.c151
-rw-r--r--shell/e-component-view.h79
-rw-r--r--shell/e-corba-config-page.c155
-rw-r--r--shell/e-corba-config-page.h68
-rw-r--r--shell/e-shell-backend.c458
-rw-r--r--shell/e-shell-backend.h151
-rw-r--r--shell/e-shell-common.h (renamed from shell/importer/intelligent.h)19
-rw-r--r--shell/e-shell-constants.h50
-rw-r--r--shell/e-shell-content.c1384
-rw-r--r--shell/e-shell-content.h143
-rw-r--r--shell/e-shell-importer.c24
-rw-r--r--shell/e-shell-importer.h15
-rw-r--r--shell/e-shell-migrate.c335
-rw-r--r--shell/e-shell-migrate.h (renamed from mail/mail-crypto.c)51
-rw-r--r--shell/e-shell-nm.c54
-rw-r--r--shell/e-shell-settings-dialog.c357
-rw-r--r--shell/e-shell-settings-dialog.h65
-rw-r--r--shell/e-shell-settings.c559
-rw-r--r--shell/e-shell-settings.h114
-rw-r--r--shell/e-shell-sidebar.c681
-rw-r--r--shell/e-shell-sidebar.h97
-rw-r--r--shell/e-shell-switcher.c700
-rw-r--r--shell/e-shell-switcher.h92
-rw-r--r--shell/e-shell-taskbar.c421
-rw-r--r--shell/e-shell-taskbar.h87
-rw-r--r--shell/e-shell-view.c1025
-rw-r--r--shell/e-shell-view.h188
-rw-r--r--shell/e-shell-window-actions.c2226
-rw-r--r--shell/e-shell-window-actions.h123
-rw-r--r--shell/e-shell-window-commands.c1393
-rw-r--r--shell/e-shell-window-private.c575
-rw-r--r--shell/e-shell-window-private.h127
-rw-r--r--shell/e-shell-window.c1737
-rw-r--r--shell/e-shell-window.h139
-rw-r--r--shell/e-shell.c2175
-rw-r--r--shell/e-shell.h205
-rw-r--r--shell/e-sidebar.c795
-rw-r--r--shell/e-sidebar.h88
-rw-r--r--shell/e-user-creatable-items-handler.c915
-rw-r--r--shell/e-user-creatable-items-handler.h70
-rw-r--r--shell/es-event.c18
-rw-r--r--shell/es-event.h15
-rw-r--r--shell/es-menu.c186
-rw-r--r--shell/es-menu.h97
-rw-r--r--shell/evolution-component.h47
-rw-r--r--shell/evolution-config-control.c175
-rw-r--r--shell/evolution-config-control.h64
-rw-r--r--shell/evolution-listener.c71
-rw-r--r--shell/evolution-listener.h54
-rw-r--r--shell/evolution-shell-component-utils.c112
-rw-r--r--shell/evolution-shell-component-utils.h52
-rw-r--r--shell/importer/GNOME_Evolution_Importer.idl97
-rw-r--r--shell/importer/Makefile.am68
-rw-r--r--shell/importer/evolution-importer-client.c267
-rw-r--r--shell/importer/evolution-importer-client.h74
-rw-r--r--shell/importer/evolution-importer-listener.c224
-rw-r--r--shell/importer/evolution-importer-listener.h71
-rw-r--r--shell/importer/evolution-importer.c249
-rw-r--r--shell/importer/evolution-importer.h100
-rw-r--r--shell/importer/evolution-intelligent-importer.c197
-rw-r--r--shell/importer/evolution-intelligent-importer.h74
-rw-r--r--shell/importer/import.glade124
-rw-r--r--shell/importer/intelligent.c469
-rw-r--r--shell/main.c445
-rw-r--r--shell/shell.error.xml27
-rw-r--r--shell/test/GNOME_Evolution_Test.server.in.in39
-rw-r--r--shell/test/Makefile.am33
-rw-r--r--shell/test/e-test-shell-backend.c240
-rw-r--r--shell/test/e-test-shell-backend.h67
-rw-r--r--shell/test/e-test-shell-view.c155
-rw-r--r--shell/test/e-test-shell-view.h66
-rw-r--r--shell/test/evolution-module-test.c (renamed from widgets/misc/e-config-page.c)36
-rw-r--r--shell/test/evolution-test-component.c178
-rw-r--r--shell/test/evolution-test-component.h56
-rw-r--r--smime/gui/Makefile.am11
-rw-r--r--smime/gui/certificate-manager.c28
-rw-r--r--smime/gui/certificate-manager.h9
-rw-r--r--ui/Makefile.am18
-rw-r--r--ui/evolution-addressbook.xml190
-rw-r--r--ui/evolution-calendar.xml107
-rw-r--r--ui/evolution-calendars.ui136
-rw-r--r--ui/evolution-contacts.ui85
-rw-r--r--ui/evolution-mail-reader.ui144
-rw-r--r--ui/evolution-mail.ui120
-rw-r--r--ui/evolution-memos.ui68
-rw-r--r--ui/evolution-memos.xml56
-rw-r--r--ui/evolution-shell.ui82
-rw-r--r--ui/evolution-tasks.ui79
-rw-r--r--ui/evolution-tasks.xml81
-rw-r--r--widgets/Makefile.am4
-rw-r--r--widgets/menus/Makefile.am4
-rw-r--r--widgets/menus/gal-view-collection.c2
-rw-r--r--widgets/menus/gal-view-instance.c143
-rw-r--r--widgets/menus/gal-view-instance.h5
-rw-r--r--widgets/menus/gal-view-menus.c544
-rw-r--r--widgets/menus/gal-view-menus.h63
-rw-r--r--widgets/menus/gal-view-new-dialog.c2
-rw-r--r--widgets/misc/Makefile.am190
-rw-r--r--widgets/misc/a11y/ea-calendar-cell.c (renamed from a11y/widgets/ea-calendar-cell.c)2
-rw-r--r--widgets/misc/a11y/ea-calendar-cell.h (renamed from a11y/widgets/ea-calendar-cell.h)0
-rw-r--r--widgets/misc/a11y/ea-calendar-item.c (renamed from a11y/widgets/ea-calendar-item.c)2
-rw-r--r--widgets/misc/a11y/ea-calendar-item.h (renamed from a11y/widgets/ea-calendar-item.h)0
-rw-r--r--widgets/misc/a11y/ea-widgets.c (renamed from a11y/widgets/ea-widgets.c)11
-rw-r--r--widgets/misc/a11y/ea-widgets.h (renamed from a11y/widgets/ea-widgets.h)1
-rw-r--r--widgets/misc/e-account-combo-box.c1
-rw-r--r--widgets/misc/e-account-combo-box.h1
-rw-r--r--widgets/misc/e-account-manager.c461
-rw-r--r--widgets/misc/e-account-manager.h82
-rw-r--r--widgets/misc/e-account-tree-view.c632
-rw-r--r--widgets/misc/e-account-tree-view.h84
-rw-r--r--widgets/misc/e-action-combo-box.c582
-rw-r--r--widgets/misc/e-action-combo-box.h85
-rw-r--r--widgets/misc/e-activity-handler.c700
-rw-r--r--widgets/misc/e-activity-handler.h108
-rw-r--r--widgets/misc/e-activity-proxy.c345
-rw-r--r--widgets/misc/e-activity-proxy.h68
-rw-r--r--widgets/misc/e-activity.c764
-rw-r--r--widgets/misc/e-activity.h107
-rw-r--r--widgets/misc/e-alert-activity.c254
-rw-r--r--widgets/misc/e-alert-activity.h70
-rw-r--r--widgets/misc/e-calendar-item.c2
-rw-r--r--widgets/misc/e-calendar.h21
-rw-r--r--widgets/misc/e-charset-picker.c203
-rw-r--r--widgets/misc/e-charset-picker.h11
-rw-r--r--widgets/misc/e-combo-button.c625
-rw-r--r--widgets/misc/e-combo-button.h83
-rw-r--r--widgets/misc/e-config-page.h67
-rw-r--r--widgets/misc/e-dropdown-button.c237
-rw-r--r--widgets/misc/e-dropdown-button.h70
-rw-r--r--widgets/misc/e-file-activity.c365
-rw-r--r--widgets/misc/e-file-activity.h83
-rw-r--r--widgets/misc/e-filter-bar.c635
-rw-r--r--widgets/misc/e-filter-bar.h46
-rw-r--r--widgets/misc/e-icon-entry.c505
-rw-r--r--widgets/misc/e-icon-entry.h66
-rw-r--r--widgets/misc/e-info-label.c246
-rw-r--r--widgets/misc/e-info-label.h59
-rw-r--r--widgets/misc/e-menu-tool-button.c157
-rw-r--r--widgets/misc/e-menu-tool-button.h68
-rw-r--r--widgets/misc/e-multi-config-dialog.c374
-rw-r--r--widgets/misc/e-multi-config-dialog.h76
-rw-r--r--widgets/misc/e-online-button.c10
-rw-r--r--widgets/misc/e-popup-action.c285
-rw-r--r--widgets/misc/e-popup-action.h95
-rw-r--r--widgets/misc/e-preferences-window.c393
-rw-r--r--widgets/misc/e-preferences-window.h74
-rw-r--r--widgets/misc/e-search-bar.c1806
-rw-r--r--widgets/misc/e-search-bar.h145
-rw-r--r--widgets/misc/e-signature-combo-box.c1
-rw-r--r--widgets/misc/e-signature-combo-box.h1
-rw-r--r--widgets/misc/e-signature-editor.c (renamed from mail/mail-signature-editor.c)37
-rw-r--r--widgets/misc/e-signature-editor.h (renamed from mail/mail-signature-editor.h)10
-rw-r--r--widgets/misc/e-signature-manager.c746
-rw-r--r--widgets/misc/e-signature-manager.h100
-rw-r--r--widgets/misc/e-signature-preview.c344
-rw-r--r--widgets/misc/e-signature-preview.h81
-rw-r--r--widgets/misc/e-signature-script-dialog.c463
-rw-r--r--widgets/misc/e-signature-script-dialog.h76
-rw-r--r--widgets/misc/e-signature-tree-view.c445
-rw-r--r--widgets/misc/e-signature-tree-view.h78
-rw-r--r--widgets/misc/e-task-bar.c302
-rw-r--r--widgets/misc/e-task-bar.h81
-rw-r--r--widgets/misc/e-task-widget.c291
-rw-r--r--widgets/misc/e-task-widget.h82
-rw-r--r--widgets/misc/e-timeout-activity.c198
-rw-r--r--widgets/misc/e-timeout-activity.h73
-rw-r--r--widgets/misc/test-calendar.c2
-rw-r--r--widgets/misc/test-dropdown-button.c99
-rw-r--r--widgets/misc/test-error.c61
-rw-r--r--widgets/misc/test-info-label.c75
-rw-r--r--widgets/misc/test-preferences-window.c (renamed from widgets/misc/test-multi-config-dialog.c)49
-rw-r--r--widgets/table/Makefile.am58
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell-popup.c (renamed from a11y/e-table/gal-a11y-e-cell-popup.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell-popup.h (renamed from a11y/e-table/gal-a11y-e-cell-popup.h)2
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell-registry.c (renamed from a11y/e-table/gal-a11y-e-cell-registry.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell-registry.h (renamed from a11y/e-table/gal-a11y-e-cell-registry.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell-text.c (renamed from a11y/e-table/gal-a11y-e-cell-text.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell-text.h (renamed from a11y/e-table/gal-a11y-e-cell-text.h)2
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell-toggle.c (renamed from a11y/e-table/gal-a11y-e-cell-toggle.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell-toggle.h (renamed from a11y/e-table/gal-a11y-e-cell-toggle.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell-tree.c (renamed from a11y/e-table/gal-a11y-e-cell-tree.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell-tree.h (renamed from a11y/e-table/gal-a11y-e-cell-tree.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell-vbox.c (renamed from a11y/e-table/gal-a11y-e-cell-vbox.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell-vbox.h (renamed from a11y/e-table/gal-a11y-e-cell-vbox.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell.c (renamed from a11y/e-table/gal-a11y-e-cell.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-cell.h (renamed from a11y/e-table/gal-a11y-e-cell.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table-click-to-add-factory.c (renamed from a11y/e-table/gal-a11y-e-table-click-to-add-factory.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table-click-to-add-factory.h (renamed from a11y/e-table/gal-a11y-e-table-click-to-add-factory.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table-click-to-add.c (renamed from a11y/e-table/gal-a11y-e-table-click-to-add.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table-click-to-add.h (renamed from a11y/e-table/gal-a11y-e-table-click-to-add.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table-column-header.c (renamed from a11y/e-table/gal-a11y-e-table-column-header.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table-column-header.h (renamed from a11y/e-table/gal-a11y-e-table-column-header.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table-factory.c (renamed from a11y/e-table/gal-a11y-e-table-factory.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table-factory.h (renamed from a11y/e-table/gal-a11y-e-table-factory.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table-item-factory.c (renamed from a11y/e-table/gal-a11y-e-table-item-factory.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table-item-factory.h (renamed from a11y/e-table/gal-a11y-e-table-item-factory.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table-item.c (renamed from a11y/e-table/gal-a11y-e-table-item.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table-item.h (renamed from a11y/e-table/gal-a11y-e-table-item.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table.c (renamed from a11y/e-table/gal-a11y-e-table.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-table.h (renamed from a11y/e-table/gal-a11y-e-table.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-tree-factory.c (renamed from a11y/e-table/gal-a11y-e-tree-factory.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-tree-factory.h (renamed from a11y/e-table/gal-a11y-e-tree-factory.h)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-tree.c (renamed from a11y/e-table/gal-a11y-e-tree.c)0
-rw-r--r--widgets/table/a11y/gal-a11y-e-tree.h (renamed from a11y/e-table/gal-a11y-e-tree.h)0
-rw-r--r--widgets/table/e-cell-combo.c2
-rw-r--r--widgets/table/e-cell-date-edit.c (renamed from widgets/misc/e-cell-date-edit.c)6
-rw-r--r--widgets/table/e-cell-date-edit.h (renamed from widgets/misc/e-cell-date-edit.h)0
-rw-r--r--widgets/table/e-cell-date.c2
-rw-r--r--widgets/table/e-cell-hbox.c4
-rw-r--r--widgets/table/e-cell-percent.c (renamed from widgets/misc/e-cell-percent.c)0
-rw-r--r--widgets/table/e-cell-percent.h (renamed from widgets/misc/e-cell-percent.h)0
-rw-r--r--widgets/table/e-cell-popup.c4
-rw-r--r--widgets/table/e-cell-text.c6
-rw-r--r--widgets/table/e-cell-toggle.c4
-rw-r--r--widgets/table/e-cell-tree.c4
-rw-r--r--widgets/table/e-cell-vbox.c4
-rw-r--r--widgets/table/e-table-click-to-add.c2
-rw-r--r--widgets/table/e-table-config.c2
-rw-r--r--widgets/table/e-table-example-1.c305
-rw-r--r--widgets/table/e-table-group-container.c2
-rw-r--r--widgets/table/e-table-header-item.c5
-rw-r--r--widgets/table/e-table-header-utils.c2
-rw-r--r--widgets/table/e-table-item.c4
-rw-r--r--widgets/table/e-table-utils.c2
-rw-r--r--widgets/table/e-table.c4
-rw-r--r--widgets/table/e-tree.c2
-rw-r--r--widgets/text/Makefile.am21
-rw-r--r--widgets/text/a11y/gal-a11y-e-text-factory.c (renamed from a11y/e-text/gal-a11y-e-text-factory.c)0
-rw-r--r--widgets/text/a11y/gal-a11y-e-text-factory.h (renamed from a11y/e-text/gal-a11y-e-text-factory.h)0
-rw-r--r--widgets/text/a11y/gal-a11y-e-text.c (renamed from a11y/e-text/gal-a11y-e-text.c)0
-rw-r--r--widgets/text/a11y/gal-a11y-e-text.h (renamed from a11y/e-text/gal-a11y-e-text.h)0
-rw-r--r--widgets/text/e-reflow-model.c (renamed from widgets/misc/e-reflow-model.c)0
-rw-r--r--widgets/text/e-reflow-model.h (renamed from widgets/misc/e-reflow-model.h)0
-rw-r--r--widgets/text/e-reflow.c (renamed from widgets/misc/e-reflow.c)8
-rw-r--r--widgets/text/e-reflow.h (renamed from widgets/misc/e-reflow.h)2
-rw-r--r--widgets/text/e-text.c4
749 files changed, 85395 insertions, 61915 deletions
diff --git a/INSTALL b/INSTALL
index 54caf7c190..d3c5b40a94 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,13 +1,19 @@
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
-Foundation, Inc.
+Installation Instructions
+*************************
- This file is free documentation; the Free Software Foundation gives
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007 Free Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
- These are generic installation instructions.
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
@@ -20,9 +26,9 @@ debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring. (Caching is
+the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
-cache files.)
+cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
@@ -32,20 +38,17 @@ some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'. You only need
-`configure.ac' if you want to change it or regenerate `configure' using
-a newer version of `autoconf'.
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
+ `./configure' to configure the package for your system.
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
2. Type `make' to compile the package.
@@ -64,54 +67,55 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
Compilers and Options
=====================
- Some systems require unusual options for compilation or linking that
-the `configure' script does not know about. Run `./configure --help'
-for details on some of the pertinent environment variables.
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
- ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
- You can compile the package for more than one kind of computer at the
+You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
-own directory. To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'. `cd' to the
+own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
- If you have to use a `make' that does not support the `VPATH'
-variable, you have to compile the package for one architecture at a
-time in the source code directory. After you have installed the
-package for one architecture, use `make distclean' before reconfiguring
-for another architecture.
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
Installation Names
==================
- By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc. You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
+options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
@@ -122,7 +126,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
- Some packages pay attention to `--enable-FEATURE' options to
+Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
@@ -137,11 +141,11 @@ you can use the `configure' options `--x-includes=DIR' and
Specifying the System Type
==========================
- There may be some features `configure' cannot figure out
-automatically, but needs to determine by the type of machine the package
-will run on. Usually, assuming the package is built to be run on the
-_same_ architectures, `configure' can figure that out, but if it prints
-a message saying it cannot guess the machine type, give it the
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
@@ -156,7 +160,7 @@ where SYSTEM can have one of these forms:
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
-use the `--target=TYPE' option to select the type of system they will
+use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
@@ -167,9 +171,9 @@ eventually be run) with `--host=TYPE'.
Sharing Defaults
================
- If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
@@ -178,7 +182,7 @@ A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
- Variables not defined in a site shell script can be set in the
+Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
@@ -186,14 +190,18 @@ them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
-will cause the specified gcc to be used as the C compiler (unless it is
+causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
+
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
`configure' Invocation
======================
- `configure' recognizes the following options to control how it
-operates.
+`configure' recognizes the following options to control how it operates.
`--help'
`-h'
diff --git a/Makefile.am b/Makefile.am
index f341656a56..2dcc6ce3df 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,21 +34,46 @@ if ENABLE_SMIME
SMIME_DIR=smime
endif
+# Disabled component and plugin directories during shell rewrite.
+
+#SUBDIRS = \
+# win32 \
+# data \
+# e-util \
+# a11y \
+# widgets \
+# shell \
+# filter \
+# $(SMIME_DIR) \
+# addressbook \
+# calendar \
+# art \
+# composer \
+# mail \
+# plugins \
+# ui \
+# views \
+# tools \
+# po \
+# sounds
+
SUBDIRS = \
win32 \
- data \
- e-util \
+ data \
+ e-util \
a11y \
- widgets \
- shell \
filter \
+ widgets \
+ shell \
$(SMIME_DIR) \
- addressbook \
- calendar \
- art \
+ em-format \
composer \
+ addressbook \
mail \
+ calendar \
+ art \
plugins \
+ doc \
ui \
views \
tools \
diff --git a/a11y/Makefile.am b/a11y/Makefile.am
index 0ccbe4390e..772a96937f 100644
--- a/a11y/Makefile.am
+++ b/a11y/Makefile.am
@@ -1,13 +1,3 @@
-# Somewhat odd looking to have "." in SUBDIRS, but apparently it works?
-SUBDIRS = e-text e-table . calendar widgets addressbook
-
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = \
- $(top_builddir)/win32/libemiscwidgets.la \
- $(top_builddir)/win32/libetable.la \
- $(top_builddir)/win32/libetext.la
-endif
-
# for debug
#A11Y_CFLAGS += -pedantic -ansi -DACC_DEBUG -Werror
@@ -27,9 +17,6 @@ libevolution_a11y_la_SOURCES = \
libevolution_a11y_la_LDFLAGS = $(NO_UNDEFINED)
libevolution_a11y_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
- e-text/libgal-a11y-etext.la \
- e-table/libgal-a11y-etable.la \
$(top_builddir)/e-util/libeutil.la \
$(GNOME_PLATFORM_LIBS)
diff --git a/a11y/addressbook/Makefile.am b/a11y/addressbook/Makefile.am
deleted file mode 100644
index 81092822f4..0000000000
--- a/a11y/addressbook/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = \
- $(top_builddir)/win32/libemiscwidgets.la \
- $(top_builddir)/win32/libevolution-addressbook.la
-endif
-
-privsolib_LTLIBRARIES = libevolution-addressbook-a11y.la
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"evolution-a11y\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/a11y \
- -I$(top_srcdir)/widgets \
- -I$(top_srcdir)/shell \
- -I$(top_srcdir)/addressbook/gui/widgets \
- -DG_DISABLE_DEPRECATED \
- $(EVOLUTION_ADDRESSBOOK_CFLAGS)
-
-libevolution_addressbook_a11y_la_SOURCES = \
- ea-minicard.c \
- ea-minicard.h \
- ea-minicard-view.c \
- ea-minicard-view.h \
- ea-addressbook-view.c \
- ea-addressbook-view.h \
- ea-addressbook.c \
- ea-addressbook.h
-
-libevolution_addressbook_a11y_la_LDFLAGS = $(NO_UNDEFINED)
-
-libevolution_addressbook_a11y_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
- $(EVOLUTION_ADDRESSBOOK_LIBS)
-
--include $(top_srcdir)/git.mk
diff --git a/a11y/calendar/Makefile.am b/a11y/calendar/Makefile.am
deleted file mode 100644
index 1bd53787c9..0000000000
--- a/a11y/calendar/Makefile.am
+++ /dev/null
@@ -1,56 +0,0 @@
-# Calendar IDL files
-
-# for debug
-#A11Y_CFLAGS += -pedantic -ansi -DACC_DEBUG -Werror
-
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = \
- $(top_builddir)/win32/libetext.la \
- $(top_builddir)/win32/libevolution-calendar.la
-endif
-
-privsolib_LTLIBRARIES = libevolution-calendar-a11y.la
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"evolution-a11y\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/calendar/gui \
- -I$(top_srcdir)/widgets \
- -I$(top_srcdir)/widgets/misc \
- -I$(top_srcdir)/a11y \
- $(EVOLUTION_CALENDAR_CFLAGS)
-
-libevolution_calendar_a11y_la_SOURCES = \
- ea-calendar.c \
- ea-calendar.h \
- ea-calendar-helpers.c \
- ea-calendar-helpers.h \
- ea-cal-view.c \
- ea-cal-view.h \
- ea-cal-view-event.c \
- ea-cal-view-event.h \
- ea-day-view.c \
- ea-day-view.h \
- ea-day-view-main-item.c \
- ea-day-view-main-item.h \
- ea-day-view-cell.c \
- ea-day-view-cell.h \
- ea-week-view.c \
- ea-week-view.h \
- ea-week-view-main-item.c \
- ea-week-view-main-item.h \
- ea-week-view-cell.c \
- ea-week-view-cell.h \
- ea-jump-button.c \
- ea-jump-button.h \
- ea-gnome-calendar.c \
- ea-gnome-calendar.h
-
-libevolution_calendar_a11y_la_LDFLAGS = $(NO_UNDEFINED)
-
-libevolution_calendar_a11y_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
- $(top_builddir)/a11y/libevolution-a11y.la \
- $(EVOLUTION_CALENDAR_LIBS)
-
--include $(top_srcdir)/git.mk
diff --git a/a11y/e-table/Makefile.am b/a11y/e-table/Makefile.am
deleted file mode 100644
index 413a37d97e..0000000000
--- a/a11y/e-table/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/widgets \
- $(E_UTIL_CFLAGS) \
- $(GNOME_PLATFORM_CFLAGS) \
- -DG_LOG_DOMAIN=\"e-table\"
-
-noinst_LTLIBRARIES = libgal-a11y-etable.la
-
-libgal_a11y_etable_la_SOURCES = \
- gal-a11y-e-tree.c \
- gal-a11y-e-tree-factory.c \
- gal-a11y-e-cell.c \
- gal-a11y-e-cell-text.c \
- gal-a11y-e-cell-tree.c \
- gal-a11y-e-cell-toggle.c \
- gal-a11y-e-cell-popup.c \
- gal-a11y-e-cell-registry.c \
- gal-a11y-e-cell-vbox.c \
- gal-a11y-e-table.c \
- gal-a11y-e-table-item.c \
- gal-a11y-e-table-item-factory.c \
- gal-a11y-e-table-click-to-add.c \
- gal-a11y-e-table-column-header.c \
- gal-a11y-e-table-click-to-add-factory.c \
- gal-a11y-e-table-factory.c \
- gal-a11y-e-tree.h \
- gal-a11y-e-tree-factory.h \
- gal-a11y-e-cell.h \
- gal-a11y-e-cell-text.h \
- gal-a11y-e-cell-tree.h \
- gal-a11y-e-cell-toggle.h \
- gal-a11y-e-cell-popup.h \
- gal-a11y-e-cell-registry.h \
- gal-a11y-e-cell-vbox.h \
- gal-a11y-e-table.h \
- gal-a11y-e-table-item.h \
- gal-a11y-e-table-click-to-add-factory.h \
- gal-a11y-e-table-click-to-add.h \
- gal-a11y-e-table-column-header.h \
- gal-a11y-e-table-item-factory.h \
- gal-a11y-e-table-factory.h
-
--include $(top_srcdir)/git.mk
diff --git a/a11y/e-text/Makefile.am b/a11y/e-text/Makefile.am
deleted file mode 100644
index 069284a617..0000000000
--- a/a11y/e-text/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/widgets \
- $(GNOME_PLATFORM_CFLAGS) \
- -DG_LOG_DOMAIN=\"e-text\"
-
-noinst_LTLIBRARIES = libgal-a11y-etext.la
-
-libgal_a11y_etext_la_SOURCES = \
- gal-a11y-e-text-factory.c \
- gal-a11y-e-text.c \
- gal-a11y-e-text-factory.h \
- gal-a11y-e-text.h
-
--include $(top_srcdir)/git.mk
diff --git a/a11y/widgets/Makefile.am b/a11y/widgets/Makefile.am
deleted file mode 100644
index e822094500..0000000000
--- a/a11y/widgets/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-
-# for debug
-#A11Y_CFLAGS += -pedantic -ansi -DACC_DEBUG -Werror
-
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = $(top_builddir)/win32/libemiscwidgets.la
-endif
-
-privsolib_LTLIBRARIES = libevolution-widgets-a11y.la
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"evolution-a11y\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/a11y \
- -I$(top_srcdir)/widgets \
- $(E_WIDGETS_CFLAGS)
-
-libevolution_widgets_a11y_la_SOURCES = \
- ea-calendar-item.c \
- ea-calendar-item.h \
- ea-calendar-cell.c \
- ea-calendar-cell.h \
- ea-combo-button.c \
- ea-combo-button.h \
- ea-widgets.c \
- ea-widgets.h
-
-libevolution_widgets_a11y_la_LDFLAGS = $(NO_UNDEFINED)
-
-libevolution_widgets_a11y_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
- $(top_builddir)/a11y/libevolution-a11y.la \
- $(top_builddir)/e-util/libeutil.la \
- $(E_WIDGETS_LIBS)
-
--include $(top_srcdir)/git.mk
diff --git a/a11y/widgets/ea-combo-button.c b/a11y/widgets/ea-combo-button.c
deleted file mode 100644
index c5180c3927..0000000000
--- a/a11y/widgets/ea-combo-button.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Harry Lu <harry.lu@sun.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include <config.h>
-#include "ea-combo-button.h"
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-static AtkObjectClass *parent_class;
-static GType parent_type;
-
-/*Action IDs */
-enum {
- ACTIVATE_DEFAULT,
- POPUP_MENU,
- LAST_ACTION
-};
-
-/* Static functions */
-static G_CONST_RETURN gchar*
-ea_combo_button_get_name (AtkObject *a11y)
-{
- GtkWidget *widget;
- GtkWidget *label;
- EComboButton *button;
-
- widget = GTK_ACCESSIBLE (a11y)->widget;
- if (!widget)
- return NULL;
-
- button = E_COMBO_BUTTON (widget);
- label = e_combo_button_get_label (button);
- if (label)
- return gtk_label_get_text (GTK_LABEL (label));
-
- return _("Combo Button");
-}
-
-/* Action interface */
-static G_CONST_RETURN gchar *
-ea_combo_button_action_get_name (AtkAction *action, gint i)
-{
- switch (i)
- {
- case ACTIVATE_DEFAULT:
- return _("Activate Default");
- case POPUP_MENU:
- return _("Popup Menu");
- default:
- return NULL;
- }
-}
-
-static gboolean
-ea_combo_button_do_action (AtkAction *action,
- gint i)
-{
- GtkWidget *widget;
- EComboButton *button;
-
- widget = GTK_ACCESSIBLE (action)->widget;
- if (!widget || !GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
- return FALSE;
-
- button = E_COMBO_BUTTON (widget);
-
- switch (i)
- {
- case ACTIVATE_DEFAULT:
- g_signal_emit_by_name (button, "activate_default");
- return TRUE;
- case POPUP_MENU:
- return e_combo_button_popup_menu (button);
- default:
- return FALSE;
- }
-}
-
-static gint
-ea_combo_button_get_n_actions (AtkAction *action)
-{
- return LAST_ACTION;
-}
-
-static void
-atk_action_interface_init (AtkActionIface *iface)
-{
- g_return_if_fail (iface != NULL);
-
- iface->do_action = ea_combo_button_do_action;
- iface->get_n_actions = ea_combo_button_get_n_actions;
- iface->get_name = ea_combo_button_action_get_name;
-}
-
-static void
-ea_combo_button_class_init (EaComboButtonClass *klass)
-{
- AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (parent_type);
-
- atk_object_class->get_name = ea_combo_button_get_name;
-}
-
-static void
-ea_combo_button_init (EaComboButton *a11y)
-{
- /* Empty for now */
-}
-
-GType
-ea_combo_button_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- AtkObjectFactory *factory;
- GTypeQuery query;
-
- GTypeInfo info = {
- sizeof (EaComboButtonClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) ea_combo_button_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EaComboButton),
- 0,
- (GInstanceInitFunc) ea_combo_button_init,
- NULL /* value_tree */
- };
-
- static const GInterfaceInfo atk_action_info = {
- (GInterfaceInitFunc) atk_action_interface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
-
- factory = atk_registry_get_factory (atk_get_default_registry (), GTK_TYPE_BUTTON);
- parent_type = atk_object_factory_get_accessible_type (factory);
- g_type_query (parent_type, &query);
-
- info.class_size = query.class_size;
- info.instance_size = query.instance_size;
-
- type = g_type_register_static (parent_type, "EaComboButton", &info, 0);
- g_type_add_interface_static (type, ATK_TYPE_ACTION,
- &atk_action_info);
-
- }
-
- return type;
-}
-
-AtkObject *
-ea_combo_button_new (GtkWidget *widget)
-{
- EaComboButton *a11y;
-
- a11y = g_object_new (ea_combo_button_get_type (), NULL);
-
- GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget);
- ATK_OBJECT (a11y)->role = ATK_ROLE_PUSH_BUTTON;
-
- return ATK_OBJECT (a11y);
-}
diff --git a/a11y/widgets/ea-combo-button.h b/a11y/widgets/ea-combo-button.h
deleted file mode 100644
index 2b5d0aa3ca..0000000000
--- a/a11y/widgets/ea-combo-button.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Harry Lu <harry.lu@sun.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef __EA_COMBO_BUTTON_H_
-#define __EA_COMBO_BUTTON_H_
-
-#include <gtk/gtk.h>
-#include <misc/e-combo-button.h>
-
-#define EA_TYPE_COMBO_BUTTON (ea_combo_button_get_type ())
-#define EA_COMBO_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_COMBO_BUTTON, EaComboButton))
-#define EA_COMBO_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_COMBO_BUTTON, EaComboButtonClass))
-#define EA_IS_COMBO_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_COMBO_BUTTON))
-#define EA_IS_COMBO_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_COMBO_BUTTON))
-
-typedef struct _EaComboButton EaComboButton;
-typedef struct _EaComboButtonClass EaComboButtonClass;
-
-struct _EaComboButton {
- GtkAccessible object;
-};
-
-struct _EaComboButtonClass {
- GtkAccessibleClass parent_class;
-};
-
-
-/* Standard Glib function */
-GType ea_combo_button_get_type (void);
-AtkObject *ea_combo_button_new (GtkWidget *combo_button);
-
-#endif /* ! __EA_COMBO_BUTTON_H_ */
diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c
index aa7bb74c6a..8dd03b3e75 100644
--- a/addressbook/conduit/address-conduit.c
+++ b/addressbook/conduit/address-conduit.c
@@ -29,7 +29,6 @@
#define G_LOG_DOMAIN "eaddrconduit"
-#include <bonobo.h>
#include <libxml/parser.h>
#include <pi-source.h>
#include <pi-socket.h>
diff --git a/addressbook/gui/Makefile.am b/addressbook/gui/Makefile.am
index 64bcd98356..73c12f9bf2 100644
--- a/addressbook/gui/Makefile.am
+++ b/addressbook/gui/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS = merging contact-editor contact-list-editor widgets component
+SUBDIRS = merging widgets contact-editor contact-list-editor component
-include $(top_srcdir)/git.mk
diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in b/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in
deleted file mode 100644
index 823d5bd89f..0000000000
--- a/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in
+++ /dev/null
@@ -1,136 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@"
- type="shlib"
- location="@COMPONENTDIR_IN_SERVER_FILE@/libevolution-addressbook@SOEXT@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Address Book"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_VCard_Control:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Control:1.0"/>
- <item value="IDL:Bonobo/PersistStream:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
- <item value="text/vcard"/>
- <item value="text/x-vcard"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Address Book card viewer"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Component:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/Component:@VERSION@"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Address Book component"/>
-
- <oaf_attribute name="evolution:component_alias" type="string" value="contacts"/>
-
- <oaf_attribute name="evolution:menu_label" type="string" _value="C_ontacts"/>
- <oaf_attribute name="evolution:menu_accelerator" type="string" value="*Control*2"/>
- <oaf_attribute name="evolution:button_label" type="string" _value="Contacts"/>
- <oaf_attribute name="evolution:button_tooltips" type="string" _value="Contacts"/>
- <oaf_attribute name="evolution:button_sort_order" type="string" value="-9"/>
- <oaf_attribute name="evolution:button_icon" type="string" value="x-office-address-book"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_AddressWidget:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:BonoboControl/address-widget:@VERSION@"/>
- <item value="IDL:GNOME/Control:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Address Book address viewer"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_AddressPopup:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:BonoboControl/address-widget:@VERSION@"/>
- <item value="IDL:GNOME/Control:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Address Book address popup"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_SMime_CertificateManager_ConfigControl:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/ConfigControl:@VERSION@"/>
- </oaf_attribute>
-
- <oaf_attribute name="evolution2:config_item:title" type="string"
- _value="Certificates"/>
-
- <oaf_attribute name="evolution2:config_item:description" type="string"
- _value="Manage your S/MIME certificates here"/>
-
- <oaf_attribute name="evolution2:config_item:icon_name" type="string"
- value="preferences-certificates"/>
-
- <oaf_attribute name="evolution2:config_item:priority" type="string" value="-6"/>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution S/MIME Certificate Management Control"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Autocompletion_ConfigControl:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/ConfigControl:@VERSION@"/>
- </oaf_attribute>
-
- <oaf_attribute name="evolution2:config_item:title" type="string"
- _value="Autocompletion"/>
-
- <oaf_attribute name="evolution2:config_item:description" type="string"
- _value="Configure autocomplete here"/>
-
- <oaf_attribute name="evolution2:config_item:icon_name" type="string"
- value="preferences-autocompletion"/>
-
- <oaf_attribute name="evolution2:config_item:type" type="stringv">
- <item value="contacts"/>
- </oaf_attribute>
-
- <oaf_attribute name="evolution2:config_item:priority" type="string" value="-9"/>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution folder settings configuration control"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
index b7870eddc7..42b22639dc 100644
--- a/addressbook/gui/component/Makefile.am
+++ b/addressbook/gui/component/Makefile.am
@@ -1,19 +1,18 @@
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = $(top_builddir)/win32/libevolution-mail.la
-endif
-
INCLUDES = \
-DG_LOG_DOMAIN=\"evolution-addressbook\" \
-I$(top_srcdir) \
-I$(top_srcdir)/widgets \
-I$(top_srcdir)/shell \
-I$(top_builddir)/shell \
+ -I$(top_srcdir)/widgets/menus \
-I$(top_srcdir)/widgets/misc \
-I$(top_srcdir)/addressbook/util \
-I$(top_srcdir)/addressbook/gui/contact-editor \
-I$(top_srcdir)/addressbook/gui/contact-list-editor \
-I$(top_srcdir)/addressbook/gui/widgets \
-I$(top_srcdir)/a11y/addressbook \
+ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
+ -DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
-DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \
@@ -21,32 +20,39 @@ INCLUDES = \
$(LDAP_CFLAGS) \
$(EVOLUTION_ADDRESSBOOK_CFLAGS)
-component_LTLIBRARIES = libevolution-addressbook.la
-
-libevolution_addressbook_la_SOURCES = \
- addressbook-component.c \
- addressbook-component.h \
- addressbook-config.c \
- addressbook-config.h \
- addressbook-migrate.c \
- addressbook-migrate.h \
- autocompletion-config.c \
- autocompletion-config.h \
- addressbook.c \
- addressbook.h \
- addressbook-view.c \
- addressbook-view.h \
- component-factory.c
-
-# $(top_builddir)/addressbook/printing/libecontactprint.la
+module_LTLIBRARIES = libevolution-module-addressbook.la
+
+libevolution_module_addressbook_la_SOURCES = \
+ evolution-module-addressbook.c \
+ addressbook-config.c \
+ addressbook-config.h \
+ autocompletion-config.c \
+ autocompletion-config.h \
+ eab-composer-util.c \
+ eab-composer-util.h \
+ e-book-shell-backend.c \
+ e-book-shell-backend.h \
+ e-book-shell-content.c \
+ e-book-shell-content.h \
+ e-book-shell-migrate.c \
+ e-book-shell-migrate.h \
+ e-book-shell-sidebar.c \
+ e-book-shell-sidebar.h \
+ e-book-shell-view.c \
+ e-book-shell-view.h \
+ e-book-shell-view-actions.c \
+ e-book-shell-view-actions.h \
+ e-book-shell-view-private.c \
+ e-book-shell-view-private.h
if ENABLE_SMIME
SMIME_LIB=$(top_builddir)/smime/gui/libevolution-smime.la
endif
-libevolution_addressbook_la_LIBADD = \
+libevolution_module_addressbook_la_LIBADD = \
$(SMIME_LIB) \
$(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/composer/libcomposer.la \
$(top_builddir)/addressbook/printing/libecontactprint.la \
$(top_builddir)/shell/libeshell.la \
$(top_builddir)/addressbook/gui/merging/libeabbookmerging.la \
@@ -58,15 +64,13 @@ libevolution_addressbook_la_LIBADD = \
$(top_builddir)/widgets/table/libetable.la \
$(top_builddir)/widgets/text/libetext.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
- $(top_builddir)/widgets/misc/libefilterbar.la \
$(top_builddir)/widgets/menus/libmenus.la \
- $(top_builddir)/a11y/addressbook/libevolution-addressbook-a11y.la \
$(top_builddir)/addressbook/importers/libevolution-addressbook-importers.la \
- $(WIN32_BOOTSTRAP_LIBS) \
$(EVOLUTION_ADDRESSBOOK_LIBS) $(LDAP_LIBS)
-libevolution_addressbook_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
+libevolution_module_addressbook_la_LDFLAGS = \
+ -module -avoid-version $(NO_UNDEFINED)
# GConf schemas
@@ -94,23 +98,14 @@ install-data-local:
fi
endif
-server_in_files = GNOME_Evolution_Addressbook.server.in.in
-server_DATA = $(server_in_files:.server.in.in=.server)
-@EVO_SERVER_RULE@
-@INTLTOOL_SERVER_RULE@
-
glade_DATA = \
ldap-config.glade
-BUILT_SOURCES = $(server_DATA)
-CLEANFILES = $(BUILT_SOURCES)
-
DISTCLEANFILES = $(schema_DATA)
EXTRA_DIST = \
$(glade_DATA) \
$(schema_in_files) \
- $(server_in_files) \
openldap-extract.h
dist-hook:
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
deleted file mode 100644
index 2c1d5caa9b..0000000000
--- a/addressbook/gui/component/addressbook-component.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-/* EPFIXME: Add autocompletion setting. */
-
-#include <config.h>
-
-#include "addressbook-component.h"
-#include "addressbook-config.h"
-#include "addressbook-migrate.h"
-#include "addressbook-view.h"
-#include "addressbook/gui/contact-editor/eab-editor.h"
-#include "addressbook/gui/widgets/eab-gui-util.h"
-#include "e-util/e-plugin.h"
-#include "e-util/e-import.h"
-#include "addressbook/gui/widgets/eab-popup.h"
-#include "addressbook/gui/widgets/eab-menu.h"
-#include "addressbook/gui/widgets/eab-config.h"
-#include "addressbook/importers/evolution-addressbook-importers.h"
-
-#include "misc/e-task-bar.h"
-#include "misc/e-info-label.h"
-
-#include "shell/e-component-view.h"
-
-#include <string.h>
-#include <gtk/gtk.h>
-#include <glib/gi18n-lib.h>
-#include <gconf/gconf-client.h>
-#include <e-util/e-util.h>
-#include <libedataserver/e-url.h>
-
-#ifdef ENABLE_SMIME
-#include "smime/gui/component.h"
-#endif
-
-#define LDAP_BASE_URI "ldap://"
-#define PERSONAL_RELATIVE_URI "system"
-
-#define PARENT_TYPE bonobo_object_get_type ()
-static BonoboObjectClass *parent_class = NULL;
-
-struct _AddressbookComponentPrivate {
- GConfClient *gconf_client;
- char *base_directory;
- GList *views;
-};
-
-static void
-ensure_sources (AddressbookComponent *component)
-{
- ESourceList *source_list;
- ESourceGroup *on_this_computer;
- ESource *personal_source;
- char *base_uri, *base_uri_proto, base_uri_proto_seventh;
- const gchar *base_dir;
-
- personal_source = NULL;
-
- if (!e_book_get_addressbooks (&source_list, NULL)) {
- g_warning ("Could not get addressbook source list from GConf!");
- return;
- }
-
- base_dir = addressbook_component_peek_base_directory (component);
- base_uri = g_build_filename (base_dir, "local", NULL);
-
- base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
- if (strlen (base_uri_proto) >= 7) {
- /* compare only file:// part. If user home dir name changes we do not want to create
- one more group */
- base_uri_proto_seventh = base_uri_proto[7];
- base_uri_proto[7] = 0;
- } else {
- base_uri_proto_seventh = -1;
- }
-
- on_this_computer = e_source_list_ensure_group (source_list, _("On This Computer"), base_uri_proto, TRUE);
- e_source_list_ensure_group (source_list, _("On LDAP Servers"), LDAP_BASE_URI, FALSE);
-
- if (base_uri_proto_seventh != -1) {
- base_uri_proto[7] = base_uri_proto_seventh;
- }
-
- if (on_this_computer) {
- /* make sure "Personal" shows up as a source under
- this group */
- GSList *sources = e_source_group_peek_sources (on_this_computer);
- GSList *s;
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
- const gchar *relative_uri;
-
- relative_uri = e_source_peek_relative_uri (source);
- if (relative_uri == NULL)
- continue;
- if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
- personal_source = source;
- break;
- }
- }
- /* Make sure we have the correct base uri. This can change when user's
- homedir name changes */
- if (strcmp (base_uri_proto, e_source_group_peek_base_uri (on_this_computer))) {
- e_source_group_set_base_uri (on_this_computer, base_uri_proto);
-
- /* *sigh* . We shouldn't need this sync call here as set_base_uri
- call results in synching to gconf, but that happens in idle loop
- and too late to prevent user seeing "Can not Open ... because of invalid uri" error.*/
- e_source_list_sync (source_list,NULL);
- }
- }
-
- if (personal_source) {
- /* ensure the source name is in current locale, not read from configuration */
- e_source_set_name (personal_source, _("Personal"));
- } else {
- /* Create the default Person addressbook */
- ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
- e_source_group_add_source (on_this_computer, source, -1);
- g_object_unref (source);
-
- e_source_set_property (source, "completion", "true");
-
- personal_source = source;
- }
-
- g_object_unref (on_this_computer);
- g_free (base_uri_proto);
- g_free (base_uri);
-}
-
-static void
-view_destroyed_cb (gpointer data, GObject *where_the_object_was)
-{
- AddressbookComponent *addressbook_component = data;
- AddressbookComponentPrivate *priv;
- GList *l;
-
- priv = addressbook_component->priv;
-
- for (l = priv->views; l; l = l->next) {
- AddressbookView *view = l->data;
- if (G_OBJECT (view) == where_the_object_was) {
- priv->views = g_list_remove (priv->views, view);
- break;
- }
- }
-}
-
-/* Evolution::Component CORBA methods. */
-
-static GNOME_Evolution_ComponentView
-impl_createView (PortableServer_Servant servant,
- GNOME_Evolution_ShellView parent,
- CORBA_boolean select_item,
- CORBA_Environment *ev)
-{
- AddressbookComponent *addressbook_component = ADDRESSBOOK_COMPONENT (bonobo_object_from_servant (servant));
- AddressbookComponentPrivate *priv = addressbook_component->priv;
- AddressbookView *view = addressbook_view_new ();
- EComponentView *component_view;
-
- g_object_weak_ref (G_OBJECT (view), view_destroyed_cb, addressbook_component);
- priv->views = g_list_append (priv->views, view);
-
- component_view = e_component_view_new_controls (parent, "contacts",
- bonobo_control_new (addressbook_view_peek_sidebar (view)),
- addressbook_view_peek_folder_view (view),
- bonobo_control_new (addressbook_view_peek_statusbar (view)));
-
- return BONOBO_OBJREF(component_view);
-
-}
-
-static GNOME_Evolution_CreatableItemTypeList *
-impl__get_userCreatableItems (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GNOME_Evolution_CreatableItemTypeList *list = GNOME_Evolution_CreatableItemTypeList__alloc ();
-
- list->_length = 3;
- list->_maximum = list->_length;
- list->_buffer = GNOME_Evolution_CreatableItemTypeList_allocbuf (list->_length);
-
- CORBA_sequence_set_release (list, FALSE);
-
- list->_buffer[0].id = (char *) "contact";
- list->_buffer[0].description = _("New Contact");
- list->_buffer[0].menuDescription = (char *) C_("New", "_Contact");
- list->_buffer[0].tooltip = _("Create a new contact");
- list->_buffer[0].menuShortcut = 'c';
- list->_buffer[0].iconName = (char *) "contact-new";
- list->_buffer[0].type = GNOME_Evolution_CREATABLE_OBJECT;
-
- list->_buffer[1].id = (char *) "contact_list";
- list->_buffer[1].description = _("New Contact List");
- list->_buffer[1].menuDescription = (char *) C_("New", "Contact _List");
- list->_buffer[1].tooltip = _("Create a new contact list");
- list->_buffer[1].menuShortcut = 'l';
- list->_buffer[1].iconName = (char *) "stock_contact-list";
- list->_buffer[1].type = GNOME_Evolution_CREATABLE_OBJECT;
-
- list->_buffer[2].id = (char *) "address_book";
- list->_buffer[2].description = _("New Address Book");
- list->_buffer[2].menuDescription = (char *) C_("New", "Address _Book");
- list->_buffer[2].tooltip = _("Create a new address book");
- list->_buffer[2].menuShortcut = '\0';
- list->_buffer[2].iconName = (char *) "address-book-new";
- list->_buffer[2].type = GNOME_Evolution_CREATABLE_FOLDER;
-
- return list;
-}
-
-static void
-book_loaded_cb (EBook *book, EBookStatus status, gpointer data)
-{
- EContact *contact;
- char *item_type_name = data;
-
- if (status != E_BOOK_ERROR_OK) {
- /* XXX we really need a dialog here, but we don't have
- access to the ESource so we can't use
- eab_load_error_dialog. fun! */
- return;
- }
-
- contact = e_contact_new ();
-
- if (!strcmp (item_type_name, "contact")) {
- eab_show_contact_editor (book, contact, TRUE, TRUE);
- }
- else if (!strcmp (item_type_name, "contact_list")) {
- eab_show_contact_list_editor (book, contact, TRUE, TRUE);
- }
-
- g_object_unref (book);
- g_object_unref (contact);
-
- g_free (item_type_name);
-}
-
-static void
-impl_requestCreateItem (PortableServer_Servant servant,
- const CORBA_char *item_type_name,
- CORBA_Environment *ev)
-{
- EBook *book;
- GConfClient *gconf_client;
- ESourceList *source_list;
- char *uid;
-
- if (!item_type_name ||
- (strcmp (item_type_name, "address_book") &&
- strcmp (item_type_name, "contact") &&
- strcmp (item_type_name, "contact_list"))) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UnknownType, NULL);
- return;
- }
-
- if (!strcmp (item_type_name, "address_book")) {
- addressbook_config_create_new_source (NULL);
- return;
- }
-
- gconf_client = gconf_client_get_default();
- uid = gconf_client_get_string (gconf_client, "/apps/evolution/addressbook/display/primary_addressbook",
- NULL);
- g_object_unref (gconf_client);
- if (!e_book_get_addressbooks (&source_list, NULL)) {
- g_warning ("Could not get addressbook source list from GConf!");
- g_free (uid);
- return;
- }
- if (uid) {
- ESource *source = e_source_list_peek_source_by_uid(source_list, uid);
- if (source) {
- book = e_book_new (source, NULL);
- }
- else {
- book = e_book_new_default_addressbook (NULL);
- }
- g_free (uid);
- }
- else {
- book = e_book_new_default_addressbook (NULL);
- }
-
- e_book_async_open (book, FALSE, book_loaded_cb, g_strdup (item_type_name));
-}
-
-static void
-impl_handleURI (PortableServer_Servant servant,
- const char* uri,
- CORBA_Environment *ev)
-{
- AddressbookComponent *addressbook_component = ADDRESSBOOK_COMPONENT (bonobo_object_from_servant (servant));
- AddressbookComponentPrivate *priv;
- AddressbookView *view = NULL;
-
- GList *l;
- char *src_uid = NULL;
- char *contact_uid = NULL;
-
- priv = addressbook_component->priv;
- l = g_list_last (priv->views);
- if (!l)
- return;
-
- view = l->data;
-
- if (!strncmp (uri, "contacts:", 9)) {
- EUri *euri = e_uri_new (uri);
- const char *p;
- char *header, *content;
- size_t len, clen;
-
- p = euri->query;
- if (p) {
- while (*p) {
- len = strcspn (p, "=&");
-
- /* If it's malformed, give up. */
- if (p[len] != '=')
- break;
-
- header = (char *) p;
- header[len] = '\0';
- p += len + 1;
-
- clen = strcspn (p, "&");
-
- content = g_strndup (p, clen);
-
- if (!g_ascii_strcasecmp (header, "source-uid")) {
- src_uid = g_strdup (content);
- } else if (!g_ascii_strcasecmp (header, "contact-uid")) {
- contact_uid = g_strdup (content);
- }
-
- g_free (content);
-
- p += clen;
- if (*p == '&') {
- p++;
- if (!strcmp (p, "amp;"))
- p += 4;
- }
- }
-
- addressbook_view_edit_contact (view, src_uid, contact_uid);
-
- g_free (src_uid);
- g_free (contact_uid);
- }
- e_uri_free (euri);
- }
-
-}
-
-static void
-impl_upgradeFromVersion (PortableServer_Servant servant, short major, short minor, short revision, CORBA_Environment *ev)
-{
- GError *err = NULL;
-
- if (!addressbook_migrate (addressbook_component_peek (), major, minor, revision, &err)) {
- GNOME_Evolution_Component_UpgradeFailed *failedex;
-
- failedex = GNOME_Evolution_Component_UpgradeFailed__alloc();
- failedex->what = CORBA_string_dup(_("Failed upgrading Address Book settings or folders."));
- failedex->why = CORBA_string_dup(err->message);
- CORBA_exception_set(ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UpgradeFailed, failedex);
- }
-
- if (err)
- g_error_free(err);
-}
-
-static CORBA_boolean
-impl_requestQuit (PortableServer_Servant servant, CORBA_Environment *ev)
-{
- return eab_editor_request_close_all ();
-}
-
-/* GObject methods. */
-
-static void
-impl_dispose (GObject *object)
-{
- AddressbookComponentPrivate *priv = ADDRESSBOOK_COMPONENT (object)->priv;
- GList *l;
-
- if (priv->gconf_client != NULL) {
- g_object_unref (priv->gconf_client);
- priv->gconf_client = NULL;
- }
-
- for (l = priv->views; l; l = l->next) {
- AddressbookView *view = l->data;
- g_object_weak_unref (G_OBJECT (view), view_destroyed_cb, ADDRESSBOOK_COMPONENT (object));
- }
- g_list_free (priv->views);
- priv->views = NULL;
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-impl_finalize (GObject *object)
-{
- AddressbookComponentPrivate *priv = ADDRESSBOOK_COMPONENT (object)->priv;
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-/* Initialization. */
-
-static void
-addressbook_component_class_init (AddressbookComponentClass *class)
-{
- POA_GNOME_Evolution_Component__epv *epv = &class->epv;
- GObjectClass *object_class = G_OBJECT_CLASS (class);
-
- bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-
- epv->createView = impl_createView;
- epv->_get_userCreatableItems = impl__get_userCreatableItems;
- epv->requestCreateItem = impl_requestCreateItem;
- epv->upgradeFromVersion = impl_upgradeFromVersion;
- epv->requestQuit = impl_requestQuit;
- epv->handleURI = impl_handleURI;
-
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
-
- parent_class = g_type_class_peek_parent (class);
-}
-
-static void
-addressbook_component_init (AddressbookComponent *component)
-{
- AddressbookComponentPrivate *priv;
- static int first = TRUE;
-
- priv = g_new0 (AddressbookComponentPrivate, 1);
-
- /* EPFIXME: Should use a custom one instead? */
- priv->gconf_client = gconf_client_get_default ();
-
- priv->base_directory = g_build_filename (e_get_user_data_dir (), "addressbook", NULL);
-
- component->priv = priv;
-
- ensure_sources (component);
-
-#ifdef ENABLE_SMIME
- smime_component_init ();
-#endif
-
- if (first) {
- EImportClass *klass;
-
- first = FALSE;
- e_plugin_hook_register_type(eab_popup_hook_get_type());
- e_plugin_hook_register_type(eab_menu_hook_get_type());
- e_plugin_hook_register_type(eab_config_hook_get_type());
-
- klass = g_type_class_ref(e_import_get_type());
- e_import_class_add_importer(klass, evolution_ldif_importer_peek(), NULL, NULL);
- e_import_class_add_importer(klass, evolution_vcard_importer_peek(), NULL, NULL);
- e_import_class_add_importer(klass, evolution_csv_outlook_importer_peek(), NULL, NULL);
- e_import_class_add_importer(klass, evolution_csv_mozilla_importer_peek(), NULL, NULL);
- e_import_class_add_importer(klass, evolution_csv_evolution_importer_peek(), NULL, NULL);
- }
-}
-
-
-/* Public API. */
-
-AddressbookComponent *
-addressbook_component_peek (void)
-{
- static AddressbookComponent *component = NULL;
-
- if (component == NULL)
- component = g_object_new (addressbook_component_get_type (), NULL);
-
- return component;
-}
-
-GConfClient*
-addressbook_component_peek_gconf_client (AddressbookComponent *component)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_COMPONENT (component), NULL);
-
- return component->priv->gconf_client;
-}
-
-const char *
-addressbook_component_peek_base_directory (AddressbookComponent *component)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_COMPONENT (component), NULL);
-
- return component->priv->base_directory;
-}
-
-BONOBO_TYPE_FUNC_FULL (AddressbookComponent, GNOME_Evolution_Component, PARENT_TYPE, addressbook_component)
diff --git a/addressbook/gui/component/addressbook-component.h b/addressbook/gui/component/addressbook-component.h
deleted file mode 100644
index 222ace82d7..0000000000
--- a/addressbook/gui/component/addressbook-component.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _ADDRESSBOOK_COMPONENT_H_
-#define _ADDRESSBOOK_COMPONENT_H_
-
-#include <bonobo/bonobo-object.h>
-
-#include "Evolution.h"
-#include "e-activity-handler.h"
-#include <libedataserver/e-source-list.h>
-
-#define ADDRESSBOOK_TYPE_COMPONENT (addressbook_component_get_type ())
-#define ADDRESSBOOK_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ADDRESSBOOK_TYPE_COMPONENT, AddressbookComponent))
-#define ADDRESSBOOK_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ADDRESSBOOK_TYPE_COMPONENT, AddressbookComponentClass))
-#define ADDRESSBOOK_IS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ADDRESSBOOK_TYPE_COMPONENT))
-#define ADDRESSBOOK_IS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), ADDRESSBOOK_TYPE_COMPONENT))
-
-
-typedef struct _AddressbookComponent AddressbookComponent;
-typedef struct _AddressbookComponentPrivate AddressbookComponentPrivate;
-typedef struct _AddressbookComponentClass AddressbookComponentClass;
-
-struct _AddressbookComponent {
- BonoboObject parent;
-
- AddressbookComponentPrivate *priv;
-};
-
-struct _AddressbookComponentClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Component__epv epv;
-};
-
-
-GType addressbook_component_get_type (void);
-
-AddressbookComponent *addressbook_component_peek (void);
-
-GConfClient *addressbook_component_peek_gconf_client (AddressbookComponent *component);
-const char *addressbook_component_peek_base_directory (AddressbookComponent *component);
-
-#endif /* _ADDRESSBOOK_COMPONENT_H_ */
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c
index ebb2d18b5d..c786a40a13 100644
--- a/addressbook/gui/component/addressbook-config.c
+++ b/addressbook/gui/component/addressbook-config.c
@@ -34,8 +34,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <bonobo/bonobo-generic-factory.h>
-
#ifdef G_OS_WIN32
/* Include <windows.h> early and work around DATADIR lossage */
#define DATADIR crap_DATADIR
@@ -46,7 +44,6 @@
#include <glade/glade.h>
#include "addressbook.h"
-#include "addressbook-component.h"
#include "addressbook-config.h"
#include "e-util/e-error.h"
@@ -72,8 +69,6 @@
#define LDAPS_PORT_STRING "636"
#define GLADE_FILE_NAME "ldap-config.glade"
-#define CONFIG_CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_ConfigControlFactory:" BASE_VERSION
-#define LDAP_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_LDAPStorage_ConfigControl:" BASE_VERSION
GtkWidget* supported_bases_create_table (char *name, char *string1, char *string2,
int num1, int num2);
diff --git a/addressbook/gui/component/addressbook-config.h b/addressbook/gui/component/addressbook-config.h
index e06e98f887..2814e8c839 100644
--- a/addressbook/gui/component/addressbook-config.h
+++ b/addressbook/gui/component/addressbook-config.h
@@ -24,7 +24,8 @@
#ifndef __ADDRESSBOOK_CONFIG_H__
#define __ADDRESSBOOK_CONFIG_H__
-#include "evolution-config-control.h"
+#include <gtk/gtk.h>
+#include <libedataserver/e-source.h>
typedef enum {
ADDRESSBOOK_LDAP_AUTH_NONE,
diff --git a/addressbook/gui/component/addressbook-view.c b/addressbook/gui/component/addressbook-view.c
deleted file mode 100644
index e6b99c6405..0000000000
--- a/addressbook/gui/component/addressbook-view.c
+++ /dev/null
@@ -1,1534 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <gdk/gdkkeysyms.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-exception.h>
-#include <e-util/e-util.h>
-#include <libedataserverui/e-source-selector.h>
-#include <libedataserverui/e-passwords.h>
-
-#include "e-util/e-error.h"
-#include "e-util/e-request.h"
-#include "misc/e-task-bar.h"
-#include "misc/e-info-label.h"
-
-#include "e-util/e-icon-factory.h"
-#include "e-util/e-util-private.h"
-#include "shell/e-user-creatable-items-handler.h"
-
-#include "evolution-shell-component-utils.h"
-#include "e-activity-handler.h"
-#include "e-contact-editor.h"
-#include "addressbook-config.h"
-#include "addressbook.h"
-#include "addressbook-view.h"
-#include "addressbook-component.h"
-#include "addressbook/gui/widgets/e-addressbook-view.h"
-#include "addressbook/gui/widgets/eab-gui-util.h"
-#include "addressbook/gui/merging/eab-contact-merging.h"
-#include "addressbook/printing/e-contact-print.h"
-#include "addressbook/util/eab-book-util.h"
-#include "addressbook/gui/widgets/eab-popup.h"
-#include "addressbook/gui/widgets/eab-menu.h"
-
-#define PARENT_TYPE G_TYPE_OBJECT
-static GObjectClass *parent_class = NULL;
-
-#define d(x)
-
-struct _AddressbookViewPrivate {
- GtkWidget *notebook;
- BonoboControl *folder_view_control;
-
- GtkWidget *statusbar_widget;
- EActivityHandler *activity_handler;
-
- GtkWidget *info_widget;
- GtkWidget *sidebar_widget;
- GtkWidget *selector;
-
- GConfClient *gconf_client;
-
- GHashTable *uid_to_view;
- GHashTable *uid_to_editor;
-
- EBook *book;
- guint activity_id;
- ESourceList *source_list;
- char *passwd;
- EUserCreatableItemsHandler *creatable_items_handler;
-
- EABMenu *menu;
-};
-
-enum DndTargetType {
- DND_TARGET_TYPE_VCARD_LIST,
- DND_TARGET_TYPE_SOURCE_VCARD_LIST
-};
-#define VCARD_TYPE "text/x-vcard"
-#define SOURCE_VCARD_TYPE "text/x-source-vcard"
-static GtkTargetEntry drag_types[] = {
- { (gchar *) SOURCE_VCARD_TYPE, 0, DND_TARGET_TYPE_SOURCE_VCARD_LIST },
- { (gchar *) VCARD_TYPE, 0, DND_TARGET_TYPE_VCARD_LIST }
-};
-static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]);
-
-static void set_status_message (EABView *eav, const char *message, AddressbookView *view);
-static void search_result (EABView *eav, EBookViewStatus status, AddressbookView *view);
-
-static void activate_source (AddressbookView *view, ESource *source);
-
-static void addressbook_view_init (AddressbookView *view);
-static void addressbook_view_class_init (AddressbookViewClass *klass);
-static void addressbook_view_dispose (GObject *object);
-
-static ESource *find_first_source (ESourceList *source_list);
-static ESource *get_primary_source (AddressbookView *view);
-
-typedef struct {
- GtkWidget *editor;
- char *uid;
- AddressbookView *view;
-} EditorUidClosure;
-
-static void
-editor_weak_notify (gpointer data, GObject *o)
-{
- EditorUidClosure *closure = data;
- AddressbookViewPrivate *priv = closure->view->priv;
-
- g_hash_table_remove (priv->uid_to_editor,
- closure->uid);
-}
-
-static EABView *
-get_current_view (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
-
- return EAB_VIEW (gtk_notebook_get_nth_page (GTK_NOTEBOOK (priv->notebook),
- gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->notebook))));
-}
-
-static void
-save_all_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
-
- if (v)
- eab_view_save_as (v, TRUE);
-}
-
-static void
-save_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_save_as(v, FALSE);
-}
-
-static void
-view_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_view(v);
-}
-
-static void
-delete_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_delete_selection(v, TRUE);
-}
-
-static void
-print_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_print (v, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-}
-
-static void
-print_preview_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_print (v, GTK_PRINT_OPERATION_ACTION_PREVIEW);
-}
-
-static void
-stop_loading_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_stop(v);
-}
-
-static void
-cut_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_cut(v);
-}
-
-static void
-copy_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_copy(v);
-}
-
-static void
-paste_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_paste(v);
-}
-
-static void
-select_all_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_select_all (v);
-}
-
-static void
-send_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_send (v);
-}
-
-static void
-send_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_send_to (v);
-}
-
-static void
-copy_all_contacts_to_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
-
- if (v)
- eab_view_copy_to_folder (v, TRUE);
-}
-
-static void
-copy_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_copy_to_folder (v, FALSE);
-}
-
-static void
-move_all_contacts_to_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_move_to_folder (v, TRUE);
-}
-
-static void
-move_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_move_to_folder (v, FALSE);
-}
-
-static void
-forget_passwords_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- e_passwords_forget_passwords();
-}
-
-static void
-new_addressbook_folder (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- addressbook_config_create_new_source (gtk_widget_get_toplevel(priv->notebook));
-}
-
-static void
-new_folder_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- new_addressbook_folder (view);
-}
-
-static void
-delete_addressbook_folder (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *selected_source;
- EBook *book;
- GError *error = NULL;
- GtkWindow *toplevel;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
- if (!selected_source)
- return;
- toplevel = (GtkWindow *) gtk_widget_get_toplevel (priv->notebook);
-
- if (e_error_run (toplevel, "addressbook:ask-delete-addressbook",
- e_source_peek_name(selected_source), NULL) != GTK_RESPONSE_YES)
- return;
-
- /* Remove local data */
- book = e_book_new (selected_source, &error);
- if (book) {
- if (e_book_remove (book, NULL)) {
- if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->selector),
- selected_source))
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->selector),
- selected_source);
-
- e_source_group_remove_source (e_source_peek_group (selected_source), selected_source);
-
- e_source_list_sync (priv->source_list, NULL);
- }
- else {
- e_error_run (toplevel, "addressbook:remove-addressbook", NULL);
- }
- g_object_unref (book);
- }
- else {
- g_warning ("error removing addressbook : %s", error->message);
- g_error_free (error);
- }
-}
-
-static void
-delete_folder_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- if (view)
- delete_addressbook_folder (view);
-
-}
-
-static void
-edit_addressbook_folder (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *selected_source;
- const char *uid;
- EditorUidClosure *closure;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
- if (!selected_source)
- return;
-
- uid = e_source_peek_uid (selected_source);
-
- closure = g_hash_table_lookup (priv->uid_to_editor, uid);
- if (!closure) {
- char *uid_copy = g_strdup (uid);
-
- closure = g_new (EditorUidClosure, 1);
- closure->editor = addressbook_config_edit_source (gtk_widget_get_toplevel(priv->notebook), selected_source);
- closure->uid = uid_copy;
- closure->view = view;
-
- g_hash_table_insert (priv->uid_to_editor,
- uid_copy,
- closure);
-
- g_object_weak_ref (G_OBJECT (closure->editor),
- editor_weak_notify, closure);
- }
-
- gtk_window_present (GTK_WINDOW (closure->editor));
-
-}
-
-static void
-edit_folder_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- if (view)
- edit_addressbook_folder (view);
-
-}
-
-static void
-rename_addressbook_folder (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *source;
- const char *old_name;
- char *prompt, *new_name;
- gboolean done = FALSE;
-
- source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
- old_name = e_source_peek_name(source);
- prompt = g_strdup_printf (_("Rename the \"%s\" folder to:"), old_name);
-
- while (!done) {
- new_name = e_request_string (NULL, _("Rename Folder"), prompt, old_name);
- if (new_name == NULL || !strcmp (old_name, new_name)) {
- done = TRUE;
- } else if (strchr(new_name, '/') != NULL) {
- e_error_run (NULL,
- "addressbook:no-rename-folder", old_name, new_name, _("Folder names cannot contain '/'"), NULL);
- done = TRUE;
- } else if (e_source_group_peek_source_by_name(e_source_peek_group(source), new_name)) {
- e_error_run (NULL, "addressbook:no-rename-folder-exists", old_name, new_name, NULL);
- } else {
- e_source_set_name (source, new_name);
- done = TRUE;
- }
- }
- g_free (new_name);
-
-}
-
-static void
-rename_folder_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- if (view)
- rename_addressbook_folder (view);
-}
-
-static gboolean
-folder_can_delete (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *source ;
- const char *source_uri;
-
- source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
- if(source) {
- source_uri = e_source_peek_relative_uri (source);
- if (source_uri && !strcmp("system", source_uri))
- return 0;
- else
- return 1;
- }
- else
- return 0;
-}
-
-static void
-set_status_message (EABView *eav, const char *message, AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- EActivityHandler *activity_handler = priv->activity_handler;
-
- if (!message || !*message) {
- if (priv->activity_id != 0) {
- e_activity_handler_operation_finished (activity_handler, priv->activity_id);
- priv->activity_id = 0;
- }
- } else if (priv->activity_id == 0) {
- char *clientid = g_strdup_printf ("%p", (gpointer) view);
-
- priv->activity_id = e_activity_handler_operation_started (
- activity_handler, clientid, message, TRUE);
-
- g_free (clientid);
- } else {
- e_activity_handler_operation_progressing (activity_handler, priv->activity_id, message, -1.0);
- }
-
-}
-
-static void
-set_folder_bar_message (EABView *eav, const char *message, AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- EABView *current_view = get_current_view (view);
-
- if (eav == current_view) {
- ESource *source = eav->source;
-
- if (source) {
- const char *name = e_source_peek_name (source);
-
- e_info_label_set_info((EInfoLabel*)priv->info_widget, name, message);
- }
- }
-}
-
-static void
-search_result (EABView *eav, EBookViewStatus status, AddressbookView *view)
-{
- eab_search_result_dialog (NULL /* XXX */, status);
-}
-
-static void
-update_command_state (EABView *eav, AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- BonoboUIComponent *uic;
- EABMenuTargetSelect *target;
-
- if (eav != get_current_view (view))
- return;
-
- g_object_ref (view);
-
- target = eab_view_get_menu_target(eav, priv->menu);
- e_menu_update_target((EMenu *)priv->menu, target);
-
- uic = bonobo_control_get_ui_component (priv->folder_view_control);
-
- /* TODO: this stuff can mostly be made to use the target bits instead */
-
- if (bonobo_ui_component_get_container (uic) != CORBA_OBJECT_NIL) {
-#define SET_SENSITIVE(verb,f) \
- bonobo_ui_component_set_prop (uic, (verb), "sensitive", (f)(eav) ? "1" : "0", NULL)
-
- SET_SENSITIVE ("/commands/ContactsSaveAsVCard", eab_view_can_save_as);
- SET_SENSITIVE ("/commands/ContactsView", eab_view_can_view);
-
- /* Print Contact */
- SET_SENSITIVE ("/commands/ContactsPrint", eab_view_can_print);
- SET_SENSITIVE ("/commands/ContactsPrintPreview", eab_view_can_print);
-
- /* Delete Contact */
- SET_SENSITIVE ("/commands/ContactDelete", eab_view_can_delete);
- SET_SENSITIVE ("/commands/ContactsCut", eab_view_can_cut);
-
- SET_SENSITIVE ("/commands/ContactsCopy", eab_view_can_copy);
- SET_SENSITIVE ("/commands/ContactsPaste", eab_view_can_paste);
- SET_SENSITIVE ("/commands/ContactsSelectAll", eab_view_can_select_all);
- SET_SENSITIVE ("/commands/ContactsSendContactToOther", eab_view_can_send);
- SET_SENSITIVE ("/commands/ContactsSendMessageToContact", eab_view_can_send_to);
- SET_SENSITIVE ("/commands/ContactsMoveToFolder", eab_view_can_move_to_folder);
- SET_SENSITIVE ("/commands/ContactsCopyToFolder", eab_view_can_copy_to_folder);
-
- bonobo_ui_component_set_prop (uic, ("/commands/FolderDelete"), "sensitive", folder_can_delete(view) ? "1" : "0", NULL);
-
- /* Stop */
- SET_SENSITIVE ("/commands/ContactStop", eab_view_can_stop);
-#undef SET_SENSITIVE
- }
-
- g_object_unref (view);
-}
-
-static BonoboUIVerb verbs [] = {
- BONOBO_UI_UNSAFE_VERB ("ContactsPrint", print_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsPrintPreview", print_preview_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsSaveAsVCard", save_contact_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsView", view_contact_cb),
-
- BONOBO_UI_UNSAFE_VERB ("ContactDelete", delete_contact_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactStop", stop_loading_cb),
-
- BONOBO_UI_UNSAFE_VERB ("ContactsCut", cut_contacts_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsCopy", copy_contacts_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsPaste", paste_contacts_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsSelectAll", select_all_contacts_cb),
-
- BONOBO_UI_UNSAFE_VERB ("ContactsSendContactToOther", send_contact_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsSendMessageToContact", send_contact_to_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsMoveToFolder", move_contact_to_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsCopyToFolder", copy_contact_to_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsForgetPasswords", forget_passwords_cb),
- /* ContactsViewPreview is a toggle */
-
- BONOBO_UI_UNSAFE_VERB ("FolderCreate", new_folder_cb),
- BONOBO_UI_UNSAFE_VERB ("FolderCopy", copy_all_contacts_to_cb),
- BONOBO_UI_UNSAFE_VERB ("FolderMove", move_all_contacts_to_cb),
- BONOBO_UI_UNSAFE_VERB ("FolderSave", save_all_contacts_cb),
- BONOBO_UI_UNSAFE_VERB ("FolderDelete", delete_folder_cb),
- BONOBO_UI_UNSAFE_VERB ("FolderRename", rename_folder_cb),
- BONOBO_UI_UNSAFE_VERB ("ChangeFolderProperties", edit_folder_cb),
-
- BONOBO_UI_VERB_END
-};
-
-static EPixmap pixmaps [] = {
- E_PIXMAP ("/commands/ChangeFolderProperties", "document-properties", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactDelete", "edit-delete", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsCopy", "edit-copy", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsCut", "edit-cut", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsPaste", "edit-paste", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsPrint", "document-print", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsPrintPreview", "document-print-preview", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsSaveAsVCard", "document-save-as", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsSendContactToOther", "mail-forward", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsSendMessageToContact", "mail-message-new", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/FolderCopy", "edit-copy", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/FolderDelete", "edit-delete", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/FolderMove", "folder-move", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/FolderSave", "document-save-as", GTK_ICON_SIZE_MENU),
-
- E_PIXMAP ("/Toolbar/ContactsPrint", "document-print", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/ContactDelete", "edit-delete", GTK_ICON_SIZE_LARGE_TOOLBAR),
-
- E_PIXMAP_END
-};
-
-static void
-control_activate (BonoboControl *control,
- BonoboUIComponent *uic,
- AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- Bonobo_UIContainer remote_ui_container;
- EABView *v = get_current_view (view);
- char *xmlfile;
-
- remote_ui_container = bonobo_control_get_remote_ui_container (control, NULL);
- bonobo_ui_component_set_container (uic, remote_ui_container, NULL);
- bonobo_object_release_unref (remote_ui_container, NULL);
-
- bonobo_ui_component_add_verb_list_with_data (
- uic, verbs, view);
-
- bonobo_ui_component_freeze (uic, NULL);
-
- xmlfile = g_build_filename (EVOLUTION_UIDIR,
- "evolution-addressbook.xml",
- NULL);
- bonobo_ui_util_set_ui (uic, PREFIX,
- xmlfile,
- "evolution-addressbook", NULL);
- g_free (xmlfile);
-
- if (v)
- eab_view_setup_menus (v, uic);
-
- e_pixmaps_update (uic, pixmaps);
-
- e_user_creatable_items_handler_activate (priv->creatable_items_handler, uic);
-
- bonobo_ui_component_thaw (uic, NULL);
-
- if (v)
- update_command_state (v, view);
-}
-
-static void
-control_activate_cb (BonoboControl *control,
- gboolean activate,
- AddressbookView *view)
-{
- BonoboUIComponent *uic;
- EABView *v = get_current_view (view);
-
- uic = bonobo_control_get_ui_component (control);
- g_return_if_fail (uic != NULL);
-
- if (activate) {
- control_activate (control, uic, view);
- e_menu_activate((EMenu *)view->priv->menu, uic, activate);
- if (activate && v && v->model)
- eab_model_force_folder_bar_message (v->model);
- } else {
- e_menu_activate((EMenu *)view->priv->menu, uic, activate);
- bonobo_ui_component_unset_container (uic, NULL);
- eab_view_discard_menus (v);
- }
-}
-
-static void
-gather_uids_foreach (char *key,
- gpointer value,
- GList **list)
-{
- (*list) = g_list_prepend (*list, key);
-}
-
-static void
-source_list_changed_cb (ESourceList *source_list, AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- GList *uids, *l;
- EABView *v;
-
- uids = NULL;
- g_hash_table_foreach (priv->uid_to_view, (GHFunc)gather_uids_foreach, &uids);
- for (l = uids; l; l = l->next) {
- char *uid = l->data;
- if (e_source_list_peek_source_by_uid (source_list, uid)) {
- /* the source still exists, do nothing */
- }
- else {
- /* the source no longer exists, remove its
- view remove it from our hash table. */
- v = g_hash_table_lookup (priv->uid_to_view,
- uid);
- gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook),
- gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook),
- GTK_WIDGET (v)));
- g_hash_table_remove (priv->uid_to_view, uid);
- }
- }
- g_list_free (uids);
-
- uids = NULL;
- g_hash_table_foreach (priv->uid_to_editor, (GHFunc)gather_uids_foreach, &uids);
- for (l = uids; l; l = l->next) {
- char *uid = l->data;
- if (e_source_list_peek_source_by_uid (source_list, uid)) {
- /* the source still exists, do nothing */
- }
- else {
- /* the source no longer exists, remove its
- editor remove it from our hash table. */
- EditorUidClosure *closure = g_hash_table_lookup (priv->uid_to_editor,
- uid);
- g_object_weak_unref (G_OBJECT (closure->editor),
- editor_weak_notify, closure);
- gtk_widget_destroy (closure->editor);
- g_hash_table_remove (priv->uid_to_editor, uid);
- }
- }
- g_list_free (uids);
-
- /* make sure we've got the current view selected and updated
- properly */
- v = get_current_view (view);
- if (v) {
- eab_view_setup_menus (v, bonobo_control_get_ui_component (priv->folder_view_control));
- update_command_state (v, view);
- }
-}
-
-static void
-load_uri_for_selection (ESourceSelector *selector,
- AddressbookView *view,
- gboolean force)
-{
- ESource *selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (selector));
- ESource *primary = get_primary_source (view);
-
- if (selected_source != NULL &&
- ((primary && (!g_str_equal (e_source_peek_uid (primary),e_source_peek_uid (selected_source) )))||force))
- activate_source (view, selected_source);
-}
-
-static ESource *
-find_first_source (ESourceList *source_list)
-{
- GSList *groups, *sources, *l, *m;
-
- groups = e_source_list_peek_groups (source_list);
- for (l = groups; l; l = l->next) {
- ESourceGroup *group = l->data;
-
- sources = e_source_group_peek_sources (group);
- for (m = sources; m; m = m->next) {
- ESource *source = m->data;
-
- return source;
- }
- }
-
- return NULL;
-}
-
-static void
-save_primary_selection (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *source;
-
- source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
- if (!source)
- return;
-
- /* Save the selection for next time we start up */
- gconf_client_set_string (priv->gconf_client,
- "/apps/evolution/addressbook/display/primary_addressbook",
- e_source_peek_uid (source), NULL);
-}
-
-static ESource *
-get_primary_source (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *source;
- char *uid;
-
- uid = gconf_client_get_string (priv->gconf_client,
- "/apps/evolution/addressbook/display/primary_addressbook",
- NULL);
- if (uid) {
- source = e_source_list_peek_source_by_uid (priv->source_list, uid);
- g_free (uid);
- } else {
- /* Try to create a default if there isn't one */
- source = find_first_source (priv->source_list);
- }
-
- return source;
-}
-
-static void
-load_primary_selection (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *source;
-
- source = get_primary_source (view);
- if (source)
- e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (priv->selector), source);
-}
-
-/* Folder popup menu callbacks */
-typedef struct {
- AddressbookView *view;
- ESource *selected_source;
- GtkWidget *toplevel;
-} BookRemovedClosure;
-
-static void
-book_removed (EBook *book, EBookStatus status, gpointer data)
-{
- BookRemovedClosure *closure = data;
- AddressbookView *view = closure->view;
- AddressbookViewPrivate *priv = view->priv;
- ESource *source = closure->selected_source;
- GtkWidget *toplevel = closure->toplevel;
-
- g_free (closure);
-
- g_object_unref (book);
-
- if (E_BOOK_ERROR_OK == status) {
- /* Remove source */
- if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->selector),
- source))
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->selector),
- source);
-
- e_source_group_remove_source (e_source_peek_group (source), source);
-
- e_source_list_sync (priv->source_list, NULL);
- }
- else {
- e_error_run (GTK_WINDOW (toplevel),
- "addressbook:remove-addressbook",
- NULL);
- }
-}
-
-static void
-delete_addressbook_cb(EPopup *ep, EPopupItem *pitem, void *data)
-{
- AddressbookView *view = data;
- AddressbookViewPrivate *priv = view->priv;
- ESource *selected_source;
- EBook *book;
- GError *error = NULL;
- GtkWindow *toplevel;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
- if (!selected_source)
- return;
-
- toplevel = (GtkWindow *)gtk_widget_get_toplevel(ep->target->widget);
-
- if (e_error_run (toplevel, "addressbook:ask-delete-addressbook", e_source_peek_name(selected_source), NULL) != GTK_RESPONSE_YES)
- return;
-
- /* Remove local data */
- book = e_book_new (selected_source, &error);
- if (book) {
- BookRemovedClosure *closure = g_new (BookRemovedClosure, 1);
-
- closure->toplevel = (GtkWidget *)toplevel;
- closure->view = view;
- closure->selected_source = selected_source;
-
- if (e_book_async_remove (book, book_removed, closure)) {
- e_error_run (toplevel, "addressbook:remove-addressbook", NULL);
- g_free (closure);
- g_object_unref (book);
- }
- }
-}
-
-static void
-new_addressbook_cb(EPopup *ep, EPopupItem *pitem, void *data)
-{
- addressbook_config_create_new_source (gtk_widget_get_toplevel(ep->target->widget));
-}
-
-static void
-rename_addressbook_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- AddressbookView *view = data;
- ESourceSelector *selector;
-
- selector = E_SOURCE_SELECTOR (view->priv->selector);
- e_source_selector_edit_primary_selection (selector);
-}
-
-static void
-save_addressbook_cb(EPopup *ep, EPopupItem *pitem, void *data)
-{
- AddressbookView *view = data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_save_as (v, TRUE);
-}
-
-static void
-edit_addressbook_cb(EPopup *ep, EPopupItem *pitem, void *data)
-{
- AddressbookView *view = data;
- if (view)
- edit_addressbook_folder (view);
-}
-
-/* Callbacks. */
-
-static void
-primary_source_selection_changed_callback (ESourceSelector *selector,
- AddressbookView *view)
-{
- load_uri_for_selection (selector, view, FALSE);
- save_primary_selection (view);
-}
-
-static EPopupItem abv_source_popups[] = {
- { E_POPUP_ITEM, (gchar *) "10.new", (gchar *) N_("_New Address Book"), new_addressbook_cb, NULL, (gchar *) "address-book-new", 0, 0 },
- { E_POPUP_ITEM, (gchar *) "20.saveasvcard", (gchar *) N_("Save As vCard..."), save_addressbook_cb, NULL, (gchar *) "document-save-as", 0, EAB_POPUP_SOURCE_PRIMARY },
- { E_POPUP_ITEM, (gchar *) "25.rename", (gchar *) N_("_Rename..."), rename_addressbook_cb, NULL, NULL, 0, EAB_POPUP_SOURCE_PRIMARY },
-
- { E_POPUP_BAR, (gchar *) "30.bar" },
- { E_POPUP_ITEM, (gchar *) "30.delete", (gchar *) N_("_Delete"), delete_addressbook_cb, NULL, (gchar *) "edit-delete", 0, EAB_POPUP_SOURCE_USER|EAB_POPUP_SOURCE_PRIMARY },
-
- { E_POPUP_BAR, (gchar *) "99.bar" },
- { E_POPUP_ITEM, (gchar *) "99.properties", (gchar *) N_("_Properties"), edit_addressbook_cb, NULL, (gchar *) "document-properties", 0, EAB_POPUP_SOURCE_PRIMARY },
-};
-
-static void
-abv_source_popup_free(EPopup *ep, GSList *list, void *data)
-{
- g_slist_free(list);
-}
-
-static gboolean
-popup_event_callback(ESourceSelector *selector, ESource *source, GdkEventButton *event, AddressbookView *view)
-{
- EABPopup *ep;
- EABPopupTargetSource *t;
- GSList *menus = NULL;
- int i;
- GtkMenu *menu;
-
- /** @HookPoint-EABPopup:Addressbook Source Selector Context Menu
- * @Id: org.gnome.evolution.addressbook.source.popup
- * @Class: org.gnome.evolution.addresbook.popup:1.0
- * @Target: EABPopupTargetSource
- *
- * The context menu on the source selector in the contacts window.
- */
-
- ep = eab_popup_new("org.gnome.evolution.addressbook.source.popup");
- t = eab_popup_target_new_source(ep, selector);
- t->target.widget = (GtkWidget *)view->priv->notebook;
-
- for (i=0;i<sizeof(abv_source_popups)/sizeof(abv_source_popups[0]);i++)
- menus = g_slist_prepend(menus, &abv_source_popups[i]);
-
- e_popup_add_items((EPopup *)ep, menus, NULL, abv_source_popup_free, view);
-
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event?event->button:0, event?event->time:gtk_get_current_event_time());
-
- return TRUE;
-}
-
-typedef struct
-{
- guint remove_from_source : 1;
- guint copy_done : 1;
- gint pending_removals;
-
- EContact *current_contact;
- GList *remaining_contacts;
-
- EBook *source_book;
- EBook *target_book;
-}
-MergeContext;
-
-static void
-destroy_merge_context (MergeContext *merge_context)
-{
- if (merge_context->source_book)
- g_object_unref (merge_context->source_book);
- if (merge_context->target_book)
- g_object_unref (merge_context->target_book);
-
- g_free (merge_context);
-}
-
-static void
-removed_contact_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- MergeContext *merge_context = closure;
-
- merge_context->pending_removals--;
-
- if (merge_context->copy_done && merge_context->pending_removals == 0) {
- /* Finished */
-
- destroy_merge_context (merge_context);
- }
-}
-
-static void
-merged_contact_cb (EBook *book, EBookStatus status, const char *id, gpointer closure)
-{
- MergeContext *merge_context = closure;
-
- if (merge_context->remove_from_source && status == E_BOOK_ERROR_OK) {
- /* Remove previous contact from source */
-
- e_book_async_remove_contact (merge_context->source_book, merge_context->current_contact,
- removed_contact_cb, merge_context);
- merge_context->pending_removals++;
- }
-
- g_object_unref (merge_context->current_contact);
-
- if (merge_context->remaining_contacts) {
- /* Copy next contact */
-
- merge_context->current_contact = merge_context->remaining_contacts->data;
- merge_context->remaining_contacts = g_list_delete_link (merge_context->remaining_contacts,
- merge_context->remaining_contacts);
- eab_merging_book_add_contact (merge_context->target_book, merge_context->current_contact,
- merged_contact_cb, merge_context);
- } else if (merge_context->pending_removals == 0) {
- /* Finished */
-
- destroy_merge_context (merge_context);
- } else {
- /* Finished, but have pending removals */
-
- merge_context->copy_done = TRUE;
- }
-}
-
-static gboolean
-selector_tree_data_dropped (ESourceSelector *selector,
- GtkSelectionData *data,
- ESource *destination,
- GdkDragAction action,
- guint info,
- AddressbookView *view)
-{
- EBook *source_book, *target_book;
- MergeContext *merge_context = NULL;
- GList *contactlist;
- EABView *v;
-
- target_book = e_book_new (destination, NULL);
- if (!target_book) {
- g_message (G_STRLOC ":Couldn't create EBook.");
- return FALSE;
- }
- e_book_open (target_book, FALSE, NULL);
-
- eab_book_and_contact_list_from_string ((char *)data->data, &source_book, &contactlist);
-
- v = get_current_view (view);
- g_object_get (v->model, "book",&source_book, NULL);
-
- /* Set up merge context */
-
- merge_context = g_new0 (MergeContext, 1);
-
- merge_context->source_book = source_book;
- merge_context->target_book = target_book;
-
- merge_context->current_contact = contactlist->data;
- merge_context->remaining_contacts = g_list_delete_link (contactlist, contactlist);
-
- merge_context->remove_from_source = action == GDK_ACTION_MOVE ? TRUE : FALSE;
-
- /* Start merge */
-
- eab_merging_book_add_contact (target_book, merge_context->current_contact,
- merged_contact_cb, merge_context);
-
- return TRUE;
-}
-
-static void
-destroy_callback(gpointer data, GObject *where_object_was)
-{
- AddressbookView *view = data;
- g_object_unref (view);
-}
-
-GType
-addressbook_view_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (AddressbookViewClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) addressbook_view_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EABView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) addressbook_view_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "AddressbookView", &info, 0);
- }
-
- return type;
-}
-
-static void
-addressbook_view_class_init (AddressbookViewClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = addressbook_view_dispose;
-
- parent_class = g_type_class_peek_parent (klass);
-}
-
-static gboolean
-source_selector_key_press_event_callback (GtkWidget *widget, GdkEventKey *event, AddressbookView *view)
-{
- if (event->keyval == GDK_Delete) {
- delete_addressbook_folder (view);
- return TRUE;
- }
- return FALSE;
-}
-
-static void
-addressbook_view_init (AddressbookView *view)
-{
- AddressbookViewPrivate *priv;
- GtkWidget *selector_scrolled_window;
- AtkObject *a11y;
-
- view->priv =
- priv = g_new0 (AddressbookViewPrivate, 1);
-
- priv->gconf_client = addressbook_component_peek_gconf_client (addressbook_component_peek ());
-
- priv->uid_to_view = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, (GDestroyNotify)g_object_unref);
- priv->uid_to_editor = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, (GDestroyNotify)g_free);
-
- priv->notebook = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
-
- g_object_weak_ref (G_OBJECT (priv->notebook), destroy_callback, view);
-
- /* Create the control. */
- priv->folder_view_control = bonobo_control_new (priv->notebook);
-
- gtk_widget_show (priv->notebook);
-
- e_book_get_addressbooks (&priv->source_list, NULL);
- g_signal_connect (priv->source_list,
- "changed",
- G_CALLBACK (source_list_changed_cb), view);
-
- priv->creatable_items_handler = e_user_creatable_items_handler_new ("contacts", NULL, NULL);
- priv->menu = eab_menu_new("org.gnome.evolution.addressbook.view");
-
- g_signal_connect (priv->folder_view_control, "activate",
- G_CALLBACK (control_activate_cb), view);
-
- priv->activity_handler = e_activity_handler_new ();
-
- priv->statusbar_widget = e_task_bar_new ();
- gtk_widget_show (priv->statusbar_widget);
-
- e_activity_handler_attach_task_bar (priv->activity_handler,
- E_TASK_BAR (priv->statusbar_widget));
-
- priv->info_widget = e_info_label_new("x-office-address-book");
- e_info_label_set_info((EInfoLabel*)priv->info_widget, _("Contacts"), "");
- gtk_widget_show (priv->info_widget);
-
- priv->selector = e_source_selector_new (priv->source_list);
-
- g_signal_connect (
- priv->selector, "data-dropped",
- G_CALLBACK (selector_tree_data_dropped), view);
- gtk_drag_dest_set (priv->selector, GTK_DEST_DEFAULT_ALL, drag_types, num_drag_types, GDK_ACTION_COPY | GDK_ACTION_MOVE);
- a11y = gtk_widget_get_accessible (GTK_WIDGET (priv->selector));
- atk_object_set_name (a11y, _("Contact Source Selector"));
-
- e_source_selector_show_selection (E_SOURCE_SELECTOR (priv->selector), FALSE);
- gtk_widget_show (priv->selector);
-
- selector_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (selector_scrolled_window), GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (selector_scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (selector_scrolled_window), priv->selector);
- gtk_widget_show (selector_scrolled_window);
-
- priv->sidebar_widget = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX (priv->sidebar_widget), priv->info_widget, FALSE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX (priv->sidebar_widget), selector_scrolled_window, TRUE, TRUE, 0);
- gtk_widget_show (priv->sidebar_widget);
-
- g_signal_connect_object (priv->selector, "primary_selection_changed",
- G_CALLBACK (primary_source_selection_changed_callback),
- G_OBJECT (view), 0);
- g_signal_connect_after (priv->selector, "key_press_event",
- G_CALLBACK (source_selector_key_press_event_callback),
- G_OBJECT (view));
- g_signal_connect_object (priv->selector, "popup_event",
- G_CALLBACK (popup_event_callback),
- G_OBJECT (view), 0);
-
- load_primary_selection (view);
- load_uri_for_selection (E_SOURCE_SELECTOR (priv->selector), view, TRUE);
-}
-
-static void
-destroy_editor (char *key,
- gpointer value,
- gpointer nada)
-{
- EditorUidClosure *closure = value;
-
- g_object_weak_unref (G_OBJECT (closure->editor),
- editor_weak_notify, closure);
-
- gtk_widget_destroy (GTK_WIDGET (closure->editor));
-}
-
-static void
-addressbook_view_dispose (GObject *object)
-{
- AddressbookView *view = ADDRESSBOOK_VIEW (object);
- AddressbookViewPrivate *priv = view->priv;
-
- if (view->priv) {
- if (priv->book)
- g_object_unref (priv->book);
-
- g_free(priv->passwd);
-
- if (priv->source_list)
- g_object_unref (priv->source_list);
-
- if (priv->uid_to_view)
- g_hash_table_destroy (priv->uid_to_view);
-
- if (priv->uid_to_editor) {
- g_hash_table_foreach (priv->uid_to_editor, (GHFunc)destroy_editor, NULL);
- g_hash_table_destroy (priv->uid_to_editor);
- }
-
- if (priv->creatable_items_handler)
- g_object_unref (priv->creatable_items_handler);
-
- if (priv->menu)
- g_object_unref (priv->menu);
-
- g_free (view->priv);
- view->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-typedef struct {
- EABView *view;
- ESource *source;
-} BookOpenData;
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- BookOpenData *data = closure;
- EABView *view = data->view;
- ESource *source = data->source;
-
- g_free (data);
-
- /* we always set the "source" property on the EABView, since
- we use it to reload a previously failed book. */
- g_object_set(view,
- "source", source,
- NULL);
-
- if (status == E_BOOK_ERROR_OK) {
- g_object_set(view,
- "book", book,
- NULL);
-
- if (view->model)
- eab_model_force_folder_bar_message (view->model);
- }
- else if (status != E_BOOK_ERROR_CANCELLED) {
- eab_load_error_dialog (NULL /* XXX */, source, status);
- }
-
-
- g_object_unref (source);
-}
-
-static void
-activate_source (AddressbookView *view,
- ESource *source)
-{
- AddressbookViewPrivate *priv = view->priv;
- const char *uid;
- GtkWidget *uid_view;
- EBook *book;
- BookOpenData *data;
-
- uid = e_source_peek_uid (source);
- uid_view = g_hash_table_lookup (priv->uid_to_view, uid);
-
- if (uid_view) {
- /* there is a view for this uid. make
- sure that the view actually
- contains an EBook (if it doesn't
- contain an EBook a previous load
- failed. try to load it again */
- g_object_get (uid_view,
- "book", &book,
- NULL);
-
- if (book) {
- g_object_unref (book);
- }
- else {
- g_object_get (uid_view,
- "source", &source,
- NULL);
-
- /* source can be NULL here, if
- a previous load hasn't
- actually made it to
- book_open_cb yet. */
- if (source) {
- book = e_book_new (source, NULL);
-
- if (!book) {
- g_object_unref (source);
- }
- else {
- data = g_new (BookOpenData, 1);
- data->view = g_object_ref (uid_view);
- data->source = source; /* transfer the ref we get back from g_object_get */
-
- addressbook_load (book, book_open_cb, data);
- }
- }
- }
- }
- else {
- /* we don't have a view for this uid already
- set up. */
- GtkWidget *label = gtk_label_new (uid);
- GError *error = NULL;
-
- uid_view = eab_view_new ();
-
- gtk_widget_show (uid_view);
- gtk_widget_show (label);
-
- g_object_set (uid_view, "type", EAB_VIEW_TABLE, NULL);
-
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
- uid_view,
- label);
-
- g_hash_table_insert (priv->uid_to_view, g_strdup (uid), uid_view);
-
- g_signal_connect (uid_view, "status_message",
- G_CALLBACK(set_status_message), view);
-
- g_signal_connect (uid_view, "search_result",
- G_CALLBACK(search_result), view);
-
- g_signal_connect (uid_view, "folder_bar_message",
- G_CALLBACK(set_folder_bar_message), view);
-
- g_signal_connect (uid_view, "command_state_change",
- G_CALLBACK(update_command_state), view);
-
- book = e_book_new (source, &error);
-
- if (book) {
- data = g_new (BookOpenData, 1);
- data->view = g_object_ref (uid_view);
- data->source = g_object_ref (source);
-
- addressbook_load (book, book_open_cb, data);
- }
- else {
- g_warning ("error loading addressbook : %s", error->message);
- g_error_free (error);
- }
- }
-
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook),
- gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook),
- uid_view));
-
- if (EAB_VIEW (uid_view)->model)
- eab_model_force_folder_bar_message (EAB_VIEW (uid_view)->model);
-
- /* change menus/toolbars to reflect the new view, assuming we are already displayed */
- if (bonobo_ui_component_get_container (bonobo_control_get_ui_component (priv->folder_view_control)) != CORBA_OBJECT_NIL) {
- eab_view_setup_menus (EAB_VIEW (uid_view), bonobo_control_get_ui_component (priv->folder_view_control));
- update_command_state (EAB_VIEW (uid_view), view);
- }
-}
-
-AddressbookView *
-addressbook_view_new (void)
-{
- return g_object_new (ADDRESSBOOK_TYPE_VIEW, NULL);
-}
-
-EActivityHandler*
-addressbook_view_peek_activity_handler (AddressbookView *view)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_VIEW (view), NULL);
-
- return view->priv->activity_handler;
-}
-
-GtkWidget*
-addressbook_view_peek_info_label (AddressbookView *view)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_VIEW (view), NULL);
-
- return view->priv->info_widget;
-}
-
-GtkWidget*
-addressbook_view_peek_sidebar (AddressbookView *view)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_VIEW (view), NULL);
-
- return view->priv->sidebar_widget;
-}
-
-GtkWidget*
-addressbook_view_peek_statusbar (AddressbookView *view)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_VIEW (view), NULL);
-
- return view->priv->statusbar_widget;
-}
-
-BonoboControl*
-addressbook_view_peek_folder_view (AddressbookView *view)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_VIEW (view), NULL);
-
- return view->priv->folder_view_control;
-}
-
-void
-addressbook_view_edit_contact (AddressbookView* view,
- const char* source_uid,
- const char* contact_uid)
-{
- AddressbookViewPrivate *priv = view->priv;
-
- ESource* source = NULL;
- EContact* contact = NULL;
- EBook* book = NULL;
-
- if (!source_uid || !contact_uid)
- return;
-
- source = e_source_list_peek_source_by_uid (priv->source_list, source_uid);
- if (!source)
- return;
-
- /* FIXME: Can I unref this book? */
- book = e_book_new (source, NULL);
- if (!book)
- return;
-
- if (!e_book_open (book, TRUE, NULL)) {
- g_object_unref (book);
- return;
- }
-
- e_book_get_contact (book, contact_uid, &contact, NULL);
-
- if (!contact) {
- g_object_unref (book);
- return;
- }
- eab_show_contact_editor (book, contact, FALSE, FALSE);
- g_object_unref (contact);
- g_object_unref (book);
-}
diff --git a/addressbook/gui/component/addressbook-view.h b/addressbook/gui/component/addressbook-view.h
deleted file mode 100644
index 08bbbb3e99..0000000000
--- a/addressbook/gui/component/addressbook-view.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _ADDRESSBOOK_VIEW_H_
-#define _ADDRESSBOOK_VIEW_H_
-
-#include <bonobo/bonobo-control.h>
-
-#define ADDRESSBOOK_TYPE_VIEW (addressbook_view_get_type ())
-#define ADDRESSBOOK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ADDRESSBOOK_TYPE_VIEW, AddressbookView))
-#define ADDRESSBOOK_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ADDRESSBOOK_TYPE_VIEW, AddressbookViewClass))
-#define ADDRESSBOOK_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ADDRESSBOOK_TYPE_VIEW))
-#define ADDRESSBOOK_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), ADDRESSBOOK_TYPE_VIEW))
-
-
-typedef struct _AddressbookView AddressbookView;
-typedef struct _AddressbookViewPrivate AddressbookViewPrivate;
-typedef struct _AddressbookViewClass AddressbookViewClass;
-
-struct _AddressbookView {
- GObject parent;
-
- AddressbookViewPrivate *priv;
-};
-
-struct _AddressbookViewClass {
- GObjectClass parent_class;
-};
-
-
-GType addressbook_view_get_type (void);
-
-AddressbookView *addressbook_view_new (void);
-
-EActivityHandler *addressbook_view_peek_activity_handler (AddressbookView *view);
-GtkWidget *addressbook_view_peek_info_label (AddressbookView *view);
-GtkWidget *addressbook_view_peek_sidebar (AddressbookView *view);
-GtkWidget *addressbook_view_peek_statusbar (AddressbookView *view);
-BonoboControl *addressbook_view_peek_folder_view (AddressbookView *view);
-
-void addressbook_view_edit_contact (AddressbookView* view,
- const char* source_id,
- const char* contact_id);
-
-#endif /* _ADDRESSBOOK_VIEW_H_ */
diff --git a/addressbook/gui/component/autocompletion-config.c b/addressbook/gui/component/autocompletion-config.c
index f45f2228e1..548c0cbd7e 100644
--- a/addressbook/gui/component/autocompletion-config.c
+++ b/addressbook/gui/component/autocompletion-config.c
@@ -22,45 +22,31 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
#include "autocompletion-config.h"
-#include "Evolution.h"
-
-#include <bonobo/bonobo-exception.h>
-
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#include <libedataserver/e-source-list.h>
#include <libedataserverui/e-source-selector.h>
#include <libedataserverui/e-name-selector-entry.h>
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-
-typedef struct {
- EvolutionConfigControl *config_control;
- GtkWidget *control_widget;
-
- ESourceList *source_list;
- GConfClient *gconf;
-} AutocompletionConfig;
+#include "widgets/misc/e-preferences-window.h"
static void
-source_selection_changed (ESourceSelector *selector,
- AutocompletionConfig *ac)
+source_selection_changed_cb (ESourceSelector *source_selector)
{
+ ESourceList *source_list;
GSList *selection;
GSList *l;
GSList *groups;
+ source_list = e_source_selector_get_source_list (source_selector);
+
/* first we clear all the completion flags from all sources */
- for (groups = e_source_list_peek_groups (ac->source_list); groups; groups = groups->next) {
+ for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) {
ESourceGroup *group = E_SOURCE_GROUP (groups->data);
GSList *sources;
+
for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) {
ESource *source = E_SOURCE (sources->data);
@@ -70,149 +56,82 @@ source_selection_changed (ESourceSelector *selector,
/* then we loop over the selector's selection, setting the
property on those sources */
- selection = e_source_selector_get_selection (selector);
+ selection = e_source_selector_get_selection (source_selector);
for (l = selection; l; l = l->next) {
- e_source_set_property (E_SOURCE (l->data), "completion", "true");
+ ESource *source = E_SOURCE (l->data);
+
+ e_source_set_property (source, "completion", "true");
}
e_source_selector_free_selection (selection);
- e_source_list_sync (ac->source_list, NULL); /* XXX we should pop up a dialog if this fails */
-}
-
-static void
-config_control_destroy_notify (void *data,
- GObject *where_the_config_control_was)
-{
- AutocompletionConfig *ac = (AutocompletionConfig *) data;
-
- g_object_unref (ac->source_list);
- g_object_unref (ac->gconf);
-
- g_free (ac);
+ /* XXX we should pop up a dialog if this fails */
+ e_source_list_sync (source_list, NULL);
}
static void
-initialize_selection (AutocompletionConfig *ac)
+initialize_selection (ESourceSelector *source_selector)
{
+ ESourceList *source_list;
GSList *groups;
- for (groups = e_source_list_peek_groups (ac->source_list); groups; groups = groups->next) {
+ source_list = e_source_selector_get_source_list (source_selector);
+
+ for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) {
ESourceGroup *group = E_SOURCE_GROUP (groups->data);
GSList *sources;
+
for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) {
ESource *source = E_SOURCE (sources->data);
- const char *completion = e_source_get_property (source, "completion");
+ const char *completion;
+
+ completion = e_source_get_property (source, "completion");
if (completion && !g_ascii_strcasecmp (completion, "true"))
- e_source_selector_select_source (E_SOURCE_SELECTOR (ac->control_widget),
- source);
+ e_source_selector_select_source (source_selector, source);
}
}
}
-static GtkWidget *
-add_section (GtkWidget *vbox, const gchar *caption, gboolean expand)
-{
- GtkWidget *label, *hbox, *itembox;
- gchar *txt;
-
- g_return_val_if_fail (vbox != NULL, NULL);
- g_return_val_if_fail (caption != NULL, NULL);
-
- txt = g_strconcat ("<b>", caption, "</b>", NULL);
-
- label = gtk_label_new (NULL);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- gtk_label_set_markup (GTK_LABEL (label), txt);
-
- g_free (txt);
-
- /* bold caption of the section */
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- hbox = gtk_hbox_new (FALSE, 12);
-
- /* space on the left for the items in the section */
- gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (""), FALSE, FALSE, 0);
-
- /* itembox, here will all section items go */
- itembox = gtk_vbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), itembox, TRUE, TRUE, 0);
-
- gtk_box_pack_start (GTK_BOX (vbox), hbox, expand, expand, 0);
-
- return itembox;
-}
-
-static void
-show_address_check_toggled_cb (GtkToggleButton *check, AutocompletionConfig *ac)
+void
+autocompletion_config_init (EShell *shell)
{
- g_return_if_fail (check != NULL);
- g_return_if_fail (ac != NULL);
- g_return_if_fail (ac->gconf != NULL);
-
- gconf_client_set_bool (ac->gconf, FORCE_SHOW_ADDRESS, gtk_toggle_button_get_active (check), NULL);
-}
-
-EvolutionConfigControl*
-autocompletion_config_control_new (void)
-{
- AutocompletionConfig *ac;
- CORBA_Environment ev;
- GtkWidget *scrolledwin, *vbox, *itembox, *w;
-
- ac = g_new0 (AutocompletionConfig, 1);
-
- CORBA_exception_init (&ev);
-
- ac->gconf = gconf_client_get_default ();
-
- vbox = gtk_vbox_new (FALSE, 6);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
-
- itembox = add_section (vbox, _("Autocompletion"), FALSE);
+ ESourceList *source_list;
+ GtkWidget *scrolled_window;
+ GtkWidget *source_selector;
+ GtkWidget *preferences_window;
- w = gtk_check_button_new_with_mnemonic (_("Always _show address of the autocompleted contact"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), gconf_client_get_bool (ac->gconf, FORCE_SHOW_ADDRESS, NULL));
- g_signal_connect (w, "toggled", (GCallback)show_address_check_toggled_cb, ac);
- gtk_box_pack_start (GTK_BOX (itembox), w, FALSE, FALSE, 0);
+ g_return_if_fail (E_IS_SHELL (shell));
- itembox = add_section (vbox, _("Look up in address books"), TRUE);
+ source_list = e_source_list_new_for_gconf_default (
+ "/apps/evolution/addressbook/sources");
- ac->source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources");
/* XXX should we watch for the source list to change and
update it in the control? what about our local changes? */
/* g_signal_connect (ac->source_list, "changed", G_CALLBACK (source_list_changed), ac); */
- scrolledwin = gtk_scrolled_window_new (NULL, NULL);
-
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwin),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwin),
- GTK_SHADOW_IN);
-
- ac->control_widget = e_source_selector_new (ac->source_list);
-
- gtk_container_add (GTK_CONTAINER (scrolledwin), ac->control_widget);
-
- initialize_selection (ac);
-
- gtk_widget_show (ac->control_widget);
- gtk_widget_show (scrolledwin);
-
- gtk_widget_show_all (vbox);
- gtk_box_pack_start (GTK_BOX (itembox), scrolledwin, TRUE, TRUE, 0);
-
- ac->config_control = evolution_config_control_new (vbox);
-
- g_signal_connect (ac->control_widget, "selection_changed",
- G_CALLBACK (source_selection_changed), ac);
-
- g_object_weak_ref (G_OBJECT (ac->config_control), config_control_destroy_notify, ac);
-
- CORBA_exception_free (&ev);
-
- return ac->config_control;
+ scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (scrolled_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
+ gtk_widget_show (scrolled_window);
+
+ source_selector = e_source_selector_new (source_list);
+ g_signal_connect (
+ source_selector, "selection_changed",
+ G_CALLBACK (source_selection_changed_cb), NULL);
+ gtk_container_add (GTK_CONTAINER (scrolled_window), source_selector);
+ gtk_widget_show (source_selector);
+
+ initialize_selection (E_SOURCE_SELECTOR (source_selector));
+
+ preferences_window = e_shell_get_preferences_window (shell);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "autocompletion",
+ "preferences-autocompletion",
+ _("Autocompletion"),
+ scrolled_window,
+ 200);
}
-
diff --git a/addressbook/gui/component/autocompletion-config.h b/addressbook/gui/component/autocompletion-config.h
index 0690604bc7..5769bdce9d 100644
--- a/addressbook/gui/component/autocompletion-config.h
+++ b/addressbook/gui/component/autocompletion-config.h
@@ -25,8 +25,13 @@
#ifndef _AUTOCOMPLETION_CONFIG_H
#define _AUTOCOMPLETION_CONFIG_H
-#include "evolution-config-control.h"
+#include <glib.h>
+#include <shell/e-shell.h>
-EvolutionConfigControl* autocompletion_config_control_new (void);
+G_BEGIN_DECLS
+
+void autocompletion_config_init (EShell *shell);
+
+G_END_DECLS
#endif /* _AUTOCOMPLETION_CONFIG_H */
diff --git a/addressbook/gui/component/component-factory.c b/addressbook/gui/component/component-factory.c
deleted file mode 100644
index 4d02cc3e6b..0000000000
--- a/addressbook/gui/component/component-factory.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * component-factory.c - Factory for Evolution's Addressbook component.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include <config.h>
-
-#include <string.h>
-#include "addressbook.h"
-#include "addressbook-component.h"
-#include "addressbook-config.h"
-#include "addressbook-view.h"
-#include "autocompletion-config.h"
-#include "eab-popup-control.h"
-#ifdef ENABLE_SMIME
-#include "smime/gui/certificate-manager.h"
-#endif
-#include <bonobo/bonobo-shlib-factory.h>
-
-
-#define FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_Factory:" BASE_VERSION
-
-#define COMPONENT_ID "OAFIID:GNOME_Evolution_Addressbook_Component:" BASE_VERSION
-#define ADDRESS_POPUP_ID "OAFIID:GNOME_Evolution_Addressbook_AddressPopup:" BASE_VERSION
-#define COMPLETION_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_Addressbook_Autocompletion_ConfigControl:" BASE_VERSION
-#define CERTIFICATE_MANAGER_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_SMime_CertificateManager_ConfigControl:" BASE_VERSION
-
-#define d(x)
-
-
-static BonoboObject *
-factory (BonoboGenericFactory *factory,
- const char *component_id,
- void *closure)
-{
- d(printf ("asked to activate component_id `%s'\n", component_id));
-
- if (strcmp (component_id, COMPONENT_ID) == 0) {
- BonoboObject *object = BONOBO_OBJECT (addressbook_component_peek ());
- bonobo_object_ref (object);
- return object;
- }
- if (strcmp (component_id, ADDRESS_POPUP_ID) == 0)
- return BONOBO_OBJECT (eab_popup_control_new ());
- if (strcmp (component_id, COMPLETION_CONFIG_CONTROL_ID) == 0)
- return BONOBO_OBJECT (autocompletion_config_control_new ());
-#ifdef ENABLE_SMIME
- if (strcmp (component_id, CERTIFICATE_MANAGER_CONFIG_CONTROL_ID) == 0)
- return BONOBO_OBJECT (certificate_manager_config_control_new ());
-#endif
-
- g_warning (FACTORY_ID ": Don't know what to do with %s", component_id);
- return NULL;
-}
-
-BONOBO_ACTIVATION_SHLIB_FACTORY (FACTORY_ID, "Evolution Addressbook component factory", factory, NULL)
diff --git a/addressbook/gui/component/e-book-shell-backend.c b/addressbook/gui/component/e-book-shell-backend.c
new file mode 100644
index 0000000000..68af7ed03b
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-backend.c
@@ -0,0 +1,576 @@
+/*
+ * e-book-shell-backend.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-book-shell-backend.h"
+
+#include <config.h>
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <libebook/e-book.h>
+#include <libedataserver/e-url.h>
+#include <libedataserver/e-source.h>
+#include <libedataserver/e-source-group.h>
+
+#include "shell/e-shell.h"
+#include "shell/e-shell-window.h"
+
+#include "e-util/e-import.h"
+#include "addressbook/gui/widgets/eab-gui-util.h"
+#include "addressbook/gui/contact-editor/e-contact-editor.h"
+#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
+#include "addressbook/importers/evolution-addressbook-importers.h"
+
+#include "eab-config.h"
+#include "addressbook-config.h"
+#include "autocompletion-config.h"
+
+#include "e-book-shell-migrate.h"
+#include "e-book-shell-view.h"
+
+#ifdef ENABLE_SMIME
+#include "smime/gui/component.h"
+#include "smime/gui/certificate-manager.h"
+#endif
+
+#define E_BOOK_SHELL_BACKEND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_BOOK_SHELL_BACKEND, EBookShellBackendPrivate))
+
+#define LDAP_BASE_URI "ldap://"
+#define PERSONAL_RELATIVE_URI "system"
+
+struct _EBookShellBackendPrivate {
+ ESourceList *source_list;
+};
+
+enum {
+ PROP_0,
+ PROP_SOURCE_LIST
+};
+
+static gpointer parent_class;
+static GType book_shell_backend_type;
+
+static void
+book_shell_backend_ensure_sources (EShellBackend *shell_backend)
+{
+ /* XXX This is basically the same algorithm across all backends.
+ * Maybe we could somehow integrate this into EShellBackend? */
+
+ EBookShellBackendPrivate *priv;
+ ESourceGroup *on_this_computer;
+ ESourceGroup *on_ldap_servers;
+ ESource *personal;
+ GSList *groups, *iter;
+ const gchar *data_dir;
+ const gchar *name;
+ gchar *base_uri;
+ gchar *filename;
+
+ on_this_computer = NULL;
+ on_ldap_servers = NULL;
+ personal = NULL;
+
+ priv = E_BOOK_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+
+ if (!e_book_get_addressbooks (&priv->source_list, NULL)) {
+ g_warning ("Could not get addressbook sources from GConf!");
+ return;
+ }
+
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ filename = g_build_filename (data_dir, "local", NULL);
+ base_uri = g_filename_to_uri (filename, NULL, NULL);
+ g_free (filename);
+
+ groups = e_source_list_peek_groups (priv->source_list);
+ for (iter = groups; iter != NULL; iter = iter->next) {
+ ESourceGroup *source_group = iter->data;
+ const gchar *group_base_uri;
+
+ group_base_uri = e_source_group_peek_base_uri (source_group);
+
+ /* Compare only "file://" part. If the user's home
+ * changes, we do not want to create another group. */
+ if (on_this_computer == NULL &&
+ strncmp (base_uri, group_base_uri, 7) == 0)
+ on_this_computer = source_group;
+
+ else if (on_ldap_servers == NULL &&
+ strcmp (LDAP_BASE_URI, group_base_uri) == 0)
+ on_ldap_servers = source_group;
+ }
+
+ name = _("On This Computer");
+
+ if (on_this_computer != NULL) {
+ GSList *sources;
+ const gchar *group_base_uri;
+
+ /* Force the group name to the current locale. */
+ e_source_group_set_name (on_this_computer, name);
+
+ sources = e_source_group_peek_sources (on_this_computer);
+ group_base_uri = e_source_group_peek_base_uri (on_this_computer);
+
+ /* Make sure this group includes a "Personal" source. */
+ for (iter = sources; iter != NULL; iter = iter->next) {
+ ESource *source = iter->data;
+ const gchar *relative_uri;
+
+ relative_uri = e_source_peek_relative_uri (source);
+ if (relative_uri == NULL)
+ continue;
+
+ if (strcmp (PERSONAL_RELATIVE_URI, relative_uri) != 0)
+ continue;
+
+ personal = source;
+ break;
+ }
+
+ /* Make sure we have the correct base URI. This can
+ * change when the user's home directory changes. */
+ if (strcmp (base_uri, group_base_uri) != 0) {
+ e_source_group_set_base_uri (
+ on_this_computer, base_uri);
+
+ /* XXX We shouldn't need this sync call here as
+ * set_base_uri() results in synching to GConf,
+ * but that happens in an idle loop and too late
+ * to prevent the user from seeing a "Cannot
+ * Open ... because of invalid URI" error. */
+ e_source_list_sync (priv->source_list, NULL);
+ }
+
+ } else {
+ ESourceGroup *source_group;
+
+ source_group = e_source_group_new (name, base_uri);
+ e_source_list_add_group (priv->source_list, source_group, -1);
+ g_object_unref (source_group);
+ }
+
+ name = _("Personal");
+
+ if (personal == NULL) {
+ ESource *source;
+
+ /* Create the default Personal address book. */
+ source = e_source_new (name, PERSONAL_RELATIVE_URI);
+ e_source_group_add_source (on_this_computer, source, -1);
+ e_source_set_property (source, "completion", "true");
+ g_object_unref (source);
+ } else {
+ /* Force the source name to the current locale. */
+ e_source_set_name (personal, name);
+ }
+
+ name = _("On LDAP Servers");
+
+ if (on_ldap_servers == NULL) {
+ ESourceGroup *source_group;
+
+ source_group = e_source_group_new (name, LDAP_BASE_URI);
+ e_source_list_add_group (priv->source_list, source_group, -1);
+ g_object_unref (source_group);
+ } else {
+ /* Force the group name to the current locale. */
+ e_source_group_set_name (on_ldap_servers, name);
+ }
+
+ g_free (base_uri);
+}
+
+static void
+book_shell_backend_init_importers (void)
+{
+ EImportClass *import_class;
+ EImportImporter *importer;
+
+ import_class = g_type_class_ref (e_import_get_type ());
+
+ importer = evolution_ldif_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+
+ importer = evolution_vcard_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+
+ importer = evolution_csv_outlook_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+
+ importer = evolution_csv_mozilla_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+
+ importer = evolution_csv_evolution_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+}
+
+static void
+book_shell_backend_book_loaded_cb (EBook *book,
+ EBookStatus status,
+ gpointer user_data)
+{
+ EContact *contact;
+ GtkAction *action;
+ GtkWidget *editor;
+ const gchar *action_name;
+
+ /* XXX Handle errors better. */
+ if (status != E_BOOK_ERROR_OK)
+ return;
+
+ contact = e_contact_new ();
+ action = GTK_ACTION (user_data);
+ action_name = gtk_action_get_name (action);
+
+ if (strcmp (action_name, "contact-new") == 0)
+ editor = e_contact_editor_new (book, contact, TRUE, TRUE);
+
+ if (strcmp (action_name, "contact-new-list") == 0)
+ editor = e_contact_list_editor_new (book, contact, TRUE, TRUE);
+
+ eab_editor_show (EAB_EDITOR (editor));
+
+ g_object_unref (contact);
+ g_object_unref (book);
+}
+
+static void
+action_contact_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShell *shell;
+ EBook *book = NULL;
+ GConfClient *client;
+ ESourceList *source_list;
+ const gchar *key;
+ gchar *uid;
+
+ /* This callback is used for both contacts and contact lists. */
+
+ if (!e_book_get_addressbooks (&source_list, NULL)) {
+ g_warning ("Could not get addressbook sources from GConf!");
+ return;
+ }
+
+ shell = e_shell_window_get_shell (shell_window);
+ client = e_shell_get_gconf_client (shell);
+
+ key = "/apps/evolution/addressbook/display/primary_addressbook";
+ uid = gconf_client_get_string (client, key, NULL);
+
+ if (uid != NULL) {
+ ESource *source;
+
+ source = e_source_list_peek_source_by_uid (source_list, uid);
+ if (source != NULL)
+ book = e_book_new (source, NULL);
+ g_free (uid);
+ }
+
+ if (book == NULL)
+ book = e_book_new_default_addressbook (NULL);
+
+ e_book_async_open (
+ book, FALSE, book_shell_backend_book_loaded_cb, action);
+}
+
+static void
+action_address_book_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ addressbook_config_create_new_source (NULL);
+}
+
+static GtkActionEntry item_entries[] = {
+
+ { "contact-new",
+ "contact-new",
+ NC_("New", "_Contact"),
+ "<Shift><Control>c",
+ N_("Create a new contact"),
+ G_CALLBACK (action_contact_new_cb) },
+
+ { "contact-new-list",
+ "stock_contact-list",
+ N_("Contact _List"),
+ "<Shift><Control>l",
+ N_("Create a new contact list"),
+ G_CALLBACK (action_contact_new_cb) }
+};
+
+static GtkActionEntry source_entries[] = {
+
+ { "address-book-new",
+ "address-book-new",
+ NC_("New", "Address _Book"),
+ NULL,
+ N_("Create a new address book"),
+ G_CALLBACK (action_address_book_new_cb) }
+};
+
+static gboolean
+book_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
+ const gchar *uri)
+{
+ EUri *euri;
+ const gchar *cp;
+ gchar *source_uid = NULL;
+ gchar *contact_uid = NULL;
+
+ if (!g_str_has_prefix (uri, "contacts:"))
+ return FALSE;
+
+ euri = e_uri_new (uri);
+ cp = euri->query;
+
+ if (cp == NULL) {
+ e_uri_free (euri);
+ return FALSE;
+ }
+
+ while (*cp != '\0') {
+ gchar *header;
+ gchar *content;
+ gsize length;
+ gsize content_length;
+
+ length = strcspn (cp, "=&");
+
+ /* If it's malformed, give up. */
+ if (cp[length] != '=')
+ break;
+
+ header = (gchar *) cp;
+ header[length] = '\0';
+ cp += length + 1;
+
+ content_length = strcspn (cp, "&");
+ content = g_strndup (cp, content_length);
+
+ if (g_ascii_strcasecmp (header, "source-uid") == 0)
+ source_uid = g_strdup (content);
+
+ if (g_ascii_strcasecmp (header, "contact-uid") == 0)
+ contact_uid = g_strdup (content);
+
+ g_free (content);
+
+ cp += content_length;
+ if (*cp == '&') {
+ cp++;
+ if (strcmp (cp, "amp;"))
+ cp += 4;
+ }
+ }
+
+ /* FIXME */
+ /*addressbook_view_edit_contact (view, source_uid, contact_uid);*/
+
+ g_free (source_uid);
+ g_free (contact_uid);
+
+ e_uri_free (euri);
+
+ return TRUE;
+}
+
+static void
+book_shell_backend_window_created_cb (EShellBackend *shell_backend,
+ GtkWindow *window)
+{
+ const gchar *backend_name;
+
+ if (!E_IS_SHELL_WINDOW (window))
+ return;
+
+ backend_name = E_SHELL_BACKEND_GET_CLASS (shell_backend)->name;
+
+ e_shell_window_register_new_item_actions (
+ E_SHELL_WINDOW (window), backend_name,
+ item_entries, G_N_ELEMENTS (item_entries));
+
+ e_shell_window_register_new_source_actions (
+ E_SHELL_WINDOW (window), backend_name,
+ source_entries, G_N_ELEMENTS (source_entries));
+}
+
+static void
+book_shell_backend_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SOURCE_LIST:
+ g_value_set_object (
+ value,
+ e_book_shell_backend_get_source_list (
+ E_BOOK_SHELL_BACKEND (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+book_shell_backend_dispose (GObject *object)
+{
+ EBookShellBackendPrivate *priv;
+
+ priv = E_BOOK_SHELL_BACKEND_GET_PRIVATE (object);
+
+ if (priv->source_list != NULL) {
+ g_object_unref (priv->source_list);
+ priv->source_list = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+book_shell_backend_constructed (GObject *object)
+{
+ EShell *shell;
+ EShellBackend *shell_backend;
+
+ shell_backend = E_SHELL_BACKEND (object);
+ shell = e_shell_backend_get_shell (shell_backend);
+
+ /* XXX Why is this here? Address books aren't the only
+ * things that use S/MIME. Maybe put it in EShell? */
+#ifdef ENABLE_SMIME
+ smime_component_init ();
+ certificate_manager_config_init (shell);
+#endif
+
+ book_shell_backend_init_importers ();
+ book_shell_backend_ensure_sources (shell_backend);
+
+ e_plugin_hook_register_type (eab_config_get_type ());
+
+ g_signal_connect_swapped (
+ shell, "handle-uri",
+ G_CALLBACK (book_shell_backend_handle_uri_cb),
+ shell_backend);
+
+ g_signal_connect_swapped (
+ shell, "window-created",
+ G_CALLBACK (book_shell_backend_window_created_cb),
+ shell_backend);
+
+ autocompletion_config_init (shell);
+}
+
+static gboolean
+book_shell_backend_is_busy (EShellBackend *shell_backend)
+{
+ return !eab_editor_request_close_all ();
+}
+
+static gboolean
+book_shell_backend_shutdown (EShellBackend *shell_backend)
+{
+ /* FIXME */
+ return TRUE;
+}
+
+static void
+book_shell_backend_class_init (EBookShellBackendClass *class)
+{
+ GObjectClass *object_class;
+ EShellBackendClass *shell_backend_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EBookShellBackendPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = book_shell_backend_get_property;
+ object_class->dispose = book_shell_backend_dispose;
+ object_class->constructed = book_shell_backend_constructed;
+
+ shell_backend_class = E_SHELL_BACKEND_CLASS (class);
+ shell_backend_class->shell_view_type = E_TYPE_BOOK_SHELL_VIEW;
+ shell_backend_class->name = "addressbook";
+ shell_backend_class->aliases = "contacts";
+ shell_backend_class->schemes = "";
+ shell_backend_class->sort_order = 300;
+ shell_backend_class->start = NULL;
+ shell_backend_class->is_busy = book_shell_backend_is_busy;
+ shell_backend_class->shutdown = book_shell_backend_shutdown;
+ shell_backend_class->migrate = e_book_shell_backend_migrate;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SOURCE_LIST,
+ g_param_spec_object (
+ "source-list",
+ _("Source List"),
+ _("The registry of address books"),
+ E_TYPE_SOURCE_LIST,
+ G_PARAM_READABLE));
+}
+
+static void
+book_shell_backend_init (EBookShellBackend *book_shell_backend)
+{
+ book_shell_backend->priv =
+ E_BOOK_SHELL_BACKEND_GET_PRIVATE (book_shell_backend);
+}
+
+GType
+e_book_shell_backend_get_type (void)
+{
+ return book_shell_backend_type;
+}
+
+void
+e_book_shell_backend_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (EBookShellBackendClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) book_shell_backend_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EBookShellBackend),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) book_shell_backend_init,
+ NULL /* value_table */
+ };
+
+ book_shell_backend_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_BACKEND,
+ "EBookShellBackend", &type_info, 0);
+}
+
+ESourceList *
+e_book_shell_backend_get_source_list (EBookShellBackend *book_shell_backend)
+{
+ g_return_val_if_fail (
+ E_IS_BOOK_SHELL_BACKEND (book_shell_backend), NULL);
+
+ return book_shell_backend->priv->source_list;
+}
diff --git a/addressbook/gui/component/e-book-shell-backend.h b/addressbook/gui/component/e-book-shell-backend.h
new file mode 100644
index 0000000000..c61e43b814
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-backend.h
@@ -0,0 +1,70 @@
+/*
+ * e-book-shell-backend.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_BOOK_SHELL_BACKEND_H
+#define E_BOOK_SHELL_BACKEND_H
+
+#include <shell/e-shell-backend.h>
+#include <libedataserver/e-source-list.h>
+
+/* Standard GObject macros */
+#define E_TYPE_BOOK_SHELL_BACKEND \
+ (e_book_shell_backend_get_type ())
+#define E_BOOK_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_BOOK_SHELL_BACKEND, EBookShellBackend))
+#define E_BOOK_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_BOOK_SHELL_BACKEND, EBookShellBackendClass))
+#define E_IS_BOOK_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_BOOK_SHELL_BACKEND))
+#define E_IS_BOOK_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_BOOK_SHELL_BACKEND))
+#define E_BOOK_SHELL_BACKEND_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_BOOK_SHELL_BACKEND, EBookShellBackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EBookShellBackend EBookShellBackend;
+typedef struct _EBookShellBackendClass EBookShellBackendClass;
+typedef struct _EBookShellBackendPrivate EBookShellBackendPrivate;
+
+struct _EBookShellBackend {
+ EShellBackend parent;
+ EBookShellBackendPrivate *priv;
+};
+
+struct _EBookShellBackendClass {
+ EShellBackendClass parent_class;
+};
+
+GType e_book_shell_backend_get_type (void);
+void e_book_shell_backend_register_type
+ (GTypeModule *type_module);
+ESourceList * e_book_shell_backend_get_source_list
+ (EBookShellBackend *book_shell_backend);
+
+G_END_DECLS
+
+#endif /* E_BOOK_SHELL_BACKEND_H */
diff --git a/addressbook/gui/component/e-book-shell-content.c b/addressbook/gui/component/e-book-shell-content.c
new file mode 100644
index 0000000000..cce03b1575
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-content.c
@@ -0,0 +1,492 @@
+/*
+ * e-book-shell-content.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-book-shell-content.h"
+
+#include <glib/gi18n.h>
+
+#include "e-util/gconf-bridge.h"
+
+#define E_BOOK_SHELL_CONTENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_BOOK_SHELL_CONTENT, EBookShellContentPrivate))
+
+struct _EBookShellContentPrivate {
+ GtkWidget *paned;
+ GtkWidget *notebook;
+ GtkWidget *preview;
+};
+
+enum {
+ PROP_0,
+ PROP_CURRENT_VIEW,
+ PROP_PREVIEW_CONTACT,
+ PROP_PREVIEW_VISIBLE
+};
+
+static gpointer parent_class;
+static GType book_shell_view_type;
+
+static void
+book_shell_content_send_message_cb (EBookShellContent *book_shell_content,
+ EDestination *destination,
+ EABContactDisplay *display)
+{
+ GList node = { destination, NULL, NULL };
+
+ eab_send_as_to (&node);
+}
+
+static void
+book_shell_content_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CURRENT_VIEW:
+ e_book_shell_content_set_current_view (
+ E_BOOK_SHELL_CONTENT (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_PREVIEW_CONTACT:
+ e_book_shell_content_set_preview_contact (
+ E_BOOK_SHELL_CONTENT (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_PREVIEW_VISIBLE:
+ e_book_shell_content_set_preview_visible (
+ E_BOOK_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+book_shell_content_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CURRENT_VIEW:
+ g_value_set_object (
+ value, e_book_shell_content_get_current_view (
+ E_BOOK_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_PREVIEW_CONTACT:
+ g_value_set_object (
+ value, e_book_shell_content_get_preview_contact (
+ E_BOOK_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_PREVIEW_VISIBLE:
+ g_value_set_boolean (
+ value, e_book_shell_content_get_preview_visible (
+ E_BOOK_SHELL_CONTENT (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+book_shell_content_dispose (GObject *object)
+{
+ EBookShellContentPrivate *priv;
+
+ priv = E_BOOK_SHELL_CONTENT_GET_PRIVATE (object);
+
+ if (priv->paned != NULL) {
+ g_object_unref (priv->paned);
+ priv->paned = NULL;
+ }
+
+ if (priv->notebook != NULL) {
+ g_object_unref (priv->notebook);
+ priv->notebook = NULL;
+ }
+
+ if (priv->preview != NULL) {
+ g_object_unref (priv->preview);
+ priv->preview = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+book_shell_content_constructed (GObject *object)
+{
+ EBookShellContentPrivate *priv;
+ GConfBridge *bridge;
+ GtkWidget *container;
+ GtkWidget *widget;
+ const gchar *key;
+
+ priv = E_BOOK_SHELL_CONTENT_GET_PRIVATE (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ container = GTK_WIDGET (object);
+
+ widget = gtk_vpaned_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->paned = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
+ gtk_paned_add1 (GTK_PANED (container), widget);
+ priv->notebook = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_paned_add2 (GTK_PANED (container), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = eab_contact_display_new ();
+ eab_contact_display_set_mode (
+ EAB_CONTACT_DISPLAY (widget),
+ EAB_CONTACT_DISPLAY_RENDER_NORMAL);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->preview = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ priv->preview, "send-message",
+ G_CALLBACK (book_shell_content_send_message_cb), object);
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (priv->paned);
+ key = "/apps/evolution/addressbook/display/vpane_position";
+ gconf_bridge_bind_property_delayed (bridge, key, object, "position");
+}
+
+static guint32
+book_shell_content_check_state (EShellContent *shell_content)
+{
+ EBookShellContent *book_shell_content;
+ ESelectionModel *selection_model;
+ EAddressbookModel *model;
+ EAddressbookView *view;
+ guint32 state = 0;
+ gint n_contacts;
+ gint n_selected;
+
+ book_shell_content = E_BOOK_SHELL_CONTENT (shell_content);
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ model = e_addressbook_view_get_model (view);
+
+ selection_model = e_addressbook_view_get_selection_model (view);
+ n_contacts = (selection_model != NULL) ?
+ e_selection_model_row_count (selection_model) : 0;
+ n_selected = (selection_model != NULL) ?
+ e_selection_model_selected_count (selection_model) : 0;
+
+ /* FIXME Finish the rest of the flags. */
+ if (n_selected == 1)
+ state |= E_BOOK_SHELL_CONTENT_SELECTION_SINGLE;
+ if (n_selected > 1)
+ state |= E_BOOK_SHELL_CONTENT_SELECTION_MULTIPLE;
+ if (e_addressbook_model_can_stop (model))
+ state |= E_BOOK_SHELL_CONTENT_SOURCE_IS_BUSY;
+ if (e_addressbook_model_get_editable (model))
+ state |= E_BOOK_SHELL_CONTENT_SOURCE_IS_EDITABLE;
+ if (n_contacts == 0)
+ state |= E_BOOK_SHELL_CONTENT_SOURCE_IS_EMPTY;
+
+ return state;
+}
+
+static void
+book_shell_content_class_init (EBookShellContentClass *class)
+{
+ GObjectClass *object_class;
+ EShellContentClass *shell_content_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EBookShellContentPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = book_shell_content_set_property;
+ object_class->get_property = book_shell_content_get_property;
+ object_class->dispose = book_shell_content_dispose;
+ object_class->constructed = book_shell_content_constructed;
+
+ shell_content_class = E_SHELL_CONTENT_CLASS (class);
+ shell_content_class->check_state = book_shell_content_check_state;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CURRENT_VIEW,
+ g_param_spec_object (
+ "current-view",
+ _("Current View"),
+ _("The currently selected address book view"),
+ E_TYPE_ADDRESSBOOK_VIEW,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PREVIEW_CONTACT,
+ g_param_spec_object (
+ "preview-contact",
+ _("Previewed Contact"),
+ _("The contact being shown in the preview pane"),
+ E_TYPE_CONTACT,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PREVIEW_VISIBLE,
+ g_param_spec_boolean (
+ "preview-visible",
+ _("Preview is Visible"),
+ _("Whether the preview pane is visible"),
+ TRUE,
+ G_PARAM_READWRITE));
+}
+
+static void
+book_shell_content_init (EBookShellContent *book_shell_content)
+{
+ book_shell_content->priv =
+ E_BOOK_SHELL_CONTENT_GET_PRIVATE (book_shell_content);
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_book_shell_content_get_type (void)
+{
+ return book_shell_view_type;
+}
+
+void
+e_book_shell_content_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (EBookShellContentClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) book_shell_content_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EBookShellContent),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) book_shell_content_init,
+ NULL /* value_table */
+ };
+
+ book_shell_view_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_CONTENT,
+ "EBookShellContent", &type_info, 0);
+}
+
+GtkWidget *
+e_book_shell_content_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_BOOK_SHELL_CONTENT,
+ "shell-view", shell_view, NULL);
+}
+
+void
+e_book_shell_content_insert_view (EBookShellContent *book_shell_content,
+ EAddressbookView *addressbook_view)
+{
+ GtkNotebook *notebook;
+ GtkWidget *child;
+
+ g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (addressbook_view));
+
+ notebook = GTK_NOTEBOOK (book_shell_content->priv->notebook);
+ child = GTK_WIDGET (addressbook_view);
+ gtk_notebook_append_page (notebook, child, NULL);
+}
+
+void
+e_book_shell_content_remove_view (EBookShellContent *book_shell_content,
+ EAddressbookView *addressbook_view)
+{
+ GtkNotebook *notebook;
+ GtkWidget *child;
+ gint page_num;
+
+ g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (addressbook_view));
+
+ notebook = GTK_NOTEBOOK (book_shell_content->priv->notebook);
+ child = GTK_WIDGET (addressbook_view);
+ page_num = gtk_notebook_page_num (notebook, child);
+ g_return_if_fail (page_num >= 0);
+
+ gtk_notebook_remove_page (notebook, page_num);
+}
+
+EAddressbookView *
+e_book_shell_content_get_current_view (EBookShellContent *book_shell_content)
+{
+ GtkNotebook *notebook;
+ GtkWidget *widget;
+ gint page_num;
+
+ g_return_val_if_fail (
+ E_IS_BOOK_SHELL_CONTENT (book_shell_content), NULL);
+
+ notebook = GTK_NOTEBOOK (book_shell_content->priv->notebook);
+ page_num = gtk_notebook_get_current_page (notebook);
+ widget = gtk_notebook_get_nth_page (notebook, page_num);
+ g_return_val_if_fail (widget != NULL, NULL);
+
+ return E_ADDRESSBOOK_VIEW (widget);
+}
+
+void
+e_book_shell_content_set_current_view (EBookShellContent *book_shell_content,
+ EAddressbookView *addressbook_view)
+{
+ GtkNotebook *notebook;
+ GtkWidget *child;
+ gint page_num;
+
+ g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (addressbook_view));
+
+ notebook = GTK_NOTEBOOK (book_shell_content->priv->notebook);
+ child = GTK_WIDGET (addressbook_view);
+ page_num = gtk_notebook_page_num (notebook, child);
+ g_return_if_fail (page_num >= 0);
+
+ gtk_notebook_set_current_page (notebook, page_num);
+ g_object_notify (G_OBJECT (book_shell_content), "current-view");
+}
+
+EContact *
+e_book_shell_content_get_preview_contact (EBookShellContent *book_shell_content)
+{
+ EABContactDisplay *display;
+
+ g_return_val_if_fail (
+ E_IS_BOOK_SHELL_CONTENT (book_shell_content), NULL);
+
+ display = EAB_CONTACT_DISPLAY (book_shell_content->priv->preview);
+
+ return eab_contact_display_get_contact (display);
+}
+
+void
+e_book_shell_content_set_preview_contact (EBookShellContent *book_shell_content,
+ EContact *preview_contact)
+{
+ EABContactDisplay *display;
+
+ g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
+
+ display = EAB_CONTACT_DISPLAY (book_shell_content->priv->preview);
+
+ eab_contact_display_set_contact (display, preview_contact);
+ g_object_notify (G_OBJECT (book_shell_content), "preview-contact");
+}
+
+gboolean
+e_book_shell_content_get_preview_visible (EBookShellContent *book_shell_content)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_val_if_fail (
+ E_IS_BOOK_SHELL_CONTENT (book_shell_content), FALSE);
+
+ paned = GTK_PANED (book_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ return GTK_WIDGET_VISIBLE (child);
+}
+
+void
+e_book_shell_content_set_preview_visible (EBookShellContent *book_shell_content,
+ gboolean preview_visible)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
+
+ paned = GTK_PANED (book_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ if (preview_visible)
+ gtk_widget_show (child);
+ else
+ gtk_widget_hide (child);
+
+ g_object_notify (G_OBJECT (book_shell_content), "preview-visible");
+}
+
+void
+e_book_shell_content_clipboard_copy (EBookShellContent *book_shell_content)
+{
+ EAddressbookView *addressbook_view;
+ GtkHTML *html;
+ gchar *selection;
+
+ g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
+
+ html = GTK_HTML (book_shell_content->priv->preview);
+ addressbook_view =
+ e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (addressbook_view != NULL);
+
+ if (!GTK_WIDGET_HAS_FOCUS (html)) {
+ e_addressbook_view_copy (addressbook_view);
+ return;
+ }
+
+ selection = gtk_html_get_selection_html (html, NULL);
+ if (selection != NULL)
+ gtk_html_copy (html);
+ g_free (selection);
+}
diff --git a/addressbook/gui/component/e-book-shell-content.h b/addressbook/gui/component/e-book-shell-content.h
new file mode 100644
index 0000000000..ac5ab10e8b
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-content.h
@@ -0,0 +1,110 @@
+/*
+ * e-book-shell-content.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_BOOK_SHELL_CONTENT_H
+#define E_BOOK_SHELL_CONTENT_H
+
+#include <libebook/e-contact.h>
+
+#include "shell/e-shell-content.h"
+#include "shell/e-shell-view.h"
+
+#include "addressbook/gui/component/eab-composer-util.h"
+#include "addressbook/gui/widgets/e-addressbook-view.h"
+
+/* Standard GObject macros */
+#define E_TYPE_BOOK_SHELL_CONTENT \
+ (e_book_shell_content_get_type ())
+#define E_BOOK_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_BOOK_SHELL_CONTENT, EBookShellContent))
+#define E_BOOK_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_BOOK_SHELL_CONTENT, EBookShellContentClass))
+#define E_IS_BOOK_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_BOOK_SHELL_CONTENT))
+#define E_IS_BOOK_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_BOOK_SHELL_CONTENT))
+#define E_BOOK_SHELL_CONTENT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_BOOK_SHELL_CONTENT, EBookShellContentClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EBookShellContent EBookShellContent;
+typedef struct _EBookShellContentClass EBookShellContentClass;
+typedef struct _EBookShellContentPrivate EBookShellContentPrivate;
+
+enum {
+ E_BOOK_SHELL_CONTENT_SELECTION_SINGLE = 1 << 0,
+ E_BOOK_SHELL_CONTENT_SELECTION_MULTIPLE = 1 << 1,
+ E_BOOK_SHELL_CONTENT_SELECTION_HAS_EMAIL = 1 << 2,
+ E_BOOK_SHELL_CONTENT_SELECTION_IS_CONTACT_LIST = 1 << 3,
+ E_BOOK_SHELL_CONTENT_SELECTION_HAS_HTTP_URI = 1 << 4,
+ E_BOOK_SHELL_CONTENT_SELECTION_HAS_MAILTO_URI = 1 << 5,
+ E_BOOK_SHELL_CONTENT_SOURCE_IS_BUSY = 1 << 6,
+ E_BOOK_SHELL_CONTENT_SOURCE_IS_EDITABLE = 1 << 7,
+ E_BOOK_SHELL_CONTENT_SOURCE_IS_EMPTY = 1 << 8
+};
+
+struct _EBookShellContent {
+ EShellContent parent;
+ EBookShellContentPrivate *priv;
+};
+
+struct _EBookShellContentClass {
+ EShellContentClass parent_class;
+};
+
+GType e_book_shell_content_get_type (void);
+void e_book_shell_content_register_type
+ (GTypeModule *type_module);
+GtkWidget * e_book_shell_content_new(EShellView *shell_view);
+void e_book_shell_content_insert_view
+ (EBookShellContent *book_shell_content,
+ EAddressbookView *addressbook_view);
+void e_book_shell_content_remove_view
+ (EBookShellContent *book_shell_content,
+ EAddressbookView *addressbook_view);
+EAddressbookView *
+ e_book_shell_content_get_current_view
+ (EBookShellContent *book_shell_content);
+void e_book_shell_content_set_current_view
+ (EBookShellContent *book_shell_content,
+ EAddressbookView *addressbook_view);
+EContact * e_book_shell_content_get_preview_contact
+ (EBookShellContent *book_shell_content);
+void e_book_shell_content_set_preview_contact
+ (EBookShellContent *book_shell_content,
+ EContact *preview_contact);
+gboolean e_book_shell_content_get_preview_visible
+ (EBookShellContent *book_shell_content);
+void e_book_shell_content_set_preview_visible
+ (EBookShellContent *book_shell_content,
+ gboolean preview_visible);
+void e_book_shell_content_clipboard_copy
+ (EBookShellContent *book_shell_content);
+
+G_END_DECLS
+
+#endif /* E_BOOK_SHELL_CONTENT_H */
diff --git a/addressbook/gui/component/addressbook-migrate.c b/addressbook/gui/component/e-book-shell-migrate.c
index ca691761c9..2c9aa6afb0 100644
--- a/addressbook/gui/component/addressbook-migrate.c
+++ b/addressbook/gui/component/e-book-shell-migrate.c
@@ -1,4 +1,6 @@
/*
+ * e-book-shell-backend-migrate.c
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -45,7 +47,7 @@
#include "e-util/e-xml-utils.h"
#include "e-util/e-folder-map.h"
-#include "addressbook-migrate.h"
+#include "e-book-shell-migrate.h"
/*#define SLOW_MIGRATION*/
@@ -57,7 +59,7 @@ typedef struct {
ESourceList *source_list;
- AddressbookComponent *component;
+ const gchar *data_dir;
GtkWidget *window;
GtkWidget *label;
@@ -450,14 +452,12 @@ create_groups (MigrationContext *context,
GSList *groups;
ESourceGroup *group;
char *base_uri, *base_uri_proto;
- const gchar *base_dir;
*on_this_computer = NULL;
*on_ldap_servers = NULL;
*personal_source = NULL;
- base_dir = addressbook_component_peek_base_directory (context->component);
- base_uri = g_build_filename (base_dir, "local", NULL);
+ base_uri = g_build_filename (context->data_dir, "local", NULL);
base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
@@ -744,12 +744,17 @@ get_source_by_name (ESourceList *source_list, const char *name)
static gboolean
migrate_completion_folders (MigrationContext *context)
{
- char *uris_xml = gconf_client_get_string (addressbook_component_peek_gconf_client (context->component),
- "/apps/evolution/addressbook/completion/uris",
- NULL);
+ GConfClient *client;
+ const gchar *key;
+ gchar *uris_xml;
printf ("trying to migrate completion folders\n");
+ client = gconf_client_get_default ();
+ key = "/apps/evolution/addressbook/completion/uris";
+ uris_xml = gconf_client_get_string (client, key, NULL);
+ g_object_unref (client);
+
if (uris_xml) {
xmlDoc *doc = xmlParseMemory (uris_xml, strlen (uris_xml));
xmlNode *root;
@@ -1076,17 +1081,20 @@ migrate_pilot_data (const char *old_path, const char *new_path)
g_dir_close (dir);
}
-static MigrationContext*
-migration_context_new (AddressbookComponent *component)
+static MigrationContext *
+migration_context_new (const gchar *data_dir)
{
MigrationContext *context = g_new (MigrationContext, 1);
/* set up the mapping from old uris to new uids */
- context->folder_uid_map = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, (GDestroyNotify)g_free);
+ context->folder_uid_map = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_free);
e_book_get_addressbooks (&context->source_list, NULL);
- context->component = component;
+ context->data_dir = data_dir;
return context;
}
@@ -1103,16 +1111,24 @@ migration_context_free (MigrationContext *context)
g_free (context);
}
-int
-addressbook_migrate (AddressbookComponent *component, int major, int minor, int revision, GError **err)
+gboolean
+e_book_shell_backend_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error)
{
ESourceGroup *on_this_computer;
ESourceGroup *on_ldap_servers;
ESource *personal_source;
- MigrationContext *context = migration_context_new (component);
+ MigrationContext *context;
gboolean need_dialog = FALSE;
+ const gchar *data_dir;
+
+ g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), FALSE);
- printf ("addressbook_migrate (%d.%d.%d)\n", major, minor, revision);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ context = migration_context_new (data_dir);
/* we call this unconditionally now - create_groups either
creates the groups/sources or it finds the necessary
@@ -1123,7 +1139,7 @@ addressbook_migrate (AddressbookComponent *component, int major, int minor, int
if (major == 1
/* we only need the most recent upgrade point here.
further decomposition will happen below. */
- && (minor < 5 || (minor == 5 && revision <= 10)))
+ && (minor < 5 || (minor == 5 && micro <= 10)))
need_dialog = TRUE;
if (need_dialog)
@@ -1131,7 +1147,7 @@ addressbook_migrate (AddressbookComponent *component, int major, int minor, int
if (major == 1) {
- if (minor < 5 || (minor == 5 && revision <= 2)) {
+ if (minor < 5 || (minor == 5 && micro <= 2)) {
/* initialize our dialog */
dialog_set_label (context,
_("The location and hierarchy of the Evolution contact "
@@ -1146,7 +1162,7 @@ addressbook_migrate (AddressbookComponent *component, int major, int minor, int
migrate_completion_folders (context);
}
- if (minor < 5 || (minor == 5 && revision <= 7)) {
+ if (minor < 5 || (minor == 5 && micro <= 7)) {
dialog_set_label (context,
_("The format of mailing list contacts has changed.\n\n"
"Please be patient while Evolution migrates your "
@@ -1155,7 +1171,7 @@ addressbook_migrate (AddressbookComponent *component, int major, int minor, int
migrate_contact_lists_for_local_folders (context, on_this_computer);
}
- if (minor < 5 || (minor == 5 && revision <= 8)) {
+ if (minor < 5 || (minor == 5 && micro <= 8)) {
dialog_set_label (context,
_("The way Evolution stores some phone numbers has changed.\n\n"
"Please be patient while Evolution migrates your "
@@ -1164,15 +1180,14 @@ addressbook_migrate (AddressbookComponent *component, int major, int minor, int
migrate_company_phone_for_local_folders (context, on_this_computer);
}
- if (minor < 5 || (minor == 5 && revision <= 10)) {
+ if (minor < 5 || (minor == 5 && micro <= 10)) {
char *old_path, *new_path;
dialog_set_label (context, _("Evolution's Palm Sync changelog and map files have changed.\n\n"
"Please be patient while Evolution migrates your Pilot Sync data..."));
old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Contacts", NULL);
- new_path = g_build_filename (addressbook_component_peek_base_directory (component),
- "local", "system", NULL);
+ new_path = g_build_filename (data_dir, "local", "system", NULL);
migrate_pilot_data (old_path, new_path);
g_free (new_path);
g_free (old_path);
@@ -1184,7 +1199,7 @@ addressbook_migrate (AddressbookComponent *component, int major, int minor, int
during one phase of development, as they take
precedent over relative uris (but aren't updated
when editing an ESource). */
- if (minor == 5 && revision <= 11) {
+ if (minor == 5 && micro <= 11) {
GSList *g;
for (g = e_source_list_peek_groups (context->source_list); g; g = g->next) {
ESourceGroup *group = g->data;
diff --git a/addressbook/gui/component/addressbook-migrate.h b/addressbook/gui/component/e-book-shell-migrate.h
index 5727b3d0ab..cb6128910a 100644
--- a/addressbook/gui/component/addressbook-migrate.h
+++ b/addressbook/gui/component/e-book-shell-migrate.h
@@ -1,4 +1,5 @@
/*
+ * e-book-shell-migrate.h
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,13 +22,20 @@
*
*/
-#ifndef _ADDRESSBOOK_MIGRATE_H_
-#define _ADDRESSBOOK_MIGRATE_H_
+#ifndef E_BOOK_SHELL_MIGRATE_H
+#define E_BOOK_SHELL_MIGRATE_H
-#include "addressbook-component.h"
+#include <glib.h>
+#include <shell/e-shell-backend.h>
-struct _GError;
+G_BEGIN_DECLS
-int addressbook_migrate (AddressbookComponent *component, int major, int minor, int revision, struct _GError **err);
+gboolean e_book_shell_backend_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error);
-#endif /* _ADDRESSBOOK_MIGRATE_H_ */
+G_END_DECLS
+
+#endif /* E_BOOK_SHELL_MIGRATE_H */
diff --git a/addressbook/gui/component/e-book-shell-sidebar.c b/addressbook/gui/component/e-book-shell-sidebar.c
new file mode 100644
index 0000000000..fc283e28d7
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-sidebar.c
@@ -0,0 +1,232 @@
+/*
+ * e-book-shell-sidebar.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-book-shell-sidebar.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+
+#include "e-book-shell-view.h"
+#include "e-book-shell-backend.h"
+#include "e-addressbook-selector.h"
+
+#define E_BOOK_SHELL_SIDEBAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_BOOK_SHELL_SIDEBAR, EBookShellSidebarPrivate))
+
+struct _EBookShellSidebarPrivate {
+ GtkWidget *selector;
+};
+
+enum {
+ PROP_0,
+ PROP_SELECTOR
+};
+
+static gpointer parent_class;
+static GType book_shell_sidebar_type;
+
+static void
+book_shell_sidebar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SELECTOR:
+ g_value_set_object (
+ value, e_book_shell_sidebar_get_selector (
+ E_BOOK_SHELL_SIDEBAR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+book_shell_sidebar_dispose (GObject *object)
+{
+ EBookShellSidebarPrivate *priv;
+
+ priv = E_BOOK_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ if (priv->selector != NULL) {
+ g_object_unref (priv->selector);
+ priv->selector = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+book_shell_sidebar_constructed (GObject *object)
+{
+ EBookShellSidebarPrivate *priv;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ EShellSidebar *shell_sidebar;
+ ESourceList *source_list;
+ GtkContainer *container;
+ GtkWidget *widget;
+
+ priv = E_BOOK_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ shell_sidebar = E_SHELL_SIDEBAR (object);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ source_list = e_book_shell_backend_get_source_list (
+ E_BOOK_SHELL_BACKEND (shell_backend));
+
+ container = GTK_CONTAINER (shell_sidebar);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_container_add (container, widget);
+ gtk_widget_show (widget);
+
+ container = GTK_CONTAINER (widget);
+
+ widget = e_addressbook_selector_new (source_list);
+ e_source_selector_show_selection (E_SOURCE_SELECTOR (widget), FALSE);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->selector = g_object_ref (widget);
+ gtk_widget_show (widget);
+}
+
+static guint32
+book_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
+{
+ EBookShellSidebar *book_shell_sidebar;
+ ESourceSelector *selector;
+ ESource *source;
+ gboolean is_system = FALSE;
+ guint32 state = 0;
+
+ book_shell_sidebar = E_BOOK_SHELL_SIDEBAR (shell_sidebar);
+ selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+
+ if (source != NULL) {
+ const gchar *uri;
+
+ uri = e_source_peek_relative_uri (source);
+ is_system = (uri == NULL || strcmp (uri, "system") == 0);
+ }
+
+ if (source != NULL)
+ state |= E_BOOK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
+ if (is_system)
+ state |= E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM;
+
+ return state;
+}
+
+static void
+book_shell_sidebar_class_init (EBookShellSidebarClass *class)
+{
+ GObjectClass *object_class;
+ EShellSidebarClass *shell_sidebar_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EBookShellSidebarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = book_shell_sidebar_get_property;
+ object_class->dispose = book_shell_sidebar_dispose;
+ object_class->constructed = book_shell_sidebar_constructed;
+
+ shell_sidebar_class = E_SHELL_SIDEBAR_CLASS (class);
+ shell_sidebar_class->check_state = book_shell_sidebar_check_state;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SELECTOR,
+ g_param_spec_object (
+ "selector",
+ _("Source Selector Widget"),
+ _("This widget displays groups of address books"),
+ E_TYPE_SOURCE_SELECTOR,
+ G_PARAM_READABLE));
+}
+
+static void
+book_shell_sidebar_init (EBookShellSidebar *book_shell_sidebar)
+{
+ book_shell_sidebar->priv =
+ E_BOOK_SHELL_SIDEBAR_GET_PRIVATE (book_shell_sidebar);
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_book_shell_sidebar_get_type (void)
+{
+ return book_shell_sidebar_type;
+}
+
+void
+e_book_shell_sidebar_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (EBookShellSidebarClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) book_shell_sidebar_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EBookShellSidebar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) book_shell_sidebar_init,
+ NULL /* value_table */
+ };
+
+ book_shell_sidebar_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_SIDEBAR,
+ "EBookShellSidebar", &type_info, 0);
+}
+
+GtkWidget *
+e_book_shell_sidebar_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_BOOK_SHELL_SIDEBAR,
+ "shell-view", shell_view, NULL);
+}
+
+ESourceSelector *
+e_book_shell_sidebar_get_selector (EBookShellSidebar *book_shell_sidebar)
+{
+ g_return_val_if_fail (
+ E_IS_BOOK_SHELL_SIDEBAR (book_shell_sidebar), NULL);
+
+ return E_SOURCE_SELECTOR (book_shell_sidebar->priv->selector);
+}
diff --git a/addressbook/gui/component/e-book-shell-sidebar.h b/addressbook/gui/component/e-book-shell-sidebar.h
new file mode 100644
index 0000000000..716523f971
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-sidebar.h
@@ -0,0 +1,79 @@
+/*
+ * e-book-shell-sidebar.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_BOOK_SHELL_SIDEBAR_H
+#define E_BOOK_SHELL_SIDEBAR_H
+
+#include <libedataserverui/e-source-selector.h>
+
+#include <shell/e-shell-sidebar.h>
+#include <shell/e-shell-view.h>
+
+/* Standard GObject macros */
+#define E_TYPE_BOOK_SHELL_SIDEBAR \
+ (e_book_shell_sidebar_get_type ())
+#define E_BOOK_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_BOOK_SHELL_SIDEBAR, EBookShellSidebar))
+#define E_BOOK_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_BOOK_SHELL_SIDEBAR, EBookShellSidebarClass))
+#define E_IS_BOOK_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_BOOK_SHELL_SIDEBAR))
+#define E_IS_BOOK_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_BOOK_SHELL_SIDEBAR))
+#define E_BOOK_SHELL_SIDEBAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_BOOK_SHELL_SIDEBAR, EBookShellSidebarClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EBookShellSidebar EBookShellSidebar;
+typedef struct _EBookShellSidebarClass EBookShellSidebarClass;
+typedef struct _EBookShellSidebarPrivate EBookShellSidebarPrivate;
+
+enum {
+ E_BOOK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE = 1 << 0,
+ E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM = 1 << 1
+};
+
+struct _EBookShellSidebar {
+ EShellSidebar parent;
+ EBookShellSidebarPrivate *priv;
+};
+
+struct _EBookShellSidebarClass {
+ EShellSidebarClass parent_class;
+};
+
+GType e_book_shell_sidebar_get_type (void);
+void e_book_shell_sidebar_register_type
+ (GTypeModule *type_module);
+GtkWidget * e_book_shell_sidebar_new(EShellView *shell_view);
+ESourceSelector *
+ e_book_shell_sidebar_get_selector
+ (EBookShellSidebar *book_shell_sidebar);
+
+G_END_DECLS
+
+#endif /* E_BOOK_SHELL_SIDEBAR_H */
diff --git a/addressbook/gui/component/e-book-shell-view-actions.c b/addressbook/gui/component/e-book-shell-view-actions.c
new file mode 100644
index 0000000000..35d0e8f8c8
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-view-actions.c
@@ -0,0 +1,982 @@
+/*
+ * e-book-shell-view-actions.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-book-shell-view-private.h"
+
+#include <e-util/e-error.h>
+#include <e-util/e-util.h>
+#include <filter/filter-rule.h>
+
+#include <addressbook-config.h>
+
+static void
+action_address_book_copy_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ e_addressbook_view_copy_to_folder (view, TRUE);
+}
+
+static void
+action_address_book_delete_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EBookShellBackend *book_shell_backend;
+ EBookShellSidebar *book_shell_sidebar;
+ ESource *source;
+ ESourceSelector *selector;
+ ESourceGroup *source_group;
+ ESourceList *source_list;
+ EBook *book;
+ gint response;
+ GError *error = NULL;
+
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ book_shell_backend = book_shell_view->priv->book_shell_backend;
+ source_list = e_book_shell_backend_get_source_list (book_shell_backend);
+
+ book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
+ selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (source != NULL);
+
+ response = e_error_run (
+ GTK_WINDOW (shell_window),
+ "addressbook:ask-delete-addressbook",
+ e_source_peek_name (source));
+
+ if (response != GTK_RESPONSE_YES)
+ return;
+
+ book = e_book_new (source, &error);
+ if (error != NULL) {
+ g_warning ("Error removing addressbook: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ if (!e_book_remove (book, NULL)) {
+ e_error_run (
+ GTK_WINDOW (shell_window),
+ "addressbook:remove-addressbook", NULL);
+ g_object_unref (book);
+ return;
+ }
+
+ if (e_source_selector_source_is_selected (selector, source))
+ e_source_selector_unselect_source (selector, source);
+
+ source_group = e_source_peek_group (source);
+ e_source_group_remove_source (source_group, source);
+
+ e_source_list_sync (source_list, NULL);
+
+ g_object_unref (book);
+}
+
+static void
+action_address_book_move_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ e_addressbook_view_move_to_folder (view, TRUE);
+}
+
+static void
+action_address_book_new_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ addressbook_config_create_new_source (GTK_WIDGET (shell_window));
+}
+
+static void
+action_address_book_properties_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EBookShellSidebar *book_shell_sidebar;
+ ESource *source;
+ ESourceSelector *selector;
+ EditorUidClosure *closure;
+ GHashTable *uid_to_editor;
+ const gchar *uid;
+
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
+ selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (source != NULL);
+
+ uid = e_source_peek_uid (source);
+ uid_to_editor = book_shell_view->priv->uid_to_editor;
+
+ closure = g_hash_table_lookup (uid_to_editor, uid);
+ if (closure == NULL) {
+ GtkWidget *editor;
+
+ editor = addressbook_config_edit_source (
+ GTK_WIDGET (shell_window), source);
+
+ closure = g_new (EditorUidClosure, 1);
+ closure->editor = editor;
+ closure->uid = g_strdup (uid);
+ closure->view = book_shell_view;
+
+ g_hash_table_insert (uid_to_editor, closure->uid, closure);
+
+ g_object_weak_ref (
+ G_OBJECT (closure->editor), (GWeakNotify)
+ e_book_shell_view_editor_weak_notify, closure);
+ }
+
+ gtk_window_present (GTK_WINDOW (closure->editor));
+}
+
+static void
+action_address_book_rename_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellSidebar *book_shell_sidebar;
+ ESourceSelector *selector;
+
+ book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
+ selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
+
+ e_source_selector_edit_primary_selection (selector);
+}
+
+static void
+action_address_book_save_as_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ e_addressbook_view_save_as (view, TRUE);
+}
+
+static void
+action_address_book_stop_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ e_addressbook_view_stop (view);
+}
+
+static void
+action_contact_clipboard_copy_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ e_book_shell_content_clipboard_copy (book_shell_content);
+}
+
+static void
+action_contact_clipboard_cut_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ e_addressbook_view_cut (view);
+}
+
+static void
+action_contact_clipboard_paste_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ e_addressbook_view_paste (view);
+}
+
+static void
+action_contact_copy_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ e_addressbook_view_copy_to_folder (view, FALSE);
+}
+
+static void
+action_contact_delete_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ e_addressbook_view_delete_selection (view, TRUE);
+}
+
+static void
+action_contact_forward_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+ GList *list, *iter;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ list = e_addressbook_view_get_selected (view);
+ g_return_if_fail (list != NULL);
+
+ /* Convert the list of contacts to a list of destinations. */
+ for (iter = list; iter != NULL; iter = iter->next) {
+ EContact *contact = iter->data;
+ EDestination *destination;
+
+ destination = e_destination_new ();
+ e_destination_set_contact (destination, contact, 0);
+ g_object_unref (contact);
+
+ iter->data = destination;
+ }
+
+ eab_send_as_attachment (list);
+ g_list_foreach (list, (GFunc) g_object_unref, NULL);
+ g_list_free (list);
+}
+
+static void
+action_contact_move_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ e_addressbook_view_move_to_folder (view, FALSE);
+}
+
+static void
+action_contact_new_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+ EAddressbookModel *model;
+ EContact *contact;
+ GtkWidget *editor;
+ EBook *book;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ model = e_addressbook_view_get_model (view);
+ book = e_addressbook_model_get_book (model);
+ g_return_if_fail (book != NULL);
+
+ contact = e_contact_new ();
+ editor = e_contact_editor_new (book, contact, TRUE, TRUE);
+ eab_editor_show (EAB_EDITOR (editor));
+ g_object_unref (contact);
+}
+
+static void
+action_contact_new_list_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+ EAddressbookModel *model;
+ EContact *contact;
+ GtkWidget *editor;
+ EBook *book;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ model = e_addressbook_view_get_model (view);
+ book = e_addressbook_model_get_book (model);
+ g_return_if_fail (book != NULL);
+
+ contact = e_contact_new ();
+ editor = e_contact_list_editor_new (book, contact, TRUE, TRUE);
+ eab_editor_show (EAB_EDITOR (editor));
+ g_object_unref (contact);
+}
+
+static void
+action_contact_open_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ e_addressbook_view_view (view);
+}
+
+static void
+action_contact_preview_cb (GtkToggleAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ gboolean visible;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ visible = gtk_toggle_action_get_active (action);
+ e_book_shell_content_set_preview_visible (book_shell_content, visible);
+}
+
+static void
+action_contact_print_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+ GtkPrintOperationAction print_action;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+ e_addressbook_view_print (view, print_action);
+}
+
+static void
+action_contact_print_preview_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+ GtkPrintOperationAction print_action;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
+ e_addressbook_view_print (view, print_action);
+}
+
+static void
+action_contact_save_as_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ e_addressbook_view_save_as (view, FALSE);
+}
+
+static void
+action_contact_select_all_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ e_addressbook_view_select_all (view);
+}
+
+static void
+action_contact_send_message_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+ GList *list, *iter;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ list = e_addressbook_view_get_selected (view);
+ g_return_if_fail (list != NULL);
+
+ /* Convert the list of contacts to a list of destinations. */
+ for (iter = list; iter != NULL; iter = iter->next) {
+ EContact *contact = iter->data;
+ EDestination *destination;
+
+ destination = e_destination_new ();
+ e_destination_set_contact (destination, contact, 0);
+ g_object_unref (contact);
+
+ iter->data = destination;
+ }
+
+ eab_send_as_to (list);
+ g_list_foreach (list, (GFunc) g_object_unref, NULL);
+ g_list_free (list);
+}
+
+static void
+action_gal_save_custom_view_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EShellView *shell_view;
+ EAddressbookView *address_view;
+ GalViewInstance *view_instance;
+
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with saving the custom view. */
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ address_view = e_book_shell_content_get_current_view (book_shell_content);
+ view_instance = e_addressbook_view_get_view_instance (address_view);
+ gal_view_instance_save_as (view_instance);
+}
+
+static void
+action_search_execute_cb (GtkAction *action,
+ EBookShellView *book_shell_view)
+{
+ EShellView *shell_view;
+
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with executing the search. */
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ e_book_shell_view_execute_search (book_shell_view);
+}
+
+static void
+action_search_filter_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EBookShellView *book_shell_view)
+{
+ e_book_shell_view_execute_search (book_shell_view);
+}
+
+static GtkActionEntry contact_entries[] = {
+
+ { "address-book-copy",
+ GTK_STOCK_COPY,
+ N_("Co_py All Contacts To..."),
+ NULL,
+ N_("Copy the contacts of the selected address book to another"),
+ G_CALLBACK (action_address_book_copy_cb) },
+
+ { "address-book-delete",
+ GTK_STOCK_DELETE,
+ N_("Del_ete Address Book"),
+ NULL,
+ N_("Delete the selected address book"),
+ G_CALLBACK (action_address_book_delete_cb) },
+
+ { "address-book-move",
+ "folder-move",
+ N_("Mo_ve All Contacts To..."),
+ NULL,
+ N_("Move the contacts of the selected address book to another"),
+ G_CALLBACK (action_address_book_move_cb) },
+
+ { "address-book-new",
+ "address-book-new",
+ N_("_New Address Book"),
+ NULL,
+ N_("Create a new address book"),
+ G_CALLBACK (action_address_book_new_cb) },
+
+ { "address-book-properties",
+ GTK_STOCK_PROPERTIES,
+ N_("Address _Book Properties"),
+ NULL,
+ N_("Show properties of the selected address book"),
+ G_CALLBACK (action_address_book_properties_cb) },
+
+ { "address-book-rename",
+ NULL,
+ N_("_Rename..."),
+ "F2",
+ N_("Rename the selected address book"),
+ G_CALLBACK (action_address_book_rename_cb) },
+
+ { "address-book-save-as",
+ GTK_STOCK_SAVE_AS,
+ N_("S_ave Address Book as vCard"),
+ NULL,
+ N_("Save the contacts of the selected address book as a vCard"),
+ G_CALLBACK (action_address_book_save_as_cb) },
+
+ { "address-book-stop",
+ GTK_STOCK_STOP,
+ NULL,
+ NULL,
+ N_("Stop loading"),
+ G_CALLBACK (action_address_book_stop_cb) },
+
+ { "contact-clipboard-copy",
+ GTK_STOCK_COPY,
+ NULL,
+ NULL,
+ N_("Copy the selection"),
+ G_CALLBACK (action_contact_clipboard_copy_cb) },
+
+ { "contact-clipboard-cut",
+ GTK_STOCK_CUT,
+ NULL,
+ NULL,
+ N_("Cut the selection"),
+ G_CALLBACK (action_contact_clipboard_cut_cb) },
+
+ { "contact-clipboard-paste",
+ GTK_STOCK_PASTE,
+ NULL,
+ NULL,
+ N_("Paste the clipboard"),
+ G_CALLBACK (action_contact_clipboard_paste_cb) },
+
+ { "contact-copy",
+ NULL,
+ N_("_Copy Contact To..."),
+ "<Control><Shift>y",
+ N_("Copy selected contacts to another address book"),
+ G_CALLBACK (action_contact_copy_cb) },
+
+ { "contact-delete",
+ GTK_STOCK_DELETE,
+ N_("_Delete Contact"),
+ "<Control>d",
+ N_("Delete selected contacts"),
+ G_CALLBACK (action_contact_delete_cb) },
+
+ { "contact-forward",
+ "mail-forward",
+ N_("_Forward Contact..."),
+ NULL,
+ N_("Send selected contacts to another person"),
+ G_CALLBACK (action_contact_forward_cb) },
+
+ { "contact-move",
+ NULL,
+ N_("_Move Contact To..."),
+ "<Control><Shift>v",
+ N_("Move selected contacts to another address book"),
+ G_CALLBACK (action_contact_move_cb) },
+
+ { "contact-new",
+ "contact-new",
+ N_("_New Contact..."),
+ NULL,
+ N_("Create a new contact"),
+ G_CALLBACK (action_contact_new_cb) },
+
+ { "contact-new-list",
+ "stock_contact-list",
+ N_("New Contact _List..."),
+ NULL,
+ N_("Create a new contact list"),
+ G_CALLBACK (action_contact_new_list_cb) },
+
+ { "contact-open",
+ NULL,
+ N_("_Open"),
+ "<Control>o",
+ N_("View the current contact"),
+ G_CALLBACK (action_contact_open_cb) },
+
+ { "contact-save-as",
+ GTK_STOCK_SAVE_AS,
+ N_("Save as vCard..."),
+ NULL,
+ N_("Save selected contacts as a vCard"),
+ G_CALLBACK (action_contact_save_as_cb) },
+
+ { "contact-select-all",
+ GTK_STOCK_SELECT_ALL,
+ NULL,
+ NULL,
+ N_("Select all contacts"),
+ G_CALLBACK (action_contact_select_all_cb) },
+
+ { "contact-send-message",
+ "mail-message-new",
+ N_("_Send Message to Contact..."),
+ NULL,
+ N_("Send a message to the selected contacts"),
+ G_CALLBACK (action_contact_send_message_cb) },
+
+ /*** Menus ***/
+
+ { "actions-menu",
+ NULL,
+ N_("_Actions"),
+ NULL,
+ NULL,
+ NULL }
+};
+
+static EPopupActionEntry contact_popup_entries[] = {
+
+ { "address-book-popup-delete",
+ N_("_Delete"),
+ "address-book-delete" },
+
+ { "address-book-popup-properties",
+ N_("_Properties"),
+ "address-book-properties" },
+
+ { "address-book-popup-rename",
+ NULL,
+ "address-book-rename" },
+
+ { "address-book-popup-save-as",
+ N_("_Save as vCard..."),
+ "address-book-save-as" },
+
+ { "contact-popup-clipboard-copy",
+ NULL,
+ "contact-clipboard-copy" },
+
+ { "contact-popup-clipboard-cut",
+ NULL,
+ "contact-clipboard-cut" },
+
+ { "contact-popup-clipboard-paste",
+ NULL,
+ "contact-clipboard-paste" },
+
+ { "contact-popup-copy",
+ NULL,
+ "contact-copy" },
+
+ { "contact-popup-delete",
+ NULL,
+ "contact-delete" },
+
+ { "contact-popup-forward",
+ NULL,
+ "contact-forward" },
+
+ { "contact-popup-move",
+ NULL,
+ "contact-move" },
+
+ { "contact-popup-open",
+ NULL,
+ "contact-open" },
+
+ { "contact-popup-save-as",
+ NULL,
+ "contact-save-as" },
+
+ { "contact-popup-send-message",
+ NULL,
+ "contact-send-message" },
+};
+
+static GtkToggleActionEntry contact_toggle_entries[] = {
+
+ { "contact-preview",
+ NULL,
+ N_("Contact _Preview"),
+ "<Control>m",
+ N_("Show contact preview window"),
+ G_CALLBACK (action_contact_preview_cb),
+ TRUE }
+};
+
+static GtkRadioActionEntry contact_filter_entries[] = {
+
+ { "contact-filter-any-category",
+ NULL,
+ N_("Any Category"),
+ NULL,
+ NULL,
+ CONTACT_FILTER_ANY_CATEGORY },
+
+ { "contact-filter-unmatched",
+ NULL,
+ N_("Unmatched"),
+ NULL,
+ NULL,
+ CONTACT_FILTER_UNMATCHED }
+};
+
+static GtkRadioActionEntry contact_search_entries[] = {
+
+ { "contact-search-any-field-contains",
+ NULL,
+ N_("Any field contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CONTACT_SEARCH_ANY_FIELD_CONTAINS },
+
+ { "contact-search-email-begins-with",
+ NULL,
+ N_("Email begins with"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CONTACT_SEARCH_EMAIL_BEGINS_WITH },
+
+ { "contact-search-name-contains",
+ NULL,
+ N_("Name contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CONTACT_SEARCH_NAME_CONTAINS }
+};
+
+static GtkActionEntry lockdown_printing_entries[] = {
+
+ { "contact-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ "<Control>p",
+ N_("Print selected contacts"),
+ G_CALLBACK (action_contact_print_cb) },
+
+ { "contact-print-preview",
+ GTK_STOCK_PRINT_PREVIEW,
+ NULL,
+ NULL,
+ N_("Preview the contacts to be printed"),
+ G_CALLBACK (action_contact_print_preview_cb) }
+};
+
+static EPopupActionEntry lockdown_printing_popup_entries[] = {
+
+ { "contact-popup-print",
+ NULL,
+ "contact-print" }
+};
+
+void
+e_book_shell_view_actions_init (EBookShellView *book_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+ GConfBridge *bridge;
+ GtkAction *action;
+ GObject *object;
+ const gchar *key;
+
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ /* Contact Actions */
+ action_group = ACTION_GROUP (CONTACTS);
+ gtk_action_group_add_actions (
+ action_group, contact_entries,
+ G_N_ELEMENTS (contact_entries), book_shell_view);
+ e_action_group_add_popup_actions (
+ action_group, contact_popup_entries,
+ G_N_ELEMENTS (contact_popup_entries));
+ gtk_action_group_add_toggle_actions (
+ action_group, contact_toggle_entries,
+ G_N_ELEMENTS (contact_toggle_entries), book_shell_view);
+ gtk_action_group_add_radio_actions (
+ action_group, contact_search_entries,
+ G_N_ELEMENTS (contact_search_entries),
+ CONTACT_SEARCH_NAME_CONTAINS,
+ NULL, NULL);
+
+ /* Lockdown Printing Actions */
+ action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
+ gtk_action_group_add_actions (
+ action_group, lockdown_printing_entries,
+ G_N_ELEMENTS (lockdown_printing_entries), book_shell_view);
+ e_action_group_add_popup_actions (
+ action_group, lockdown_printing_popup_entries,
+ G_N_ELEMENTS (lockdown_printing_popup_entries));
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (ACTION (CONTACT_PREVIEW));
+ key = "/apps/evolution/addressbook/display/show_preview";
+ gconf_bridge_bind_property (bridge, key, object, "active");
+
+ /* Fine tuning. */
+
+ action = ACTION (CONTACT_DELETE);
+ g_object_set (action, "short-label", _("Delete"), NULL);
+
+ g_signal_connect (
+ ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
+ G_CALLBACK (action_gal_save_custom_view_cb), book_shell_view);
+
+ g_signal_connect (
+ ACTION (SEARCH_EXECUTE), "activate",
+ G_CALLBACK (action_search_execute_cb), book_shell_view);
+}
+
+void
+e_book_shell_view_update_search_filter (EBookShellView *book_shell_view)
+{
+ EShellView *shell_view;
+ EShellContent *shell_content;
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+ GtkRadioAction *radio_action;
+ GList *list, *iter;
+ GSList *group;
+ gint ii;
+
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ action_group = ACTION_GROUP (CONTACTS_FILTER);
+ e_action_group_remove_all_actions (action_group);
+
+ /* Add the standard filter actions. */
+ gtk_action_group_add_radio_actions (
+ action_group, contact_filter_entries,
+ G_N_ELEMENTS (contact_filter_entries),
+ CONTACT_FILTER_ANY_CATEGORY,
+ G_CALLBACK (action_search_filter_cb),
+ book_shell_view);
+
+ /* Retrieve the radio group from an action we just added. */
+ list = gtk_action_group_list_actions (action_group);
+ radio_action = GTK_RADIO_ACTION (list->data);
+ group = gtk_radio_action_get_group (radio_action);
+ g_list_free (list);
+
+ /* Build the category actions. */
+
+ list = e_categories_get_list ();
+ for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
+ const gchar *category_name = iter->data;
+ const gchar *filename;
+ GtkAction *action;
+ gchar *action_name;
+
+ action_name = g_strdup_printf (
+ "contact-filter-category-%d", ii);
+ radio_action = gtk_radio_action_new (
+ action_name, category_name, NULL, NULL, ii);
+ g_free (action_name);
+
+ /* Convert the category icon file to a themed icon name. */
+ filename = e_categories_get_icon_file_for (category_name);
+ if (filename != NULL && *filename != '\0') {
+ gchar *basename;
+ gchar *cp;
+
+ basename = g_path_get_basename (filename);
+
+ /* Lose the file extension. */
+ if ((cp = strrchr (basename, '.')) != NULL)
+ *cp = '\0';
+
+ g_object_set (
+ radio_action, "icon-name", basename, NULL);
+
+ g_free (basename);
+ }
+
+ gtk_radio_action_set_group (radio_action, group);
+ group = gtk_radio_action_get_group (radio_action);
+
+ /* The action group takes ownership of the action. */
+ action = GTK_ACTION (radio_action);
+ gtk_action_group_add_action (action_group, action);
+ g_object_unref (radio_action);
+ }
+ g_list_free (list);
+
+ /* Use any action in the group; doesn't matter which. */
+ e_shell_content_set_filter_action (shell_content, radio_action);
+
+ ii = CONTACT_FILTER_UNMATCHED;
+ e_shell_content_add_filter_separator_after (shell_content, ii);
+}
diff --git a/addressbook/gui/component/e-book-shell-view-actions.h b/addressbook/gui/component/e-book-shell-view-actions.h
new file mode 100644
index 0000000000..8e3d31f7bf
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-view-actions.h
@@ -0,0 +1,91 @@
+/*
+ * e-book-shell-view-actions.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_BOOK_SHELL_VIEW_ACTIONS_H
+#define E_BOOK_SHELL_VIEW_ACTIONS_H
+
+#include <shell/e-shell-window-actions.h>
+
+/* Address Book Actions */
+#define E_SHELL_WINDOW_ACTION_ADDRESS_BOOK_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "address-book-copy")
+#define E_SHELL_WINDOW_ACTION_ADDRESS_BOOK_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "address-book-delete")
+#define E_SHELL_WINDOW_ACTION_ADDRESS_BOOK_MOVE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "address-book-move")
+#define E_SHELL_WINDOW_ACTION_ADDRESS_BOOK_PROPERTIES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "address-book-properties")
+#define E_SHELL_WINDOW_ACTION_ADDRESS_BOOK_RENAME(window) \
+ E_SHELL_WINDOW_ACTION ((window), "address-book-rename")
+#define E_SHELL_WINDOW_ACTION_ADDRESS_BOOK_SAVE_AS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "address-book-save-as")
+#define E_SHELL_WINDOW_ACTION_ADDRESS_BOOK_STOP(window) \
+ E_SHELL_WINDOW_ACTION ((window), "address-book-stop")
+
+/* Contact Actions */
+#define E_SHELL_WINDOW_ACTION_CONTACT_CLIPBOARD_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-clipboard-copy")
+#define E_SHELL_WINDOW_ACTION_CONTACT_CLIPBOARD_CUT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-clipboard-cut")
+#define E_SHELL_WINDOW_ACTION_CONTACT_CLIPBOARD_PASTE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-clipboard-paste")
+#define E_SHELL_WINDOW_ACTION_CONTACT_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-copy")
+#define E_SHELL_WINDOW_ACTION_CONTACT_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-delete")
+#define E_SHELL_WINDOW_ACTION_CONTACT_FORWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-forward")
+#define E_SHELL_WINDOW_ACTION_CONTACT_MOVE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-move")
+#define E_SHELL_WINDOW_ACTION_CONTACT_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-new")
+#define E_SHELL_WINDOW_ACTION_CONTACT_NEW_LIST(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-new-list")
+#define E_SHELL_WINDOW_ACTION_CONTACT_OPEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-open")
+#define E_SHELL_WINDOW_ACTION_CONTACT_PREVIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-preview")
+#define E_SHELL_WINDOW_ACTION_CONTACT_PRINT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-print")
+#define E_SHELL_WINDOW_ACTION_CONTACT_PRINT_PREVIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-print-preview")
+#define E_SHELL_WINDOW_ACTION_CONTACT_SAVE_AS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-save-as")
+#define E_SHELL_WINDOW_ACTION_CONTACT_SELECT_ALL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-select-all")
+#define E_SHELL_WINDOW_ACTION_CONTACT_SEND_MESSAGE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-send-message")
+
+/* Search Actions */
+#define E_SHELL_WINDOW_ACTION_CONTACT_SEARCH_ANY_FIELD_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-search-any-field-contains")
+#define E_SHELL_WINDOW_ACTION_CONTACT_SEARCH_EMAIL_BEGINS_WITH(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-search-email-begins-with")
+#define E_SHELL_WINDOW_ACTION_CONTACT_SEARCH_NAME_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-search-name-contains")
+
+/* Action Groups */
+#define E_SHELL_WINDOW_ACTION_GROUP_CONTACTS(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "contacts")
+#define E_SHELL_WINDOW_ACTION_GROUP_CONTACTS_FILTER(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "contacts-filter")
+
+#endif /* E_BOOK_SHELL_VIEW_ACTIONS_H */
diff --git a/addressbook/gui/component/e-book-shell-view-private.c b/addressbook/gui/component/e-book-shell-view-private.c
new file mode 100644
index 0000000000..ec3562e87a
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-view-private.c
@@ -0,0 +1,621 @@
+/*
+ * e-book-shell-view-private.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-book-shell-view-private.h"
+
+#include "widgets/menus/gal-view-factory-etable.h"
+#include "addressbook/gui/widgets/gal-view-factory-minicard.h"
+
+#include "addressbook.h"
+
+static void
+open_contact (EBookShellView *book_shell_view,
+ EContact *contact,
+ gboolean is_new_contact,
+ EAddressbookView *view)
+{
+ EAddressbookModel *model;
+ GtkWidget *editor;
+ EBook *book;
+ gboolean editable;
+
+ model = e_addressbook_view_get_model (view);
+ book = e_addressbook_model_get_book (model);
+ editable = e_addressbook_model_get_editable (model);
+
+ if (e_contact_get (contact, E_CONTACT_IS_LIST))
+ editor = e_contact_list_editor_new (
+ book, contact, is_new_contact, editable);
+ else
+ editor = e_contact_editor_new (
+ book, contact, is_new_contact, editable);
+
+ eab_editor_show (EAB_EDITOR (editor));
+}
+
+static void
+popup_event (EBookShellView *book_shell_view,
+ GdkEventButton *event)
+{
+ EShellView *shell_view;
+ const gchar *widget_path;
+
+ widget_path = "/contact-popup";
+ shell_view = E_SHELL_VIEW (book_shell_view);
+
+ e_shell_view_show_popup_menu (shell_view, widget_path, event);
+}
+
+static void
+book_shell_view_selection_change_foreach (gint row,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+ EAddressbookModel *model;
+ EContact *contact;
+
+ /* XXX A "foreach" function is kind of a silly way to retrieve
+ * the one and only selected contact, but this is the only
+ * means that ESelectionModel provides. */
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ model = e_addressbook_view_get_model (view);
+ contact = e_addressbook_model_get_contact (model, row);
+
+ e_book_shell_content_set_preview_contact (book_shell_content, contact);
+}
+
+static void
+selection_change (EBookShellView *book_shell_view,
+ EAddressbookView *view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *current_view;
+ ESelectionModel *selection_model;
+ EShellView *shell_view;
+ gint n_selected;
+
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ current_view = e_book_shell_content_get_current_view (book_shell_content);
+
+ if (view != current_view)
+ return;
+
+ e_shell_view_update_actions (shell_view);
+
+ selection_model = e_addressbook_view_get_selection_model (view);
+
+ n_selected = (selection_model != NULL) ?
+ e_selection_model_selected_count (selection_model) : 0;
+
+ if (n_selected == 1)
+ e_selection_model_foreach (
+ selection_model, (EForeachFunc)
+ book_shell_view_selection_change_foreach,
+ book_shell_view);
+ else
+ e_book_shell_content_set_preview_contact (
+ book_shell_content, NULL);
+}
+
+static void
+contact_changed (EBookShellView *book_shell_view,
+ EContact *contact)
+{
+ EBookShellContent *book_shell_content;
+ EContact *preview_contact;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+
+ preview_contact =
+ e_book_shell_content_get_preview_contact (book_shell_content);
+
+ if (contact != preview_contact)
+ return;
+
+ /* Re-render the same contact. */
+ e_book_shell_content_set_preview_contact (book_shell_content, contact);
+}
+
+static void
+contacts_removed (EBookShellView *book_shell_view,
+ GArray *removed_indices,
+ EAddressbookModel *model)
+{
+ EBookShellContent *book_shell_content;
+ EContact *preview_contact;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+
+ preview_contact =
+ e_book_shell_content_get_preview_contact (book_shell_content);
+
+ if (preview_contact == NULL)
+ return;
+
+ /* Is the displayed contact still in the model? */
+ if (e_addressbook_model_find (model, preview_contact) < 0)
+ return;
+
+ /* If not, clear the contact display. */
+ e_book_shell_content_set_preview_contact (book_shell_content, NULL);
+}
+
+static void
+book_open_cb (EBook *book,
+ EBookStatus status,
+ gpointer user_data)
+{
+ EAddressbookView *view = user_data;
+ EAddressbookModel *model;
+ ESource *source;
+
+ source = e_book_get_source (book);
+ model = e_addressbook_view_get_model (view);
+
+ if (status == E_BOOK_ERROR_OK) {
+ e_addressbook_model_set_book (model, book);
+ e_addressbook_model_force_folder_bar_message (model);
+ } else if (status != E_BOOK_ERROR_CANCELLED)
+ eab_load_error_dialog (NULL /* XXX */, source, status);
+}
+
+static void
+book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
+ ESourceSelector *selector)
+{
+ EShellView *shell_view;
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+ EAddressbookModel *model;
+ ESource *source;
+ GalViewInstance *view_instance;
+ GHashTable *hash_table;
+ GtkWidget *widget;
+ const gchar *uid;
+ gchar *view_id;
+
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ source = e_source_selector_peek_primary_selection (selector);
+
+ if (source == NULL)
+ return;
+
+ uid = e_source_peek_uid (source);
+ hash_table = book_shell_view->priv->uid_to_view;
+ widget = g_hash_table_lookup (hash_table, uid);
+
+ if (widget != NULL) {
+ EBook *book;
+
+ /* There is a view for this UID. Make sure the view
+ * actually contains an EBook. The absence of an EBook
+ * suggests a previous load failed, so try again. */
+ view = E_ADDRESSBOOK_VIEW (widget);
+ model = e_addressbook_view_get_model (view);
+ source = e_addressbook_view_get_source (view);
+
+ if (e_addressbook_model_get_book (model) == NULL) {
+ book = e_book_new (source, NULL);
+
+ if (book != NULL)
+ addressbook_load (book, book_open_cb, view);
+ }
+
+ } else {
+ EBook *book;
+
+ /* Create a view for this UID. */
+ widget = e_addressbook_view_new (shell_view, source);
+ gtk_widget_show (widget);
+
+ e_book_shell_content_insert_view (
+ book_shell_content,
+ E_ADDRESSBOOK_VIEW (widget));
+
+ g_hash_table_insert (
+ hash_table, g_strdup (uid),
+ g_object_ref (widget));
+
+ g_signal_connect_swapped (
+ widget, "open-contact",
+ G_CALLBACK (open_contact), book_shell_view);
+
+ g_signal_connect_swapped (
+ widget, "popup-event",
+ G_CALLBACK (popup_event), book_shell_view);
+
+ g_signal_connect_swapped (
+ widget, "command-state-change",
+ G_CALLBACK (e_shell_view_update_actions),
+ book_shell_view);
+
+ g_signal_connect_swapped (
+ widget, "selection-change",
+ G_CALLBACK (selection_change), book_shell_view);
+
+ book = e_book_new (source, NULL);
+ view = E_ADDRESSBOOK_VIEW (widget);
+
+ if (book != NULL)
+ addressbook_load (book, book_open_cb, view);
+
+ model = e_addressbook_view_get_model (view);
+
+ g_signal_connect_swapped (
+ model, "contact-changed",
+ G_CALLBACK (contact_changed), book_shell_view);
+
+ g_signal_connect_swapped (
+ model, "contacts-removed",
+ G_CALLBACK (contacts_removed), book_shell_view);
+ }
+
+ e_book_shell_content_set_current_view (
+ book_shell_content, E_ADDRESSBOOK_VIEW (widget));
+
+ /* XXX We have to keep the addressbook selector informed of the
+ * current view so it can move contacts via drag-and-drop. */
+ e_addressbook_selector_set_current_view (
+ E_ADDRESSBOOK_SELECTOR (selector),
+ E_ADDRESSBOOK_VIEW (widget));
+
+ view_instance = e_addressbook_view_get_view_instance (view);
+ view_id = gal_view_instance_get_current_view_id (view_instance);
+ e_shell_view_set_view_id (shell_view, view_id);
+ g_free (view_id);
+
+ e_addressbook_model_force_folder_bar_message (model);
+ selection_change (book_shell_view, view);
+}
+
+static gboolean
+book_shell_view_show_popup_menu (GdkEventButton *event,
+ EShellView *shell_view)
+{
+ const gchar *widget_path;
+
+ widget_path = "/address-book-popup";
+ e_shell_view_show_popup_menu (shell_view, widget_path, event);
+
+ return TRUE;
+}
+
+static gboolean
+book_shell_view_selector_button_press_event_cb (EShellView *shell_view,
+ GdkEventButton *event)
+{
+ /* XXX Use ESourceSelector's "popup-event" signal instead. */
+
+ if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
+ return book_shell_view_show_popup_menu (event, shell_view);
+
+ return FALSE;
+}
+
+static gboolean
+book_shell_view_selector_popup_menu_cb (EShellView *shell_view)
+{
+ /* XXX Use ESourceSelector's "popup-event" signal instead. */
+
+ return book_shell_view_show_popup_menu (NULL, shell_view);
+}
+
+static gboolean
+book_shell_view_selector_key_press_event_cb (EShellView *shell_view,
+ GdkEventKey *event)
+{
+ EShellWindow *shell_window;
+
+ /* Needed for the ACTION() macro. */
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ if (event->keyval == GDK_Delete) {
+ gtk_action_activate (ACTION (ADDRESS_BOOK_DELETE));
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+book_shell_view_load_view_collection (EShellViewClass *shell_view_class)
+{
+ GalViewCollection *collection;
+ GalViewFactory *factory;
+ ETableSpecification *spec;
+ const gchar *base_dir;
+ gchar *filename;
+
+ collection = shell_view_class->view_collection;
+
+ base_dir = EVOLUTION_ETSPECDIR;
+ spec = e_table_specification_new ();
+ filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
+ if (!e_table_specification_load_from_file (spec, filename))
+ g_critical ("Unable to load ETable specification file "
+ "for address book");
+ g_free (filename);
+
+ factory = gal_view_factory_etable_new (spec);
+ gal_view_collection_add_factory (collection, factory);
+ g_object_unref (factory);
+ g_object_unref (spec);
+
+ factory = gal_view_factory_minicard_new ();
+ gal_view_collection_add_factory (collection, factory);
+ g_object_unref (factory);
+
+ gal_view_collection_load (collection);
+}
+
+static void
+book_shell_view_notify_view_id_cb (EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EAddressbookView *address_view;
+ GalViewInstance *view_instance;
+ const gchar *view_id;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ address_view = e_book_shell_content_get_current_view (book_shell_content);
+ view_instance = e_addressbook_view_get_view_instance (address_view);
+ view_id = e_shell_view_get_view_id (E_SHELL_VIEW (book_shell_view));
+
+ /* A NULL view ID implies we're in a custom view. But you can
+ * only get to a custom view via the "Define Views" dialog, which
+ * would have already modified the view instance appropriately.
+ * Furthermore, there's no way to refer to a custom view by ID
+ * anyway, since custom views have no IDs. */
+ if (view_id == NULL)
+ return;
+
+ gal_view_instance_set_current_view_id (view_instance, view_id);
+}
+
+void
+e_book_shell_view_private_init (EBookShellView *book_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ EBookShellViewPrivate *priv = book_shell_view->priv;
+ GHashTable *uid_to_view;
+ GHashTable *uid_to_editor;
+
+ uid_to_view = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_object_unref);
+
+ uid_to_editor = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_free);
+
+ priv->uid_to_view = uid_to_view;
+ priv->uid_to_editor = uid_to_editor;
+
+ if (!gal_view_collection_loaded (shell_view_class->view_collection))
+ book_shell_view_load_view_collection (shell_view_class);
+
+ g_signal_connect (
+ book_shell_view, "notify::view-id",
+ G_CALLBACK (book_shell_view_notify_view_id_cb), NULL);
+}
+
+void
+e_book_shell_view_private_constructed (EBookShellView *book_shell_view)
+{
+ EBookShellViewPrivate *priv = book_shell_view->priv;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellBackend *shell_backend;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESourceSelector *selector;
+
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ e_shell_window_add_action_group (shell_window, "contacts");
+ e_shell_window_add_action_group (shell_window, "contacts-filter");
+
+ /* Cache these to avoid lots of awkward casting. */
+ priv->book_shell_backend = g_object_ref (shell_backend);
+ priv->book_shell_content = g_object_ref (shell_content);
+ priv->book_shell_sidebar = g_object_ref (shell_sidebar);
+
+ selector = e_book_shell_sidebar_get_selector (
+ E_BOOK_SHELL_SIDEBAR (shell_sidebar));
+
+ g_signal_connect_swapped (
+ selector, "button-press-event",
+ G_CALLBACK (book_shell_view_selector_button_press_event_cb),
+ book_shell_view);
+
+ g_signal_connect_swapped (
+ selector, "key-press-event",
+ G_CALLBACK (book_shell_view_selector_key_press_event_cb),
+ book_shell_view);
+
+ g_signal_connect_swapped (
+ selector, "popup-menu",
+ G_CALLBACK (book_shell_view_selector_popup_menu_cb),
+ book_shell_view);
+
+ g_signal_connect_swapped (
+ selector, "primary-selection-changed",
+ G_CALLBACK (book_shell_view_activate_selected_source),
+ book_shell_view);
+
+ e_categories_register_change_listener (
+ G_CALLBACK (e_book_shell_view_update_search_filter),
+ book_shell_view);
+
+ e_book_shell_view_actions_init (book_shell_view);
+ book_shell_view_activate_selected_source (book_shell_view, selector);
+ e_book_shell_view_update_search_filter (book_shell_view);
+}
+
+void
+e_book_shell_view_private_dispose (EBookShellView *book_shell_view)
+{
+ EBookShellViewPrivate *priv = book_shell_view->priv;
+
+ DISPOSE (priv->book_shell_backend);
+ DISPOSE (priv->book_shell_content);
+ DISPOSE (priv->book_shell_sidebar);
+
+ g_hash_table_remove_all (priv->uid_to_view);
+ g_hash_table_remove_all (priv->uid_to_editor);
+}
+
+void
+e_book_shell_view_private_finalize (EBookShellView *book_shell_view)
+{
+ EBookShellViewPrivate *priv = book_shell_view->priv;
+
+ g_hash_table_destroy (priv->uid_to_view);
+ g_hash_table_destroy (priv->uid_to_editor);
+}
+
+void
+e_book_shell_view_execute_search (EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellContent *shell_content;
+ GtkAction *action;
+ GString *string;
+ EAddressbookView *view;
+ EAddressbookModel *model;
+ FilterRule *rule;
+ const gchar *format;
+ const gchar *text;
+ gchar *query;
+ gchar *temp;
+ gint value;
+
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ text = e_shell_content_get_search_text (shell_content);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ action = ACTION (CONTACT_SEARCH_ANY_FIELD_CONTAINS);
+ value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
+
+ if (text == NULL || *text == '\0') {
+ text = "";
+ value = CONTACT_SEARCH_ANY_FIELD_CONTAINS;
+ }
+
+ switch (value) {
+ case CONTACT_SEARCH_NAME_CONTAINS:
+ format = "(contains \"full_name\" %s)";
+ break;
+
+ case CONTACT_SEARCH_EMAIL_BEGINS_WITH:
+ format = "(beginswith \"email\" %s)";
+ break;
+
+ default:
+ text = "";
+ /* fall through */
+
+ case CONTACT_SEARCH_ANY_FIELD_CONTAINS:
+ format = "(contains \"x-evolution-any-field\" %s)";
+ break;
+ }
+
+ /* Build the query. */
+ string = g_string_new ("");
+ e_sexp_encode_string (string, text);
+ query = g_strdup_printf (format, string->str);
+ g_string_free (string, TRUE);
+
+ /* Apply selected filter. */
+ value = e_shell_content_get_filter_value (shell_content);
+ switch (value) {
+ case CONTACT_FILTER_ANY_CATEGORY:
+ break;
+
+ case CONTACT_FILTER_UNMATCHED:
+ temp = g_strdup_printf (
+ "(and (not (and (exists \"CATEGORIES\") "
+ "(not (is \"CATEGORIES\" \"\")))) %s)",
+ query);
+ g_free (query);
+ query = temp;
+ break;
+
+ default:
+ {
+ GList *categories;
+ const gchar *category_name;
+
+ categories = e_categories_get_list ();
+ category_name = g_list_nth_data (categories, value);
+ g_list_free (categories);
+
+ temp = g_strdup_printf (
+ "(and (is \"category_list\" \"%s\") %s)",
+ category_name, query);
+ g_free (query);
+ query = temp;
+ }
+ }
+
+ /* XXX This is wrong. We need to programmatically construct a
+ * FilterRule, tell it to build code, and pass the resulting
+ * expression string to EAddressbookModel. */
+ rule = filter_rule_new ();
+ e_shell_content_set_search_rule (shell_content, rule);
+ g_object_unref (rule);
+
+ /* Submit the query. */
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ model = e_addressbook_view_get_model (view);
+ e_addressbook_model_set_query (model, query);
+ g_free (query);
+
+ e_book_shell_content_set_preview_contact (book_shell_content, NULL);
+}
+
+void
+e_book_shell_view_editor_weak_notify (EditorUidClosure *closure,
+ GObject *where_the_object_was)
+{
+ GHashTable *hash_table;
+
+ hash_table = closure->view->priv->uid_to_editor;
+ g_hash_table_remove (hash_table, closure->uid);
+}
diff --git a/addressbook/gui/component/e-book-shell-view-private.h b/addressbook/gui/component/e-book-shell-view-private.h
new file mode 100644
index 0000000000..b4701aea81
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-view-private.h
@@ -0,0 +1,129 @@
+/*
+ * e-book-shell-view-private.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_BOOK_SHELL_VIEW_PRIVATE_H
+#define E_BOOK_SHELL_VIEW_PRIVATE_H
+
+#include "e-book-shell-view.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
+#include <libebook/e-book.h>
+#include <libedataserver/e-categories.h>
+#include <libedataserver/e-sexp.h>
+#include <libedataserverui/e-source-selector.h>
+
+#include "e-util/gconf-bridge.h"
+#include "shell/e-shell-content.h"
+#include "shell/e-shell-sidebar.h"
+#include "misc/e-popup-action.h"
+
+#include "addressbook/gui/contact-editor/e-contact-editor.h"
+#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
+#include "addressbook/gui/widgets/eab-gui-util.h"
+#include "addressbook/gui/widgets/e-addressbook-view.h"
+#include "addressbook/gui/widgets/e-addressbook-selector.h"
+
+#include "e-book-shell-backend.h"
+#include "e-book-shell-content.h"
+#include "e-book-shell-sidebar.h"
+#include "e-book-shell-view-actions.h"
+
+#define E_BOOK_SHELL_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_BOOK_SHELL_VIEW, EBookShellViewPrivate))
+
+/* Shorthand, requires a variable named "shell_window". */
+#define ACTION(name) \
+ (E_SHELL_WINDOW_ACTION_##name (shell_window))
+#define ACTION_GROUP(name) \
+ (E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window))
+
+/* For use in dispose() methods. */
+#define DISPOSE(obj) \
+ G_STMT_START { \
+ if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \
+ } G_STMT_END
+
+/* ETable Specifications */
+#define ETSPEC_FILENAME "e-addressbook-view.etspec"
+
+G_BEGIN_DECLS
+
+typedef struct _EditorUidClosure EditorUidClosure;
+
+struct _EditorUidClosure {
+ GtkWidget *editor;
+ gchar *uid;
+ EBookShellView *view;
+};
+
+/* List these in the order to be displayed.
+ * Positive values are reserved for categories. */
+enum {
+ CONTACT_FILTER_ANY_CATEGORY = -2,
+ CONTACT_FILTER_UNMATCHED = -1
+};
+
+/* List these in the order to be displayed. */
+enum {
+ CONTACT_SEARCH_NAME_CONTAINS,
+ CONTACT_SEARCH_EMAIL_BEGINS_WITH,
+ CONTACT_SEARCH_ANY_FIELD_CONTAINS
+};
+
+struct _EBookShellViewPrivate {
+
+ /* These are just for convenience. */
+ EBookShellBackend *book_shell_backend;
+ EBookShellContent *book_shell_content;
+ EBookShellSidebar *book_shell_sidebar;
+
+ GHashTable *uid_to_view;
+ GHashTable *uid_to_editor;
+};
+
+void e_book_shell_view_private_init
+ (EBookShellView *book_shell_view,
+ EShellViewClass *shell_view_class);
+void e_book_shell_view_private_constructed
+ (EBookShellView *book_shell_view);
+void e_book_shell_view_private_dispose
+ (EBookShellView *book_shell_view);
+void e_book_shell_view_private_finalize
+ (EBookShellView *book_shell_view);
+
+/* Private Utilities */
+
+void e_book_shell_view_actions_init
+ (EBookShellView *book_shell_view);
+void e_book_shell_view_execute_search
+ (EBookShellView *book_shell_view);
+void e_book_shell_view_editor_weak_notify
+ (EditorUidClosure *closure,
+ GObject *where_the_object_was);
+void e_book_shell_view_update_search_filter
+ (EBookShellView *book_shell_view);
+
+G_END_DECLS
+
+#endif /* E_BOOK_SHELL_VIEW_PRIVATE_H */
diff --git a/addressbook/gui/component/e-book-shell-view.c b/addressbook/gui/component/e-book-shell-view.c
new file mode 100644
index 0000000000..ea48bb534c
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-view.c
@@ -0,0 +1,318 @@
+/*
+ * e-book-shell-view.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-book-shell-view-private.h"
+
+static gpointer parent_class;
+static GType book_shell_view_type;
+
+static void
+book_shell_view_source_list_changed_cb (EBookShellView *book_shell_view,
+ ESourceList *source_list)
+{
+ EBookShellViewPrivate *priv = book_shell_view->priv;
+ EBookShellContent *book_shell_content;
+ EShellView *shell_view;
+ GList *keys, *iter;
+
+ shell_view = E_SHELL_VIEW (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+
+ keys = g_hash_table_get_keys (priv->uid_to_view);
+ for (iter = keys; iter != NULL; iter = iter->next) {
+ gchar *uid = iter->data;
+ EAddressbookView *view;
+
+ /* If the source still exists, move on. */
+ if (e_source_list_peek_source_by_uid (source_list, uid))
+ continue;
+
+ /* Remove the view for the deleted source. */
+ view = g_hash_table_lookup (priv->uid_to_view, uid);
+ e_book_shell_content_remove_view (book_shell_content, view);
+ g_hash_table_remove (priv->uid_to_view, uid);
+ }
+ g_list_free (keys);
+
+ keys = g_hash_table_get_keys (priv->uid_to_editor);
+ for (iter = keys; iter != NULL; iter = iter->next) {
+ gchar *uid = iter->data;
+ EditorUidClosure *closure;
+
+ /* If the source still exists, move on. */
+ if (e_source_list_peek_source_by_uid (source_list, uid))
+ continue;
+
+ /* Remove the editor for the deleted source. */
+ closure = g_hash_table_lookup (priv->uid_to_editor, uid);
+ g_object_weak_unref (
+ G_OBJECT (closure->editor), (GWeakNotify)
+ e_book_shell_view_editor_weak_notify, closure);
+ gtk_widget_destroy (closure->editor);
+ g_hash_table_remove (priv->uid_to_editor, uid);
+ }
+ g_list_free (keys);
+
+ e_shell_view_update_actions (shell_view);
+}
+
+static void
+book_shell_view_dispose (GObject *object)
+{
+ EBookShellView *book_shell_view;
+
+ book_shell_view = E_BOOK_SHELL_VIEW (object);
+ e_book_shell_view_private_dispose (book_shell_view);
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+book_shell_view_finalize (GObject *object)
+{
+ EBookShellView *book_shell_view;
+
+ book_shell_view = E_BOOK_SHELL_VIEW (object);
+ e_book_shell_view_private_finalize (book_shell_view);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+book_shell_view_constructed (GObject *object)
+{
+ EBookShellView *book_shell_view;
+ EBookShellBackend *book_shell_backend;
+ ESourceList *source_list;
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ book_shell_view = E_BOOK_SHELL_VIEW (object);
+ e_book_shell_view_private_constructed (book_shell_view);
+
+ book_shell_backend = book_shell_view->priv->book_shell_backend;
+ source_list = e_book_shell_backend_get_source_list (book_shell_backend);
+
+ g_signal_connect_swapped (
+ source_list, "changed",
+ G_CALLBACK (book_shell_view_source_list_changed_cb),
+ book_shell_view);
+}
+
+static void
+book_shell_view_update_actions (EShellView *shell_view)
+{
+ EBookShellViewPrivate *priv;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellWindow *shell_window;
+ GtkAction *action;
+ const gchar *label;
+ gboolean sensitive;
+ guint32 state;
+
+ /* Be descriptive. */
+ gboolean any_contacts_selected;
+ gboolean has_primary_source;
+ gboolean multiple_contacts_selected;
+ gboolean primary_source_is_system;
+ gboolean single_contact_selected;
+ gboolean selection_is_contact_list;
+ gboolean selection_has_email;
+ gboolean source_is_busy;
+ gboolean source_is_editable;
+ gboolean source_is_empty;
+
+ priv = E_BOOK_SHELL_VIEW_GET_PRIVATE (shell_view);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ state = e_shell_content_check_state (shell_content);
+
+ single_contact_selected =
+ (state & E_BOOK_SHELL_CONTENT_SELECTION_SINGLE);
+ multiple_contacts_selected =
+ (state & E_BOOK_SHELL_CONTENT_SELECTION_MULTIPLE);
+ selection_has_email =
+ (state & E_BOOK_SHELL_CONTENT_SELECTION_HAS_EMAIL);
+ selection_is_contact_list =
+ (state & E_BOOK_SHELL_CONTENT_SELECTION_IS_CONTACT_LIST);
+ source_is_busy =
+ (state & E_BOOK_SHELL_CONTENT_SOURCE_IS_BUSY);
+ source_is_editable =
+ (state & E_BOOK_SHELL_CONTENT_SOURCE_IS_EDITABLE);
+ source_is_empty =
+ (state & E_BOOK_SHELL_CONTENT_SOURCE_IS_EMPTY);
+
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ state = e_shell_sidebar_check_state (shell_sidebar);
+
+ has_primary_source =
+ (state & E_BOOK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE);
+ primary_source_is_system =
+ (state & E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM);
+
+ any_contacts_selected =
+ (single_contact_selected || multiple_contacts_selected);
+
+ action = ACTION (ADDRESS_BOOK_DELETE);
+ sensitive = has_primary_source && !primary_source_is_system;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (ADDRESS_BOOK_RENAME);
+ sensitive = has_primary_source;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (ADDRESS_BOOK_STOP);
+ sensitive = source_is_busy;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CONTACT_CLIPBOARD_COPY);
+ sensitive = any_contacts_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CONTACT_CLIPBOARD_CUT);
+ sensitive = source_is_editable && any_contacts_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CONTACT_CLIPBOARD_PASTE);
+ sensitive = source_is_editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CONTACT_COPY);
+ sensitive = any_contacts_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CONTACT_DELETE);
+ sensitive = source_is_editable && any_contacts_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CONTACT_FORWARD);
+ sensitive = any_contacts_selected;
+ gtk_action_set_sensitive (action, sensitive);
+ if (multiple_contacts_selected)
+ label = _("_Forward Contacts");
+ else
+ label = _("_Forward Contact");
+ g_object_set (action, "label", label, NULL);
+
+ action = ACTION (CONTACT_MOVE);
+ sensitive = source_is_editable && any_contacts_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CONTACT_OPEN);
+ sensitive = any_contacts_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CONTACT_PRINT);
+ sensitive = any_contacts_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CONTACT_PRINT_PREVIEW);
+ sensitive = any_contacts_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CONTACT_SAVE_AS);
+ sensitive = any_contacts_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CONTACT_SELECT_ALL);
+ sensitive = !(source_is_empty);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CONTACT_SEND_MESSAGE);
+ sensitive = any_contacts_selected && selection_has_email;
+ gtk_action_set_sensitive (action, sensitive);
+ if (multiple_contacts_selected)
+ label = _("_Send Message to Contacts");
+ else if (selection_is_contact_list)
+ label = _("_Send Message to List");
+ else
+ label = _("_Send Message to Contact");
+ g_object_set (action, "label", label, NULL);
+}
+
+static void
+book_shell_view_class_init (EBookShellViewClass *class)
+{
+ GObjectClass *object_class;
+ EShellViewClass *shell_view_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EBookShellViewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = book_shell_view_dispose;
+ object_class->finalize = book_shell_view_finalize;
+ object_class->constructed = book_shell_view_constructed;
+
+ shell_view_class = E_SHELL_VIEW_CLASS (class);
+ shell_view_class->label = _("Contacts");
+ shell_view_class->icon_name = "x-office-address-book";
+ shell_view_class->ui_definition = "evolution-contacts.ui";
+ shell_view_class->ui_manager_id = "org.gnome.evolution.contacts";
+ shell_view_class->search_options = "/contact-search-options";
+ shell_view_class->search_rules = "addresstypes.xml";
+ shell_view_class->new_shell_content = e_book_shell_content_new;
+ shell_view_class->new_shell_sidebar = e_book_shell_sidebar_new;
+ shell_view_class->update_actions = book_shell_view_update_actions;
+}
+
+static void
+book_shell_view_init (EBookShellView *book_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ book_shell_view->priv =
+ E_BOOK_SHELL_VIEW_GET_PRIVATE (book_shell_view);
+
+ e_book_shell_view_private_init (book_shell_view, shell_view_class);
+}
+
+GType
+e_book_shell_view_get_type (void)
+{
+ return book_shell_view_type;
+}
+
+void
+e_book_shell_view_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (EBookShellViewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) book_shell_view_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EBookShellView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) book_shell_view_init,
+ NULL /* value_table */
+ };
+
+ book_shell_view_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_VIEW,
+ "EBookShellView", &type_info, 0);
+}
diff --git a/addressbook/gui/component/e-book-shell-view.h b/addressbook/gui/component/e-book-shell-view.h
new file mode 100644
index 0000000000..33a0c8a75d
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-view.h
@@ -0,0 +1,66 @@
+/*
+ * e-book-shell-view.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_BOOK_SHELL_VIEW_H
+#define E_BOOK_SHELL_VIEW_H
+
+#include <shell/e-shell-view.h>
+
+/* Standard GObject macros */
+#define E_TYPE_BOOK_SHELL_VIEW \
+ (e_book_shell_view_get_type ())
+#define E_BOOK_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_BOOK_SHELL_VIEW, EBookShellView))
+#define E_BOOK_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_BOOK_SHELL_VIEW, EBookShellViewClass))
+#define E_IS_BOOK_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_BOOK_SHELL_VIEW))
+#define E_IS_BOOK_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_BOOK_SHELL_VIEW))
+#define E_BOOK_SHELL_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_BOOK_SHELL_VIEW, EBookShellViewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EBookShellView EBookShellView;
+typedef struct _EBookShellViewClass EBookShellViewClass;
+typedef struct _EBookShellViewPrivate EBookShellViewPrivate;
+
+struct _EBookShellView {
+ EShellView parent;
+ EBookShellViewPrivate *priv;
+};
+
+struct _EBookShellViewClass {
+ EShellViewClass parent_class;
+};
+
+GType e_book_shell_view_get_type (void);
+void e_book_shell_view_register_type (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_BOOK_SHELL_VIEW_H */
diff --git a/addressbook/gui/component/eab-composer-util.c b/addressbook/gui/component/eab-composer-util.c
new file mode 100644
index 0000000000..46d28b0790
--- /dev/null
+++ b/addressbook/gui/component/eab-composer-util.c
@@ -0,0 +1,197 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "eab-composer-util.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <libebook/e-contact.h>
+#include <libebook/e-destination.h>
+
+#include "composer/e-msg-composer.h"
+#include "addressbook/util/eab-book-util.h"
+#include "addressbook/gui/widgets/eab-gui-util.h"
+
+void
+eab_send_as_to (GList *destinations)
+{
+ EMsgComposer *composer;
+ EComposerHeaderTable *table;
+ GPtrArray *to_array;
+ GPtrArray *bcc_array;
+
+ union {
+ gpointer *pdata;
+ EDestination **destinations;
+ } convert;
+
+ if (destinations == NULL)
+ return;
+
+ composer = e_msg_composer_new ();
+ table = e_msg_composer_get_header_table (composer);
+
+ to_array = g_ptr_array_new ();
+ bcc_array = g_ptr_array_new ();
+
+ /* Sort contacts into "To" and "Bcc" destinations. */
+ while (destinations != NULL) {
+ EDestination *destination = destinations->data;
+
+ if (e_destination_is_evolution_list (destination)) {
+ if (e_destination_list_show_addresses (destination))
+ g_ptr_array_add (to_array, destination);
+ else
+ g_ptr_array_add (bcc_array, destination);
+ } else
+ g_ptr_array_add (to_array, destination);
+
+ destinations = g_list_next (destinations);
+ }
+
+ /* Add sentinels to each array. */
+ g_ptr_array_add (to_array, NULL);
+ g_ptr_array_add (bcc_array, NULL);
+
+ /* XXX Acrobatics like this make me question whether NULL-terminated
+ * arrays are really the best argument type for passing a list of
+ * destinations to the header table. */
+
+ /* Add "To" destinations. */
+ convert.pdata = to_array->pdata;
+ e_composer_header_table_set_destinations_to (
+ table, convert.destinations);
+ g_ptr_array_free (to_array, FALSE);
+ e_destination_freev (convert.destinations);
+
+ /* Add "Bcc" destinations. */
+ convert.pdata = bcc_array->pdata;
+ e_composer_header_table_set_destinations_bcc (
+ table, convert.destinations);
+ g_ptr_array_free (bcc_array, FALSE);
+ e_destination_freev (convert.destinations);
+
+ gtk_widget_show (GTK_WIDGET (composer));
+}
+
+static const char *
+get_email (EContact *contact, EContactField field_id, gchar **to_free)
+{
+ char *name = NULL, *mail = NULL;
+ const char *value = e_contact_get_const (contact, field_id);
+
+ *to_free = NULL;
+
+ if (eab_parse_qp_email (value, &name, &mail)) {
+ *to_free = g_strdup_printf ("%s <%s>", name, mail);
+ value = *to_free;
+ }
+
+ g_free (name);
+ g_free (mail);
+
+ return value;
+}
+
+void
+eab_send_as_attachment (GList *destinations)
+{
+ EMsgComposer *composer;
+ EComposerHeaderTable *table;
+ CamelMimePart *attachment;
+ GList *contacts, *iter;
+ gchar *data;
+
+ if (destinations == NULL)
+ return;
+
+ composer = e_msg_composer_new ();
+ table = e_msg_composer_get_header_table (composer);
+
+ attachment = camel_mime_part_new ();
+
+ contacts = g_list_copy (destinations);
+ for (iter = contacts; iter != NULL; iter = iter->next)
+ iter->data = e_destination_get_contact (iter->data);
+ data = eab_contact_list_to_string (contacts);
+ g_list_free (contacts);
+
+ camel_mime_part_set_content (
+ attachment, data, strlen (data), "text/x-vcard");
+
+ if (destinations->next != NULL)
+ camel_mime_part_set_description (
+ attachment, _("Multiple vCards"));
+ else {
+ EContact *contact;
+ const gchar *file_as;
+ gchar *description;
+
+ contact = e_destination_get_contact (destinations->data);
+ file_as = e_contact_get_const (contact, E_CONTACT_FILE_AS);
+ description = g_strdup_printf (_("vCard for %s"), file_as);
+ camel_mime_part_set_description (attachment, description);
+ g_free (description);
+ }
+
+ camel_mime_part_set_disposition (attachment, "attachment");
+
+ e_msg_composer_attach (composer, attachment);
+ camel_object_unref (attachment);
+
+ if (destinations->next != NULL)
+ e_composer_header_table_set_subject (
+ table, _("Contact information"));
+ else {
+ EContact *contact;
+ gchar *tempstr;
+ const gchar *tempstr2;
+ gchar *tempfree = NULL;
+
+ contact = e_destination_get_contact (destinations->data);
+ tempstr2 = e_contact_get_const (contact, E_CONTACT_FILE_AS);
+ if (!tempstr2 || !*tempstr2)
+ tempstr2 = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
+ if (!tempstr2 || !*tempstr2)
+ tempstr2 = e_contact_get_const (contact, E_CONTACT_ORG);
+ if (!tempstr2 || !*tempstr2) {
+ g_free (tempfree);
+ tempstr2 = get_email (contact, E_CONTACT_EMAIL_1, &tempfree);
+ }
+ if (!tempstr2 || !*tempstr2) {
+ g_free (tempfree);
+ tempstr2 = get_email (contact, E_CONTACT_EMAIL_2, &tempfree);
+ }
+ if (!tempstr2 || !*tempstr2) {
+ g_free (tempfree);
+ tempstr2 = get_email (contact, E_CONTACT_EMAIL_3, &tempfree);
+ }
+
+ if (!tempstr2 || !*tempstr2)
+ tempstr = g_strdup_printf (_("Contact information"));
+ else
+ tempstr = g_strdup_printf (_("Contact information for %s"), tempstr2);
+
+ e_composer_header_table_set_subject (table, tempstr);
+
+ g_free (tempstr);
+ g_free (tempfree);
+ }
+
+ gtk_widget_show (GTK_WIDGET (composer));
+}
diff --git a/widgets/table/table-test.h b/addressbook/gui/component/eab-composer-util.h
index 8b179bafdf..4aec23074d 100644
--- a/widgets/table/table-test.h
+++ b/addressbook/gui/component/eab-composer-util.h
@@ -1,5 +1,4 @@
/*
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,15 +12,20 @@
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-void table_browser_test (void);
-void multi_cols_test (void);
-void check_test (void);
-void e_table_test (void);
+#ifndef EAB_COMPOSER_UTIL_H
+#define EAB_COMPOSER_UTIL_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+void eab_send_as_to (GList *destinations);
+void eab_send_as_attachment (GList *destinations);
+
+G_END_DECLS
+
+#endif /* EAB_COMPOSER_UTIL_H */
diff --git a/shell/evolution-component.c b/addressbook/gui/component/evolution-module-addressbook.c
index 49824c9545..3089133e43 100644
--- a/shell/evolution-component.c
+++ b/addressbook/gui/component/evolution-module-addressbook.c
@@ -1,4 +1,6 @@
/*
+ * evolution-module-addressbook.c
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,36 +15,31 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Michael Zucchi <notzed@novell.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "evolution-component.h"
-
-#define PARENT_TYPE bonobo_object_get_type ()
+#include "e-book-shell-backend.h"
+#include "e-book-shell-content.h"
+#include "e-book-shell-sidebar.h"
+#include "e-book-shell-view.h"
-static BonoboObjectClass *parent_class = NULL;
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
-/* Evolution.Component */
-
-/* Initialization */
-
-static void
-evolution_component_class_init (EvolutionComponentClass *klass)
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
{
- parent_class = g_type_class_peek_parent (klass);
+ /* Register dynamically loaded types. */
+
+ e_book_shell_backend_register_type (type_module);
+ e_book_shell_content_register_type (type_module);
+ e_book_shell_sidebar_register_type (type_module);
+ e_book_shell_view_register_type (type_module);
}
-static void
-evolution_component_init(EvolutionComponent *emf, EvolutionComponentClass *klass)
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
{
}
-
-BONOBO_TYPE_FUNC_FULL (EvolutionComponent, GNOME_Evolution_Component, PARENT_TYPE, evolution_component)
diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am
index 53ed96fdee..681836f07b 100644
--- a/addressbook/gui/contact-editor/Makefile.am
+++ b/addressbook/gui/contact-editor/Makefile.am
@@ -1,7 +1,3 @@
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = $(top_builddir)/win32/libevolution-addressbook.la
-endif
-
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/widgets \
@@ -29,10 +25,13 @@ libecontacteditor_la_SOURCES = \
libecontacteditor_la_LDFLAGS = $(NO_UNDEFINED)
-libecontacteditor_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
- $(top_builddir)/widgets/misc/libemiscwidgets.la \
- $(top_builddir)/e-util/libeutil.la \
+libecontacteditor_la_LIBADD = \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/addressbook/util/libeabutil.la \
+ $(top_builddir)/addressbook/gui/widgets/libeabwidgets.la \
+ $(top_builddir)/addressbook/gui/merging/libeabbookmerging.la \
+ $(top_builddir)/addressbook/printing/libecontactprint.la \
$(EVOLUTION_ADDRESSBOOK_LIBS)
glade_DATA = \
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index c7ce449ec4..03272d4444 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -33,7 +33,6 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libedataserverui/e-categories-dialog.h>
-#include <misc/e-gui-utils.h>
#include <libebook/e-address-western.h>
#include <libedataserverui/e-category-completion.h>
@@ -41,7 +40,7 @@
#include <camel/camel.h>
-#include "addressbook/gui/component/addressbook.h"
+#include "addressbook/util/addressbook.h"
#include "addressbook/printing/e-contact-print.h"
#include "addressbook/gui/widgets/eab-gui-util.h"
#include "e-util/e-util.h"
@@ -49,9 +48,9 @@
#include "misc/e-dateedit.h"
#include "misc/e-image-chooser.h"
#include "misc/e-url-entry.h"
-#include "shell/evolution-shell-component-utils.h"
#include "e-util/e-icon-factory.h"
#include "e-util/e-util-private.h"
+#include "shell/e-shell.h"
#include "eab-contact-merging.h"
@@ -199,6 +198,54 @@ static const gint email_default [] = { 0, 1, 2, 2 };
#define STRING_IS_EMPTY(x) (!(x) || !(*(x)))
#define STRING_MAKE_NON_NULL(x) ((x) ? (x) : "")
+static void
+e_contact_editor_contact_added (EABEditor *editor,
+ EBookStatus status,
+ EContact *contact)
+{
+ if (status == E_BOOK_ERROR_OK)
+ return;
+
+ if (status == E_BOOK_ERROR_CANCELLED)
+ return;
+
+ eab_error_dialog (_("Error adding contact"), status);
+}
+
+static void
+e_contact_editor_contact_modified (EABEditor *editor,
+ EBookStatus status,
+ EContact *contact)
+{
+ if (status == E_BOOK_ERROR_OK)
+ return;
+
+ if (status == E_BOOK_ERROR_CANCELLED)
+ return;
+
+ eab_error_dialog (_("Error modifying contact"), status);
+}
+
+static void
+e_contact_editor_contact_deleted (EABEditor *editor,
+ EBookStatus status,
+ EContact *contact)
+{
+ if (status == E_BOOK_ERROR_OK)
+ return;
+
+ if (status == E_BOOK_ERROR_CANCELLED)
+ return;
+
+ eab_error_dialog (_("Error removing contact"), status);
+}
+
+static void
+e_contact_editor_closed (EABEditor *editor)
+{
+ g_object_unref (editor);
+}
+
GType
e_contact_editor_get_type (void)
{
@@ -242,6 +289,10 @@ e_contact_editor_class_init (EContactEditorClass *klass)
editor_class->save_contact = e_contact_editor_save_contact;
editor_class->is_changed = e_contact_editor_is_changed;
editor_class->get_window = e_contact_editor_get_window;
+ editor_class->contact_added = e_contact_editor_contact_added;
+ editor_class->contact_modified = e_contact_editor_contact_modified;
+ editor_class->contact_deleted = e_contact_editor_contact_deleted;
+ editor_class->editor_closed = e_contact_editor_closed;
g_object_class_install_property (object_class, PROP_SOURCE_BOOK,
g_param_spec_object ("source_book",
@@ -3329,6 +3380,7 @@ static void
e_contact_editor_init (EContactEditor *e_contact_editor)
{
GladeXML *gui;
+ EShell *shell;
GtkWidget *widget, *label;
GtkEntryCompletion *completion;
char *gladefile;
@@ -3406,6 +3458,10 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
/* show window */
gtk_widget_show (e_contact_editor->app);
+
+ /* FIXME Shell should be passed in. */
+ shell = e_shell_get_default ();
+ e_shell_watch_window (shell, GTK_WINDOW (e_contact_editor->app));
}
static void
@@ -3501,7 +3557,7 @@ contact_editor_destroy_notify (void *data,
eab_editor_remove (EAB_EDITOR (data));
}
-EContactEditor *
+GtkWidget *
e_contact_editor_new (EBook *book,
EContact *contact,
gboolean is_new_contact,
@@ -3527,7 +3583,7 @@ e_contact_editor_new (EBook *book,
if (book)
e_book_async_get_supported_fields (book, (EBookEListCallback)supported_fields_cb, ce);
- return ce;
+ return GTK_WIDGET (ce);
}
static void
diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h
index e9f40507ae..041fcde479 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.h
+++ b/addressbook/gui/contact-editor/e-contact-editor.h
@@ -23,7 +23,6 @@
#ifndef __E_CONTACT_EDITOR_H__
#define __E_CONTACT_EDITOR_H__
-#include <bonobo/bonobo-ui-component.h>
#include <glade/glade.h>
#include "addressbook/gui/contact-editor/eab-editor.h"
@@ -63,9 +62,6 @@ struct _EContactEditor
EBook *target_book;
EContact *contact;
- /* UI handler */
- BonoboUIComponent *uic;
-
GladeXML *gui;
GtkWidget *app;
@@ -111,11 +107,11 @@ struct _EContactEditorClass
EABEditorClass parent_class;
};
-EContactEditor *e_contact_editor_new (EBook *book,
- EContact *contact,
- gboolean is_new_contact,
- gboolean editable);
-GType e_contact_editor_get_type (void);
+GType e_contact_editor_get_type (void);
+GtkWidget *e_contact_editor_new (EBook *book,
+ EContact *contact,
+ gboolean is_new_contact,
+ gboolean editable);
G_END_DECLS
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index e8d7b03e6c..8aa2825fc8 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -28,7 +28,7 @@
#include <libebook/e-book.h>
#include <libebook/e-contact.h>
#include <libedataserverui/e-source-combo-box.h>
-#include <addressbook/gui/component/addressbook.h>
+#include <addressbook/util/addressbook.h>
#include <addressbook/util/eab-book-util.h>
#include "e-contact-editor.h"
#include "e-contact-quick-add.h"
@@ -194,7 +194,7 @@ ce_have_book (EBook *book, EBookStatus status, gpointer closure)
g_warning ("Couldn't open local address book.");
quick_add_unref (qa);
} else {
- EContactEditor *contact_editor = e_contact_editor_new (book, qa->contact, TRUE, TRUE /* XXX */);
+ GtkWidget *contact_editor = e_contact_editor_new (book, qa->contact, TRUE, TRUE /* XXX */);
/* mark it as changed so the Save buttons are enabled when we bring up the dialog. */
g_object_set (contact_editor,
diff --git a/addressbook/gui/contact-editor/eab-editor.c b/addressbook/gui/contact-editor/eab-editor.c
index d052e42fd7..b5a4683540 100644
--- a/addressbook/gui/contact-editor/eab-editor.c
+++ b/addressbook/gui/contact-editor/eab-editor.c
@@ -28,8 +28,8 @@
#include <glib/gi18n.h>
#include "eab-editor.h"
-#include "addressbook/gui/widgets/eab-gui-util.h"
#include "e-util/e-util.h"
+#include "addressbook/gui/widgets/eab-gui-util.h"
static void eab_editor_default_show (EABEditor *editor);
static void eab_editor_default_raise (EABEditor *editor);
@@ -310,51 +310,6 @@ eab_editor_get_all_editors (void)
return all_editors;
}
-gboolean
-eab_editor_confirm_delete (GtkWindow *parent, gboolean plural, gboolean is_list, char *name)
-{
- GtkWidget *dialog;
- gint result;
- char *msg;
-
- if (is_list) {
- /* contact list(s) */
- if (!plural)
- msg = g_strdup_printf (_("Are you sure you want\nto delete contact list (%s)?"),
- name?name:"");
- else
- msg = g_strdup (_("Are you sure you want\nto delete these contact lists?"));
- }
- else {
- /* contact(s) */
- if (!plural)
- msg = g_strdup_printf (_("Are you sure you want\nto delete contact (%s)?"),
- name?name:"");
- else
- msg = g_strdup (_("Are you sure you want\nto delete these contacts?"));
- }
-
- dialog = gtk_message_dialog_new (parent,
- 0,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- "%s",
- msg);
- g_free (msg);
-
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT,
- NULL);
-
- result = gtk_dialog_run(GTK_DIALOG (dialog));
-
- gtk_widget_destroy (dialog);
-
- return (result == GTK_RESPONSE_ACCEPT);
-}
-
-
void
eab_editor_contact_added (EABEditor *editor, EBookStatus status, EContact *contact)
{
diff --git a/addressbook/gui/contact-editor/eab-editor.h b/addressbook/gui/contact-editor/eab-editor.h
index 18a11047be..9dcb5e19d0 100644
--- a/addressbook/gui/contact-editor/eab-editor.h
+++ b/addressbook/gui/contact-editor/eab-editor.h
@@ -24,7 +24,6 @@
#ifndef __EAB_EDITOR_H__
#define __EAB_EDITOR_H__
-#include <bonobo/bonobo-ui-component.h>
#include <glade/glade.h>
#include <libebook/e-book.h>
@@ -91,7 +90,6 @@ gboolean eab_editor_is_changed (EABEditor *editor);
GtkWindow* eab_editor_get_window (EABEditor *editor);
gboolean eab_editor_prompt_to_save_changes (EABEditor *editor, GtkWindow *window);
-gboolean eab_editor_confirm_delete (GtkWindow *parent, gboolean plural, gboolean is_list, char *name);
/* these four generate EABEditor signals */
void eab_editor_contact_added (EABEditor *editor, EBookStatus status, EContact *contact);
diff --git a/addressbook/gui/contact-editor/test-editor.c b/addressbook/gui/contact-editor/test-editor.c
index e624c97987..f5d133283f 100644
--- a/addressbook/gui/contact-editor/test-editor.c
+++ b/addressbook/gui/contact-editor/test-editor.c
@@ -28,31 +28,19 @@
#include "e-contact-editor.h"
#include "ebook/e-card.h"
-#define TEST_VCARD \
-"BEGIN:VCARD
-" \
-"FN:Nat
-" \
-"N:Friedman;Nat;D;Mr.
-" \
-"BDAY:1977-08-06
-" \
-"TEL;WORK:617 679 1984
-" \
-"TEL;CELL:123 456 7890
-" \
-"EMAIL;INTERNET:nat@nat.org
-" \
-"EMAIL;INTERNET:nat@ximian.com
-" \
-"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234;
-" \
-"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA
-" \
-"END:VCARD
-" \
-"
-"
+#define TEST_VCARD \
+"BEGIN:VCARD" \
+"FN:Nat" \
+"N:Friedman;Nat;D;Mr." \
+"BDAY:1977-08-06" \
+"TEL;WORK:617 679 1984" \
+"TEL;CELL:123 456 7890" \
+"EMAIL;INTERNET:nat@nat.org" \
+"EMAIL;INTERNET:nat@ximian.com" \
+"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234;" \
+"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA" \
+"END:VCARD" \
+""
static char *
read_file (char *name)
diff --git a/addressbook/gui/contact-list-editor/Makefile.am b/addressbook/gui/contact-list-editor/Makefile.am
index 8e287f3f3a..87fd18ca90 100644
--- a/addressbook/gui/contact-list-editor/Makefile.am
+++ b/addressbook/gui/contact-list-editor/Makefile.am
@@ -1,7 +1,3 @@
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = $(top_builddir)/win32/libevolution-addressbook.la
-endif
-
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/widgets \
@@ -25,7 +21,6 @@ libecontactlisteditor_la_SOURCES = \
libecontactlisteditor_la_LDFLAGS = $(NO_UNDEFINED)
libecontactlisteditor_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
$(top_builddir)/addressbook/util/libeabutil.la \
$(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \
$(top_builddir)/widgets/table/libetable.la \
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 7a492f0c52..002cb08bbf 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -34,10 +34,8 @@
#include <libedataserverui/e-source-combo-box.h>
-#include "shell/evolution-shell-component-utils.h"
-
-#include "addressbook/gui/component/addressbook.h"
#include "addressbook/gui/widgets/eab-gui-util.h"
+#include "addressbook/util/addressbook.h"
#include "addressbook/util/eab-book-util.h"
#include "eab-editor.h"
@@ -924,87 +922,6 @@ contact_list_editor_create_name_selector (gchar *name,
return GTK_WIDGET (name_selector_entry);
}
-/**************************** EABEditor Callbacks ****************************/
-
-static void
-contact_list_editor_show (EABEditor *editor)
-{
- gtk_widget_show (WIDGET (DIALOG));
-}
-
-static void
-contact_list_editor_close (EABEditor *editor)
-{
- gtk_widget_destroy (WIDGET (DIALOG));
- eab_editor_closed (editor);
-}
-
-static void
-contact_list_editor_raise (EABEditor *editor)
-{
- gdk_window_raise (WIDGET (DIALOG)->window);
-}
-
-static void
-contact_list_editor_save_contact (EABEditor *eab_editor,
- gboolean should_close)
-{
- EContactListEditor *editor = E_CONTACT_LIST_EDITOR (eab_editor);
- EContactListEditorPrivate *priv = editor->priv;
- EditorCloseStruct *ecs;
- EContact *contact;
-
- contact = e_contact_list_editor_get_contact (editor);
-
- if (priv->book == NULL)
- return;
-
- ecs = g_new (EditorCloseStruct, 1);
- ecs->editor = g_object_ref (editor);
- ecs->should_close = should_close;
-
- gtk_widget_set_sensitive (WIDGET (DIALOG), FALSE);
- priv->in_async_call = TRUE;
-
- if (priv->is_new_list)
- eab_merging_book_add_contact (
- priv->book, contact, (EBookIdCallback)
- contact_list_editor_list_added_cb, ecs);
- else
- eab_merging_book_commit_contact (
- priv->book, contact, (EBookCallback)
- contact_list_editor_list_modified_cb, ecs);
-
- priv->changed = FALSE;
-}
-
-static gboolean
-contact_list_editor_is_valid (EABEditor *editor)
-{
- GtkEditable *editable;
- gboolean valid;
- gchar *chars;
-
- editable = GTK_EDITABLE (WIDGET (LIST_NAME_ENTRY));
- chars = gtk_editable_get_chars (editable, 0, -1);
- valid = (chars != NULL && *chars != '\0');
- g_free (chars);
-
- return valid;
-}
-
-static gboolean
-contact_list_editor_is_changed (EABEditor *editor)
-{
- return E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor)->changed;
-}
-
-static GtkWindow*
-contact_list_editor_get_window (EABEditor *editor)
-{
- return GTK_WINDOW (WIDGET (DIALOG));
-}
-
/***************************** GObject Callbacks *****************************/
static GObject *
@@ -1114,6 +1031,135 @@ contact_list_editor_dispose (GObject *object)
G_OBJECT_CLASS (parent_class)->dispose (object);
}
+/**************************** EABEditor Callbacks ****************************/
+
+static void
+contact_list_editor_show (EABEditor *editor)
+{
+ gtk_widget_show (WIDGET (DIALOG));
+}
+
+static void
+contact_list_editor_close (EABEditor *editor)
+{
+ gtk_widget_destroy (WIDGET (DIALOG));
+ eab_editor_closed (editor);
+}
+
+static void
+contact_list_editor_raise (EABEditor *editor)
+{
+ gdk_window_raise (WIDGET (DIALOG)->window);
+}
+
+static void
+contact_list_editor_save_contact (EABEditor *eab_editor,
+ gboolean should_close)
+{
+ EContactListEditor *editor = E_CONTACT_LIST_EDITOR (eab_editor);
+ EContactListEditorPrivate *priv = editor->priv;
+ EditorCloseStruct *ecs;
+ EContact *contact;
+
+ contact = e_contact_list_editor_get_contact (editor);
+
+ if (priv->book == NULL)
+ return;
+
+ ecs = g_new (EditorCloseStruct, 1);
+ ecs->editor = g_object_ref (editor);
+ ecs->should_close = should_close;
+
+ gtk_widget_set_sensitive (WIDGET (DIALOG), FALSE);
+ priv->in_async_call = TRUE;
+
+ if (priv->is_new_list)
+ eab_merging_book_add_contact (
+ priv->book, contact, (EBookIdCallback)
+ contact_list_editor_list_added_cb, ecs);
+ else
+ eab_merging_book_commit_contact (
+ priv->book, contact, (EBookCallback)
+ contact_list_editor_list_modified_cb, ecs);
+
+ priv->changed = FALSE;
+}
+
+static gboolean
+contact_list_editor_is_valid (EABEditor *editor)
+{
+ GtkEditable *editable;
+ gboolean valid;
+ gchar *chars;
+
+ editable = GTK_EDITABLE (WIDGET (LIST_NAME_ENTRY));
+ chars = gtk_editable_get_chars (editable, 0, -1);
+ valid = (chars != NULL && *chars != '\0');
+ g_free (chars);
+
+ return valid;
+}
+
+static gboolean
+contact_list_editor_is_changed (EABEditor *editor)
+{
+ return E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor)->changed;
+}
+
+static GtkWindow *
+contact_list_editor_get_window (EABEditor *editor)
+{
+ return GTK_WINDOW (WIDGET (DIALOG));
+}
+
+static void
+contact_list_editor_contact_added (EABEditor *editor,
+ EBookStatus status,
+ EContact *contact)
+{
+ if (status == E_BOOK_ERROR_OK)
+ return;
+
+ if (status == E_BOOK_ERROR_CANCELLED)
+ return;
+
+ eab_error_dialog (_("Error adding list"), status);
+}
+
+static void
+contact_list_editor_contact_modified (EABEditor *editor,
+ EBookStatus status,
+ EContact *contact)
+{
+ if (status == E_BOOK_ERROR_OK)
+ return;
+
+ if (status == E_BOOK_ERROR_CANCELLED)
+ return;
+
+ eab_error_dialog (_("Error modifying list"), status);
+}
+
+static void
+contact_list_editor_contact_deleted (EABEditor *editor,
+ EBookStatus status,
+ EContact *contact)
+{
+ if (status == E_BOOK_ERROR_OK)
+ return;
+
+ if (status == E_BOOK_ERROR_CANCELLED)
+ return;
+
+ eab_error_dialog (_("Error removing list"), status);
+}
+
+static void
+contact_list_editor_closed (EABEditor *editor)
+{
+ g_object_unref (editor);
+}
+
/****************************** GType Callbacks ******************************/
static void
@@ -1139,6 +1185,10 @@ contact_list_editor_class_init (EContactListEditorClass *class)
editor_class->is_valid = contact_list_editor_is_valid;
editor_class->is_changed = contact_list_editor_is_changed;
editor_class->get_window = contact_list_editor_get_window;
+ editor_class->contact_added = contact_list_editor_contact_added;
+ editor_class->contact_modified = contact_list_editor_contact_modified;
+ editor_class->contact_deleted = contact_list_editor_contact_deleted;
+ editor_class->editor_closed = contact_list_editor_closed;
g_object_class_install_property (
object_class,
@@ -1276,7 +1326,7 @@ contact_list_editor_destroy_notify (gpointer data,
eab_editor_remove (EAB_EDITOR (data));
}
-EContactListEditor *
+GtkWidget *
e_contact_list_editor_new (EBook *book,
EContact *list_contact,
gboolean is_new_list,
@@ -1297,7 +1347,7 @@ e_contact_list_editor_new (EBook *book,
"editable", editable,
NULL);
- return editor;
+ return GTK_WIDGET (editor);
}
EBook *
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.h b/addressbook/gui/contact-list-editor/e-contact-list-editor.h
index fcee0b02ef..5b67fe0126 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.h
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.h
@@ -68,7 +68,7 @@ struct _EContactListEditorClass
};
GType e_contact_list_editor_get_type (void);
-EContactListEditor * e_contact_list_editor_new (EBook *book,
+GtkWidget * e_contact_list_editor_new (EBook *book,
EContact *list_contact,
gboolean is_new_list,
gboolean editable);
diff --git a/addressbook/gui/merging/eab-contact-compare.c b/addressbook/gui/merging/eab-contact-compare.c
index 86138efb14..6a3132f5a5 100644
--- a/addressbook/gui/merging/eab-contact-compare.c
+++ b/addressbook/gui/merging/eab-contact-compare.c
@@ -24,8 +24,8 @@
#include <config.h>
#include <ctype.h>
#include <string.h>
-#include "util/eab-book-util.h"
-#include "../component/addressbook.h"
+#include "addressbook/util/addressbook.h"
+#include "addressbook/util/eab-book-util.h"
#include "eab-contact-compare.h"
/* This is an "optimistic" combiner: the best of the two outcomes is
diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c
index 895e8126c6..5a6ac2cdac 100644
--- a/addressbook/gui/merging/eab-contact-merging.c
+++ b/addressbook/gui/merging/eab-contact-merging.c
@@ -472,12 +472,18 @@ match_query_callback (EContact *contact, EContact *match, EABContactMatchType ty
}
widget = glade_xml_get_widget (ui, "custom-old-contact");
- eab_contact_display_render (EAB_CONTACT_DISPLAY (widget),
- match, EAB_CONTACT_DISPLAY_RENDER_COMPACT);
+ eab_contact_display_set_mode (
+ EAB_CONTACT_DISPLAY (widget),
+ EAB_CONTACT_DISPLAY_RENDER_COMPACT);
+ eab_contact_display_set_contact (
+ EAB_CONTACT_DISPLAY (widget), match);
widget = glade_xml_get_widget (ui, "custom-new-contact");
- eab_contact_display_render (EAB_CONTACT_DISPLAY (widget),
- contact, EAB_CONTACT_DISPLAY_RENDER_COMPACT);
+ eab_contact_display_set_mode (
+ EAB_CONTACT_DISPLAY (widget),
+ EAB_CONTACT_DISPLAY_RENDER_COMPACT);
+ eab_contact_display_set_contact (
+ EAB_CONTACT_DISPLAY (widget), contact);
widget = glade_xml_get_widget (ui, "dialog-duplicate-contact");
diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am
index ebdf49ef40..45c0b0cba3 100644
--- a/addressbook/gui/widgets/Makefile.am
+++ b/addressbook/gui/widgets/Makefile.am
@@ -7,11 +7,11 @@ INCLUDES = \
-DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
-DSEARCH_RULE_DIR=\"$(ruledir)\" \
-I$(top_srcdir) \
+ -I$(top_srcdir)/filter \
-I$(top_srcdir)/widgets \
-I$(top_srcdir)/addressbook \
- -I$(top_srcdir)/addressbook/gui/contact-editor \
-I$(top_srcdir)/addressbook/gui/merging \
- -I$(top_srcdir)/addressbook/gui/component \
+ -I$(top_srcdir)/addressbook/util \
-I$(top_srcdir)/widgets/misc \
-I$(top_builddir)/shell \
$(EVOLUTION_ADDRESSBOOK_CFLAGS)
@@ -22,9 +22,7 @@ noinst_LTLIBRARIES = \
eabincludedir = $(privincludedir)/addressbook/gui/widgets
eabinclude_HEADERS = \
- eab-config.h \
- eab-menu.h \
- eab-popup.h
+ eab-config.h
libeabwidgets_la_SOURCES = \
eab-config.c \
@@ -32,11 +30,6 @@ libeabwidgets_la_SOURCES = \
eab-contact-display.h \
eab-gui-util.c \
eab-gui-util.h \
- eab-menu.c \
- eab-popup.c \
- eab-popup.h \
- eab-popup-control.c \
- eab-popup-control.h \
e-minicard.c \
e-minicard.h \
e-minicard-label.c \
@@ -51,12 +44,29 @@ libeabwidgets_la_SOURCES = \
e-addressbook-table-adapter.h \
e-addressbook-model.c \
e-addressbook-model.h \
+ e-addressbook-selector.c \
+ e-addressbook-selector.h \
e-addressbook-view.c \
e-addressbook-view.h \
gal-view-minicard.c \
gal-view-minicard.h \
gal-view-factory-minicard.c \
- gal-view-factory-minicard.h
+ gal-view-factory-minicard.h \
+ a11y/ea-minicard.c \
+ a11y/ea-minicard.h \
+ a11y/ea-minicard-view.c \
+ a11y/ea-minicard-view.h \
+ a11y/ea-addressbook-view.c \
+ a11y/ea-addressbook-view.h \
+ a11y/ea-addressbook.c \
+ a11y/ea-addressbook.h
+
+libeabwidgets_la_LIBADD = \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/shell/libeshell.la \
+ $(top_builddir)/widgets/table/libetable.la \
+ $(top_builddir)/widgets/menus/libmenus.la \
+ $(top_builddir)/a11y/libevolution-a11y.la
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
@@ -65,6 +75,6 @@ etspec_DATA= e-addressbook-view.etspec
EXTRA_DIST = \
$(etspec_DATA) \
- addresstypes.xml
+ $(rule_DATA)
-include $(top_srcdir)/git.mk
diff --git a/a11y/addressbook/ea-addressbook-view.c b/addressbook/gui/widgets/a11y/ea-addressbook-view.c
index 6c2da221b9..4150e10ff4 100644
--- a/a11y/addressbook/ea-addressbook-view.c
+++ b/addressbook/gui/widgets/a11y/ea-addressbook-view.c
@@ -28,7 +28,7 @@
static G_CONST_RETURN gchar* ea_ab_view_get_name (AtkObject *accessible);
static G_CONST_RETURN gchar* ea_ab_view_get_description (AtkObject *accessible);
-static void ea_ab_view_class_init (EABViewClass *klass);
+static void ea_ab_view_class_init (EAddressbookViewClass *class);
static gpointer parent_class = NULL;
@@ -42,13 +42,13 @@ ea_ab_view_get_type (void)
if (!type) {
static GTypeInfo tinfo = {
- sizeof (EABViewClass),
+ sizeof (EAddressbookViewClass),
(GBaseInitFunc) NULL, /* base_init */
(GBaseFinalizeFunc) NULL, /* base_finalize */
(GClassInitFunc) ea_ab_view_class_init,
(GClassFinalizeFunc) NULL, /* class_finalize */
NULL, /* class_data */
- sizeof (EaABView),
+ sizeof (EAddressbookView),
0, /* n_preallocs */
(GInstanceInitFunc) NULL, /* instance init */
NULL /* value table */
@@ -74,14 +74,15 @@ ea_ab_view_get_type (void)
}
static void
-ea_ab_view_class_init (EABViewClass *klass)
+ea_ab_view_class_init (EAddressbookViewClass *class)
{
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+ AtkObjectClass *atk_object_class;
- parent_class = g_type_class_peek_parent (klass);
+ parent_class = g_type_class_peek_parent (class);
- class->get_name = ea_ab_view_get_name;
- class->get_description = ea_ab_view_get_description;
+ atk_object_class = ATK_OBJECT_CLASS (class);
+ atk_object_class->get_name = ea_ab_view_get_name;
+ atk_object_class->get_description = ea_ab_view_get_description;
}
static G_CONST_RETURN gchar*
diff --git a/a11y/addressbook/ea-addressbook-view.h b/addressbook/gui/widgets/a11y/ea-addressbook-view.h
index f223f24a0c..f223f24a0c 100644
--- a/a11y/addressbook/ea-addressbook-view.h
+++ b/addressbook/gui/widgets/a11y/ea-addressbook-view.h
diff --git a/a11y/addressbook/ea-addressbook.c b/addressbook/gui/widgets/a11y/ea-addressbook.c
index 8ccff66a5b..14fc4c1ca3 100644
--- a/a11y/addressbook/ea-addressbook.c
+++ b/addressbook/gui/widgets/a11y/ea-addressbook.c
@@ -21,7 +21,7 @@
*/
#include <text/e-text.h>
-#include "ea-factory.h"
+#include "a11y/ea-factory.h"
#include "ea-addressbook.h"
#include "ea-minicard.h"
#include "ea-minicard-view.h"
@@ -55,7 +55,7 @@ void e_minicard_view_a11y_init (void)
void eab_view_a11y_init (void)
{
- EA_SET_FACTORY (eab_view_get_type (), ea_ab_view);
+ EA_SET_FACTORY (E_TYPE_ADDRESSBOOK_VIEW, ea_ab_view);
}
static gboolean
diff --git a/a11y/addressbook/ea-addressbook.h b/addressbook/gui/widgets/a11y/ea-addressbook.h
index 97b691dc18..97b691dc18 100644
--- a/a11y/addressbook/ea-addressbook.h
+++ b/addressbook/gui/widgets/a11y/ea-addressbook.h
diff --git a/a11y/addressbook/ea-minicard-view.c b/addressbook/gui/widgets/a11y/ea-minicard-view.c
index dab53e6ce5..052db4d1b1 100644
--- a/a11y/addressbook/ea-minicard-view.c
+++ b/addressbook/gui/widgets/a11y/ea-minicard-view.c
@@ -362,11 +362,9 @@ static gboolean atk_action_interface_do_action (AtkAction *action, gint i)
{
gboolean return_value = TRUE;
EMinicardView *card_view;
- EContact *contact = e_contact_new();
AtkGObjectAccessible *atk_gobj= NULL;
EReflow *reflow = NULL;
- EBook *book;
atk_gobj = ATK_GOBJECT_ACCESSIBLE (action);
reflow = E_REFLOW (atk_gobject_accessible_get_object (atk_gobj));
@@ -375,26 +373,21 @@ static gboolean atk_action_interface_do_action (AtkAction *action, gint i)
return FALSE;
card_view = E_MINICARD_VIEW (reflow);
- g_object_get(card_view,
- "book", &book,
- NULL);
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
switch (i) {
case 0:
/* New Contact */
- eab_show_contact_editor (book, contact, TRUE, TRUE);
+ e_minicard_view_create_contact (card_view);
break;
case 1:
/* New Contact List */
- eab_show_contact_list_editor (book, contact, TRUE, TRUE);
+ e_minicard_view_create_contact_list (card_view);
break;
default:
return_value = FALSE;
break;
}
- g_object_unref (book);
- g_object_unref (contact);
+
return return_value;
}
diff --git a/a11y/addressbook/ea-minicard-view.h b/addressbook/gui/widgets/a11y/ea-minicard-view.h
index f20ef4487b..f20ef4487b 100644
--- a/a11y/addressbook/ea-minicard-view.h
+++ b/addressbook/gui/widgets/a11y/ea-minicard-view.h
diff --git a/a11y/addressbook/ea-minicard.c b/addressbook/gui/widgets/a11y/ea-minicard.c
index d77d591fcc..d77d591fcc 100644
--- a/a11y/addressbook/ea-minicard.c
+++ b/addressbook/gui/widgets/a11y/ea-minicard.c
diff --git a/a11y/addressbook/ea-minicard.h b/addressbook/gui/widgets/a11y/ea-minicard.h
index 15f89e19c3..15f89e19c3 100644
--- a/a11y/addressbook/ea-minicard.h
+++ b/addressbook/gui/widgets/a11y/ea-minicard.h
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 9482a93744..b016d4f9db 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -22,32 +22,45 @@
#include <config.h>
#include <string.h>
-#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include "e-util/e-util.h"
#include "e-addressbook-model.h"
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
+#include <e-util/e-util.h>
#include <misc/e-gui-utils.h>
#include "eab-gui-util.h"
-#define PARENT_TYPE G_TYPE_OBJECT
-static GObjectClass *parent_class;
-
-/*
- * EABModel callbacks
- * These are the callbacks that define the behavior of our custom model.
- */
-static void eab_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void eab_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-
+#define E_ADDRESSBOOK_MODEL_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ADDRESSBOOK_MODEL, EAddressbookModelPrivate))
+
+struct _EAddressbookModelPrivate {
+ EBook *book;
+ EBookQuery *query;
+ EBookView *book_view;
+ guint book_view_idle_id;
+
+ /* Query Results */
+ GPtrArray *contacts;
+
+ /* Signal Handler IDs */
+ gulong create_contact_id;
+ gulong remove_contact_id;
+ gulong modify_contact_id;
+ gulong status_message_id;
+ gulong writable_status_id;
+ gulong sequence_complete_id;
+ gulong backend_died_id;
+
+ guint search_in_progress : 1;
+ guint editable : 1;
+ guint editable_set : 1;
+ guint first_get_view : 1;
+};
enum {
PROP_0,
PROP_BOOK,
- PROP_QUERY,
- PROP_EDITABLE
+ PROP_EDITABLE,
+ PROP_QUERY
};
enum {
@@ -65,673 +78,799 @@ enum {
LAST_SIGNAL
};
-static guint eab_model_signals [LAST_SIGNAL] = {0, };
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
static void
-free_data (EABModel *model)
+free_data (EAddressbookModel *model)
{
- if (model->data) {
- int i;
-
- for ( i = 0; i < model->data_count; i++ ) {
- g_object_unref (model->data[i]);
- }
+ GPtrArray *array;
- g_free(model->data);
- model->data = NULL;
- model->data_count = 0;
- model->allocated_count = 0;
- }
+ array = model->priv->contacts;
+ g_ptr_array_foreach (array, (GFunc) g_object_unref, NULL);
+ g_ptr_array_set_size (array, 0);
}
static void
-remove_book_view(EABModel *model)
-{
- if (model->book_view && model->create_contact_id)
- g_signal_handler_disconnect (model->book_view,
- model->create_contact_id);
- if (model->book_view && model->remove_contact_id)
- g_signal_handler_disconnect (model->book_view,
- model->remove_contact_id);
- if (model->book_view && model->modify_contact_id)
- g_signal_handler_disconnect (model->book_view,
- model->modify_contact_id);
- if (model->book_view && model->status_message_id)
- g_signal_handler_disconnect (model->book_view,
- model->status_message_id);
- if (model->book_view && model->sequence_complete_id)
- g_signal_handler_disconnect (model->book_view,
- model->sequence_complete_id);
-
- model->create_contact_id = 0;
- model->remove_contact_id = 0;
- model->modify_contact_id = 0;
- model->status_message_id = 0;
- model->sequence_complete_id = 0;
-
- model->search_in_progress = FALSE;
-
- if (model->book_view) {
- e_book_view_stop (model->book_view);
- g_object_unref (model->book_view);
- model->book_view = NULL;
- }
-}
-
-static void
-addressbook_dispose(GObject *object)
+remove_book_view(EAddressbookModel *model)
{
- EABModel *model = EAB_MODEL(object);
-
- remove_book_view(model);
- free_data (model);
-
- if (model->book) {
- if (model->writable_status_id)
- g_signal_handler_disconnect (model->book,
- model->writable_status_id);
- model->writable_status_id = 0;
-
- if (model->backend_died_id)
- g_signal_handler_disconnect (model->book,
- model->backend_died_id);
- model->backend_died_id = 0;
-
- g_object_unref (model->book);
- model->book = NULL;
+ if (model->priv->book_view && model->priv->create_contact_id)
+ g_signal_handler_disconnect (
+ model->priv->book_view,
+ model->priv->create_contact_id);
+ if (model->priv->book_view && model->priv->remove_contact_id)
+ g_signal_handler_disconnect (
+ model->priv->book_view,
+ model->priv->remove_contact_id);
+ if (model->priv->book_view && model->priv->modify_contact_id)
+ g_signal_handler_disconnect (
+ model->priv->book_view,
+ model->priv->modify_contact_id);
+ if (model->priv->book_view && model->priv->status_message_id)
+ g_signal_handler_disconnect (
+ model->priv->book_view,
+ model->priv->status_message_id);
+ if (model->priv->book_view && model->priv->sequence_complete_id)
+ g_signal_handler_disconnect (
+ model->priv->book_view,
+ model->priv->sequence_complete_id);
+
+ model->priv->create_contact_id = 0;
+ model->priv->remove_contact_id = 0;
+ model->priv->modify_contact_id = 0;
+ model->priv->status_message_id = 0;
+ model->priv->sequence_complete_id = 0;
+
+ model->priv->search_in_progress = FALSE;
+
+ if (model->priv->book_view) {
+ e_book_view_stop (model->priv->book_view);
+ g_object_unref (model->priv->book_view);
+ model->priv->book_view = NULL;
}
-
- if (model->query) {
- e_book_query_unref (model->query);
- model->query = NULL;
- }
-
- if (G_OBJECT_CLASS(parent_class)->dispose)
- G_OBJECT_CLASS(parent_class)->dispose(object);
}
static void
-update_folder_bar_message (EABModel *model)
+update_folder_bar_message (EAddressbookModel *model)
{
- int count;
+ guint count;
char *message;
- count = model->data_count;
+ count = model->priv->contacts->len;
switch (count) {
case 0:
message = g_strdup (_("No contacts"));
break;
default:
- message = g_strdup_printf (ngettext("%d contact", "%d contacts", count), count);
+ message = g_strdup_printf (
+ ngettext ("%d contact", "%d contacts", count), count);
break;
}
- g_signal_emit (model,
- eab_model_signals [FOLDER_BAR_MESSAGE], 0,
- message);
+ g_signal_emit (model, signals[FOLDER_BAR_MESSAGE], 0, message);
g_free (message);
}
static void
-create_contact(EBookView *book_view,
- const GList *contacts,
- EABModel *model)
+create_contact (EBookView *book_view,
+ const GList *contact_list,
+ EAddressbookModel *model)
{
- int old_count = model->data_count;
- int length = g_list_length ((GList *)contacts);
+ GPtrArray *array;
+ guint count;
+ guint index;
- if (model->data_count + length > model->allocated_count) {
- while (model->data_count + length > model->allocated_count)
- model->allocated_count = model->allocated_count * 2 + 1;
- model->data = g_renew(EContact *, model->data, model->allocated_count);
- }
+ array = model->priv->contacts;
+ index = array->len;
+ count = g_list_length ((GList *) contact_list);
- for ( ; contacts; contacts = contacts->next) {
- model->data[model->data_count++] = contacts->data;
- g_object_ref (contacts->data);
- }
+ while (contact_list != NULL) {
+ EContact *contact = contact_list->data;
- g_signal_emit (model,
- eab_model_signals [CONTACT_ADDED], 0,
- old_count, model->data_count - old_count);
+ g_ptr_array_add (array, g_object_ref (contact));
+ contact_list = contact_list->next;
+ }
+ g_signal_emit (model, signals[CONTACT_ADDED], 0, index, count);
update_folder_bar_message (model);
}
static void
remove_contact(EBookView *book_view,
GList *ids,
- EABModel *model)
+ EAddressbookModel *model)
{
/* XXX we should keep a hash around instead of this O(n*m) loop */
- gint i = 0;
- GList *l;
+ GList *iter;
GArray *indices;
+ GPtrArray *array;
+ gint ii;
+ array = model->priv->contacts;
indices = g_array_new (FALSE, FALSE, sizeof (gint));
- for (l = ids; l; l = l->next) {
- char *id = l->data;
- for ( i = 0; i < model->data_count; i++) {
- if ( !strcmp(e_contact_get_const (model->data[i], E_CONTACT_UID), id) ) {
- g_object_unref (model->data[i]);
- memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (EContact *));
- model->data_count--;
- g_array_append_val (indices, i);
- break;
+
+ for (iter = ids; iter != NULL; iter = iter->next) {
+ const gchar *target_uid = iter->data;
+
+ for (ii = 0; ii < array->len; ii++) {
+ EContact *contact;
+ const gchar *uid;
+
+ contact = array->pdata[ii];
+ uid = e_contact_get_const (contact, E_CONTACT_UID);
+ if (strcmp (uid, target_uid) == 0) {
+ g_object_unref (contact);
+ g_array_append_val (indices, ii);
}
}
}
- g_signal_emit (model,
- eab_model_signals [CONTACTS_REMOVED], 0,
- indices);
+
+ for (ii = 0; ii < indices->len; ii++) {
+ gint index;
+
+ index = g_array_index (indices, gint, ii);
+ g_ptr_array_remove_index (array, index);
+ }
+
+ g_signal_emit (model, signals[CONTACTS_REMOVED], 0, indices);
g_array_free (indices, FALSE);
+
update_folder_bar_message (model);
}
static void
modify_contact(EBookView *book_view,
- const GList *contacts,
- EABModel *model)
-{
- for ( ; contacts; contacts = contacts->next) {
- int i;
- for ( i = 0; i < model->data_count; i++) {
- if ( !strcmp(e_contact_get_const(model->data[i], E_CONTACT_UID),
- e_contact_get_const(E_CONTACT(contacts->data), E_CONTACT_UID)) ) {
- g_object_unref (model->data[i]);
- model->data[i] = e_contact_duplicate(E_CONTACT(contacts->data));
- g_signal_emit (model,
- eab_model_signals [CONTACT_CHANGED], 0,
- i);
- break;
- }
+ const GList *contact_list,
+ EAddressbookModel *model)
+{
+ GPtrArray *array;
+
+ array = model->priv->contacts;
+
+ while (contact_list != NULL) {
+ EContact *contact = contact_list->data;
+ const gchar *target_uid;
+ gint ii;
+
+ target_uid = e_contact_get_const (contact, E_CONTACT_UID);
+
+ for (ii = 0; ii < array->len; ii++) {
+ const gchar *uid;
+
+ uid = e_contact_get_const (
+ array->pdata[ii], E_CONTACT_UID);
+
+ if (strcmp (uid, target_uid) != 0)
+ continue;
+
+ g_object_unref (array->pdata[ii]);
+ contact = e_contact_duplicate (contact);
+ array->pdata[ii] = contact;
+
+ g_signal_emit (
+ model, signals[CONTACT_CHANGED], 0, contact);
+ break;
}
+
+ contact_list = contact_list->next;
}
}
static void
status_message (EBookView *book_view,
char* status,
- EABModel *model)
+ EAddressbookModel *model)
{
- g_signal_emit (model,
- eab_model_signals [STATUS_MESSAGE], 0,
- status);
+ g_signal_emit (model, signals[STATUS_MESSAGE], 0, status);
}
static void
sequence_complete (EBookView *book_view,
- EBookViewStatus status,
- EABModel *model)
+ EBookViewStatus status,
+ EAddressbookModel *model)
{
- model->search_in_progress = FALSE;
+ model->priv->search_in_progress = FALSE;
status_message (book_view, NULL, model);
- g_signal_emit (model,
- eab_model_signals [SEARCH_RESULT], 0,
- status);
- g_signal_emit (model,
- eab_model_signals [STOP_STATE_CHANGED], 0);
+ g_signal_emit (model, signals[SEARCH_RESULT], 0, status);
+ g_signal_emit (model, signals[STOP_STATE_CHANGED], 0);
}
static void
writable_status (EBook *book,
gboolean writable,
- EABModel *model)
+ EAddressbookModel *model)
{
- if (!model->editable_set) {
- model->editable = writable;
+ if (!model->priv->editable_set) {
+ model->priv->editable = writable;
- g_signal_emit (model,
- eab_model_signals [WRITABLE_STATUS], 0,
- writable);
+ g_signal_emit (model, signals[WRITABLE_STATUS], 0, writable);
}
}
static void
backend_died (EBook *book,
- EABModel *model)
+ EAddressbookModel *model)
+{
+ g_signal_emit (model, signals[BACKEND_DIED], 0);
+}
+
+static void
+book_view_loaded (EBook *book,
+ EBookStatus status,
+ EBookView *book_view,
+ gpointer closure)
+{
+ EAddressbookModel *model = closure;
+
+ if (status != E_BOOK_ERROR_OK) {
+ eab_error_dialog (_("Error getting book view"), status);
+ return;
+ }
+
+ remove_book_view (model);
+ free_data (model);
+
+ model->priv->book_view = book_view;
+ if (model->priv->book_view)
+ g_object_ref (model->priv->book_view);
+
+ model->priv->create_contact_id = g_signal_connect (
+ model->priv->book_view, "contacts-added",
+ G_CALLBACK (create_contact), model);
+ model->priv->remove_contact_id = g_signal_connect (
+ model->priv->book_view, "contacts-removed",
+ G_CALLBACK (remove_contact), model);
+ model->priv->modify_contact_id = g_signal_connect (
+ model->priv->book_view, "contacts-changed",
+ G_CALLBACK (modify_contact), model);
+ model->priv->status_message_id = g_signal_connect (
+ model->priv->book_view, "status-message",
+ G_CALLBACK (status_message), model);
+ model->priv->sequence_complete_id = g_signal_connect (
+ model->priv->book_view, "sequence-complete",
+ G_CALLBACK (sequence_complete), model);
+
+ model->priv->search_in_progress = TRUE;
+ g_signal_emit (model, signals[MODEL_CHANGED], 0);
+ g_signal_emit (model, signals[SEARCH_STARTED], 0);
+ g_signal_emit (model, signals[STOP_STATE_CHANGED], 0);
+
+ e_book_view_start (model->priv->book_view);
+}
+
+static gboolean
+addressbook_model_idle_cb (EAddressbookModel *model)
+{
+ model->priv->book_view_idle_id = 0;
+
+ if (model->priv->book && model->priv->query) {
+ ESource *source;
+ const char *limit_str;
+ int limit = -1;
+
+ source = e_book_get_source (model->priv->book);
+
+ limit_str = e_source_get_property (source, "limit");
+ if (limit_str && *limit_str)
+ limit = atoi (limit_str);
+
+ remove_book_view(model);
+
+ if (model->priv->first_get_view) {
+ model->priv->first_get_view = FALSE;
+
+ if (e_book_check_static_capability (model->priv->book, "do-initial-query")) {
+ e_book_async_get_book_view (
+ model->priv->book, model->priv->query,
+ NULL, limit, book_view_loaded, model);
+ } else {
+ free_data (model);
+
+ g_signal_emit (model,
+ signals[MODEL_CHANGED], 0);
+ g_signal_emit (model,
+ signals[STOP_STATE_CHANGED], 0);
+ }
+ } else
+ e_book_async_get_book_view (
+ model->priv->book, model->priv->query,
+ NULL, limit, book_view_loaded, model);
+
+ }
+
+ g_object_unref (model);
+
+ return FALSE;
+}
+
+static void
+addressbook_model_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id){
+ case PROP_BOOK:
+ e_addressbook_model_set_book (
+ E_ADDRESSBOOK_MODEL (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_EDITABLE:
+ e_addressbook_model_set_editable (
+ E_ADDRESSBOOK_MODEL (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_QUERY:
+ e_addressbook_model_set_query (
+ E_ADDRESSBOOK_MODEL (object),
+ g_value_get_string (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+
+}
+
+static void
+addressbook_model_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_BOOK:
+ g_value_set_object (
+ value, e_addressbook_model_get_book (
+ E_ADDRESSBOOK_MODEL (object)));
+ return;
+
+ case PROP_EDITABLE:
+ g_value_set_boolean (
+ value, e_addressbook_model_get_editable (
+ E_ADDRESSBOOK_MODEL (object)));
+ return;
+
+ case PROP_QUERY:
+ g_value_take_string (
+ value, e_addressbook_model_get_query (
+ E_ADDRESSBOOK_MODEL (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+addressbook_model_dispose (GObject *object)
{
- g_signal_emit (model,
- eab_model_signals [BACKEND_DIED], 0);
+ EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object);
+
+ remove_book_view (model);
+ free_data (model);
+
+ if (model->priv->book) {
+ if (model->priv->writable_status_id)
+ g_signal_handler_disconnect (
+ model->priv->book,
+ model->priv->writable_status_id);
+ model->priv->writable_status_id = 0;
+
+ if (model->priv->backend_died_id)
+ g_signal_handler_disconnect (
+ model->priv->book,
+ model->priv->backend_died_id);
+ model->priv->backend_died_id = 0;
+
+ g_object_unref (model->priv->book);
+ model->priv->book = NULL;
+ }
+
+ if (model->priv->query) {
+ e_book_query_unref (model->priv->query);
+ model->priv->query = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-eab_model_class_init (GObjectClass *object_class)
-{
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = addressbook_dispose;
- object_class->set_property = eab_model_set_property;
- object_class->get_property = eab_model_get_property;
-
- 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));
-
- eab_model_signals [WRITABLE_STATUS] =
+addressbook_model_finalize (GObject *object)
+{
+ EAddressbookModelPrivate *priv;
+
+ priv = E_ADDRESSBOOK_MODEL_GET_PRIVATE (object);
+
+ g_ptr_array_free (priv->contacts, TRUE);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+addressbook_model_class_init (EAddressbookModelClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EAddressbookModelPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = addressbook_model_set_property;
+ object_class->get_property = addressbook_model_get_property;
+ object_class->dispose = addressbook_model_dispose;
+ object_class->finalize = addressbook_model_finalize;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_BOOK,
+ g_param_spec_object (
+ "book",
+ _("Book"),
+ NULL,
+ E_TYPE_BOOK,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_EDITABLE,
+ g_param_spec_boolean (
+ "editable",
+ _("Editable"),
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_QUERY,
+ g_param_spec_string (
+ "query",
+ _("Query"),
+ NULL,
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ signals[WRITABLE_STATUS] =
g_signal_new ("writable_status",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, writable_status),
+ G_STRUCT_OFFSET (EAddressbookModelClass, writable_status),
NULL, NULL,
g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE,
1, G_TYPE_BOOLEAN);
- eab_model_signals [STATUS_MESSAGE] =
+ signals[STATUS_MESSAGE] =
g_signal_new ("status_message",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, status_message),
+ G_STRUCT_OFFSET (EAddressbookModelClass, status_message),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE,
1, G_TYPE_POINTER);
- eab_model_signals [SEARCH_STARTED] =
+ signals[SEARCH_STARTED] =
g_signal_new ("search_started",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, search_started),
+ G_STRUCT_OFFSET (EAddressbookModelClass, search_started),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- eab_model_signals [SEARCH_RESULT] =
+ signals[SEARCH_RESULT] =
g_signal_new ("search_result",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, search_result),
+ G_STRUCT_OFFSET (EAddressbookModelClass, search_result),
NULL, NULL,
g_cclosure_marshal_VOID__INT,
G_TYPE_NONE, 1, G_TYPE_INT);
- eab_model_signals [FOLDER_BAR_MESSAGE] =
+ signals[FOLDER_BAR_MESSAGE] =
g_signal_new ("folder_bar_message",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, folder_bar_message),
+ G_STRUCT_OFFSET (EAddressbookModelClass, folder_bar_message),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
- eab_model_signals [CONTACT_ADDED] =
+ signals[CONTACT_ADDED] =
g_signal_new ("contact_added",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, contact_added),
+ G_STRUCT_OFFSET (EAddressbookModelClass, contact_added),
NULL, NULL,
e_marshal_NONE__INT_INT,
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
- eab_model_signals [CONTACTS_REMOVED] =
+ signals[CONTACTS_REMOVED] =
g_signal_new ("contacts_removed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, contacts_removed),
+ G_STRUCT_OFFSET (EAddressbookModelClass, contacts_removed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
- eab_model_signals [CONTACT_CHANGED] =
+ signals[CONTACT_CHANGED] =
g_signal_new ("contact_changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, contact_changed),
+ G_STRUCT_OFFSET (EAddressbookModelClass, contact_changed),
NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, E_TYPE_CONTACT);
- eab_model_signals [MODEL_CHANGED] =
+ signals[MODEL_CHANGED] =
g_signal_new ("model_changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, model_changed),
+ G_STRUCT_OFFSET (EAddressbookModelClass, model_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- eab_model_signals [STOP_STATE_CHANGED] =
+ signals[STOP_STATE_CHANGED] =
g_signal_new ("stop_state_changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, stop_state_changed),
+ G_STRUCT_OFFSET (EAddressbookModelClass, stop_state_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- eab_model_signals [BACKEND_DIED] =
+ signals[BACKEND_DIED] =
g_signal_new ("backend_died",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, backend_died),
+ G_STRUCT_OFFSET (EAddressbookModelClass, backend_died),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
-eab_model_init (GObject *object)
-{
- EABModel *model = EAB_MODEL(object);
- model->book = NULL;
- model->query = e_book_query_any_field_contains ("");
- model->book_view = NULL;
- model->create_contact_id = 0;
- model->remove_contact_id = 0;
- model->modify_contact_id = 0;
- model->status_message_id = 0;
- model->writable_status_id = 0;
- model->backend_died_id = 0;
- model->sequence_complete_id = 0;
- model->data = NULL;
- model->data_count = 0;
- model->allocated_count = 0;
- model->search_in_progress = FALSE;
- model->editable = FALSE;
- model->editable_set = FALSE;
- model->first_get_view = TRUE;
+addressbook_model_init (EAddressbookModel *model)
+{
+ model->priv = E_ADDRESSBOOK_MODEL_GET_PRIVATE (model);
+
+ model->priv->contacts = g_ptr_array_new ();
+ model->priv->first_get_view = TRUE;
}
-static void
-book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure)
+GType
+e_addressbook_model_get_type (void)
{
- EABModel *model = closure;
+ static GType type = 0;
- if (status != E_BOOK_ERROR_OK) {
- eab_error_dialog (_("Error getting book view"), status);
- return;
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EAddressbookModelClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) addressbook_model_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EAddressbookModel),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) addressbook_model_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ G_TYPE_OBJECT, "EAddressbookModel", &type_info, 0);
}
- remove_book_view (model);
- free_data (model);
+ return type;
+}
- model->book_view = book_view;
- if (model->book_view)
- g_object_ref (model->book_view);
- model->create_contact_id = g_signal_connect(model->book_view,
- "contacts_added",
- G_CALLBACK (create_contact),
- model);
- model->remove_contact_id = g_signal_connect(model->book_view,
- "contacts_removed",
- G_CALLBACK (remove_contact),
- model);
- model->modify_contact_id = g_signal_connect(model->book_view,
- "contacts_changed",
- G_CALLBACK(modify_contact),
- model);
- model->status_message_id = g_signal_connect(model->book_view,
- "status_message",
- G_CALLBACK(status_message),
- model);
- model->sequence_complete_id = g_signal_connect(model->book_view,
- "sequence_complete",
- G_CALLBACK(sequence_complete),
- model);
-
- model->search_in_progress = TRUE;
- g_signal_emit (model,
- eab_model_signals [MODEL_CHANGED], 0);
- g_signal_emit (model,
- eab_model_signals [SEARCH_STARTED], 0);
- g_signal_emit (model,
- eab_model_signals [STOP_STATE_CHANGED], 0);
-
- e_book_view_start (model->book_view);
+EAddressbookModel*
+e_addressbook_model_new (void)
+{
+ return g_object_new (E_TYPE_ADDRESSBOOK_MODEL, NULL);
}
-static void
-get_view (EABModel *model)
+EContact *
+e_addressbook_model_get_contact (EAddressbookModel *model,
+ gint row)
{
- /* Should this be checked somehow? */
- gboolean success;
+ GPtrArray *array;
- if (model->book && model->query) {
- ESource *source;
- const char *limit_str;
- int limit = -1;
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_MODEL (model), NULL);
- source = e_book_get_source (model->book);
+ array = model->priv->contacts;
- limit_str = e_source_get_property (source, "limit");
- if (limit_str && *limit_str)
- limit = atoi (limit_str);
+ if (0 <= row && row < array->len)
+ return e_contact_duplicate (array->pdata[row]);
- remove_book_view(model);
+ return NULL;
+}
- if (model->first_get_view) {
- model->first_get_view = FALSE;
+void
+e_addressbook_model_stop (EAddressbookModel *model)
+{
+ const gchar *message;
- if (e_book_check_static_capability (model->book, "do-initial-query")) {
- success = e_book_async_get_book_view (model->book, model->query, NULL, limit, book_view_loaded, model);
- } else {
- free_data (model);
+ g_return_if_fail (E_IS_ADDRESSBOOK_MODEL (model));
- g_signal_emit (model,
- eab_model_signals [MODEL_CHANGED], 0);
- g_signal_emit (model,
- eab_model_signals [STOP_STATE_CHANGED], 0);
- return;
- }
- }
- else
- success = e_book_async_get_book_view (model->book, model->query, NULL, limit, book_view_loaded, model);
+ remove_book_view (model);
- }
+ message = _("Search Interrupted");
+ g_signal_emit (model, signals[STOP_STATE_CHANGED], 0);
+ g_signal_emit (model, signals[STATUS_MESSAGE], 0, message);
}
-static gboolean
-get_view_idle (EABModel *model)
+gboolean
+e_addressbook_model_can_stop (EAddressbookModel *model)
{
- model->book_view_idle_id = 0;
- get_view (model);
- g_object_unref (model);
- return FALSE;
-}
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_MODEL (model), FALSE);
+ return model->priv->search_in_progress;
+}
-EContact *
-eab_model_get_contact(EABModel *model,
- int row)
+void
+e_addressbook_model_force_folder_bar_message (EAddressbookModel *model)
{
- if (model->data && 0 <= row && row < model->data_count) {
- return e_contact_duplicate (model->data[row]);
- }
- return NULL;
+ g_return_if_fail (E_IS_ADDRESSBOOK_MODEL (model));
+
+ update_folder_bar_message (model);
}
-static void
-eab_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gint
+e_addressbook_model_contact_count (EAddressbookModel *model)
{
- EABModel *model;
- gboolean need_get_book_view = FALSE;
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_MODEL (model), 0);
- model = EAB_MODEL (object);
+ return model->priv->contacts->len;
+}
- switch (prop_id){
- case PROP_BOOK:
- if (model->book) {
- if (model->writable_status_id)
- g_signal_handler_disconnect (model->book,
- model->writable_status_id);
- model->writable_status_id = 0;
+EContact *
+e_addressbook_model_contact_at (EAddressbookModel *model,
+ gint index)
+{
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_MODEL (model), NULL);
- if (model->backend_died_id)
- g_signal_handler_disconnect (model->book,
- model->backend_died_id);
- model->backend_died_id = 0;
+ return model->priv->contacts->pdata[index];
+}
- g_object_unref (model->book);
- }
- model->book = E_BOOK(g_value_get_object (value));
- if (model->book) {
- model->writable_status_id =
- g_signal_connect (model->book,
- "writable_status",
- G_CALLBACK (writable_status), model);
- model->backend_died_id =
- g_signal_connect (model->book,
- "backend_died",
- G_CALLBACK (backend_died), model);
-
- if (!model->editable_set) {
- model->editable = e_book_is_writable (model->book);
+gint
+e_addressbook_model_find (EAddressbookModel *model,
+ EContact *contact)
+{
+ GPtrArray *array;
+ gint ii;
- g_signal_emit (model,
- eab_model_signals [WRITABLE_STATUS], 0,
- model->editable);
- }
+ /* XXX This searches for a particular EContact instance,
+ * as opposed to an equivalent but possibly different
+ * EContact instance. Might have to revise this in
+ * the future. */
- model->first_get_view = TRUE;
- g_object_ref (model->book);
- need_get_book_view = TRUE;
- }
- break;
- case PROP_QUERY:
- if (model->query)
- e_book_query_unref (model->query);
- model->query = e_book_query_from_string (g_value_get_string (value));
- need_get_book_view = TRUE;
- break;
- case PROP_EDITABLE:
- model->editable = g_value_get_boolean (value);
- model->editable_set = TRUE;
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_MODEL (model), -1);
+ g_return_val_if_fail (E_IS_CONTACT (contact), -1);
- if (need_get_book_view) {
- if (!model->book_view_idle_id) {
- g_object_ref (model);
- model->book_view_idle_id = g_idle_add ((GSourceFunc)get_view_idle, model);
- }
+ array = model->priv->contacts;
+ for (ii = 0; ii < array->len; ii++) {
+ EContact *candidate = array->pdata[ii];
+
+ if (contact == candidate)
+ return ii;
}
+ return -1;
}
-static void
-eab_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+EBook *
+e_addressbook_model_get_book (EAddressbookModel *model)
{
- EABModel *eab_model;
-
- eab_model = EAB_MODEL (object);
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_MODEL (model), NULL);
- switch (prop_id) {
- case PROP_BOOK:
- g_value_set_object (value, eab_model->book);
- break;
- case PROP_QUERY: {
- char *query_string = e_book_query_to_string (eab_model->query);
- g_value_set_string (value, query_string);
- break;
- }
- case PROP_EDITABLE:
- g_value_set_boolean (value, eab_model->editable);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ return model->priv->book;
}
-GType
-eab_model_get_type (void)
+void
+e_addressbook_model_set_book (EAddressbookModel *model,
+ EBook *book)
{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EABModelClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) eab_model_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EABModel),
- 0, /* n_preallocs */
- (GInstanceInitFunc) eab_model_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "EABModel", &info, 0);
+ g_return_if_fail (E_IS_ADDRESSBOOK_MODEL (model));
+ g_return_if_fail (E_IS_BOOK (book));
+
+ if (model->priv->book != NULL) {
+ if (model->priv->writable_status_id != 0)
+ g_signal_handler_disconnect (
+ model->priv->book,
+ model->priv->writable_status_id);
+ model->priv->writable_status_id = 0;
+
+ if (model->priv->backend_died_id != 0)
+ g_signal_handler_disconnect (
+ model->priv->book,
+ model->priv->backend_died_id);
+ model->priv->backend_died_id = 0;
+
+ g_object_unref (model->priv->book);
}
- return type;
-}
+ model->priv->book = g_object_ref (book);
+ model->priv->first_get_view = TRUE;
-EABModel*
-eab_model_new (void)
-{
- EABModel *et;
+ model->priv->writable_status_id = g_signal_connect (
+ book, "writable-status",
+ G_CALLBACK (writable_status), model);
- et = g_object_new (EAB_TYPE_MODEL, NULL);
+ model->priv->backend_died_id = g_signal_connect (
+ book, "backend-died",
+ G_CALLBACK (backend_died), model);
- return et;
-}
+ if (!model->priv->editable_set) {
+ model->priv->editable = e_book_is_writable (book);
+ g_signal_emit (
+ model, signals[WRITABLE_STATUS], 0,
+ model->priv->editable);
+ }
-void eab_model_stop (EABModel *model)
-{
- remove_book_view(model);
- g_signal_emit (model,
- eab_model_signals [STOP_STATE_CHANGED], 0);
- g_signal_emit (model,
- eab_model_signals [STATUS_MESSAGE], 0,
- "Search Interrupted.");
+ if (model->priv->book_view_idle_id == 0)
+ model->priv->book_view_idle_id = g_idle_add (
+ (GSourceFunc) addressbook_model_idle_cb,
+ g_object_ref (model));
+
+ g_object_notify (G_OBJECT (model), "book");
}
gboolean
-eab_model_can_stop (EABModel *model)
+e_addressbook_model_get_editable (EAddressbookModel *model)
{
- return model->search_in_progress;
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_MODEL (model), FALSE);
+
+ return model->priv->editable;
}
void
-eab_model_force_folder_bar_message (EABModel *model)
+e_addressbook_model_set_editable (EAddressbookModel *model,
+ gboolean editable)
{
- update_folder_bar_message (model);
-}
+ g_return_if_fail (E_IS_ADDRESSBOOK_MODEL (model));
-int
-eab_model_contact_count (EABModel *model)
-{
- return model->data_count;
-}
+ model->priv->editable = editable;
+ model->priv->editable_set = TRUE;
-const EContact *
-eab_model_contact_at (EABModel *model, int index)
-{
- return model->data[index];
+ g_object_notify (G_OBJECT (model), "editable");
}
-gboolean
-eab_model_editable (EABModel *model)
+gchar *
+e_addressbook_model_get_query (EAddressbookModel *model)
{
- return model->editable;
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_MODEL (model), NULL);
+
+ return e_book_query_to_string (model->priv->query);
}
-EBook *
-eab_model_get_ebook (EABModel *model)
+void
+e_addressbook_model_set_query (EAddressbookModel *model,
+ const gchar *query)
{
- return model->book;
+ g_return_if_fail (E_IS_ADDRESSBOOK_MODEL (model));
+
+ if (model->priv->query != NULL)
+ e_book_query_unref (model->priv->query);
+
+ if (query == NULL)
+ model->priv->query = e_book_query_any_field_contains ("");
+ else
+ model->priv->query = e_book_query_from_string (query);
+
+ if (model->priv->book_view_idle_id == 0)
+ model->priv->book_view_idle_id = g_idle_add (
+ (GSourceFunc) addressbook_model_idle_cb,
+ g_object_ref (model));
+
+ g_object_notify (G_OBJECT (model), "query");
}
diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h
index ae1c5f4cb2..87f1ac5175 100644
--- a/addressbook/gui/widgets/e-addressbook-model.h
+++ b/addressbook/gui/widgets/e-addressbook-model.h
@@ -18,84 +18,99 @@
*
*/
-#ifndef _EAB_MODEL_H_
-#define _EAB_MODEL_H_
+#ifndef E_ADDRESSBOOK_MODEL_H
+#define E_ADDRESSBOOK_MODEL_H
-#include <glib.h>
-#include <glib-object.h>
#include <libebook/e-book.h>
+#include <libebook/e-book-query.h>
#include <libebook/e-book-view.h>
-#define EAB_TYPE_MODEL (eab_model_get_type ())
-#define EAB_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EAB_TYPE_MODEL, EABModel))
-#define EAB_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EAB_TYPE_MODEL, EABModelClass))
-#define E_IS_ADDRESSBOOK_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EAB_TYPE_MODEL))
-#define E_IS_ADDRESSBOOK_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EAB_TYPE_MODEL))
-
-typedef struct _EABModel EABModel;
-typedef struct _EABModelClass EABModelClass;
-
-struct _EABModel {
+/* Standard GObject macros */
+#define E_TYPE_ADDRESSBOOK_MODEL \
+ (e_addressbook_model_get_type ())
+#define E_ADDRESSBOOK_MODEL(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ADDRESSBOOK_MODEL, EAddressbookModel))
+#define E_ADDRESSBOOK_MODEL_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ADDRESSBOOK_MODEL, EAddressbookModelClass))
+#define E_IS_ADDRESSBOOK_MODEL(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ADDRESSBOOK_MODEL))
+#define E_IS_ADDRESSBOOK_MODEL_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ADDRESSBOOK_MODEL))
+#define E_ADDRESSBOOK_MODEL_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ADDRESSBOOK_MODEL))
+
+G_BEGIN_DECLS
+
+typedef struct _EAddressbookModel EAddressbookModel;
+typedef struct _EAddressbookModelClass EAddressbookModelClass;
+typedef struct _EAddressbookModelPrivate EAddressbookModelPrivate;
+
+struct _EAddressbookModel {
GObject parent;
-
- /* item specific fields */
- EBook *book;
- EBookQuery *query;
- EBookView *book_view;
-
- int book_view_idle_id;
-
- EContact **data;
- int data_count;
- int allocated_count;
-
- int create_contact_id, remove_contact_id, modify_contact_id;
- int status_message_id, writable_status_id, sequence_complete_id;
- int backend_died_id;
-
- guint search_in_progress : 1;
- guint editable : 1;
- guint editable_set : 1;
- guint first_get_view : 1;
+ EAddressbookModelPrivate *priv;
};
-struct _EABModelClass {
+struct _EAddressbookModelClass {
GObjectClass parent_class;
- /*
- * Signals
- */
- void (*writable_status) (EABModel *model, gboolean writable);
- void (*search_started) (EABModel *model);
- void (*search_result) (EABModel *model, EBookViewStatus status);
- void (*status_message) (EABModel *model, const gchar *message);
- void (*folder_bar_message) (EABModel *model, const gchar *message);
- void (*contact_added) (EABModel *model, gint index, gint count);
- void (*contacts_removed) (EABModel *model, gpointer id_list);
- void (*contact_changed) (EABModel *model, gint index);
- void (*model_changed) (EABModel *model);
- void (*stop_state_changed) (EABModel *model);
- void (*backend_died) (EABModel *model);
+ /* Signals */
+ void (*writable_status) (EAddressbookModel *model,
+ gboolean writable);
+ void (*search_started) (EAddressbookModel *model);
+ void (*search_result) (EAddressbookModel *model,
+ EBookViewStatus status);
+ void (*status_message) (EAddressbookModel *model,
+ const gchar *message);
+ void (*folder_bar_message) (EAddressbookModel *model,
+ const gchar *message);
+ void (*contact_added) (EAddressbookModel *model,
+ gint index,
+ gint count);
+ void (*contacts_removed) (EAddressbookModel *model,
+ gpointer id_list);
+ void (*contact_changed) (EAddressbookModel *model,
+ EContact *contact);
+ void (*model_changed) (EAddressbookModel *model);
+ void (*stop_state_changed) (EAddressbookModel *model);
+ void (*backend_died) (EAddressbookModel *model);
};
-
-GType eab_model_get_type (void);
-EABModel *eab_model_new (void);
+GType e_addressbook_model_get_type (void);
+EAddressbookModel *
+ e_addressbook_model_new (void);
/* Returns object with ref count of 1. */
-EContact *eab_model_get_contact (EABModel *model,
- int row);
-EBook *eab_model_get_ebook (EABModel *model);
-
-void eab_model_stop (EABModel *model);
-gboolean eab_model_can_stop (EABModel *model);
-
-void eab_model_force_folder_bar_message (EABModel *model);
-
-int eab_model_contact_count (EABModel *model);
-const EContact *eab_model_contact_at (EABModel *model,
- int index);
-gboolean eab_model_editable (EABModel *model);
-
-#endif /* _EAB_MODEL_H_ */
+EContact * e_addressbook_model_get_contact (EAddressbookModel *model,
+ gint row);
+
+void e_addressbook_model_stop (EAddressbookModel *model);
+gboolean e_addressbook_model_can_stop (EAddressbookModel *model);
+
+void e_addressbook_model_force_folder_bar_message
+ (EAddressbookModel *model);
+
+gint e_addressbook_model_contact_count
+ (EAddressbookModel *model);
+EContact * e_addressbook_model_contact_at (EAddressbookModel *model,
+ gint index);
+gint e_addressbook_model_find (EAddressbookModel *model,
+ EContact *contact);
+EBook * e_addressbook_model_get_book (EAddressbookModel *model);
+void e_addressbook_model_set_book (EAddressbookModel *model,
+ EBook *book);
+gboolean e_addressbook_model_get_editable(EAddressbookModel *model);
+void e_addressbook_model_set_editable(EAddressbookModel *model,
+ gboolean editable);
+gchar * e_addressbook_model_get_query (EAddressbookModel *model);
+void e_addressbook_model_set_query (EAddressbookModel *model,
+ const gchar *query);
+
+G_END_DECLS
+
+#endif /* E_ADDRESSBOOK_MODEL_H */
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
index 237838141b..a867042de0 100644
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
@@ -20,19 +20,18 @@
#include <string.h>
#include <glib/gi18n.h>
-#include "e-util/e-util.h"
#include "e-addressbook-reflow-adapter.h"
#include "e-addressbook-model.h"
-#include "e-addressbook-view.h"
#include "eab-gui-util.h"
#include "e-minicard.h"
+#include <e-util/e-util.h>
#include <misc/e-gui-utils.h>
#include "addressbook/printing/e-contact-print.h"
struct _EAddressbookReflowAdapterPrivate {
- EABModel *model;
+ EAddressbookModel *model;
gboolean loading;
@@ -55,10 +54,11 @@ enum {
enum {
DRAG_BEGIN,
+ OPEN_CONTACT,
LAST_SIGNAL
};
-static guint e_addressbook_reflow_adapter_signals [LAST_SIGNAL] = {0, };
+static guint signals [LAST_SIGNAL] = {0, };
static void
unlink_model(EAddressbookReflowAdapter *adapter)
@@ -130,7 +130,7 @@ addressbook_count (EReflowModel *erm)
EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm);
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- return eab_model_contact_count (priv->model);
+ return e_addressbook_model_contact_count (priv->model);
}
/* This function returns the height of the minicontact in question */
@@ -142,7 +142,7 @@ addressbook_height (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
EContactField field;
int count = 0;
char *string;
- EContact *contact = (EContact*)eab_model_contact_at (priv->model, i);
+ EContact *contact = (EContact*)e_addressbook_model_contact_at (priv->model, i);
PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (GNOME_CANVAS_ITEM (parent)->canvas), "");
int height;
@@ -191,8 +191,8 @@ addressbook_compare (EReflowModel *erm, int n1, int n2)
return n1-n2;
}
else {
- contact1 = (EContact*)eab_model_contact_at (priv->model, n1);
- contact2 = (EContact*)eab_model_contact_at (priv->model, n2);
+ contact1 = (EContact*)e_addressbook_model_contact_at (priv->model, n1);
+ contact2 = (EContact*)e_addressbook_model_contact_at (priv->model, n2);
if (contact1 && contact2) {
const char *file_as1, *file_as2;
@@ -228,12 +228,20 @@ adapter_drag_begin (EMinicard *card, GdkEvent *event, EAddressbookReflowAdapter
gint ret_val = 0;
g_signal_emit (adapter,
- e_addressbook_reflow_adapter_signals[DRAG_BEGIN], 0,
+ signals[DRAG_BEGIN], 0,
event, &ret_val);
return ret_val;
}
+static void
+adapter_open_contact (EMinicard *card,
+ EContact *contact,
+ EAddressbookReflowAdapter *adapter)
+{
+ g_signal_emit (adapter, signals[OPEN_CONTACT], 0, contact);
+}
+
static GnomeCanvasItem *
addressbook_incarnate (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
{
@@ -243,8 +251,8 @@ addressbook_incarnate (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
item = gnome_canvas_item_new(parent,
e_minicard_get_type(),
- "contact", eab_model_contact_at (priv->model, i),
- "editable", eab_model_editable (priv->model),
+ "contact", e_addressbook_model_contact_at (priv->model, i),
+ "editable", e_addressbook_model_get_editable (priv->model),
NULL);
#if 0
@@ -253,7 +261,10 @@ addressbook_incarnate (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
#endif
g_signal_connect (item, "drag_begin",
- G_CALLBACK(adapter_drag_begin), adapter);
+ G_CALLBACK (adapter_drag_begin), adapter);
+
+ g_signal_connect (item, "open-contact",
+ G_CALLBACK (adapter_open_contact), adapter);
return item;
}
@@ -265,12 +276,12 @@ addressbook_reincarnate (EReflowModel *erm, int i, GnomeCanvasItem *item)
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
gnome_canvas_item_set(item,
- "contact", eab_model_contact_at (priv->model, i),
+ "contact", e_addressbook_model_contact_at (priv->model, i),
NULL);
}
static void
-create_contact (EABModel *model,
+create_contact (EAddressbookModel *model,
gint index, gint count,
EAddressbookReflowAdapter *adapter)
{
@@ -280,7 +291,7 @@ create_contact (EABModel *model,
}
static void
-remove_contacts (EABModel *model,
+remove_contacts (EAddressbookModel *model,
gpointer data,
EAddressbookReflowAdapter *adapter)
{
@@ -295,7 +306,7 @@ remove_contacts (EABModel *model,
}
static void
-modify_contact (EABModel *model,
+modify_contact (EAddressbookModel *model,
gint index,
EAddressbookReflowAdapter *adapter)
{
@@ -303,14 +314,14 @@ modify_contact (EABModel *model,
}
static void
-model_changed (EABModel *model,
+model_changed (EAddressbookModel *model,
EAddressbookReflowAdapter *adapter)
{
e_reflow_model_changed (E_REFLOW_MODEL (adapter));
}
static void
-search_started (EABModel *model,
+search_started (EAddressbookModel *model,
EAddressbookReflowAdapter *adapter)
{
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
@@ -319,7 +330,7 @@ search_started (EABModel *model,
}
static void
-search_result (EABModel *model,
+search_result (EAddressbookModel *model,
EBookViewStatus status,
EAddressbookReflowAdapter *adapter)
{
@@ -425,10 +436,10 @@ e_addressbook_reflow_adapter_class_init (GObjectClass *object_class)
g_param_spec_object ("model",
_("Model"),
/*_( */"XXX blurb" /*)*/,
- EAB_TYPE_MODEL,
+ E_TYPE_ADDRESSBOOK_MODEL,
G_PARAM_READABLE));
- e_addressbook_reflow_adapter_signals [DRAG_BEGIN] =
+ signals [DRAG_BEGIN] =
g_signal_new ("drag_begin",
G_OBJECT_CLASS_TYPE(object_class),
G_SIGNAL_RUN_LAST,
@@ -437,6 +448,16 @@ e_addressbook_reflow_adapter_class_init (GObjectClass *object_class)
e_marshal_INT__POINTER,
G_TYPE_INT, 1, G_TYPE_POINTER);
+ signals [OPEN_CONTACT] =
+ g_signal_new ("open-contact",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EAddressbookReflowAdapterClass, open_contact),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_CONTACT);
+
model_class->set_width = addressbook_set_width;
model_class->count = addressbook_count;
model_class->height = addressbook_height;
@@ -488,7 +509,7 @@ e_addressbook_reflow_adapter_get_type (void)
void
e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter,
- EABModel *model)
+ EAddressbookModel *model)
{
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
@@ -522,7 +543,7 @@ e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter,
}
EReflowModel *
-e_addressbook_reflow_adapter_new (EABModel *model)
+e_addressbook_reflow_adapter_new (EAddressbookModel *model)
{
EAddressbookReflowAdapter *et;
@@ -540,5 +561,5 @@ e_addressbook_reflow_adapter_get_contact (EAddressbookReflowAdapter *adapter,
{
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- return eab_model_get_contact (priv->model, index);
+ return e_addressbook_model_get_contact (priv->model, index);
}
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.h b/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
index 88ce1a7132..b5feda6c4b 100644
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
+++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
@@ -21,7 +21,7 @@
#ifndef _E_ADDRESSBOOK_REFLOW_ADAPTER_H_
#define _E_ADDRESSBOOK_REFLOW_ADAPTER_H_
-#include <misc/e-reflow-model.h>
+#include <text/e-reflow-model.h>
#include <libebook/e-contact.h>
#include "e-addressbook-model.h"
@@ -48,14 +48,17 @@ struct _EAddressbookReflowAdapterClass {
/*
* Signals
*/
- gint (* drag_begin) (EAddressbookReflowAdapter *adapter, GdkEvent *event);
+ gint (*drag_begin) (EAddressbookReflowAdapter *adapter,
+ GdkEvent *event);
+ void (*open_contact) (EAddressbookReflowAdapter *adapter,
+ EContact *contact);
};
GType e_addressbook_reflow_adapter_get_type (void);
void e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter,
- EABModel *model);
-EReflowModel *e_addressbook_reflow_adapter_new (EABModel *model);
+ EAddressbookModel *model);
+EReflowModel *e_addressbook_reflow_adapter_new (EAddressbookModel *model);
/* Returns object with ref count of 1. */
EContact *e_addressbook_reflow_adapter_get_contact (EAddressbookReflowAdapter *adapter,
diff --git a/addressbook/gui/widgets/e-addressbook-selector.c b/addressbook/gui/widgets/e-addressbook-selector.c
new file mode 100644
index 0000000000..21347e2529
--- /dev/null
+++ b/addressbook/gui/widgets/e-addressbook-selector.c
@@ -0,0 +1,443 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-addressbook-selector.c
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-addressbook-selector.h"
+
+#include <eab-book-util.h>
+#include <eab-contact-merging.h>
+
+#define E_ADDRESSBOOK_SELECTOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ADDRESSBOOK_SELECTOR, EAddressbookSelectorPrivate))
+
+#define PRIMARY_ADDRESSBOOK_KEY \
+ "/apps/evolution/addressbook/display/primary_addressbook"
+
+typedef struct _MergeContext MergeContext;
+
+struct _EAddressbookSelectorPrivate {
+ EAddressbookView *current_view;
+};
+
+struct _MergeContext {
+ EBook *source_book;
+ EBook *target_book;
+
+ EContact *current_contact;
+ GList *remaining_contacts;
+ guint pending_removals;
+
+ gint remove_from_source : 1;
+ gint copy_done : 1;
+};
+
+enum {
+ PROP_0,
+ PROP_CURRENT_VIEW
+};
+
+enum {
+ DND_TARGET_TYPE_VCARD,
+ DND_TARGET_TYPE_SOURCE_VCARD
+};
+
+static GtkTargetEntry drag_types[] = {
+ { (gchar *) "text/x-vcard", 0, DND_TARGET_TYPE_VCARD },
+ { (gchar *) "text/x-source-vcard", 0, DND_TARGET_TYPE_SOURCE_VCARD }
+};
+
+static gpointer parent_class;
+
+static void
+merge_context_next (MergeContext *merge_context)
+{
+ GList *list;
+
+ list = merge_context->remaining_contacts;
+ merge_context->current_contact = list->data;
+ list = g_list_delete_link (list, list);
+ merge_context->remaining_contacts = list;
+}
+
+static MergeContext *
+merge_context_new (EBook *source_book,
+ EBook *target_book,
+ GList *contact_list)
+{
+ MergeContext *merge_context;
+
+ merge_context = g_slice_new0 (MergeContext);
+ merge_context->source_book = source_book;
+ merge_context->target_book = target_book;
+ merge_context->remaining_contacts = contact_list;
+ merge_context_next (merge_context);
+
+ return merge_context;
+}
+
+static void
+merge_context_free (MergeContext *merge_context)
+{
+ if (merge_context->source_book != NULL)
+ g_object_unref (merge_context->source_book);
+
+ if (merge_context->target_book != NULL)
+ g_object_unref (merge_context->target_book);
+
+ g_slice_free (MergeContext, merge_context);
+}
+
+static void
+addressbook_selector_removed_cb (EBook *book,
+ EBookStatus status,
+ MergeContext *merge_context)
+{
+ merge_context->pending_removals--;
+
+ if (merge_context->remaining_contacts != NULL)
+ return;
+
+ if (merge_context->pending_removals > 0)
+ return;
+
+ merge_context_free (merge_context);
+}
+
+static void
+addressbook_selector_merge_next_cb (EBook *book,
+ EBookStatus status,
+ const gchar *id,
+ MergeContext *merge_context)
+{
+ if (merge_context->remove_from_source && status == E_BOOK_ERROR_OK) {
+ /* Remove previous contact from source. */
+ e_book_async_remove_contact (
+ merge_context->source_book,
+ merge_context->current_contact,
+ (EBookCallback) addressbook_selector_removed_cb,
+ merge_context);
+ merge_context->pending_removals++;
+ }
+
+ g_object_unref (merge_context->current_contact);
+
+ if (merge_context->remaining_contacts != NULL) {
+ merge_context_next (merge_context);
+ eab_merging_book_add_contact (
+ merge_context->target_book,
+ merge_context->current_contact,
+ (EBookIdCallback) addressbook_selector_merge_next_cb,
+ merge_context);
+
+ } else if (merge_context->pending_removals == 0)
+ merge_context_free (merge_context);
+}
+
+static void
+addressbook_selector_load_primary_source (ESourceSelector *selector)
+{
+ GConfClient *client;
+ ESourceList *source_list;
+ ESource *source = NULL;
+ const gchar *key;
+ gchar *uid;
+
+ /* XXX If ESourceSelector had a "primary-uid" property,
+ * we could just bind the GConf key to it. */
+
+ source_list = e_source_selector_get_source_list (selector);
+
+ client = gconf_client_get_default ();
+ key = PRIMARY_ADDRESSBOOK_KEY;
+ uid = gconf_client_get_string (client, key, NULL);
+ g_object_unref (client);
+
+ if (uid != NULL) {
+ source = e_source_list_peek_source_by_uid (source_list, uid);
+ g_free (uid);
+ } else {
+ GSList *groups;
+
+ /* Dig up the first source in the source list.
+ * XXX libedataserver should provide API for this. */
+ groups = e_source_list_peek_groups (source_list);
+ while (groups != NULL) {
+ ESourceGroup *source_group = groups->data;
+ GSList *sources;
+
+ sources = e_source_group_peek_sources (source_group);
+ if (sources != NULL) {
+ source = sources->data;
+ break;
+ }
+
+ groups = g_slist_next (groups);
+ }
+ }
+
+ if (source != NULL)
+ e_source_selector_set_primary_selection (selector, source);
+}
+
+static void
+addressbook_selector_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CURRENT_VIEW:
+ e_addressbook_selector_set_current_view (
+ E_ADDRESSBOOK_SELECTOR (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+addressbook_selector_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CURRENT_VIEW:
+ g_value_set_object (
+ value,
+ e_addressbook_selector_get_current_view (
+ E_ADDRESSBOOK_SELECTOR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+addressbook_selector_dispose (GObject *object)
+{
+ EAddressbookSelectorPrivate *priv;
+
+ priv = E_ADDRESSBOOK_SELECTOR_GET_PRIVATE (object);
+
+ if (priv->current_view != NULL) {
+ g_object_unref (priv->current_view);
+ priv->current_view = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+addressbook_selector_constructed (GObject *object)
+{
+ ESourceSelector *selector;
+
+ selector = E_SOURCE_SELECTOR (object);
+ addressbook_selector_load_primary_source (selector);
+}
+
+static void
+addressbook_selector_primary_selection_changed (ESourceSelector *selector)
+{
+ ESource *source;
+ GConfClient *client;
+ const gchar *key;
+ const gchar *string;
+
+ /* XXX If ESourceSelector had a "primary-uid" property,
+ * we could just bind the GConf key to it. */
+
+ source = e_source_selector_peek_primary_selection (selector);
+ if (source == NULL)
+ return;
+
+ client = gconf_client_get_default ();
+ key = PRIMARY_ADDRESSBOOK_KEY;
+ string = e_source_peek_uid (source);
+ gconf_client_set_string (client, key, string, NULL);
+ g_object_unref (client);
+}
+
+static gboolean
+addressbook_selector_data_dropped (ESourceSelector *selector,
+ GtkSelectionData *selection_data,
+ ESource *destination,
+ GdkDragAction action,
+ guint info)
+{
+ EAddressbookSelectorPrivate *priv;
+ MergeContext *merge_context;
+ EAddressbookModel *model;
+ EBook *source_book;
+ EBook *target_book;
+ GList *list;
+ const gchar *string;
+ gboolean remove_from_source;
+
+ priv = E_ADDRESSBOOK_SELECTOR_GET_PRIVATE (selector);
+ g_return_val_if_fail (priv->current_view != NULL, FALSE);
+
+ string = (const gchar *) selection_data->data;
+ remove_from_source = (action == GDK_ACTION_MOVE);
+
+ target_book = e_book_new (destination, NULL);
+ if (target_book == NULL)
+ return FALSE;
+
+ e_book_open (target_book, FALSE, NULL);
+
+ /* XXX Function assumes both out arguments are provided. All we
+ * care about is the contact list; source_book will be NULL. */
+ eab_book_and_contact_list_from_string (string, &source_book, &list);
+ if (list == NULL)
+ return FALSE;
+
+ model = e_addressbook_view_get_model (priv->current_view);
+ source_book = e_addressbook_model_get_book (model);
+ g_return_val_if_fail (E_IS_BOOK (source_book), FALSE);
+
+ merge_context = merge_context_new (source_book, target_book, list);
+ merge_context->remove_from_source = remove_from_source;
+
+ eab_merging_book_add_contact (
+ target_book, merge_context->current_contact,
+ (EBookIdCallback) addressbook_selector_merge_next_cb,
+ merge_context);
+
+ return TRUE;
+}
+
+static void
+addressbook_selector_class_init (EAddressbookSelectorClass *class)
+{
+ GObjectClass *object_class;
+ ESourceSelectorClass *selector_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EAddressbookSelectorPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = addressbook_selector_set_property;
+ object_class->get_property = addressbook_selector_get_property;
+ object_class->dispose = addressbook_selector_dispose;
+ object_class->constructed = addressbook_selector_constructed;
+
+ selector_class = E_SOURCE_SELECTOR_CLASS (class);
+ selector_class->primary_selection_changed =
+ addressbook_selector_primary_selection_changed;
+ selector_class->data_dropped = addressbook_selector_data_dropped;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CURRENT_VIEW,
+ g_param_spec_object (
+ "current-view",
+ NULL,
+ NULL,
+ E_TYPE_ADDRESSBOOK_VIEW,
+ G_PARAM_READWRITE));
+}
+
+static void
+addressbook_selector_init (EAddressbookSelector *selector)
+{
+ selector->priv = E_ADDRESSBOOK_SELECTOR_GET_PRIVATE (selector);
+
+ gtk_drag_dest_set (
+ GTK_WIDGET (selector), GTK_DEST_DEFAULT_ALL,
+ drag_types, G_N_ELEMENTS (drag_types),
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
+}
+
+GType
+e_addressbook_selector_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (EAddressbookSelectorClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) addressbook_selector_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EAddressbookSelector),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) addressbook_selector_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_SOURCE_SELECTOR, "EAddressbookSelector",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_addressbook_selector_new (ESourceList *source_list)
+{
+ g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+
+ return g_object_new (
+ E_TYPE_ADDRESSBOOK_SELECTOR,
+ "source-list", source_list, NULL);
+}
+
+EAddressbookView *
+e_addressbook_selector_get_current_view (EAddressbookSelector *selector)
+{
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_SELECTOR (selector), NULL);
+
+ return selector->priv->current_view;
+}
+
+void
+e_addressbook_selector_set_current_view (EAddressbookSelector *selector,
+ EAddressbookView *current_view)
+{
+ /* XXX This is only needed for moving contacts via drag-and-drop.
+ * The selection data doesn't include the source of the data
+ * (the model for the currently selected address book view),
+ * so we have to rely on it being provided to us. I would
+ * be happy to see this function go away. */
+
+ g_return_if_fail (E_IS_ADDRESSBOOK_SELECTOR (selector));
+
+ if (current_view != NULL)
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (current_view));
+
+ if (selector->priv->current_view != NULL) {
+ g_object_unref (selector->priv->current_view);
+ selector->priv->current_view = NULL;
+ }
+
+ if (current_view != NULL)
+ g_object_ref (current_view);
+
+ selector->priv->current_view = current_view;
+
+ g_object_notify (G_OBJECT (selector), "current-view");
+}
diff --git a/addressbook/gui/widgets/e-addressbook-selector.h b/addressbook/gui/widgets/e-addressbook-selector.h
new file mode 100644
index 0000000000..c0102cb3b8
--- /dev/null
+++ b/addressbook/gui/widgets/e-addressbook-selector.h
@@ -0,0 +1,73 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-addressbook-selector.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef E_ADDRESSBOOK_SELECTOR_H
+#define E_ADDRESSBOOK_SELECTOR_H
+
+#include <libedataserver/e-source-list.h>
+#include <libedataserverui/e-source-selector.h>
+#include "e-addressbook-view.h"
+
+/* Standard GObject macros */
+#define E_TYPE_ADDRESSBOOK_SELECTOR \
+ (e_addressbook_selector_get_type ())
+#define E_ADDRESSBOOK_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ADDRESSBOOK_SELECTOR, EAddressbookSelector))
+#define E_ADDRESSBOOK_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ADDRESSBOOK_SELECTOR, EAddressbookSelectorClass))
+#define E_IS_ADDRESSBOOK_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ADDRESSBOOK_SELECTOR))
+#define E_IS_ADDRESSBOOK_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ADDRESSBOOK_SELECTOR))
+#define E_ADDRESSBOOK_SELECTOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ADDRESSBOOK_SELECTOR, EAddressbookSelectorClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EAddressbookSelector EAddressbookSelector;
+typedef struct _EAddressbookSelectorClass EAddressbookSelectorClass;
+typedef struct _EAddressbookSelectorPrivate EAddressbookSelectorPrivate;
+
+struct _EAddressbookSelector {
+ ESourceSelector parent;
+ EAddressbookSelectorPrivate *priv;
+};
+
+struct _EAddressbookSelectorClass {
+ ESourceSelectorClass parent_class;
+};
+
+GType e_addressbook_selector_get_type (void);
+GtkWidget * e_addressbook_selector_new (ESourceList *source_list);
+EAddressbookView *
+ e_addressbook_selector_get_current_view
+ (EAddressbookSelector *selector);
+void e_addressbook_selector_set_current_view
+ (EAddressbookSelector *selector,
+ EAddressbookView *current_view);
+
+G_END_DECLS
+
+#endif /* E_ADDRESSBOOK_SELECTOR_H */
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c
index 9e3dfe5f5f..c970b6f32d 100644
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c
@@ -31,7 +31,7 @@
#include <libxml/xmlmemory.h>
struct _EAddressbookTableAdapterPrivate {
- EABModel *model;
+ EAddressbookModel *model;
int create_contact_id, remove_contact_id, modify_contact_id, model_changed_id;
@@ -100,7 +100,7 @@ addressbook_row_count (ETableModel *etc)
EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etc);
EAddressbookTableAdapterPrivate *priv = adapter->priv;
- return eab_model_contact_count (priv->model);
+ return e_addressbook_model_contact_count (priv->model);
}
/* This function returns the value at a particular point in our ETableModel. */
@@ -111,10 +111,10 @@ addressbook_value_at (ETableModel *etc, int col, int row)
EAddressbookTableAdapterPrivate *priv = adapter->priv;
const char *value;
- if ( col >= COLS || row >= eab_model_contact_count (priv->model) )
+ if ( col >= COLS || row >= e_addressbook_model_contact_count (priv->model) )
return NULL;
- value = e_contact_get_const((EContact*)eab_model_contact_at (priv->model, row), col);
+ value = e_contact_get_const((EContact*)e_addressbook_model_contact_at (priv->model, row), col);
if (value && *value && (col == E_CONTACT_EMAIL_1 || col == E_CONTACT_EMAIL_2 || col == E_CONTACT_EMAIL_3)) {
char *val = g_hash_table_lookup (priv->emails, value);
@@ -156,13 +156,13 @@ addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val)
EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etc);
EAddressbookTableAdapterPrivate *priv = adapter->priv;
- if (eab_model_editable (priv->model)) {
+ if (e_addressbook_model_get_editable (priv->model)) {
EContact *contact;
- if (col >= COLS || row >= eab_model_contact_count (priv->model))
+ if (col >= COLS || row >= e_addressbook_model_contact_count (priv->model))
return;
- contact = eab_model_get_contact (priv->model, row);
+ contact = e_addressbook_model_get_contact (priv->model, row);
if (!contact)
return;
@@ -177,7 +177,7 @@ addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val)
}
e_contact_set(contact, col, (void *) val);
- eab_merging_book_commit_contact (eab_model_get_ebook (priv->model),
+ eab_merging_book_commit_contact (e_addressbook_model_get_book (priv->model),
contact, contact_modified_cb, etc);
g_object_unref (contact);
@@ -196,12 +196,12 @@ addressbook_is_cell_editable (ETableModel *etc, int col, int row)
EAddressbookTableAdapterPrivate *priv = adapter->priv;
const EContact *contact;
- if (row >= 0 && row < eab_model_contact_count (priv->model))
- contact = eab_model_contact_at (priv->model, row);
+ if (row >= 0 && row < e_addressbook_model_contact_count (priv->model))
+ contact = e_addressbook_model_contact_at (priv->model, row);
else
contact = NULL;
- if (!eab_model_editable(priv->model))
+ if (!e_addressbook_model_editable(priv->model))
return FALSE;
else if (contact && e_contact_get ((EContact *) contact, E_CONTACT_IS_LIST))
/* we only allow editing of the name and file as for
@@ -229,7 +229,7 @@ addressbook_append_row (ETableModel *etm, ETableModel *source, gint row)
e_contact_set (contact, col, (void *) val);
}
- eab_merging_book_add_contact (eab_model_get_ebook (priv->model), contact, NULL, NULL);
+ eab_merging_book_add_contact (e_addressbook_model_get_book (priv->model), contact, NULL, NULL);
g_object_unref (contact);
}
@@ -304,7 +304,7 @@ eab_table_adapter_init (GObject *object)
static void
-create_contact (EABModel *model,
+create_contact (EAddressbookModel *model,
gint index, gint count,
EAddressbookTableAdapter *adapter)
{
@@ -313,7 +313,7 @@ create_contact (EABModel *model,
}
static void
-remove_contacts (EABModel *model,
+remove_contacts (EAddressbookModel *model,
gpointer data,
EAddressbookTableAdapter *adapter)
{
@@ -331,7 +331,7 @@ remove_contacts (EABModel *model,
}
static void
-modify_contact (EABModel *model,
+modify_contact (EAddressbookModel *model,
gint index,
EAddressbookTableAdapter *adapter)
{
@@ -343,7 +343,7 @@ modify_contact (EABModel *model,
}
static void
-model_changed (EABModel *model,
+model_changed (EAddressbookModel *model,
EAddressbookTableAdapter *adapter)
{
/* clear whole cache */
@@ -379,7 +379,7 @@ eab_table_adapter_get_type (void)
void
eab_table_adapter_construct (EAddressbookTableAdapter *adapter,
- EABModel *model)
+ EAddressbookModel *model)
{
EAddressbookTableAdapterPrivate *priv = adapter->priv;
@@ -407,7 +407,7 @@ eab_table_adapter_construct (EAddressbookTableAdapter *adapter,
}
ETableModel *
-eab_table_adapter_new (EABModel *model)
+eab_table_adapter_new (EAddressbookModel *model)
{
EAddressbookTableAdapter *et;
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.h b/addressbook/gui/widgets/e-addressbook-table-adapter.h
index edfb1adf00..d892894570 100644
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.h
+++ b/addressbook/gui/widgets/e-addressbook-table-adapter.h
@@ -49,7 +49,7 @@ struct _EAddressbookTableAdapterClass {
GType eab_table_adapter_get_type (void);
void eab_table_adapter_construct (EAddressbookTableAdapter *adapter,
- EABModel *model);
-ETableModel *eab_table_adapter_new (EABModel *model);
+ EAddressbookModel *model);
+ETableModel *eab_table_adapter_new (EAddressbookModel *model);
#endif /* _EAB_TABLE_ADAPTER_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 4cd151f19f..e889d9b0c2 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -30,12 +30,10 @@
#include <widgets/menus/gal-view-factory-etable.h>
#include <filter/rule-editor.h>
#include <widgets/menus/gal-view-etable.h>
-#include <e-util/e-xml-utils.h>
+#include <e-shell-sidebar.h>
#include "addressbook/printing/e-contact-print.h"
-#include "addressbook/gui/widgets/eab-popup.h"
-#include "addressbook/gui/widgets/eab-menu.h"
-#include "a11y/addressbook/ea-addressbook.h"
+#include "a11y/ea-addressbook.h"
#include "e-util/e-print.h"
#include "e-util/e-util.h"
@@ -55,1532 +53,946 @@
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
-#include "e-contact-editor.h"
#include <gdk/gdkkeysyms.h>
#include <ctype.h>
#include <string.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-
-#define SHOW_ALL_SEARCH "(contains \"x-evolution-any-field\" \"\")"
+#define E_ADDRESSBOOK_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ADDRESSBOOK_VIEW, EAddressbookViewPrivate))
#define d(x)
-static void eab_view_init (EABView *card);
-static void eab_view_class_init (EABViewClass *class);
-
-static void eab_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void eab_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-
-static void eab_view_dispose (GObject *object);
-static void change_view_type (EABView *view, EABViewType view_type);
-
-static void status_message (GtkObject *object, const gchar *status, EABView *eav);
-static void search_result (GtkObject *object, EBookViewStatus status, EABView *eav);
-static void folder_bar_message (GtkObject *object, const gchar *status, EABView *eav);
-static void stop_state_changed (GtkObject *object, EABView *eav);
-static void writable_status (GtkObject *object, gboolean writable, EABView *eav);
-static void backend_died (GtkObject *object, EABView *eav);
-static void contact_changed (EABModel *model, gint index, EABView *eav);
-static void contacts_removed (EABModel *model, gpointer data, EABView *eav);
-static GList *get_selected_contacts (EABView *view);
-
-static void command_state_change (EABView *eav);
-
-static void selection_clear_event (GtkWidget *invisible, GdkEventSelection *event,
- EABView *view);
-static void selection_received (GtkWidget *invisible, GtkSelectionData *selection_data,
- guint time, EABView *view);
-static void selection_get (GtkWidget *invisible, GtkSelectionData *selection_data,
- guint info, guint time_stamp, EABView *view);
-static void invisible_destroyed (gpointer data, GObject *where_object_was);
-
-static void categories_changed_cb (gpointer object, gpointer user_data);
-static void make_suboptions (EABView *view);
-static void query_changed (ESearchBar *esb, EABView *view);
-static void search_activated (ESearchBar *esb, EABView *view);
-static void search_menu_activated (ESearchBar *esb, int id, EABView *view);
-static GList *get_master_list (gboolean force_rebuild);
+static void status_message (EAddressbookView *view, const gchar *status);
+static void search_result (EAddressbookView *view, EBookViewStatus status);
+static void folder_bar_message (EAddressbookView *view, const gchar *status);
+static void stop_state_changed (GtkObject *object, EAddressbookView *view);
+static void backend_died (EAddressbookView *view);
-static gpointer parent_class;
+static void command_state_change (EAddressbookView *view);
+
+struct _EAddressbookViewPrivate {
+ gpointer shell_view; /* weak pointer */
+
+ EAddressbookModel *model;
+ EActivity *activity;
+
+ GList *clipboard_contacts;
+ ESource *source;
+
+ GObject *object;
+ GtkWidget *widget;
+
+ GalViewInstance *view_instance;
+
+ GtkWidget *invisible;
+};
-/* The arguments we take */
enum {
PROP_0,
- PROP_BOOK,
- PROP_SOURCE,
- PROP_QUERY,
- PROP_TYPE
+ PROP_MODEL,
+ PROP_SHELL_VIEW,
+ PROP_SOURCE
};
enum {
- STATUS_MESSAGE,
- SEARCH_RESULT,
- FOLDER_BAR_MESSAGE,
+ OPEN_CONTACT,
+ POPUP_EVENT,
COMMAND_STATE_CHANGE,
+ SELECTION_CHANGE,
LAST_SIGNAL
};
-enum DndTargetType {
+enum {
DND_TARGET_TYPE_SOURCE_VCARD,
DND_TARGET_TYPE_VCARD
};
-#define VCARD_TYPE "text/x-vcard"
-#define SOURCE_VCARD_TYPE "text/x-source-vcard"
-
-typedef struct EABSearchBarItem {
- ESearchBarItem search;
- char *image;
-}EABSearchBarItem;
static GtkTargetEntry drag_types[] = {
- { (gchar *) SOURCE_VCARD_TYPE, 0, DND_TARGET_TYPE_SOURCE_VCARD },
- { (gchar *) VCARD_TYPE, 0, DND_TARGET_TYPE_VCARD }
+ { (gchar *) "text/x-source-vcard", 0, DND_TARGET_TYPE_SOURCE_VCARD },
+ { (gchar *) "text/x-vcard", 0, DND_TARGET_TYPE_VCARD }
};
-static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]);
-
-static guint eab_view_signals [LAST_SIGNAL] = {0, };
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
static GdkAtom clipboard_atom = GDK_NONE;
-static GalViewCollection *collection = NULL;
-
-enum {
- ESB_FULL_NAME,
- ESB_EMAIL,
- ESB_ANY
-};
-
-#if 0
-static ESearchBarItem addressbook_search_option_items[] = {
- { N_("Name begins with"), ESB_FULL_NAME, ESB_ITEMTYPE_RADIO },
- { N_("Email begins with"), ESB_EMAIL, ESB_ITEMTYPE_RADIO },
- { N_("Any field contains"), ESB_ANY, ESB_ITEMTYPE_RADIO },
- { NULL, -1, 0 }
-};
-#endif
-
-static ESearchBarItem addressbook_search_items[] = {
- E_FILTERBAR_ADVANCED,
- {NULL, 0, 0},
- E_FILTERBAR_SAVE,
- E_FILTERBAR_EDIT,
- {NULL, -1, 0}
-};
-
-GType
-eab_view_get_type (void)
+static void
+addressbook_view_emit_open_contact (EAddressbookView *view,
+ EContact *contact,
+ gboolean is_new_contact)
{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EABViewClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) eab_view_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EABView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) eab_view_init,
- };
-
- type = g_type_register_static (GTK_TYPE_VBOX, "EABView", &info, 0);
- }
-
- return type;
+ g_signal_emit (view, signals[OPEN_CONTACT], 0, contact, is_new_contact);
}
static void
-eab_view_class_init (EABViewClass *class)
+addressbook_view_emit_popup_event (EAddressbookView *view,
+ GdkEvent *event)
{
- GObjectClass *object_class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class = G_OBJECT_CLASS(class);
- object_class->set_property = eab_view_set_property;
- object_class->get_property = eab_view_get_property;
- object_class->dispose = eab_view_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_SOURCE,
- g_param_spec_object ("source",
- _("Source"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_SOURCE,
- 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_TYPE,
- g_param_spec_int ("type",
- _("Type"),
- /*_( */"XXX blurb" /*)*/,
- EAB_VIEW_NONE,
- EAB_VIEW_TABLE,
- EAB_VIEW_NONE,
- G_PARAM_READWRITE));
-
- eab_view_signals [STATUS_MESSAGE] =
- g_signal_new ("status_message",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABViewClass, status_message),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- eab_view_signals [SEARCH_RESULT] =
- g_signal_new ("search_result",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABViewClass, search_result),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- eab_view_signals [FOLDER_BAR_MESSAGE] =
- g_signal_new ("folder_bar_message",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABViewClass, folder_bar_message),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- eab_view_signals [COMMAND_STATE_CHANGE] =
- g_signal_new ("command_state_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABViewClass, command_state_change),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-
- /* init the accessibility support for e_addressbook_view */
- eab_view_a11y_init();
+ g_signal_emit (view, signals[POPUP_EVENT], 0, event);
}
static void
-eab_view_init (EABView *eav)
+addressbook_view_emit_selection_change (EAddressbookView *view)
{
- eav->view_type = EAB_VIEW_NONE;
-
- eav->model = NULL;
- eav->object = NULL;
- eav->widget = NULL;
- eav->contact_display_window = NULL;
- eav->contact_display = NULL;
- eav->displayed_contact = -1;
-
- eav->view_instance = NULL;
- eav->view_menus = NULL;
- eav->current_view = NULL;
- eav->uic = NULL;
-
- eav->book = NULL;
- eav->source = NULL;
- eav->query = NULL;
-
- eav->invisible = NULL;
- eav->clipboard_contacts = NULL;
+ g_signal_emit (view, signals[SELECTION_CHANGE], 0);
}
static void
-eab_view_dispose (GObject *object)
+addressbook_view_open_contact (EAddressbookView *view,
+ EContact *contact)
{
- EABView *eav = EAB_VIEW(object);
-
- e_categories_unregister_change_listener (G_CALLBACK (categories_changed_cb), eav);
-
- if (eav->model) {
- g_signal_handlers_disconnect_matched (eav->model,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL,
- object);
- g_object_unref (eav->model);
- eav->model = NULL;
- }
-
- if (eav->book) {
- g_object_unref (eav->book);
- eav->book = NULL;
- }
-
- if (eav->source) {
- g_object_unref (eav->source);
- eav->source = NULL;
- }
-
- if (eav->query) {
- g_free(eav->query);
- eav->query = NULL;
- }
-
- eav->uic = NULL;
-
- if (eav->view_instance) {
- g_object_unref (eav->view_instance);
- eav->view_instance = NULL;
- }
-
- if (eav->view_menus) {
- g_object_unref (eav->view_menus);
- eav->view_menus = NULL;
- }
-
- if (eav->clipboard_contacts) {
- g_list_foreach (eav->clipboard_contacts, (GFunc)g_object_unref, NULL);
- g_list_free (eav->clipboard_contacts);
- eav->clipboard_contacts = NULL;
- }
-
- if (eav->invisible) {
- gtk_widget_destroy (eav->invisible);
- eav->invisible = NULL;
- }
-
- /*
- if (eav->search_context) {
- g_object_unref (eav->search_context);
- eav->search_context = NULL;
- }
- */
-
- if (eav->search_rule) {
- g_object_unref (eav->search_rule);
- eav->search_rule = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ addressbook_view_emit_open_contact (view, contact, FALSE);
}
static void
-set_paned_position (EABView *eav)
+addressbook_view_create_contact (EAddressbookView *view)
{
- GConfClient *gconf_client;
- gint pos;
-
- /* XXX this should use the addressbook's global gconf client */
- gconf_client = gconf_client_get_default ();
- pos = gconf_client_get_int (gconf_client, "/apps/evolution/addressbook/display/vpane_position", NULL);
- if (pos < 1)
- pos = 144;
-
- gtk_paned_set_position (GTK_PANED (eav->paned), pos);
+ EContact *contact;
- g_object_unref (gconf_client);
+ contact = e_contact_new ();
+ addressbook_view_emit_open_contact (view, contact, TRUE);
+ g_object_unref (contact);
}
-static gboolean
-get_paned_position (EABView *eav)
+static void
+addressbook_view_create_contact_list (EAddressbookView *view)
{
- GConfClient *gconf_client;
- gint pos;
-
- /* XXX this should use the addressbook's global gconf client */
- gconf_client = gconf_client_get_default ();
-
- pos = gtk_paned_get_position (GTK_PANED (eav->paned));
- gconf_client_set_int (gconf_client, "/apps/evolution/addressbook/display/vpane_position", pos, NULL);
-
- g_object_unref (gconf_client);
+ EContact *contact;
- return FALSE;
+ contact = e_contact_new ();
+ e_contact_set (contact, E_CONTACT_IS_LIST, GINT_TO_POINTER (TRUE));
+ addressbook_view_emit_open_contact (view, contact, TRUE);
+ g_object_unref (contact);
}
-GtkWidget*
-eab_view_new (void)
+static void
+table_double_click (ETableScrolled *table,
+ gint row,
+ gint col,
+ GdkEvent *event,
+ EAddressbookView *view)
{
- GtkWidget *widget = GTK_WIDGET (g_object_new (E_TYPE_AB_VIEW, NULL));
- EABView *eav = EAB_VIEW (widget);
- FilterPart *part;
- char *xmlfile;
- char *userfile;
-
- /* create our model */
- eav->model = eab_model_new ();
-
- g_signal_connect (eav->model, "status_message",
- G_CALLBACK (status_message), eav);
- g_signal_connect (eav->model, "search_result",
- G_CALLBACK (search_result), eav);
- g_signal_connect (eav->model, "folder_bar_message",
- G_CALLBACK (folder_bar_message), eav);
- g_signal_connect (eav->model, "stop_state_changed",
- G_CALLBACK (stop_state_changed), eav);
- g_signal_connect (eav->model, "writable_status",
- G_CALLBACK (writable_status), eav);
- g_signal_connect (eav->model, "backend_died",
- G_CALLBACK (backend_died), eav);
- g_signal_connect (eav->model, "contact_changed",
- G_CALLBACK (contact_changed), eav);
- g_signal_connect (eav->model, "contacts_removed",
- G_CALLBACK (contacts_removed), eav);
-
- eav->editable = FALSE;
- eav->query = g_strdup (SHOW_ALL_SEARCH);
-
- /* create the search context */
- eav->search_context = rule_context_new ();
- rule_context_add_part_set (eav->search_context, "partset", filter_part_get_type (),
- rule_context_add_part, rule_context_next_part);
- rule_context_add_rule_set (eav->search_context, "ruleset", filter_rule_get_type (),
- rule_context_add_rule, rule_context_next_rule);
-
- userfile = g_build_filename ( g_get_home_dir (), ".evolution/addressbook/searches.xml", NULL);
- xmlfile = g_build_filename (SEARCH_RULE_DIR, "addresstypes.xml", NULL);
-
- g_object_set_data_full (G_OBJECT (eav->search_context), "user", userfile, g_free);
- g_object_set_data_full (G_OBJECT (eav->search_context), "system", xmlfile, g_free);
-
- rule_context_load (eav->search_context, xmlfile, userfile);
-
- eav->search_rule = filter_rule_new ();
- part = rule_context_next_part (eav->search_context, NULL);
-
- if (part == NULL)
- g_warning ("Could not load addressbook search; no parts.");
- else
- filter_rule_add_part (eav->search_rule, filter_part_clone (part));
-
- eav->search = e_filter_bar_new (eav->search_context, xmlfile, userfile, NULL, eav);
-
- g_free (xmlfile);
- g_free (userfile);
-
- e_search_bar_set_menu ( (ESearchBar *) eav->search, addressbook_search_items);
- gtk_widget_show (GTK_WIDGET (eav->search));
- make_suboptions (eav);
-
- e_categories_register_change_listener (G_CALLBACK (categories_changed_cb), eav);
-
- g_signal_connect (eav->search, "query_changed",
- G_CALLBACK (query_changed), eav);
- g_signal_connect (eav->search, "search_activated",
- G_CALLBACK (search_activated), eav);
- g_signal_connect (eav->search, "menu_activated",
- G_CALLBACK (search_menu_activated), eav);
-
- gtk_box_pack_start (GTK_BOX (eav), GTK_WIDGET (eav->search), FALSE, FALSE, 0);
-
- /* create the paned window and contact display */
- eav->paned = gtk_vpaned_new ();
- gtk_box_pack_start (GTK_BOX (eav), eav->paned, TRUE, TRUE, 0);
- g_signal_connect_swapped (eav->paned, "button_release_event",
- G_CALLBACK (get_paned_position), eav);
-
- eav->contact_display = eab_contact_display_new ();
- eav->contact_display_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (eav->contact_display_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (eav->contact_display_window), GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (eav->contact_display_window), eav->contact_display);
- gtk_paned_add2 (GTK_PANED (eav->paned), eav->contact_display_window);
- gtk_widget_show (eav->contact_display);
- gtk_widget_show (eav->contact_display_window);
- gtk_widget_show (eav->paned);
-
- /* gtk selection crap */
- eav->invisible = gtk_invisible_new ();
-
- gtk_selection_add_target (eav->invisible,
- clipboard_atom,
- GDK_SELECTION_TYPE_STRING,
- 0);
-
- g_signal_connect (eav->invisible, "selection_get",
- G_CALLBACK (selection_get),
- eav);
- g_signal_connect (eav->invisible, "selection_clear_event",
- G_CALLBACK (selection_clear_event),
- eav);
- g_signal_connect (eav->invisible, "selection_received",
- G_CALLBACK (selection_received),
- eav);
- g_object_weak_ref (G_OBJECT (eav->invisible), invisible_destroyed, eav);
-
- return widget;
-}
+ EAddressbookModel *model;
+ EContact *contact;
-RuleContext *
-eab_view_peek_search_context (EABView *view)
-{
- return view->search_context;
-}
+ if (!E_IS_ADDRESSBOOK_TABLE_ADAPTER (view->priv->object))
+ return;
-FilterRule *
-eab_view_peek_search_rule (EABView *view)
-{
- return view->search_rule;
+ model = e_addressbook_view_get_model (view);
+ contact = e_addressbook_model_get_contact (model, row);
+ addressbook_view_emit_open_contact (view, contact, FALSE);
+ g_object_unref (contact);
}
-static void
-writable_status (GtkObject *object, gboolean writable, EABView *eav)
+static gint
+table_right_click (ETableScrolled *table,
+ gint row,
+ gint col,
+ GdkEvent *event,
+ EAddressbookView *view)
{
- eav->editable = writable;
- command_state_change (eav);
-}
+ addressbook_view_emit_popup_event (view, event);
-static void
-init_collection (void)
-{
- GalViewFactory *factory;
- ETableSpecification *spec;
- char *galview;
- char *addressbookdir;
- char *etspecfile;
-
- if (collection == NULL) {
- collection = gal_view_collection_new();
-
- gal_view_collection_set_title (collection, _("Address Book"));
-
- galview = g_build_filename (
- e_get_user_data_dir (), "addressbook", "views", NULL);
- addressbookdir = g_build_filename (EVOLUTION_GALVIEWSDIR,
- "addressbook",
- NULL);
- gal_view_collection_set_storage_directories
- (collection,
- addressbookdir,
- galview);
- g_free(addressbookdir);
- g_free(galview);
-
- spec = e_table_specification_new();
- etspecfile = g_build_filename (EVOLUTION_ETSPECDIR,
- "e-addressbook-view.etspec",
- NULL);
- if (!e_table_specification_load_from_file (spec, etspecfile))
- g_error ("Unable to load ETable specification file "
- "for address book");
- g_free (etspecfile);
-
- factory = gal_view_factory_etable_new (spec);
- g_object_unref (spec);
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- factory = gal_view_factory_minicard_new();
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- gal_view_collection_load(collection);
- }
+ return TRUE;
}
-static void
-set_view_preview (EABView *view)
+static gint
+table_white_space_event (ETableScrolled *table,
+ GdkEvent *event,
+ EAddressbookView *view)
{
- /* XXX this should use the addressbook's global gconf client */
- GConfClient *gconf_client;
- gboolean state;
-
- gconf_client = gconf_client_get_default();
- state = gconf_client_get_bool(gconf_client, "/apps/evolution/addressbook/display/show_preview", NULL);
- bonobo_ui_component_set_prop (view->uic,
- "/commands/ContactsViewPreview",
- "state",
- state ? "1" : "0", NULL);
+ gint button = ((GdkEventButton *) event)->button;
- eab_view_show_contact_preview (view, state);
-
- g_object_unref (gconf_client);
-}
-
-static void
-display_view(GalViewInstance *instance,
- GalView *view,
- gpointer data)
-{
- EABView *address_view = data;
- if (GAL_IS_VIEW_ETABLE(view)) {
- change_view_type (address_view, EAB_VIEW_TABLE);
- gal_view_etable_attach_table (GAL_VIEW_ETABLE(view), e_table_scrolled_get_table(E_TABLE_SCROLLED(address_view->widget)));
- }
- else if (GAL_IS_VIEW_MINICARD(view)) {
- change_view_type (address_view, EAB_VIEW_MINICARD);
- gal_view_minicard_attach (GAL_VIEW_MINICARD (view), address_view);
+ if (event->type == GDK_BUTTON_PRESS && button == 3) {
+ addressbook_view_emit_popup_event (view, event);
+ return TRUE;
}
- address_view->current_view = view;
- set_paned_position (address_view);
- set_view_preview (address_view);
+ return FALSE;
}
static void
-view_preview(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- /* XXX this should use the addressbook's global gconf client */
- GConfClient *gconf_client;
- EABView *view = EAB_VIEW (data);
+table_drag_data_get (ETable *table,
+ gint row,
+ gint col,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time,
+ gpointer user_data)
+{
+ EAddressbookView *view = user_data;
+ EAddressbookModel *model;
+ EBook *book;
+ GList *contact_list;
+ gchar *value;
- if (type != Bonobo_UIComponent_STATE_CHANGED)
+ if (!E_IS_ADDRESSBOOK_TABLE_ADAPTER (view->priv->object))
return;
- gconf_client = gconf_client_get_default();
- gconf_client_set_bool(gconf_client, "/apps/evolution/addressbook/display/show_preview", state[0] != '0', NULL);
+ model = e_addressbook_view_get_model (view);
+ book = e_addressbook_model_get_book (model);
- eab_view_show_contact_preview(view, state[0] != '0');
+ contact_list = e_addressbook_view_get_selected (view);
- g_object_unref (gconf_client);
-}
+ switch (info) {
+ case DND_TARGET_TYPE_VCARD:
+ value = eab_contact_list_to_string (contact_list);
-static void
-setup_menus (EABView *view)
-{
- if (view->book && view->view_instance == NULL) {
- init_collection ();
- view->view_instance = gal_view_instance_new (collection, e_book_get_uri (view->book));
- }
+ gtk_selection_data_set (
+ selection_data, selection_data->target,
+ 8, (guchar *)value, strlen (value));
- if (view->view_instance && view->uic) {
- view->view_menus = gal_view_menus_new(view->view_instance);
- gal_view_menus_apply(view->view_menus, view->uic, NULL);
+ g_free (value);
+ break;
- display_view (view->view_instance, gal_view_instance_get_current_view (view->view_instance), view);
+ case DND_TARGET_TYPE_SOURCE_VCARD:
+ value = eab_book_and_contact_list_to_string (
+ book, contact_list);
- g_signal_connect(view->view_instance, "display_view",
- G_CALLBACK (display_view), view);
- }
+ gtk_selection_data_set (
+ selection_data, selection_data->target,
+ 8, (guchar *)value, strlen (value));
- bonobo_ui_component_add_listener(view->uic, "ContactsViewPreview", view_preview, view);
+ g_free (value);
+ break;
+ }
- set_view_preview (view);
+ g_list_foreach (contact_list, (GFunc) g_object_unref, NULL);
+ g_list_free (contact_list);
}
static void
-eab_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+addressbook_view_create_table_view (EAddressbookView *view)
{
- EABView *eav = EAB_VIEW(object);
+ ETableModel *adapter;
+ ETable *table;
+ GtkWidget *widget;
+ gchar *etspecfile;
- switch (prop_id){
- case PROP_BOOK:
- if (eav->book) {
- g_object_unref (eav->book);
- }
- if (g_value_get_object (value)) {
- eav->book = E_BOOK(g_value_get_object (value));
- g_object_ref (eav->book);
- gtk_widget_set_sensitive (GTK_WIDGET (eav->search), TRUE);
- }
- else {
- eav->book = NULL;
- gtk_widget_set_sensitive (GTK_WIDGET (eav->search), FALSE);
- }
+ adapter = eab_table_adapter_new (view->priv->model);
- if (eav->view_instance) {
- g_object_unref (eav->view_instance);
- eav->view_instance = 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. */
+ etspecfile = g_build_filename (
+ EVOLUTION_ETSPECDIR, "e-addressbook-view.etspec", NULL);
+ widget = e_table_scrolled_new_from_spec_file (
+ adapter, NULL, etspecfile, NULL);
+ table = E_TABLE (E_TABLE_SCROLLED (widget)->table);
+ g_free (etspecfile);
- g_object_set(eav->model,
- "book", eav->book,
- NULL);
+ view->priv->object = G_OBJECT (adapter);
+ view->priv->widget = widget;
- setup_menus (eav);
+ g_signal_connect (
+ table, "double_click",
+ G_CALLBACK(table_double_click), view);
+ g_signal_connect (
+ table, "right_click",
+ G_CALLBACK(table_right_click), view);
+ g_signal_connect (
+ table, "white_space_event",
+ G_CALLBACK(table_white_space_event), view);
+ g_signal_connect_swapped (
+ table, "selection_change",
+ G_CALLBACK (addressbook_view_emit_selection_change), view);
- break;
- case PROP_SOURCE:
- if (eav->source) {
- g_warning ("EABView at present does not support multiple writes on the \"source\" property.");
- break;
- }
- else {
- if (g_value_get_object (value)) {
- eav->source = E_SOURCE(g_value_get_object (value));
- g_object_ref (eav->source);
- }
- else {
- eav->source = NULL;
- }
- }
- break;
- case PROP_QUERY:
-#if 0 /* This code will mess up ldap a bit. We need to think about the ramifications of this more. */
- if ((g_value_get_string (value) == NULL && !strcmp (eav->query, SHOW_ALL_SEARCH)) ||
- (g_value_get_string (value) != NULL && !strcmp (eav->query, g_value_get_string (value))))
- break;
-#endif
- g_free(eav->query);
- eav->query = g_strdup(g_value_get_string (value));
- if (!eav->query)
- eav->query = g_strdup (SHOW_ALL_SEARCH);
- g_object_set(eav->model,
- "query", eav->query,
- NULL);
- break;
- case PROP_TYPE:
- change_view_type(eav, g_value_get_int (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ e_table_drag_source_set (
+ table, GDK_BUTTON1_MASK,
+ drag_types, G_N_ELEMENTS (drag_types),
+ GDK_ACTION_MOVE | GDK_ACTION_COPY);
+
+ g_signal_connect (
+ table, "table_drag_data_get",
+ G_CALLBACK (table_drag_data_get), view);
+
+ gtk_box_pack_start (GTK_BOX (view), widget, TRUE, TRUE, 0);
+
+ gtk_widget_show (widget);
}
static void
-eab_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+addressbook_view_create_minicard_view (EAddressbookView *view)
{
- EABView *eav = EAB_VIEW(object);
+ GtkWidget *scrolled_window;
+ GtkWidget *minicard_view;
+ EAddressbookReflowAdapter *adapter;
- switch (prop_id) {
- case PROP_BOOK:
- if (eav->book)
- g_value_set_object (value, eav->book);
- else
- g_value_set_object (value, NULL);
- break;
- case PROP_SOURCE:
- if (eav->source)
- g_value_set_object (value, eav->source);
- else
- g_value_set_object (value, NULL);
- break;
-
- case PROP_QUERY:
- g_value_set_string (value, eav->query);
- break;
- case PROP_TYPE:
- g_value_set_int (value, eav->view_type);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
+ adapter = E_ADDRESSBOOK_REFLOW_ADAPTER (
+ e_addressbook_reflow_adapter_new (view->priv->model));
+ minicard_view = e_minicard_view_widget_new (adapter);
-static ESelectionModel*
-get_selection_model (EABView *view)
-{
- if (view->view_type == EAB_VIEW_TABLE)
- return e_table_get_selection_model (e_table_scrolled_get_table (E_TABLE_SCROLLED(view->widget)));
- else if (view->view_type == EAB_VIEW_MINICARD)
- return e_minicard_view_widget_get_selection_model (E_MINICARD_VIEW_WIDGET(view->object));
- g_return_val_if_reached (NULL);
-}
+ g_signal_connect_swapped (
+ adapter, "open-contact",
+ G_CALLBACK (addressbook_view_open_contact), view);
-/* Popup menu stuff */
-typedef struct {
- EABView *view;
- gpointer closure;
-} ContactAndBook;
+ g_signal_connect_swapped (
+ minicard_view, "create-contact",
+ G_CALLBACK (addressbook_view_create_contact), view);
-static ESelectionModel*
-contact_and_book_get_selection_model (ContactAndBook *contact_and_book)
-{
- return get_selection_model (contact_and_book->view);
-}
+ g_signal_connect_swapped (
+ minicard_view, "create-contact-list",
+ G_CALLBACK (addressbook_view_create_contact_list), view);
-static GList *
-get_contact_list (EABPopupTargetSelect *t)
-{
- GList *list = NULL;
- int i;
+ g_signal_connect_swapped (
+ minicard_view, "selection_change",
+ G_CALLBACK (addressbook_view_emit_selection_change), view);
- for (i=0;i<t->cards->len;i++)
- list = g_list_prepend(list, t->cards->pdata[i]);
+ g_signal_connect_swapped (
+ minicard_view, "right_click",
+ G_CALLBACK (addressbook_view_emit_popup_event), view);
- return list;
-}
+ scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (scrolled_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-static void
-save_as (EPopup *ep, EPopupItem *pitem, void *data)
-{
- /*ContactAndBook *contact_and_book = data;*/
- GList *contacts = get_contact_list ((EABPopupTargetSelect *)ep->target);
+ view->priv->object = G_OBJECT (minicard_view);
+ view->priv->widget = scrolled_window;
- if (contacts) {
- eab_contact_list_save(_("Save as vCard..."), contacts, NULL);
- g_list_free(contacts);
- }
-}
+ gtk_container_add (GTK_CONTAINER (scrolled_window), minicard_view);
+ gtk_widget_show (minicard_view);
-static void
-send_as (EPopup *ep, EPopupItem *pitem, void *data)
-{
- /*ContactAndBook *contact_and_book = data;*/
- GList *contacts = get_contact_list ((EABPopupTargetSelect *)ep->target);
+ gtk_widget_show_all (scrolled_window);
- if (contacts) {
- eab_send_contact_list(contacts, EAB_DISPOSITION_AS_ATTACHMENT);
- g_list_free(contacts);
- }
+ gtk_box_pack_start (GTK_BOX (view), scrolled_window, TRUE, TRUE, 0);
+
+ e_reflow_model_changed (E_REFLOW_MODEL (adapter));
}
static void
-send_to (EPopup *ep, EPopupItem *pitem, void *data)
-{
- /*ContactAndBook *contact_and_book = data;*/
- GList *contacts = get_contact_list ((EABPopupTargetSelect *)ep->target);
-
- if (contacts) {
- eab_send_contact_list(contacts, EAB_DISPOSITION_AS_TO);
- g_list_free(contacts);
+addressbook_view_display_view_cb (EAddressbookView *view,
+ GalView *gal_view)
+{
+ if (view->priv->widget != NULL) {
+ gtk_container_remove (
+ GTK_CONTAINER (view),
+ view->priv->widget);
+ view->priv->widget = NULL;
+ }
+ view->priv->object = NULL;
+
+ if (GAL_IS_VIEW_ETABLE (gal_view)) {
+ addressbook_view_create_table_view (view);
+ gal_view_etable_attach_table (
+ GAL_VIEW_ETABLE (gal_view),
+ e_table_scrolled_get_table (
+ E_TABLE_SCROLLED (view->priv->widget)));
}
+ else if (GAL_IS_VIEW_MINICARD (gal_view)) {
+ addressbook_view_create_minicard_view (view);
+ gal_view_minicard_attach (
+ GAL_VIEW_MINICARD (gal_view), view);
+ }
+
+ command_state_change (view);
}
static void
-print (EPopup *ep, EPopupItem *pitem, void *data)
+addressbook_view_selection_get_cb (EAddressbookView *view,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time_stamp)
{
- /*ContactAndBook *contact_and_book = data;*/
- EABPopupTargetSelect *t = (EABPopupTargetSelect *)ep->target;
- GList *contact_list;
+ gchar *string;
- contact_list = get_contact_list (t);
- e_contact_print (
- NULL, NULL, contact_list,
- GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
- g_list_free (contact_list);
-}
+ string = eab_contact_list_to_string (view->priv->clipboard_contacts);
-static void
-copy (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ContactAndBook *contact_and_book = data;
+ gtk_selection_data_set (
+ selection_data, GDK_SELECTION_TYPE_STRING,
+ 8, (guchar *) string, strlen (string));
- eab_view_copy (contact_and_book->view);
+ g_free (string);
}
static void
-paste (EPopup *ep, EPopupItem *pitem, void *data)
+addressbook_view_selection_clear_event_cb (EAddressbookView *view,
+ GdkEventSelection *event)
{
- ContactAndBook *contact_and_book = data;
+ GList *list;
+
+ list = view->priv->clipboard_contacts;
+ view->priv->clipboard_contacts = NULL;
- eab_view_paste (contact_and_book->view);
+ g_list_foreach (list, (GFunc) g_object_unref, NULL);
+ g_list_free (list);
}
static void
-cut (EPopup *ep, EPopupItem *pitem, void *data)
+addressbook_view_selection_received_cb (EAddressbookView *view,
+ GtkSelectionData *selection_data,
+ guint time)
{
- ContactAndBook *contact_and_book = data;
+ EAddressbookModel *model;
+ GList *list, *iter;
+ EBook *book;
- eab_view_cut (contact_and_book->view);
-}
+ model = e_addressbook_view_get_model (view);
+ book = e_addressbook_model_get_book (model);
-static void
-delete (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ContactAndBook *contact_and_book = data;
+ if (selection_data->length <= 0)
+ return;
- eab_view_delete_selection(contact_and_book->view, TRUE);
-}
+ if (selection_data->type != GDK_SELECTION_TYPE_STRING)
+ return;
-static void
-copy_to_folder (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ContactAndBook *contact_and_book = data;
+ if (selection_data->data[selection_data->length - 1] != 0) {
+ gchar *string;
- eab_view_copy_to_folder (contact_and_book->view, FALSE);
-}
+ string = g_malloc0 (selection_data->length + 1);
+ memcpy (string, selection_data->data, selection_data->length);
+ list = eab_contact_list_from_string (string);
+ g_free (string);
+ } else
+ list = eab_contact_list_from_string (
+ (gchar *) selection_data->data);
-static void
-move_to_folder (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ContactAndBook *contact_and_book = data;
+ for (iter = list; iter != NULL; iter = iter->next) {
+ EContact *contact = iter->data;
- eab_view_move_to_folder (contact_and_book->view, FALSE);
+ /* XXX NULL for a callback /sigh */
+ eab_merging_book_add_contact (
+ book, contact, NULL /* XXX */, NULL);
+ }
+
+ g_list_foreach (list, (GFunc) g_object_unref, NULL);
+ g_list_free (list);
}
static void
-open_contact (EPopup *ep, EPopupItem *pitem, void *data)
+addressbook_view_set_shell_view (EAddressbookView *view,
+ EShellView *shell_view)
{
- ContactAndBook *contact_and_book = data;
+ g_return_if_fail (view->priv->shell_view == NULL);
- eab_view_view (contact_and_book->view);
-}
+ view->priv->shell_view = shell_view;
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_view),
+ &view->priv->shell_view);
+}
static void
-new_card (EPopup *ep, EPopupItem *pitem, void *data)
+addressbook_view_set_source (EAddressbookView *view,
+ ESource *source)
{
- /*ContactAndBook *contact_and_book = data;*/
- EContact *contact = e_contact_new();
+ g_return_if_fail (view->priv->source == NULL);
- eab_show_contact_editor (((EABPopupTargetSelect *)ep->target)->book, contact, TRUE, TRUE);
- g_object_unref (contact);
+ view->priv->source = g_object_ref (source);
}
static void
-new_list (EPopup *ep, EPopupItem *pitem, void *data)
-{
- /*ContactAndBook *contact_and_book = data;*/
- EContact *contact = e_contact_new ();
+addressbook_view_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id){
+ case PROP_SHELL_VIEW:
+ addressbook_view_set_shell_view (
+ E_ADDRESSBOOK_VIEW (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SOURCE:
+ addressbook_view_set_source (
+ E_ADDRESSBOOK_VIEW (object),
+ g_value_get_object (value));
+ return;
+ }
- eab_show_contact_list_editor (((EABPopupTargetSelect *)ep->target)->book, contact, TRUE, TRUE);
- g_object_unref(contact);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
-static EPopupItem eabv_popup_items[] = {
- { E_POPUP_ITEM, (gchar *) "05.open", (gchar *) N_("_Open"), open_contact, NULL, NULL, EAB_POPUP_SELECT_ANY|EAB_POPUP_SELECT_EDITABLE },
- { E_POPUP_BAR, (gchar *) "10.bar" },
- { E_POPUP_ITEM, (gchar *) "10.new", (gchar *) N_("_New Contact..."), new_card, NULL, (gchar *) "contact-new", 0, EAB_POPUP_SELECT_EDITABLE},
- { E_POPUP_ITEM, (gchar *) "15.newlist", (gchar *) N_("New Contact _List..."), new_list, NULL, (gchar *) "stock_contact-list", 0, EAB_POPUP_SELECT_EDITABLE },
-
- { E_POPUP_BAR, (gchar *) "20.bar" },
- { E_POPUP_ITEM, (gchar *) "30.saveas", (gchar *) N_("_Save as vCard..."), save_as, NULL, (gchar *) "document-save-as", 0, EAB_POPUP_SELECT_ANY },
- { E_POPUP_ITEM, (gchar *) "40.forward", (gchar *) N_("_Forward Contact"), send_as, NULL, (gchar *) "mail-forward", EAB_POPUP_SELECT_ONE },
- { E_POPUP_ITEM, (gchar *) "40.forward", (gchar *) N_("_Forward Contacts"), send_as, NULL, (gchar *) "mail-forward", EAB_POPUP_SELECT_MANY },
- { E_POPUP_ITEM, (gchar *) "50.mailto", (gchar *) N_("Send _Message to Contact"), send_to, NULL, (gchar *) "mail-message-new", EAB_POPUP_SELECT_ONE|EAB_POPUP_SELECT_EMAIL|EAB_POPUP_CONTACT },
- { E_POPUP_ITEM, (gchar *) "50.mailto", (gchar *) N_("Send _Message to List"), send_to, NULL, (gchar *) "mail-message-new", EAB_POPUP_SELECT_ONE|EAB_POPUP_SELECT_EMAIL|EAB_POPUP_LIST },
- { E_POPUP_ITEM, (gchar *) "50.mailto", (gchar *) N_("Send _Message to Contacts"), send_to, NULL, (gchar *) "mail-message-new", EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EMAIL },
- { E_POPUP_ITEM, (gchar *) "60.print", (gchar *) N_("_Print"), print, NULL, (gchar *) "document-print", 0, EAB_POPUP_SELECT_ANY },
-
- { E_POPUP_BAR, (gchar *) "70.bar" },
- { E_POPUP_ITEM, (gchar *) "80.copyto", (gchar *) N_("Cop_y to Address Book..."), copy_to_folder, NULL, NULL, 0, EAB_POPUP_SELECT_ANY },
- { E_POPUP_ITEM, (gchar *) "90.moveto", (gchar *) N_("Mo_ve to Address Book..."), move_to_folder, NULL, NULL, 0, EAB_POPUP_SELECT_ANY|EAB_POPUP_SELECT_EDITABLE },
-
- { E_POPUP_BAR, (gchar *) "a0.bar" },
- { E_POPUP_ITEM, (gchar *) "b0.cut", (gchar *) N_("Cu_t"), cut, NULL, (gchar *) "edit-cut", 0, EAB_POPUP_SELECT_ANY|EAB_POPUP_SELECT_EDITABLE },
- { E_POPUP_ITEM, (gchar *) "c0.copy", (gchar *) N_("_Copy"), copy, NULL, (gchar *) "edit-copy", 0, EAB_POPUP_SELECT_ANY },
- { E_POPUP_ITEM, (gchar *) "d0.paste", (gchar *) N_("P_aste"), paste, NULL, (gchar *) "edit-paste", 0, EAB_POPUP_SELECT_EDITABLE },
- { E_POPUP_ITEM, (gchar *) "e0.delete", (gchar *) N_("_Delete"), delete, NULL, (gchar *) "edit-delete", 0, EAB_POPUP_SELECT_EDITABLE|EAB_POPUP_SELECT_ANY },
-};
-
static void
-get_card_1(gint model_row, void *data)
-{
- ContactAndBook *contact_and_book = data;
- EContact *contact;
+addressbook_view_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MODEL:
+ g_value_set_object (
+ value, e_addressbook_view_get_model (
+ E_ADDRESSBOOK_VIEW (object)));
+ return;
+
+ case PROP_SHELL_VIEW:
+ g_value_set_object (
+ value, e_addressbook_view_get_shell_view (
+ E_ADDRESSBOOK_VIEW (object)));
+ return;
+
+ case PROP_SOURCE:
+ g_value_set_object (
+ value, e_addressbook_view_get_source (
+ E_ADDRESSBOOK_VIEW (object)));
+ return;
+ }
- contact = eab_model_get_contact(contact_and_book->view->model, model_row);
- if (contact)
- g_ptr_array_add((GPtrArray *)contact_and_book->closure, contact);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-eabv_popup_free(EPopup *ep, GSList *list, void *data)
+addressbook_view_dispose (GObject *object)
{
- ContactAndBook *cab = data;
- ESelectionModel *selection;
+ EAddressbookViewPrivate *priv;
- /* NB: this looks strange to me */
- selection = contact_and_book_get_selection_model(cab);
- if (selection)
- e_selection_model_right_click_up(selection);
+ priv = E_ADDRESSBOOK_VIEW_GET_PRIVATE (object);
- g_slist_free(list);
- g_object_unref(cab->view);
- g_free(cab);
-}
+ if (priv->shell_view != NULL) {
+ g_object_remove_weak_pointer (
+ G_OBJECT (priv->shell_view),
+ &priv->shell_view);
+ priv->shell_view = NULL;
+ }
-static void
-do_popup_menu(EABView *view, GdkEvent *event)
-{
- EABPopup *ep;
- EABPopupTargetSelect *t;
- GSList *menus = NULL;
- int i;
- GtkMenu *menu;
- GPtrArray *cards = g_ptr_array_new();
- ContactAndBook *contact_and_book;
- ESelectionModel *selection_model;
-
- contact_and_book = g_new(ContactAndBook, 1);
- contact_and_book->view = view;
- g_object_ref(contact_and_book->view);
-
- selection_model = contact_and_book_get_selection_model(contact_and_book);
- if (selection_model) {
- contact_and_book->closure = cards;
- e_selection_model_foreach(selection_model, get_card_1, contact_and_book);
+ if (priv->model != NULL) {
+ g_signal_handlers_disconnect_matched (
+ priv->model, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, object);
+ g_object_unref (priv->model);
+ priv->model = NULL;
}
- /** @HookPoint-EABPopup:Addressbook view Context Menu
- * @Id: org.gnome.evolution.addressbook.view.popup
- * @Class: org.gnome.evolution.addresbook.popup:1.0
- * @Target: EABPopupTargetSelect
- *
- * The context menu on the contacts view.
- */
+ if (priv->activity != NULL) {
+ /* XXX Activity is not cancellable. */
+ e_activity_complete (priv->activity);
+ g_object_unref (priv->activity);
+ priv->activity = NULL;
+ }
- ep = eab_popup_new("org.gnome.evolution.addressbook.view.popup");
- t = eab_popup_target_new_select(ep, view->book, !eab_model_editable(view->model), cards);
- t->target.widget = (GtkWidget *)view;
+ if (priv->invisible != NULL) {
+ gtk_widget_destroy (priv->invisible);
+ priv->invisible = NULL;
+ }
- for (i=0;i<sizeof(eabv_popup_items)/sizeof(eabv_popup_items[0]);i++)
- menus = g_slist_prepend(menus, &eabv_popup_items[i]);
+ if (priv->source != NULL) {
+ g_object_unref (priv->source);
+ priv->source = NULL;
+ }
+
+ if (priv->view_instance != NULL) {
+ g_object_unref (priv->view_instance);
+ priv->view_instance = NULL;
+ }
- e_popup_add_items((EPopup *)ep, menus, NULL, eabv_popup_free, contact_and_book);
+ g_list_foreach (
+ priv->clipboard_contacts,
+ (GFunc) g_object_unref, NULL);
+ g_list_free (priv->clipboard_contacts);
+ priv->clipboard_contacts = NULL;
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event?event->button.button:0, event?event->button.time:gtk_get_current_event_time());
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-render_contact (int row, EABView *view)
+addressbook_view_constructed (GObject *object)
{
- EContact *contact = eab_model_get_contact (view->model, row);
+ EAddressbookView *view = E_ADDRESSBOOK_VIEW (object);
+ GalViewInstance *view_instance;
+ EShellView *shell_view;
+ ESource *source;
+ gchar *uri;
- view->displayed_contact = row;
+ shell_view = e_addressbook_view_get_shell_view (view);
+ source = e_addressbook_view_get_source (view);
+ uri = e_source_get_uri (source);
- eab_contact_display_render (EAB_CONTACT_DISPLAY (view->contact_display), contact,
- EAB_CONTACT_DISPLAY_RENDER_NORMAL);
+ view_instance = e_shell_view_new_view_instance (shell_view, uri);
+ g_signal_connect_swapped (
+ view_instance, "display-view",
+ G_CALLBACK (addressbook_view_display_view_cb), view);
+ gal_view_instance_load (view_instance);
+ view->priv->view_instance = view_instance;
+
+ g_free (uri);
}
static void
-selection_changed (GObject *o, EABView *view)
+addressbook_view_class_init (EAddressbookViewClass *class)
{
- ESelectionModel *selection_model;
-
- command_state_change (view);
+ GObjectClass *object_class;
- selection_model = get_selection_model (view);
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EAddressbookViewPrivate));
- if (e_selection_model_selected_count (selection_model) == 1)
- e_selection_model_foreach (selection_model,
- (EForeachFunc)render_contact, view);
- else {
- view->displayed_contact = -1;
- eab_contact_display_render (EAB_CONTACT_DISPLAY (view->contact_display), NULL,
- EAB_CONTACT_DISPLAY_RENDER_NORMAL);
- }
+ object_class = G_OBJECT_CLASS(class);
+ object_class->set_property = addressbook_view_set_property;
+ object_class->get_property = addressbook_view_get_property;
+ object_class->dispose = addressbook_view_dispose;
+ object_class->constructed = addressbook_view_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MODEL,
+ g_param_spec_object (
+ "model",
+ _("Model"),
+ NULL,
+ E_TYPE_ADDRESSBOOK_MODEL,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_VIEW,
+ g_param_spec_object (
+ "shell-view",
+ _("Shell View"),
+ NULL,
+ E_TYPE_SHELL_VIEW,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SOURCE,
+ g_param_spec_object (
+ "source",
+ _("Source"),
+ NULL,
+ E_TYPE_SOURCE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ signals[OPEN_CONTACT] = g_signal_new (
+ "open-contact",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EAddressbookViewClass, open_contact),
+ NULL, NULL,
+ e_marshal_VOID__OBJECT_BOOLEAN,
+ G_TYPE_NONE, 2,
+ E_TYPE_CONTACT,
+ G_TYPE_BOOLEAN);
+
+ signals[POPUP_EVENT] = g_signal_new (
+ "popup-event",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EAddressbookViewClass, popup_event),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__BOXED,
+ G_TYPE_NONE, 1,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+ signals[COMMAND_STATE_CHANGE] = g_signal_new (
+ "command-state-change",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EAddressbookViewClass, command_state_change),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[SELECTION_CHANGE] = g_signal_new (
+ "selection-change",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EAddressbookViewClass, selection_change),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ if (clipboard_atom == NULL)
+ clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+ /* init the accessibility support for e_addressbook_view */
+ eab_view_a11y_init ();
}
static void
-table_double_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EABView *view)
+addressbook_view_init (EAddressbookView *view)
{
- if (E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object)) {
- EABModel *model = view->model;
- EContact *contact = eab_model_get_contact (model, row);
- EBook *book;
+ view->priv = E_ADDRESSBOOK_VIEW_GET_PRIVATE (view);
- g_object_get(model,
- "book", &book,
- NULL);
+ view->priv->model = e_addressbook_model_new ();
- g_return_if_fail (E_IS_BOOK (book));
+ view->priv->invisible = gtk_invisible_new ();
- if (e_contact_get (contact, E_CONTACT_IS_LIST))
- eab_show_contact_list_editor (book, contact, FALSE, view->editable);
- else
- eab_show_contact_editor (book, contact, FALSE, view->editable);
+ gtk_selection_add_target (
+ view->priv->invisible, clipboard_atom,
+ GDK_SELECTION_TYPE_STRING, 0);
- g_object_unref (book);
- g_object_unref (contact);
- }
+ g_signal_connect_swapped (
+ view->priv->invisible, "selection-get",
+ G_CALLBACK (addressbook_view_selection_get_cb), view);
+ g_signal_connect_swapped (
+ view->priv->invisible, "selection-clear-event",
+ G_CALLBACK (addressbook_view_selection_clear_event_cb), view);
+ g_signal_connect_swapped (
+ view->priv->invisible, "selection-received",
+ G_CALLBACK (addressbook_view_selection_received_cb), view);
}
-static gint
-table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EABView *view)
+GType
+e_addressbook_view_get_type (void)
{
- do_popup_menu(view, event);
- return TRUE;
-}
+ static GType type = 0;
-static gint
-table_white_space_event(ETableScrolled *table, GdkEvent *event, EABView *view)
-{
- if (event->type == GDK_BUTTON_PRESS && ((GdkEventButton *)event)->button == 3) {
- do_popup_menu(view, event);
- return TRUE;
- } else {
- return FALSE;
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EAddressbookViewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) addressbook_view_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EAddressbookView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) addressbook_view_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_VBOX, "EAddressbookView", &type_info, 0);
}
+
+ return type;
}
-static void
-table_drag_data_get (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer user_data)
+GtkWidget *
+e_addressbook_view_new (EShellView *shell_view,
+ ESource *source)
{
- EABView *view = user_data;
- GList *contact_list;
+ GtkWidget *widget;
+ EAddressbookView *view;
- if (!E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object))
- return;
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
- contact_list = get_selected_contacts (view);
+ widget = g_object_new (
+ E_TYPE_ADDRESSBOOK_VIEW, "shell-view",
+ shell_view, "source", source, NULL);
- switch (info) {
- case DND_TARGET_TYPE_VCARD: {
- char *value;
+ view = E_ADDRESSBOOK_VIEW (widget);
- value = eab_contact_list_to_string (contact_list);
+ g_signal_connect_swapped (
+ view->priv->model, "status_message",
+ G_CALLBACK (status_message), view);
+ g_signal_connect_swapped (
+ view->priv->model, "search_result",
+ G_CALLBACK (search_result), view);
+ g_signal_connect_swapped (
+ view->priv->model, "folder_bar_message",
+ G_CALLBACK (folder_bar_message), view);
+ g_signal_connect (view->priv->model, "stop_state_changed",
+ G_CALLBACK (stop_state_changed), view);
+ g_signal_connect_swapped (
+ view->priv->model, "writable-status",
+ G_CALLBACK (command_state_change), view);
+ g_signal_connect_swapped (
+ view->priv->model, "backend_died",
+ G_CALLBACK (backend_died), view);
- gtk_selection_data_set (selection_data,
- selection_data->target,
- 8,
- (guchar *)value, strlen (value));
- g_free (value);
- break;
- }
- case DND_TARGET_TYPE_SOURCE_VCARD: {
- char *value;
-
- value = eab_book_and_contact_list_to_string (view->book, contact_list);
-
- gtk_selection_data_set (selection_data,
- selection_data->target,
- 8,
- (guchar *)value, strlen (value));
- g_free (value);
- break;
- }
- }
-
- g_list_foreach (contact_list, (GFunc) g_object_unref, NULL);
- g_list_free (contact_list);
+ return widget;
}
-static void
-emit_status_message (EABView *eav, const gchar *status)
+EAddressbookModel *
+e_addressbook_view_get_model (EAddressbookView *view)
{
- g_signal_emit (eav,
- eab_view_signals [STATUS_MESSAGE], 0,
- status);
-}
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (view), NULL);
-static void
-emit_search_result (EABView *eav, EBookViewStatus status)
-{
- g_signal_emit (eav,
- eab_view_signals [SEARCH_RESULT], 0,
- status);
+ return view->priv->model;
}
-static void
-emit_folder_bar_message (EABView *eav, const gchar *message)
+GalViewInstance *
+e_addressbook_view_get_view_instance (EAddressbookView *view)
{
- g_signal_emit (eav,
- eab_view_signals [FOLDER_BAR_MESSAGE], 0,
- message);
-}
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (view), NULL);
-static void
-status_message (GtkObject *object, const gchar *status, EABView *eav)
-{
- emit_status_message (eav, status);
+ return view->priv->view_instance;
}
-static void
-search_result (GtkObject *object, EBookViewStatus status, EABView *eav)
+GObject *
+e_addressbook_view_get_view_object (EAddressbookView *view)
{
- emit_search_result (eav, status);
-}
+ /* XXX Find a more descriptive name for this. */
-static void
-folder_bar_message (GtkObject *object, const gchar *status, EABView *eav)
-{
- emit_folder_bar_message (eav, status);
-}
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (view), NULL);
-static void
-stop_state_changed (GtkObject *object, EABView *eav)
-{
- command_state_change (eav);
+ return view->priv->object;
}
-static void
-command_state_change (EABView *eav)
+GtkWidget *
+e_addressbook_view_get_view_widget (EAddressbookView *view)
{
- /* Reffing during emission is unnecessary. Gtk automatically refs during an emission. */
- g_signal_emit (eav, eab_view_signals [COMMAND_STATE_CHANGE], 0);
-}
+ /* XXX Find a more descriptive name for this. */
-static void
-backend_died (GtkObject *object, EABView *eav)
-{
- e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (eav))),
- "addressbook:backend-died", e_book_get_uri (eav->book), NULL);
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (view), NULL);
+
+ return view->priv->widget;
}
+/* Helper for e_addressbook_view_get_selected() */
static void
-contact_changed (EABModel *model, gint index, EABView *eav)
+add_to_list (gint model_row, gpointer closure)
{
- if (eav->displayed_contact == index) {
- /* if the contact that's presently displayed is changed, re-render it */
- render_contact (index, eav);
- }
+ GList **list = closure;
+ *list = g_list_prepend (*list, GINT_TO_POINTER (model_row));
}
-static void
-contacts_removed (EABModel *model, gpointer data, EABView *eav)
+GList *
+e_addressbook_view_get_selected (EAddressbookView *view)
{
- GArray *indices = (GArray *) data;
- int count = indices->len;
- gint i;
-
- for (i = 0; i < count; i ++) {
+ GList *list, *iter;
+ ESelectionModel *selection;
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (view), NULL);
- if (eav->displayed_contact == g_array_index (indices, gint, i)) {
+ list = NULL;
+ selection = e_addressbook_view_get_selection_model (view);
+ e_selection_model_foreach (selection, add_to_list, &list);
- /* if the contact that's presently displayed is changed, clear the display */
- eab_contact_display_render (EAB_CONTACT_DISPLAY (eav->contact_display), NULL,
- EAB_CONTACT_DISPLAY_RENDER_NORMAL);
- eav->displayed_contact = -1;
- break;
- }
- }
-}
+ for (iter = list; iter != NULL; iter = iter->next)
+ iter->data = e_addressbook_model_get_contact (
+ view->priv->model, GPOINTER_TO_INT (iter->data));
+ list = g_list_reverse (list);
-static void
-minicard_right_click (EMinicardView *minicard_view_item, GdkEvent *event, EABView *view)
-{
- do_popup_menu(view, event);
+ return list;
}
-static void
-create_minicard_view (EABView *view)
+ESelectionModel *
+e_addressbook_view_get_selection_model (EAddressbookView *view)
{
- GtkWidget *scrolled_window;
- GtkWidget *minicard_view;
- EAddressbookReflowAdapter *adapter;
+ GalView *gal_view;
+ GalViewInstance *view_instance;
+ ESelectionModel *model = NULL;
- adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(e_addressbook_reflow_adapter_new (view->model));
- minicard_view = e_minicard_view_widget_new(adapter);
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (view), NULL);
- g_signal_connect(minicard_view, "selection_change",
- G_CALLBACK(selection_changed), view);
+ view_instance = e_addressbook_view_get_view_instance (view);
+ gal_view = gal_view_instance_get_current_view (view_instance);
- g_signal_connect(minicard_view, "right_click",
- G_CALLBACK(minicard_right_click), view);
+ if (GAL_IS_VIEW_ETABLE (gal_view)) {
+ ETableScrolled *scrolled_table;
+ ETable *table;
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
+ scrolled_table = E_TABLE_SCROLLED (view->priv->widget);
+ table = e_table_scrolled_get_table (scrolled_table);
- view->object = G_OBJECT(minicard_view);
- view->widget = scrolled_window;
+ model = e_table_get_selection_model (table);
- gtk_container_add (GTK_CONTAINER (scrolled_window), minicard_view);
- gtk_widget_show (minicard_view);
+ } else if (GAL_IS_VIEW_MINICARD (gal_view)) {
+ EMinicardViewWidget *widget;
- gtk_widget_show_all( GTK_WIDGET(scrolled_window) );
+ widget = E_MINICARD_VIEW_WIDGET (view->priv->object);
- gtk_paned_add1 (GTK_PANED (view->paned), scrolled_window);
+ model = e_minicard_view_widget_get_selection_model (widget);
+ }
- e_reflow_model_changed (E_REFLOW_MODEL (adapter));
+ return model;
}
-static void
-create_table_view (EABView *view)
+EShellView *
+e_addressbook_view_get_shell_view (EAddressbookView *view)
{
- ETableModel *adapter;
- GtkWidget *table;
- char *etspecfile;
-
- adapter = eab_table_adapter_new(view->model);
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (view), 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. */
- etspecfile = g_build_filename (EVOLUTION_ETSPECDIR,
- "e-addressbook-view.etspec",
- NULL);
- table = e_table_scrolled_new_from_spec_file (adapter, NULL, etspecfile, NULL);
- g_free (etspecfile);
-
- view->object = G_OBJECT(adapter);
- view->widget = table;
-
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "double_click",
- G_CALLBACK(table_double_click), view);
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "right_click",
- G_CALLBACK(table_right_click), view);
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "white_space_event",
- G_CALLBACK(table_white_space_event), view);
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "selection_change",
- G_CALLBACK(selection_changed), view);
-
- /* drag & drop signals */
- e_table_drag_source_set (E_TABLE(E_TABLE_SCROLLED(table)->table), GDK_BUTTON1_MASK,
- drag_types, num_drag_types, GDK_ACTION_MOVE | GDK_ACTION_COPY);
-
- g_signal_connect (E_TABLE_SCROLLED(table)->table,
- "table_drag_data_get",
- G_CALLBACK (table_drag_data_get),
- view);
-
- gtk_paned_add1 (GTK_PANED (view->paned), table);
-
- gtk_widget_show( GTK_WIDGET(table) );
+ return view->priv->shell_view;
}
-static void
-change_view_type (EABView *view, EABViewType view_type)
+ESource *
+e_addressbook_view_get_source (EAddressbookView *view)
{
- if (view_type == view->view_type)
- return;
-
- if (view->widget) {
- gtk_container_remove (GTK_CONTAINER (view->paned), view->widget);
- view->widget = NULL;
- }
- view->object = NULL;
-
- switch (view_type) {
- case EAB_VIEW_TABLE:
- create_table_view (view);
- break;
- case EAB_VIEW_MINICARD:
- create_minicard_view (view);
- break;
- default:
- g_warning ("view_type not recognized.");
- return;
- }
-
- view->view_type = view_type;
+ g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (view), NULL);
- command_state_change (view);
+ return view->priv->source;
}
-
-
static void
-search_activated (ESearchBar *esb, EABView *v)
-{
- GList *master_list;
- char *search_word, *search_query, *view_sexp;
- const char *category_name;
- int search_type, subid;
-
- g_object_get(esb,
- "text", &search_word,
- "item_id", &search_type,
- NULL);
-
- if (search_type == E_FILTERBAR_ADVANCED_ID) {
- /* rebuild view immediately */
- query_changed (esb, v);
- }
- else {
- if ((search_word && strlen (search_word))) {
- GString *s = g_string_new ("");
- e_sexp_encode_string (s, search_word);
- switch (search_type) {
- case ESB_ANY:
- search_query = g_strdup_printf ("(contains \"x-evolution-any-field\" %s)",
- s->str);
- break;
- case ESB_FULL_NAME:
- search_query = g_strdup_printf ("(contains \"full_name\" %s)",
- s->str);
- break;
- case ESB_EMAIL:
- search_query = g_strdup_printf ("(beginswith \"email\" %s)",
- s->str);
- break;
- default:
- search_query = g_strdup ("(contains \"x-evolution-any-field\" \"\")");
- break;
- }
- g_string_free (s, TRUE);
-
- } else
- search_query = g_strdup ("(contains \"x-evolution-any-field\" \"\")");
-
- /* Merge view and sexp */
- subid = e_search_bar_get_viewitem_id (esb);
-
- if (subid) {
- master_list = get_master_list (FALSE);
- if (subid < 3) {
- view_sexp = g_strdup ("(not (and (exists \"CATEGORIES\") (not (is \"CATEGORIES\" \"\"))))");
- } else {
- category_name = g_list_nth_data (master_list, subid-3);
- view_sexp = g_strdup_printf ("(is \"category_list\" \"%s\")", category_name);
- }
- search_query = g_strconcat ("(and ", view_sexp, search_query, ")", NULL);
- g_free (view_sexp);
+status_message (EAddressbookView *view,
+ const gchar *status)
+{
+ EActivity *activity;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+
+ activity = view->priv->activity;
+ shell_view = e_addressbook_view_get_shell_view (view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ if (status == NULL || *status == '\0') {
+ if (activity != NULL) {
+ e_activity_complete (activity);
+ g_object_unref (activity);
+ view->priv->activity = NULL;
}
- if (search_query)
- g_object_set (v,
- "query", search_query,
- NULL);
-
- g_free (search_query);
- }
+ } else if (activity == NULL) {
+ activity = e_activity_new (status);
+ view->priv->activity = activity;
+ e_shell_backend_add_activity (shell_backend, activity);
- g_free (search_word);
- v->displayed_contact = -1;
- eab_contact_display_render (EAB_CONTACT_DISPLAY (v->contact_display), NULL,
- EAB_CONTACT_DISPLAY_RENDER_NORMAL);
+ } else
+ e_activity_set_primary_text (activity, status);
}
static void
-search_menu_activated (ESearchBar *esb, int id, EABView *view)
+search_result (EAddressbookView *view,
+ EBookViewStatus status)
{
- if (id == E_FILTERBAR_ADVANCED_ID)
- e_search_bar_set_item_id (esb, id);
-}
+ EShellView *shell_view;
+ EShellWindow *shell_window;
-static void
-query_changed (ESearchBar *esb, EABView *view)
-{
- int search_type;
- char *query;
-
- search_type = e_search_bar_get_item_id(esb);
- if (search_type == E_FILTERBAR_ADVANCED_ID) {
- g_object_get (esb, "query", &query, NULL);
- g_object_set (view, "query", query, NULL);
- g_free (query);
- }
+ shell_view = e_addressbook_view_get_shell_view (view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ eab_search_result_dialog (GTK_WIDGET (shell_window), status);
}
-static int
-compare_subitems (const void *a, const void *b)
-{
- const ESearchBarItem *subitem_a = a;
- const ESearchBarItem *subitem_b = b;
- char *collate_a, *collate_b;
- int ret;
-
- collate_a = g_utf8_collate_key (subitem_a->text, -1);
- collate_b = g_utf8_collate_key (subitem_b->text, -1);
-
- ret = strcmp (collate_a, collate_b);
-
- g_free (collate_a);
- g_free (collate_b);
-
- return ret;
-}
-
-static GtkWidget *
-generate_viewoption_menu (EABSearchBarItem *subitems)
+static void
+folder_bar_message (EAddressbookView *view,
+ const gchar *message)
{
- GtkWidget *menu, *menu_item;
- gint i = 0;
-
- menu = gtk_menu_new ();
-
- for (i = 0; subitems[i].search.id != -1; ++i) {
- if (subitems[i].search.text) {
- char *str = NULL;
- str = e_str_without_underscores (subitems[i].search.text);
- menu_item = gtk_image_menu_item_new_with_label (str);
- if (subitems[i].image) {
- GtkWidget *image;
-
- image = gtk_image_new_from_file (
- subitems[i].image);
- gtk_image_menu_item_set_image (
- GTK_IMAGE_MENU_ITEM (menu_item),
- image);
- }
- g_free (str);
- } else {
- menu_item = gtk_menu_item_new ();
- gtk_widget_set_sensitive (menu_item, FALSE);
- }
+ EShellView *shell_view;
+ EShellSidebar *shell_sidebar;
+ const gchar *name;
- g_object_set_data (G_OBJECT (menu_item), "EsbItemId",
- GINT_TO_POINTER (subitems[i].search.id));
+ shell_view = e_addressbook_view_get_shell_view (view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
- gtk_widget_show (menu_item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- }
+ if (view->priv->source == NULL)
+ return;
- return menu;
+ name = e_source_peek_name (view->priv->source);
+ e_shell_sidebar_set_primary_text (shell_sidebar, name);
+ e_shell_sidebar_set_secondary_text (shell_sidebar, message);
}
static void
-categories_changed_cb (gpointer object, gpointer user_data)
+stop_state_changed (GtkObject *object, EAddressbookView *view)
{
- get_master_list (TRUE);
- make_suboptions (user_data);
+ command_state_change (view);
}
static void
-make_suboptions (EABView *view)
+command_state_change (EAddressbookView *view)
{
- EABSearchBarItem *subitems, *s;
- GList *master_list;
- gint i, N;
- GtkWidget *menu;
-
- master_list = get_master_list (FALSE);
- N = g_list_length (master_list);
- subitems = g_new (EABSearchBarItem, N+4);
-
- subitems[0].search.id = 0;
- subitems[0].search.text = g_strdup (_("Any Category"));
- subitems[0].image = NULL;
-
- subitems[1].search.text = g_strdup (_("Unmatched"));
- subitems[1].search.id = 1;
- subitems[1].image = NULL;
-
- subitems[2].search.text = NULL;
- subitems[2].search.id = 0;
- subitems[2].image = NULL;
-
- for (i=0; i<N; ++i) {
- const char *category = g_list_nth_data (master_list, i);
- subitems[i+3].search.id = i+3;
- subitems[i+3].search.text = g_strdup (category);
- subitems[i+3].image = (char *)e_categories_get_icon_file_for (category);
- }
-
- subitems[N+3].search.id = -1;
- subitems[N+3].search.text = NULL;
- subitems[N+3].image = NULL;
-
- qsort (subitems + 3, N, sizeof (subitems[0]), compare_subitems);
- menu = generate_viewoption_menu (subitems);
- e_search_bar_set_viewoption_menu ((ESearchBar *)view->search, menu);
-
- for (s = subitems; ((ESearchBarItem *)s)->id != -1; s++) {
- if (((ESearchBarItem *)s)->text)
- g_free (((ESearchBarItem *)s)->text);
- }
- g_free (subitems);
+ g_signal_emit (view, signals[COMMAND_STATE_CHANGE], 0);
}
-static GList *
-get_master_list (gboolean force_rebuild)
+static void
+backend_died (EAddressbookView *view)
{
- static GList *category_list = NULL;
-
- if (force_rebuild) {
- g_list_free (category_list);
- category_list = NULL;
- }
-
- if (category_list == NULL) {
- GList *l, *p = e_categories_get_list ();
-
- for (l = p; l; l = l->next) {
- if (e_categories_is_searchable ((const char *) l->data))
- category_list = g_list_prepend (category_list, l->data);
- }
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EAddressbookModel *model;
+ EBook *book;
- category_list = g_list_reverse (category_list);
+ shell_view = e_addressbook_view_get_shell_view (view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
- g_list_free (p);
- }
+ model = e_addressbook_view_get_model (view);
+ book = e_addressbook_model_get_book (model);
- return category_list;
+ e_error_run (
+ GTK_WINDOW (shell_window),
+ "addressbook:backend-died",
+ e_book_get_uri (book), NULL);
}
static void
@@ -1626,78 +1038,27 @@ e_contact_print_button (EPrintable *printable, GtkPrintOperationAction action)
}
void
-eab_view_show_contact_preview (EABView *view, gboolean show)
+e_addressbook_view_print (EAddressbookView *view,
+ GtkPrintOperationAction action)
{
- g_return_if_fail (view && E_IS_ADDRESSBOOK_VIEW (view));
+ GalView *gal_view;
+ GalViewInstance *view_instance;
- if (show)
- gtk_widget_show (view->contact_display_window);
- else
- gtk_widget_hide (view->contact_display_window);
-}
-
-void
-eab_view_setup_menus (EABView *view,
- BonoboUIComponent *uic)
-{
-
- g_return_if_fail (view != NULL);
g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
- g_return_if_fail (uic != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (uic));
-
- init_collection ();
- view->uic = uic;
+ view_instance = e_addressbook_view_get_view_instance (view);
+ gal_view = gal_view_instance_get_current_view (view_instance);
- setup_menus (view);
-
- /* XXX toshok - yeah this really doesn't belong here, but it
- needs to happen at the same time and takes the uic */
- e_search_bar_set_ui_component ( (ESearchBar *)view->search, uic);
-}
-
-/**
- * eab_view_discard_menus:
- * @view: An addressbook view.
- *
- * Makes an addressbook view discard its GAL view menus and its views instance
- * objects. This should be called when the corresponding Bonobo component is
- * deactivated.
- **/
-void
-eab_view_discard_menus (EABView *view)
-{
- g_return_if_fail (view != NULL);
- g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
-
- if (view->view_menus) {
- gal_view_menus_unmerge (view->view_menus, NULL);
-
- g_object_unref (view->view_menus);
- view->view_menus = NULL;
- }
-
- if (view->view_instance) {
- g_object_unref (view->view_instance);
- view->view_instance = NULL;
- }
-
- view->uic = NULL;
-}
-
-void
-eab_view_print (EABView *view, GtkPrintOperationAction action)
-{
- if (view->view_type == EAB_VIEW_MINICARD) {
+ if (GAL_IS_VIEW_MINICARD (gal_view)) {
+ EAddressbookModel *model;
EBook *book;
EBookQuery *query;
gchar *query_string;
GList *contact_list;
- g_object_get (
- view->model, "query", &query_string,
- "book", &book, NULL);
+ model = e_addressbook_view_get_model (view);
+ book = e_addressbook_model_get_book (model);
+ query_string = e_addressbook_model_get_query (model);
if (query_string != NULL)
query = e_book_query_from_string (query_string);
@@ -1705,7 +1066,7 @@ eab_view_print (EABView *view, GtkPrintOperationAction action)
query = NULL;
g_free (query_string);
- contact_list = get_selected_contacts (view);
+ contact_list = e_addressbook_view_get_selected (view);
e_contact_print (book, query, contact_list, action);
g_list_foreach (contact_list, (GFunc) g_object_unref, NULL);
g_list_free (contact_list);
@@ -1713,11 +1074,11 @@ eab_view_print (EABView *view, GtkPrintOperationAction action)
if (query != NULL)
e_book_query_unref (query);
- } else if (view->view_type == EAB_VIEW_TABLE) {
+ } else if (GAL_IS_VIEW_ETABLE (gal_view)) {
EPrintable *printable;
ETable *table;
- g_object_get (view->widget, "table", &table, NULL);
+ g_object_get (view->priv->widget, "table", &table, NULL);
printable = e_table_get_printable (table);
g_object_ref_sink (printable);
g_object_unref (table);
@@ -1731,7 +1092,8 @@ eab_view_print (EABView *view, GtkPrintOperationAction action)
/* callback function to handle removal of contacts for
* which a user doesnt have write permission
*/
-static void delete_contacts_cb (EBook *book, EBookStatus status, gpointer closure)
+static void
+delete_contacts_cb (EBook *book, EBookStatus status, gpointer closure)
{
switch(status) {
case E_BOOK_ERROR_OK :
@@ -1747,19 +1109,85 @@ static void delete_contacts_cb (EBook *book, EBookStatus status, gpointer clos
}
}
+static gboolean
+addressbook_view_confirm_delete (GtkWindow *parent,
+ gboolean plural,
+ gboolean is_list,
+ const gchar *name)
+{
+ GtkWidget *dialog;
+ gchar *message;
+ gint response;
+
+ if (is_list) {
+ if (plural) {
+ message = g_strdup (
+ _("Are you sure you want to "
+ "delete these contact lists?"));
+ } else if (name == NULL) {
+ message = g_strdup (
+ _("Are you sure you want to "
+ "delete this contact list?"));
+ } else {
+ message = g_strdup_printf (
+ _("Are you sure you want to delete "
+ "this contact list (%s)?"), name);
+ }
+ } else {
+ if (plural) {
+ message = g_strdup (
+ _("Are you sure you want to "
+ "delete these contacts?"));
+ } else if (name == NULL) {
+ message = g_strdup (
+ _("Are you sure you want to "
+ "delete this contact?"));
+ } else {
+ message = g_strdup_printf (
+ _("Are you sure you want to delete "
+ "this contact (%s)?"), name);
+ }
+ }
+
+ dialog = gtk_message_dialog_new (
+ parent, 0, GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_NONE, "%s", message);
+ gtk_dialog_add_buttons (
+ GTK_DIALOG (dialog),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT,
+ NULL);
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ g_free (message);
+
+ return (response == GTK_RESPONSE_ACCEPT);
+}
+
void
-eab_view_delete_selection(EABView *view, gboolean is_delete)
+e_addressbook_view_delete_selection(EAddressbookView *view, gboolean is_delete)
{
GList *list, *l;
gboolean plural = FALSE, is_list = FALSE;
EContact *contact;
ETable *etable = NULL;
+ EAddressbookModel *model;
+ EBook *book;
EMinicardView *card_view;
ESelectionModel *selection_model = NULL;
+ GalViewInstance *view_instance;
+ GalView *gal_view;
char *name = NULL;
gint row = 0, select;
- list = get_selected_contacts (view);
+ model = e_addressbook_view_get_model (view);
+ book = e_addressbook_model_get_book (model);
+
+ view_instance = e_addressbook_view_get_view_instance (view);
+ gal_view = gal_view_instance_get_current_view (view_instance);
+
+ list = e_addressbook_view_get_selected (view);
contact = list->data;
if (g_list_next(list))
@@ -1770,28 +1198,29 @@ eab_view_delete_selection(EABView *view, gboolean is_delete)
if (e_contact_get (contact, E_CONTACT_IS_LIST))
is_list = TRUE;
- if (view->view_type == EAB_VIEW_MINICARD) {
- card_view = e_minicard_view_widget_get_view (E_MINICARD_VIEW_WIDGET(view->object));
- selection_model = get_selection_model (view);
+ if (GAL_IS_VIEW_MINICARD (gal_view)) {
+ card_view = e_minicard_view_widget_get_view (E_MINICARD_VIEW_WIDGET(view->priv->object));
+ selection_model = e_addressbook_view_get_selection_model (view);
row = e_selection_model_cursor_row (selection_model);
}
- else if (view->view_type == EAB_VIEW_TABLE) {
- etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(view->widget));
+ else if (GAL_IS_VIEW_ETABLE (gal_view)) {
+ etable = e_table_scrolled_get_table (
+ E_TABLE_SCROLLED(view->priv->widget));
row = e_table_get_cursor_row (E_TABLE (etable));
}
/* confirm delete */
- if (is_delete &&
- !eab_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(view->widget)),
- plural, is_list, name)) {
+ if (is_delete && !addressbook_view_confirm_delete (
+ GTK_WINDOW (gtk_widget_get_toplevel (
+ view->priv->widget)), plural, is_list, name)) {
g_free (name);
g_list_foreach (list, (GFunc) g_object_unref, NULL);
g_list_free (list);
return;
}
- if (e_book_check_static_capability (view->book, "bulk-remove")) {
+ if (e_book_check_static_capability (book, "bulk-remove")) {
GList *ids = NULL;
for (l=list;l;l=g_list_next(l)) {
@@ -1801,7 +1230,7 @@ eab_view_delete_selection(EABView *view, gboolean is_delete)
}
/* Remove the cards all at once. */
- e_book_async_remove_contacts (view->book,
+ e_book_async_remove_contacts (book,
ids,
delete_contacts_cb,
NULL);
@@ -1812,7 +1241,7 @@ eab_view_delete_selection(EABView *view, gboolean is_delete)
for (l=list;l;l=g_list_next(l)) {
contact = l->data;
/* Remove the card. */
- e_book_async_remove_contact (view->book,
+ e_book_async_remove_contact (book,
contact,
delete_contacts_cb,
NULL);
@@ -1820,7 +1249,7 @@ eab_view_delete_selection(EABView *view, gboolean is_delete)
}
/* Sets the cursor, at the row after the deleted row */
- if (view->view_type == EAB_VIEW_MINICARD && row!=0) {
+ if (GAL_IS_VIEW_MINICARD (gal_view) && row != 0) {
select = e_sorter_model_to_sorted (selection_model->sorter, row);
/* Sets the cursor, before the deleted row if its the last row */
@@ -1834,7 +1263,7 @@ eab_view_delete_selection(EABView *view, gboolean is_delete)
}
/* Sets the cursor, at the row after the deleted row */
- else if (view->view_type == EAB_VIEW_TABLE && row!=0) {
+ else if (GAL_IS_VIEW_ETABLE (gal_view) && row != 0) {
select = e_table_model_to_view_row (E_TABLE (etable), row);
/* Sets the cursor, before the deleted row if its the last row */
@@ -1850,234 +1279,149 @@ eab_view_delete_selection(EABView *view, gboolean is_delete)
g_list_free (list);
}
-static void
-invisible_destroyed (gpointer data, GObject *where_object_was)
-{
- EABView *view = data;
- view->invisible = NULL;
-}
-
-static void
-selection_get (GtkWidget *invisible,
- GtkSelectionData *selection_data,
- guint info,
- guint time_stamp,
- EABView *view)
-{
- char *value;
-
- value = eab_contact_list_to_string (view->clipboard_contacts);
-
- gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING,
- 8, (guchar *)value, strlen (value));
- g_free (value);
-}
-
-static void
-selection_clear_event (GtkWidget *invisible,
- GdkEventSelection *event,
- EABView *view)
+void
+e_addressbook_view_save_as (EAddressbookView *view,
+ gboolean all)
{
- if (view->clipboard_contacts) {
- g_list_foreach (view->clipboard_contacts, (GFunc)g_object_unref, NULL);
- g_list_free (view->clipboard_contacts);
- view->clipboard_contacts = NULL;
- }
-}
+ GList *list = NULL;
+ EBook *book;
-static void
-selection_received (GtkWidget *invisible,
- GtkSelectionData *selection_data,
- guint time,
- EABView *view)
-{
- if (selection_data->length <= 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) {
- return;
- } else {
- GList *contact_list;
- GList *l;
- char *str = NULL;
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
- if (selection_data->data [selection_data->length - 1] != 0) {
- str = g_malloc0 (selection_data->length + 1);
- memcpy (str, selection_data->data, selection_data->length);
- contact_list = eab_contact_list_from_string (str);
- } else
- contact_list = eab_contact_list_from_string ((char *)selection_data->data);
+ book = e_addressbook_model_get_book (view->priv->model);
- for (l = contact_list; l; l = l->next) {
- EContact *contact = l->data;
+ if (all) {
+ EBookQuery *query;
- /* XXX NULL for a callback /sigh */
- eab_merging_book_add_contact (view->book, contact, NULL /* XXX */, NULL);
- }
+ query = e_book_query_any_field_contains ("");
+ e_book_get_contacts (book, query, &list, NULL);
+ e_book_query_unref (query);
+ } else
+ list = e_addressbook_view_get_selected (view);
- g_list_foreach (contact_list, (GFunc)g_object_unref, NULL);
- g_list_free (contact_list);
- g_free (str);
+ if (list != NULL) {
+ eab_contact_list_save (_("Save as vCard..."), list, NULL);
+ g_list_foreach (list, (GFunc) g_object_unref, NULL);
+ g_list_free (list);
}
}
-static void
-add_to_list (int model_row, gpointer closure)
-{
- GList **list = closure;
- *list = g_list_prepend (*list, GINT_TO_POINTER (model_row));
-}
-
-static GList *
-get_selected_contacts (EABView *view)
-{
- GList *list;
- GList *iterator;
- ESelectionModel *selection = get_selection_model (view);
-
- list = NULL;
- e_selection_model_foreach (selection, add_to_list, &list);
-
- for (iterator = list; iterator; iterator = iterator->next) {
- iterator->data = eab_model_get_contact (view->model, GPOINTER_TO_INT (iterator->data));
- }
- list = g_list_reverse (list);
- return list;
-}
-
void
-eab_view_save_as (EABView *view, gboolean all)
+e_addressbook_view_view (EAddressbookView *view)
{
- GList *list = NULL;
- EBook *book ;
+ EAddressbookModel *model;
+ EBook *book;
+ GList *list, *iter;
+ gboolean editable;
+ gint response;
+ guint length;
- g_object_get(view->model,
- "book", &book,
- NULL);
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
- if (all) {
- EBookQuery *query = e_book_query_any_field_contains("");
- e_book_get_contacts(book, query, &list, NULL);
- e_book_query_unref(query);
- }
- else {
- list = get_selected_contacts(view);
+ model = e_addressbook_view_get_model (view);
+ book = e_addressbook_model_get_book (model);
+ editable = e_addressbook_model_get_editable (model);
+
+ list = e_addressbook_view_get_selected (view);
+ length = g_list_length (list);
+ response = GTK_RESPONSE_YES;
+
+ if (length > 5) {
+ GtkWidget *dialog;
+
+ /* XXX Use e_error_new(). */
+ /* XXX Provide a parent window. */
+ dialog = gtk_message_dialog_new (
+ NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
+ _("Opening %d contacts will open %d new windows as "
+ "well.\nDo you really want to display all of these "
+ "contacts?"), length, length);
+ gtk_dialog_add_buttons (
+ GTK_DIALOG (dialog),
+ _("_Don't Display"), GTK_RESPONSE_NO,
+ _("Display _All Contacts"), GTK_RESPONSE_YES,
+ NULL);
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
}
- if (list)
- eab_contact_list_save (_("Save as vCard..."), list, NULL);
- g_list_foreach (list, (GFunc) g_object_unref, NULL);
- g_list_free (list);
-}
-void
-eab_view_view (EABView *view)
-{
- GList *list = get_selected_contacts (view);
- eab_show_multiple_contacts (view->book, list, view->editable);
- g_list_foreach (list, (GFunc) g_object_unref, NULL);
- g_list_free (list);
-}
+ if (response == GTK_RESPONSE_YES)
+ for (iter = list; iter != NULL; iter = iter->next)
+ addressbook_view_emit_open_contact (
+ view, iter->data, FALSE);
-void
-eab_view_send (EABView *view)
-{
- GList *list = get_selected_contacts (view);
- if (list)
- eab_send_contact_list (list, EAB_DISPOSITION_AS_ATTACHMENT);
g_list_foreach (list, (GFunc) g_object_unref, NULL);
g_list_free (list);
}
void
-eab_view_send_to (EABView *view)
+e_addressbook_view_cut (EAddressbookView *view)
{
- GList *list = get_selected_contacts (view);
- if (list)
- eab_send_contact_list (list, EAB_DISPOSITION_AS_TO);
- g_list_foreach (list, (GFunc) g_object_unref, NULL);
- g_list_free (list);
-}
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
-void
-eab_view_cut (EABView *view)
-{
- eab_view_copy (view);
- eab_view_delete_selection (view, FALSE);
+ e_addressbook_view_copy (view);
+ e_addressbook_view_delete_selection (view, FALSE);
}
-static gboolean
-contact_display_has_selection (EABContactDisplay *display)
+void
+e_addressbook_view_copy (EAddressbookView *view)
{
- gchar *string;
- gint selection_length;
- gboolean has_selection;
-
- string = gtk_html_get_selection_html (GTK_HTML (display), &selection_length);
-
- has_selection = string ? TRUE : FALSE;
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
- if (string)
- g_free (string);
+ view->priv->clipboard_contacts = e_addressbook_view_get_selected (view);
- return has_selection;
+ gtk_selection_owner_set (
+ view->priv->invisible,
+ clipboard_atom, GDK_CURRENT_TIME);
}
void
-eab_view_copy (EABView *view)
+e_addressbook_view_paste (EAddressbookView *view)
{
- if (GTK_WIDGET_HAS_FOCUS (view->contact_display) &&
- contact_display_has_selection (EAB_CONTACT_DISPLAY (view->contact_display)))
- {
- gtk_html_copy (GTK_HTML (view->contact_display));
- }
- else
- {
- view->clipboard_contacts = get_selected_contacts (view);
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
- gtk_selection_owner_set (view->invisible, clipboard_atom, GDK_CURRENT_TIME);
- }
+ gtk_selection_convert (
+ view->priv->invisible, clipboard_atom,
+ GDK_SELECTION_TYPE_STRING, GDK_CURRENT_TIME);
}
void
-eab_view_paste (EABView *view)
+e_addressbook_view_select_all (EAddressbookView *view)
{
- gtk_selection_convert (view->invisible, clipboard_atom,
- GDK_SELECTION_TYPE_STRING,
- GDK_CURRENT_TIME);
-}
+ ESelectionModel *model;
-void
-eab_view_select_all (EABView *view)
-{
- ESelectionModel *model = get_selection_model (view);
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
+ model = e_addressbook_view_get_selection_model (view);
g_return_if_fail (model);
e_selection_model_select_all (model);
}
void
-eab_view_show_all(EABView *view)
+e_addressbook_view_show_all (EAddressbookView *view)
{
- g_object_set(view,
- "query", NULL,
- NULL);
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
+
+ e_addressbook_model_set_query (view->priv->model, "");
}
void
-eab_view_stop(EABView *view)
+e_addressbook_view_stop (EAddressbookView *view)
{
- if (view)
- eab_model_stop (view->model);
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
+
+ e_addressbook_model_stop (view->priv->model);
}
static void
-view_transfer_contacts (EABView *view, gboolean delete_from_source, gboolean all)
+view_transfer_contacts (EAddressbookView *view, gboolean delete_from_source, gboolean all)
{
EBook *book;
GList *contacts = NULL;
GtkWindow *parent_window;
- g_object_get(view->model,
- "book", &book,
- NULL);
+ book = e_addressbook_model_get_book (view->priv->model);
if (all) {
EBookQuery *query = e_book_query_any_field_contains("");
@@ -2085,7 +1429,7 @@ view_transfer_contacts (EABView *view, gboolean delete_from_source, gboolean all
e_book_query_unref(query);
}
else {
- contacts = get_selected_contacts (view);
+ contacts = e_addressbook_view_get_selected (view);
}
parent_window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
@@ -2094,132 +1438,13 @@ view_transfer_contacts (EABView *view, gboolean delete_from_source, gboolean all
}
void
-eab_view_copy_to_folder (EABView *view, gboolean all)
+e_addressbook_view_copy_to_folder (EAddressbookView *view, gboolean all)
{
view_transfer_contacts (view, FALSE, all);
}
void
-eab_view_move_to_folder (EABView *view, gboolean all)
+e_addressbook_view_move_to_folder (EAddressbookView *view, gboolean all)
{
view_transfer_contacts (view, TRUE, all);
}
-
-
-static gboolean
-eab_view_selection_nonempty (EABView *view)
-{
- ESelectionModel *selection_model;
-
- selection_model = get_selection_model (view);
- if (selection_model == NULL)
- return FALSE;
-
- return e_selection_model_selected_count (selection_model) != 0;
-}
-
-gboolean
-eab_view_can_create (EABView *view)
-{
- return view ? eab_model_editable (view->model) : FALSE;
-}
-
-gboolean
-eab_view_can_print (EABView *view)
-{
- return view && view->model ? eab_model_contact_count (view->model) : FALSE;
-}
-
-gboolean
-eab_view_can_save_as (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-eab_view_can_view (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-eab_view_can_send (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-eab_view_can_send_to (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-eab_view_can_delete (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) && eab_model_editable (view->model) : FALSE;
-}
-
-gboolean
-eab_view_can_cut (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) && eab_model_editable (view->model) : FALSE;
-}
-
-gboolean
-eab_view_can_copy (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-eab_view_can_paste (EABView *view)
-{
- return view ? eab_model_editable (view->model) : FALSE;
-}
-
-gboolean
-eab_view_can_select_all (EABView *view)
-{
- return view ? eab_model_contact_count (view->model) != 0 : FALSE;
-}
-
-gboolean
-eab_view_can_stop (EABView *view)
-{
- return view ? eab_model_can_stop (view->model) : FALSE;
-}
-
-gboolean
-eab_view_can_copy_to_folder (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-eab_view_can_move_to_folder (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) && eab_model_editable (view->model) : FALSE;
-}
-
-EABMenuTargetSelect *
-eab_view_get_menu_target (EABView *view, EABMenu *menu)
-{
- GPtrArray *cards = g_ptr_array_new();
- ESelectionModel *selection_model;
- EABMenuTargetSelect *t;
-
- selection_model = get_selection_model (view);
- if (selection_model) {
- ContactAndBook cab;
-
- cab.view = view;
- cab.closure = cards;
- e_selection_model_foreach(selection_model, get_card_1, &cab);
- }
-
- t = eab_menu_target_new_select(menu, view->book, !eab_model_editable(view->model), cards);
- t->target.widget = (GtkWidget *)view;
-
- return t;
-}
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
index 7f796415cd..ab168ec8b7 100644
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ b/addressbook/gui/widgets/e-addressbook-view.h
@@ -20,145 +20,105 @@
*
*/
-#ifndef __EAB_VIEW_H__
-#define __EAB_VIEW_H__
+#ifndef E_ADDRESSBOOK_VIEW_H
+#define E_ADDRESSBOOK_VIEW_H
-#include <gtk/gtk.h>
-#include <bonobo/bonobo-ui-component.h>
-#include <widgets/menus/gal-view-instance.h>
+#include <e-shell-view.h>
#include <libebook/e-book.h>
+#include <libebook/e-contact.h>
+#include <widgets/menus/gal-view-instance.h>
+#include <widgets/misc/e-selection-model.h>
+
#include "e-addressbook-model.h"
#include "eab-contact-display.h"
-#include "widgets/menus/gal-view-menus.h"
-#include "misc/e-search-bar.h"
-#include "misc/e-filter-bar.h"
-
-G_BEGIN_DECLS
-
-struct _EABMenu;
-struct _EABMenuTargetSelect;
-
-/* EABView - A card displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- */
-
-#define E_TYPE_AB_VIEW (eab_view_get_type ())
-#define EAB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_AB_VIEW, EABView))
-#define EAB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_AB_VIEW, EABViewClass))
-#define E_IS_ADDRESSBOOK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_AB_VIEW))
-#define E_IS_ADDRESSBOOK_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_AB_VIEW))
-typedef enum {
- EAB_VIEW_NONE, /* initialized to this */
- EAB_VIEW_MINICARD,
- EAB_VIEW_TABLE
-} EABViewType;
+/* Standard GObject macros */
+#define E_TYPE_ADDRESSBOOK_VIEW \
+ (e_addressbook_view_get_type ())
+#define E_ADDRESSBOOK_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ADDRESSBOOK_VIEW, EAddressbookView))
+#define E_ADDRESSBOOK_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ADDRESSBOOK_VIEW, EAddressbookViewClass))
+#define E_IS_ADDRESSBOOK_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ADDRESSBOOK_VIEW))
+#define E_IS_ADDRESSBOOK_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), E_TYPE_ADDRESSBOOK_VIEW))
+#define E_ADDRESSBOOK_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ADDRESSBOOK_VIEW, EAddressbookViewClass))
+G_BEGIN_DECLS
-typedef struct _EABView EABView;
-typedef struct _EABViewClass EABViewClass;
+typedef struct _EAddressbookView EAddressbookView;
+typedef struct _EAddressbookViewClass EAddressbookViewClass;
+typedef struct _EAddressbookViewPrivate EAddressbookViewPrivate;
-struct _EABView
-{
+struct _EAddressbookView {
GtkVBox parent;
-
- /* item specific fields */
- EABViewType view_type;
-
- EABModel *model;
-
- GtkWidget *invisible;
- GList *clipboard_contacts;
-
- EBook *book;
- ESource *source;
- char *query;
- guint editable : 1;
-
- gint displayed_contact;
-
- GObject *object;
- GtkWidget *widget;
-
- GtkWidget *contact_display_window;
- GtkWidget *contact_display;
- GtkWidget *paned;
-
- /* Menus handler and the view instance */
- GalViewInstance *view_instance;
- GalViewMenus *view_menus;
- GalView *current_view;
- BonoboUIComponent *uic;
-
- /* the search bar and related machinery */
- EFilterBar *search;
- gint ecml_changed_id;
- RuleContext *search_context;
- FilterRule *search_rule;
+ EAddressbookViewPrivate *priv;
};
-struct _EABViewClass
-{
+struct _EAddressbookViewClass {
GtkVBoxClass parent_class;
- /*
- * Signals
- */
- void (*status_message) (EABView *view, const gchar *message);
- void (*search_result) (EABView *view, EBookViewStatus status);
- void (*folder_bar_message) (EABView *view, const gchar *message);
- void (*command_state_change) (EABView *view);
+ /* Signals */
+ void (*open_contact) (EAddressbookView *view,
+ EContact *contact,
+ gboolean is_new_contact);
+ void (*popup_event) (EAddressbookView *view,
+ GdkEvent *event);
+ void (*status_message) (EAddressbookView *view,
+ const gchar *message);
+ void (*command_state_change) (EAddressbookView *view);
+ void (*selection_change) (EAddressbookView *view);
};
-GtkWidget *eab_view_new (void);
-GType eab_view_get_type (void);
-
-void eab_view_show_contact_preview (EABView *view, gboolean show);
-
-void eab_view_setup_menus (EABView *view,
- BonoboUIComponent *uic);
-void eab_view_discard_menus (EABView *view);
-
-RuleContext *eab_view_peek_search_context (EABView *view);
-FilterRule *eab_view_peek_search_rule (EABView *view);
-
-void eab_view_save_as (EABView *view, gboolean all);
-void eab_view_view (EABView *view);
-void eab_view_send (EABView *view);
-void eab_view_send_to (EABView *view);
-void eab_view_print (EABView *view,
- GtkPrintOperationAction action);
-void eab_view_delete_selection (EABView *view, gboolean is_delete);
-void eab_view_cut (EABView *view);
-void eab_view_copy (EABView *view);
-void eab_view_paste (EABView *view);
-void eab_view_select_all (EABView *view);
-void eab_view_show_all (EABView *view);
-void eab_view_stop (EABView *view);
-void eab_view_copy_to_folder (EABView *view, gboolean all);
-void eab_view_move_to_folder (EABView *view, gboolean all);
-
-gboolean eab_view_can_create (EABView *view);
-gboolean eab_view_can_print (EABView *view);
-gboolean eab_view_can_save_as (EABView *view);
-gboolean eab_view_can_view (EABView *view);
-gboolean eab_view_can_send (EABView *view);
-gboolean eab_view_can_send_to (EABView *view);
-gboolean eab_view_can_delete (EABView *view);
-gboolean eab_view_can_cut (EABView *view);
-gboolean eab_view_can_copy (EABView *view);
-gboolean eab_view_can_paste (EABView *view);
-gboolean eab_view_can_select_all (EABView *view);
-gboolean eab_view_can_stop (EABView *view);
-gboolean eab_view_can_copy_to_folder (EABView *view);
-gboolean eab_view_can_move_to_folder (EABView *view);
-
-struct _EABMenuTargetSelect *eab_view_get_menu_target (EABView *view, struct _EABMenu *menu);
+GType e_addressbook_view_get_type (void);
+GtkWidget * e_addressbook_view_new (EShellView *shell_view,
+ ESource *source);
+EAddressbookModel *
+ e_addressbook_view_get_model (EAddressbookView *view);
+GalViewInstance *
+ e_addressbook_view_get_view_instance
+ (EAddressbookView *view);
+GObject * e_addressbook_view_get_view_object
+ (EAddressbookView *view);
+GtkWidget * e_addressbook_view_get_view_widget
+ (EAddressbookView *view);
+GList * e_addressbook_view_get_selected (EAddressbookView *view);
+ESelectionModel *
+ e_addressbook_view_get_selection_model
+ (EAddressbookView *view);
+EShellView * e_addressbook_view_get_shell_view
+ (EAddressbookView *view);
+ESource * e_addressbook_view_get_source (EAddressbookView *view);
+void e_addressbook_view_save_as (EAddressbookView *view,
+ gboolean all);
+void e_addressbook_view_view (EAddressbookView *view);
+void e_addressbook_view_print (EAddressbookView *view,
+ GtkPrintOperationAction action);
+void e_addressbook_view_delete_selection
+ (EAddressbookView *view,
+ gboolean is_delete);
+void e_addressbook_view_cut (EAddressbookView *view);
+void e_addressbook_view_copy (EAddressbookView *view);
+void e_addressbook_view_paste (EAddressbookView *view);
+void e_addressbook_view_select_all (EAddressbookView *view);
+void e_addressbook_view_show_all (EAddressbookView *view);
+void e_addressbook_view_stop (EAddressbookView *view);
+void e_addressbook_view_copy_to_folder
+ (EAddressbookView *view,
+ gboolean all);
+void e_addressbook_view_move_to_folder
+ (EAddressbookView *view,
+ gboolean all);
+
+gboolean e_addressbook_view_can_create (EAddressbookView *view);
G_END_DECLS
-#endif /* __EAB_VIEW_H__ */
+#endif /* E_ADDRESSBOOK_VIEW_H */
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
index 9c493afa61..ac1f35caa7 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ b/addressbook/gui/widgets/e-minicard-view-widget.c
@@ -53,6 +53,8 @@ enum {
};
enum {
+ CREATE_CONTACT,
+ CREATE_CONTACT_LIST,
SELECTION_CHANGE,
COLUMN_WIDTH_CHANGED,
RIGHT_CLICK,
@@ -140,6 +142,24 @@ e_minicard_view_widget_class_init (EMinicardViewWidgetClass *class)
0.0, G_MAXDOUBLE, 150.0,
G_PARAM_READWRITE));
+ signals [CREATE_CONTACT] =
+ g_signal_new ("create-contact",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EMinicardViewWidgetClass, create_contact),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals [CREATE_CONTACT_LIST] =
+ g_signal_new ("create-contact-list",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EMinicardViewWidgetClass, create_contact_list),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
signals [SELECTION_CHANGE] =
g_signal_new ("selection_change",
G_OBJECT_CLASS_TYPE (object_class),
@@ -315,6 +335,18 @@ column_width_changed (ESelectionModel *esm, double width, EMinicardViewWidget *w
signals [COLUMN_WIDTH_CHANGED], 0, width);
}
+static void
+create_contact (EMinicardView *view, EMinicardViewWidget *widget)
+{
+ g_signal_emit (widget, signals[CREATE_CONTACT], 0);
+}
+
+static void
+create_contact_list (EMinicardView *view, EMinicardViewWidget *widget)
+{
+ g_signal_emit (widget, signals[CREATE_CONTACT_LIST], 0);
+}
+
static guint
right_click (EMinicardView *view, GdkEvent *event, EMinicardViewWidget *widget)
{
@@ -370,6 +402,12 @@ e_minicard_view_widget_realize (GtkWidget *widget)
"column_width_changed",
G_CALLBACK (column_width_changed), view);
g_signal_connect (view->emv,
+ "create-contact",
+ G_CALLBACK (create_contact), view);
+ g_signal_connect (view->emv,
+ "create-contact-list",
+ G_CALLBACK (create_contact_list), view);
+ g_signal_connect (view->emv,
"right_click",
G_CALLBACK (right_click), view);
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.h b/addressbook/gui/widgets/e-minicard-view-widget.h
index ff9cddac24..82962218fa 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.h
+++ b/addressbook/gui/widgets/e-minicard-view-widget.h
@@ -58,6 +58,8 @@ struct _EMinicardViewWidget
struct _EMinicardViewWidgetClass
{
ECanvasClass parent_class;
+ void (*create_contact) (EMinicardViewWidget *emvw);
+ void (*create_contact_list) (EMinicardViewWidget *emvw);
void (*selection_change) (EMinicardViewWidget *emvw);
void (*column_width_changed) (EMinicardViewWidget *emvw, double width);
guint (*right_click) (EMinicardViewWidget *emvw);
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index b716c86c80..e60d32cf10 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -33,7 +33,8 @@
#include <misc/e-canvas.h>
#include <glib/gi18n.h>
#include <string.h>
-#include "a11y/addressbook/ea-addressbook.h"
+#include "e-util/e-util.h"
+#include "a11y/ea-addressbook.h"
static void e_minicard_view_drag_data_get(GtkWidget *widget,
GdkDragContext *context,
@@ -56,6 +57,8 @@ enum {
enum {
+ CREATE_CONTACT,
+ CREATE_CONTACT_LIST,
RIGHT_CLICK,
LAST_SIGNAL
};
@@ -160,7 +163,7 @@ set_empty_message (EMinicardView *view)
EBook *book;
if (view->adapter) {
- EABModel *model = NULL;
+ EAddressbookModel *model = NULL;
g_object_get (view->adapter,
"editable", &editable,
@@ -171,7 +174,7 @@ set_empty_message (EMinicardView *view)
if (!e_book_check_static_capability (book, "do-initial-query"))
perform_initial_query = TRUE;
- searching = model && eab_model_can_stop (model);
+ searching = model && e_addressbook_model_can_stop (model);
}
if (searching) {
@@ -196,13 +199,13 @@ set_empty_message (EMinicardView *view)
}
static void
-writable_status_change (EABModel *model, gboolean writable, EMinicardView *view)
+writable_status_change (EAddressbookModel *model, gboolean writable, EMinicardView *view)
{
set_empty_message (view);
}
static void
-stop_state_changed (EABModel *model, EMinicardView *view)
+stop_state_changed (EAddressbookModel *model, EMinicardView *view)
{
set_empty_message (view);
}
@@ -230,7 +233,7 @@ e_minicard_view_set_property (GObject *object,
case PROP_ADAPTER:
if (view->adapter) {
if (view->writable_status_id || view->stop_state_id) {
- EABModel *model;
+ EAddressbookModel *model;
g_object_get (view->adapter,
"model", &model,
NULL);
@@ -253,7 +256,7 @@ e_minicard_view_set_property (GObject *object,
"model", view->adapter,
NULL);
if (view->adapter) {
- EABModel *model;
+ EAddressbookModel *model;
g_object_get (view->adapter,
"model", &model,
NULL);
@@ -338,7 +341,7 @@ e_minicard_view_dispose (GObject *object)
if (view->adapter) {
if (view->writable_status_id || view->stop_state_id) {
- EABModel *model;
+ EAddressbookModel *model;
g_object_get (view->adapter,
"model", &model,
NULL);
@@ -383,13 +386,8 @@ e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event)
g_object_get(view->adapter, "editable", &editable, NULL);
- if (editable) {
- EBook *book;
- g_object_get(view, "book", &book, NULL);
-
- if (book && E_IS_BOOK (book))
- eab_show_contact_editor (book, e_contact_new(), TRUE, editable);
- }
+ if (editable)
+ e_minicard_view_create_contact (view);
return TRUE;
}
case GDK_BUTTON_PRESS:
@@ -547,6 +545,22 @@ e_minicard_view_class_init (EMinicardViewClass *klass)
FALSE,
G_PARAM_READWRITE));
+ signals [CREATE_CONTACT] =
+ g_signal_new ("create-contact",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals [CREATE_CONTACT_LIST] =
+ g_signal_new ("create-contact-list",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
signals [RIGHT_CLICK] =
g_signal_new ("right_click",
G_OBJECT_CLASS_TYPE (object_class),
@@ -655,3 +669,19 @@ e_minicard_view_get_card_list (EMinicardView *view)
mal.list = g_list_reverse (mal.list);
return mal.list;
}
+
+void
+e_minicard_view_create_contact (EMinicardView *view)
+{
+ g_return_if_fail (E_IS_MINICARD_VIEW (view));
+
+ g_signal_emit (view, signals[CREATE_CONTACT], 0);
+}
+
+void
+e_minicard_view_create_contact_list (EMinicardView *view)
+{
+ g_return_if_fail (E_IS_MINICARD_VIEW (view));
+
+ g_signal_emit (view, signals[CREATE_CONTACT_LIST], 0);
+}
diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h
index 4bda766254..7a21914e86 100644
--- a/addressbook/gui/widgets/e-minicard-view.h
+++ b/addressbook/gui/widgets/e-minicard-view.h
@@ -26,7 +26,7 @@
#include "e-minicard.h"
-#include <misc/e-reflow.h>
+#include <text/e-reflow.h>
#include <misc/e-selection-model-simple.h>
#include <libebook/e-book.h>
#include "e-addressbook-reflow-adapter.h"
@@ -91,6 +91,8 @@ void e_minicard_view_remove_selection (EMinicardView *view,
void e_minicard_view_jump_to_letter (EMinicardView *view,
gunichar letter);
GList *e_minicard_view_get_card_list (EMinicardView *view);
+void e_minicard_view_create_contact (EMinicardView *view);
+void e_minicard_view_create_contact_list (EMinicardView *view);
G_END_DECLS
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 0c70b12da0..3f89b8fdc6 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -35,11 +35,10 @@
#include "e-minicard.h"
#include "e-minicard-label.h"
#include "e-minicard-view.h"
-#include "e-contact-editor.h"
#include <e-util/e-html-utils.h>
#include <e-util/e-icon-factory.h>
#include <libebook/e-destination.h>
-#include "a11y/addressbook/ea-addressbook.h"
+#include "a11y/ea-addressbook.h"
static void e_minicard_init (EMinicard *card);
static void e_minicard_class_init (EMinicardClass *class);
@@ -86,6 +85,7 @@ enum {
enum {
SELECTED,
DRAG_BEGIN,
+ OPEN_CONTACT,
STYLE_SET,
LAST_SIGNAL
};
@@ -101,7 +101,7 @@ common_location [] =
{ "OTHER", N_ ("Other Email") }
};
-static guint e_minicard_signals [LAST_SIGNAL] = {0, };
+static guint signals [LAST_SIGNAL] = {0, };
GType
e_minicard_get_type (void)
@@ -200,7 +200,7 @@ e_minicard_class_init (EMinicardClass *class)
E_TYPE_CONTACT,
G_PARAM_READWRITE));
- e_minicard_signals [SELECTED] =
+ signals [SELECTED] =
g_signal_new ("selected",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
@@ -209,7 +209,7 @@ e_minicard_class_init (EMinicardClass *class)
e_marshal_INT__POINTER,
G_TYPE_INT, 1, G_TYPE_POINTER);
- e_minicard_signals [DRAG_BEGIN] =
+ signals [DRAG_BEGIN] =
g_signal_new ("drag_begin",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
@@ -218,7 +218,17 @@ e_minicard_class_init (EMinicardClass *class)
e_marshal_INT__POINTER,
G_TYPE_INT, 1, G_TYPE_POINTER);
- e_minicard_signals [STYLE_SET] =
+ signals [OPEN_CONTACT] =
+ g_signal_new ("open-contact",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EMinicardClass, open_contact),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_CONTACT);
+
+ signals [STYLE_SET] =
g_signal_new ("style_set",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
@@ -249,8 +259,6 @@ e_minicard_init (EMinicard *minicard)
minicard->list_icon_pixbuf = e_icon_factory_get_icon (LIST_ICON_NAME, GTK_ICON_SIZE_MENU);
minicard->list_icon_size = gdk_pixbuf_get_height (minicard->list_icon_pixbuf);
- minicard->editor = NULL;
-
minicard->changed = FALSE;
e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard), e_minicard_reflow);
@@ -528,50 +536,12 @@ e_minicard_unrealize (GnomeCanvasItem *item)
(* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item);
}
-/* Callback used when the contact editor is closed */
-static void
-editor_closed_cb (GtkObject *editor, gpointer data)
-{
- EMinicard *minicard = data;
- g_object_unref (editor);
- minicard->editor = NULL;
-}
-
-gboolean
-e_minicard_activate_editor(EMinicard *minicard)
+void
+e_minicard_activate_editor (EMinicard *minicard)
{
- GnomeCanvasItem *item = (GnomeCanvasItem *)minicard;
-
- if (minicard->editor) {
- eab_editor_raise (minicard->editor);
- }
- else {
- EBook *book = NULL;
- if (E_IS_MINICARD_VIEW(item->parent)) {
- g_object_get(item->parent, "book", &book, NULL);
- }
-
- if (book != NULL) {
- if (e_contact_get (minicard->contact, E_CONTACT_IS_LIST)) {
- EContactListEditor *editor = eab_show_contact_list_editor (book, minicard->contact,
- FALSE, e_book_is_writable (book));
- minicard->editor = EAB_EDITOR (editor);
- }
- else {
- EContactEditor *editor = eab_show_contact_editor (book, minicard->contact,
- FALSE, e_book_is_writable (book));
- minicard->editor = EAB_EDITOR (editor);
- }
-
- g_object_ref (minicard->editor);
- g_signal_connect (minicard->editor, "editor_closed",
- G_CALLBACK (editor_closed_cb), minicard);
-
- g_object_unref (book);
- }
- }
+ g_return_if_fail (E_IS_MINICARD (minicard));
- return TRUE;
+ g_signal_emit (minicard, signals[OPEN_CONTACT], 0, minicard->contact);
}
static gboolean
@@ -655,7 +625,8 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
break;
case GDK_2BUTTON_PRESS:
if (event->button.button == 1 && E_IS_MINICARD_VIEW (item->parent)) {
- return e_minicard_activate_editor (e_minicard);
+ e_minicard_activate_editor (e_minicard);
+ return TRUE;
}
break;
case GDK_KEY_PRESS:
@@ -725,7 +696,8 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
}
else if (event->key.keyval == GDK_Return ||
event->key.keyval == GDK_KP_Enter) {
- return e_minicard_activate_editor (e_minicard);
+ e_minicard_activate_editor (e_minicard);
+ return TRUE;
}
break;
default:
@@ -1154,7 +1126,7 @@ e_minicard_drag_begin (EMinicard *minicard, GdkEvent *event)
gint ret_val = 0;
GnomeCanvasItem *parent;
g_signal_emit (minicard,
- e_minicard_signals[DRAG_BEGIN], 0,
+ signals[DRAG_BEGIN], 0,
event, &ret_val);
parent = GNOME_CANVAS_ITEM (minicard)->parent;
diff --git a/addressbook/gui/widgets/e-minicard.h b/addressbook/gui/widgets/e-minicard.h
index fb8116cb9d..520cc55cac 100644
--- a/addressbook/gui/widgets/e-minicard.h
+++ b/addressbook/gui/widgets/e-minicard.h
@@ -24,7 +24,6 @@
#define __E_MINICARD_H__
#include <gtk/gtk.h>
-#include "addressbook/gui/contact-editor/eab-editor.h"
#include <libgnomecanvas/gnome-canvas.h>
#include <libebook/e-contact.h>
@@ -75,8 +74,6 @@ struct _EMinicard
GdkPixbuf *list_icon_pixbuf;
double list_icon_size;
- EABEditor *editor;
-
GList *fields; /* Of type EMinicardField */
guint needs_remodeling : 1;
@@ -105,6 +102,7 @@ struct _EMinicardClass
gint (* selected) (EMinicard *minicard, GdkEvent *event);
gint (* drag_begin) (EMinicard *minicard, GdkEvent *event);
+ void (* open_contact) (EMinicard *minicard, EContact *contact);
void (* style_set) (EMinicard *minicard, GtkStyle *previous_style);
};
@@ -125,7 +123,7 @@ int e_minicard_compare (EMinicard *minicard1,
int e_minicard_selected (EMinicard *minicard,
GdkEvent *event);
-gboolean e_minicard_activate_editor (EMinicard *minicard);
+void e_minicard_activate_editor (EMinicard *minicard);
#ifdef __cplusplus
}
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index 96050b2ca4..fe87f3c72a 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -25,27 +25,46 @@
#endif
#include "eab-contact-display.h"
-#include "eab-popup.h"
#include "eab-gui-util.h"
#include "e-util/e-util.h"
#include "e-util/e-html-utils.h"
#include "e-util/e-icon-factory.h"
+#include "e-util/e-plugin-ui.h"
#include <string.h>
#include <glib/gi18n.h>
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-stream.h>
-#define HANDLE_MAILTO_INTERNALLY 1
+#define EAB_CONTACT_DISPLAY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplayPrivate))
-#define PARENT_TYPE (GTK_TYPE_HTML)
+#define HANDLE_MAILTO_INTERNALLY 1
struct _EABContactDisplayPrivate {
EContact *contact;
+ EABContactDisplayMode mode;
+ GtkUIManager *ui_manager;
+ GtkActionGroup *email_actions;
+ GtkActionGroup *uri_actions;
GtkWidget *invisible;
- char *selection_uri;
+
+ gchar *selected_uri;
+ gchar *clipboard_uri;
+};
+
+enum {
+ PROP_0,
+ PROP_CONTACT,
+ PROP_MODE
+};
+
+enum {
+ SEND_MESSAGE,
+ LAST_SIGNAL
};
static struct {
@@ -77,151 +96,154 @@ common_location [] =
#define MAX_COMPACT_IMAGE_DIMENSION 48
-static void
-eab_uri_popup_link_open(EPopup *ep, EPopupItem *item, void *data)
-{
- EABPopupTargetURI *t = (EABPopupTargetURI *)ep->target;
-
- /* FIXME Pass a parent window. */
- e_show_uri (NULL, t->uri);
-}
+static const gchar *ui =
+"<ui>"
+" <popup>"
+" <menuitem action='open-link'/>"
+" <menuitem action='copy-link'/>"
+" <menuitem action='send-message'/>"
+" <menuitem action='copy-address'/>"
+" </popup>"
+"</ui>";
-static void
-eab_uri_popup_email_address_copy(EPopup *ep, EPopupItem *item, void *data)
-{
- EABContactDisplay *display = data;
- struct _EABContactDisplayPrivate *p = display->priv;
- EABPopupTargetURI *t = (EABPopupTargetURI *)ep->target;
- const char *url = t->uri;
- char *html=NULL;
- int i=0;
- GList *email_list, *l;
- int email_num = atoi (url + strlen ("internal-mailto:"));
-
- email_list = e_contact_get (p->contact, E_CONTACT_EMAIL);
- for (l = email_list; l; l=l->next) {
- if(i==email_num)
- html = e_text_to_html (l->data, 0);
- i++;
- }
-
- g_free(p->selection_uri);
- p->selection_uri = g_strdup(html);
- g_free (html);
-
- gtk_selection_owner_set(p->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
- gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time());
-}
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
static void
-eab_uri_popup_link_copy(EPopup *ep, EPopupItem *pitem, void *data)
+action_copy_address_cb (GtkAction *action,
+ EABContactDisplay *display)
{
- EABContactDisplay *display = data;
- struct _EABContactDisplayPrivate *p = display->priv;
-
- g_free(p->selection_uri);
- p->selection_uri = g_strdup(pitem->user_data);
-
- gtk_selection_owner_set(p->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
- gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time());
+ EContact *contact;
+ GList *list;
+ const gchar *uri;
+ gchar *html;
+ gint index;
+
+ uri = display->priv->selected_uri;
+ index = atoi (uri + strlen ("internal-mailto:"));
+ contact = eab_contact_display_get_contact (display);
+
+ list = e_contact_get (contact, E_CONTACT_EMAIL);
+ html = e_text_to_html (g_list_nth_data (list, index), 0);
+ g_list_foreach (list, (GFunc) g_free, NULL);
+ g_list_free (list);
+
+ display->priv->clipboard_uri = html;
+ display->priv->selected_uri = NULL;
+
+ gtk_selection_owner_set (
+ display->priv->invisible, GDK_SELECTION_PRIMARY,
+ gtk_get_current_event_time ());
+ gtk_selection_owner_set (
+ display->priv->invisible, GDK_SELECTION_CLIPBOARD,
+ gtk_get_current_event_time ());
}
static void
-eab_uri_popup_address_send(EPopup *ep, EPopupItem *item, void *data)
+action_copy_link_cb (GtkAction *action,
+ EABContactDisplay *display)
{
- EABPopupTargetURI *t = (EABPopupTargetURI *)ep->target;
- const char *url = t->uri;
- EABContactDisplay *display = data;
- struct _EABContactDisplayPrivate *p = display->priv;
-
- int mail_num = atoi (url + strlen ("internal-mailto:"));
-
- if (mail_num == -1)
- return;
-
- eab_send_contact (p->contact, mail_num, EAB_DISPOSITION_AS_TO);
-
+ display->priv->clipboard_uri = display->priv->selected_uri;
+ display->priv->selected_uri = NULL;
+
+ gtk_selection_owner_set (
+ display->priv->invisible, GDK_SELECTION_PRIMARY,
+ gtk_get_current_event_time ());
+ gtk_selection_owner_set (
+ display->priv->invisible, GDK_SELECTION_CLIPBOARD,
+ gtk_get_current_event_time ());
}
static void
-eab_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, EABContactDisplay *display)
+action_open_link_cb (GtkAction *action,
+ EABContactDisplay *display)
{
- struct _EABContactDisplayPrivate *p = display->priv;
-
- if (p->selection_uri == NULL)
- return;
-
- gtk_selection_data_set(data, data->target, 8, (guchar *)p->selection_uri, strlen(p->selection_uri));
+ /* XXX Pass a parent window. */
+ e_show_uri (NULL, display->priv->selected_uri);
}
static void
-eab_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EABContactDisplay *display)
+action_send_message_cb (GtkAction *action,
+ EABContactDisplay *display)
{
-#if 0
- struct _EABContactDisplayPrivate *p = display->priv;
-
- g_free(p->selection_uri);
- p->selection_uri = NULL;
-#endif
+ EDestination *destination;
+ EContact *contact;
+ const gchar *uri;
+ gint row;
+
+ uri = display->priv->selected_uri;
+ row = atoi (uri + strlen ("internal-mailto:"));
+ g_return_if_fail (row >= 0);
+
+ destination = e_destination_new ();
+ contact = eab_contact_display_get_contact (display);
+ e_destination_set_contact (destination, contact, row);
+ g_signal_emit (display, signals[SEND_MESSAGE], 0, destination);
+ g_object_unref (destination);
}
-static EPopupItem eab_uri_popups[] = {
- { E_POPUP_ITEM, (gchar *) "05.open", (gchar *) N_("_Open Link in Browser"), eab_uri_popup_link_open, NULL, NULL, EAB_POPUP_URI_NOT_MAILTO },
- { E_POPUP_ITEM, (gchar *) "10.copy", (gchar *) N_("_Copy Link Location"), eab_uri_popup_link_copy, NULL, (gchar *) "edit-copy", EAB_POPUP_URI_NOT_MAILTO },
- { E_POPUP_ITEM, (gchar *) "15.send", (gchar *) N_("_Send New Message To..."), eab_uri_popup_address_send, NULL, (gchar *) "mail-message-new", EAB_POPUP_URI_MAILTO},
- { E_POPUP_ITEM, (gchar *) "20.copy", (gchar *) N_("Copy _Email Address"), eab_uri_popup_email_address_copy, NULL, (gchar *) "edit-copy", EAB_POPUP_URI_MAILTO},
- };
+static GtkActionEntry email_entries[] = {
+
+ { "copy-address",
+ NULL,
+ N_("Copy _Email Address"),
+ NULL,
+ NULL,
+ G_CALLBACK (action_copy_address_cb) },
+
+ { "send-message",
+ NULL,
+ N_("_Send New Message To..."),
+ NULL,
+ NULL,
+ G_CALLBACK (action_send_message_cb) }
+};
+static GtkActionEntry uri_entries[] = {
+
+ { "copy-link",
+ NULL,
+ N_("_Copy Link Location"),
+ NULL,
+ NULL,
+ G_CALLBACK (action_copy_link_cb) },
+
+ { "open-link",
+ NULL,
+ N_("_Open Link in Browser"),
+ NULL,
+ NULL,
+ G_CALLBACK (action_open_link_cb) }
+};
static void
-eab_uri_popup_free(EPopup *ep, GSList *list, void *data)
+contact_display_selection_get (EABContactDisplay *display,
+ GtkSelectionData *data,
+ guint info,
+ guint time_stamp)
{
- while (list){
- GSList *n = list->next;
- struct _EPopupItem *item = list->data;
-
- g_free(item->user_data);
- item->user_data = NULL;
- g_slist_free_1(list);
+ if (display->priv->clipboard_uri == NULL)
+ return;
- list = n;
- }
+ gtk_selection_data_set (
+ data, data->target, 8,
+ (guchar *) display->priv->clipboard_uri,
+ strlen (display->priv->clipboard_uri));
}
-static int
-eab_uri_popup_event(EABContactDisplay *display, GdkEvent *event, const char *uri)
+static void
+contact_display_selection_clear_event (EABContactDisplay *display,
+ GdkEventSelection *event)
{
- EABPopup *emp;
- EABPopupTargetURI *t ;
- GtkMenu *menu;
- GSList *menus = NULL;
- int i;
-
- emp = eab_popup_new("org.gnome.evolution.addressbook.contactdisplay.popup");
-
- t = eab_popup_target_new_uri(emp, uri);
- t->target.widget = (GtkWidget *)display;
-
- for (i=0;i<sizeof(eab_uri_popups)/sizeof(eab_uri_popups[0]);i++) {
- eab_uri_popups[i].user_data = g_strdup(t->uri);
- menus = g_slist_prepend(menus, &eab_uri_popups[i]);
- }
- e_popup_add_items((EPopup *)emp, menus, NULL, eab_uri_popup_free, display);
-
- menu = e_popup_create_menu_once((EPopup *)emp,(EPopupTarget*)t, 0);
-
- if (event == NULL) {
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
- } else {
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button.button, event->button.time);
- }
-
- return TRUE;
+ g_free (display->priv->clipboard_uri);
+ display->priv->clipboard_uri = NULL;
}
static void
-on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
- EABContactDisplay *display)
+contact_display_on_url_requested (GtkHTML *html,
+ const gchar *url,
+ GtkHTMLStream *handle,
+ EABContactDisplay *display)
{
if (!strcmp (url, "internal-contact-photo:")) {
EContactPhoto *photo;
@@ -254,16 +276,25 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
}
static void
-on_link_clicked (GtkHTML *html, const char *uri, EABContactDisplay *display)
+contact_display_on_link_clicked (GtkHTML *html,
+ const gchar *uri,
+ EABContactDisplay *display)
{
#ifdef HANDLE_MAILTO_INTERNALLY
if (!strncmp (uri, "internal-mailto:", strlen ("internal-mailto:"))) {
- int mail_num = atoi (uri + strlen ("internal-mailto:"));
+ EDestination *destination;
+ EContact *contact;
+ gint email_num;
- if (mail_num == -1)
+ email_num = atoi (uri + strlen ("internal-mailto:"));
+ if (email_num == -1)
return;
- eab_send_contact (display->priv->contact, mail_num, EAB_DISPOSITION_AS_TO);
+ destination = e_destination_new ();
+ contact = eab_contact_display_get_contact (display);
+ e_destination_set_contact (destination, contact, email_num);
+ g_signal_emit (display, signals[SEND_MESSAGE], 0, destination);
+ g_object_unref (destination);
return;
}
@@ -273,44 +304,6 @@ on_link_clicked (GtkHTML *html, const char *uri, EABContactDisplay *display)
e_show_uri (NULL, uri);
}
-#if 0
-static void
-render_address (GtkHTMLStream *html_stream, EContact *contact, const char *html_label, EContactField adr_field, EContactField label_field)
-{
- EContactAddress *adr;
- const char *label;
-
- label = e_contact_get_const (contact, label_field);
- if (label) {
- char *html = e_text_to_html (label, E_TEXT_TO_HTML_CONVERT_NL);
-
- gtk_html_stream_printf (html_stream, "<tr><td valign=\"top\" width=\"" IMAGE_COL_WIDTH "\"></td><td valign=\"top\" width=\"100\"><font color=" HEADER_COLOR ">%s:</font><br><a href=\"http://www.mapquest.com/\">%s</a></td><td valign=\"top\">%s</td></tr>", html_label, _("(map)"), html);
-
-This shoul g_free (html);
- return;
- }
-
- adr = e_contact_get (contact, adr_field);
- if (adr &&
- (adr->po || adr->ext || adr->street || adr->locality || adr->region || adr->code || adr->country)) {
-
- gtk_html_stream_printf (html_stream, "<tr><td valign=\"top\" width=\"" IMAGE_COL_WIDTH "\"></td><td valign=\"top\" width=\"100\"><font color=" HEADER_COLOR ">%s:</font><br><a href=\"http://www.mapquest.com/\">%s</a></td><td valign=\"top\">", html_label, _("map"));
-
- if (adr->po && *adr->po) gtk_html_stream_printf (html_stream, "%s<br>", adr->po);
- if (adr->ext && *adr->ext) gtk_html_stream_printf (html_stream, "%s<br>", adr->ext);
- if (adr->street && *adr->street) gtk_html_stream_printf (html_stream, "%s<br>", adr->street);
- if (adr->locality && *adr->locality) gtk_html_stream_printf (html_stream, "%s<br>", adr->locality);
- if (adr->region && *adr->region) gtk_html_stream_printf (html_stream, "%s<br>", adr->region);
- if (adr->code && *adr->code) gtk_html_stream_printf (html_stream, "%s<br>", adr->code);
- if (adr->country && *adr->country) gtk_html_stream_printf (html_stream, "%s<br>", adr->country);
-
- gtk_html_stream_printf (html_stream, "</td></tr>");
- }
- if (adr)
- e_contact_address_free (adr);
-}
-#endif
-
static void
render_name_value (GtkHTMLStream *html_stream, const char *label, const char *str, const char *icon, unsigned int html_flags)
{
@@ -670,12 +663,6 @@ eab_contact_display_render_normal (EABContactDisplay *display, EContact *contact
GtkHTMLStream *html_stream;
gboolean is_rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL);
- if (display->priv->contact)
- g_object_unref (display->priv->contact);
- display->priv->contact = contact;
- if (display->priv->contact)
- g_object_ref (display->priv->contact);
-
html_stream = gtk_html_begin (GTK_HTML (display));
gtk_html_stream_write (html_stream, HTML_HEADER, sizeof (HTML_HEADER) - 1);
gtk_html_stream_printf (html_stream, "<body><table width=\"100%%\"><tr><td %s>\n", is_rtl ? " align=\"right\" " : "");
@@ -726,16 +713,11 @@ eab_contact_display_render_normal (EABContactDisplay *display, EContact *contact
}
static void
-eab_contact_display_render_compact (EABContactDisplay *display, EContact *contact)
+eab_contact_display_render_compact (EABContactDisplay *display,
+ EContact *contact)
{
GtkHTMLStream *html_stream;
- if (display->priv->contact)
- g_object_unref (display->priv->contact);
- display->priv->contact = contact;
- if (display->priv->contact)
- g_object_ref (display->priv->contact);
-
html_stream = gtk_html_begin (GTK_HTML (display));
gtk_html_stream_write (html_stream, HTML_HEADER, sizeof (HTML_HEADER) - 1);
gtk_html_stream_write (html_stream, "<body>\n", 7);
@@ -909,98 +891,266 @@ eab_contact_display_render_compact (EABContactDisplay *display, EContact *contac
gtk_html_end (GTK_HTML (display), html_stream, GTK_HTML_STREAM_OK);
}
-void
-eab_contact_display_render (EABContactDisplay *display, EContact *contact,
- EABContactDisplayRenderMode mode)
+static int
+contact_display_button_press_event (GtkWidget *widget,
+ GdkEvent *event,
+ EABContactDisplay *display)
{
- switch (mode) {
- case EAB_CONTACT_DISPLAY_RENDER_NORMAL:
- eab_contact_display_render_normal (display, contact);
- break;
- case EAB_CONTACT_DISPLAY_RENDER_COMPACT:
- eab_contact_display_render_compact (display, contact);
- break;
+ GtkUIManager *ui_manager;
+ GtkActionGroup *action_group;
+ GtkWidget *menu;
+ gboolean has_email;
+ gchar *uri;
+
+ if (event->button.button != 3)
+ return FALSE;
+
+ uri = gtk_html_get_url_at (
+ GTK_HTML (widget),
+ event->button.x, event->button.y);
+
+ if (uri == NULL)
+ return FALSE;
+
+ g_free (display->priv->selected_uri);
+ display->priv->selected_uri = uri;
+
+ ui_manager = display->priv->ui_manager;
+ menu = gtk_ui_manager_get_widget (ui_manager, "/popup");
+ g_return_val_if_fail (GTK_IS_MENU (menu), FALSE);
+
+ has_email = (g_ascii_strncasecmp (uri, "internal-mailto:", 16) == 0);
+
+ /* Show the appropriate actions. */
+ action_group = display->priv->email_actions;
+ gtk_action_group_set_visible (action_group, has_email);
+ action_group = display->priv->uri_actions;
+ gtk_action_group_set_visible (action_group, !has_email);
+
+ if (event != NULL)
+ gtk_menu_popup (
+ GTK_MENU (menu), NULL, NULL, NULL, NULL,
+ event->button.button, event->button.time);
+ else
+ gtk_menu_popup (
+ GTK_MENU (menu), NULL, NULL, NULL, NULL,
+ 0, gtk_get_current_event_time ());
+
+ return TRUE;
+}
+
+static void
+contact_display_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CONTACT:
+ eab_contact_display_set_contact (
+ EAB_CONTACT_DISPLAY (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_MODE:
+ eab_contact_display_set_mode (
+ EAB_CONTACT_DISPLAY (object),
+ g_value_get_int (value));
+ return;
}
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
-static int
-eab_html_press_event (GtkWidget *widget, GdkEvent *event,EABContactDisplay *display)
+static void
+contact_display_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- char *uri;
- gboolean res = FALSE;
+ switch (property_id) {
+ case PROP_CONTACT:
+ g_value_set_object (
+ value, eab_contact_display_get_contact (
+ EAB_CONTACT_DISPLAY (object)));
+ return;
+ case PROP_MODE:
+ g_value_set_int (
+ value, eab_contact_display_get_mode (
+ EAB_CONTACT_DISPLAY (object)));
+ return;
+ }
- if (event->button.button!= 3 )
- return FALSE;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+contact_display_dispose (GObject *object)
+{
+ EABContactDisplayPrivate *priv;
+
+ priv = EAB_CONTACT_DISPLAY_GET_PRIVATE (object);
+
+ if (priv->contact != NULL) {
+ g_object_unref (priv->contact);
+ priv->contact = NULL;
+ }
+
+ if (priv->ui_manager != NULL) {
+ g_object_unref (priv->ui_manager);
+ priv->ui_manager = NULL;
+ }
+
+ if (priv->email_actions != NULL) {
+ g_object_unref (priv->email_actions);
+ priv->email_actions = NULL;
+ }
- uri = gtk_html_get_url_at (GTK_HTML (widget), event->button.x, event->button.y);
- if (uri){
- eab_uri_popup_event(display,event,uri);
- }
+ if (priv->uri_actions != NULL) {
+ g_object_unref (priv->uri_actions);
+ priv->uri_actions = NULL;
+ }
- g_free(uri);
+ if (priv->invisible != NULL) {
+ g_object_unref (priv->invisible);
+ priv->invisible = NULL;
+ }
- return res;
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
-GtkWidget*
-eab_contact_display_new (void)
+static void
+contact_display_finalize (GObject *object)
{
- EABContactDisplay *display;
-
- struct _EABContactDisplayPrivate *p;
-
- display = g_object_new (EAB_TYPE_CONTACT_DISPLAY, NULL);
- p=display->priv = g_new0 (EABContactDisplayPrivate, 1);
-
- gtk_html_set_default_content_type (GTK_HTML (display), "text/html; charset=utf-8");
-
- gtk_html_set_editable (GTK_HTML (display), FALSE);
-
- g_signal_connect (display, "url_requested",
- G_CALLBACK (on_url_requested),
- display);
- g_signal_connect (display, "link_clicked",
- G_CALLBACK (on_link_clicked),
- display);
- g_signal_connect(display, "button_press_event",
- G_CALLBACK(eab_html_press_event),
- display);
- p->invisible = gtk_invisible_new();
- g_signal_connect(p->invisible, "selection_get", G_CALLBACK(eab_selection_get), display);
- g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(eab_selection_clear_event), display);
- gtk_selection_add_target(p->invisible, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0);
- gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1);
-
-#if 0
- g_signal_connect (display, "object_requested",
- G_CALLBACK (on_object_requested),
- mail_display);
- g_signal_connect (display, "button_press_event",
- G_CALLBACK (html_button_press_event), mail_display);
- g_signal_connect (display, "motion_notify_event",
- G_CALLBACK (html_motion_notify_event), mail_display);
- g_signal_connect (display, "enter_notify_event",
- G_CALLBACK (html_enter_notify_event), mail_display);
- g_signal_connect (display, "iframe_created",
- G_CALLBACK (html_iframe_created), mail_display);
- g_signal_connect (display, "on_url",
- G_CALLBACK (html_on_url), mail_display);
-#endif
+ EABContactDisplayPrivate *priv;
- return GTK_WIDGET (display);
+ priv = EAB_CONTACT_DISPLAY_GET_PRIVATE (object);
+
+ g_free (priv->selected_uri);
+ g_free (priv->clipboard_uri);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-eab_contact_display_init (GObject *object)
+eab_contact_display_class_init (EABContactDisplayClass *class)
{
- gtk_html_construct ((GtkHTML *)object);
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EABContactDisplayPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = contact_display_set_property;
+ object_class->get_property = contact_display_get_property;
+ object_class->dispose = contact_display_dispose;
+ object_class->finalize = contact_display_finalize;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CONTACT,
+ g_param_spec_object (
+ "contact",
+ NULL,
+ NULL,
+ E_TYPE_CONTACT,
+ G_PARAM_READWRITE));
+
+ /* XXX Make this a real enum property. */
+ g_object_class_install_property (
+ object_class,
+ PROP_MODE,
+ g_param_spec_int (
+ "mode",
+ NULL,
+ NULL,
+ EAB_CONTACT_DISPLAY_RENDER_NORMAL,
+ EAB_CONTACT_DISPLAY_RENDER_COMPACT,
+ EAB_CONTACT_DISPLAY_RENDER_NORMAL,
+ G_PARAM_READWRITE));
+
+ signals[SEND_MESSAGE] = g_signal_new (
+ "send-message",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EABContactDisplayClass, send_message),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_DESTINATION);
}
static void
-eab_contact_display_class_init (GtkObjectClass *object_class)
+eab_contact_display_init (EABContactDisplay *display)
{
- /* object_class->destroy = mail_display_destroy;*/
+ GtkActionGroup *action_group;
+ GtkHTML *html;
+ const gchar *id;
+
+ display->priv = EAB_CONTACT_DISPLAY_GET_PRIVATE (display);
+ display->priv->mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL;
+ display->priv->ui_manager = gtk_ui_manager_new ();
+ display->priv->invisible = gtk_invisible_new ();
+
+ g_object_ref_sink (display->priv->invisible);
+
+ action_group = gtk_action_group_new ("email");
+ gtk_action_group_set_translation_domain (
+ action_group, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions (
+ action_group, email_entries,
+ G_N_ELEMENTS (email_entries), display);
+ gtk_ui_manager_insert_action_group (
+ display->priv->ui_manager, action_group, 0);
+ display->priv->email_actions = action_group;
+
+ action_group = gtk_action_group_new ("uri");
+ gtk_action_group_set_translation_domain (
+ action_group, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions (
+ action_group, uri_entries,
+ G_N_ELEMENTS (uri_entries), display);
+ gtk_ui_manager_insert_action_group (
+ display->priv->ui_manager, action_group, 0);
+ display->priv->uri_actions = action_group;
+
+ gtk_ui_manager_add_ui_from_string (
+ display->priv->ui_manager, ui, -1, NULL);
+
+ html = GTK_HTML (display);
+ gtk_html_construct (html);
+ gtk_html_set_editable (html, FALSE);
+ gtk_html_set_default_content_type (html, "text/html; charset=utf-8");
+
+ g_signal_connect (
+ display, "url-requested",
+ G_CALLBACK (contact_display_on_url_requested), display);
+ g_signal_connect (
+ display, "link-clicked",
+ G_CALLBACK (contact_display_on_link_clicked), display);
+ g_signal_connect (
+ display, "button-press-event",
+ G_CALLBACK (contact_display_button_press_event), display);
+
+ g_signal_connect_swapped (
+ display->priv->invisible, "selection-get",
+ G_CALLBACK (contact_display_selection_get), display);
+ g_signal_connect_swapped (
+ display->priv->invisible, "selection-clear-event",
+ G_CALLBACK (contact_display_selection_clear_event), display);
+ gtk_selection_add_target (
+ display->priv->invisible,
+ GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0);
+ gtk_selection_add_target (
+ display->priv->invisible,
+ GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1);
+
+ id = "org.gnome.evolution.contact-display";
+ e_plugin_ui_register_manager (display->priv->ui_manager, id, display);
+ e_plugin_ui_enable_manager (display->priv->ui_manager, id);
}
GType
@@ -1008,21 +1158,98 @@ eab_contact_display_get_type (void)
{
static GType type = 0;
- if (!type) {
- static const GTypeInfo info = {
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
sizeof (EABContactDisplayClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
(GClassInitFunc) eab_contact_display_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
sizeof (EABContactDisplay),
- 0, /* n_preallocs */
+ 0, /* n_preallocs */
(GInstanceInitFunc) eab_contact_display_init,
+ NULL /* value_table */
};
- type = g_type_register_static (PARENT_TYPE, "EABContactDisplay", &info, 0);
+ type = g_type_register_static (
+ GTK_TYPE_HTML, "EABContactDisplay", &type_info, 0);
}
return type;
}
+
+GtkWidget *
+eab_contact_display_new (void)
+{
+ return g_object_new (EAB_TYPE_CONTACT_DISPLAY, NULL);
+}
+
+EContact *
+eab_contact_display_get_contact (EABContactDisplay *display)
+{
+ g_return_val_if_fail (EAB_IS_CONTACT_DISPLAY (display), NULL);
+
+ return display->priv->contact;
+}
+
+void
+eab_contact_display_set_contact (EABContactDisplay *display,
+ EContact *contact)
+{
+ EABContactDisplayMode mode;
+
+ g_return_if_fail (EAB_IS_CONTACT_DISPLAY (display));
+
+ mode = eab_contact_display_get_mode (display);
+
+ if (contact != NULL)
+ g_object_ref (contact);
+ if (display->priv->contact != NULL)
+ g_object_unref (display->priv->contact);
+ display->priv->contact = contact;
+
+ switch (mode) {
+ case EAB_CONTACT_DISPLAY_RENDER_NORMAL:
+ eab_contact_display_render_normal (display, contact);
+ break;
+
+ case EAB_CONTACT_DISPLAY_RENDER_COMPACT:
+ eab_contact_display_render_compact (display, contact);
+ break;
+ }
+
+ g_object_notify (G_OBJECT (display), "contact");
+}
+
+EABContactDisplayMode
+eab_contact_display_get_mode (EABContactDisplay *display)
+{
+ g_return_val_if_fail (EAB_IS_CONTACT_DISPLAY (display), 0);
+
+ return display->priv->mode;
+}
+
+void
+eab_contact_display_set_mode (EABContactDisplay *display,
+ EABContactDisplayMode mode)
+{
+ EContact *contact;
+
+ g_return_if_fail (EAB_IS_CONTACT_DISPLAY (display));
+
+ display->priv->mode = mode;
+ contact = eab_contact_display_get_contact (display);
+
+ switch (mode) {
+ case EAB_CONTACT_DISPLAY_RENDER_NORMAL:
+ eab_contact_display_render_normal (display, contact);
+ break;
+
+ case EAB_CONTACT_DISPLAY_RENDER_COMPACT:
+ eab_contact_display_render_compact (display, contact);
+ break;
+ }
+
+ g_object_notify (G_OBJECT (display), "mode");
+}
diff --git a/addressbook/gui/widgets/eab-contact-display.h b/addressbook/gui/widgets/eab-contact-display.h
index 80acc5eefe..a671b378fc 100644
--- a/addressbook/gui/widgets/eab-contact-display.h
+++ b/addressbook/gui/widgets/eab-contact-display.h
@@ -20,41 +20,68 @@
*
*/
-#ifndef _EAB_CONTACT_DISPLAY_H_
-#define _EAB_CONTACT_DISPLAY_H_
+#ifndef EAB_CONTACT_DISPLAY_H
+#define EAB_CONTACT_DISPLAY_H
#include <gtkhtml/gtkhtml.h>
#include <libebook/e-contact.h>
+#include <libebook/e-destination.h>
-#define EAB_TYPE_CONTACT_DISPLAY (eab_contact_display_get_type ())
-#define EAB_CONTACT_DISPLAY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplay))
-#define EAB_CONTACT_DISPLAY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplayClass))
-#define IS_EAB_CONTACT_DISPLAY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EAB_TYPE_CONTACT_DISPLAY))
-#define IS_EAB_CONTACT_DISPLAY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EAB_TYPE_CONTACT_DISPLAY))
+/* Standard GObject macros */
+#define EAB_TYPE_CONTACT_DISPLAY \
+ (eab_contact_display_get_type ())
+#define EAB_CONTACT_DISPLAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplay))
+#define EAB_CONTACT_DISPLAY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplayClass))
+#define EAB_IS_CONTACT_DISPLAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EAB_TYPE_CONTACT_DISPLAY))
+#define EAB_IS_CONTACT_DISPLAY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EAB_TYPE_CONTACT_DISPLAY))
+#define EAB_CONTACT_DISPLAY_GET_CLASS(obj) \
+ (G_TYPE_ISNTANCE_GET_CLASS \
+ ((obj), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplayClass))
+
+G_BEGIN_DECLS
typedef struct _EABContactDisplay EABContactDisplay;
-typedef struct _EABContactDisplayPrivate EABContactDisplayPrivate;
typedef struct _EABContactDisplayClass EABContactDisplayClass;
+typedef struct _EABContactDisplayPrivate EABContactDisplayPrivate;
typedef enum {
EAB_CONTACT_DISPLAY_RENDER_NORMAL, /* for use in the preview pane */
EAB_CONTACT_DISPLAY_RENDER_COMPACT /* for use with embedded vcards (e.g, the EABVCardControl) */
-} EABContactDisplayRenderMode;
+} EABContactDisplayMode;
struct _EABContactDisplay {
GtkHTML parent;
-
EABContactDisplayPrivate *priv;
};
struct _EABContactDisplayClass {
GtkHTMLClass parent_class;
+
+ /* Signals */
+ void (*send_message) (EABContactDisplay *display,
+ EDestination *destination);
};
-GType eab_contact_display_get_type (void);
-GtkWidget * eab_contact_display_new (void);
+GType eab_contact_display_get_type (void);
+GtkWidget * eab_contact_display_new (void);
+
+EContact * eab_contact_display_get_contact (EABContactDisplay *display);
+void eab_contact_display_set_contact (EABContactDisplay *display,
+ EContact *contact);
+EABContactDisplayMode
+ eab_contact_display_get_mode (EABContactDisplay *display);
+void eab_contact_display_set_mode (EABContactDisplay *display,
+ EABContactDisplayMode mode);
+
-void eab_contact_display_render (EABContactDisplay *display, EContact *contact,
- EABContactDisplayRenderMode render_mode);
+G_END_DECLS
-#endif /* _EAB_CONTACT_DISPLAY_H_ */
+#endif /* EAB_CONTACT_DISPLAY_H */
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
index 58895c736c..d5ec322c3d 100644
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ b/addressbook/gui/widgets/eab-gui-util.c
@@ -40,17 +40,11 @@
#include "misc/e-image-chooser.h"
#include <e-util/e-icon-factory.h>
#include "eab-contact-merging.h"
-#include <composer/e-msg-composer.h>
-#include <mail/em-composer-utils.h>
/* we link to camel for decoding quoted printable email addresses */
#include <camel/camel-mime-utils.h>
-#include "addressbook/gui/contact-editor/eab-editor.h"
-#include "addressbook/gui/contact-editor/e-contact-editor.h"
-#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
-#include "addressbook/gui/component/addressbook-component.h"
-#include "addressbook/gui/component/addressbook.h"
+#include "addressbook/util/addressbook.h"
/* the NULL's in this table correspond to the status codes
that should *never* be generated by a backend */
@@ -201,140 +195,6 @@ eab_prompt_save_dialog (GtkWindow *parent)
return e_error_run (parent, "addressbook:prompt-save", NULL);
}
-static void
-added_cb (EBook* book, EBookStatus status, EContact *contact,
- gpointer data)
-{
- gboolean is_list = GPOINTER_TO_INT (data);
-
- if (status != E_BOOK_ERROR_OK && status != E_BOOK_ERROR_CANCELLED) {
- eab_error_dialog (is_list ? _("Error adding list") : _("Error adding contact"), status);
- }
-}
-
-static void
-modified_cb (EBook* book, EBookStatus status, EContact *contact,
- gpointer data)
-{
- gboolean is_list = GPOINTER_TO_INT (data);
-
- if (status != E_BOOK_ERROR_OK && status != E_BOOK_ERROR_CANCELLED) {
- eab_error_dialog (is_list ? _("Error modifying list") : _("Error modifying contact"),
- status);
- }
-}
-
-static void
-deleted_cb (EBook* book, EBookStatus status, EContact *contact,
- gpointer data)
-{
- gboolean is_list = GPOINTER_TO_INT (data);
-
- if (status != E_BOOK_ERROR_OK) {
- eab_error_dialog (is_list ? _("Error removing list") : _("Error removing contact"),
- status);
- }
-}
-
-static void
-editor_closed_cb (GtkObject *editor, gpointer data)
-{
- g_object_unref (editor);
-}
-
-EContactEditor *
-eab_show_contact_editor (EBook *book, EContact *contact,
- gboolean is_new_contact,
- gboolean editable)
-{
- EContactEditor *ce;
-
- ce = e_contact_editor_new (book, contact, is_new_contact, editable);
-
- g_signal_connect (ce, "contact_added",
- G_CALLBACK (added_cb), GINT_TO_POINTER (FALSE));
- g_signal_connect (ce, "contact_modified",
- G_CALLBACK (modified_cb), GINT_TO_POINTER (FALSE));
- g_signal_connect (ce, "contact_deleted",
- G_CALLBACK (deleted_cb), GINT_TO_POINTER (FALSE));
- g_signal_connect (ce, "editor_closed",
- G_CALLBACK (editor_closed_cb), NULL);
-
- return ce;
-}
-
-EContactListEditor *
-eab_show_contact_list_editor (EBook *book, EContact *contact,
- gboolean is_new_contact,
- gboolean editable)
-{
- EContactListEditor *ce;
-
- ce = e_contact_list_editor_new (book, contact, is_new_contact, editable);
-
- g_signal_connect (ce, "contact_added",
- G_CALLBACK (added_cb), GINT_TO_POINTER (TRUE));
- g_signal_connect (ce, "contact_modified",
- G_CALLBACK (modified_cb), GINT_TO_POINTER (TRUE));
- g_signal_connect (ce, "contact_deleted",
- G_CALLBACK (deleted_cb), GINT_TO_POINTER (TRUE));
- g_signal_connect (ce, "editor_closed",
- G_CALLBACK (editor_closed_cb), GINT_TO_POINTER (TRUE));
-
- eab_editor_show (EAB_EDITOR (ce));
-
- return ce;
-}
-
-static void
-view_contacts (EBook *book, GList *list, gboolean editable)
-{
- for (; list; list = list->next) {
- EContact *contact = list->data;
- if (e_contact_get (contact, E_CONTACT_IS_LIST))
- eab_show_contact_list_editor (book, contact, FALSE, editable);
- else
- eab_show_contact_editor (book, contact, FALSE, editable);
- }
-}
-
-void
-eab_show_multiple_contacts (EBook *book,
- GList *list,
- gboolean editable)
-{
- if (list) {
- int length = g_list_length (list);
- if (length > 5) {
- GtkWidget *dialog;
- gint response;
-
- dialog = gtk_message_dialog_new (NULL,
- 0,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- ngettext("Opening %d contact will open %d new window as well.\n"
- "Do you really want to display this contact?",
- "Opening %d contacts will open %d new windows as well.\n"
- "Do you really want to display all of these contacts?",
- length),
- length,
- length);
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- _("_Don't Display"), GTK_RESPONSE_NO,
- _("Display _All Contacts"), GTK_RESPONSE_YES,
- NULL);
- response = gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- if (response == GTK_RESPONSE_YES)
- view_contacts (book, list, editable);
- } else {
- view_contacts (book, list, editable);
- }
- }
-}
-
-
static gint
file_exists(GtkWindow *window, const char *filename)
{
@@ -629,16 +489,6 @@ struct ContactCopyProcess_ {
ContactCopyDone done_cb;
};
-#if 0
-static void
-contact_deleted_cb (EBook* book, EBookStatus status, gpointer user_data)
-{
- if (status != E_BOOK_ERROR_OK) {
- eab_error_dialog (_("Error removing contact"), status);
- }
-}
-#endif
-
static void
do_delete (gpointer data, gpointer user_data)
{
@@ -783,234 +633,6 @@ eab_transfer_contacts (EBook *source, GList *contacts /* adopted */, gboolean de
addressbook_load (dest, got_book_cb, process);
}
-typedef struct {
- EContact *contact;
- int email_num; /* if the contact is a person (not a list), the email address to use */
-} ContactAndEmailNum;
-
-static void
-eab_send_to_contact_and_email_num_list (GList *contact_list)
-{
- EMsgComposer *composer;
- EComposerHeaderTable *table;
- GPtrArray *to_array;
- GPtrArray *bcc_array;
-
- union {
- gpointer *pdata;
- EDestination **destinations;
- } convert;
-
- if (contact_list == NULL)
- return;
-
- composer = e_msg_composer_new ();
- table = e_msg_composer_get_header_table (composer);
- em_composer_utils_setup_default_callbacks (composer);
-
- to_array = g_ptr_array_new ();
- bcc_array = g_ptr_array_new ();
-
- /* Sort contacts into "To" and "Bcc" destinations. */
- while (contact_list != NULL) {
- ContactAndEmailNum *ce = contact_list->data;
- EContact *contact = ce->contact;
- EDestination *destination;
-
- destination = e_destination_new ();
- e_destination_set_contact (destination, contact, 0);
-
- if (e_destination_is_evolution_list (destination)) {
- if (e_destination_list_show_addresses (destination))
- g_ptr_array_add (to_array, destination);
- else
- g_ptr_array_add (bcc_array, destination);
- } else
- g_ptr_array_add (to_array, destination);
-
- contact_list = g_list_next (contact_list);
- }
-
- /* Add sentinels to each array. */
- g_ptr_array_add (to_array, NULL);
- g_ptr_array_add (bcc_array, NULL);
-
- /* XXX Acrobatics like this make me question whether NULL-terminated
- * arrays are really the best argument type for passing a list of
- * destinations to the header table. */
-
- /* Set "To" destinations. */
- convert.pdata = to_array->pdata;
- e_composer_header_table_set_destinations_to (
- table, convert.destinations);
- g_ptr_array_free (to_array, FALSE);
- e_destination_freev (convert.destinations);
-
- /* Add "Bcc" destinations.
- * Add destinations instead of setting, so we don't remove
- * automatic BCC addresses that have already been added. */
- convert.pdata = bcc_array->pdata;
- e_composer_header_table_add_destinations_bcc (
- table, convert.destinations);
- g_ptr_array_free (bcc_array, FALSE);
- e_destination_freev (convert.destinations);
-
- gtk_widget_show (GTK_WIDGET (composer));
-}
-
-static const char *
-get_email (EContact *contact, EContactField field_id, gchar **to_free)
-{
- char *name = NULL, *mail = NULL;
- const char *value = e_contact_get_const (contact, field_id);
-
- *to_free = NULL;
-
- if (eab_parse_qp_email (value, &name, &mail)) {
- *to_free = g_strdup_printf ("%s <%s>", name, mail);
- value = *to_free;
- }
-
- g_free (name);
- g_free (mail);
-
- return value;
-}
-
-static void
-eab_send_contact_list_as_attachment (GList *contacts)
-{
- EMsgComposer *composer;
- EComposerHeaderTable *table;
- CamelMimePart *attachment;
- gchar *data;
-
- if (contacts == NULL)
- return;
-
- composer = e_msg_composer_new ();
- table = e_msg_composer_get_header_table (composer);
- em_composer_utils_setup_default_callbacks (composer);
-
- attachment = camel_mime_part_new ();
- data = eab_contact_list_to_string (contacts);
-
- camel_mime_part_set_content (
- attachment, data, strlen (data), "text/x-vcard");
-
- if (contacts->next != NULL)
- camel_mime_part_set_description (
- attachment, _("Multiple vCards"));
- else {
- EContact *contact = contacts->data;
- const gchar *file_as;
- gchar *description;
-
- file_as = e_contact_get_const (contact, E_CONTACT_FILE_AS);
- description = g_strdup_printf (_("vCard for %s"), file_as);
- camel_mime_part_set_description (attachment, description);
- g_free (description);
- }
-
- camel_mime_part_set_disposition (attachment, "attachment");
-
- e_msg_composer_attach (composer, attachment);
- camel_object_unref (attachment);
-
- if (contacts->next != NULL)
- e_composer_header_table_set_subject (
- table, _("Contact information"));
- else {
- EContact *contact = contacts->data;
- gchar *tempstr;
- const gchar *tempstr2;
- gchar *tempfree = NULL;
-
- tempstr2 = e_contact_get_const (contact, E_CONTACT_FILE_AS);
- if (!tempstr2 || !*tempstr2)
- tempstr2 = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
- if (!tempstr2 || !*tempstr2)
- tempstr2 = e_contact_get_const (contact, E_CONTACT_ORG);
- if (!tempstr2 || !*tempstr2) {
- g_free (tempfree);
- tempstr2 = get_email (contact, E_CONTACT_EMAIL_1, &tempfree);
- }
- if (!tempstr2 || !*tempstr2) {
- g_free (tempfree);
- tempstr2 = get_email (contact, E_CONTACT_EMAIL_2, &tempfree);
- }
- if (!tempstr2 || !*tempstr2) {
- g_free (tempfree);
- tempstr2 = get_email (contact, E_CONTACT_EMAIL_3, &tempfree);
- }
-
- if (!tempstr2 || !*tempstr2)
- tempstr = g_strdup_printf (_("Contact information"));
- else
- tempstr = g_strdup_printf (_("Contact information for %s"), tempstr2);
-
- e_composer_header_table_set_subject (table, tempstr);
-
- g_free (tempstr);
- g_free (tempfree);
- }
-
- gtk_widget_show (GTK_WIDGET (composer));
-}
-
-void
-eab_send_contact_list (GList *contacts, EABDisposition disposition)
-{
- switch (disposition) {
- case EAB_DISPOSITION_AS_TO: {
- GList *list = NULL, *l;
-
- for (l = contacts; l; l = l->next) {
- ContactAndEmailNum *ce = g_new (ContactAndEmailNum, 1);
- ce->contact = l->data;
- ce->email_num = 0; /* hardcode this */
-
- list = g_list_append (list, ce);
- }
-
- eab_send_to_contact_and_email_num_list (list);
-
- g_list_foreach (list, (GFunc)g_free, NULL);
- g_list_free (list);
- break;
- }
- case EAB_DISPOSITION_AS_ATTACHMENT:
- eab_send_contact_list_as_attachment (contacts);
- break;
- }
-}
-
-void
-eab_send_contact (EContact *contact, int email_num, EABDisposition disposition)
-{
- GList *list = NULL;
-
- switch (disposition) {
- case EAB_DISPOSITION_AS_TO: {
- ContactAndEmailNum ce;
-
- ce.contact = contact;
- ce.email_num = email_num;
-
- list = g_list_prepend (NULL, &ce);
- eab_send_to_contact_and_email_num_list (list);
- break;
- }
- case EAB_DISPOSITION_AS_ATTACHMENT: {
- list = g_list_prepend (NULL, contact);
- eab_send_contact_list_as_attachment (list);
- break;
- }
- }
-
- g_list_free (list);
-}
-
GtkWidget *
eab_create_image_chooser_widget(gchar *name,
gchar *string1, gchar *string2,
diff --git a/addressbook/gui/widgets/eab-gui-util.h b/addressbook/gui/widgets/eab-gui-util.h
index b5129d1637..82fc172321 100644
--- a/addressbook/gui/widgets/eab-gui-util.h
+++ b/addressbook/gui/widgets/eab-gui-util.h
@@ -26,8 +26,6 @@
#include <gtk/gtk.h>
#include <libebook/e-book.h>
-#include "addressbook/gui/contact-editor/e-contact-editor.h"
-#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
G_BEGIN_DECLS
@@ -40,17 +38,6 @@ void eab_search_result_dialog (GtkWidget *parent,
EBookViewStatus status);
gint eab_prompt_save_dialog (GtkWindow *parent);
-EContactEditor *eab_show_contact_editor (EBook *book,
- EContact *contact,
- gboolean is_new_contact,
- gboolean editable);
-EContactListEditor *eab_show_contact_list_editor (EBook *book,
- EContact *contact,
- gboolean is_new_contact,
- gboolean editable);
-void eab_show_multiple_contacts (EBook *book,
- GList *list,
- gboolean editable);
void eab_transfer_contacts (EBook *source,
GList *contacts, /* adopted */
gboolean delete_from_source,
@@ -64,17 +51,6 @@ void eab_contact_list_save (char *title,
GList *list,
GtkWindow *parent_window);
-typedef enum {
- EAB_DISPOSITION_AS_ATTACHMENT,
- EAB_DISPOSITION_AS_TO
-} EABDisposition;
-
-void eab_send_contact (EContact *contact,
- int email_num,
- EABDisposition disposition);
-void eab_send_contact_list (GList *contacts,
- EABDisposition disposition);
-
GtkWidget *eab_create_image_chooser_widget (gchar *name, gchar *string1, gchar *string2, gint int1, gint int2);
@@ -82,8 +58,10 @@ ESource *eab_select_source (const gchar *title, const gch
const gchar *select_uid, GtkWindow *parent);
/* To parse quoted printable address & return email & name fields */
-gboolean eab_parse_qp_email (const gchar *string, gchar **name, gchar **email);
-char *eab_parse_qp_email_to_html (const gchar *string);
+gboolean eab_parse_qp_email (const gchar *string,
+ gchar **name,
+ gchar **email);
+gchar * eab_parse_qp_email_to_html (const gchar *string);
G_END_DECLS
diff --git a/addressbook/gui/widgets/eab-menu.c b/addressbook/gui/widgets/eab-menu.c
deleted file mode 100644
index e07489b003..0000000000
--- a/addressbook/gui/widgets/eab-menu.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <glib.h>
-
-#include <libebook/e-contact.h>
-
-#include "eab-menu.h"
-
-static void eabm_standard_menu_factory(EMenu *emp, void *data);
-
-static GObjectClass *eabm_parent;
-
-static void
-eabm_init(GObject *o)
-{
- /*EABMenu *emp = (EABMenu *)o; */
-}
-
-static void
-eabm_finalise(GObject *o)
-{
- ((GObjectClass *)eabm_parent)->finalize(o);
-}
-
-static void
-eabm_target_free(EMenu *ep, EMenuTarget *t)
-{
- switch (t->type) {
- case EAB_MENU_TARGET_SELECT: {
- EABMenuTargetSelect *s = (EABMenuTargetSelect *)t;
- int i;
-
- for (i=0;i<s->cards->len;i++)
- g_object_unref(s->cards->pdata[i]);
- g_ptr_array_free(s->cards, TRUE);
- if (s->book)
- g_object_unref(s->book);
- break; }
- }
-
- ((EMenuClass *)eabm_parent)->target_free(ep, t);
-}
-
-static void
-eabm_class_init(GObjectClass *klass)
-{
- klass->finalize = eabm_finalise;
- ((EMenuClass *)klass)->target_free = eabm_target_free;
-
- e_menu_class_add_factory((EMenuClass *)klass, NULL, (EMenuFactoryFunc)eabm_standard_menu_factory, NULL);
-}
-
-GType
-eab_menu_get_type(void)
-{
- static GType type = 0;
-
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(EABMenuClass),
- NULL, NULL,
- (GClassInitFunc)eabm_class_init,
- NULL, NULL,
- sizeof(EABMenu), 0,
- (GInstanceInitFunc)eabm_init
- };
- eabm_parent = g_type_class_ref(e_menu_get_type());
- type = g_type_register_static(e_menu_get_type(), "EABMenu", &info, 0);
- }
-
- return type;
-}
-
-EABMenu *eab_menu_new(const char *menuid)
-{
- EABMenu *emp = g_object_new(eab_menu_get_type(), NULL);
-
- e_menu_construct(&emp->menu, menuid);
-
- return emp;
-}
-
-/**
- * eab_menu_target_new_select - create a menu target of the current selection.
- * @eabp: Address book menu.
- * @book: Book the cards belong to. May be NULL in which case cards must be an empty GPtrArray.
- * @readonly: Book is read-only mode. FIXME: Why can't we just get this off the book?
- * @cards: Cards selected. This will be freed on completion and the array indices unreferenced.
- *
- * Create a new selection menu target.
- *
- * Return value:
- **/
-EABMenuTargetSelect *
-eab_menu_target_new_select(EABMenu *eabp, struct _EBook *book, int readonly, GPtrArray *cards)
-{
- EABMenuTargetSelect *t = e_menu_target_new(&eabp->menu, EAB_MENU_TARGET_SELECT, sizeof(*t));
- guint32 mask = ~0;
- int has_email = FALSE, i;
-
- /* FIXME: duplicated in eab-popup.c */
-
- t->book = book;
- if (book)
- g_object_ref(book);
- t->cards = cards;
-
- for (i=0;i<cards->len && !has_email;i++) {
- EContact *contact = cards->pdata[i];
- GList *email;
-
- email = e_contact_get(E_CONTACT(contact), E_CONTACT_EMAIL);
- if (email) {
- has_email = TRUE;
-
- g_list_foreach(email, (GFunc)g_free, NULL);
- g_list_free(email);
- }
- }
-
- if (has_email)
- mask &= ~EAB_MENU_SELECT_EMAIL;
-
- if (!readonly)
- mask &= ~EAB_MENU_SELECT_EDITABLE;
-
- if (cards->len == 1)
- mask &= ~EAB_MENU_SELECT_ONE;
-
- if (cards->len > 1)
- mask &= ~EAB_MENU_SELECT_MANY;
-
- if (cards->len >= 1)
- mask &= ~EAB_MENU_SELECT_ANY;
-
- t->target.mask = mask;
-
- return t;
-}
-
-static void
-eabm_standard_menu_factory(EMenu *emp, void *data)
-{
- /* noop */
-}
-
-/* ********************************************************************** */
-
-/* menu plugin handler */
-
-/*
-<e-plugin
- class="org.gnome.mail.plugin.popup:1.0"
- id="org.gnome.mail.plugin.popup.item:1.0"
- type="shlib"
- location="/opt/gnome2/lib/camel/1.0/libcamelimap.so"
- name="imap"
- description="IMAP4 and IMAP4v1 mail store">
- <hook class="org.gnome.mail.popupMenu:1.0"
- handler="HandlePopup">
- <menu id="any" target="select">
- <item
- type="item|toggle|radio|image|submenu|bar"
- active
- path="foo/bar"
- label="label"
- icon="foo"
- mask="select_one"
- activate="eabm_view_emacs"/>
- </menu>
- </extension>
-
-*/
-
-static void *eabmph_parent_class;
-#define eabmph ((EABMenuHook *)eph)
-
-static const EMenuHookTargetMask eabmph_select_masks[] = {
- { "one", EAB_MENU_SELECT_ONE },
- { "many", EAB_MENU_SELECT_MANY },
- { "any", EAB_MENU_SELECT_ANY },
- { "editable", EAB_MENU_SELECT_EDITABLE },
- { "email", EAB_MENU_SELECT_EMAIL },
- { NULL }
-};
-
-static const EMenuHookTargetMap eabmph_targets[] = {
- { "select", EAB_MENU_TARGET_SELECT, eabmph_select_masks },
- { NULL }
-};
-
-static void
-eabmph_finalise(GObject *o)
-{
- /*EPluginHook *eph = (EPluginHook *)o;*/
-
- ((GObjectClass *)eabmph_parent_class)->finalize(o);
-}
-
-static void
-eabmph_class_init(EPluginHookClass *klass)
-{
- int i;
-
- ((GObjectClass *)klass)->finalize = eabmph_finalise;
- ((EPluginHookClass *)klass)->id = "org.gnome.evolution.addressbook.bonobomenu:1.0";
-
- for (i=0;eabmph_targets[i].type;i++)
- e_menu_hook_class_add_target_map((EMenuHookClass *)klass, &eabmph_targets[i]);
-
- /* FIXME: leaks parent set class? */
- ((EMenuHookClass *)klass)->menu_class = g_type_class_ref(eab_menu_get_type());
-}
-
-GType
-eab_menu_hook_get_type(void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof(EABMenuHookClass), NULL, NULL, (GClassInitFunc) eabmph_class_init, NULL, NULL,
- sizeof(EABMenuHook), 0, (GInstanceInitFunc) NULL,
- };
-
- eabmph_parent_class = g_type_class_ref(e_menu_hook_get_type());
- type = g_type_register_static(e_menu_hook_get_type(), "EABMenuHook", &info, 0);
- }
-
- return type;
-}
diff --git a/addressbook/gui/widgets/eab-menu.h b/addressbook/gui/widgets/eab-menu.h
deleted file mode 100644
index 7bea32efa4..0000000000
--- a/addressbook/gui/widgets/eab-menu.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michel Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef __EAB_MENU_H__
-#define __EAB_MENU_H__
-
-#include <glib-object.h>
-
-#include "e-util/e-menu.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-struct _EBook;
-
-typedef struct _EABMenu EABMenu;
-typedef struct _EABMenuClass EABMenuClass;
-
-/* Current target description */
-enum _eab_menu_target_t {
- EAB_MENU_TARGET_SELECT
-};
-
-/**
- * enum _eab_menu_target_select_t - EABMenuTargetSelect qualifiers.
- *
- * @EAB_MENU_SELECT_ONE: Only one item is selected.
- * @EAB_MENU_SELECT_MANY: More than one item selected.
- * @EAB_MENU_SELECT_ANY: One or more items selected.
- * @EAB_MENU_SELECT_EDITABLE: Editable addressbook.
- * @EAB_MENU_SELECT_EMAIL: Has an email address.
- **/
-enum _eab_menu_target_select_t {
- EAB_MENU_SELECT_ONE = 1<<0,
- EAB_MENU_SELECT_MANY = 1<<1,
- EAB_MENU_SELECT_ANY = 1<<2,
- EAB_MENU_SELECT_EDITABLE = 1<<3,
- EAB_MENU_SELECT_EMAIL = 1<<4
-};
-
-typedef struct _EABMenuTargetSelect EABMenuTargetSelect;
-
-struct _EABMenuTargetSelect {
- EMenuTarget target;
-
- struct _EBook *book;
- GPtrArray *cards;
-};
-
-typedef struct _EMenuItem EABMenuItem;
-
-/* The object */
-struct _EABMenu {
- EMenu menu;
-
- struct _EABMenuPrivate *priv;
-};
-
-struct _EABMenuClass {
- EMenuClass menu_class;
-};
-
-GType eab_menu_get_type(void);
-
-EABMenu *eab_menu_new(const char *menuid);
-
-EABMenuTargetSelect *eab_menu_target_new_select(EABMenu *eabp, struct _EBook *book, int readonly, GPtrArray *cards);
-
-/* ********************************************************************** */
-
-typedef struct _EABMenuHook EABMenuHook;
-typedef struct _EABMenuHookClass EABMenuHookClass;
-
-struct _EABMenuHook {
- EMenuHook hook;
-};
-
-struct _EABMenuHookClass {
- EMenuHookClass hook_class;
-};
-
-GType eab_menu_hook_get_type(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __EAB_MENU_H__ */
diff --git a/addressbook/gui/widgets/eab-popup-control.c b/addressbook/gui/widgets/eab-popup-control.c
deleted file mode 100644
index d520108db4..0000000000
--- a/addressbook/gui/widgets/eab-popup-control.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * This file is too big and this widget is too complicated. Forgive me.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- * Authors:
- * Jon Trowbridge <trow@ximian.com>
- * Chris Toshok <toshok@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- */
-
-#include <config.h>
-#include <string.h>
-#include "addressbook.h"
-#include "eab-popup-control.h"
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-property-bag.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <addressbook/util/eab-book-util.h>
-#include <addressbook/gui/contact-editor/e-contact-editor.h>
-#include <addressbook/gui/contact-editor/e-contact-quick-add.h>
-#include <addressbook/gui/widgets/eab-contact-display.h>
-#include <addressbook/gui/widgets/eab-gui-util.h>
-
-static void eab_popup_control_set_name (EABPopupControl *pop, const gchar *name);
-static void eab_popup_control_set_email (EABPopupControl *pop, const gchar *email);
-static void eab_popup_control_set_vcard (EABPopupControl *pop, const gchar *vcard);
-
-static GtkObjectClass *parent_class;
-
-static void eab_popup_control_dispose (GObject *);
-static void eab_popup_control_query (EABPopupControl *);
-
-
-static void
-eab_popup_control_class_init (EABPopupControlClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = eab_popup_control_dispose;
-}
-
-static void
-eab_popup_control_init (EABPopupControl *pop)
-{
- pop->transitory = TRUE;
-}
-
-static void
-eab_popup_control_cleanup (EABPopupControl *pop)
-{
- if (pop->contact) {
- g_object_unref (pop->contact);
- pop->contact = NULL;
- }
-
- if (pop->scheduled_refresh) {
- g_source_remove (pop->scheduled_refresh);
- pop->scheduled_refresh = 0;
- }
-
- if (pop->query_tag) {
-#ifdef notyet
- e_book_simple_query_cancel (pop->book, pop->query_tag);
-#endif
- pop->query_tag = 0;
- }
-
- if (pop->book) {
- g_object_unref (pop->book);
- pop->book = NULL;
- }
-
- g_free (pop->name);
- pop->name = NULL;
-
- g_free (pop->email);
- pop->email = NULL;
-
- g_free (pop->vcard);
- pop->vcard = NULL;
-}
-
-static void
-eab_popup_control_dispose (GObject *obj)
-{
- EABPopupControl *pop = EAB_POPUP_CONTROL (obj);
-
- eab_popup_control_cleanup (pop);
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (obj);
-}
-
-GType
-eab_popup_control_get_type (void)
-{
- static GType pop_type = 0;
-
- if (!pop_type) {
- static const GTypeInfo pop_info = {
- sizeof (EABPopupControlClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) eab_popup_control_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EABPopupControl),
- 0, /* n_preallocs */
- (GInstanceInitFunc) eab_popup_control_init,
- };
-
- pop_type = g_type_register_static (gtk_event_box_get_type (), "EABPopupControl", &pop_info, 0);
- }
-
- return pop_type;
-}
-
-static void
-eab_popup_control_refresh_names (EABPopupControl *pop)
-{
- if (pop->name_widget) {
- if (pop->name && *pop->name) {
- gtk_label_set_text (GTK_LABEL (pop->name_widget), pop->name);
- gtk_widget_show (pop->name_widget);
- } else {
- gtk_widget_hide (pop->name_widget);
- }
- }
-
- if (pop->email_widget) {
- if (pop->email && *pop->email) {
- gtk_label_set_text (GTK_LABEL (pop->email_widget), pop->email);
- gtk_widget_show (pop->email_widget);
- } else {
- gtk_widget_hide (pop->email_widget);
- }
- }
-
- eab_popup_control_query (pop);
-}
-
-static gint
-refresh_timeout_cb (gpointer ptr)
-{
- EABPopupControl *pop = EAB_POPUP_CONTROL (ptr);
- eab_popup_control_refresh_names (pop);
- pop->scheduled_refresh = 0;
- return 0;
-}
-
-static void
-eab_popup_control_schedule_refresh (EABPopupControl *pop)
-{
- if (pop->scheduled_refresh == 0)
- pop->scheduled_refresh = g_timeout_add (20, refresh_timeout_cb, pop);
-}
-
-/* If we are handed something of the form "Foo <bar@bar.com>",
- do the right thing. */
-static gboolean
-eab_popup_control_set_free_form (EABPopupControl *pop, const gchar *txt)
-{
- gchar *lt, *gt = NULL;
-
- g_return_val_if_fail (pop && EAB_IS_POPUP_CONTROL (pop), FALSE);
-
- if (txt == NULL)
- return FALSE;
-
- lt = strchr (txt, '<');
- if (lt)
- gt = strchr (txt, '>');
-
- if (lt && gt && lt+1 < gt) {
- gchar *name = g_strndup (txt, lt-txt);
- gchar *email = g_strndup (lt+1, gt-lt-1);
- eab_popup_control_set_name (pop, name);
- eab_popup_control_set_email (pop, email);
- g_free(name);
- g_free(email);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-eab_popup_control_set_name (EABPopupControl *pop, const gchar *name)
-{
- g_return_if_fail (pop && EAB_IS_POPUP_CONTROL (pop));
-
- /* We only allow the name to be set once. */
- if (pop->name)
- return;
-
- if (!eab_popup_control_set_free_form (pop, name)) {
- pop->name = g_strdup (name);
- if (pop->name)
- g_strstrip (pop->name);
- }
-
- eab_popup_control_schedule_refresh (pop);
-}
-
-static void
-eab_popup_control_set_email (EABPopupControl *pop, const gchar *email)
-{
- g_return_if_fail (pop && EAB_IS_POPUP_CONTROL (pop));
-
- /* We only allow the e-mail to be set once. */
- if (pop->email)
- return;
-
- if (!eab_popup_control_set_free_form (pop, email)) {
- pop->email = g_strdup (email);
- if (pop->email)
- g_strstrip (pop->email);
- }
-
- eab_popup_control_schedule_refresh (pop);
-}
-
-static void
-eab_popup_control_set_vcard (EABPopupControl *pop, const gchar *vcard)
-{
- g_return_if_fail (pop && EAB_IS_POPUP_CONTROL (pop));
-
- /* We only allow the vcard to be set once. */
- if (pop->vcard)
- return;
-
- g_free (pop->name);
- g_free (pop->email);
-
- pop->name = NULL;
- pop->email = NULL;
-
- pop->vcard = g_strdup (vcard);
-
- eab_popup_control_schedule_refresh (pop);
-}
-
-void
-eab_popup_control_construct (EABPopupControl *pop)
-{
- GtkWidget *vbox, *name_holder;
- GdkColor color = { 0x0, 0xffff, 0xffff, 0xffff };
-
- g_return_if_fail (pop && EAB_IS_POPUP_CONTROL (pop));
-
- pop->main_vbox = gtk_vbox_new (FALSE, 0);
-
- /* Build Generic View */
-
- name_holder = gtk_event_box_new ();
- vbox = gtk_vbox_new (FALSE, 2);
- pop->name_widget = gtk_label_new ("");
- pop->email_widget = gtk_label_new ("");
-
- gtk_box_pack_start (GTK_BOX (vbox), pop->name_widget, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), pop->email_widget, TRUE, TRUE, 2);
- gtk_container_add (GTK_CONTAINER (name_holder), GTK_WIDGET (vbox));
-
- if (gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (name_holder)), &color, FALSE, TRUE)) {
- GtkStyle *style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (name_holder)));
- style->bg[0] = color;
- gtk_widget_set_style (GTK_WIDGET (name_holder), style);
- g_object_unref (style);
- }
-
- pop->generic_view = gtk_frame_new (NULL);
- gtk_container_add (GTK_CONTAINER (pop->generic_view), name_holder);
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->generic_view, TRUE, TRUE, 0);
- gtk_widget_show_all (pop->generic_view);
-
- pop->query_msg = gtk_label_new (_("Querying Address Book..."));
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->query_msg, TRUE, TRUE, 0);
- gtk_widget_show (pop->query_msg);
-
- /* Build ContactDisplay */
- pop->contact_display = eab_contact_display_new ();
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->contact_display, TRUE, TRUE, 0);
-
-
- /* Final assembly */
-
- gtk_container_add (GTK_CONTAINER (pop), pop->main_vbox);
- gtk_widget_show (pop->main_vbox);
-
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
- gtk_container_set_border_width (GTK_CONTAINER (pop), 2);
-}
-
-static GtkWidget *
-eab_popup_new (void)
-{
- EABPopupControl *pop = g_object_new (EAB_TYPE_POPUP_CONTROL, NULL);
- eab_popup_control_construct (pop);
- return GTK_WIDGET (pop);
-}
-
-static void
-emit_event (EABPopupControl *pop, const char *event)
-{
- if (pop->es) {
- BonoboArg *arg;
-
- arg = bonobo_arg_new (BONOBO_ARG_BOOLEAN);
- BONOBO_ARG_SET_BOOLEAN (arg, TRUE);
- bonobo_event_source_notify_listeners_full (pop->es,
- "GNOME/Evolution/Addressbook/AddressPopup",
- "Event",
- event,
- arg, NULL);
- bonobo_arg_release (arg);
- }
-}
-
-static void
-eab_popup_control_no_matches (EABPopupControl *pop)
-{
- if (pop->vcard && *pop->vcard)
- e_contact_quick_add_vcard (pop->vcard, NULL, NULL);
- else if (pop->email && *pop->email) {
- if (pop->name && *pop->name)
- e_contact_quick_add (pop->name, pop->email, NULL, NULL);
- else
- e_contact_quick_add_free_form (pop->email, NULL, NULL);
-
- }
- eab_popup_control_cleanup (pop);
- emit_event (pop, "Destroy");
-}
-
-static void
-eab_popup_control_query (EABPopupControl *pop)
-{
- g_return_if_fail (pop && EAB_IS_POPUP_CONTROL (pop));
-
- g_object_ref (pop);
-
- eab_popup_control_no_matches (pop) ;
-
- g_object_unref (pop);
-
-}
-
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-
-enum {
- PROPERTY_NAME,
- PROPERTY_EMAIL,
- PROPERTY_TRANSITORY,
- PROPERTY_VCARD
-};
-
-static void
-set_prop (BonoboPropertyBag *bag, const BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data)
-{
- EABPopupControl *pop = EAB_POPUP_CONTROL (user_data);
-
- switch (arg_id) {
-
- case PROPERTY_NAME:
- eab_popup_control_set_name (pop, BONOBO_ARG_GET_STRING (arg));
- break;
-
- case PROPERTY_EMAIL:
- eab_popup_control_set_email (pop, BONOBO_ARG_GET_STRING (arg));
- break;
-
- case PROPERTY_VCARD:
- eab_popup_control_set_vcard (pop, BONOBO_ARG_GET_STRING (arg));
- break;
-
- default:
- g_return_if_reached ();
- }
-}
-
-static void
-get_prop (BonoboPropertyBag *bag, BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data)
-{
- EABPopupControl *pop = EAB_POPUP_CONTROL (user_data);
-
- switch (arg_id) {
-
- case PROPERTY_NAME:
- BONOBO_ARG_SET_STRING (arg, pop->name);
- break;
-
- case PROPERTY_EMAIL:
- BONOBO_ARG_SET_STRING (arg, pop->email);
- break;
-
- case PROPERTY_TRANSITORY:
- BONOBO_ARG_SET_BOOLEAN (arg, pop->transitory);
- break;
-
- case PROPERTY_VCARD:
- BONOBO_ARG_SET_STRING (arg, pop->vcard);
- break;
-
- default:
- g_return_if_reached ();
- }
-}
-
-BonoboControl *
-eab_popup_control_new (void)
-{
- BonoboControl *control;
- BonoboPropertyBag *bag;
- EABPopupControl *addy;
- GtkWidget *w;
-
- w = eab_popup_new ();
- addy = EAB_POPUP_CONTROL (w);
-
- control = bonobo_control_new (w);
- gtk_widget_show (w);
-
- bag = bonobo_property_bag_new (get_prop, set_prop, w);
- bonobo_property_bag_add (bag, "name", PROPERTY_NAME,
- BONOBO_ARG_STRING, NULL, NULL,
- BONOBO_PROPERTY_WRITEABLE | BONOBO_PROPERTY_READABLE);
-
- bonobo_property_bag_add (bag, "email", PROPERTY_EMAIL,
- BONOBO_ARG_STRING, NULL, NULL,
- BONOBO_PROPERTY_WRITEABLE | BONOBO_PROPERTY_READABLE);
-
- bonobo_property_bag_add (bag, "transitory", PROPERTY_TRANSITORY,
- BONOBO_ARG_BOOLEAN, NULL, NULL,
- BONOBO_PROPERTY_READABLE);
-
- bonobo_property_bag_add (bag, "vcard", PROPERTY_VCARD,
- BONOBO_ARG_STRING, NULL, NULL,
- BONOBO_PROPERTY_WRITEABLE | BONOBO_PROPERTY_READABLE);
-
- bonobo_control_set_properties (control, bonobo_object_corba_objref (BONOBO_OBJECT (bag)), NULL);
- bonobo_object_unref (BONOBO_OBJECT (bag));
-
- addy->es = bonobo_event_source_new ();
- bonobo_object_add_interface (BONOBO_OBJECT (control),
- BONOBO_OBJECT (addy->es));
-
- return control;
-}
diff --git a/addressbook/gui/widgets/eab-popup-control.h b/addressbook/gui/widgets/eab-popup-control.h
deleted file mode 100644
index 9eeedc8e00..0000000000
--- a/addressbook/gui/widgets/eab-popup-control.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Jon Trowbridge <trow@ximian.com>
- * Chris Toshok <toshok@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef __EAB_POPUP_CONTROL_H__
-#define __EAB_POPUP_CONTROL_H__
-
-#include <bonobo/bonobo-event-source.h>
-#include <libebook/e-book.h>
-#include <libebook/e-contact.h>
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define EAB_TYPE_POPUP_CONTROL (eab_popup_control_get_type ())
-#define EAB_POPUP_CONTROL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EAB_TYPE_POPUP_CONTROL, EABPopupControl))
-#define EAB_POPUP_CONTROL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EAB_TYPE_POPUP_CONTROL, EABPopupControlClass))
-#define EAB_IS_POPUP_CONTROL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EAB_TYPE_POPUP_CONTROL))
-#define EAB_IS_POPUP_CONTROL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EAB_TYPE_POPUP_CONTROL))
-
-typedef struct _EABPopupControl EABPopupControl;
-typedef struct _EABPopupControlClass EABPopupControlClass;
-
-struct _EABPopupControl {
- GtkEventBox parent;
-
- gchar *name;
- gchar *email;
- gchar *vcard;
-
- GtkWidget *name_widget;
- GtkWidget *email_widget;
- GtkWidget *query_msg;
-
- GtkWidget *main_vbox;
- GtkWidget *generic_view;
- GtkWidget *contact_display;
-
- gboolean transitory;
-
- guint scheduled_refresh;
- EBook *book;
- guint query_tag;
- gboolean multiple_matches;
- EContact *contact;
-
- BonoboEventSource *es;
-};
-
-struct _EABPopupControlClass {
- GtkEventBoxClass parent_class;
-};
-
-GType eab_popup_control_get_type (void);
-
-void eab_popup_control_construct (EABPopupControl *);
-
-BonoboControl *eab_popup_control_new (void);
-
-G_END_DECLS
-
-#endif /* __EAB_POPUP_CONTROL_H__ */
-
diff --git a/addressbook/gui/widgets/eab-popup.c b/addressbook/gui/widgets/eab-popup.c
deleted file mode 100644
index 1b5cde4b5c..0000000000
--- a/addressbook/gui/widgets/eab-popup.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <glib.h>
-
-#include "eab-popup.h"
-#include <libedataserverui/e-source-selector.h>
-#include <libebook/e-contact.h>
-
-static GObjectClass *eabp_parent;
-
-static void
-eabp_init(GObject *o)
-{
- /*EABPopup *eabp = (EABPopup *)o; */
-}
-
-static void
-eabp_finalise(GObject *o)
-{
- ((GObjectClass *)eabp_parent)->finalize(o);
-}
-
-static void
-eabp_target_free(EPopup *ep, EPopupTarget *t)
-{
- switch (t->type) {
- case EAB_POPUP_TARGET_SELECT: {
- EABPopupTargetSelect *s = (EABPopupTargetSelect *)t;
- int i;
-
- for (i=0;i<s->cards->len;i++)
- g_object_unref(s->cards->pdata[i]);
- g_ptr_array_free(s->cards, TRUE);
- g_object_unref(s->book);
-
- break; }
- case EAB_POPUP_TARGET_URI: {
- EABPopupTargetURI *s = (EABPopupTargetURI *)t;
-
- g_free(s->uri);
- break; }
- case EAB_POPUP_TARGET_SOURCE: {
- EABPopupTargetSource *s = (EABPopupTargetSource *)t;
-
- g_object_unref(s->selector);
- break; }
-
-#ifdef ADAPTED_TO_E_NAME_SELECTOR
-
- case EAB_POPUP_TARGET_SELECT_NAMES: {
- EABPopupTargetSelectNames *s = (EABPopupTargetSelectNames *)t;
-
- g_object_unref(s->model);
- break; }
-
-#endif
-
- }
-
- ((EPopupClass *)eabp_parent)->target_free(ep, t);
-}
-
-static void
-eabp_class_init(GObjectClass *klass)
-{
- klass->finalize = eabp_finalise;
- ((EPopupClass *)klass)->target_free = eabp_target_free;
-}
-
-GType
-eab_popup_get_type(void)
-{
- static GType type = 0;
-
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(EABPopupClass),
- NULL, NULL,
- (GClassInitFunc)eabp_class_init,
- NULL, NULL,
- sizeof(EABPopup), 0,
- (GInstanceInitFunc)eabp_init
- };
- eabp_parent = g_type_class_ref(e_popup_get_type());
- type = g_type_register_static(e_popup_get_type(), "EABPopup", &info, 0);
- }
-
- return type;
-}
-
-EABPopup *eab_popup_new(const char *menuid)
-{
- EABPopup *eabp = g_object_new(eab_popup_get_type(), NULL);
-
- e_popup_construct(&eabp->popup, menuid);
-
- return eabp;
-}
-
-/**
- * eab_popup_target_new_select:
- * @eabp: Address book popup.
- * @book: Book the cards belong to.
- * @readonly: Book is read-only mode. FIXME: Why can't we just get this off the book?
- * @cards: Cards selected. This will be freed on completion.
- *
- * Create a new selection popup target.
- *
- * Return value:
- **/
-
-
-EABPopupTargetURI *
-eab_popup_target_new_uri(EABPopup *emp, const char *uri)
-{
- EABPopupTargetURI *t = e_popup_target_new(&emp->popup, EAB_POPUP_TARGET_URI, sizeof(*t));
- guint32 mask = ~0;
-
- t->uri = g_strdup(uri);
-
- if (g_ascii_strncasecmp(uri, "http:", 5) == 0
- || g_ascii_strncasecmp(uri, "https:", 6) == 0)
- mask &= ~EAB_POPUP_URI_HTTP;
- if (g_ascii_strncasecmp(uri, "internal-mailto:", 16) == 0)
- mask &= ~EAB_POPUP_URI_MAILTO;
- else
- mask &= ~EAB_POPUP_URI_NOT_MAILTO;
-
- t->target.mask = mask;
-
- return t;
-}
-
-
-
-
-EABPopupTargetSelect *
-eab_popup_target_new_select(EABPopup *eabp, struct _EBook *book, int readonly, GPtrArray *cards)
-{
- EABPopupTargetSelect *t = e_popup_target_new(&eabp->popup, EAB_POPUP_TARGET_SELECT, sizeof(*t));
- guint32 mask = ~0;
- int has_email = FALSE, i;
-
- /* FIXME: duplicated in eab-menu.c */
-
- t->book = book;
- g_object_ref(book);
- t->cards = cards;
-
- for (i=0;i<cards->len && !has_email;i++) {
- EContact *contact = cards->pdata[i];
- GList *email;
-
- email = e_contact_get(E_CONTACT(contact), E_CONTACT_EMAIL);
- if (email) {
- has_email = TRUE;
-
- g_list_foreach(email, (GFunc)g_free, NULL);
- g_list_free(email);
- }
- }
-
- if (cards->len == 1) {
- if (e_contact_get (E_CONTACT(cards->pdata[0]), E_CONTACT_IS_LIST))
- mask &= ~EAB_POPUP_LIST;
- else
- mask &= ~EAB_POPUP_CONTACT;
- }
-
- if (has_email)
- mask &= ~EAB_POPUP_SELECT_EMAIL;
-
- if (!readonly)
- mask &= ~EAB_POPUP_SELECT_EDITABLE;
-
- if (cards->len == 1)
- mask &= ~EAB_POPUP_SELECT_ONE;
-
- if (cards->len > 1)
- mask &= ~EAB_POPUP_SELECT_MANY;
-
- if (cards->len >= 1)
- mask &= ~EAB_POPUP_SELECT_ANY;
-
- t->target.mask = mask;
-
- return t;
-}
-
-EABPopupTargetSource *
-eab_popup_target_new_source(EABPopup *eabp, ESourceSelector *selector)
-{
- EABPopupTargetSource *t = e_popup_target_new(&eabp->popup, EAB_POPUP_TARGET_SOURCE, sizeof(*t));
- guint32 mask = ~0;
- const char *source_uri;
- ESource *source;
-
- /* TODO: this is duplicated for calendar and tasks too */
-
- t->selector = selector;
- g_object_ref(selector);
-
- /* TODO: perhaps we need to copy this so it doesn't change during the lifecycle */
- source = e_source_selector_peek_primary_selection(selector);
- if (source)
- mask &= ~EAB_POPUP_SOURCE_PRIMARY;
-
- /* FIXME Gross hack, should have a property or something */
- source_uri = e_source_peek_relative_uri(source);
- if (source_uri && !strcmp("system", source_uri))
- mask &= ~EAB_POPUP_SOURCE_SYSTEM;
- else
- mask &= ~EAB_POPUP_SOURCE_USER;
-
- t->target.mask = mask;
-
- return t;
-}
-
-#ifdef ADAPTED_TO_E_NAME_SELECTOR
-
-EABPopupTargetSelectNames *
-eab_popup_target_new_select_names(EABPopup *eabp, struct _ESelectNamesModel *model, int row)
-{
- EABPopupTargetSelectNames *t = e_popup_target_new(&eabp->popup, EAB_POPUP_TARGET_SELECT_NAMES, sizeof(*t));
-
- /* TODO: this is sort of not very useful, maybe the popup which uses it doesn't
- need to be pluggable */
-
- t->model = model;
- g_object_ref(model);
- t->row = row;
-
- return t;
-}
-
-#endif
-
-/* ********************************************************************** */
-/* Popup menu plugin handler */
-
-/*
-<e-plugin
- class="org.gnome.mail.plugin.popup:1.0"
- id="org.gnome.mail.plugin.popup.iteab:1.0"
- type="shlib"
- location="/opt/gnome2/lib/camel/1.0/libcamelimap.so"
- name="imap"
- description="IMAP4 and IMAP4v1 mail store">
- <hook class="org.gnome.mail.popupMenu:1.0"
- handler="HandlePopup">
- <menu id="any" target="select">
- <iteab
- type="iteab|toggle|radio|image|submenu|bar"
- active
- path="foo/bar"
- label="label"
- icon="foo"
- mask="select_one"
- activate="eabp_view_eabacs"/>
- </menu>
- </extension>
-
-*/
-
-static void *eabph_parent_class;
-#define eabph ((EABPopupHook *)eph)
-
-static const EPopupHookTargetMask eabph_select_masks[] = {
- { "one", EAB_POPUP_SELECT_ONE },
- { "many", EAB_POPUP_SELECT_MANY },
- { "any", EAB_POPUP_SELECT_ANY },
- { "editable", EAB_POPUP_SELECT_EDITABLE },
- { "email", EAB_POPUP_SELECT_EMAIL },
- { NULL }
-};
-
-static const EPopupHookTargetMask eabph_source_masks[] = {
- { "primary", EAB_POPUP_SOURCE_PRIMARY },
- { "system", EAB_POPUP_SOURCE_SYSTEM },
- { NULL }
-};
-
-static const EPopupHookTargetMask eabph_uri_masks[] = {
- { "http", EAB_POPUP_URI_HTTP },
- { "internal-mailto", EAB_POPUP_URI_MAILTO },
- { "notmailto", EAB_POPUP_URI_NOT_MAILTO },
- { NULL }
-};
-
-static const EPopupHookTargetMask eabph_select_names_masks[] = {
- { NULL }
-};
-
-static const EPopupHookTargetMap eabph_targets[] = {
- { "select", EAB_POPUP_TARGET_SELECT, eabph_select_masks },
- { "uri", EAB_POPUP_TARGET_URI, eabph_uri_masks },
- { "source", EAB_POPUP_TARGET_SOURCE, eabph_source_masks },
- { "select-names", EAB_POPUP_TARGET_SELECT_NAMES, eabph_select_names_masks },
- { NULL }
-};
-
-static void
-eabph_finalise(GObject *o)
-{
- /*EPluginHook *eph = (EPluginHook *)o;*/
-
- ((GObjectClass *)eabph_parent_class)->finalize(o);
-}
-
-static void
-eabph_class_init(EPluginHookClass *klass)
-{
- int i;
-
- ((GObjectClass *)klass)->finalize = eabph_finalise;
- ((EPluginHookClass *)klass)->id = "org.gnome.evolution.addressbook.popup:1.0";
-
- for (i=0;eabph_targets[i].type;i++)
- e_popup_hook_class_add_target_map((EPopupHookClass *)klass, &eabph_targets[i]);
-
- ((EPopupHookClass *)klass)->popup_class = g_type_class_ref(eab_popup_get_type());
-}
-
-GType
-eab_popup_hook_get_type(void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof(EABPopupHookClass), NULL, NULL, (GClassInitFunc) eabph_class_init, NULL, NULL,
- sizeof(EABPopupHook), 0, (GInstanceInitFunc) NULL,
- };
-
- eabph_parent_class = g_type_class_ref(e_popup_hook_get_type());
- type = g_type_register_static(e_popup_hook_get_type(), "EABPopupHook", &info, 0);
- }
-
- return type;
-}
diff --git a/addressbook/gui/widgets/eab-popup.h b/addressbook/gui/widgets/eab-popup.h
deleted file mode 100644
index 86deff7f9c..0000000000
--- a/addressbook/gui/widgets/eab-popup.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef __EAB_POPUP_H__
-#define __EAB_POPUP_H__
-
-#include <glib-object.h>
-
-#include "e-util/e-popup.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define ADAPTED_TO_E_NAME_SELECTOR 1
-
-typedef struct _EABPopup EABPopup;
-typedef struct _EABPopupClass EABPopupClass;
-
-/**
- * enum _eab_popup_target_t - A list of mail popup target types.
- *
- * @EAB_POPUP_TARGET_SELECT: A selection of cards
- * @EAB_POPUP_TARGET_SOURCE: A source selection.
- *
- * Defines the value of the targetid for all EABPopup target types.
- **/
-enum _eab_popup_target_t {
- EAB_POPUP_TARGET_SELECT,
- EAB_POPUP_TARGET_URI,
- EAB_POPUP_TARGET_SOURCE,
- EAB_POPUP_TARGET_SELECT_NAMES
-};
-
-/**
- * enum _eab_popup_target_select_t - EABPopupTargetSelect qualifiers.
- *
- * @EAB_POPUP_SELECT_ONE: Only one item is selected.
- * @EAB_POPUP_SELECT_MANY: Two or more items are selected.
- * @EAB_POPUP_SELECT_ANY: One or more items are selected.
- * @EAB_POPUP_SELECT_EDITABLE: Read/writable source.
- * @EAB_POPUP_SELECT_EMAIL: Has an email address.
- **/
-enum _eab_popup_target_select_t {
- EAB_POPUP_SELECT_ONE = 1<<0,
- EAB_POPUP_SELECT_MANY = 1<<1,
- EAB_POPUP_SELECT_ANY = 1<<2,
- EAB_POPUP_SELECT_EDITABLE = 1<<3,
- EAB_POPUP_SELECT_EMAIL = 1<<4,
- EAB_POPUP_LIST = 1<<5,
- EAB_POPUP_CONTACT = 1<<6
-};
-
-enum _eab_popup_target_uri_t {
- EAB_POPUP_URI_HTTP = 1<<0,
- EAB_POPUP_URI_MAILTO = 1<<1,
- EAB_POPUP_URI_NOT_MAILTO = 1<<2
-};
-/**
- * enum _eab_popup_target_source_t - EABPopupTargetSource qualifiers.
- *
- * @EAB_POPUP_SOURCE_PRIMARY: Has a primary selection.
- * @EAB_POPUP_SOURCE_SYSTEM: Is a 'system' folder.
- *
- **/
-enum _eab_popup_target_source_t {
- EAB_POPUP_SOURCE_PRIMARY = 1<<0,
- EAB_POPUP_SOURCE_SYSTEM = 1<<1, /* system folder */
- EAB_POPUP_SOURCE_USER = 1<<2 /* user folder (!system) */
-};
-
-typedef struct _EABPopupTargetSelect EABPopupTargetSelect;
-typedef struct _EABPopupTargetSource EABPopupTargetSource;
-typedef struct _EABPopupTargetSelectNames EABPopupTargetSelectNames;
-typedef struct _EABPopupTargetURI EABPopupTargetURI;
-/**
- * struct _EABPopupTargetSelect - A list of address cards.
- *
- * @target: Superclass.
- * @book: Book the cards belong to.
- * @cards: All selected cards.
- *
- * Used to represent a selection of cards as context for a popup
- * menu.
- **/
-struct _EABPopupTargetSelect {
- EPopupTarget target;
-
- struct _EBook *book;
- GPtrArray *cards;
-};
-
-
-struct _EABPopupTargetURI {
- EPopupTarget target;
- char *uri;
-};
-
-/**
- * struct _EABPopupTargetSource - A source target.
- *
- * @target: Superclass.
- * @selector: Selector holding the source selection.
- *
- * This target is used to represent a source selection.
- **/
-struct _EABPopupTargetSource {
- EPopupTarget target;
-
- struct _ESourceSelector *selector;
-};
-
-#ifdef ADAPTED_TO_E_NAME_SELECTOR
-
-/**
- * struct _EABPopupTargetSelectNames - A select names target.
- *
- * @target: Superclass.
- * @model: Select names model.
- * @row: Row of item selected.
- *
- * This target is used to represent an item selected in an
- * ESelectNames model.
- **/
-struct _EABPopupTargetSelectNames {
- EPopupTarget target;
-
- struct _ESelectNamesModel *model;
- int row;
-};
-
-#endif
-
-typedef struct _EPopupItem EABPopupItem;
-
-/* The object */
-struct _EABPopup {
- EPopup popup;
-
- struct _EABPopupPrivate *priv;
-};
-
-struct _EABPopupClass {
- EPopupClass popup_class;
-};
-
-GType eab_popup_get_type(void);
-
-EABPopup *eab_popup_new(const char *menuid);
-
-EABPopupTargetSelect *eab_popup_target_new_select(EABPopup *eabp, struct _EBook *book, int readonly, GPtrArray *cards);
-EABPopupTargetURI *eab_popup_target_new_uri(EABPopup *emp, const char *uri);
-EABPopupTargetSource *eab_popup_target_new_source(EABPopup *eabp, struct _ESourceSelector *selector);
-
-#ifdef ADAPTED_TO_E_NAME_SELECTOR
-
-EABPopupTargetSelectNames *eab_popup_target_new_select_names(EABPopup *eabp, struct _ESelectNamesModel *model, int row);
-
-#endif
-
-/* ********************************************************************** */
-
-typedef struct _EABPopupHook EABPopupHook;
-typedef struct _EABPopupHookClass EABPopupHookClass;
-
-struct _EABPopupHook {
- EPopupHook hook;
-};
-
-struct _EABPopupHookClass {
- EPopupHookClass hook_class;
-};
-
-GType eab_popup_hook_get_type(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __EAB_POPUP_H__ */
diff --git a/addressbook/gui/widgets/gal-view-minicard.c b/addressbook/gui/widgets/gal-view-minicard.c
index 0a2fac9262..0ebc928bad 100644
--- a/addressbook/gui/widgets/gal-view-minicard.c
+++ b/addressbook/gui/widgets/gal-view-minicard.c
@@ -26,115 +26,172 @@
#include <config.h>
#include <libxml/parser.h>
-
-#include <libedataserver/e-xml-utils.h>
-
#include <e-util/e-xml-utils.h>
+#include <libedataserver/e-xml-utils.h>
#include "gal-view-minicard.h"
-#define PARENT_TYPE gal_view_get_type ()
-#define d(x)
+static gpointer parent_class;
+
+static void
+view_minicard_column_width_changed (EAddressbookView *address_view,
+ gdouble width)
+{
+ GalView *view;
+ GalViewInstance *view_instance;
+ GalViewMinicard *view_minicard;
+ GtkScrolledWindow *scrolled_window;
+ GtkAdjustment *adjustment;
+ GtkWidget *widget;
+ gdouble value, lower, upper;
+ gdouble page_increment, page_size;
+
+ view_instance = e_addressbook_view_get_view_instance (address_view);
+ view = gal_view_instance_get_current_view (view_instance);
+ view_minicard = GAL_VIEW_MINICARD (view);
+
+ if (view_minicard->column_width != width) {
+ view_minicard->column_width = width;
+ gal_view_changed (view);
+ }
+
+ widget = e_addressbook_view_get_view_widget (address_view);
+ scrolled_window = GTK_SCROLLED_WINDOW (widget);
+ adjustment = gtk_scrolled_window_get_hadjustment (scrolled_window);
+
+ value = gtk_adjustment_get_value (adjustment);
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ page_increment = gtk_adjustment_get_page_increment (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
+
+ adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (
+ value, lower, upper, page_size, page_increment, page_size));
+ gtk_scrolled_window_set_hadjustment (scrolled_window, adjustment);
+}
+
+static void
+view_minicard_finalize (GObject *object)
+{
+ GalViewMinicard *view = GAL_VIEW_MINICARD (object);
+
+ if (view->title != NULL) {
+ gal_view_minicard_detach (view);
+ g_free (view->title);
+ view->title = NULL;
+ }
-static GalViewClass *gal_view_minicard_parent_class;
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
static void
-gal_view_minicard_load (GalView *view,
- const char *filename)
+view_minicard_load (GalView *view,
+ const gchar *filename)
{
+ GalViewMinicard *view_minicard;
xmlDoc *doc;
+ xmlNode *root;
+
+ view_minicard = GAL_VIEW_MINICARD (view);
doc = e_xml_parse_file (filename);
- if (doc) {
- xmlNode *root = xmlDocGetRootElement(doc);
- GAL_VIEW_MINICARD (view)->column_width = e_xml_get_double_prop_by_name_with_default (root, (const unsigned char *)"column_width", 150);
- xmlFreeDoc(doc);
- }
+ g_return_if_fail (doc != NULL);
+
+ root = xmlDocGetRootElement (doc);
+ view_minicard->column_width =
+ e_xml_get_double_prop_by_name_with_default (
+ root, (guchar *) "column_width", 150);
+ xmlFreeDoc (doc);
}
static void
-gal_view_minicard_save (GalView *view,
- const char *filename)
+view_minicard_save (GalView *view,
+ const gchar *filename)
{
+ GalViewMinicard *view_minicard;
xmlDoc *doc;
xmlNode *root;
- doc = xmlNewDoc((const unsigned char *)"1.0");
- root = xmlNewNode (NULL, (const unsigned char *)"EMinicardViewState");
- e_xml_set_double_prop_by_name (root, (const unsigned char *)"column_width", GAL_VIEW_MINICARD (view)->column_width);
- xmlDocSetRootElement(doc, root);
+ view_minicard = GAL_VIEW_MINICARD (view);
+
+ doc = xmlNewDoc ((guchar *) "1.0");
+ root = xmlNewNode (NULL, (guchar *) "EMinicardViewState");
+ e_xml_set_double_prop_by_name (
+ root, (guchar *) "column_width",
+ view_minicard->column_width);
+ xmlDocSetRootElement (doc, root);
e_xml_save_file (filename, doc);
- xmlFreeDoc(doc);
+ xmlFreeDoc (doc);
}
-static const char *
-gal_view_minicard_get_title (GalView *view)
+static const gchar *
+view_minicard_get_title (GalView *view)
{
- return GAL_VIEW_MINICARD(view)->title;
+ GalViewMinicard *view_minicard;
+
+ view_minicard = GAL_VIEW_MINICARD (view);
+
+ return view_minicard->title;
}
static void
-gal_view_minicard_set_title (GalView *view,
- const char *title)
+view_minicard_set_title (GalView *view,
+ const char *title)
{
- g_free(GAL_VIEW_MINICARD(view)->title);
- GAL_VIEW_MINICARD(view)->title = g_strdup(title);
+ GalViewMinicard *view_minicard;
+
+ view_minicard = GAL_VIEW_MINICARD (view);
+
+ g_free (view_minicard->title);
+ view_minicard->title = g_strdup (title);
}
-static const char *
-gal_view_minicard_get_type_code (GalView *view)
+static const gchar *
+view_minicard_get_type_code (GalView *view)
{
return "minicard";
}
static GalView *
-gal_view_minicard_clone (GalView *view)
+view_minicard_clone (GalView *view)
{
- GalViewMinicard *gvm, *new;
+ GalViewMinicard *view_minicard;
+ GalViewMinicard *clone;
- gvm = GAL_VIEW_MINICARD(view);
+ view_minicard = GAL_VIEW_MINICARD(view);
- new = g_object_new (GAL_TYPE_VIEW_MINICARD, NULL);
- new->title = g_strdup (gvm->title);
- new->column_width = gvm->column_width;
+ clone = g_object_new (GAL_TYPE_VIEW_MINICARD, NULL);
+ clone->column_width = view_minicard->column_width;
+ clone->title = g_strdup (view_minicard->title);
- return GAL_VIEW(new);
+ return GAL_VIEW (clone);
}
static void
-gal_view_minicard_dispose (GObject *object)
+gal_view_minicard_class_init (GalViewMinicardClass *class)
{
- GalViewMinicard *view = GAL_VIEW_MINICARD(object);
+ GObjectClass *object_class;
+ GalViewClass *gal_view_class;
- if (view->title != NULL) {
- gal_view_minicard_detach (view);
- g_free(view->title);
- view->title = NULL;
- }
+ parent_class = g_type_class_peek_parent (class);
- if (G_OBJECT_CLASS (gal_view_minicard_parent_class)->dispose)
- (* G_OBJECT_CLASS (gal_view_minicard_parent_class)->dispose) (object);
-}
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = view_minicard_finalize;
+
+ gal_view_class = GAL_VIEW_CLASS (class);
+ gal_view_class->edit = NULL;
+ gal_view_class->load = view_minicard_load;
+ gal_view_class->save = view_minicard_save;
+ gal_view_class->get_title = view_minicard_get_title;
+ gal_view_class->set_title = view_minicard_set_title;
+ gal_view_class->get_type_code = view_minicard_get_type_code;
+ gal_view_class->clone = view_minicard_clone;
-static void
-gal_view_minicard_class_init (GObjectClass *object_class)
-{
- GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class);
- gal_view_minicard_parent_class = g_type_class_ref (PARENT_TYPE);
-
- gal_view_class->edit = NULL ;
- gal_view_class->load = gal_view_minicard_load ;
- gal_view_class->save = gal_view_minicard_save ;
- gal_view_class->get_title = gal_view_minicard_get_title ;
- gal_view_class->set_title = gal_view_minicard_set_title ;
- gal_view_class->get_type_code = gal_view_minicard_get_type_code;
- gal_view_class->clone = gal_view_minicard_clone ;
-
- object_class->dispose = gal_view_minicard_dispose ;
}
static void
-gal_view_minicard_init (GalViewMinicard *gvm)
+gal_view_minicard_init (GalViewMinicard *gvm)
{
gvm->title = NULL;
gvm->column_width = 150.0;
@@ -143,6 +200,32 @@ gal_view_minicard_init (GalViewMinicard *gvm)
gvm->emvw_column_width_changed_id = 0;
}
+GType
+gal_view_minicard_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (GalViewMinicardClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gal_view_minicard_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (GalViewMinicard),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) gal_view_minicard_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GAL_VIEW_TYPE, "GalViewMinicard", &type_info, 0);
+ }
+
+ return type;
+}
+
/**
* gal_view_minicard_new
* @title: The name of the new view.
@@ -155,7 +238,8 @@ gal_view_minicard_init (GalViewMinicard *gvm)
GalView *
gal_view_minicard_new (const gchar *title)
{
- return gal_view_minicard_construct (g_object_new (GAL_TYPE_VIEW_MINICARD, NULL), title);
+ return gal_view_minicard_construct (
+ g_object_new (GAL_TYPE_VIEW_MINICARD, NULL), title);
}
/**
@@ -163,7 +247,7 @@ gal_view_minicard_new (const gchar *title)
* @view: The view to construct.
* @title: The name of the new view.
*
- * constructs the GalViewMinicard. To be used by subclasses and
+ * Constructs the GalViewMinicard. To be used by subclasses and
* language bindings.
*
* Returns: The GalViewMinicard.
@@ -172,85 +256,49 @@ GalView *
gal_view_minicard_construct (GalViewMinicard *view,
const gchar *title)
{
- view->title = g_strdup(title);
- return GAL_VIEW(view);
-}
-
-GType
-gal_view_minicard_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (GalViewMinicardClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gal_view_minicard_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GalViewMinicard),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gal_view_minicard_init,
- };
+ view->title = g_strdup (title);
- type = g_type_register_static (PARENT_TYPE, "GalViewMinicard", &info, 0);
- }
-
- return type;
+ return GAL_VIEW (view);
}
-static void
-column_width_changed (EMinicardViewWidget *w, double width, EABView *address_view)
+void
+gal_view_minicard_attach (GalViewMinicard *view,
+ EAddressbookView *address_view)
{
- GalViewMinicard *view = GAL_VIEW_MINICARD (gal_view_instance_get_current_view (address_view->view_instance));
- GtkScrolledWindow *scrolled_window;
- GtkAdjustment *adj;
- GtkAdjustment *adj_new;
+ GObject *object;
- d(g_print("%s: Old width = %f, New width = %f\n", G_STRFUNC, view->column_width, width));
- if (view->column_width != width) {
- view->column_width = width;
- gal_view_changed(GAL_VIEW(view));
- }
+ g_return_if_fail (GAL_IS_VIEW_MINICARD (view));
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (address_view));
- scrolled_window = GTK_SCROLLED_WINDOW (address_view->widget);
- adj = gtk_scrolled_window_get_hadjustment (scrolled_window);
- adj_new = GTK_ADJUSTMENT (gtk_adjustment_new (adj->value, adj->lower, adj->upper,
- adj->page_size, adj->page_increment,
- adj->page_size));
- gtk_scrolled_window_set_hadjustment (scrolled_window, adj_new);
-}
+ object = e_addressbook_view_get_view_object (address_view);
+ g_return_if_fail (E_IS_MINICARD_VIEW_WIDGET (object));
-void
-gal_view_minicard_attach (GalViewMinicard *view, EABView *address_view)
-{
- EMinicardViewWidget *emvw = E_MINICARD_VIEW_WIDGET (address_view->object);
gal_view_minicard_detach (view);
+ view->emvw = g_object_ref (object);
- view->emvw = emvw;
-
- g_object_ref (view->emvw);
-
- g_object_set (view->emvw,
- "column_width", view->column_width,
- NULL);
+ g_object_set (view->emvw, "column-width", view->column_width, NULL);
view->emvw_column_width_changed_id =
- g_signal_connect(view->emvw, "column_width_changed",
- G_CALLBACK (column_width_changed), address_view);
+ g_signal_connect_swapped (
+ view->emvw, "column-width-changed",
+ G_CALLBACK (view_minicard_column_width_changed),
+ address_view);
}
void
gal_view_minicard_detach (GalViewMinicard *view)
{
+ g_return_if_fail (GAL_IS_VIEW_MINICARD (view));
+
if (view->emvw == NULL)
return;
- if (view->emvw_column_width_changed_id) {
- g_signal_handler_disconnect (view->emvw,
- view->emvw_column_width_changed_id);
+
+ if (view->emvw_column_width_changed_id > 0) {
+ g_signal_handler_disconnect (
+ view->emvw, view->emvw_column_width_changed_id);
view->emvw_column_width_changed_id = 0;
}
+
g_object_unref (view->emvw);
view->emvw = NULL;
}
diff --git a/addressbook/gui/widgets/gal-view-minicard.h b/addressbook/gui/widgets/gal-view-minicard.h
index cf3faaec56..c7a8c912d4 100644
--- a/addressbook/gui/widgets/gal-view-minicard.h
+++ b/addressbook/gui/widgets/gal-view-minicard.h
@@ -22,40 +22,59 @@
*
*/
-#ifndef _GAL_VIEW_MINICARD_H_
-#define _GAL_VIEW_MINICARD_H_
+#ifndef GAL_VIEW_MINICARD_H
+#define GAL_VIEW_MINICARD_H
#include <widgets/menus/gal-view.h>
#include <e-minicard-view-widget.h>
#include "e-addressbook-view.h"
-#define GAL_TYPE_VIEW_MINICARD (gal_view_minicard_get_type ())
-#define GAL_VIEW_MINICARD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_TYPE_VIEW_MINICARD, GalViewMinicard))
-#define GAL_VIEW_MINICARD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_TYPE_VIEW_MINICARD, GalViewMinicardClass))
-#define GAL_IS_VIEW_MINICARD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_TYPE_VIEW_MINICARD))
-#define GAL_IS_VIEW_MINICARD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_TYPE_VIEW_MINICARD))
+/* Standard GObject macros */
+#define GAL_TYPE_VIEW_MINICARD \
+ (gal_view_minicard_get_type ())
+#define GAL_VIEW_MINICARD(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), GAL_TYPE_VIEW_MINICARD, GalViewMinicard))
+#define GAL_VIEW_MINICARD_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), GAL_TYPE_VIEW_MINICARD, GalViewMinicardClass))
+#define GAL_IS_VIEW_MINICARD(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), GAL_TYPE_VIEW_MINICARD))
+#define GAL_IS_VIEW_MINICARD_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), GAL_TYPE_VIEW_MINICARD))
+#define GAL_VIEW_MINICARD_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), GAL_TYPE_VIEW_MINICARD, GalViewMinicardClass))
-typedef struct {
- GalView base;
+G_BEGIN_DECLS
+
+typedef struct _GalViewMinicard GalViewMinicard;
+typedef struct _GalViewMinicardClass GalViewMinicardClass;
+
+struct _GalViewMinicard {
+ GalView parent;
char *title;
double column_width;
EMinicardViewWidget *emvw;
guint emvw_column_width_changed_id;
-} GalViewMinicard;
+};
-typedef struct {
+struct _GalViewMinicardClass {
GalViewClass parent_class;
-} GalViewMinicardClass;
-
-/* Standard functions */
-GType gal_view_minicard_get_type (void);
-GalView *gal_view_minicard_new (const gchar *title);
-GalView *gal_view_minicard_construct (GalViewMinicard *view,
- const gchar *title);
-void gal_view_minicard_attach (GalViewMinicard *view,
- EABView *address_view);
-void gal_view_minicard_detach (GalViewMinicard *view);
-
-#endif /* _GAL_VIEW_MINICARD_H_ */
+};
+
+GType gal_view_minicard_get_type (void);
+GalView * gal_view_minicard_new (const gchar *title);
+GalView * gal_view_minicard_construct (GalViewMinicard *view,
+ const gchar *title);
+void gal_view_minicard_attach (GalViewMinicard *view,
+ EAddressbookView *address_view);
+void gal_view_minicard_detach (GalViewMinicard *view);
+
+G_END_DECLS
+
+#endif /* GAL_VIEW_MINICARD_H */
diff --git a/addressbook/printing/Makefile.am b/addressbook/printing/Makefile.am
index cd22b43380..f3090d6a09 100644
--- a/addressbook/printing/Makefile.am
+++ b/addressbook/printing/Makefile.am
@@ -36,12 +36,6 @@ contact_print_test_LDADD = \
$(top_builddir)/e-util/libeutil.la \
$(EVOLUTION_ADDRESSBOOK_LIBS)
-contact_print_style_editor_test_LDADD = \
- libecontactprint.la \
- $(top_builddir)/addressbook/util/libeabutil.la \
- $(top_builddir)/e-util/libeutil.la \
- $(EVOLUTION_ADDRESSBOOK_LIBS)
-
EXTRA_DIST = \
$(ecps_DATA)
diff --git a/addressbook/util/Makefile.am b/addressbook/util/Makefile.am
index ce5d6c35d7..cc78518f40 100644
--- a/addressbook/util/Makefile.am
+++ b/addressbook/util/Makefile.am
@@ -12,6 +12,8 @@ INCLUDES = \
privsolib_LTLIBRARIES = libeabutil.la
libeabutil_la_SOURCES = \
+ addressbook.c \
+ addressbook.h \
eab-book-util.c \
eab-book-util.h
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/util/addressbook.c
index f36012ab94..f36012ab94 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/util/addressbook.c
diff --git a/addressbook/gui/component/addressbook.h b/addressbook/util/addressbook.h
index 0dbd4d7a3d..7bc92ee344 100644
--- a/addressbook/gui/component/addressbook.h
+++ b/addressbook/util/addressbook.h
@@ -22,10 +22,6 @@
#ifndef __ADDRESSBOOK_H__
#define __ADDRESSBOOK_H__
-#include <bonobo/bonobo-control.h>
-#include <e-util/e-config-listener.h>
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-moniker-util.h>
#include <libebook/e-book.h>
guint addressbook_load (EBook *book, EBookCallback cb, gpointer closure);
diff --git a/addressbook/util/eab-book-util.h b/addressbook/util/eab-book-util.h
index 0cded9c662..cb59dc9085 100644
--- a/addressbook/util/eab-book-util.h
+++ b/addressbook/util/eab-book-util.h
@@ -24,8 +24,6 @@
#ifndef __EAB_UTIL_H__
#define __EAB_UTIL_H__
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-moniker-util.h>
#include <libebook/e-book.h>
#include "e-util/e-config-listener.h"
diff --git a/calendar/Makefile.am b/calendar/Makefile.am
index 87057a4d3a..5da53380b8 100644
--- a/calendar/Makefile.am
+++ b/calendar/Makefile.am
@@ -4,7 +4,7 @@ else
CONDUIT_DIR =
endif
-SUBDIRS = idl common importers gui $(CONDUIT_DIR)
+SUBDIRS = idl common importers gui $(CONDUIT_DIR) module
error_DATA = calendar.error
errordir = $(privdatadir)/errors
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 509aff1596..1b9a5d23c2 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -1,31 +1,5 @@
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = $(top_builddir)/win32/libevolution-mail.la
-endif
-
-## CORBA stuff
-
-IDLS = \
- $(top_srcdir)/calendar/idl/evolution-calendar.idl
-
-CALENDAR_IDL_GENERATED_H = \
- evolution-calendar.h
-CALENDAR_IDL_GENERATED_C = \
- evolution-calendar-common.c \
- evolution-calendar-skels.c \
- evolution-calendar-stubs.c
-CALENDAR_IDL_GENERATED = $(CALENDAR_IDL_GENERATED_C) $(CALENDAR_IDL_GENERATED_H)
-
-$(CALENDAR_IDL_GENERATED_H): $(IDLS)
- $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \
- $(top_srcdir)/calendar/idl/evolution-calendar.idl
-$(CALENDAR_IDL_GENERATED_C): $(CALENDAR_IDL_GENERATED_H)
-
-IDL_GENERATED = $(CALENDAR_IDL_GENERATED)
-
SUBDIRS = alarm-notify dialogs
-component_LTLIBRARIES = libevolution-calendar.la
-
ecalendarincludedir = $(privincludedir)/calendar/gui
ecalendarinclude_HEADERS = \
@@ -67,35 +41,34 @@ etspec_DATA = \
e-cal-list-view.etspec \
e-memo-table.etspec
-libevolution_calendar_la_SOURCES = \
- $(IDL_GENERATED) \
+privsolib_LTLIBRARIES = libcal-gui.la
+
+# Removed from SOURCES
+# cal-search-bar.c
+# cal-search-bar.h
+# gnome-cal.c
+# gnome-cal.h
+
+libcal_gui_la_SOURCES = \
e-attachment-handler-calendar.c \
e-attachment-handler-calendar.h \
- cal-search-bar.c \
- cal-search-bar.h \
+ e-calendar-view.c \
+ e-calendar-view.h \
+ e-calendar-table.c \
+ e-calendar-table.h \
calendar-config.c \
calendar-config.h \
calendar-config-keys.h \
- calendar-commands.c \
- calendar-commands.h \
- calendar-component.c \
- calendar-component.h \
calendar-view.c \
calendar-view.h \
calendar-view-factory.c \
calendar-view-factory.h \
- comp-editor-factory.c \
- comp-editor-factory.h \
comp-util.c \
comp-util.h \
- control-factory.c \
- control-factory.h \
e-alarm-list.c \
e-alarm-list.h \
e-cal-component-preview.c \
e-cal-component-preview.h \
- e-cal-component-memo-preview.c \
- e-cal-component-memo-preview.h \
e-cal-config.c \
e-cal-config.h \
e-cal-event.c \
@@ -111,18 +84,16 @@ libevolution_calendar_la_SOURCES = \
e-cal-model.h \
e-cal-popup.h \
e-cal-popup.c \
- e-calendar-view.c \
- e-calendar-view.h \
e-cal-list-view.c \
e-cal-list-view.h \
e-cal-list-view-config.c \
e-cal-list-view-config.h \
e-cal-model-memos.c \
e-cal-model-memos.h \
- e-calendar-table.c \
- e-calendar-table.h \
e-calendar-table-config.c \
e-calendar-table-config.h \
+ e-calendar-selector.c \
+ e-calendar-selector.h \
e-cell-date-edit-config.c \
e-cell-date-edit-config.h \
e-cell-date-edit-text.h \
@@ -160,18 +131,20 @@ libevolution_calendar_la_SOURCES = \
e-meeting-types.h \
e-meeting-utils.c \
e-meeting-utils.h \
+ e-memo-list-selector.c \
+ e-memo-list-selector.h \
e-memo-table.c \
e-memo-table.h \
e-memo-table-config.c \
e-memo-table-config.h \
- e-memos.c \
- e-memos.h \
e-mini-calendar-config.c \
e-mini-calendar-config.h \
e-select-names-editable.c \
e-select-names-editable.h \
e-select-names-renderer.c \
e-select-names-renderer.h \
+ e-task-list-selector.c \
+ e-task-list-selector.h \
e-week-view-config.c \
e-week-view-config.h \
e-week-view-event-item.c \
@@ -184,60 +157,67 @@ libevolution_calendar_la_SOURCES = \
e-week-view-titles-item.h \
e-week-view.c \
e-week-view.h \
- e-tasks.c \
- e-tasks.h \
e-timezone-entry.c \
e-timezone-entry.h \
- gnome-cal.c \
- gnome-cal.h \
goto.c \
goto.h \
- itip-bonobo-control.c \
- itip-bonobo-control.h \
itip-utils.c \
itip-utils.h \
- main.c \
- memos-component.c \
- memos-component.h \
- memos-control.c \
- memos-control.h \
- migration.c \
- migration.h \
misc.c \
misc.h \
print.c \
print.h \
tag-calendar.c \
tag-calendar.h \
- tasks-component.c \
- tasks-component.h \
- tasks-control.c \
- tasks-control.h \
weekday-picker.c \
weekday-picker.h
-libevolution_calendar_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
+# no gnome-cal no a11y. FIXME: KILL-BONOBO
+# a11y/ea-calendar.c \
+# a11y/ea-calendar.h \
+# a11y/ea-calendar-helpers.c \
+# a11y/ea-calendar-helpers.h \
+# a11y/ea-cal-view.c \
+# a11y/ea-cal-view.h \
+# a11y/ea-cal-view-event.c \
+# a11y/ea-cal-view-event.h \
+# a11y/ea-day-view.c \
+# a11y/ea-day-view.h \
+# a11y/ea-day-view-main-item.c \
+# a11y/ea-day-view-main-item.h \
+# a11y/ea-day-view-cell.c \
+# a11y/ea-day-view-cell.h \
+# a11y/ea-week-view.c \
+# a11y/ea-week-view.h \
+# a11y/ea-week-view-main-item.c \
+# a11y/ea-week-view-main-item.h \
+# a11y/ea-week-view-cell.c \
+# a11y/ea-week-view-cell.h \
+# a11y/ea-jump-button.c \
+# a11y/ea-jump-button.h \
+# a11y/ea-gnome-calendar.c \
+# a11y/ea-gnome-calendar.h
+
+libcal_gui_la_LIBADD = \
+ $(top_builddir)/composer/libcomposer.la \
+ $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \
+ $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \
$(top_builddir)/widgets/menus/libmenus.la \
$(top_builddir)/shell/libeshell.la \
$(top_builddir)/calendar/common/libevolution-calendarprivate.la \
$(top_builddir)/calendar/gui/dialogs/libcal-dialogs.la \
$(top_builddir)/calendar/importers/libevolution-calendar-importers.la \
$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la \
- $(top_builddir)/widgets/misc/libefilterbar.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/widgets/table/libetable.la \
$(top_builddir)/filter/libfilter.la \
$(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/a11y/calendar/libevolution-calendar-a11y.la \
$(LIBSOUP_LIBS) \
$(CAMEL_LIBS) \
$(EVOLUTION_CALENDAR_LIBS)
-libevolution_calendar_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
+libcal_gui_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
-server_in_files = GNOME_Evolution_Calendar.server.in.in
-server_DATA = $(server_in_files:.server.in.in=.server)
-@EVO_SERVER_RULE@
@INTLTOOL_SERVER_RULE@
# GConf schemas
@@ -252,10 +232,8 @@ EXTRA_DIST = \
$(glade_DATA) \
$(schema_in_files) \
$(etspec_DATA) \
- $(server_in_files) \
$(search_files)
-BUILT_SOURCES = $(IDL_GENERATED) $(server_DATA)
CLEANFILES = $(BUILT_SOURCES)
DISTCLEANFILES = $(schema_DATA)
diff --git a/a11y/calendar/ea-cal-view-event.c b/calendar/gui/a11y/ea-cal-view-event.c
index e0c0f8fdac..e0c0f8fdac 100644
--- a/a11y/calendar/ea-cal-view-event.c
+++ b/calendar/gui/a11y/ea-cal-view-event.c
diff --git a/a11y/calendar/ea-cal-view-event.h b/calendar/gui/a11y/ea-cal-view-event.h
index fccf023a82..fccf023a82 100644
--- a/a11y/calendar/ea-cal-view-event.h
+++ b/calendar/gui/a11y/ea-cal-view-event.h
diff --git a/a11y/calendar/ea-cal-view.c b/calendar/gui/a11y/ea-cal-view.c
index 7e337ac16b..7e337ac16b 100644
--- a/a11y/calendar/ea-cal-view.c
+++ b/calendar/gui/a11y/ea-cal-view.c
diff --git a/a11y/calendar/ea-cal-view.h b/calendar/gui/a11y/ea-cal-view.h
index 9aa026ef6d..9aa026ef6d 100644
--- a/a11y/calendar/ea-cal-view.h
+++ b/calendar/gui/a11y/ea-cal-view.h
diff --git a/a11y/calendar/ea-calendar-helpers.c b/calendar/gui/a11y/ea-calendar-helpers.c
index f07cdfa086..f07cdfa086 100644
--- a/a11y/calendar/ea-calendar-helpers.c
+++ b/calendar/gui/a11y/ea-calendar-helpers.c
diff --git a/a11y/calendar/ea-calendar-helpers.h b/calendar/gui/a11y/ea-calendar-helpers.h
index a4045cd7af..a4045cd7af 100644
--- a/a11y/calendar/ea-calendar-helpers.h
+++ b/calendar/gui/a11y/ea-calendar-helpers.h
diff --git a/a11y/calendar/ea-calendar.c b/calendar/gui/a11y/ea-calendar.c
index 26e73da6da..2662f42283 100644
--- a/a11y/calendar/ea-calendar.c
+++ b/calendar/gui/a11y/ea-calendar.c
@@ -23,7 +23,7 @@
#include <text/e-text.h>
#include <libgnomecanvas/gnome-canvas-pixbuf.h>
#include "ea-calendar-helpers.h"
-#include "ea-factory.h"
+#include "a11y/ea-factory.h"
#include "ea-calendar.h"
#include "calendar/ea-cal-view.h"
diff --git a/a11y/calendar/ea-calendar.h b/calendar/gui/a11y/ea-calendar.h
index b2238ffdbc..b2238ffdbc 100644
--- a/a11y/calendar/ea-calendar.h
+++ b/calendar/gui/a11y/ea-calendar.h
diff --git a/a11y/calendar/ea-day-view-cell.c b/calendar/gui/a11y/ea-day-view-cell.c
index bc303f380f..3555723b13 100644
--- a/a11y/calendar/ea-day-view-cell.c
+++ b/calendar/gui/a11y/ea-day-view-cell.c
@@ -24,7 +24,7 @@
#include "ea-day-view-cell.h"
#include "ea-day-view-main-item.h"
#include "ea-day-view.h"
-#include "ea-factory.h"
+#include "a11y/ea-factory.h"
/* EDayViewCell */
diff --git a/a11y/calendar/ea-day-view-cell.h b/calendar/gui/a11y/ea-day-view-cell.h
index e0394c639b..e0394c639b 100644
--- a/a11y/calendar/ea-day-view-cell.h
+++ b/calendar/gui/a11y/ea-day-view-cell.h
diff --git a/a11y/calendar/ea-day-view-main-item.c b/calendar/gui/a11y/ea-day-view-main-item.c
index 783710dc61..783710dc61 100644
--- a/a11y/calendar/ea-day-view-main-item.c
+++ b/calendar/gui/a11y/ea-day-view-main-item.c
diff --git a/a11y/calendar/ea-day-view-main-item.h b/calendar/gui/a11y/ea-day-view-main-item.h
index 0ee7b5e0d1..0ee7b5e0d1 100644
--- a/a11y/calendar/ea-day-view-main-item.h
+++ b/calendar/gui/a11y/ea-day-view-main-item.h
diff --git a/a11y/calendar/ea-day-view.c b/calendar/gui/a11y/ea-day-view.c
index 107f983bb0..107f983bb0 100644
--- a/a11y/calendar/ea-day-view.c
+++ b/calendar/gui/a11y/ea-day-view.c
diff --git a/a11y/calendar/ea-day-view.h b/calendar/gui/a11y/ea-day-view.h
index 011064a764..011064a764 100644
--- a/a11y/calendar/ea-day-view.h
+++ b/calendar/gui/a11y/ea-day-view.h
diff --git a/a11y/calendar/ea-gnome-calendar.c b/calendar/gui/a11y/ea-gnome-calendar.c
index 4d6e752b8e..4d6e752b8e 100644
--- a/a11y/calendar/ea-gnome-calendar.c
+++ b/calendar/gui/a11y/ea-gnome-calendar.c
diff --git a/a11y/calendar/ea-gnome-calendar.h b/calendar/gui/a11y/ea-gnome-calendar.h
index 56e695a684..56e695a684 100644
--- a/a11y/calendar/ea-gnome-calendar.h
+++ b/calendar/gui/a11y/ea-gnome-calendar.h
diff --git a/a11y/calendar/ea-jump-button.c b/calendar/gui/a11y/ea-jump-button.c
index 7888196b8d..7888196b8d 100644
--- a/a11y/calendar/ea-jump-button.c
+++ b/calendar/gui/a11y/ea-jump-button.c
diff --git a/a11y/calendar/ea-jump-button.h b/calendar/gui/a11y/ea-jump-button.h
index cb2bea315d..cb2bea315d 100644
--- a/a11y/calendar/ea-jump-button.h
+++ b/calendar/gui/a11y/ea-jump-button.h
diff --git a/a11y/calendar/ea-week-view-cell.c b/calendar/gui/a11y/ea-week-view-cell.c
index 4c7a591121..b45cf66e94 100644
--- a/a11y/calendar/ea-week-view-cell.c
+++ b/calendar/gui/a11y/ea-week-view-cell.c
@@ -24,7 +24,7 @@
#include "ea-week-view-cell.h"
#include "ea-week-view-main-item.h"
-#include "ea-factory.h"
+#include "a11y/ea-factory.h"
/* EWeekViewCell */
diff --git a/a11y/calendar/ea-week-view-cell.h b/calendar/gui/a11y/ea-week-view-cell.h
index 4cd2971b80..4cd2971b80 100644
--- a/a11y/calendar/ea-week-view-cell.h
+++ b/calendar/gui/a11y/ea-week-view-cell.h
diff --git a/a11y/calendar/ea-week-view-main-item.c b/calendar/gui/a11y/ea-week-view-main-item.c
index ae507df235..ae507df235 100644
--- a/a11y/calendar/ea-week-view-main-item.c
+++ b/calendar/gui/a11y/ea-week-view-main-item.c
diff --git a/a11y/calendar/ea-week-view-main-item.h b/calendar/gui/a11y/ea-week-view-main-item.h
index 2093de10bd..2093de10bd 100644
--- a/a11y/calendar/ea-week-view-main-item.h
+++ b/calendar/gui/a11y/ea-week-view-main-item.h
diff --git a/a11y/calendar/ea-week-view.c b/calendar/gui/a11y/ea-week-view.c
index 1d88e40c46..1d88e40c46 100644
--- a/a11y/calendar/ea-week-view.c
+++ b/calendar/gui/a11y/ea-week-view.c
diff --git a/a11y/calendar/ea-week-view.h b/calendar/gui/a11y/ea-week-view.h
index 5a83276059..5a83276059 100644
--- a/a11y/calendar/ea-week-view.h
+++ b/calendar/gui/a11y/ea-week-view.h
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index c293bf74a8..51aad370d6 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -904,6 +904,7 @@ create_snooze (CompQueuedAlarms *cqa, gpointer alarm_id, int snooze_mins)
static void
edit_component (ECal *client, ECalComponent *comp)
{
+#if 0 /* KILL-BONOBO */
const char *uid;
const char *uri;
ECalSourceType source_type;
@@ -947,6 +948,7 @@ edit_component (ECal *client, ECalComponent *comp)
/* Get rid of the factory */
bonobo_object_release_unref (factory, NULL);
+#endif
}
typedef struct {
diff --git a/calendar/gui/apps_evolution_calendar.schemas.in b/calendar/gui/apps_evolution_calendar.schemas.in
index 48c5100ad8..6e5e057c14 100644
--- a/calendar/gui/apps_evolution_calendar.schemas.in
+++ b/calendar/gui/apps_evolution_calendar.schemas.in
@@ -268,11 +268,11 @@
</locale>
</schema>
<schema>
- <key>/schemas/apps/evolution/calendar/display/tag_vpane_position</key>
- <applyto>/apps/evolution/calendar/display/tag_vpane_position</applyto>
+ <key>/schemas/apps/evolution/calendar/display/date_navigator_pane_position</key>
+ <applyto>/apps/evolution/calendar/display/date_navigator_pane_position</applyto>
<owner>evolution-calendar</owner>
- <type>float</type>
- <default>0.5</default>
+ <type>int</type>
+ <default>150</default>
<locale name="C">
<short>Month view vertical pane position </short>
<long>Position of the vertical pane, between the calendar lists and the date navigator calendar.</long>
@@ -293,13 +293,25 @@
</schema>
<schema>
+ <key>/schemas/apps/evolution/calendar/display/memo_vpane_position</key>
+ <applyto>/apps/evolution/calendar/display/memo_vpane_position</applyto>
+ <owner>evolution-calendar</owner>
+ <type>int</type>
+ <default>400</default>
+ <locale name="C">
+ <short>Memos vertical pane position</short>
+ <long>Position of the vertical pane, between the memo list and the memo preview pane, in pixels.</long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/evolution/calendar/display/task_vpane_position</key>
<applyto>/apps/evolution/calendar/display/task_vpane_position</applyto>
<owner>evolution-calendar</owner>
<type>int</type>
<default>400</default>
<locale name="C">
- <short>Tasks vertical pane position </short>
+ <short>Tasks vertical pane position</short>
<long>Position of the vertical pane, between the task list and the task preview pane, in pixels.</long>
</locale>
</schema>
diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c
index 6183d873ba..40359d14dc 100644
--- a/calendar/gui/cal-search-bar.c
+++ b/calendar/gui/cal-search-bar.c
@@ -72,12 +72,12 @@ enum {
/* Comments are disabled because they are kind of useless right now, see bug 33247 */
static ESearchBarItem search_option_items[] = {
- { (gchar *) N_("Summary contains"), SEARCH_SUMMARY_CONTAINS, ESB_ITEMTYPE_RADIO },
- { (gchar *) N_("Description contains"), SEARCH_DESCRIPTION_CONTAINS, ESB_ITEMTYPE_RADIO },
- { (gchar *) N_("Category is"), SEARCH_CATEGORY_IS, ESB_ITEMTYPE_RADIO },
- { (gchar *) N_("Comment contains"), SEARCH_COMMENT_CONTAINS, ESB_ITEMTYPE_RADIO },
- { (gchar *) N_("Location contains"), SEARCH_LOCATION_CONTAINS, ESB_ITEMTYPE_RADIO },
- { (gchar *) N_("Any field contains"), SEARCH_ANY_FIELD_CONTAINS, ESB_ITEMTYPE_RADIO },
+ { N_("Summary contains"), SEARCH_SUMMARY_CONTAINS },
+ { N_("Description contains"), SEARCH_DESCRIPTION_CONTAINS },
+ { N_("Category is"), SEARCH_CATEGORY_IS },
+ { N_("Comment contains"), SEARCH_COMMENT_CONTAINS },
+ { N_("Location contains"), SEARCH_LOCATION_CONTAINS },
+ { N_("Any field contains"), SEARCH_ANY_FIELD_CONTAINS },
};
/* IDs for the categories suboptions */
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index e69cd463ea..9f00044a4b 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -66,53 +66,6 @@ typedef struct {
guint taskpad_focused : 1;
} FocusData;
-static void
-file_open_event_cb (BonoboUIComponent *uic, gpointer data, const char *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- e_calendar_view_open_event (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)));
-}
-
-
-/* Prints the calendar at its current view and time range */
-void
-calendar_command_print (GnomeCalendar *gcal, GtkPrintOperationAction action)
-{
- if (gnome_calendar_get_view (gcal) == GNOME_CAL_LIST_VIEW) {
- ECalListView *list_view;
- ETable *table;
-
- list_view = E_CAL_LIST_VIEW (gnome_calendar_get_current_view_widget (gcal));
- table = e_table_scrolled_get_table (list_view->table_scrolled);
- print_table (table, _("Print"), _("Calendar"), action);
- } else {
- time_t start;
-
- gnome_calendar_get_current_time_range (gcal, &start, NULL);
- print_calendar (gcal, action, start);
- }
-}
-
-/* File/Print callback */
-static void
-file_print_cb (BonoboUIComponent *uic, gpointer data, const char *path)
-{
- GnomeCalendar *gcal = GNOME_CALENDAR (data);
-
- calendar_command_print (gcal, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-}
-
-static void
-file_print_preview_cb (BonoboUIComponent *uic, gpointer data, const char *path)
-{
- GnomeCalendar *gcal = GNOME_CALENDAR (data);
-
- calendar_command_print (gcal, GTK_PRINT_OPERATION_ACTION_PREVIEW);
-}
-
/* Sets a clock cursor for the specified calendar window */
static void
set_clock_cursor (GnomeCalendar *gcal)
@@ -134,58 +87,6 @@ set_normal_cursor (GnomeCalendar *gcal)
}
static void
-previous_clicked (BonoboUIComponent *uic, gpointer data, const char *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- set_clock_cursor (gcal);
- gnome_calendar_previous (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
-next_clicked (BonoboUIComponent *uic, gpointer data, const char *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- set_clock_cursor (gcal);
- gnome_calendar_next (gcal);
- set_normal_cursor (gcal);
-}
-
-void
-calendar_goto_today (GnomeCalendar *gcal)
-{
- set_clock_cursor (gcal);
- gnome_calendar_goto_today (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
-today_clicked (BonoboUIComponent *uic, gpointer data, const char *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- calendar_goto_today (gcal);
-}
-
-static void
-goto_clicked (BonoboUIComponent *uic, gpointer data, const char *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- goto_dialog (gcal);
-}
-
-static void
show_day_view_clicked (BonoboUIComponent *uic, gpointer data, const char *path)
{
GnomeCalendar *gcal;
@@ -238,65 +139,6 @@ show_list_view_clicked (BonoboUIComponent *uic, gpointer data, const char *path)
static void
-cut_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
- set_clock_cursor (gcal);
- gnome_calendar_cut_clipboard (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
-copy_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- set_clock_cursor (gcal);
- gnome_calendar_copy_clipboard (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
-paste_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- set_clock_cursor (gcal);
- gnome_calendar_paste_clipboard (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
-delete_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- set_clock_cursor (gcal);
- gnome_calendar_delete_selection (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
-delete_occurrence_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- set_clock_cursor (gcal);
- gnome_calendar_delete_selected_occurrence (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
purge_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path)
{
GnomeCalendar *gcal;
@@ -368,69 +210,6 @@ sensitize_items(BonoboUIComponent *uic, struct _sensitize_item *items, guint32 m
}
}
-static struct _sensitize_item calendar_sensitize_table[] = {
- { "EventOpen", E_CAL_MENU_SELECT_ONE },
- { "Cut", E_CAL_MENU_SELECT_EDITABLE },
- { "Copy", E_CAL_MENU_SELECT_ANY },
- { "Paste", E_CAL_MENU_SELECT_EDITABLE },
- { "Delete", E_CAL_MENU_SELECT_EDITABLE|E_CAL_MENU_SELECT_NONRECURRING },
- { "DeleteOccurrence", E_CAL_MENU_SELECT_EDITABLE|E_CAL_MENU_SELECT_RECURRING },
- { "DeleteAllOccurrences", E_CAL_MENU_SELECT_EDITABLE|E_CAL_MENU_SELECT_RECURRING },
- { NULL }
-};
-
-/* Sensitizes the UI Component menu/toolbar calendar commands based on the
- * number of selected events. (This will always be 0 or 1 currently.) If enable
- * is FALSE, all will be disabled. Otherwise, the currently-selected number of
- * events will be used.
- */
-void
-calendar_control_sensitize_calendar_commands (BonoboControl *control, GnomeCalendar *gcal, gboolean enable)
-{
- BonoboUIComponent *uic;
- GtkWidget *view;
- ECalMenu *menu;
- ECalModel *model;
- GPtrArray *events;
- GList *selected, *l;
- ECalMenuTargetSelect *t;
-
- uic = bonobo_control_get_ui_component (control);
- g_return_if_fail (uic != NULL);
-
- if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL)
- return;
-
- view = gnome_calendar_get_current_view_widget (gcal);
-
- menu = gnome_calendar_get_calendar_menu (gcal);
- model = e_calendar_view_get_model((ECalendarView *)view);
- events = g_ptr_array_new();
- selected = e_calendar_view_get_selected_events((ECalendarView *)view);
- for (l=selected;l;l=g_list_next(l)) {
- ECalendarViewEvent *event = l->data;
- if (event && event->comp_data)
- g_ptr_array_add (events, e_cal_model_copy_component_data(event->comp_data));
- }
- g_list_free(selected);
-
- t = e_cal_menu_target_new_select(menu, model, events);
- if (!enable)
- t->target.mask = ~0;
-
- sensitize_items(uic, calendar_sensitize_table, t->target.mask);
-#if 0
- /* retrieve read-onlyness of the default client */
- e_cal = e_cal_model_get_default_client (gnome_calendar_get_calendar_model (gcal));
- if (e_cal)
- e_cal_is_read_only (e_cal, &default_read_only, NULL);
- else
- default_read_only = TRUE;
-#endif
-
- e_menu_update_target((EMenu *)menu, (EMenuTarget *)t);
-}
-
static struct _sensitize_item taskpad_sensitize_table[] = {
{ "Cut", E_CAL_MENU_SELECT_EDITABLE },
{ "Copy", E_CAL_MENU_SELECT_ANY },
@@ -558,21 +337,6 @@ help_debug (BonoboUIComponent *uid, void *data, const char *path)
}
static BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("EventOpen", file_open_event_cb),
- BONOBO_UI_VERB ("CalendarPrint", file_print_cb),
- BONOBO_UI_VERB ("CalendarPrintPreview", file_print_preview_cb),
-
- BONOBO_UI_VERB ("Cut", cut_cmd),
- BONOBO_UI_VERB ("Copy", copy_cmd),
- BONOBO_UI_VERB ("Paste", paste_cmd),
- BONOBO_UI_VERB ("Delete", delete_cmd),
- BONOBO_UI_VERB ("DeleteOccurrence", delete_occurrence_cmd),
- BONOBO_UI_VERB ("DeleteAllOccurrences", delete_cmd),
-
- BONOBO_UI_VERB ("CalendarPrev", previous_clicked),
- BONOBO_UI_VERB ("CalendarToday", today_clicked),
- BONOBO_UI_VERB ("CalendarNext", next_clicked),
- BONOBO_UI_VERB ("CalendarGoto", goto_clicked),
BONOBO_UI_VERB ("ShowDayView", show_day_view_clicked),
BONOBO_UI_VERB ("ShowWorkWeekView", show_work_week_view_clicked),
@@ -585,35 +349,6 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_VERB_END
};
-static EPixmap pixmaps [] = {
- E_PIXMAP ("/commands/CalendarPrev", "go-previous", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/CalendarPrint", "document-print", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/DeleteAllOccurrences", "edit-delete", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/DeleteOccurrence", "edit-delete", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/CalendarGoto", "go-jump", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/CalendarNext", "go-next", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/CalendarPrintPreview", "document-print-preview", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/Copy", "edit-copy", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/Cut", "edit-cut", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/Delete", "edit-delete", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/Paste", "edit-paste", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/CalendarToday", "go-today", GTK_ICON_SIZE_MENU),
-
- E_PIXMAP ("/Toolbar/Print", "document-print", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Delete", "edit-delete", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Prev", "go-previous", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Next", "go-next", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Goto", "go-jump", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/DayView", "view-calendar-day", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/WorkWeekView", "view-calendar-workweek", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/WeekView", "view-calendar-week", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/MonthView", "view-calendar-month", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/ListView", "view-calendar-list", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Today", "go-today", GTK_ICON_SIZE_LARGE_TOOLBAR),
-
- E_PIXMAP_END
-};
-
void
calendar_control_activate (BonoboControl *control,
GnomeCalendar *gcal)
@@ -645,8 +380,6 @@ calendar_control_activate (BonoboControl *control,
NULL);
g_free (xmlfile);
- e_pixmaps_update (uic, pixmaps);
-
gnome_calendar_setup_view_menus (gcal, uic);
g_signal_connect (gcal, "calendar_focus_change",
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index bca0832bac..eef60cfdb6 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -65,26 +65,9 @@
#define CREATE_MEETING_ID "meeting"
#define CREATE_ALLDAY_EVENT_ID "allday-event"
#define CREATE_CALENDAR_ID "calendar"
-#define WEB_BASE_URI "webcal://"
-#define CONTACTS_BASE_URI "contacts://"
-#define WEATHER_BASE_URI "weather://"
-#define PERSONAL_RELATIVE_URI "system"
#define CALENDAR_ERROR_LEVEL_KEY "/apps/evolution/calendar/display/error_level"
#define CALENDAR_ERROR_TIME_OUT_KEY "/apps/evolution/calendar/display/error_timeout"
-enum DndTargetType {
- DND_TARGET_TYPE_CALENDAR_LIST
-};
-#define CALENDAR_TYPE "text/calendar"
-#define XCALENDAR_TYPE "text/x-calendar"
-static GtkTargetEntry drag_types[] = {
- { (gchar *) CALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST },
- { (gchar *) XCALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST }
-};
-static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]);
-#define CALENDAR_COMPONENT_DEFAULT(cc) if (cc == NULL) cc = calendar_component_peek()
-#define PARENT_TYPE bonobo_object_get_type ()
-
static BonoboObjectClass *parent_class = NULL;
typedef struct
@@ -99,27 +82,17 @@ typedef struct
GnomeCalendar *calendar;
- EInfoLabel *info_label;
GtkWidget *source_selector;
BonoboControl *view_control;
- BonoboControl *sidebar_control;
- BonoboControl *statusbar_control;
GList *notifications;
- EUserCreatableItemsHandler *creatable_items_handler;
-
- EActivityHandler *activity_handler;
-
float vpane_pos;
} CalendarComponentView;
struct _CalendarComponentPrivate {
- char *base_directory;
- char *config_directory;
- GConfClient *gconf_client;
int gconf_notify_id;
ESourceList *source_list;
@@ -136,9 +109,6 @@ struct _CalendarComponentPrivate {
GList *notifications;
};
-/* FIXME This should be gnome cal likely */
-extern ECompEditorRegistry *comp_editor_registry;
-
static void
calcomp_vpane_realized (GtkWidget *vpane, CalendarComponentView *view)
{
@@ -156,158 +126,6 @@ calcomp_vpane_resized (GtkWidget *vpane, GdkEventButton *e, CalendarComponentVie
return FALSE;
}
-static void
-ensure_sources (CalendarComponent *component)
-{
- ESourceList *source_list;
- ESourceGroup *on_this_computer;
- ESourceGroup *contacts;
- ESource *personal_source;
- ESource *birthdays_source;
- char *base_uri, *base_uri_proto, base_uri_proto_seventh;
- const gchar *base_dir;
- gchar *create_source;
-
- personal_source = NULL;
- birthdays_source = NULL;
-
- if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) {
- g_warning ("Could not get calendar source list from GConf!");
- return;
- }
-
- base_dir = calendar_component_peek_base_directory (component);
- base_uri = g_build_filename (base_dir, "local", NULL);
-
- base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
- if (strlen (base_uri_proto) > 7) {
- /* compare only file:// part. If user home dir name changes we do not want to create
- one more group */
- base_uri_proto_seventh = base_uri_proto[7];
- base_uri_proto[7] = 0;
- } else {
- base_uri_proto_seventh = -1;
- }
-
- on_this_computer = e_source_list_ensure_group (source_list, _("On This Computer"), base_uri_proto, TRUE);
- contacts = e_source_list_ensure_group (source_list, _("Contacts"), CONTACTS_BASE_URI, TRUE);
- e_source_list_ensure_group (source_list, _("On The Web"), WEB_BASE_URI, FALSE);
- e_source_list_ensure_group (source_list, _("Weather"), WEATHER_BASE_URI, FALSE);
-
- if (base_uri_proto_seventh != -1) {
- base_uri_proto[7] = base_uri_proto_seventh;
- }
-
- if (on_this_computer) {
- /* make sure "Personal" shows up as a source under
- this group */
- GSList *sources = e_source_group_peek_sources (on_this_computer);
- GSList *s;
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
- const gchar *relative_uri;
-
- relative_uri = e_source_peek_relative_uri (source);
- if (relative_uri == NULL)
- continue;
- if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
- personal_source = source;
- break;
- }
- }
- /* Make sure we have the correct base uri. This can change when user's
- homedir name changes */
- if (strcmp (base_uri_proto, e_source_group_peek_base_uri (on_this_computer))) {
- e_source_group_set_base_uri (on_this_computer, base_uri_proto);
-
- /* *sigh* . We shouldn't need this sync call here as set_base_uri
- call results in synching to gconf, but that happens in idle loop
- and too late to prevent user seeing "Can not Open ... because of invalid uri" error.*/
- e_source_list_sync (source_list,NULL);
- }
- }
-
- if (personal_source) {
- /* ensure the source name is in current locale, not read from configuration */
- e_source_set_name (personal_source, _("Personal"));
- } else {
- char *primary_calendar = calendar_config_get_primary_calendar();
- GSList *calendars_selected;
-
- /* Create the default Person addressbook */
- personal_source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
- e_source_group_add_source (on_this_computer, personal_source, -1);
- g_object_unref (personal_source);
-
- calendars_selected = calendar_config_get_calendars_selected ();
- if (!primary_calendar && !calendars_selected) {
- GSList selected;
-
- calendar_config_set_primary_calendar (e_source_peek_uid (personal_source));
-
- selected.data = (gpointer)e_source_peek_uid (personal_source);
- selected.next = NULL;
- calendar_config_set_calendars_selected (&selected);
- }
-
- if (calendars_selected) {
- g_slist_foreach (calendars_selected, (GFunc) g_free, NULL);
- g_slist_free (calendars_selected);
- }
-
- g_free (primary_calendar);
- e_source_set_color_spec (personal_source, "#BECEDD");
- }
-
- if (contacts) {
- GSList *sources = e_source_group_peek_sources (contacts);
- if (sources) {
- birthdays_source = E_SOURCE (sources->data); /* There is only one source under Contacts Group*/
-
- if (sources->next) {
- /* Ensure we have only one contacts source - we was able to create more than one before */
- GSList *l = NULL, *p;
-
- for (p = sources->next; p; p = p->next)
- l = g_slist_prepend (l, p->data);
-
- for (p = l; p; p = p->next)
- e_source_group_remove_source (contacts, p->data);
-
- g_slist_free (l);
- }
- }
- }
-
- create_source = e_source_group_get_property (contacts, "create_source");
- if (!create_source)
- e_source_group_set_property (contacts, "create_source", "no");
- g_free (create_source);
-
- if (birthdays_source) {
- /* ensure the source name is in current locale, not read from configuration */
- e_source_set_name (birthdays_source, _("Birthdays & Anniversaries"));
- } else {
- birthdays_source = e_source_new (_("Birthdays & Anniversaries"), "/");
- e_source_group_add_source (contacts, birthdays_source, -1);
- g_object_unref (birthdays_source);
- }
-
- if (!e_source_get_property (birthdays_source, "delete"))
- e_source_set_property(birthdays_source, "delete", "no");
-
- if (e_source_peek_color_spec (birthdays_source) == NULL)
- e_source_set_color_spec (birthdays_source, "#DDBECE");
-
- component->priv->source_list = source_list;
-
- g_object_unref (on_this_computer);
- g_object_unref (contacts);
- g_free (base_uri_proto);
- g_free (base_uri);
-}
-
-
/* Utility functions. */
static gboolean
@@ -341,88 +159,6 @@ is_in_uids (GSList *uids, ESource *source)
}
static void
-update_uris_for_selection (CalendarComponentView *component_view)
-{
- GSList *selection, *l, *uids_selected = NULL;
-
- selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (component_view->source_selector));
-
- for (l = component_view->source_selection; l; l = l->next) {
- ESource *old_selected_source = l->data;
-
- if (!is_in_selection (selection, old_selected_source))
- gnome_calendar_remove_source (component_view->calendar, E_CAL_SOURCE_TYPE_EVENT, old_selected_source);
- }
-
- for (l = selection; l; l = l->next) {
- ESource *selected_source = l->data;
-
- if (gnome_calendar_add_source (component_view->calendar, E_CAL_SOURCE_TYPE_EVENT, selected_source))
- uids_selected = g_slist_append (uids_selected, (char *) e_source_peek_uid (selected_source));
- }
-
- e_source_selector_free_selection (component_view->source_selection);
- component_view->source_selection = selection;
-
- /* Save the selection for next time we start up */
- calendar_config_set_calendars_selected (uids_selected);
- g_slist_free (uids_selected);
-}
-
-static void
-update_uri_for_primary_selection (CalendarComponentView *component_view)
-{
- ESource *source;
-
- source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!source)
- return;
-
- /* Set the default */
- gnome_calendar_set_default_source (component_view->calendar, E_CAL_SOURCE_TYPE_EVENT, source);
-
- /* Make sure we are embedded first */
- calendar_control_sensitize_calendar_commands (component_view->view_control, component_view->calendar, TRUE);
-
- /* Save the selection for next time we start up */
- calendar_config_set_primary_calendar (e_source_peek_uid (source));
-}
-
-static void
-update_selection (CalendarComponentView *component_view)
-{
- GSList *selection, *uids_selected, *l;
-
- /* Get the selection in gconf */
- uids_selected = calendar_config_get_calendars_selected ();
-
- /* Remove any that aren't there any more */
- selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (component_view->source_selector));
-
- for (l = selection; l; l = l->next) {
- ESource *source = l->data;
-
- if (!is_in_uids (uids_selected, source))
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
- }
-
- e_source_selector_free_selection (selection);
-
- /* Make sure the whole selection is there */
- for (l = uids_selected; l; l = l->next) {
- char *uid = l->data;
- ESource *source;
-
- source = e_source_list_peek_source_by_uid (component_view->source_list, uid);
- if (source)
- e_source_selector_select_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
-
- g_free (uid);
- }
- g_slist_free (uids_selected);
-}
-
-static void
update_task_memo_selection (CalendarComponentView *component_view, ECalSourceType type)
{
GSList *uids_selected, *l, *source_selection;
@@ -472,28 +208,6 @@ update_task_memo_selection (CalendarComponentView *component_view, ECalSourceTyp
}
static void
-update_primary_selection (CalendarComponentView *component_view)
-{
- ESource *source = NULL;
- char *uid;
-
- uid = calendar_config_get_primary_calendar ();
- if (uid) {
- source = e_source_list_peek_source_by_uid (component_view->source_list, uid);
- g_free (uid);
- }
-
- if (source) {
- e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector), source);
- } else {
- /* Try to create a default if there isn't one */
- source = e_source_list_peek_source_any (component_view->source_list);
- if (source)
- e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector), source);
- }
-}
-
-static void
update_primary_task_memo_selection (CalendarComponentView *component_view, ECalSourceType type)
{
ESource *source = NULL;
@@ -518,314 +232,6 @@ update_primary_task_memo_selection (CalendarComponentView *component_view, ECalS
gnome_calendar_set_default_source (component_view->calendar, type, source);
}
-/* Callbacks. */
-static void
-copy_calendar_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- CalendarComponentView *component_view = data;
- ESource *selected_source;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- copy_source_dialog (GTK_WINDOW (gtk_widget_get_toplevel (ep->target->widget)), selected_source, E_CAL_SOURCE_TYPE_EVENT);
-}
-
-static void
-delete_calendar_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- CalendarComponentView *component_view = data;
- ESource *selected_source;
- ECal *cal;
- char *uri;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- if (e_error_run((GtkWindow *)gtk_widget_get_toplevel(ep->target->widget),
- "calendar:prompt-delete-calendar", e_source_peek_name(selected_source), NULL) != GTK_RESPONSE_YES)
- return;
-
- /* first, ask the backend to remove the calendar */
- uri = e_source_get_uri (selected_source);
- cal = e_cal_model_get_client_for_uri (gnome_calendar_get_calendar_model (component_view->calendar), uri);
- if (!cal)
- cal = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_EVENT);
- g_free (uri);
- if (cal) {
- if (e_cal_remove (cal, NULL)) {
- if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (component_view->source_selector),
- selected_source)) {
- gnome_calendar_remove_source (component_view->calendar, E_CAL_SOURCE_TYPE_EVENT, selected_source);
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector),
- selected_source);
- }
-
- e_source_group_remove_source (e_source_peek_group (selected_source), selected_source);
- e_source_list_sync (component_view->source_list, NULL);
- }
- }
-}
-
-static void
-new_calendar_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- calendar_setup_edit_calendar (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), NULL, pitem->user_data);
-}
-
-static void
-rename_calendar_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- CalendarComponentView *component_view = data;
- ESourceSelector *selector;
-
- selector = E_SOURCE_SELECTOR (component_view->source_selector);
- e_source_selector_edit_primary_selection (selector);
-}
-
-static void
-edit_calendar_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- CalendarComponentView *component_view = data;
- ESource *selected_source;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- calendar_setup_edit_calendar (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), selected_source, NULL);
-}
-
-static void
-set_offline_availability (EPopup *ep, EPopupItem *pitem, void *data, const char *value)
-{
- CalendarComponentView *component_view = data;
- ESource *selected_source;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- e_source_set_property (selected_source, "offline_sync", value);
-}
-
-static void
-mark_no_offline_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- set_offline_availability (ep, pitem, data, "0");
-}
-
-static void
-mark_offline_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- set_offline_availability (ep, pitem, data, "1");
-}
-
-static EPopupItem ecc_source_popups[] = {
- { E_POPUP_ITEM, (gchar *) "10.new", (gchar *) N_("_New Calendar"), new_calendar_cb, NULL, (gchar *) "x-office-calendar", 0, 0 },
- { E_POPUP_ITEM, (gchar *) "15.copy", (gchar *) N_("_Copy..."), copy_calendar_cb, NULL, (gchar *) "edit-copy", 0, E_CAL_POPUP_SOURCE_PRIMARY },
- { E_POPUP_ITEM, (gchar *) "18.rename", (gchar *) N_("_Rename..."), rename_calendar_cb, NULL, NULL, 0, E_CAL_POPUP_SOURCE_PRIMARY },
-
- { E_POPUP_BAR, (gchar *) "20.bar" },
- { E_POPUP_ITEM, (gchar *) "20.delete", (gchar *) N_("_Delete"), delete_calendar_cb, NULL, (gchar *) "edit-delete", 0,E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_DELETE },
- { E_POPUP_ITEM, (gchar *) "30.mark_calendar_offline", (gchar *) N_("_Make available for offline use"), mark_offline_cb, NULL, (gchar *) "stock_disconnect", E_CAL_POPUP_SOURCE_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_OFFLINE },
- { E_POPUP_ITEM, (gchar *) "40.mark_calendar_no_offline", (gchar *) N_("_Do not make available for offline use"), mark_no_offline_cb, NULL, (gchar *) "stock_connect", E_CAL_POPUP_SOURCE_NO_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_NO_OFFLINE },
-
- { E_POPUP_BAR, (gchar *) "99.bar" },
- { E_POPUP_ITEM, (gchar *) "99.properties", (gchar *) N_("_Properties"), edit_calendar_cb, NULL, (gchar *) "document-properties", 0, E_CAL_POPUP_SOURCE_PRIMARY },
-};
-
-static void
-ecc_source_popup_free(EPopup *ep, GSList *list, void *data)
-{
- g_slist_free(list);
-}
-
-static gboolean
-popup_event_cb(ESourceSelector *selector, ESource *insource, GdkEventButton *event, CalendarComponentView *component_view)
-{
- ECalPopup *ep;
- ECalPopupTargetSource *t;
- GSList *menus = NULL;
- int i;
- GtkMenu *menu;
-
- /** @HookPoint-ECalPopup: Calendar Source Selector Context Menu
- * @Id: org.gnome.evolution.calendar.source.popup
- * @Class: org.gnome.evolution.calendar.popup:1.0
- * @Target: ECalPopupTargetSource
- *
- * The context menu on the source selector in the calendar window.
- */
- ep = e_cal_popup_new("org.gnome.evolution.calendar.source.popup");
- t = e_cal_popup_target_new_source(ep, selector);
- t->target.widget = (GtkWidget *)component_view->calendar;
-
- for (i=0;i<sizeof(ecc_source_popups)/sizeof(ecc_source_popups[0]);i++)
- menus = g_slist_prepend(menus, &ecc_source_popups[i]);
-
- e_popup_add_items((EPopup *)ep, menus, NULL, ecc_source_popup_free, component_view);
-
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event?event->button:0, event?event->time:gtk_get_current_event_time());
-
- return TRUE;
-}
-
-static void
-source_selection_changed_cb (ESourceSelector *selector, CalendarComponentView *component_view)
-{
- update_uris_for_selection (component_view);
-}
-
-static void
-primary_source_selection_changed_cb (ESourceSelector *selector, CalendarComponentView *component_view)
-{
- update_uri_for_primary_selection (component_view);
-}
-
-static void
-source_changed_cb (ESource *source, GnomeCalendar *calendar)
-{
- if (calendar) {
- GtkWidget *widget = gnome_calendar_get_current_view_widget (calendar);
-
- if (widget)
- gtk_widget_queue_draw (widget);
- }
-}
-
-static void
-source_added_cb (GnomeCalendar *calendar, ECalSourceType source_type, ESource *source, CalendarComponentView *component_view)
-{
- switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
- e_source_selector_select_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
- g_signal_connect (source, "changed", G_CALLBACK (source_changed_cb), calendar);
- break;
- default:
- break;
- }
-}
-
-static void
-source_removed_cb (GnomeCalendar *calendar, ECalSourceType source_type, ESource *source, CalendarComponentView *component_view)
-{
- switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
- g_signal_handlers_disconnect_by_func (source, G_CALLBACK (source_changed_cb), calendar);
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
- break;
- default:
- break;
- }
-}
-
-static void
-set_info (CalendarComponentView *component_view)
-{
- icaltimezone *zone;
- struct icaltimetype start_tt, end_tt;
- time_t start_time, end_time;
- struct tm start_tm, end_tm;
- char buffer[512], end_buffer[256];
- GnomeCalendarViewType view;
-
- gnome_calendar_get_visible_time_range (component_view->calendar, &start_time, &end_time);
- zone = gnome_calendar_get_timezone (component_view->calendar);
-
- start_tt = icaltime_from_timet_with_zone (start_time, FALSE, zone);
- start_tm.tm_year = start_tt.year - 1900;
- start_tm.tm_mon = start_tt.month - 1;
- start_tm.tm_mday = start_tt.day;
- start_tm.tm_hour = start_tt.hour;
- start_tm.tm_min = start_tt.minute;
- start_tm.tm_sec = start_tt.second;
- start_tm.tm_isdst = -1;
- start_tm.tm_wday = time_day_of_week (start_tt.day, start_tt.month - 1,
- start_tt.year);
-
- /* Take one off end_time so we don't get an extra day. */
- end_tt = icaltime_from_timet_with_zone (end_time - 1, FALSE, zone);
- end_tm.tm_year = end_tt.year - 1900;
- end_tm.tm_mon = end_tt.month - 1;
- end_tm.tm_mday = end_tt.day;
- end_tm.tm_hour = end_tt.hour;
- end_tm.tm_min = end_tt.minute;
- end_tm.tm_sec = end_tt.second;
- end_tm.tm_isdst = -1;
- end_tm.tm_wday = time_day_of_week (end_tt.day, end_tt.month - 1,
- end_tt.year);
-
- view = gnome_calendar_get_view (component_view->calendar);
-
- switch (view) {
- case GNOME_CAL_DAY_VIEW:
- case GNOME_CAL_WORK_WEEK_VIEW:
- case GNOME_CAL_WEEK_VIEW:
- if (start_tm.tm_year == end_tm.tm_year
- && start_tm.tm_mon == end_tm.tm_mon
- && start_tm.tm_mday == end_tm.tm_mday) {
- e_utf8_strftime (buffer, sizeof (buffer),
- _("%A %d %b %Y"), &start_tm);
- } else if (start_tm.tm_year == end_tm.tm_year) {
- e_utf8_strftime (buffer, sizeof (buffer),
- _("%a %d %b"), &start_tm);
- e_utf8_strftime (end_buffer, sizeof (end_buffer),
- _("%a %d %b %Y"), &end_tm);
- strcat (buffer, " - ");
- strcat (buffer, end_buffer);
- } else {
- e_utf8_strftime (buffer, sizeof (buffer),
- _("%a %d %b %Y"), &start_tm);
- e_utf8_strftime (end_buffer, sizeof (end_buffer),
- _("%a %d %b %Y"), &end_tm);
- strcat (buffer, " - ");
- strcat (buffer, end_buffer);
- }
- break;
- case GNOME_CAL_MONTH_VIEW:
- case GNOME_CAL_LIST_VIEW:
- if (start_tm.tm_year == end_tm.tm_year) {
- if (start_tm.tm_mon == end_tm.tm_mon) {
- e_utf8_strftime (buffer, sizeof (buffer),
- "%d", &start_tm);
- e_utf8_strftime (end_buffer, sizeof (end_buffer),
- _("%d %b %Y"), &end_tm);
- strcat (buffer, " - ");
- strcat (buffer, end_buffer);
- } else {
- e_utf8_strftime (buffer, sizeof (buffer),
- _("%d %b"), &start_tm);
- e_utf8_strftime (end_buffer, sizeof (end_buffer),
- _("%d %b %Y"), &end_tm);
- strcat (buffer, " - ");
- strcat (buffer, end_buffer);
- }
- } else {
- e_utf8_strftime (buffer, sizeof (buffer),
- _("%d %b %Y"), &start_tm);
- e_utf8_strftime (end_buffer, sizeof (end_buffer),
- _("%d %b %Y"), &end_tm);
- strcat (buffer, " - ");
- strcat (buffer, end_buffer);
- }
- break;
- default:
- g_return_if_reached ();
- }
-
- e_info_label_set_info (component_view->info_label, _("Calendars"), buffer);
-}
-
-static void
-calendar_dates_changed_cb (GnomeCalendar *calendar, CalendarComponentView *component_view)
-{
- set_info (component_view);
-}
-
static void
config_primary_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
{
@@ -948,85 +354,6 @@ impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environme
}
static void
-impl_upgradeFromVersion (PortableServer_Servant servant,
- CORBA_short major,
- CORBA_short minor,
- CORBA_short revision,
- CORBA_Environment *ev)
-{
- GError *err = NULL;
- CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant));
-
- if (!migrate_calendars (calendar_component, major, minor, revision, &err)) {
- GNOME_Evolution_Component_UpgradeFailed *failedex;
-
- failedex = GNOME_Evolution_Component_UpgradeFailed__alloc();
- failedex->what = CORBA_string_dup(_("Failed upgrading calendars."));
- failedex->why = CORBA_string_dup(err->message);
- CORBA_exception_set(ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UpgradeFailed, failedex);
- }
-
- if (err)
- g_error_free(err);
-}
-
-static gboolean
-selector_tree_data_dropped (ESourceSelector *selector,
- GtkSelectionData *data,
- ESource *destination,
- GdkDragAction action,
- guint info,
- CalendarComponent *component)
-{
- gboolean success = FALSE;
- ECal *client;
-
- client = auth_new_cal_from_source (destination, E_CAL_SOURCE_TYPE_EVENT);
-
- if (!client || !e_cal_open (client, TRUE, NULL)) {
- if (client)
- g_object_unref (client);
-
- return FALSE;
- }
-
- if (data->data) {
- icalcomponent *icalcomp = NULL;
- char *comp_str; /* do not free this! */
-
- /* data->data is "source_uid\ncomponent_string" */
- comp_str = strchr ((char *)data->data, '\n');
- if (comp_str) {
- comp_str [0] = 0;
- comp_str++;
-
- icalcomp = icalparser_parse_string (comp_str);
-
- if (icalcomp) {
- success = cal_comp_process_source_list_drop (client, icalcomp, action, (char *)data->data, component->priv->source_list);
- icalcomponent_free (icalcomp);
- }
- }
- }
-
- return success;
-}
-
-static void
-control_activate_cb (BonoboControl *control, gboolean activate, gpointer data)
-{
- CalendarComponentView *component_view = data;
-
- if (activate) {
- BonoboUIComponent *uic;
- uic = bonobo_control_get_ui_component (component_view->view_control);
-
- e_user_creatable_items_handler_activate (component_view->creatable_items_handler, uic);
- }
-}
-
-
-static void
config_create_ecal_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
{
CalendarComponent *calendar_component = data;
@@ -1124,79 +451,13 @@ setup_create_ecal (CalendarComponent *calendar_component, CalendarComponentView
return priv->create_ecal;
}
-static gboolean
-create_new_event (CalendarComponent *calendar_component, CalendarComponentView *component_view, gboolean is_allday, gboolean is_meeting)
-{
- ECal *ecal;
- ECalendarView *view;
-
- ecal = setup_create_ecal (calendar_component, component_view);
- if (!ecal)
- return FALSE;
-
- if (component_view && (view = E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (component_view->calendar)))) {
- e_calendar_view_new_appointment_full (view, is_allday, is_meeting, TRUE);
- } else {
- ECalComponent *comp;
- CompEditor *editor;
- CompEditorFlags flags;
-
- flags = COMP_EDITOR_USER_ORG | COMP_EDITOR_NEW_ITEM;
- if (is_meeting)
- flags |= COMP_EDITOR_MEETING;
- comp = cal_comp_event_new_with_current_time (ecal, is_allday);
- editor = event_editor_new (ecal, flags);
- e_cal_component_commit_sequence (comp);
-
- comp_editor_edit_comp (editor, comp);
- if (is_meeting)
- event_editor_show_meeting (EVENT_EDITOR (editor));
- gtk_window_present (GTK_WINDOW (editor));
-
- e_comp_editor_registry_add (comp_editor_registry, editor, TRUE);
- }
-
- return TRUE;
-}
-
-static void
-create_local_item_cb (EUserCreatableItemsHandler *handler, const char *item_type_name, void *data)
-{
- CalendarComponent *calendar_component = data;
- CalendarComponentPrivate *priv;
- CalendarComponentView *component_view = NULL;
- GList *l;
-
- priv = calendar_component->priv;
-
- for (l = priv->views; l; l = l->next) {
- component_view = l->data;
-
- if (component_view->creatable_items_handler == handler)
- break;
-
- component_view = NULL;
- }
-
- if (strcmp (item_type_name, CREATE_EVENT_ID) == 0)
- create_new_event (calendar_component, component_view, FALSE, FALSE);
- else if (strcmp (item_type_name, CREATE_ALLDAY_EVENT_ID) == 0)
- create_new_event (calendar_component, component_view, TRUE, FALSE);
- else if (strcmp (item_type_name, CREATE_MEETING_ID) == 0)
- create_new_event (calendar_component, component_view, FALSE, TRUE);
- else if (strcmp (item_type_name, CREATE_CALENDAR_ID) == 0)
- calendar_setup_new_calendar (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (component_view->calendar))));
-}
-
static CalendarComponentView *
create_component_view (CalendarComponent *calendar_component)
{
CalendarComponentPrivate *priv;
CalendarComponentView *component_view;
- GtkWidget *selector_scrolled_window, *vbox, *vpane;
- GtkWidget *statusbar_widget;
+ GtkWidget **vpane;
guint not;
- AtkObject *a11y;
priv = calendar_component->priv;
@@ -1213,14 +474,8 @@ create_component_view (CalendarComponent *calendar_component)
component_view->source_list = g_object_ref (priv->source_list);
component_view->task_source_list = g_object_ref (priv->task_source_list);
component_view->memo_source_list = g_object_ref (priv->memo_source_list);
- component_view->vpane_pos = calendar_config_get_tag_vpane_pos ();
-
/* Create sidebar selector */
component_view->source_selector = e_source_selector_new (calendar_component->priv->source_list);
- e_source_selector_set_select_new ((ESourceSelector *)component_view->source_selector, TRUE);
- a11y = gtk_widget_get_accessible (GTK_WIDGET (component_view->source_selector));
- atk_object_set_name (a11y, _("Calendar Source Selector"));
-
g_signal_connect (
component_view->source_selector, "data-dropped",
G_CALLBACK (selector_tree_data_dropped), calendar_component);
@@ -1290,18 +545,11 @@ create_component_view (CalendarComponent *calendar_component)
g_signal_connect (component_view->source_selector, "popup_event",
G_CALLBACK (popup_event_cb), component_view);
+>>>>>>> 23df769955ea54f756a579c19964df87ae6fd5c8:calendar/gui/calendar-component.c
/* Set up the "new" item handler */
- component_view->creatable_items_handler = e_user_creatable_items_handler_new ("calendar", create_local_item_cb, calendar_component);
g_signal_connect (component_view->view_control, "activate", G_CALLBACK (control_activate_cb), component_view);
- /* We use this to update the component information */
- set_info (component_view);
- g_signal_connect (component_view->calendar, "dates_shown_changed",
- G_CALLBACK (calendar_dates_changed_cb), component_view);
-
/* Load the selection from the last run */
- update_selection (component_view);
- update_primary_selection (component_view);
update_task_memo_selection (component_view, E_CAL_SOURCE_TYPE_TODO);
update_primary_task_memo_selection (component_view, E_CAL_SOURCE_TYPE_TODO);
update_task_memo_selection (component_view, E_CAL_SOURCE_TYPE_JOURNAL);
@@ -1349,12 +597,6 @@ destroy_component_view (CalendarComponentView *component_view)
calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
g_list_free (component_view->notifications);
- if (component_view->creatable_items_handler)
- g_object_unref (component_view->creatable_items_handler);
-
- if (component_view->activity_handler)
- g_object_unref (component_view->activity_handler);
-
if (component_view->task_source_selection) {
g_slist_foreach (component_view->task_source_selection, (GFunc) g_free, NULL);
g_slist_free (component_view->task_source_selection);
@@ -1389,109 +631,6 @@ view_destroyed_cb (gpointer data, GObject *where_the_object_was)
}
}
-static GNOME_Evolution_ComponentView
-impl_createView (PortableServer_Servant servant,
- GNOME_Evolution_ShellView parent,
- CORBA_boolean select_item,
- CORBA_Environment *ev)
-{
- CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant));
- CalendarComponentPrivate *priv;
- CalendarComponentView *component_view;
- EComponentView *ecv;
-
- priv = calendar_component->priv;
-
- /* Create the calendar component view */
- component_view = create_component_view (calendar_component);
- if (!component_view) {
- /* FIXME Should we describe the problem in a control? */
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
-
- return CORBA_OBJECT_NIL;
- }
-
- g_object_weak_ref (G_OBJECT (component_view->view_control), view_destroyed_cb, calendar_component);
- priv->views = g_list_append (priv->views, component_view);
-
- /* TODO: Make CalendarComponentView just subclass EComponentView */
- ecv = e_component_view_new_controls (parent, "calendar", component_view->sidebar_control,
- component_view->view_control, component_view->statusbar_control);
-
- return BONOBO_OBJREF(ecv);
-}
-
-
-static GNOME_Evolution_CreatableItemTypeList *
-impl__get_userCreatableItems (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GNOME_Evolution_CreatableItemTypeList *list = GNOME_Evolution_CreatableItemTypeList__alloc ();
-
- list->_length = 4;
- list->_maximum = list->_length;
- list->_buffer = GNOME_Evolution_CreatableItemTypeList_allocbuf (list->_length);
-
- CORBA_sequence_set_release (list, FALSE);
-
- list->_buffer[0].id = (char *) CREATE_EVENT_ID;
- list->_buffer[0].description = (char *) _("New appointment");
- list->_buffer[0].menuDescription = (char *) C_("New", "_Appointment");
- list->_buffer[0].tooltip = (char *) _("Create a new appointment");
- list->_buffer[0].menuShortcut = 'a';
- list->_buffer[0].iconName = (char *) "appointment-new";
- list->_buffer[0].type = GNOME_Evolution_CREATABLE_OBJECT;
-
- list->_buffer[1].id = (char *) CREATE_MEETING_ID;
- list->_buffer[1].description = (char *) _("New meeting");
- list->_buffer[1].menuDescription = (char *) C_("New", "M_eeting");
- list->_buffer[1].tooltip = (char *) _("Create a new meeting request");
- list->_buffer[1].menuShortcut = 'e';
- list->_buffer[1].iconName = (char *) "stock_new-meeting";
- list->_buffer[1].type = GNOME_Evolution_CREATABLE_OBJECT;
-
- list->_buffer[2].id = (char *) CREATE_ALLDAY_EVENT_ID;
- list->_buffer[2].description = (char *) _("New all day appointment");
- list->_buffer[2].menuDescription = (char *) C_("New", "All Day A_ppointment");
- list->_buffer[2].tooltip = (char *) _("Create a new all-day appointment");
- list->_buffer[2].menuShortcut = '\0';
- list->_buffer[2].iconName = (char *) "stock_new-24h-appointment";
- list->_buffer[2].type = GNOME_Evolution_CREATABLE_OBJECT;
-
- list->_buffer[3].id = (char *) CREATE_CALENDAR_ID;
- list->_buffer[3].description = (char *) _("New calendar");
- list->_buffer[3].menuDescription = (char *) C_("New", "Cale_ndar");
- list->_buffer[3].tooltip = (char *) _("Create a new calendar");
- list->_buffer[3].menuShortcut = '\0';
- list->_buffer[3].iconName = (char *) "x-office-calendar";
- list->_buffer[3].type = GNOME_Evolution_CREATABLE_FOLDER;
-
- return list;
-}
-
-static void
-impl_requestCreateItem (PortableServer_Servant servant,
- const CORBA_char *item_type_name,
- CORBA_Environment *ev)
-{
- CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant));
- gboolean result = FALSE;
-
- if (strcmp (item_type_name, CREATE_EVENT_ID) == 0)
- result = create_new_event (calendar_component, NULL, FALSE, FALSE);
- else if (strcmp (item_type_name, CREATE_ALLDAY_EVENT_ID) == 0)
- result = create_new_event (calendar_component, NULL, TRUE, FALSE);
- else if (strcmp (item_type_name, CREATE_MEETING_ID) == 0)
- result = create_new_event (calendar_component, NULL, FALSE, TRUE);
- else if (strcmp (item_type_name, CREATE_CALENDAR_ID) == 0)
- /* FIXME Should we use the last opened window? */
- calendar_setup_new_calendar (NULL);
- else
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_UnknownType);
-
- if (!result)
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
-}
/* GObject methods. */
@@ -1507,9 +646,9 @@ impl_dispose (GObject *object)
priv->source_list = NULL;
}
- if (priv->gconf_client != NULL) {
- g_object_unref (priv->gconf_client);
- priv->gconf_client = NULL;
+ if (priv->activity_handler != NULL) {
+ g_object_unref (priv->activity_handler);
+ priv->activity_handler = NULL;
}
if (priv->activity_handler != NULL) {
@@ -1539,27 +678,6 @@ impl_dispose (GObject *object)
}
static void
-impl_finalize (GObject *object)
-{
- CalendarComponentPrivate *priv = CALENDAR_COMPONENT (object)->priv;
- GList *l;
-
- for (l = priv->views; l; l = l->next) {
- CalendarComponentView *component_view = l->data;
-
- destroy_component_view (component_view);
- }
- g_list_free (priv->views);
-
- g_free (priv->base_directory);
- g_free (priv->config_directory);
- g_object_unref (priv->logger);
- g_free (priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
calendar_component_class_init (CalendarComponentClass *class)
{
POA_GNOME_Evolution_Component__epv *epv = &class->epv;
@@ -1570,17 +688,9 @@ calendar_component_class_init (CalendarComponentClass *class)
parent_class = g_type_class_peek_parent (class);
- epv->upgradeFromVersion = impl_upgradeFromVersion;
- epv->createView = impl_createView;
- epv->_get_userCreatableItems = impl__get_userCreatableItems;
- epv->requestCreateItem = impl_requestCreateItem;
epv->handleURI = impl_handleURI;
object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
-
- /* Register attachment handler types. */
- e_attachment_handler_calendar_get_type ();
}
static void
@@ -1589,15 +699,6 @@ calendar_component_init (CalendarComponent *component)
CalendarComponentPrivate *priv;
guint not;
- priv = g_new0 (CalendarComponentPrivate, 1);
-
- priv->base_directory = g_build_filename (e_get_user_data_dir (), "calendar", NULL);
- priv->config_directory = g_build_filename (priv->base_directory, "config", NULL);
-
- /* EPFIXME: Should use a custom one instead? Also we should add
- * calendar_component_peek_gconf_client(). */
- priv->gconf_client = gconf_client_get_default ();
-
not = calendar_config_add_notification_primary_calendar (config_primary_selection_changed_cb,
component);
priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
@@ -1608,68 +709,7 @@ calendar_component_init (CalendarComponent *component)
e_activity_handler_set_error_flush_time (priv->activity_handler,eni_config_get_error_timeout (CALENDAR_ERROR_TIME_OUT_KEY)*1000);
component->priv = priv;
- ensure_sources (component);
e_cal_get_sources (&priv->task_source_list, E_CAL_SOURCE_TYPE_TODO, NULL);
e_cal_get_sources (&priv->memo_source_list, E_CAL_SOURCE_TYPE_JOURNAL, NULL);
}
-
-
-/* Public API. */
-
-CalendarComponent *
-calendar_component_peek (void)
-{
- static CalendarComponent *component = NULL;
-
- if (component == NULL) {
- component = g_object_new (calendar_component_get_type (), NULL);
-
- if (g_mkdir_with_parents (calendar_component_peek_config_directory (component), 0777) != 0) {
- g_warning (G_STRLOC ": Cannot create directory %s: %s",
- calendar_component_peek_config_directory (component),
- g_strerror (errno));
- g_object_unref (component);
- component = NULL;
- }
- }
-
- return component;
-}
-
-const char *
-calendar_component_peek_base_directory (CalendarComponent *component)
-{
- return component->priv->base_directory;
-}
-
-const char *
-calendar_component_peek_config_directory (CalendarComponent *component)
-{
- return component->priv->config_directory;
-}
-
-ESourceList *
-calendar_component_peek_source_list (CalendarComponent *component)
-{
- return component->priv->source_list;
-}
-
-EActivityHandler *
-calendar_component_peek_activity_handler (CalendarComponent *component)
-{
- CALENDAR_COMPONENT_DEFAULT(component);
-
- return component->priv->activity_handler;
-}
-
-void
-calendar_component_show_logger (gpointer top)
-{
- CalendarComponent *cc = calendar_component_peek ();
- ELogger *logger = cc->priv->logger;
-
- eni_show_logger(logger, top, CALENDAR_ERROR_TIME_OUT_KEY, CALENDAR_ERROR_LEVEL_KEY);
-}
-
-BONOBO_TYPE_FUNC_FULL (CalendarComponent, GNOME_Evolution_Component, PARENT_TYPE, calendar_component)
diff --git a/calendar/gui/calendar-component.h b/calendar/gui/calendar-component.h
index 1fbcdbc487..1106d8ec62 100644
--- a/calendar/gui/calendar-component.h
+++ b/calendar/gui/calendar-component.h
@@ -56,12 +56,4 @@ struct _CalendarComponentClass {
GType calendar_component_get_type (void);
-CalendarComponent *calendar_component_peek (void);
-
-const char *calendar_component_peek_base_directory (CalendarComponent *component);
-const char *calendar_component_peek_config_directory (CalendarComponent *component);
-ESourceList *calendar_component_peek_source_list (CalendarComponent *component);
-EActivityHandler *calendar_component_peek_activity_handler (CalendarComponent *component);
-void calendar_component_show_logger (gpointer);
-
#endif /* _CALENDAR_COMPONENT_H_ */
diff --git a/calendar/gui/calendar-config-keys.h b/calendar/gui/calendar-config-keys.h
index 37724a53e9..b4e95c2bd7 100644
--- a/calendar/gui/calendar-config-keys.h
+++ b/calendar/gui/calendar-config-keys.h
@@ -28,18 +28,10 @@ G_BEGIN_DECLS
#define CALENDAR_CONFIG_PREFIX "/apps/evolution/calendar"
/* Display settings */
-#define CALENDAR_CONFIG_USE_SYSTEM_TIMEZONE CALENDAR_CONFIG_PREFIX "/display/use_system_timezone"
#define CALENDAR_CONFIG_TIMEZONE CALENDAR_CONFIG_PREFIX "/display/timezone"
#define CALENDAR_CONFIG_SELECTED_CALENDARS CALENDAR_CONFIG_PREFIX "/display/selected_calendars"
-#define CALENDAR_CONFIG_PRIMARY_CALENDAR CALENDAR_CONFIG_PREFIX "/display/primary_calendar"
#define CALENDAR_CONFIG_24HOUR CALENDAR_CONFIG_PREFIX "/display/use_24hour_format"
#define CALENDAR_CONFIG_SHOW_ATTENDEE CALENDAR_CONFIG_PREFIX "/display/show_attendee"
-#define CALENDAR_CONFIG_SHOW_ROLE CALENDAR_CONFIG_PREFIX "/display/show_role"
-#define CALENDAR_CONFIG_SHOW_STATUS CALENDAR_CONFIG_PREFIX "/display/show_status"
-#define CALENDAR_CONFIG_SHOW_TYPE CALENDAR_CONFIG_PREFIX "/display/show_type"
-#define CALENDAR_CONFIG_SHOW_RSVP CALENDAR_CONFIG_PREFIX "/display/show_rsvp"
-#define CALENDAR_CONFIG_SHOW_TIMEZONE CALENDAR_CONFIG_PREFIX "/display/show_timezone"
-#define CALENDAR_CONFIG_SHOW_CATEGORIES CALENDAR_CONFIG_PREFIX "/display/show_categories"
#define CALENDAR_CONFIG_WEEK_START CALENDAR_CONFIG_PREFIX "/display/week_start_day"
#define CALENDAR_CONFIG_DAY_START_HOUR CALENDAR_CONFIG_PREFIX "/display/day_start_hour"
#define CALENDAR_CONFIG_DAY_START_MINUTE CALENDAR_CONFIG_PREFIX "/display/day_start_minute"
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index ffd398bd69..14ebc801a3 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -29,12 +29,13 @@
#include <config.h>
#endif
-#include <string.h>
#include <time.h>
-#include <libedataserver/e-data-server-util.h>
+#include <string.h>
#include <e-util/e-util.h>
-#include <widgets/e-timezone-dialog/e-timezone-dialog.h>
#include <libecal/e-cal-time-util.h>
+#include <libedataserver/e-data-server-util.h>
+#include <widgets/e-timezone-dialog/e-timezone-dialog.h>
+#include <shell/e-shell.h>
#include "calendar-config-keys.h"
#include "calendar-config.h"
@@ -150,73 +151,23 @@ calendar_config_add_notification_calendars_selected (GConfClientNotifyFunc func,
return id;
}
-/* The primary calendar */
-char *
-calendar_config_get_primary_calendar (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_string (config, CALENDAR_CONFIG_PRIMARY_CALENDAR, NULL);
-}
-
-void
-calendar_config_set_primary_calendar (const char *primary_uid)
-{
- calendar_config_init ();
-
- gconf_client_set_string (config, CALENDAR_CONFIG_PRIMARY_CALENDAR, primary_uid, NULL);
-}
-
-
-guint
-calendar_config_add_notification_primary_calendar (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_PRIMARY_CALENDAR, func, data, NULL, NULL);
-
- return id;
-}
-
-gboolean
-calendar_config_get_use_system_timezone (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_USE_SYSTEM_TIMEZONE, NULL);
-}
-
-void
-calendar_config_set_use_system_timezone (gboolean use)
-{
- calendar_config_init ();
-
- if (calendar_config_get_use_system_timezone () != use) {
- gconf_client_set_bool (config, CALENDAR_CONFIG_USE_SYSTEM_TIMEZONE, use, NULL);
- gconf_client_notify (config, CALENDAR_CONFIG_TIMEZONE);
-
- /* FIXME: notify CALENDAR_CONFIG_TIMEZONE change on system timezone change
- itself too, when using system timezone. How to receive such change? */
- }
-}
-
-guint
-calendar_config_add_notification_use_system_timezone (GConfClientNotifyFunc func, gpointer data)
-{
- calendar_config_init ();
-
- return gconf_client_notify_add (config, CALENDAR_CONFIG_USE_SYSTEM_TIMEZONE, func, data, NULL, NULL);
-}
-
/* The current timezone, e.g. "Europe/London". It may be NULL, in which case
you should assume UTC (though Evolution will show the timezone-setting
dialog the next time a calendar or task folder is selected). */
gchar *
calendar_config_get_timezone (void)
{
- if (calendar_config_get_use_system_timezone ())
+ EShell *shell;
+ EShellSettings *shell_settings;
+ gboolean use_system_timezone;
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ use_system_timezone = e_shell_settings_get_boolean (
+ shell_settings, "cal-use-system-timezone");
+
+ if (use_system_timezone)
return e_cal_util_get_system_timezone_location ();
return calendar_config_get_timezone_stored ();
@@ -309,107 +260,6 @@ calendar_config_add_notification_24_hour_format (GConfClientNotifyFunc func, gpo
return id;
}
-/* Show RSVP*/
-gboolean
-calendar_config_get_show_rsvp (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_RSVP, NULL);
-}
-
-void
-calendar_config_set_show_rsvp (gboolean state)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_RSVP, state, NULL);
-}
-
-/* Show Role*/
-gboolean
-calendar_config_get_show_role (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_ROLE, NULL);
-}
-
-void
-calendar_config_set_show_role (gboolean state)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_ROLE, state, NULL);
-}
-
-/* Show Type*/
-gboolean
-calendar_config_get_show_type (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_TYPE, NULL);
-}
-
-void
-calendar_config_set_show_type (gboolean state)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_TYPE, state, NULL);
-}
-
-/* Show status */
-gboolean
-calendar_config_get_show_status (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_STATUS, NULL);
-}
-
-void
-calendar_config_set_show_status (gboolean state)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_STATUS, state, NULL);
-}
-
-/* Show timezone */
-gboolean
-calendar_config_get_show_timezone (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_TIMEZONE, NULL);
-}
-
-void
-calendar_config_set_show_timezone (gboolean status)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_TIMEZONE, status, NULL);
-}
-
-gboolean
-calendar_config_get_show_categories (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_CATEGORIES, NULL);
-}
-void
-calendar_config_set_show_categories (gboolean status)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_CATEGORIES, status, NULL);
-}
-
-
/* The start day of the week (0 = Sun to 6 = Mon). */
gint
calendar_config_get_week_start_day (void)
diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h
index ff4e69d008..08febaf0d3 100644
--- a/calendar/gui/calendar-config.h
+++ b/calendar/gui/calendar-config.h
@@ -68,16 +68,6 @@ GSList *calendar_config_get_calendars_selected (void);
void calendar_config_set_calendars_selected (GSList *selected);
guint calendar_config_add_notification_calendars_selected (GConfClientNotifyFunc func, gpointer data);
-/* The primary calendar */
-char *calendar_config_get_primary_calendar (void);
-void calendar_config_set_primary_calendar (const char *primary_uid);
-guint calendar_config_add_notification_primary_calendar (GConfClientNotifyFunc func, gpointer data);
-
-/* Use system timezone; if TRUE, then influences also the current timezone functions. */
-gboolean calendar_config_get_use_system_timezone (void);
-void calendar_config_set_use_system_timezone (gboolean use);
-guint calendar_config_add_notification_use_system_timezone (GConfClientNotifyFunc func, gpointer data);
-
/* The current timezone, e.g. "Europe/London". */
gchar* calendar_config_get_timezone (void);
gchar* calendar_config_get_timezone_stored (void);
@@ -117,25 +107,6 @@ gboolean calendar_config_get_24_hour_format (void);
void calendar_config_set_24_hour_format (gboolean use_24_hour);
guint calendar_config_add_notification_24_hour_format (GConfClientNotifyFunc func, gpointer data);
-gboolean calendar_config_get_show_status (void);
-void calendar_config_set_show_status (gboolean status);
-
-gboolean calendar_config_get_show_type (void);
-void calendar_config_set_show_type (gboolean status);
-
-gboolean calendar_config_get_show_rsvp (void);
-void calendar_config_set_show_rsvp (gboolean status);
-
-gboolean calendar_config_get_show_timezone (void);
-void calendar_config_set_show_timezone (gboolean status);
-
-gboolean calendar_config_get_show_categories (void);
-void calendar_config_set_show_categories (gboolean status);
-
-gboolean calendar_config_get_show_role (void);
-void calendar_config_set_show_role (gboolean state);
-
-
/* The time divisions in the Day/Work-Week view in minutes (5/10/15/30/60). */
gint calendar_config_get_time_divisions (void);
void calendar_config_set_time_divisions (gint divisions);
diff --git a/calendar/gui/calendar-view-factory.c b/calendar/gui/calendar-view-factory.c
index 8d167f44de..9eec42fb13 100644
--- a/calendar/gui/calendar-view-factory.c
+++ b/calendar/gui/calendar-view-factory.c
@@ -181,7 +181,7 @@ calendar_view_factory_new_view (GalViewFactory *factory, const char *name)
*
* Return value: The same value as @cal_view_factory.
**/
-CalendarViewFactory *
+GalViewFactory *
calendar_view_factory_construct (CalendarViewFactory *cal_view_factory,
GnomeCalendarViewType view_type)
{
@@ -194,7 +194,7 @@ calendar_view_factory_construct (CalendarViewFactory *cal_view_factory,
priv->view_type = view_type;
- return cal_view_factory;
+ return GAL_VIEW_FACTORY (cal_view_factory);
}
/**
@@ -205,7 +205,7 @@ calendar_view_factory_construct (CalendarViewFactory *cal_view_factory,
*
* Return value: A newly-created calendar view factory.
**/
-CalendarViewFactory *
+GalViewFactory *
calendar_view_factory_new (GnomeCalendarViewType view_type)
{
CalendarViewFactory *cal_view_factory;
diff --git a/calendar/gui/calendar-view-factory.h b/calendar/gui/calendar-view-factory.h
index 0f182a11e1..c0b90f2bd9 100644
--- a/calendar/gui/calendar-view-factory.h
+++ b/calendar/gui/calendar-view-factory.h
@@ -57,10 +57,10 @@ typedef struct {
GType calendar_view_factory_get_type (void);
-CalendarViewFactory *calendar_view_factory_construct (CalendarViewFactory *cal_view_factory,
+GalViewFactory *calendar_view_factory_construct (CalendarViewFactory *cal_view_factory,
GnomeCalendarViewType view_type);
-CalendarViewFactory *calendar_view_factory_new (GnomeCalendarViewType view_type);
+GalViewFactory *calendar_view_factory_new (GnomeCalendarViewType view_type);
diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c
deleted file mode 100644
index b98f7170ed..0000000000
--- a/calendar/gui/comp-editor-factory.c
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * Evolution calendar - Component editor factory object
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Federico Mena-Quintero <federico@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <bonobo/bonobo-exception.h>
-#include <evolution-calendar.h>
-#include <libedataserver/e-url.h>
-#include <libecal/e-cal.h>
-#include "calendar-config.h"
-#include "e-comp-editor-registry.h"
-#include "comp-editor-factory.h"
-#include "comp-util.h"
-#include "common/authentication.h"
-#include "dialogs/event-editor.h"
-#include "dialogs/task-editor.h"
-
-extern ECompEditorRegistry *comp_editor_registry;
-
-
-
-/* A pending request */
-
-typedef enum {
- REQUEST_EXISTING,
- REQUEST_NEW
-} RequestType;
-
-typedef struct {
- RequestType type;
-
- union {
- struct {
- char *uid;
- } existing;
-
- struct {
- GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode type;
- } new;
- } u;
-} Request;
-
-/* A client we have open */
-typedef struct {
- /* Our parent CompEditorFactory */
- CompEditorFactory *factory;
-
- /* Uri of the calendar, used as key in the clients hash table */
- char *uri;
-
- /* Client of the calendar */
- ECal *client;
-
- /* Count editors using this client */
- int editor_count;
-
- /* Pending requests; they are pending if the client is still being opened */
- GSList *pending;
-
- /* Whether this is open or still waiting */
- guint open : 1;
-} OpenClient;
-
-/* Private part of the CompEditorFactory structure */
-struct CompEditorFactoryPrivate {
- /* Hash table of URI->OpenClient */
- GHashTable *uri_client_hash;
-};
-
-
-
-static void comp_editor_factory_class_init (CompEditorFactoryClass *class);
-static void comp_editor_factory_init (CompEditorFactory *factory);
-static void comp_editor_factory_finalize (GObject *object);
-
-static void impl_editExisting (PortableServer_Servant servant,
- const CORBA_char *str_uri,
- const CORBA_char *uid,
- const GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode corba_type,
- CORBA_Environment *ev);
-static void impl_editNew (PortableServer_Servant servant,
- const CORBA_char *str_uri,
- const GNOME_Evolution_Calendar_CalObjType type,
- CORBA_Environment *ev);
-
-static BonoboObjectClass *parent_class = NULL;
-
-
-
-BONOBO_TYPE_FUNC_FULL (CompEditorFactory,
- GNOME_Evolution_Calendar_CompEditorFactory,
- BONOBO_OBJECT_TYPE,
- comp_editor_factory)
-
-/* Class initialization function for the component editor factory */
-static void
-comp_editor_factory_class_init (CompEditorFactoryClass *class)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- class->epv.editExisting = impl_editExisting;
- class->epv.editNew = impl_editNew;
-
- object_class->finalize = comp_editor_factory_finalize;
-}
-
-/* Frees a Request structure */
-static void
-free_request (Request *r)
-{
- if (r->type == REQUEST_EXISTING)
- g_free (r->u.existing.uid);
-
- g_free (r);
-}
-
-/* Frees an OpenClient structure */
-static void
-free_client (OpenClient *oc)
-{
- GSList *l;
-
- g_free (oc->uri);
- oc->uri = NULL;
-
- g_object_unref (oc->client);
- oc->client = NULL;
-
- for (l = oc->pending; l; l = l->next) {
- Request *r;
-
- r = l->data;
- free_request (r);
- }
- g_slist_free (oc->pending);
- oc->pending = NULL;
-
- g_free (oc);
-}
-
-/* Object initialization function for the component editor factory */
-static void
-comp_editor_factory_init (CompEditorFactory *factory)
-{
- CompEditorFactoryPrivate *priv;
-
- priv = g_new (CompEditorFactoryPrivate, 1);
- factory->priv = priv;
-
- priv->uri_client_hash = g_hash_table_new_full (
- g_str_hash, g_str_equal,
- (GDestroyNotify) NULL,
- (GDestroyNotify) free_client);
-}
-
-/* Destroy handler for the component editor factory */
-static void
-comp_editor_factory_finalize (GObject *object)
-{
- CompEditorFactory *factory;
- CompEditorFactoryPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_COMP_EDITOR_FACTORY (object));
-
- factory = COMP_EDITOR_FACTORY (object);
- priv = factory->priv;
-
- g_hash_table_destroy (priv->uri_client_hash);
- priv->uri_client_hash = NULL;
-
- g_free (priv);
- factory->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-
-/* Callback used when a component editor gets destroyed */
-static void
-editor_destroy_cb (GtkObject *object, gpointer data)
-{
- OpenClient *oc;
- CompEditorFactory *factory;
- CompEditorFactoryPrivate *priv;
-
- oc = data;
- factory = oc->factory;
- priv = factory->priv;
-
- oc->editor_count--;
-
- /* See if we need to free the client */
- g_return_if_fail (oc->pending == NULL);
-
- if (oc->editor_count != 0)
- return;
-
- g_hash_table_remove (priv->uri_client_hash, oc->uri);
-}
-
-/* Starts editing an existing component on a client that is already open */
-static void
-edit_existing (OpenClient *oc, const char *uid)
-{
- ECalComponent *comp;
- icalcomponent *icalcomp;
- CompEditor *editor;
- ECalComponentVType vtype;
- CompEditorFlags flags = { 0, };
-
- g_return_if_fail (oc->open);
-
- /* Get the object */
- if (!e_cal_get_object (oc->client, uid, NULL, &icalcomp, NULL)) {
- /* FIXME Better error handling */
- g_warning (G_STRLOC ": Syntax error while getting component `%s'", uid);
-
- return;
- }
-
- comp = e_cal_component_new ();
- if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
- g_object_unref (comp);
- icalcomponent_free (icalcomp);
- return;
- }
-
- /* Create the appropriate type of editor */
-
- vtype = e_cal_component_get_vtype (comp);
- if (itip_organizer_is_user (comp, oc->client))
- flags |= COMP_EDITOR_USER_ORG;
-
-
- switch (vtype) {
- case E_CAL_COMPONENT_EVENT:
- if (e_cal_component_has_attendees (comp))
- flags |= COMP_EDITOR_MEETING;
-
- editor = event_editor_new (oc->client, flags);
- break;
-
- case E_CAL_COMPONENT_TODO:
- editor = COMP_EDITOR (task_editor_new (oc->client, flags));
- break;
-
- default:
- g_message ("edit_exiting(): Unsupported object type %d", (int) vtype);
- g_object_unref (comp);
- return;
- }
-
- /* Set the object on the editor */
- comp_editor_edit_comp (editor, comp);
- gtk_window_present (GTK_WINDOW (editor));
- g_object_unref (comp);
-
- oc->editor_count++;
- g_signal_connect (editor, "destroy", G_CALLBACK (editor_destroy_cb), oc);
-
- e_comp_editor_registry_add (comp_editor_registry, editor, TRUE);
-}
-
-static ECalComponent *
-get_default_task (ECal *client)
-{
- ECalComponent *comp;
-
- comp = cal_comp_task_new_with_defaults (client);
-
- return comp;
-}
-
-/* Edits a new object in the context of a client */
-static void
-edit_new (OpenClient *oc, const GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode type)
-{
- ECalComponent *comp;
- CompEditor *editor;
-
- switch (type) {
- case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT:
- editor = event_editor_new (oc->client, FALSE);
- comp = cal_comp_event_new_with_current_time (oc->client, FALSE);
- break;
- case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING:
- editor = event_editor_new (oc->client, TRUE);
- comp = cal_comp_event_new_with_current_time (oc->client, FALSE);
- break;
- case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT:
- editor = event_editor_new (oc->client, FALSE);
- comp = cal_comp_event_new_with_current_time (oc->client, TRUE);
- break;
- case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO:
- editor = COMP_EDITOR (task_editor_new (oc->client, FALSE));
- comp = get_default_task (oc->client);
- break;
- default:
- g_return_if_reached ();
- return;
- }
-
- comp_editor_edit_comp (editor, comp);
- if (type == GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING)
- event_editor_show_meeting (EVENT_EDITOR (editor));
- gtk_window_present (GTK_WINDOW (editor));
-
- oc->editor_count++;
- g_signal_connect (editor, "destroy", G_CALLBACK (editor_destroy_cb), oc);
-
- e_comp_editor_registry_add (comp_editor_registry, editor, TRUE);
-}
-
-/* Resolves all the pending requests for a client */
-static void
-resolve_pending_requests (OpenClient *oc)
-{
- GSList *l;
- icaltimezone *zone;
-
- if (!oc->pending)
- return;
-
- /* Set the default timezone in the backend. */
- zone = calendar_config_get_icaltimezone ();
-
- /* FIXME Error handling? */
- e_cal_set_default_timezone (oc->client, zone, NULL);
-
- for (l = oc->pending; l; l = l->next) {
- Request *request;
-
- request = l->data;
-
- switch (request->type) {
- case REQUEST_EXISTING:
- edit_existing (oc, request->u.existing.uid);
- break;
-
- case REQUEST_NEW:
- edit_new (oc, request->u.new.type);
- break;
- }
-
- free_request (request);
- }
-
- g_slist_free (oc->pending);
- oc->pending = NULL;
-}
-
-/* Callback used when a client is finished opening. We resolve all the pending
- * requests.
- */
-static void
-cal_opened_cb (ECal *client, ECalendarStatus status, gpointer data)
-{
- OpenClient *oc;
- CompEditorFactory *factory;
- CompEditorFactoryPrivate *priv;
- GtkWidget *dialog = NULL;
-
- oc = data;
- factory = oc->factory;
- priv = factory->priv;
-
- switch (status) {
- case E_CALENDAR_STATUS_OK:
- oc->open = TRUE;
- resolve_pending_requests (oc);
- return;
-
- case E_CALENDAR_STATUS_OTHER_ERROR:
- case E_CALENDAR_STATUS_NO_SUCH_CALENDAR:
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("Error while opening the calendar"));
- break;
-
- case E_CALENDAR_STATUS_PROTOCOL_NOT_SUPPORTED:
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("Method not supported when opening the calendar"));
- break;
-
- case E_CALENDAR_STATUS_PERMISSION_DENIED :
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("Permission denied to open the calendar"));
- break;
-
- case E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED:
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("Authentication Required"));
- break;
-
- case E_CALENDAR_STATUS_AUTHENTICATION_FAILED :
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("Authentication Failed"));
- break;
-
- default:
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("Unknown error"));
- return;
- }
-
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- g_hash_table_remove (priv->uri_client_hash, oc->uri);
-}
-
-/* Creates a new OpenClient structure and queues the component editing/creation
- * process until the client is open. Returns NULL if it could not issue the
- * open request.
- */
-static OpenClient *
-open_client (CompEditorFactory *factory, ECalSourceType source_type, const char *uristr)
-{
- CompEditorFactoryPrivate *priv;
- ECal *client;
- OpenClient *oc;
- GError *error = NULL;
-
- priv = factory->priv;
-
- client = auth_new_cal_from_uri (uristr, source_type);
- if (!client)
- return NULL;
-
- oc = g_new (OpenClient, 1);
- oc->factory = factory;
-
- oc->uri = g_strdup (uristr);
-
- oc->client = client;
- oc->editor_count = 0;
- oc->pending = NULL;
- oc->open = FALSE;
-
- g_signal_connect (oc->client, "cal_opened", G_CALLBACK (cal_opened_cb), oc);
-
- g_hash_table_insert (priv->uri_client_hash, oc->uri, oc);
-
- if (!e_cal_open (oc->client, FALSE, &error)) {
- g_warning (G_STRLOC ": %s", error->message);
- g_free (oc->uri);
- g_object_unref (oc->client);
- g_free (oc);
- g_error_free (error);
-
- return NULL;
- }
-
- return oc;
-}
-
-/* Looks up an open client or queues it for being opened. Returns the client or
- * NULL on failure; in the latter case it sets the ev exception.
- */
-static OpenClient *
-lookup_open_client (CompEditorFactory *factory, ECalSourceType source_type, const char *str_uri, CORBA_Environment *ev)
-{
- CompEditorFactoryPrivate *priv;
- OpenClient *oc;
- EUri *uri;
-
- priv = factory->priv;
-
- /* Look up the client */
-
- uri = e_uri_new (str_uri);
- if (!uri) {
- bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_CompEditorFactory_InvalidURI);
- return NULL;
- }
- e_uri_free (uri);
-
- oc = g_hash_table_lookup (priv->uri_client_hash, str_uri);
- if (!oc) {
- oc = open_client (factory, source_type, str_uri);
- if (!oc) {
- bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_CompEditorFactory_BackendContactError);
- return NULL;
- }
- }
-
- return oc;
-}
-
-/* Queues a request for editing an existing object */
-static void
-queue_edit_existing (OpenClient *oc, const char *uid)
-{
- Request *request;
-
- g_return_if_fail (!oc->open);
-
- request = g_new (Request, 1);
- request->type = REQUEST_EXISTING;
- request->u.existing.uid = g_strdup (uid);
-
- oc->pending = g_slist_append (oc->pending, request);
-}
-
-/* ::editExisting() method implementation */
-static void
-impl_editExisting (PortableServer_Servant servant,
- const CORBA_char *str_uri,
- const CORBA_char *uid,
- const GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode corba_type,
- CORBA_Environment *ev)
-{
- CompEditorFactory *factory;
- OpenClient *oc;
- CompEditor *editor;
- ECalSourceType source_type;
-
- factory = COMP_EDITOR_FACTORY (bonobo_object_from_servant (servant));
-
- switch (corba_type) {
- case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO:
- source_type = E_CAL_SOURCE_TYPE_TODO;
- break;
- default:
- source_type = E_CAL_SOURCE_TYPE_EVENT;
- }
-
- oc = lookup_open_client (factory, source_type, str_uri, ev);
- if (!oc)
- return;
-
- if (!oc->open) {
- queue_edit_existing (oc, uid);
- return;
- }
-
- /* Look up the component */
- editor = e_comp_editor_registry_find (comp_editor_registry, uid);
- if (editor == NULL) {
- edit_existing (oc, uid);
- } else {
- gtk_window_present (GTK_WINDOW (editor));
- }
-}
-
-/* Queues a request for creating a new object */
-static void
-queue_edit_new (OpenClient *oc, const GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode type)
-{
- Request *request;
-
- g_return_if_fail (!oc->open);
-
- request = g_new (Request, 1);
- request->type = REQUEST_NEW;
- request->u.new.type = type;
-
- oc->pending = g_slist_append (oc->pending, request);
-}
-
-/* ::editNew() method implementation */
-static void
-impl_editNew (PortableServer_Servant servant,
- const CORBA_char *str_uri,
- const GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode corba_type,
- CORBA_Environment *ev)
-{
- CompEditorFactory *factory;
- OpenClient *oc;
- ECalSourceType source_type;
-
- factory = COMP_EDITOR_FACTORY (bonobo_object_from_servant (servant));
-
- switch (corba_type) {
- case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO:
- source_type = E_CAL_SOURCE_TYPE_TODO;
- break;
- default:
- source_type = E_CAL_SOURCE_TYPE_EVENT;
- }
-
- oc = lookup_open_client (factory, source_type, str_uri, ev);
- if (!oc)
- return;
-
- if (!oc->open)
- queue_edit_new (oc, corba_type);
- else
- edit_new (oc, corba_type);
-}
-
-
-
-/**
- * comp_editor_factory_new:
- *
- * Creates a new calendar component editor factory.
- *
- * Return value: A newly-created component editor factory.
- **/
-CompEditorFactory *
-comp_editor_factory_new (void)
-{
- return g_object_new (TYPE_COMP_EDITOR_FACTORY, NULL);
-}
-
-
diff --git a/calendar/gui/comp-editor-factory.h b/calendar/gui/comp-editor-factory.h
deleted file mode 100644
index 3e79992d67..0000000000
--- a/calendar/gui/comp-editor-factory.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Evolution calendar - Component editor factory object
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Federico Mena-Quintero <federico@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef COMP_EDITOR_FACTORY_H
-#define COMP_EDITOR_FACTORY_H
-
-#include <bonobo/bonobo-object.h>
-#include "evolution-calendar.h"
-
-
-
-#define TYPE_COMP_EDITOR_FACTORY (comp_editor_factory_get_type ())
-#define COMP_EDITOR_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMP_EDITOR_FACTORY, \
- CompEditorFactory))
-#define COMP_EDITOR_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
- TYPE_COMP_EDITOR_FACTORY, CompEditorFactoryClass))
-#define IS_COMP_EDITOR_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMP_EDITOR_FACTORY))
-#define IS_COMP_EDITOR_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COMP_EDITOR_FACTORY))
-
-typedef struct CompEditorFactoryPrivate CompEditorFactoryPrivate;
-
-typedef struct {
- BonoboObject object;
-
- /* Private data */
- CompEditorFactoryPrivate *priv;
-} CompEditorFactory;
-
-typedef struct {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Calendar_CompEditorFactory__epv epv;
-} CompEditorFactoryClass;
-
-GType comp_editor_factory_get_type (void);
-
-CompEditorFactory *comp_editor_factory_new (void);
-
-
-
-#endif
diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c
deleted file mode 100644
index 3e7b7499cc..0000000000
--- a/calendar/gui/control-factory.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include <config.h>
-#include <string.h>
-#include <gtk/gtk.h>
-#include <glade/glade.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-persist-file.h>
-#include <bonobo/bonobo-context.h>
-#include <glade/glade.h>
-
-#include <libecal/e-cal-time-util.h>
-#include <gui/gnome-cal.h>
-#include <gui/calendar-commands.h>
-#include <gui/calendar-config.h>
-
-#include "control-factory.h"
-
-/* Are these supposed to be global or static? */
-CORBA_Environment ev;
-CORBA_ORB orb;
-
-static void
-control_activate_cb (BonoboControl *control, gboolean activate, gpointer data)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- if (activate)
- calendar_control_activate (control, gcal);
- else
- calendar_control_deactivate (control, gcal);
-}
-
-BonoboControl *
-control_factory_new_control (void)
-{
- BonoboControl *control;
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (gnome_calendar_new ());
- if (!gcal)
- return NULL;
-
- gtk_widget_show (GTK_WIDGET (gcal));
-
- control = bonobo_control_new (GTK_WIDGET (gcal));
- if (!control) {
- g_message ("control_factory_fn(): could not create the control!");
- return NULL;
- }
- g_object_set_data (G_OBJECT (gcal), "control", control);
-
- g_signal_connect (control, "activate", G_CALLBACK (control_activate_cb), gcal);
-
- return control;
-}
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index f00adc0f0d..097c91907f 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -31,6 +31,7 @@
#include "../calendar-config.h"
#include "cal-prefs-dialog.h"
#include <widgets/misc/e-dateedit.h>
+#include <e-util/e-binding.h>
#include <e-util/e-dialog-widgets.h>
#include <e-util/e-util-private.h>
#include <glib/gi18n.h>
@@ -486,7 +487,9 @@ template_url_changed (GtkEntry *entry, CalendarPrefsDialog *prefs)
}
static void
-update_system_tz_widgets (CalendarPrefsDialog *prefs)
+update_system_tz_widgets (EShellSettings *shell_settings,
+ GParamSpec *pspec,
+ CalendarPrefsDialog *prefs)
{
icaltimezone *zone;
@@ -498,15 +501,6 @@ update_system_tz_widgets (CalendarPrefsDialog *prefs)
} else {
gtk_label_set_text (GTK_LABEL (prefs->system_tz_label), "(UTC)");
}
-
- gtk_widget_set_sensitive (prefs->timezone, !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prefs->use_system_tz_check)));
-}
-
-static void
-use_system_tz_changed (GtkWidget *check, CalendarPrefsDialog *prefs)
-{
- calendar_config_set_use_system_timezone (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
- update_system_tz_widgets (prefs);
}
static void
@@ -517,7 +511,6 @@ setup_changes (CalendarPrefsDialog *prefs)
for (i = 0; i < 7; i ++)
g_signal_connect (G_OBJECT (prefs->working_days[i]), "toggled", G_CALLBACK (working_days_changed), prefs);
- g_signal_connect (G_OBJECT (prefs->use_system_tz_check), "toggled", G_CALLBACK (use_system_tz_changed), prefs);
g_signal_connect (G_OBJECT (prefs->timezone), "changed", G_CALLBACK (timezone_changed), prefs);
g_signal_connect (G_OBJECT (prefs->day_second_zone), "clicked", G_CALLBACK (day_second_zone_clicked), prefs);
@@ -652,11 +645,6 @@ show_config (CalendarPrefsDialog *prefs)
CalUnits units;
int interval;
- /* Use system timezone */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->use_system_tz_check), calendar_config_get_use_system_timezone ());
- gtk_widget_set_sensitive (prefs->system_tz_label, FALSE);
- update_system_tz_widgets (prefs);
-
/* Timezone. */
location = calendar_config_get_timezone_stored ();
zone = icaltimezone_get_builtin_timezone (location);
@@ -666,6 +654,9 @@ show_config (CalendarPrefsDialog *prefs)
/* Day's second zone */
update_day_second_zone_caption (prefs);
+ /* Day's second zone */
+ update_day_second_zone_caption (prefs);
+
/* Working Days. */
working_days = calendar_config_get_working_days ();
mask = 1 << 0;
@@ -759,13 +750,16 @@ eccp_free (EConfig *ec, GSList *items, void *data)
}
static void
-calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs)
+calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
+ EShell *shell)
{
GladeXML *gui;
ECalConfig *ec;
ECalConfigTargetPrefs *target;
+ EShellSettings *shell_settings;
int i;
GtkWidget *toplevel;
+ GtkWidget *widget;
GSList *l;
const char *working_day_names[] = {
"sun_button",
@@ -778,6 +772,8 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs)
};
char *gladefile;
+ shell_settings = e_shell_get_shell_settings (shell);
+
gladefile = g_build_filename (EVOLUTION_GLADEDIR,
"cal-prefs-dialog.glade",
NULL);
@@ -801,8 +797,20 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs)
l = g_slist_prepend (l, &eccp_items[i]);
e_config_add_items ((EConfig *) ec, l, NULL, NULL, eccp_free, prefs);
+ widget = glade_xml_get_widget (gui, "use-system-tz-check");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-use-system-timezone",
+ G_OBJECT (widget), "active");
+ g_signal_connect (
+ G_OBJECT (shell_settings), "notify::cal-use-system-timezone",
+ G_CALLBACK (update_system_tz_widgets), prefs);
+
+ widget = glade_xml_get_widget (gui, "timezone");
+ e_mutual_binding_new_with_negation (
+ G_OBJECT (shell_settings), "cal-use-system-timezone",
+ G_OBJECT (widget), "sensitive");
+
/* General tab */
- prefs->use_system_tz_check = glade_xml_get_widget (gui, "use-system-tz-check");
prefs->system_tz_label = glade_xml_get_widget (gui, "system-tz-label");
prefs->timezone = glade_xml_get_widget (gui, "timezone");
prefs->day_second_zone = glade_xml_get_widget (gui, "day_second_zone");
@@ -873,14 +881,18 @@ calendar_prefs_dialog_get_type (void)
}
GtkWidget *
-calendar_prefs_dialog_new (void)
+calendar_prefs_dialog_new (EShell *shell)
{
CalendarPrefsDialog *dialog;
- dialog = (CalendarPrefsDialog *) g_object_new (calendar_prefs_dialog_get_type (), NULL);
- calendar_prefs_dialog_construct (dialog);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+
+ dialog = g_object_new (CALENDAR_TYPE_PREFS_DIALOG, NULL);
+
+ /* FIXME Kill this function. */
+ calendar_prefs_dialog_construct (dialog, shell);
- return (GtkWidget *) dialog;
+ return GTK_WIDGET (dialog);
}
/* called by libglade to create our custom EDateEdit widgets. */
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h
index 647df417df..397cb35cfa 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.h
+++ b/calendar/gui/dialogs/cal-prefs-dialog.h
@@ -21,14 +21,33 @@
*
*/
-#ifndef _CAL_PREFS_DIALOG_H_
-#define _CAL_PREFS_DIALOG_H_
+#ifndef CAL_PREFS_DIALOG_H
+#define CAL_PREFS_DIALOG_H
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <gconf/gconf-client.h>
#include <libedataserverui/e-source-selector.h>
-#include "evolution-config-control.h"
+#include <shell/e-shell.h>
+
+/* Standard GObject macros */
+#define CALENDAR_TYPE_PREFS_DIALOG \
+ (calendar_prefs_dialog_get_type ())
+#define CALENDAR_PREFS_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CALENDAR_TYPE_PREFS_DIALOG, CalendarPrefsDialog))
+#define CALENDAR_PREFS_DIALOG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CALENDAR_TYPE_PREFS_DIALOG, CalendarPrefsDialogClass))
+#define CALENDAR_IS_PREFS_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CALENDAR_TYPE_PREFS_DIALOG))
+#define CALENDAR_IS_PREFS_DIALOG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CALENDAR_TYPE_PREFS_DIALOG))
+#define CALENDAR_PREFS_DIALOG_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CALENDAR_TYPE_PREFS_DIALOG, CalendarPrefsDialogClass))
G_BEGIN_DECLS
@@ -43,7 +62,6 @@ struct _CalendarPrefsDialog {
GConfClient *gconf;
/* General tab */
- GtkWidget *use_system_tz_check;
GtkWidget *system_tz_label;
GtkWidget *timezone;
GtkWidget *day_second_zone;
@@ -95,9 +113,9 @@ struct _CalendarPrefsDialogClass {
GtkVBoxClass parent;
};
-GType calendar_prefs_dialog_get_type (void);
-GtkWidget *calendar_prefs_dialog_new (void);
+GType calendar_prefs_dialog_get_type (void);
+GtkWidget * calendar_prefs_dialog_new (EShell *shell);
G_END_DECLS
-#endif /* _CAL_PREFS_DIALOG_H_ */
+#endif /* CAL_PREFS_DIALOG_H */
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index cd2dac7a9e..06fd724680 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -39,7 +39,7 @@
#include <e-util/e-dialog-utils.h>
#include <e-util/e-util-private.h>
#include <e-util/gconf-bridge.h>
-#include <evolution-shell-component-utils.h>
+#include <shell/e-shell.h>
#include <camel/camel-url.h>
#include <camel/camel-exception.h>
@@ -76,6 +76,9 @@
/* Private part of the CompEditor structure */
struct _CompEditorPrivate {
+
+ gpointer shell; /* weak pointer */
+
/* Client to use */
ECal *client;
@@ -125,6 +128,7 @@ enum {
PROP_CHANGED,
PROP_CLIENT,
PROP_FLAGS,
+ PROP_SHELL,
PROP_SUMMARY
};
@@ -133,7 +137,10 @@ static const gchar *ui =
" <menubar action='main-menu'>"
" <menu action='file-menu'>"
" <menuitem action='save'/>"
+" <separator/>"
+" <menuitem action='print-preview'/>"
" <menuitem action='print'/>"
+" <separator/>"
" <menuitem action='close'/>"
" </menu>"
" <menu action='edit-menu'>"
@@ -170,8 +177,8 @@ static void close_dialog (CompEditor *editor);
static void page_dates_changed_cb (CompEditor *editor, CompEditorPageDates *dates, CompEditorPage *page);
-static void obj_modified_cb (ECal *client, GList *objs, gpointer data);
-static void obj_removed_cb (ECal *client, GList *uids, gpointer data);
+static void obj_modified_cb (ECal *client, GList *objs, CompEditor *editor);
+static void obj_removed_cb (ECal *client, GList *uids, CompEditor *editor);
G_DEFINE_TYPE (CompEditor, comp_editor, GTK_TYPE_WINDOW)
@@ -180,7 +187,15 @@ enum {
LAST_SIGNAL
};
-static guint comp_editor_signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL];
+static GList *active_editors;
+
+static void
+comp_editor_weak_notify_cb (gpointer unused,
+ GObject *where_the_object_was)
+{
+ active_editors = g_list_remove (active_editors, where_the_object_was);
+}
static void
attachment_store_changed_cb (CompEditor *editor)
@@ -697,17 +712,22 @@ action_print_cb (GtkAction *action,
CompEditor *editor)
{
CompEditorPrivate *priv = editor->priv;
+ GtkPrintOperationAction print_action;
ECalComponent *comp;
GList *l;
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp);
+ icalcomponent *component;
+ icalcomponent *clone;
comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+ component = e_cal_component_get_icalcomponent (priv->comp);
+ clone = icalcomponent_new_clone (component);
+ e_cal_component_set_icalcomponent (comp, clone);
for (l = priv->pages; l != NULL; l = l->next)
comp_editor_page_fill_component (l->data, comp);
- print_comp (comp, priv->client, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+ print_comp (comp, priv->client, print_action);
g_object_unref (comp);
}
@@ -717,15 +737,22 @@ action_print_preview_cb (GtkAction *action,
CompEditor *editor)
{
CompEditorPrivate *priv = editor->priv;
+ GtkPrintOperationAction print_action;
ECalComponent *comp;
GList *l;
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp);
+ icalcomponent *component;
+ icalcomponent *clone;
comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+ component = e_cal_component_get_icalcomponent (priv->comp);
+ clone = icalcomponent_new_clone (component);
+ e_cal_component_set_icalcomponent (comp, clone);
+
for (l = priv->pages; l != NULL; l = l->next)
comp_editor_page_fill_component (l->data, comp);
- print_comp (comp, priv->client, TRUE);
+
+ print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
+ print_comp (comp, priv->client, print_action);
g_object_unref (comp);
}
@@ -793,12 +820,10 @@ action_save_cb (GtkAction *action,
if (e_cal_component_has_recurrences (priv->comp)) {
if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor), delegated))
return;
-
} else if (e_cal_component_is_instance (priv->comp))
priv->mod = CALOBJ_MOD_THIS;
comp = comp_editor_get_current_comp (editor, &correct);
-
e_cal_component_get_summary (comp, &text);
g_object_unref (comp);
@@ -1180,6 +1205,17 @@ comp_editor_setup_recent_menu (CompEditor *editor)
}
static void
+comp_editor_set_shell (CompEditor *editor,
+ EShell *shell)
+{
+ g_return_if_fail (editor->priv->shell == NULL);
+
+ editor->priv->shell = shell;
+
+ g_object_add_weak_pointer (G_OBJECT (shell), &editor->priv->shell);
+}
+
+static void
comp_editor_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -1204,6 +1240,12 @@ comp_editor_set_property (GObject *object,
g_value_get_int (value));
return;
+ case PROP_SHELL:
+ comp_editor_set_shell (
+ COMP_EDITOR (object),
+ g_value_get_object (value));
+ return;
+
case PROP_SUMMARY:
comp_editor_set_summary (
COMP_EDITOR (object),
@@ -1239,6 +1281,12 @@ comp_editor_get_property (GObject *object,
COMP_EDITOR (object)));
return;
+ case PROP_SHELL:
+ g_value_set_object (
+ value, comp_editor_get_shell (
+ COMP_EDITOR (object)));
+ return;
+
case PROP_SUMMARY:
g_value_set_string (
value, comp_editor_get_summary (
@@ -1314,42 +1362,39 @@ static void
comp_editor_map (GtkWidget *widget)
{
CompEditor *editor = COMP_EDITOR (widget);
- GConfBridge *bridge = gconf_bridge_get ();
+ GConfBridge *bridge;
GtkAction *action;
+ const gchar *key;
+
+ bridge = gconf_bridge_get ();
/* Give subclasses a chance to construct their pages before
* we fiddle with their widgets. That's why we don't do this
* until after object construction. */
+ key = "/apps/evolution/calendar/display/show_categories";
action = comp_editor_get_action (editor, "view-categories");
- gconf_bridge_bind_property (
- bridge, CALENDAR_CONFIG_SHOW_CATEGORIES,
- G_OBJECT (action), "active");
+ gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+ key = "/apps/evolution/calendar/display/show_role";
action = comp_editor_get_action (editor, "view-role");
- gconf_bridge_bind_property (
- bridge, CALENDAR_CONFIG_SHOW_ROLE,
- G_OBJECT (action), "active");
+ gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+ key = "/apps/evolution/calendar/display/show_rsvp";
action = comp_editor_get_action (editor, "view-rsvp");
- gconf_bridge_bind_property (
- bridge, CALENDAR_CONFIG_SHOW_RSVP,
- G_OBJECT (action), "active");
+ gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+ key = "/apps/evolution/calendar/display/show_status";
action = comp_editor_get_action (editor, "view-status");
- gconf_bridge_bind_property (
- bridge, CALENDAR_CONFIG_SHOW_STATUS,
- G_OBJECT (action), "active");
+ gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+ key = "/apps/evolution/calendar/display/show_timezone";
action = comp_editor_get_action (editor, "view-time-zone");
- gconf_bridge_bind_property (
- bridge, CALENDAR_CONFIG_SHOW_TIMEZONE,
- G_OBJECT (action), "active");
+ gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+ key = "/apps/evolution/calendar/display/show_type";
action = comp_editor_get_action (editor, "view-type");
- gconf_bridge_bind_property (
- bridge, CALENDAR_CONFIG_SHOW_TYPE,
- G_OBJECT (action), "active");
+ gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
/* Chain up to parent's map() method. */
GTK_WIDGET_CLASS (comp_editor_parent_class)->map (widget);
@@ -1496,6 +1541,17 @@ comp_editor_class_init (CompEditorClass *class)
g_object_class_install_property (
object_class,
+ PROP_SHELL,
+ g_param_spec_object (
+ "shell",
+ NULL,
+ NULL,
+ E_TYPE_SHELL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ object_class,
PROP_SUMMARY,
g_param_spec_string (
"summary",
@@ -1504,7 +1560,7 @@ comp_editor_class_init (CompEditorClass *class)
NULL,
G_PARAM_READWRITE));
- comp_editor_signals[OBJECT_CREATED] =
+ signals[OBJECT_CREATED] =
g_signal_new ("object_created",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
@@ -1527,11 +1583,18 @@ comp_editor_init (CompEditor *editor)
GtkAction *action;
GtkWidget *container;
GtkWidget *widget;
+ EShell *shell;
gint n_targets;
GError *error = NULL;
editor->priv = priv = COMP_EDITOR_GET_PRIVATE (editor);
+ g_object_weak_ref (
+ G_OBJECT (editor), (GWeakNotify)
+ comp_editor_weak_notify_cb, NULL);
+
+ active_editors = g_list_prepend (active_editors, editor);
+
priv->pages = NULL;
priv->changed = FALSE;
priv->needs_send = FALSE;
@@ -1665,6 +1728,10 @@ comp_editor_init (CompEditor *editor)
g_signal_connect_swapped (
store, "row-inserted",
G_CALLBACK (attachment_store_changed_cb), editor);
+
+ /* FIXME Shell should be passed in. */
+ shell = e_shell_get_default ();
+ e_shell_watch_window (shell, GTK_WINDOW (editor));
}
static gboolean
@@ -1747,7 +1814,18 @@ close_dialog (CompEditor *editor)
gtk_widget_destroy (GTK_WIDGET (editor));
}
-
+gint
+comp_editor_compare (CompEditor *editor_a,
+ CompEditor *editor_b)
+{
+ const gchar *uid_a = NULL;
+ const gchar *uid_b = NULL;
+
+ e_cal_component_get_uid (editor_a->priv->comp, &uid_a);
+ e_cal_component_get_uid (editor_b->priv->comp, &uid_b);
+
+ return g_strcmp0 (uid_a, uid_b);
+}
void
comp_editor_set_existing_org (CompEditor *editor, gboolean existing_org)
@@ -1833,6 +1911,14 @@ comp_editor_get_classification (CompEditor *editor)
return gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
}
+EShell *
+comp_editor_get_shell (CompEditor *editor)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
+
+ return editor->priv->shell;
+}
+
void
comp_editor_set_summary (CompEditor *editor,
const gchar *summary)
@@ -1938,11 +2024,10 @@ comp_editor_set_flags (CompEditor *editor,
g_object_notify (G_OBJECT (editor), "flags");
}
-
CompEditorFlags
comp_editor_get_flags (CompEditor *editor)
{
- g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), 0);
return editor->priv->flags;
}
@@ -2000,6 +2085,20 @@ comp_editor_get_managed_widget (CompEditor *editor,
return widget;
}
+CompEditor *
+comp_editor_find_instance (const gchar *uid)
+{
+ GList *link;
+
+ g_return_val_if_fail (uid != NULL, NULL);
+
+ link = g_list_find_custom (
+ active_editors, uid,
+ (GCompareFunc) comp_editor_compare);
+
+ return (link != NULL) ? link->data : NULL;
+}
+
/**
* comp_editor_set_needs_send:
* @editor: A component editor
@@ -2275,8 +2374,14 @@ fill_widgets (CompEditor *editor)
EAttachmentStore *store;
EAttachmentView *view;
CompEditorPrivate *priv;
- GList *l;
GtkAction *action;
+ GList *iter;
+
+ view = E_ATTACHMENT_VIEW (editor->priv->attachment_view);
+ store = e_attachment_view_get_store (view);
+
+ view = E_ATTACHMENT_VIEW (editor->priv->attachment_view);
+ store = e_attachment_view_get_store (view);
view = E_ATTACHMENT_VIEW (editor->priv->attachment_view);
store = e_attachment_view_get_store (view);
@@ -2299,12 +2404,14 @@ fill_widgets (CompEditor *editor)
}
action = comp_editor_get_action (editor, "classify-public");
- g_signal_handlers_block_by_func (action, G_CALLBACK (action_classification_cb), editor);
+ g_signal_handlers_block_by_func (
+ action, G_CALLBACK (action_classification_cb), editor);
- for (l = priv->pages; l != NULL; l = l->next)
- comp_editor_page_fill_widgets (l->data, priv->comp);
+ for (iter = priv->pages; iter != NULL; iter = iter->next)
+ comp_editor_page_fill_widgets (iter->data, priv->comp);
- g_signal_handlers_unblock_by_func (action, G_CALLBACK (action_classification_cb), editor);
+ g_signal_handlers_unblock_by_func (
+ action, G_CALLBACK (action_classification_cb), editor);
}
static void
@@ -2710,9 +2817,10 @@ page_dates_changed_cb (CompEditor *editor,
}
static void
-obj_modified_cb (ECal *client, GList *objects, gpointer data)
+obj_modified_cb (ECal *client,
+ GList *objects,
+ CompEditor *editor)
{
- CompEditor *editor = COMP_EDITOR (data);
CompEditorPrivate *priv;
ECalComponent *comp = NULL;
@@ -2745,12 +2853,11 @@ obj_modified_cb (ECal *client, GList *objects, gpointer data)
}
static void
-obj_removed_cb (ECal *client, GList *uids, gpointer data)
+obj_removed_cb (ECal *client,
+ GList *uids,
+ CompEditor *editor)
{
- CompEditor *editor = COMP_EDITOR (data);
- CompEditorPrivate *priv;
-
- priv = editor->priv;
+ CompEditorPrivate *priv = editor->priv;
if (changed_component_dialog ((GtkWindow *) editor, priv->comp, TRUE, priv->changed))
close_dialog (editor);
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index 22167cb78f..278501b9ba 100644
--- a/calendar/gui/dialogs/comp-editor.h
+++ b/calendar/gui/dialogs/comp-editor.h
@@ -29,6 +29,7 @@
#include <libecal/e-cal.h>
#include "../itip-utils.h"
#include "comp-editor-page.h"
+#include <shell/e-shell.h>
/* Standard GObject macros */
#define TYPE_COMP_EDITOR \
@@ -87,6 +88,8 @@ typedef enum {
} CompEditorFlags;
GType comp_editor_get_type (void);
+gint comp_editor_compare (CompEditor *editor_a,
+ CompEditor *editor_b);
void comp_editor_set_changed (CompEditor *editor,
gboolean changed);
gboolean comp_editor_get_changed (CompEditor *editor);
@@ -106,6 +109,7 @@ void comp_editor_set_classification (CompEditor *editor,
ECalComponentClassification classification);
ECalComponentClassification
comp_editor_get_classification (CompEditor *editor);
+EShell * comp_editor_get_shell (CompEditor *editor);
void comp_editor_set_summary (CompEditor *editor,
const gchar *summary);
const gchar * comp_editor_get_summary (CompEditor *editor);
@@ -150,6 +154,7 @@ GtkActionGroup *
const gchar *group_name);
GtkWidget * comp_editor_get_managed_widget (CompEditor *editor,
const gchar *widget_path);
+CompEditor * comp_editor_find_instance (const gchar *uid);
G_END_DECLS
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index cff9d75950..987c716b6f 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -36,7 +36,6 @@
#include <misc/e-dateedit.h>
#include <e-util/e-plugin-ui.h>
#include <e-util/e-util-private.h>
-#include <evolution-shell-component-utils.h>
#include "event-page.h"
#include "recurrence-page.h"
@@ -466,6 +465,7 @@ event_editor_init (EventEditor *ee)
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
GtkAction *action;
+ const gchar *id;
GError *error = NULL;
ee->priv = EVENT_EDITOR_GET_PRIVATE (ee);
@@ -488,7 +488,10 @@ event_editor_init (EventEditor *ee)
ui_manager = comp_editor_get_ui_manager (editor);
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
- e_plugin_ui_register_manager ("event-editor", ui_manager, ee);
+
+ id = "org.gnome.evolution.event-editor";
+ e_plugin_ui_register_manager (ui_manager, id, ee);
+ e_plugin_ui_enable_manager (ui_manager, id);
if (error != NULL) {
g_critical ("%s: %s", G_STRFUNC, error->message);
@@ -662,13 +665,16 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboo
* editor could not be created.
**/
CompEditor *
-event_editor_new (ECal *client, CompEditorFlags flags)
+event_editor_new (ECal *client,
+ EShell *shell,
+ CompEditorFlags flags)
{
g_return_val_if_fail (E_IS_CAL (client), NULL);
+ g_return_val_if_fail (E_IS_SHELL (client), NULL);
return g_object_new (
TYPE_EVENT_EDITOR,
- "flags", flags, "client", client, NULL);
+ "client", client, "flags", flags, "shell", shell, NULL);
}
void
diff --git a/calendar/gui/dialogs/event-editor.h b/calendar/gui/dialogs/event-editor.h
index 03afd6448a..abb8f0e659 100644
--- a/calendar/gui/dialogs/event-editor.h
+++ b/calendar/gui/dialogs/event-editor.h
@@ -66,6 +66,7 @@ struct _EventEditorClass {
GType event_editor_get_type (void);
CompEditor * event_editor_new (ECal *client,
+ EShell *shell,
CompEditorFlags flags);
void event_editor_show_meeting (EventEditor *ee);
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index b2ac6b55db..fa1faa2f79 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -381,9 +381,11 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD
EventPagePrivate *priv = epage->priv;
CompEditor *editor;
ECal *client;
+ GtkAction *action;
struct icaltimetype *start_tt, *end_tt, implied_tt;
icaltimezone *start_zone = NULL, *def_zone = NULL;
gboolean all_day_event, homezone=TRUE;
+ gboolean show_timezone;
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
client = comp_editor_get_client (editor);
@@ -455,7 +457,9 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD
if (!def_zone || !start_zone || strcmp (icaltimezone_get_tzid(def_zone), icaltimezone_get_tzid (start_zone)))
homezone = FALSE;
- event_page_set_show_timezone (epage, (calendar_config_get_show_timezone()|| !homezone) & !all_day_event);
+ action = comp_editor_get_action (editor, "view-time-zone");
+ show_timezone = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ event_page_set_show_timezone (epage, (show_timezone || !homezone) & !all_day_event);
/*unblock the endtimezone widget*/
g_signal_handlers_unblock_matched (priv->end_timezone, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
@@ -1815,15 +1819,10 @@ remove_clicked_cb (GtkButton *btn, EventPage *epage)
}
static void
-invite_cb (GtkWidget *widget, gpointer data)
+invite_cb (GtkWidget *widget,
+ EventPage *page)
{
- EventPage *page;
- EventPagePrivate *priv;
-
- page = EVENT_PAGE (data);
- priv = page->priv;
-
- e_meeting_list_view_invite_others_dialog (priv->list_view);
+ e_meeting_list_view_invite_others_dialog (page->priv->list_view);
}
static void
@@ -2013,6 +2012,7 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day)
CompEditor *editor;
GtkAction *action;
gboolean date_set;
+ gboolean active;
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
@@ -2091,7 +2091,10 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day)
TRUE);
}
- event_page_set_show_timezone (epage, calendar_config_get_show_timezone() & !all_day);
+ action = comp_editor_get_action (editor, "view-time-zone");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ event_page_set_show_timezone (epage, active & !all_day);
+
g_signal_handlers_block_matched (priv->start_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
g_signal_handlers_block_matched (priv->end_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage);
@@ -2173,10 +2176,12 @@ event_page_set_info_string (EventPage *epage, const gchar *icon, const gchar *ms
static gboolean
get_widgets (EventPage *epage)
{
+ CompEditor *editor;
CompEditorPage *page = COMP_EDITOR_PAGE (epage);
GtkEntryCompletion *completion;
EventPagePrivate *priv;
GSList *accel_groups;
+ GtkAction *action;
GtkWidget *toplevel;
GtkWidget *sw;
@@ -2184,6 +2189,8 @@ get_widgets (EventPage *epage)
#define GW(name) glade_xml_get_widget (priv->xml, name)
+ editor = comp_editor_page_get_editor (page);
+
priv->main = GW ("event-page");
if (!priv->main)
return FALSE;
@@ -2205,7 +2212,8 @@ get_widgets (EventPage *epage)
gtk_widget_show (priv->status_icons);
- if (!calendar_config_get_show_timezone()) {
+ action = comp_editor_get_action (editor, "view-time-zone");
+ if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
gtk_widget_hide (priv->timezone_label);
gtk_widget_hide (priv->start_timezone);
} else {
@@ -2483,14 +2491,10 @@ times_updated (EventPage *epage, gboolean adjust_end_time)
* start date < end date and we set the "all day event" button as appropriate.
*/
static void
-start_date_changed_cb (GtkWidget *dedit, gpointer data)
+start_date_changed_cb (GtkWidget *dedit,
+ EventPage *epage)
{
- EventPage *epage;
-
- epage = EVENT_PAGE (data);
-
hour_minute_changed (epage);
-
times_updated (epage, TRUE);
}
@@ -2498,12 +2502,9 @@ start_date_changed_cb (GtkWidget *dedit, gpointer data)
* start date < end date and we set the "all day event" button as appropriate.
*/
static void
-end_date_changed_cb (GtkWidget *dedit, gpointer data)
+end_date_changed_cb (GtkWidget *dedit,
+ EventPage *epage)
{
- EventPage *epage;
-
- epage = EVENT_PAGE (data);
-
times_updated (epage, FALSE);
}
@@ -2512,15 +2513,12 @@ end_date_changed_cb (GtkWidget *dedit, gpointer data)
* labels on the other notebook pages.
*/
static void
-start_timezone_changed_cb (GtkWidget *widget, gpointer data)
+start_timezone_changed_cb (GtkWidget *widget,
+ EventPage *epage)
{
- EventPage *epage;
- EventPagePrivate *priv;
+ EventPagePrivate *priv = epage->priv;
icaltimezone *zone;
- epage = EVENT_PAGE (data);
- priv = epage->priv;
-
if (priv->sync_timezones) {
zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
comp_editor_page_set_updating (COMP_EDITOR_PAGE (epage), TRUE);
@@ -2537,17 +2535,13 @@ start_timezone_changed_cb (GtkWidget *widget, gpointer data)
* category list dialog.
*/
static void
-categories_clicked_cb (GtkWidget *button, gpointer data)
+categories_clicked_cb (GtkWidget *button,
+ EventPage *epage)
{
- EventPage *epage;
- EventPagePrivate *priv;
- GtkWidget *entry;
+ GtkEntry *entry;
- epage = EVENT_PAGE (data);
- priv = epage->priv;
-
- entry = priv->categories;
- e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry));
+ entry = GTK_ENTRY (epage->priv->categories);
+ e_categories_config_open_dialog_for_entry (entry);
}
void
@@ -2666,13 +2660,10 @@ set_subscriber_info_string (EventPage *epage, const char *backend_address)
}
static void
-alarm_changed_cb (GtkWidget *widget, gpointer data)
+alarm_changed_cb (GtkWidget *widget,
+ EventPage *epage)
{
- EventPage *epage;
- EventPagePrivate *priv;
-
- epage = EVENT_PAGE (data);
- priv = epage->priv;
+ EventPagePrivate *priv = epage->priv;
if (e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map) != ALARM_NONE) {
ECalComponentAlarm *ca;
@@ -2814,7 +2805,9 @@ init_widgets (EventPage *epage)
GtkTextBuffer *text_buffer;
icaltimezone *zone;
char *combo_label = NULL;
+ GtkAction *action;
GtkTreeSelection *selection;
+ gboolean active;
ECal *client;
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
@@ -2871,11 +2864,28 @@ init_widgets (EventPage *epage)
g_signal_connect((priv->start_timezone), "changed",
G_CALLBACK (start_timezone_changed_cb), epage);
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE);
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ROLE_COL, calendar_config_get_show_role ());
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, calendar_config_get_show_rsvp ());
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_STATUS_COL, calendar_config_get_show_status ());
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_TYPE_COL, calendar_config_get_show_type ());
+ e_meeting_list_view_column_set_visible (
+ priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE);
+
+ action = comp_editor_get_action (editor, "view-role");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ e_meeting_list_view_column_set_visible (
+ priv->list_view, E_MEETING_STORE_ROLE_COL, active);
+
+ action = comp_editor_get_action (editor, "view-rsvp");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ e_meeting_list_view_column_set_visible (
+ priv->list_view, E_MEETING_STORE_RSVP_COL, active);
+
+ action = comp_editor_get_action (editor, "view-status");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ e_meeting_list_view_column_set_visible (
+ priv->list_view, E_MEETING_STORE_STATUS_COL, active);
+
+ action = comp_editor_get_action (editor, "view-type");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ e_meeting_list_view_column_set_visible (
+ priv->list_view, E_MEETING_STORE_TYPE_COL, active);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->list_view));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
@@ -2911,7 +2921,8 @@ init_widgets (EventPage *epage)
gtk_widget_show (GTK_WIDGET (priv->list_view));
/* categories */
- if (!calendar_config_get_show_categories()) {
+ action = comp_editor_get_action (editor, "view-categories");
+ if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
gtk_widget_hide (priv->categories_btn);
gtk_widget_hide (priv->categories);
} else {
@@ -3005,7 +3016,9 @@ init_widgets (EventPage *epage)
e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->start_timezone), zone);
e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->end_timezone), zone);
- event_page_set_show_timezone (epage, calendar_config_get_show_timezone());
+ action = comp_editor_get_action (editor, "view-time-zone");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ event_page_set_show_timezone (epage, active);
return TRUE;
}
diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c
index cf3781a3c2..bda54e55eb 100644
--- a/calendar/gui/dialogs/memo-editor.c
+++ b/calendar/gui/dialogs/memo-editor.c
@@ -34,7 +34,6 @@
#include <e-util/e-plugin-ui.h>
#include <e-util/e-util-private.h>
-#include <evolution-shell-component-utils.h>
#include "memo-page.h"
#include "cancel-comp.h"
@@ -135,6 +134,7 @@ memo_editor_init (MemoEditor *me)
{
CompEditor *editor = COMP_EDITOR (me);
GtkUIManager *ui_manager;
+ const gchar *id;
GError *error = NULL;
me->priv = MEMO_EDITOR_GET_PRIVATE (me);
@@ -142,7 +142,10 @@ memo_editor_init (MemoEditor *me)
ui_manager = comp_editor_get_ui_manager (editor);
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
- e_plugin_ui_register_manager ("memo-editor", ui_manager, me);
+
+ id = "org.gnome.evolution.memo-editor";
+ e_plugin_ui_register_manager (ui_manager, id, me);
+ e_plugin_ui_enable_manager (ui_manager, id);
if (error != NULL) {
g_critical ("%s: %s", G_STRFUNC, error->message);
@@ -160,11 +163,14 @@ memo_editor_init (MemoEditor *me)
* editor could not be created.
**/
CompEditor *
-memo_editor_new (ECal *client, CompEditorFlags flags)
+memo_editor_new (ECal *client,
+ EShell *shell,
+ CompEditorFlags flags)
{
g_return_val_if_fail (E_IS_CAL (client), NULL);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
return g_object_new (
TYPE_MEMO_EDITOR,
- "flags", flags, "client", client, NULL);
+ "client", client, "flags", flags, "shell", shell, NULL);
}
diff --git a/calendar/gui/dialogs/memo-editor.h b/calendar/gui/dialogs/memo-editor.h
index 2e431b507f..cd4bc194ac 100644
--- a/calendar/gui/dialogs/memo-editor.h
+++ b/calendar/gui/dialogs/memo-editor.h
@@ -68,6 +68,7 @@ struct _MemoEditorClass {
GType memo_editor_get_type (void);
CompEditor * memo_editor_new (ECal *client,
+ EShell *shell,
CompEditorFlags flags);
G_END_DECLS
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index 957b8f695c..f8ce1bece2 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -929,9 +929,14 @@ to_button_clicked_cb (GtkButton *button,
static gboolean
init_widgets (MemoPage *mpage)
{
+ CompEditor *editor;
MemoPagePrivate *priv = mpage->priv;
GtkTextBuffer *buffer;
GtkTextView *view;
+ GtkAction *action;
+ gboolean active;
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
/* Generic informative messages */
gtk_widget_hide (priv->info_hbox);
@@ -996,8 +1001,9 @@ init_widgets (MemoPage *mpage)
G_CALLBACK (comp_editor_page_changed), mpage);
}
- memo_page_set_show_categories (
- mpage, calendar_config_get_show_categories());
+ action = comp_editor_get_action (editor, "view-categories");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ memo_page_set_show_categories (mpage, active);
return TRUE;
}
diff --git a/calendar/gui/dialogs/memo-page.glade b/calendar/gui/dialogs/memo-page.glade
index b1ff10f3f4..8728c9366e 100644
--- a/calendar/gui/dialogs/memo-page.glade
+++ b/calendar/gui/dialogs/memo-page.glade
@@ -159,6 +159,7 @@
<widget class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="label" translatable="yes">_Description:</property>
+ <property name="mnemonic_widget">memo_content</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c
index 7fb4679047..95764cde48 100644
--- a/calendar/gui/dialogs/task-details-page.c
+++ b/calendar/gui/dialogs/task-details-page.c
@@ -517,16 +517,15 @@ complete_date_changed (TaskDetailsPage *tdpage, time_t ctime, gboolean complete)
}
static void
-date_changed_cb (EDateEdit *dedit, gpointer data)
+date_changed_cb (EDateEdit *dedit,
+ TaskDetailsPage *tdpage)
{
- TaskDetailsPage *tdpage;
- TaskDetailsPagePrivate *priv;
+ TaskDetailsPagePrivate *priv = tdpage->priv;
CompEditorPageDates dates = {NULL, NULL, NULL, NULL};
struct icaltimetype completed_tt = icaltime_null_time ();
icalproperty_status status;
gboolean date_set;
- tdpage = TASK_DETAILS_PAGE (data);
priv = tdpage->priv;
if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tdpage)))
diff --git a/calendar/gui/dialogs/task-details-page.glade b/calendar/gui/dialogs/task-details-page.glade
index 44fc3b2fbb..aac90876ed 100644
--- a/calendar/gui/dialogs/task-details-page.glade
+++ b/calendar/gui/dialogs/task-details-page.glade
@@ -4,7 +4,7 @@
<glade-interface>
<widget class="GtkWindow" id="task-details-toplevel">
- <property name="title">window1</property>
+ <property name="title" translatable="no">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@@ -15,8 +15,6 @@
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
<child>
<widget class="GtkVBox" id="task-details-page">
@@ -38,10 +36,6 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -69,10 +63,6 @@
<property name="yalign">0.5</property>
<property name="xpad">12</property>
<property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -103,10 +93,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
+ <property name="mnemonic_widget">status</property>
</widget>
<packing>
<property name="left_attach">0</property>
@@ -132,10 +119,6 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">percent-complete</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@@ -160,10 +143,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
+ <property name="mnemonic_widget">priority</property>
</widget>
<packing>
<property name="left_attach">0</property>
@@ -188,10 +168,6 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
@@ -204,85 +180,153 @@
</child>
<child>
- <widget class="GtkSpinButton" id="percent-complete">
+ <widget class="GtkOptionMenu" id="priority">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">True</property>
- <property name="update_policy">GTK_UPDATE_ALWAYS</property>
- <property name="snap_to_ticks">False</property>
- <property name="wrap">False</property>
- <property name="adjustment">0 0 100 1 10 0</property>
+ <property name="history">0</property>
+
+ <child internal-child="menu">
+ <widget class="GtkMenu" id="convertwidget7">
+ <property name="visible">True</property>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget8">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">High</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget9">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Normal</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget10">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Low</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget11">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Undefined</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+ </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="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="Custom" id="completed-date">
+ <widget class="GtkOptionMenu" id="status">
<property name="visible">True</property>
- <property name="creation_function">task_details_page_create_date_edit</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 01 Jun 2001 18:58:51 GMT</property>
- <accessibility>
- <atkrelation target="date_completed_label" type="labelled-by"/>
- </accessibility>
+ <property name="can_focus">True</property>
+ <property name="history">0</property>
+
+ <child internal-child="menu">
+ <widget class="GtkMenu" id="convertwidget1">
+ <property name="visible">True</property>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Not Started</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">In Progress</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget5">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Completed</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="convertwidget6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Canceled</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
</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="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="GtkComboBox" id="priority-combobox">
+ <widget class="GtkSpinButton" id="percent-complete">
<property name="visible">True</property>
- <property name="items" translatable="yes">High
-Normal
-Low
-Undefined</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0 0 100 1 10 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="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">fill</property>
- <property name="y_options">fill</property>
+ <property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkComboBox" id="status-combobox">
+ <widget class="Custom" id="completed-date">
<property name="visible">True</property>
- <property name="items" translatable="yes">Not Started
-In Progress
-Completed
-Canceled</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
+ <property name="creation_function">task_details_page_create_date_edit</property>
+ <property name="int1">0</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Fri, 01 Jun 2001 18:58:51 GMT</property>
+ <accessibility>
+ <atkrelation target="date_completed_label" type="labelled-by"/>
+ </accessibility>
</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="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">fill</property>
- <property name="y_options">fill</property>
+ <property name="y_options"></property>
</packing>
</child>
</widget>
@@ -313,10 +357,6 @@ Canceled</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -344,10 +384,6 @@ Canceled</property>
<property name="yalign">0.5</property>
<property name="xpad">12</property>
<property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -379,10 +415,6 @@ Canceled</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index fbab8b0581..8926ac720b 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -35,7 +35,6 @@
#include <e-util/e-plugin-ui.h>
#include <e-util/e-util-private.h>
-#include <evolution-shell-component-utils.h>
#include "task-page.h"
#include "task-details-page.h"
@@ -304,6 +303,7 @@ task_editor_init (TaskEditor *te)
CompEditor *editor = COMP_EDITOR (te);
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
+ const gchar *id;
GError *error = NULL;
te->priv = TASK_EDITOR_GET_PRIVATE (te);
@@ -346,7 +346,10 @@ task_editor_init (TaskEditor *te)
ui_manager = comp_editor_get_ui_manager (editor);
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
- e_plugin_ui_register_manager ("task-editor", ui_manager, te);
+
+ id = "org.gnome.evolution.task-editor";
+ e_plugin_ui_register_manager (ui_manager, id, te);
+ e_plugin_ui_enable_manager (ui_manager, id);
if (error != NULL) {
g_critical ("%s: %s", G_STRFUNC, error->message);
@@ -489,13 +492,16 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gbool
* editor could not be created.
**/
CompEditor *
-task_editor_new (ECal *client, CompEditorFlags flags)
+task_editor_new (ECal *client,
+ EShell *shell,
+ CompEditorFlags flags)
{
g_return_val_if_fail (E_IS_CAL (client), NULL);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
return g_object_new (
TYPE_TASK_EDITOR,
- "flags", flags, "client", client, NULL);
+ "client", client, "flags", flags, "shell", shell, NULL);
}
void
diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h
index 57ab33b54f..f026acae0c 100644
--- a/calendar/gui/dialogs/task-editor.h
+++ b/calendar/gui/dialogs/task-editor.h
@@ -66,6 +66,7 @@ struct _TaskEditorClass {
GType task_editor_get_type (void);
CompEditor * task_editor_new (ECal *client,
+ EShell *shell,
CompEditorFlags flags);
void task_editor_show_assignment (TaskEditor *te);
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index b088fb4ff1..a3700f5bf7 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -451,12 +451,14 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
ECalComponentClassification cl;
CompEditor *editor;
CompEditorFlags flags;
+ GtkAction *action;
ECal *client;
GSList *l;
icalcomponent *icalcomp;
const char *categories, *uid;
icaltimezone *zone, *default_zone;
gchar *backend_addr = NULL;
+ gboolean active;
tpage = TASK_PAGE (page);
priv = tpage->priv;
@@ -538,7 +540,10 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->timezone),
zone ? zone : default_zone);
- task_page_set_show_timezone (tpage, calendar_config_get_show_timezone());
+
+ action = comp_editor_get_action (editor, "view-time-zone");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ task_page_set_show_timezone (tpage, active);
if (!(flags & COMP_EDITOR_NEW_ITEM) && !zone) {
GtkAction *action;
@@ -1125,15 +1130,10 @@ remove_clicked_cb (GtkButton *btn, TaskPage *page)
}
static void
-invite_cb (GtkWidget *widget, gpointer data)
+invite_cb (GtkWidget *widget,
+ TaskPage *page)
{
- TaskPage *page;
- TaskPagePrivate *priv;
-
- page = TASK_PAGE (data);
- priv = page->priv;
-
- e_meeting_list_view_invite_others_dialog (priv->list_view);
+ e_meeting_list_view_invite_others_dialog (page->priv->list_view);
}
static void
@@ -1494,17 +1494,16 @@ summary_changed_cb (GtkEditable *editable,
* other pages in the task editor, so they can update any labels.
*/
static void
-date_changed_cb (EDateEdit *dedit, gpointer data)
+date_changed_cb (EDateEdit *dedit,
+ TaskPage *tpage)
{
- TaskPage *tpage;
- TaskPagePrivate *priv;
+ TaskPagePrivate *priv = tpage->priv;
CompEditorPageDates dates;
gboolean date_set, time_set;
ECalComponentDateTime start_dt, due_dt;
struct icaltimetype start_tt = icaltime_null_time();
struct icaltimetype due_tt = icaltime_null_time();
- tpage = TASK_PAGE (data);
priv = tpage->priv;
if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tpage)))
@@ -1563,33 +1562,24 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
}
static void
-timezone_changed_cb (EDateEdit *dedit, gpointer data)
+timezone_changed_cb (EDateEdit *dedit,
+ TaskPage *tpage)
{
- TaskPage *tpage;
- TaskPagePrivate *priv;
-
- tpage = TASK_PAGE (data);
- priv = tpage->priv;
-
- date_changed_cb ((EDateEdit *) priv->start_date, tpage);
- date_changed_cb ((EDateEdit *) priv->due_date, tpage);
+ date_changed_cb ((EDateEdit *) tpage->priv->start_date, tpage);
+ date_changed_cb ((EDateEdit *) tpage->priv->due_date, tpage);
}
/* Callback used when the categories button is clicked; we must bring up the
* category list dialog.
*/
static void
-categories_clicked_cb (GtkWidget *button, gpointer data)
+categories_clicked_cb (GtkWidget *button,
+ TaskPage *tpage)
{
- TaskPage *tpage;
- TaskPagePrivate *priv;
- GtkWidget *entry;
+ GtkEntry *entry;
- tpage = TASK_PAGE (data);
- priv = tpage->priv;
-
- entry = priv->categories;
- e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry));
+ entry = GTK_ENTRY (tpage->priv->categories);
+ e_categories_config_open_dialog_for_entry (entry);
}
static gboolean
@@ -1844,12 +1834,17 @@ task_page_sendoptions_clicked_cb (TaskPage *tpage)
static gboolean
init_widgets (TaskPage *tpage)
{
+ CompEditor *editor;
TaskPagePrivate *priv;
+ GtkAction *action;
GtkTextBuffer *text_buffer;
icaltimezone *zone;
+ gboolean active;
priv = tpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
+
/* Make sure the EDateEdit widgets use our timezones to get the
current time. */
e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->start_date),
@@ -1945,15 +1940,36 @@ init_widgets (TaskPage *tpage)
zone = calendar_config_get_icaltimezone ();
e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->timezone), zone);
- task_page_set_show_timezone (tpage, calendar_config_get_show_timezone());
+ action = comp_editor_get_action (editor, "view-time-zone");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ task_page_set_show_timezone (tpage, active);
+
+ e_meeting_list_view_column_set_visible (
+ priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE);
+
+ action = comp_editor_get_action (editor, "view-role");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ e_meeting_list_view_column_set_visible (
+ priv->list_view, E_MEETING_STORE_ROLE_COL, active);
+
+ action = comp_editor_get_action (editor, "view-rsvp");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ e_meeting_list_view_column_set_visible (
+ priv->list_view, E_MEETING_STORE_RSVP_COL, active);
+
+ action = comp_editor_get_action (editor, "view-status");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ e_meeting_list_view_column_set_visible (
+ priv->list_view, E_MEETING_STORE_STATUS_COL, active);
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE);
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ROLE_COL, calendar_config_get_show_role ());
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, calendar_config_get_show_rsvp ());
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_STATUS_COL, calendar_config_get_show_status ());
- e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_TYPE_COL, calendar_config_get_show_type ());
+ action = comp_editor_get_action (editor, "view-type");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ e_meeting_list_view_column_set_visible (
+ priv->list_view, E_MEETING_STORE_TYPE_COL, active);
- task_page_set_show_categories (tpage, calendar_config_get_show_categories());
+ action = comp_editor_get_action (editor, "view-categories");
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ task_page_set_show_categories (tpage, active);
return TRUE;
}
diff --git a/calendar/gui/e-cal-component-memo-preview.c b/calendar/gui/e-cal-component-memo-preview.c
deleted file mode 100644
index 18c47ebfcc..0000000000
--- a/calendar/gui/e-cal-component-memo-preview.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Federico Mena Quintero <federico@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <libecal/e-cal-time-util.h>
-#include <libedataserver/e-categories.h>
-#include <gtkhtml/gtkhtml.h>
-#include <gtkhtml/gtkhtml-stream.h>
-#include <libedataserver/e-time-utils.h>
-#include <e-util/e-util.h>
-#include <e-util/e-categories-config.h>
-#include "calendar-config.h"
-#include "e-cal-component-memo-preview.h"
-#include "e-cal-component-preview.h"
-#include <camel/camel-mime-filter-tohtml.h>
-
-struct _ECalComponentMemoPreviewPrivate {
- GtkWidget *html;
-
- icaltimezone *zone;
-};
-
-G_DEFINE_TYPE (ECalComponentMemoPreview, e_cal_component_memo_preview, GTK_TYPE_TABLE)
-
-
-static void
-on_link_clicked (GtkHTML *html, const char *url, gpointer data)
-{
- /* FIXME Pass a parent window. */
- e_show_uri (NULL, url);
-}
-
-static void
-on_url_cb (GtkHTML *html, const char *url, gpointer data)
-{
-#if 0
- char *msg;
- ECalComponentMemoPreview *preview = data;
-
- if (url && *url) {
- msg = g_strdup_printf (_("Click to open %s"), url);
- e_calendar_table_set_status_message (e_tasks_get_calendar_table (tasks), msg);
- g_free (msg);
- } else
- e_calendar_table_set_status_message (e_tasks_get_calendar_table (tasks), NULL);
-#endif
-}
-
-/* Converts a time_t to a string, relative to the specified timezone */
-static char *
-timet_to_str_with_zone (ECalComponentDateTime *dt, ECal *ecal, icaltimezone *default_zone)
-{
- struct icaltimetype itt;
- icaltimezone *zone;
- struct tm tm;
- char buf[256];
-
- if (dt->tzid) {
- /* If we can't find the zone, we'll guess its "local" */
- if (!e_cal_get_timezone (ecal, dt->tzid, &zone, NULL))
- zone = NULL;
- } else if (dt->value->is_utc) {
- zone = icaltimezone_get_utc_timezone ();
- } else {
- zone = NULL;
- }
-
-
- itt = *dt->value;
- if (zone)
- icaltimezone_convert_time (&itt, zone, default_zone);
- tm = icaltimetype_to_tm (&itt);
-
- e_time_format_date_and_time (&tm, calendar_config_get_24_hour_format (),
- FALSE, FALSE, buf, sizeof (buf));
-
- return g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
-}
-
-static void
-write_html (GtkHTMLStream *stream, ECal *ecal, ECalComponent *comp, icaltimezone *default_zone)
-{
- ECalComponentText text;
- ECalComponentDateTime dt;
- gchar *str;
- GSList *l;
- gboolean one_added = FALSE;
-
- g_return_if_fail (E_IS_CAL_COMPONENT (comp));
-
- /* write document header */
- e_cal_component_get_summary (comp, &text);
-
- if (text.value)
- gtk_html_stream_printf (stream,
- "<HTML><BODY><H1>%s</H1>",
- text.value);
- else
- gtk_html_stream_printf (stream,
- "<HTML><BODY><H1><I>%s</I></H1>",
- _("Untitled"));
-
- /* write icons for the categories */
- e_cal_component_get_categories_list (comp, &l);
- if (l) {
- GSList *node;
- GString *string = g_string_new (NULL);
-
-
- gtk_html_stream_printf(stream, "<H3>%s: ", _("Categories"));
-
- for (node = l; node != NULL; node = node->next) {
- const char *icon_file;
-
- icon_file = e_categories_get_icon_file_for ((const char *) node->data);
- if (icon_file && g_file_test(icon_file, G_FILE_TEST_EXISTS)) {
- gchar *icon_file_uri = g_filename_to_uri (icon_file, NULL, NULL);
- gtk_html_stream_printf (stream, "<IMG ALT=\"%s\" SRC=\"%s\">",
- (const char *) node->data, icon_file_uri);
- g_free (icon_file_uri);
- one_added = TRUE;
- }
- else{
- if(one_added == FALSE){
- g_string_append_printf (string, "%s", (const char *) node->data);
- one_added = TRUE;
- }
- else{
- g_string_append_printf (string, ", %s", (const char *) node->data);
- }
- }
- }
-
- if (string->len > 0)
- gtk_html_stream_printf(stream, "%s", string->str);
-
- g_string_free (string, TRUE);
-
- gtk_html_stream_printf(stream, "</H3>");
-
- e_cal_component_free_categories_list (l);
- }
-
- /* Start table */
- gtk_html_stream_printf (stream, "<TABLE BORDER=\"0\" WIDTH=\"80%%\">"
- "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\" WIDTH=\"15%%\"></TD></TR>");
-
- /* write start date */
- e_cal_component_get_dtstart (comp, &dt);
- if (dt.value != NULL) {
- str = timet_to_str_with_zone (&dt, ecal, default_zone);
- gtk_html_stream_printf (stream, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\"><B>%s</B></TD><TD>%s</TD></TR>",
- _("Start Date:"), str);
-
- g_free (str);
- }
- e_cal_component_free_datetime (&dt);
-
- /* write description and URL */
- gtk_html_stream_printf (stream, "<TR><TD COLSPAN=\"2\"><HR></TD></TR>");
-
- e_cal_component_get_description_list (comp, &l);
- if (l) {
- GSList *node;
-
- gtk_html_stream_printf (stream, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\"><B>%s</B></TD>", _("Description:"));
-
- gtk_html_stream_printf (stream, "<TD><TT>");
-
- for (node = l; node != NULL; node = node->next) {
- char *html;
-
- text = * (ECalComponentText *) node->data;
- html = camel_text_to_html (text.value ? text.value : "", CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES | CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES, 0);
-
- if (html)
- gtk_html_stream_printf (stream, "%s", html);
-
- g_free (html);
- }
-
- gtk_html_stream_printf (stream, "</TT></TD></TR>");
-
- e_cal_component_free_text_list (l);
- }
-
- /* URL */
- e_cal_component_get_url (comp, (const char **) &str);
- if (str) {
- gtk_html_stream_printf (stream, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\"><B>%s</B></TD>", _("Web Page:"));
- gtk_html_stream_printf (stream, "<TD><A HREF=\"%s\">%s</A></TD></TR>", str, str);
- }
-
- gtk_html_stream_printf (stream, "</TABLE>");
-
- /* close document */
- gtk_html_stream_printf (stream, "</BODY></HTML>");
-}
-
-static void
-e_cal_component_memo_preview_init (ECalComponentMemoPreview *preview)
-{
- ECalComponentMemoPreviewPrivate *priv;
- GtkWidget *scroll;
-
- priv = g_new0 (ECalComponentMemoPreviewPrivate, 1);
- preview->priv = priv;
-
- priv->html = gtk_html_new ();
- gtk_html_set_default_content_type (GTK_HTML (priv->html), "charset=utf-8");
- gtk_html_load_empty (GTK_HTML (priv->html));
-
- g_signal_connect (G_OBJECT (priv->html), "url_requested",
- G_CALLBACK (e_cal_comp_preview_url_requested_cb), NULL);
- g_signal_connect (G_OBJECT (priv->html), "link_clicked",
- G_CALLBACK (on_link_clicked), preview);
- g_signal_connect (G_OBJECT (priv->html), "on_url",
- G_CALLBACK (on_url_cb), preview);
-
- scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN);
-
- gtk_container_add (GTK_CONTAINER (scroll), priv->html);
- gtk_container_add (GTK_CONTAINER (preview), scroll);
- gtk_widget_show_all (scroll);
-
- priv->zone = icaltimezone_get_utc_timezone ();
-}
-
-static void
-e_cal_component_memo_preview_destroy (GtkObject *object)
-{
- ECalComponentMemoPreview *preview;
- ECalComponentMemoPreviewPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_CAL_COMPONENT_MEMO_PREVIEW (object));
-
- preview = E_CAL_COMPONENT_MEMO_PREVIEW (object);
- priv = preview->priv;
-
- if (priv) {
-
- g_free (priv);
- preview->priv = NULL;
- }
-
- if (GTK_OBJECT_CLASS (e_cal_component_memo_preview_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (e_cal_component_memo_preview_parent_class)->destroy) (object);
-}
-
-static void
-e_cal_component_memo_preview_class_init (ECalComponentMemoPreviewClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) klass;
-
- object_class->destroy = e_cal_component_memo_preview_destroy;
-}
-
-GtkWidget *
-e_cal_component_memo_preview_new (void)
-{
- ECalComponentMemoPreview *preview;
-
- preview = g_object_new (e_cal_component_memo_preview_get_type (), NULL);
-
- return GTK_WIDGET (preview);
-}
-
-icaltimezone *
-e_cal_component_memo_preview_get_default_timezone (ECalComponentMemoPreview *preview)
-{
- ECalComponentMemoPreviewPrivate *priv;
-
- g_return_val_if_fail (preview != NULL, NULL);
- g_return_val_if_fail (E_IS_CAL_COMPONENT_MEMO_PREVIEW (preview), NULL);
-
- priv = preview->priv;
-
- return priv->zone;
-}
-
-void
-e_cal_component_memo_preview_set_default_timezone (ECalComponentMemoPreview *preview, icaltimezone *zone)
-{
- ECalComponentMemoPreviewPrivate *priv;
-
- g_return_if_fail (preview != NULL);
- g_return_if_fail (E_IS_CAL_COMPONENT_MEMO_PREVIEW (preview));
- g_return_if_fail (zone != NULL);
-
- priv = preview->priv;
-
- priv->zone = zone;
-}
-
-void
-e_cal_component_memo_preview_display (ECalComponentMemoPreview *preview, ECal *ecal, ECalComponent *comp)
-{
- ECalComponentMemoPreviewPrivate *priv;
- GtkHTMLStream *stream;
-
- g_return_if_fail (preview != NULL);
- g_return_if_fail (E_IS_CAL_COMPONENT_MEMO_PREVIEW (preview));
- g_return_if_fail (comp != NULL);
- g_return_if_fail (E_IS_CAL_COMPONENT (comp));
-
- priv = preview->priv;
-
- stream = gtk_html_begin (GTK_HTML (priv->html));
- write_html (stream, ecal, comp, priv->zone);
- gtk_html_stream_close (stream, GTK_HTML_STREAM_OK);
-}
-
-void
-e_cal_component_memo_preview_clear (ECalComponentMemoPreview *preview)
-{
- ECalComponentMemoPreviewPrivate *priv;
-
- g_return_if_fail (preview != NULL);
- g_return_if_fail (E_IS_CAL_COMPONENT_MEMO_PREVIEW (preview));
-
- priv = preview->priv;
-
- gtk_html_load_empty (GTK_HTML (priv->html));
-}
-
-GtkWidget *
-e_cal_component_memo_preview_get_html (ECalComponentMemoPreview *preview)
-{
- g_return_val_if_fail (preview != NULL, NULL);
- g_return_val_if_fail (E_IS_CAL_COMPONENT_MEMO_PREVIEW (preview), NULL);
-
- return preview->priv->html;
-}
diff --git a/calendar/gui/e-cal-component-memo-preview.h b/calendar/gui/e-cal-component-memo-preview.h
deleted file mode 100644
index 8dcab9d0f3..0000000000
--- a/calendar/gui/e-cal-component-memo-preview.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Federico Mena Quintero <federico@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_CAL_COMPONENT_MEMO_PREVIEW_H_
-#define _E_CAL_COMPONENT_MEMO_PREVIEW_H_
-
-#include <gtk/gtk.h>
-#include <libecal/e-cal.h>
-
-#define E_TYPE_CAL_COMPONENT_MEMO_PREVIEW (e_cal_component_memo_preview_get_type ())
-#define E_CAL_COMPONENT_MEMO_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_COMPONENT_MEMO_PREVIEW, ECalComponentMemoPreview))
-#define E_CAL_COMPONENT_MEMO_PREVIEW_CLASS(klass) (G_TYPE_CHECK_INSTANCE_CAST_CLASS ((klass), E_TYPE_CAL_COMPONENT_MEMO_PREVIEW, \
- ECalComponentMemoPreviewClass))
-#define E_IS_CAL_COMPONENT_MEMO_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_COMPONENT_MEMO_PREVIEW))
-#define E_IS_CAL_COMPONENT_MEMO_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_COMPONENT_MEMO_PREVIEW))
-
-typedef struct _ECalComponentMemoPreview ECalComponentMemoPreview;
-typedef struct _ECalComponentMemoPreviewClass ECalComponentMemoPreviewClass;
-typedef struct _ECalComponentMemoPreviewPrivate ECalComponentMemoPreviewPrivate;
-
-struct _ECalComponentMemoPreview {
- GtkTable table;
-
- /* Private data */
- ECalComponentMemoPreviewPrivate *priv;
-};
-
-struct _ECalComponentMemoPreviewClass {
- GtkTableClass parent_class;
-
- /* Notification signals */
- void (* selection_changed) (ECalComponentMemoPreview *preview, int n_selected);
-};
-
-
-GType e_cal_component_memo_preview_get_type (void);
-GtkWidget *e_cal_component_memo_preview_new (void);
-
-icaltimezone *e_cal_component_memo_preview_get_default_timezone (ECalComponentMemoPreview *preview);
-void e_cal_component_memo_preview_set_default_timezone (ECalComponentMemoPreview *preview, icaltimezone *zone);
-
-void e_cal_component_memo_preview_display (ECalComponentMemoPreview *preview, ECal *ecal, ECalComponent *comp);
-void e_cal_component_memo_preview_clear (ECalComponentMemoPreview *preview);
-GtkWidget *e_cal_component_memo_preview_get_html (ECalComponentMemoPreview *preview);
-
-#endif /* _E_CAL_COMPONENT_MEMO_PREVIEW_H_ */
diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c
index a70bf5761f..a34fb77f7a 100644
--- a/calendar/gui/e-cal-component-preview.c
+++ b/calendar/gui/e-cal-component-preview.c
@@ -22,42 +22,41 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "e-cal-component-preview.h"
#include <string.h>
-#include <gio/gio.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <libedataserver/e-categories.h>
#include <libecal/e-cal-time-util.h>
-#include <gtkhtml/gtkhtml.h>
+#include <libedataserver/e-categories.h>
#include <gtkhtml/gtkhtml-stream.h>
#include <libedataserver/e-time-utils.h>
#include <e-util/e-util.h>
#include <e-util/e-categories-config.h>
#include "calendar-config.h"
-#include "e-cal-component-preview.h"
#include <camel/camel-mime-filter-tohtml.h>
-struct _ECalComponentPreviewPrivate {
- GtkWidget *html;
+#define E_CAL_COMPONENT_PREVIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CAL_COMPONENT_PREVIEW, ECalComponentPreviewPrivate))
+struct _ECalComponentPreviewPrivate {
icaltimezone *zone;
};
-G_DEFINE_TYPE (ECalComponentPreview, e_cal_component_preview, GTK_TYPE_TABLE)
+static gpointer parent_class;
static void
-on_link_clicked (GtkHTML *html, const char *url, gpointer data)
+cal_component_preview_link_clicked (GtkHTML *html,
+ const gchar *uri)
{
/* FIXME Pass a parent window. */
- e_show_uri (NULL, url);
+ e_show_uri (NULL, uri);
}
static void
-on_url_cb (GtkHTML *html, const char *url, gpointer data)
+cal_component_preview_on_url (GtkHTML *html,
+ const gchar *url)
{
#if 0
char *msg;
@@ -72,51 +71,11 @@ on_url_cb (GtkHTML *html, const char *url, gpointer data)
#endif
}
-/* Callback used when the user selects a URL in the HTML widget */
-void
-e_cal_comp_preview_url_requested_cb (GtkHTML *html, const char *url, GtkHTMLStream *html_stream, gpointer data)
-{
- int len = strlen ("file:///");
-
- if (!strncmp ("file:///", url, len)) {
- GFile *file;
- const char *path = url + len - 1;
-
- g_return_if_fail (html_stream != NULL);
- g_return_if_fail (path != NULL);
-
- file = g_file_new_for_path (path);
- if (file) {
- char buffer[4096];
- GInputStream *stream;
-
- /* ignore errors here */
- stream = G_INPUT_STREAM (g_file_read (file, NULL, NULL));
-
- if (stream) {
- gssize bread;
-
- do {
- /* ignore errors here as well */
- bread = g_input_stream_read (stream, buffer, sizeof (buffer), NULL, NULL);
- if (bread > 0)
- gtk_html_stream_write (html_stream, buffer, bread);
- } while (bread > 0);
-
- g_input_stream_close (stream, NULL, NULL);
- g_object_unref (stream);
-
- gtk_html_stream_close (html_stream, GTK_HTML_STREAM_OK);
- }
-
- g_object_unref (file);
- }
- }
-}
-
/* Converts a time_t to a string, relative to the specified timezone */
static char *
-timet_to_str_with_zone (ECalComponentDateTime *dt, ECal *ecal, icaltimezone *default_zone)
+timet_to_str_with_zone (ECalComponentDateTime *dt,
+ ECal *ecal,
+ icaltimezone *default_zone)
{
struct icaltimetype itt;
icaltimezone *zone;
@@ -146,12 +105,18 @@ timet_to_str_with_zone (ECalComponentDateTime *dt, ECal *ecal, icaltimezone *def
}
static void
-write_html (GtkHTMLStream *stream, ECal *ecal, ECalComponent *comp, icaltimezone *default_zone)
+cal_component_preview_write_html (GtkHTMLStream *stream,
+ ECal *ecal,
+ ECalComponent *comp,
+ icaltimezone *default_zone)
{
ECalComponentText text;
ECalComponentDateTime dt;
gchar *str;
- GSList *l;
+ GString *string;
+ GSList *list, *iter;
+ icalcomponent *icalcomp;
+ icalproperty *icalprop;
icalproperty_status status;
const char *location;
int *priority_value;
@@ -170,28 +135,34 @@ write_html (GtkHTMLStream *stream, ECal *ecal, ECalComponent *comp, icaltimezone
"<HTML><BODY><H1><I>%s</I></H1>",
_("Untitled"));
-
/* write icons for the categories */
- e_cal_component_get_categories_list (comp, &l);
- if (l) {
- GSList *node;
-
- for (node = l; node != NULL; node = node->next) {
- const char *icon_file;
-
- icon_file = e_categories_get_icon_file_for ((const char *) node->data);
- if (icon_file) {
- gchar *icon_file_uri = g_filename_to_uri (icon_file, NULL, NULL);
- gtk_html_stream_printf (stream, "<IMG ALT=\"%s\" SRC=\"%s\">",
- (const char *) node->data, icon_file_uri);
- g_free (icon_file_uri);
- }
+ string = g_string_new (NULL);
+ e_cal_component_get_categories_list (comp, &list);
+ if (list != NULL)
+ gtk_html_stream_printf (stream, "<H3>%s ", _("Categories:"));
+ for (iter = list; iter != NULL; iter = iter->next) {
+ const gchar *category = iter->data;
+ const gchar *icon_file;
+
+ icon_file = e_categories_get_icon_file_for (category);
+ if (icon_file && g_file_test (icon_file, G_FILE_TEST_EXISTS)) {
+ gchar *uri;
+
+ uri = g_filename_to_uri (icon_file, NULL, NULL);
+ gtk_html_stream_printf (
+ stream, "<IMG ALT=\"%s\" SRC=\"%s\">",
+ category, uri);
+ g_free (uri);
+ } else {
+ if (iter != list)
+ g_string_append_len (string, ", ", 2);
+ g_string_append (string, category);
}
-
- e_cal_component_free_categories_list (l);
-
- gtk_html_stream_printf (stream, "<BR><BR><BR>");
}
+ if (string->len > 0)
+ gtk_html_stream_printf (stream, "%s</H3>", string->str);
+ e_cal_component_free_categories_list (list);
+ g_string_free (string, TRUE);
/* Start table */
gtk_html_stream_printf (stream, "<TABLE BORDER=\"0\" WIDTH=\"80%%\">"
@@ -237,26 +208,31 @@ write_html (GtkHTMLStream *stream, ECal *ecal, ECalComponent *comp, icaltimezone
e_cal_component_free_datetime (&dt);
/* write status */
- gtk_html_stream_printf (stream, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\"><B>%s</B></TD>", _("Status:"));
- e_cal_component_get_status (comp, &status);
- switch (status) {
- case ICAL_STATUS_INPROCESS :
- str = g_strdup (_("In Progress"));
- break;
- case ICAL_STATUS_COMPLETED :
- str = g_strdup (_("Completed"));
- break;
- case ICAL_STATUS_CANCELLED :
- str = g_strdup (_("Canceled"));
- break;
- case ICAL_STATUS_NONE :
- default :
- str = g_strdup (_("Not Started"));
- break;
- }
+ icalcomp = e_cal_component_get_icalcomponent (comp);
+ icalprop = icalcomponent_get_first_property (
+ icalcomp, ICAL_STATUS_PROPERTY);
+ if (icalprop != NULL) {
+ gtk_html_stream_printf (stream, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\"><B>%s</B></TD>", _("Status:"));
+ e_cal_component_get_status (comp, &status);
+ switch (status) {
+ case ICAL_STATUS_INPROCESS :
+ str = g_strdup (_("In Progress"));
+ break;
+ case ICAL_STATUS_COMPLETED :
+ str = g_strdup (_("Completed"));
+ break;
+ case ICAL_STATUS_CANCELLED :
+ str = g_strdup (_("Canceled"));
+ break;
+ case ICAL_STATUS_NONE :
+ default :
+ str = g_strdup (_("Not Started"));
+ break;
+ }
- gtk_html_stream_printf (stream, "<TD>%s</TD></TR>", str);
- g_free (str);
+ gtk_html_stream_printf (stream, "<TD>%s</TD></TR>", str);
+ g_free (str);
+ }
/* write priority */
e_cal_component_get_priority (comp, &priority_value);
@@ -280,15 +256,15 @@ write_html (GtkHTMLStream *stream, ECal *ecal, ECalComponent *comp, icaltimezone
/* write description and URL */
gtk_html_stream_printf (stream, "<TR><TD COLSPAN=\"2\"><HR></TD></TR>");
- e_cal_component_get_description_list (comp, &l);
- if (l) {
+ e_cal_component_get_description_list (comp, &list);
+ if (list) {
GSList *node;
gtk_html_stream_printf (stream, "<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\"><B>%s</B></TD>", _("Description:"));
gtk_html_stream_printf (stream, "<TD><TT>");
- for (node = l; node != NULL; node = node->next) {
+ for (node = list; node != NULL; node = node->next) {
char *html;
text = * (ECalComponentText *) node->data;
@@ -302,7 +278,7 @@ write_html (GtkHTMLStream *stream, ECal *ecal, ECalComponent *comp, icaltimezone
gtk_html_stream_printf (stream, "</TT></TD></TR>");
- e_cal_component_free_text_list (l);
+ e_cal_component_free_text_list (list);
}
/* URL */
@@ -319,143 +295,120 @@ write_html (GtkHTMLStream *stream, ECal *ecal, ECalComponent *comp, icaltimezone
}
static void
-e_cal_component_preview_init (ECalComponentPreview *preview)
+cal_component_preview_finalize (GObject *object)
{
ECalComponentPreviewPrivate *priv;
- GtkWidget *scroll;
- priv = g_new0 (ECalComponentPreviewPrivate, 1);
- preview->priv = priv;
+ priv = E_CAL_COMPONENT_PREVIEW_GET_PRIVATE (object);
+
+ /* XXX Nothing to do? */
- priv->html = gtk_html_new ();
- gtk_html_set_default_content_type (GTK_HTML (priv->html), "charset=utf-8");
- gtk_html_load_empty (GTK_HTML (priv->html));
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
- g_signal_connect (G_OBJECT (priv->html), "url_requested",
- G_CALLBACK (e_cal_comp_preview_url_requested_cb), NULL);
- g_signal_connect (G_OBJECT (priv->html), "link_clicked",
- G_CALLBACK (on_link_clicked), preview);
- g_signal_connect (G_OBJECT (priv->html), "on_url",
- G_CALLBACK (on_url_cb), preview);
+static void
+cal_component_preview_class_init (ECalComponentPreviewClass *class)
+{
+ GObjectClass *object_class;
+ GtkHTMLClass *gtkhtml_class;
- scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN);
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECalComponentPreviewPrivate));
- gtk_container_add (GTK_CONTAINER (scroll), priv->html);
- gtk_container_add (GTK_CONTAINER (preview), scroll);
- gtk_widget_show_all (scroll);
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = cal_component_preview_finalize;
- priv->zone = icaltimezone_get_utc_timezone ();
+ gtkhtml_class = GTK_HTML_CLASS (class);
+ gtkhtml_class->link_clicked = cal_component_preview_link_clicked;
+ gtkhtml_class->on_url = cal_component_preview_on_url;
}
static void
-e_cal_component_preview_destroy (GtkObject *object)
+cal_component_preview_init (ECalComponentPreview *preview)
{
- ECalComponentPreview *preview;
ECalComponentPreviewPrivate *priv;
+ GtkHTML *html;
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_CAL_COMPONENT_PREVIEW (object));
-
- preview = E_CAL_COMPONENT_PREVIEW (object);
- priv = preview->priv;
-
- if (priv) {
+ preview->priv = E_CAL_COMPONENT_PREVIEW_GET_PRIVATE (preview);
- g_free (priv);
- preview->priv = NULL;
- }
+ html = GTK_HTML (preview);
+ gtk_html_set_default_content_type (html, "charset=utf-8");
+ gtk_html_load_empty (html);
- if (GTK_OBJECT_CLASS (e_cal_component_preview_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (e_cal_component_preview_parent_class)->destroy) (object);
+ priv->zone = icaltimezone_get_utc_timezone ();
}
-static void
-e_cal_component_preview_class_init (ECalComponentPreviewClass *klass)
+GType
+e_cal_component_preview_get_type (void)
{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) klass;
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ECalComponentPreviewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) cal_component_preview_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ECalComponentPreview),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) cal_component_preview_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_HTML, "ECalComponentPreview", &type_info, 0);
+ }
- object_class->destroy = e_cal_component_preview_destroy;
+ return type;
}
GtkWidget *
e_cal_component_preview_new (void)
{
- ECalComponentPreview *preview;
-
- preview = g_object_new (e_cal_component_preview_get_type (), NULL);
-
- return GTK_WIDGET (preview);
+ return g_object_new (E_TYPE_CAL_COMPONENT_PREVIEW, NULL);
}
icaltimezone *
e_cal_component_preview_get_default_timezone (ECalComponentPreview *preview)
{
- ECalComponentPreviewPrivate *priv;
-
- g_return_val_if_fail (preview != NULL, NULL);
g_return_val_if_fail (E_IS_CAL_COMPONENT_PREVIEW (preview), NULL);
- priv = preview->priv;
-
- return priv->zone;
+ return preview->priv->zone;
}
void
-e_cal_component_preview_set_default_timezone (ECalComponentPreview *preview, icaltimezone *zone)
+e_cal_component_preview_set_default_timezone (ECalComponentPreview *preview,
+ icaltimezone *zone)
{
- ECalComponentPreviewPrivate *priv;
-
- g_return_if_fail (preview != NULL);
g_return_if_fail (E_IS_CAL_COMPONENT_PREVIEW (preview));
g_return_if_fail (zone != NULL);
- priv = preview->priv;
-
- priv->zone = zone;
+ preview->priv->zone = zone;
}
void
-e_cal_component_preview_display (ECalComponentPreview *preview, ECal *ecal, ECalComponent *comp)
+e_cal_component_preview_display (ECalComponentPreview *preview,
+ ECal *ecal,
+ ECalComponent *comp)
{
- ECalComponentPreviewPrivate *priv;
GtkHTMLStream *stream;
- g_return_if_fail (preview != NULL);
g_return_if_fail (E_IS_CAL_COMPONENT_PREVIEW (preview));
- g_return_if_fail (comp != NULL);
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
- priv = preview->priv;
-
- stream = gtk_html_begin (GTK_HTML (priv->html));
- write_html (stream, ecal, comp, priv->zone);
+ stream = gtk_html_begin (GTK_HTML (preview));
+ cal_component_preview_write_html (
+ stream, ecal, comp, preview->priv->zone);
gtk_html_stream_close (stream, GTK_HTML_STREAM_OK);
}
void
e_cal_component_preview_clear (ECalComponentPreview *preview)
{
- ECalComponentPreviewPrivate *priv;
-
- g_return_if_fail (preview != NULL);
g_return_if_fail (E_IS_CAL_COMPONENT_PREVIEW (preview));
- priv = preview->priv;
-
- gtk_html_load_empty (GTK_HTML (priv->html));
-}
-
-GtkWidget *
-e_cal_component_preview_get_html (ECalComponentPreview *preview)
-{
- g_return_val_if_fail (preview != NULL, NULL);
- g_return_val_if_fail (E_IS_CAL_COMPONENT_PREVIEW (preview), NULL);
-
- return preview->priv->html;
+ gtk_html_load_empty (GTK_HTML (preview));
}
diff --git a/calendar/gui/e-cal-component-preview.h b/calendar/gui/e-cal-component-preview.h
index 4faa7bd29b..0397636d3e 100644
--- a/calendar/gui/e-cal-component-preview.h
+++ b/calendar/gui/e-cal-component-preview.h
@@ -1,5 +1,4 @@
/*
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -22,52 +21,63 @@
*
*/
-#ifndef _E_CAL_COMPONENT_PREVIEW_H_
-#define _E_CAL_COMPONENT_PREVIEW_H_
+#ifndef E_CAL_COMPONENT_PREVIEW_H
+#define E_CAL_COMPONENT_PREVIEW_H
#include <gtk/gtk.h>
#include <libecal/e-cal.h>
#include <gtkhtml/gtkhtml.h>
-#include <gtkhtml/gtkhtml-stream.h>
-#define E_TYPE_CAL_COMPONENT_PREVIEW (e_cal_component_preview_get_type ())
-#define E_CAL_COMPONENT_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_COMPONENT_PREVIEW, ECalComponentPreview))
-#define E_CAL_COMPONENT_PREVIEW_CLASS(klass) (G_TYPE_CHECK_INSTANCE_CAST_CLASS ((klass), E_TYPE_CAL_COMPONENT_PREVIEW, \
- ECalComponentPreviewClass))
-#define E_IS_CAL_COMPONENT_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_COMPONENT_PREVIEW))
-#define E_IS_CAL_COMPONENT_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_COMPONENT_PREVIEW))
+/* Standard GObject macros */
+#define E_TYPE_CAL_COMPONENT_PREVIEW \
+ (e_cal_component_preview_get_type ())
+#define E_CAL_COMPONENT_PREVIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CAL_COMPONENT_PREVIEW, ECalComponentPreview))
+#define E_CAL_COMPONENT_PREVIEW_CLASS(cls) \
+ (G_TYPE_CHECK_INSTANCE_CAST_CLASS \
+ ((cls), E_TYPE_CAL_COMPONENT_PREVIEW, ECalComponentPreviewClass))
+#define E_IS_CAL_COMPONENT_PREVIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CAL_COMPONENT_PREVIEW))
+#define E_IS_CAL_COMPONENT_PREVIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CAL_COMPONENT_PREVIEW))
+#define E_CAL_COMPONENT_PREVIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CAL_COMPONENT_PREVIEW, ECalComponentPreviewClass))
+
+G_BEGIN_DECLS
typedef struct _ECalComponentPreview ECalComponentPreview;
typedef struct _ECalComponentPreviewClass ECalComponentPreviewClass;
typedef struct _ECalComponentPreviewPrivate ECalComponentPreviewPrivate;
struct _ECalComponentPreview {
- GtkTable table;
-
- /* Private data */
+ GtkHTML parent;
ECalComponentPreviewPrivate *priv;
};
struct _ECalComponentPreviewClass {
- GtkTableClass parent_class;
+ GtkHTMLClass parent_class;
/* Notification signals */
void (* selection_changed) (ECalComponentPreview *preview, int n_selected);
};
-GType e_cal_component_preview_get_type (void);
-GtkWidget *e_cal_component_preview_new (void);
-
-icaltimezone *e_cal_component_preview_get_default_timezone (ECalComponentPreview *preview);
-void e_cal_component_preview_set_default_timezone (ECalComponentPreview *preview, icaltimezone *zone);
-
-void e_cal_component_preview_display (ECalComponentPreview *preview, ECal *ecal, ECalComponent *comp);
-void e_cal_component_preview_clear (ECalComponentPreview *preview);
-
-/* Callback used when GtkHTML widget requests URL */
-void e_cal_comp_preview_url_requested_cb (GtkHTML *html, const char *url, GtkHTMLStream *html_stream, gpointer data);
+GType e_cal_component_preview_get_type(void);
+GtkWidget * e_cal_component_preview_new (void);
+icaltimezone * e_cal_component_preview_get_default_timezone
+ (ECalComponentPreview *preview);
+void e_cal_component_preview_set_default_timezone
+ (ECalComponentPreview *preview,
+ icaltimezone *zone);
+void e_cal_component_preview_display (ECalComponentPreview *preview,
+ ECal *ecal,
+ ECalComponent *comp);
+void e_cal_component_preview_clear (ECalComponentPreview *preview);
-GtkWidget *e_cal_component_preview_get_html (ECalComponentPreview *preview);
+G_END_DECLS
-#endif /* _E_CAL_COMPONENT_PREVIEW_H_ */
+#endif /* E_CAL_COMPONENT_PREVIEW_H */
diff --git a/calendar/gui/e-cal-event.c b/calendar/gui/e-cal-event.c
index db7e9abc89..d84a9f968b 100644
--- a/calendar/gui/e-cal-event.c
+++ b/calendar/gui/e-cal-event.c
@@ -43,10 +43,10 @@ static void
ece_target_free (EEvent *ev, EEventTarget *t)
{
switch (t->type) {
- case E_CAL_EVENT_TARGET_COMPONENT: {
- ECalEventTargetComponent *s = (ECalEventTargetComponent *) t;
- if (s->component)
- g_object_unref (s->component);
+ case E_CAL_EVENT_TARGET_MODULE: {
+ ECalEventTargetModule *s = (ECalEventTargetModule *) t;
+ if (s->shell_backend)
+ g_object_unref (s->shell_backend);
break; }
}
@@ -92,12 +92,12 @@ e_cal_event_peek (void)
return e_cal_event;
}
-ECalEventTargetComponent *
-e_cal_event_target_new_component (ECalEvent *ece, struct _CalendarComponent *component, guint32 flags)
+ECalEventTargetModule *
+e_cal_event_target_new_module (ECalEvent *ece, EShellBackend *shell_backend, guint32 flags)
{
- ECalEventTargetComponent *t = e_event_target_new (&ece->event, E_CAL_EVENT_TARGET_COMPONENT, sizeof (*t));
+ ECalEventTargetModule *t = e_event_target_new (&ece->event, E_CAL_EVENT_TARGET_MODULE, sizeof (*t));
- t->component = g_object_ref (component);
+ t->shell_backend = g_object_ref (shell_backend);
t->target.mask = ~flags;
return t;
@@ -107,13 +107,13 @@ e_cal_event_target_new_component (ECalEvent *ece, struct _CalendarComponent *com
static void *eceh_parent_class;
-static const EEventHookTargetMask eceh_component_masks[] = {
- { "migration", E_CAL_EVENT_COMPONENT_MIGRATION },
+static const EEventHookTargetMask eceh_module_masks[] = {
+ { "migration", E_CAL_EVENT_MODULE_MIGRATION },
{ NULL },
};
static const EEventHookTargetMap eceh_targets[] = {
- { "component", E_CAL_EVENT_TARGET_COMPONENT, eceh_component_masks },
+ { "module", E_CAL_EVENT_TARGET_MODULE, eceh_module_masks },
{ NULL },
};
diff --git a/calendar/gui/e-cal-event.h b/calendar/gui/e-cal-event.h
index 0802640d2c..4932157f37 100644
--- a/calendar/gui/e-cal-event.h
+++ b/calendar/gui/e-cal-event.h
@@ -27,6 +27,7 @@
#include <glib-object.h>
#include "e-util/e-event.h"
+#include "shell/e-shell-backend.h"
#ifdef __cplusplus
extern "C" {
@@ -37,20 +38,19 @@ typedef struct _ECalEvent ECalEvent;
typedef struct _ECalEventClass ECalEventClass;
enum _e_cal_event_target_t {
- E_CAL_EVENT_TARGET_COMPONENT
+ E_CAL_EVENT_TARGET_MODULE,
};
-/* Flags that describe TARGET_COMPONENT */
+/* Flags that describe TARGET_MODULE */
enum {
- E_CAL_EVENT_COMPONENT_MIGRATION = 1 << 0
+ E_CAL_EVENT_MODULE_MIGRATION = 1 << 0,
};
-typedef struct _ECalEventTargetComponent ECalEventTargetComponent;
+typedef struct _ECalEventTargetModule ECalEventTargetModule;
-struct _ECalEventTargetComponent {
+struct _ECalEventTargetModule {
EEventTarget target;
-
- struct _CalendarComponent *component;
+ EShellBackend *shell_backend;
};
struct _ECalEvent {
@@ -65,7 +65,7 @@ struct _ECalEventClass {
GType e_cal_event_get_type (void);
ECalEvent* e_cal_event_peek (void);
-ECalEventTargetComponent* e_cal_event_target_new_component (ECalEvent *ece, struct _CalendarComponent *component, guint32 flags);
+ECalEventTargetModule* e_cal_event_target_new_module (ECalEvent *ece, EShellBackend *shell_backend, guint32 flags);
/* ********************************************************************** */
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c
index 6eab1f7aac..a3ece9d66f 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -25,7 +25,7 @@
#endif
#include "e-cal-list-view.h"
-#include "ea-calendar.h"
+#include "a11y/ea-calendar.h"
#include <math.h>
#include <time.h>
@@ -41,7 +41,7 @@
#include <table/e-cell-text.h>
#include <table/e-cell-combo.h>
#include <misc/e-popup-menu.h>
-#include <misc/e-cell-date-edit.h>
+#include <table/e-cell-date-edit.h>
#include <e-util/e-categories-config.h>
#include <e-util/e-dialog-utils.h>
#include <e-util/e-util-private.h>
@@ -56,7 +56,6 @@
#include "dialogs/recur-comp.h"
#include "comp-util.h"
#include "itip-utils.h"
-#include "calendar-commands.h"
#include "calendar-config.h"
#include "goto.h"
#include "misc.h"
@@ -358,10 +357,12 @@ e_cal_list_view_destroy (GtkObject *object)
static void
e_cal_list_view_show_popup_menu (ECalListView *cal_list_view, gint row, GdkEvent *gdk_event)
{
+#if 0 /* KILL-BONOBO */
GtkMenu *menu;
menu = e_calendar_view_create_popup_menu (E_CALENDAR_VIEW (cal_list_view));
gtk_menu_popup(menu, NULL, NULL, NULL, NULL, gdk_event?gdk_event->button.button:0, gdk_event?gdk_event->button.time:gtk_get_current_event_time());
+#endif
}
static gboolean
diff --git a/calendar/gui/e-cal-model-memos.c b/calendar/gui/e-cal-model-memos.c
index 95fe5f1572..815d8d7ee6 100644
--- a/calendar/gui/e-cal-model-memos.c
+++ b/calendar/gui/e-cal-model-memos.c
@@ -261,7 +261,7 @@ ecmm_fill_component_from_model (ECalModel *model, ECalModelComponent *comp_data,
/**
* e_cal_model_memos_new
*/
-ECalModelMemos *
+ECalModel *
e_cal_model_memos_new (void)
{
return g_object_new (E_TYPE_CAL_MODEL_MEMOS, NULL);
diff --git a/calendar/gui/e-cal-model-memos.h b/calendar/gui/e-cal-model-memos.h
index 34b8e5a14d..f7a5d17091 100644
--- a/calendar/gui/e-cal-model-memos.h
+++ b/calendar/gui/e-cal-model-memos.h
@@ -55,8 +55,8 @@ typedef struct {
ECalModelClass parent_class;
} ECalModelMemosClass;
-GType e_cal_model_memos_get_type (void);
-ECalModelMemos *e_cal_model_memos_new (void);
+GType e_cal_model_memos_get_type (void);
+ECalModel * e_cal_model_memos_new (void);
G_END_DECLS
diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c
index a2b9eb6f2f..d66555a636 100644
--- a/calendar/gui/e-cal-model-tasks.c
+++ b/calendar/gui/e-cal-model-tasks.c
@@ -1108,7 +1108,7 @@ ecmt_fill_component_from_model (ECalModel *model, ECalModelComponent *comp_data,
/**
* e_cal_model_tasks_new
*/
-ECalModelTasks *
+ECalModel *
e_cal_model_tasks_new (void)
{
return g_object_new (E_TYPE_CAL_MODEL_TASKS, NULL);
diff --git a/calendar/gui/e-cal-model-tasks.h b/calendar/gui/e-cal-model-tasks.h
index 0900d1e155..88b0d071e2 100644
--- a/calendar/gui/e-cal-model-tasks.h
+++ b/calendar/gui/e-cal-model-tasks.h
@@ -64,7 +64,7 @@ typedef struct {
} ECalModelTasksClass;
GType e_cal_model_tasks_get_type (void);
-ECalModelTasks *e_cal_model_tasks_new (void);
+ECalModel * e_cal_model_tasks_new (void);
void e_cal_model_tasks_mark_comp_complete (ECalModelTasks *model, ECalModelComponent *comp_data);
void e_cal_model_tasks_mark_comp_incomplete (ECalModelTasks *model, ECalModelComponent *comp_data);
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 19844a7560..f88418b6a8 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -35,8 +35,8 @@
#include "e-cal-model.h"
#include "itip-utils.h"
#include "misc.h"
-#include "e-util/e-util.h"
#include "calendar-config.h"
+#include "e-util/e-util.h"
typedef struct {
ECal *client;
diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c
new file mode 100644
index 0000000000..54858e56f9
--- /dev/null
+++ b/calendar/gui/e-calendar-selector.c
@@ -0,0 +1,226 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-calendar-selector.c
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-calendar-selector.h"
+
+#include <libecal/e-cal.h>
+#include "common/authentication.h"
+
+#define E_CALENDAR_SELECTOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CALENDAR_SELECTOR, ECalendarSelectorPrivate))
+
+struct _ECalendarSelectorPrivate {
+ gint dummy_value;
+};
+
+enum {
+ DND_TARGET_TYPE_CALENDAR_LIST
+};
+
+static GtkTargetEntry drag_types[] = {
+ { "text/calendar", 0, DND_TARGET_TYPE_CALENDAR_LIST },
+ { "text/x-calendar", 0, DND_TARGET_TYPE_CALENDAR_LIST }
+};
+
+static gpointer parent_class;
+
+static gboolean
+calendar_selector_update_single_object (ECal *client,
+ icalcomponent *icalcomp)
+{
+ gchar *uid;
+ icalcomponent *tmp_icalcomp;
+
+ uid = (gchar *) icalcomponent_get_uid (icalcomp);
+
+ if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, NULL))
+ return e_cal_modify_object (
+ client, icalcomp, CALOBJ_MOD_ALL, NULL);
+
+ return e_cal_create_object (client, icalcomp, &uid, NULL);
+}
+
+static gboolean
+calendar_selector_update_objects (ECal *client,
+ icalcomponent *icalcomp)
+{
+ icalcomponent *subcomp;
+ icalcomponent_kind kind;
+
+ kind = icalcomponent_isa (icalcomp);
+ if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT)
+ return calendar_selector_update_single_object (
+ client, icalcomp);
+ else if (kind != ICAL_VCALENDAR_COMPONENT)
+ return FALSE;
+
+ subcomp = icalcomponent_get_first_component (
+ icalcomp, ICAL_ANY_COMPONENT);
+ while (subcomp != NULL) {
+ gboolean success;
+
+ kind = icalcomponent_isa (subcomp);
+ if (kind == ICAL_VTIMEZONE_COMPONENT) {
+ icaltimezone *zone;
+
+ zone = icaltimezone_new ();
+ icaltimezone_set_component (zone, subcomp);
+
+ success = e_cal_add_timezone (client, zone, NULL);
+ icaltimezone_free (zone, 1);
+ if (!success)
+ return FALSE;
+ } else if (kind == ICAL_VTODO_COMPONENT ||
+ kind == ICAL_VEVENT_COMPONENT) {
+ success = calendar_selector_update_single_object (
+ client, subcomp);
+ if (!success)
+ return FALSE;
+ }
+
+ subcomp = icalcomponent_get_next_component (
+ icalcomp, ICAL_ANY_COMPONENT);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+calendar_selector_data_dropped (ESourceSelector *selector,
+ GtkSelectionData *selection_data,
+ ESource *destination,
+ GdkDragAction action,
+ guint info)
+{
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreePath *path = NULL;
+ ECal *client;
+ icalcomponent *icalcomp;
+ const gchar *string;
+ gboolean remove_from_source;
+ gboolean success = FALSE;
+ gpointer object = NULL;
+
+ tree_view = GTK_TREE_VIEW (selector);
+ model = gtk_tree_view_get_model (tree_view);
+
+ string = (const gchar *) selection_data->data;
+ remove_from_source = (action == GDK_ACTION_MOVE);
+
+ icalcomp = icalparser_parse_string (string);
+
+ if (icalcomp == NULL)
+ goto exit;
+
+ /* FIXME Deal with GDK_ACTION_ASK. */
+ if (action == GDK_ACTION_COPY) {
+ gchar *uid;
+
+ uid = e_cal_component_gen_uid ();
+ icalcomponent_set_uid (icalcomp, uid);
+ }
+
+ client = auth_new_cal_from_source (
+ destination, E_CAL_SOURCE_TYPE_EVENT);
+
+ if (client != NULL) {
+ if (e_cal_open (client, TRUE, NULL)) {
+ success = TRUE;
+ calendar_selector_update_objects (client, icalcomp);
+ }
+
+ g_object_unref (client);
+ }
+
+ icalcomponent_free (icalcomp);
+
+ success = TRUE;
+
+exit:
+ if (path != NULL)
+ gtk_tree_path_free (path);
+
+ if (object != NULL)
+ g_object_unref (object);
+
+ return TRUE;
+}
+
+static void
+calendar_selector_class_init (ECalendarSelectorClass *class)
+{
+ ESourceSelectorClass *source_selector_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECalendarSelectorPrivate));
+
+ source_selector_class = E_SOURCE_SELECTOR_CLASS (class);
+ source_selector_class->data_dropped = calendar_selector_data_dropped;
+}
+
+static void
+calendar_selector_init (ECalendarSelector *selector)
+{
+ selector->priv = E_CALENDAR_SELECTOR_GET_PRIVATE (selector);
+
+ gtk_drag_dest_set (
+ GTK_WIDGET (selector), GTK_DEST_DEFAULT_ALL,
+ drag_types, G_N_ELEMENTS (drag_types),
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
+}
+
+GType
+e_calendar_selector_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (ECalendarSelectorClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) calendar_selector_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ECalendarSelector),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) calendar_selector_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_SOURCE_SELECTOR, "ECalendarSelector",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_calendar_selector_new (ESourceList *source_list)
+{
+ g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+
+ return g_object_new (
+ E_TYPE_CALENDAR_SELECTOR,
+ "source-list", source_list, NULL);
+}
diff --git a/calendar/gui/e-calendar-selector.h b/calendar/gui/e-calendar-selector.h
new file mode 100644
index 0000000000..65d9a2fc81
--- /dev/null
+++ b/calendar/gui/e-calendar-selector.h
@@ -0,0 +1,66 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-calendar-selector.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef E_CALENDAR_SELECTOR_H
+#define E_CALENDAR_SELECTOR_H
+
+#include <libedataserver/e-source-list.h>
+#include <libedataserverui/e-source-selector.h>
+
+/* Standard GObject macros */
+#define E_TYPE_CALENDAR_SELECTOR \
+ (e_calendar_selector_get_type ())
+#define E_CALENDAR_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CALENDAR_SELECTOR, ECalendarSelector))
+#define E_CALENDAR_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CALENDAR_SELECTOR, ECalendarSelectorClass))
+#define E_IS_CALENDAR_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CALENDAR_SELECTOR))
+#define E_IS_CALENDAR_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CALENDAR_SELECTOR))
+#define E_CALENDAR_SELECTOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CALENDAR_SELECTOR, ECalendarSelectorClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ECalendarSelector ECalendarSelector;
+typedef struct _ECalendarSelectorClass ECalendarSelectorClass;
+typedef struct _ECalendarSelectorPrivate ECalendarSelectorPrivate;
+
+struct _ECalendarSelector {
+ ESourceSelector parent;
+ ECalendarSelectorPrivate *priv;
+};
+
+struct _ECalendarSelectorClass {
+ ESourceSelectorClass parent_class;
+};
+
+GType e_calendar_selector_get_type (void);
+GtkWidget * e_calendar_selector_new (ESourceList *source_list);
+
+G_END_DECLS
+
+#endif /* E_CALENDAR_SELECTOR_H */
diff --git a/calendar/gui/e-calendar-table-config.c b/calendar/gui/e-calendar-table-config.c
index fb8d18c189..8b73056f51 100644
--- a/calendar/gui/e-calendar-table-config.c
+++ b/calendar/gui/e-calendar-table-config.c
@@ -24,221 +24,245 @@
#include "e-cell-date-edit-config.h"
#include "e-calendar-table-config.h"
+#define E_CALENDAR_TABLE_CONFIG_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CALENDAR_TABLE_CONFIG, ECalendarTableConfigPrivate))
+
struct _ECalendarTableConfigPrivate {
ECalendarTable *table;
-
ECellDateEditConfig *cell_config;
-
GList *notifications;
};
-/* Property IDs */
-enum props {
+enum {
PROP_0,
PROP_TABLE
};
-G_DEFINE_TYPE (ECalendarTableConfig, e_calendar_table_config, G_TYPE_OBJECT)
+static gpointer parent_class;
static void
-e_calendar_table_config_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+calendar_table_config_set_timezone (ECalendarTable *table)
{
- ECalendarTableConfig *table_config;
-
- table_config = E_CALENDAR_TABLE_CONFIG (object);
+ ECalModel *model;
+ icaltimezone *zone;
- switch (property_id) {
- case PROP_TABLE:
- e_calendar_table_config_set_table (table_config, g_value_get_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
+ zone = calendar_config_get_icaltimezone ();
+ model = e_calendar_table_get_model (table);
+ if (model != NULL)
+ e_cal_model_set_timezone (model, zone);
}
static void
-e_calendar_table_config_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+calendar_table_config_timezone_changed_cb (GConfClient *client,
+ guint id,
+ GConfEntry *entry,
+ gpointer data)
{
- ECalendarTableConfig *table_config;
-
- table_config = E_CALENDAR_TABLE_CONFIG (object);
+ ECalendarTableConfig *table_config = data;
- switch (property_id) {
- case PROP_TABLE:
- g_value_set_object (value, e_calendar_table_config_get_table (table_config));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
+ calendar_table_config_set_timezone (table_config->priv->table);
}
static void
-e_calendar_table_config_dispose (GObject *object)
+calendar_table_config_set_twentyfour_hour (ECalendarTable *table)
{
- ECalendarTableConfig *table_config = E_CALENDAR_TABLE_CONFIG (object);
+ ECalModel *model;
+ gboolean use_24_hour;
- e_calendar_table_config_set_table (table_config, NULL);
+ use_24_hour = calendar_config_get_24_hour_format ();
- if (G_OBJECT_CLASS (e_calendar_table_config_parent_class)->dispose)
- G_OBJECT_CLASS (e_calendar_table_config_parent_class)->dispose (object);
+ model = e_calendar_table_get_model (table);
+ if (model != NULL)
+ e_cal_model_set_use_24_hour_format (model, use_24_hour);
}
static void
-e_calendar_table_config_finalize (GObject *object)
+calendar_table_config_twentyfour_hour_changed_cb (GConfClient *client,
+ guint id,
+ GConfEntry *entry,
+ gpointer data)
{
- ECalendarTableConfig *table_config = E_CALENDAR_TABLE_CONFIG (object);
- ECalendarTableConfigPrivate *priv;
-
- priv = table_config->priv;
-
- g_free (priv);
+ ECalendarTableConfig *table_config = data;
- if (G_OBJECT_CLASS (e_calendar_table_config_parent_class)->finalize)
- G_OBJECT_CLASS (e_calendar_table_config_parent_class)->finalize (object);
+ calendar_table_config_set_twentyfour_hour (table_config->priv->table);
}
static void
-e_calendar_table_config_class_init (ECalendarTableConfigClass *klass)
+calendar_table_config_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GParamSpec *spec;
-
- /* Method override */
- gobject_class->set_property = e_calendar_table_config_set_property;
- gobject_class->get_property = e_calendar_table_config_get_property;
- gobject_class->dispose = e_calendar_table_config_dispose;
- gobject_class->finalize = e_calendar_table_config_finalize;
-
- spec = g_param_spec_object ("table", NULL, NULL, e_calendar_table_get_type (),
- G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
- g_object_class_install_property (gobject_class, PROP_TABLE, spec);
+ switch (property_id) {
+ case PROP_TABLE:
+ e_calendar_table_config_set_table (
+ E_CALENDAR_TABLE_CONFIG (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-e_calendar_table_config_init (ECalendarTableConfig *table_config)
+calendar_table_config_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- table_config->priv = g_new0 (ECalendarTableConfigPrivate, 1);
+ switch (property_id) {
+ case PROP_TABLE:
+ g_value_set_object (
+ value, e_calendar_table_config_get_table (
+ E_CALENDAR_TABLE_CONFIG (object)));
+ return;
+ }
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
-ECalendarTableConfig *
-e_calendar_table_config_new (ECalendarTable *table)
+static void
+calendar_table_config_dispose (GObject *object)
{
- ECalendarTableConfig *table_config;
+ ECalendarTableConfig *table_config = E_CALENDAR_TABLE_CONFIG (object);
- table_config = g_object_new (e_calendar_table_config_get_type (), "table", table, NULL);
+ e_calendar_table_config_set_table (table_config, NULL);
- return table_config;
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
-ECalendarTable *
-e_calendar_table_config_get_table (ECalendarTableConfig *table_config)
+static void
+calendar_table_config_class_init (ECalendarTableConfigClass *class)
{
- ECalendarTableConfigPrivate *priv;
-
- g_return_val_if_fail (table_config != NULL, NULL);
- g_return_val_if_fail (E_IS_CALENDAR_TABLE_CONFIG (table_config), NULL);
-
- priv = table_config->priv;
-
- return priv->table;
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECalendarTableConfigPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = calendar_table_config_set_property;
+ object_class->get_property = calendar_table_config_get_property;
+ object_class->dispose = calendar_table_config_dispose;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_TABLE,
+ g_param_spec_object (
+ "table",
+ NULL,
+ NULL,
+ E_TYPE_CALENDAR_TABLE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
}
static void
-set_timezone (ECalendarTable *table)
+calendar_table_config_init (ECalendarTableConfig *table_config)
{
- ECalModel *model;
- icaltimezone *zone;
-
- zone = calendar_config_get_icaltimezone ();
- model = e_calendar_table_get_model (table);
- if (model)
- e_cal_model_set_timezone (model, zone);
+ table_config->priv =
+ E_CALENDAR_TABLE_CONFIG_GET_PRIVATE (table_config);
}
-static void
-timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+GType
+e_calendar_table_config_get_type (void)
{
- ECalendarTableConfig *table_config = data;
- ECalendarTableConfigPrivate *priv;
-
- priv = table_config->priv;
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ECalendarTableConfigClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) calendar_table_config_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ECalendarTableConfig),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) calendar_table_config_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ G_TYPE_OBJECT, "ECalendarTableConfig", &type_info, 0);
+ }
- set_timezone (priv->table);
+ return type;
}
-static void
-set_twentyfour_hour (ECalendarTable *table)
+ECalendarTableConfig *
+e_calendar_table_config_new (ECalendarTable *table)
{
- ECalModel *model;
- gboolean use_24_hour;
+ g_return_val_if_fail (E_IS_CALENDAR_TABLE (table), NULL);
- use_24_hour = calendar_config_get_24_hour_format ();
-
- model = e_calendar_table_get_model (table);
- if (model)
- e_cal_model_set_use_24_hour_format (model, use_24_hour);
+ return g_object_new (
+ E_TYPE_CALENDAR_TABLE_CONFIG,
+ "table", table, NULL);
}
-static void
-twentyfour_hour_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+ECalendarTable *
+e_calendar_table_config_get_table (ECalendarTableConfig *table_config)
{
- ECalendarTableConfig *table_config = data;
- ECalendarTableConfigPrivate *priv;
-
- priv = table_config->priv;
+ g_return_val_if_fail (E_IS_CALENDAR_TABLE_CONFIG (table_config), NULL);
- set_twentyfour_hour (priv->table);
+ return table_config->priv->table;
}
void
-e_calendar_table_config_set_table (ECalendarTableConfig *table_config, ECalendarTable *table)
+e_calendar_table_config_set_table (ECalendarTableConfig *table_config,
+ ECalendarTable *table)
{
ECalendarTableConfigPrivate *priv;
- guint not;
- GList *l;
+ guint notification;
+ GList *list, *iter;
- g_return_if_fail (table_config != NULL);
g_return_if_fail (E_IS_CALENDAR_TABLE_CONFIG (table_config));
priv = table_config->priv;
- if (priv->table) {
- g_object_unref (priv->table);
- priv->table = NULL;
+ if (table_config->priv->table) {
+ g_object_unref (table_config->priv->table);
+ table_config->priv->table = NULL;
}
- if (priv->cell_config) {
- g_object_unref (priv->cell_config);
- priv->cell_config = NULL;
+ if (table_config->priv->cell_config) {
+ g_object_unref (table_config->priv->cell_config);
+ table_config->priv->cell_config = NULL;
}
- for (l = priv->notifications; l; l = l->next)
- calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
-
- g_list_free (priv->notifications);
- priv->notifications = NULL;
+ list = table_config->priv->notifications;
+ for (iter = list; iter != NULL; iter = iter->next) {
+ notification = GPOINTER_TO_UINT (iter->data);
+ calendar_config_remove_notification (notification);
+ }
+ g_list_free (list);
+ table_config->priv->notifications = NULL;
- /* If the new view is NULL, return right now */
- if (!table)
+ if (table == NULL)
return;
- priv->table = g_object_ref (table);
+ table_config->priv->table = g_object_ref (table);
/* Time zone */
- set_timezone (table);
+ calendar_table_config_set_timezone (table);
- not = calendar_config_add_notification_timezone (timezone_changed_cb, table_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+ notification = calendar_config_add_notification_timezone (
+ calendar_table_config_timezone_changed_cb, table_config);
+ table_config->priv->notifications = g_list_prepend (
+ table_config->priv->notifications,
+ GUINT_TO_POINTER (notification));
/* 24 Hour format */
- set_twentyfour_hour (table);
+ calendar_table_config_set_twentyfour_hour (table);
- not = calendar_config_add_notification_24_hour_format (twentyfour_hour_changed_cb, table_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+ notification = calendar_config_add_notification_24_hour_format (
+ calendar_table_config_twentyfour_hour_changed_cb, table_config);
+ table_config->priv->notifications = g_list_prepend (
+ table_config->priv->notifications,
+ GUINT_TO_POINTER (notification));
/* Date cell */
- priv->cell_config = e_cell_date_edit_config_new (table->dates_cell);
+ table_config->priv->cell_config =
+ e_cell_date_edit_config_new (table->dates_cell);
}
diff --git a/calendar/gui/e-calendar-table-config.h b/calendar/gui/e-calendar-table-config.h
index 93588a6e57..36745064d1 100644
--- a/calendar/gui/e-calendar-table-config.h
+++ b/calendar/gui/e-calendar-table-config.h
@@ -21,24 +21,38 @@
*
*/
-#ifndef _E_CALENDAR_TABLE_CONFIG_H_
-#define _E_CALENDAR_TABLE_CONFIG_H_
+#ifndef E_CALENDAR_TABLE_CONFIG_H
+#define E_CALENDAR_TABLE_CONFIG_H
#include "e-calendar-table.h"
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_CALENDAR_TABLE_CONFIG \
+ (e_calendar_table_config_get_type ())
+#define E_CALENDAR_TABLE_CONFIG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CALENDAR_TABLE_CONFIG, ECalendarTableConfig))
+#define E_CALENDAR_TABLE_CONFIG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CALENDAR_TABLE_CONFIG, ECalendarTableConfigClass))
+#define E_IS_CALENDAR_TABLE_CONFIG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CALENDAR_TABLE_CONFIG))
+#define E_IS_CALENDAR_TABLE_CONFIG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CALENDAR_TABLE_CONFIG))
+#define E_CALENDAR_TABLE_CONFIG_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CALENDAR_TABLE_CONFIG, ECalendarTableConfigClass))
-#define E_CALENDAR_TABLE_CONFIG(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_calendar_table_config_get_type (), ECalendarTableConfig)
-#define E_CALENDAR_TABLE_CONFIG_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_calendar_table_config_get_type (), ECalendarTableConfigClass)
-#define E_IS_CALENDAR_TABLE_CONFIG(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_calendar_table_config_get_type ())
+G_BEGIN_DECLS
-typedef struct _ECalendarTableConfig ECalendarTableConfig;
-typedef struct _ECalendarTableConfigClass ECalendarTableConfigClass;
+typedef struct _ECalendarTableConfig ECalendarTableConfig;
+typedef struct _ECalendarTableConfigClass ECalendarTableConfigClass;
typedef struct _ECalendarTableConfigPrivate ECalendarTableConfigPrivate;
struct _ECalendarTableConfig {
GObject parent;
-
ECalendarTableConfigPrivate *priv;
};
@@ -46,11 +60,15 @@ struct _ECalendarTableConfigClass {
GObjectClass parent_class;
};
-GType e_calendar_table_config_get_type (void);
-ECalendarTableConfig *e_calendar_table_config_new (ECalendarTable *table);
-ECalendarTable *e_calendar_table_config_get_table (ECalendarTableConfig *view_config);
-void e_calendar_table_config_set_table (ECalendarTableConfig *view_config, ECalendarTable *table);
+GType e_calendar_table_config_get_type(void);
+ECalendarTableConfig *
+ e_calendar_table_config_new (ECalendarTable *table);
+ECalendarTable *e_calendar_table_config_get_table
+ (ECalendarTableConfig *table_config);
+void e_calendar_table_config_set_table
+ (ECalendarTableConfig *table_config,
+ ECalendarTable *table);
G_END_DECLS
-#endif
+#endif /* E_CALENDAR_TABLE_CONFIG_H */
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index b8ce8d1c29..6e99cf58eb 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -32,7 +32,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
@@ -44,12 +43,11 @@
#include <table/e-cell-combo.h>
#include <e-util/e-dialog-utils.h>
#include <e-util/e-util-private.h>
-#include <misc/e-cell-date-edit.h>
-#include <misc/e-cell-percent.h>
+#include <table/e-cell-date-edit.h>
+#include <table/e-cell-percent.h>
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-time-utils.h>
-#include "calendar-component.h"
#include "calendar-config.h"
#include "dialogs/delete-comp.h"
#include "dialogs/delete-error.h"
@@ -58,65 +56,50 @@
#include "e-calendar-table.h"
#include "e-calendar-view.h"
#include "e-cell-date-edit-text.h"
-#include "e-comp-editor-registry.h"
#include "print.h"
#include <e-util/e-icon-factory.h>
#include "e-cal-popup.h"
-#include "e-tasks.h"
#include "misc.h"
-enum TargetType{
- TARGET_TYPE_VCALENDAR
-};
+#define E_CALENDAR_TABLE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CALENDAR_TABLE, ECalendarTablePrivate))
-static GtkTargetEntry target_types[] = {
- { (gchar *) "text/x-calendar", 0, TARGET_TYPE_VCALENDAR },
- { (gchar *) "text/calendar", 0, TARGET_TYPE_VCALENDAR }
+struct _ECalendarTablePrivate {
+ gpointer shell_view; /* weak pointer */
+ ECalModel *model;
};
-static guint n_target_types = G_N_ELEMENTS (target_types);
+enum {
+ PROP_0,
+ PROP_MODEL,
+ PROP_SHELL_VIEW
+};
-extern ECompEditorRegistry *comp_editor_registry;
-
-static void e_calendar_table_destroy (GtkObject *object);
-
-static void e_calendar_table_on_double_click (ETable *table,
- gint row,
- gint col,
- GdkEvent *event,
- ECalendarTable *cal_table);
-static gint e_calendar_table_show_popup_menu (ETable *table,
- GdkEvent *gdk_event,
- ECalendarTable *cal_table);
-
-static gint e_calendar_table_on_right_click (ETable *table,
- gint row,
- gint col,
- GdkEvent *event,
- ECalendarTable *cal_table);
-static gboolean e_calendar_table_on_popup_menu (GtkWidget *widget,
- gpointer data);
-
-static gint e_calendar_table_on_key_press (ETable *table,
- gint row,
- gint col,
- GdkEventKey *event,
- ECalendarTable *cal_table);
-
-static struct tm e_calendar_table_get_current_time (ECellDateEdit *ecde,
- gpointer data);
-static void mark_as_complete_cb (EPopup *ep, EPopupItem *pitem, void *data);
-
-static void hide_completed_rows (ECalModel *model, GList *clients_list, char *hide_sexp, GPtrArray *comp_objects);
-static void show_completed_rows (ECalModel *model, GList *clients_list, char *show_sexp, GPtrArray *comp_objects);
-
-/* Signal IDs */
enum {
+ OPEN_COMPONENT,
+ POPUP_EVENT,
+ STATUS_MESSAGE,
USER_CREATED,
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
+enum {
+ TARGET_TYPE_VCALENDAR
+};
+
+static GtkTargetEntry target_types[] = {
+ { "text/calendar", 0, TARGET_TYPE_VCALENDAR },
+ { "text/x-calendar", 0, TARGET_TYPE_VCALENDAR }
+};
+
+static guint n_target_types = G_N_ELEMENTS (target_types);
+
+static struct tm e_calendar_table_get_current_time (ECellDateEdit *ecde, gpointer data);
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+static GdkAtom clipboard_atom;
/* The icons to represent the task. */
#define E_CALENDAR_MODEL_NUM_ICONS 4
@@ -125,36 +108,45 @@ static const char* icon_names[E_CALENDAR_MODEL_NUM_ICONS] = {
};
static GdkPixbuf* icon_pixbufs[E_CALENDAR_MODEL_NUM_ICONS] = { NULL };
-static GdkAtom clipboard_atom = GDK_NONE;
+static void
+calendar_table_emit_open_component (ECalendarTable *cal_table,
+ ECalModelComponent *comp_data)
+{
+ guint signal_id = signals[OPEN_COMPONENT];
-G_DEFINE_TYPE (ECalendarTable, e_calendar_table, GTK_TYPE_TABLE)
+ g_signal_emit (cal_table, signal_id, 0, comp_data);
+}
static void
-e_calendar_table_class_init (ECalendarTableClass *class)
+calendar_table_emit_popup_event (ECalendarTable *cal_table,
+ GdkEvent *event)
{
- GtkObjectClass *object_class;
+ guint signal_id = signals[POPUP_EVENT];
- object_class = (GtkObjectClass *) class;
+ g_signal_emit (cal_table, signal_id, 0, event);
+}
+
+static void
+calendar_table_emit_status_message (ECalendarTable *cal_table,
+ const gchar *message,
+ gdouble percent)
+{
+ guint signal_id = signals[STATUS_MESSAGE];
- /* Method override */
- object_class->destroy = e_calendar_table_destroy;
+ g_signal_emit (cal_table, signal_id, 0, message, percent);
+}
- signals[USER_CREATED] =
- g_signal_new ("user_created",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECalendarTableClass, user_created),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+static void
+calendar_table_emit_user_created (ECalendarTable *cal_table)
+{
+ guint signal_id = signals[USER_CREATED];
- /* clipboard atom */
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+ g_signal_emit (cal_table, signal_id, 0);
}
static gint
-date_compare_cb (gconstpointer a, gconstpointer b)
+calendar_table_date_compare_cb (gconstpointer a,
+ gconstpointer b)
{
ECellDateEditValue *dv1 = (ECellDateEditValue *) a;
ECellDateEditValue *dv2 = (ECellDateEditValue *) b;
@@ -182,24 +174,18 @@ date_compare_cb (gconstpointer a, gconstpointer b)
}
static gint
-percent_compare_cb (gconstpointer a, gconstpointer b)
+calendar_table_percent_compare_cb (gconstpointer a,
+ gconstpointer b)
{
int percent1 = GPOINTER_TO_INT (a);
int percent2 = GPOINTER_TO_INT (b);
- int retval;
-
- if (percent1 > percent2)
- retval = 1;
- else if (percent1 < percent2)
- retval = -1;
- else
- retval = 0;
- return retval;
+ return (percent1 < percent2) ? -1 : (percent1 > percent2);
}
static gint
-priority_compare_cb (gconstpointer a, gconstpointer b)
+calendar_table_priority_compare_cb (gconstpointer a,
+ gconstpointer b)
{
int priority1, priority2;
@@ -213,71 +199,85 @@ priority_compare_cb (gconstpointer a, gconstpointer b)
priority2 = 10;
/* We'll just use the ordering of the priority values. */
- if (priority1 < priority2)
- return -1;
- else if (priority1 > priority2)
- return 1;
- else
- return 0;
+ return (priority1 < priority2) ? -1 : (priority1 > priority2);
}
static gint
-status_from_string (const char *str)
-{
- int status = -2;
-
- if (!str || !str[0])
- status = -1;
- else if (!g_utf8_collate (str, _("Not Started")))
- status = 0;
- else if (!g_utf8_collate (str, _("In Progress")))
- status = 1;
- else if (!g_utf8_collate (str, _("Completed")))
- status = 2;
- else if (!g_utf8_collate (str, _("Canceled")))
- status = 3;
-
- return status;
+calendar_table_status_compare_cb (gconstpointer a,
+ gconstpointer b)
+{
+ const gchar *string_a = a;
+ const gchar *string_b = b;
+ gint status_a = -2;
+ gint status_b = -2;
+
+ if (string_a == NULL || *string_a == '\0')
+ status_a = -1;
+ else if (!g_utf8_collate (string_a, _("Not Started")))
+ status_a = 0;
+ else if (!g_utf8_collate (string_a, _("In Progress")))
+ status_a = 1;
+ else if (!g_utf8_collate (string_a, _("Completed")))
+ status_a = 2;
+ else if (!g_utf8_collate (string_a, _("Canceled")))
+ status_a = 3;
+
+ if (string_b == NULL || *string_b == '\0')
+ status_b = -1;
+ else if (!g_utf8_collate (string_b, _("Not Started")))
+ status_b = 0;
+ else if (!g_utf8_collate (string_b, _("In Progress")))
+ status_b = 1;
+ else if (!g_utf8_collate (string_b, _("Completed")))
+ status_b = 2;
+ else if (!g_utf8_collate (string_b, _("Canceled")))
+ status_b = 3;
+
+ return (status_a < status_b) ? -1 : (status_a > status_b);
}
-static gint
-status_compare_cb (gconstpointer a, gconstpointer b)
+static void
+calendar_table_double_click_cb (ECalendarTable *cal_table,
+ gint row,
+ gint col,
+ GdkEvent *event)
{
- int sa = status_from_string ((const char *)a);
- int sb = status_from_string ((const char *)b);
-
- if (sa < sb)
- return -1;
- else if (sa > sb)
- return 1;
+ ECalModel *model;
+ ECalModelComponent *comp_data;
- return 0;
+ model = e_calendar_table_get_model (cal_table);
+ comp_data = e_cal_model_get_component_at (model, row);
+ calendar_table_emit_open_component (cal_table, comp_data);
}
static void
-row_appended_cb (ECalModel *model, ECalendarTable *cal_table)
+calendar_table_model_cal_view_progress_cb (ECalendarTable *cal_table,
+ const gchar *message,
+ gint progress,
+ ECalSourceType type)
{
- g_signal_emit (cal_table, signals[USER_CREATED], 0);
+ gdouble percent = (gdouble) progress;
+
+ calendar_table_emit_status_message (cal_table, message, percent);
}
static void
-get_time_as_text (struct icaltimetype *tt, icaltimezone *f_zone, icaltimezone *t_zone, char *buff, int buff_len)
+calendar_table_model_cal_view_done_cb (ECalendarTable *cal_table,
+ ECalendarStatus status,
+ ECalSourceType type)
{
- struct tm tmp_tm;
-
- buff [0] = 0;
-
- tmp_tm = icaltimetype_to_tm_with_zone (tt, f_zone, t_zone);
- e_time_format_date_and_time (&tmp_tm,
- calendar_config_get_24_hour_format (),
- FALSE, FALSE,
- buff, buff_len);
+ calendar_table_emit_status_message (cal_table, NULL, -1.0);
}
-gboolean
-ec_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, GtkWidget *etable_wgt, ECalModel *model)
+static gboolean
+calendar_table_query_tooltip_cb (ECalendarTable *cal_table,
+ gint x,
+ gint y,
+ gboolean keyboard_mode,
+ GtkTooltip *tooltip)
{
- ECalModelComponent *comp;
+ ECalModel *model;
+ ECalModelComponent *comp_data;
int row = -1, col = -1;
GtkWidget *box, *l, *w;
GtkStyle *style = gtk_widget_get_default_style ();
@@ -289,44 +289,44 @@ ec_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk
ECalComponent *new_comp;
ECalComponentOrganizer organizer;
ECalComponentDateTime dtstart, dtdue;
+ icalcomponent *clone;
icaltimezone *zone, *default_zone;
GSList *desc, *p;
int len;
ETable *etable;
ESelectionModel *esm;
+ struct tm tmp_tm;
if (keyboard_mode)
return FALSE;
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (tooltip != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE (etable_wgt), FALSE);
- g_return_val_if_fail (E_IS_CAL_MODEL (model), FALSE);
-
- etable = E_TABLE (etable_wgt);
-
+ etable = e_calendar_table_get_table (cal_table);
e_table_get_mouse_over_cell (etable, &row, &col);
if (row == -1 || !etable)
return FALSE;
- /* respect sorting option, the 'e_table_get_mouse_over_cell' returns sorted row, not the model one */
+ /* Respect sorting option; the 'e_table_get_mouse_over_cell'
+ * returns sorted row, not the model one. */
esm = e_table_get_selection_model (etable);
if (esm && esm->sorter && e_sorter_needs_sorting (esm->sorter))
row = e_sorter_sorted_to_model (esm->sorter, row);
- comp = e_cal_model_get_component_at (model, row);
- if (!comp || !comp->icalcomp)
+ model = e_calendar_table_get_model (cal_table);
+ comp_data = e_cal_model_get_component_at (model, row);
+ if (!comp_data || !comp_data->icalcomp)
return FALSE;
new_comp = e_cal_component_new ();
- if (!e_cal_component_set_icalcomponent (new_comp, icalcomponent_new_clone (comp->icalcomp))) {
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ if (!e_cal_component_set_icalcomponent (new_comp, clone)) {
g_object_unref (new_comp);
return FALSE;
}
box = gtk_vbox_new (FALSE, 0);
- str = e_calendar_view_get_icalcomponent_summary (comp->client, comp->icalcomp, &free_text);
+ str = e_calendar_view_get_icalcomponent_summary (
+ comp_data->client, comp_data->icalcomp, &free_text);
if (!(str && *str)) {
if (free_text)
g_free ((char *)str);
@@ -366,7 +366,7 @@ ec_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk
if (ptr) {
ptr++;
- /* To Translators: It will display "Organiser: NameOfTheUser <email@ofuser.com>" */
+ /* To Translators: It will display "Organizer: NameOfTheUser <email@ofuser.com>" */
tmp = g_strdup_printf (_("Organizer: %s <%s>"), organizer.cn, ptr);
} else {
/* With SunOne accounts, there may be no ':' in organiser.value */
@@ -383,12 +383,13 @@ ec_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk
e_cal_component_get_dtstart (new_comp, &dtstart);
e_cal_component_get_due (new_comp, &dtdue);
- default_zone = e_cal_model_get_timezone (model);
+ default_zone = e_cal_model_get_timezone (model);
if (dtstart.tzid) {
zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (new_comp), dtstart.tzid);
if (!zone)
- e_cal_get_timezone (comp->client, dtstart.tzid, &zone, NULL);
+ e_cal_get_timezone (
+ comp_data->client, dtstart.tzid, &zone, NULL);
if (!zone)
zone = default_zone;
} else {
@@ -398,7 +399,13 @@ ec_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk
tmp2 = g_string_new ("");
if (dtstart.value) {
- get_time_as_text (dtstart.value, zone, default_zone, buff, 1000);
+ buff[0] = 0;
+
+ tmp_tm = icaltimetype_to_tm_with_zone (
+ dtstart.value, zone, default_zone);
+ e_time_format_date_and_time (
+ &tmp_tm, calendar_config_get_24_hour_format (),
+ FALSE, FALSE, buff, 1000);
if (buff [0]) {
g_string_append (tmp2, _("Start: "));
@@ -407,7 +414,13 @@ ec_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk
}
if (dtdue.value) {
- get_time_as_text (dtdue.value, zone, default_zone, buff, 1000);
+ buff[0] = 0;
+
+ tmp_tm = icaltimetype_to_tm_with_zone (
+ dtdue.value, zone, default_zone);
+ e_time_format_date_and_time (
+ &tmp_tm, calendar_config_get_24_hour_format (),
+ FALSE, FALSE, buff, 1000);
if (buff [0]) {
if (tmp2->len)
@@ -429,7 +442,8 @@ ec_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk
e_cal_component_free_datetime (&dtstart);
e_cal_component_free_datetime (&dtdue);
- tmp = e_calendar_view_get_attendees_status_info (new_comp, comp->client);
+ tmp = e_calendar_view_get_attendees_status_info (
+ new_comp, comp_data->client);
if (tmp) {
l = gtk_label_new (tmp);
gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
@@ -474,46 +488,149 @@ ec_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk
}
static gboolean
-query_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer user_data)
+calendar_table_popup_menu_cb (ECalendarTable *cal_table)
{
- ECalendarTable *cal_table;
+ calendar_table_emit_popup_event (cal_table, NULL);
+
+ return TRUE;
+}
+
+static gint
+calendar_table_right_click_cb (ECalendarTable *cal_table,
+ gint row,
+ gint col,
+ GdkEvent *event)
+{
+ calendar_table_emit_popup_event (cal_table, event);
+
+ return TRUE;
+}
+
+static void
+calendar_table_set_model (ECalendarTable *cal_table,
+ ECalModel *model)
+{
+ g_return_if_fail (cal_table->priv->model == NULL);
+
+ cal_table->priv->model = g_object_ref (model);
+
+ g_signal_connect_swapped (
+ model, "row_appended",
+ G_CALLBACK (calendar_table_emit_user_created), cal_table);
+
+ g_signal_connect_swapped (
+ model, "cal-view-progress",
+ G_CALLBACK (calendar_table_model_cal_view_progress_cb),
+ cal_table);
+
+ g_signal_connect_swapped (
+ model, "cal-view-done",
+ G_CALLBACK (calendar_table_model_cal_view_done_cb),
+ cal_table);
+}
+
+static void
+calendar_table_set_shell_view (ECalendarTable *cal_table,
+ EShellView *shell_view)
+{
+ g_return_if_fail (cal_table->priv->shell_view == NULL);
+
+ cal_table->priv->shell_view = shell_view;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_view),
+ &cal_table->priv->shell_view);
+}
+
+static void
+calendar_table_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MODEL:
+ calendar_table_set_model (
+ E_CALENDAR_TABLE (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SHELL_VIEW:
+ calendar_table_set_shell_view (
+ E_CALENDAR_TABLE (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+calendar_table_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MODEL:
+ g_value_set_object (
+ value, e_calendar_table_get_model (
+ E_CALENDAR_TABLE (object)));
+ return;
+
+ case PROP_SHELL_VIEW:
+ g_value_set_object (
+ value, e_calendar_table_get_shell_view (
+ E_CALENDAR_TABLE (object)));
+ return;
+ }
- g_return_val_if_fail (E_IS_CALENDAR_TABLE (user_data), FALSE);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+calendar_table_dispose (GObject *object)
+{
+ ECalendarTablePrivate *priv;
- cal_table = E_CALENDAR_TABLE (user_data);
+ priv = E_CALENDAR_TABLE_GET_PRIVATE (object);
- return ec_query_tooltip (widget, x, y, keyboard_mode, tooltip, GTK_WIDGET (e_calendar_table_get_table (cal_table)), cal_table->model);
+ if (priv->model != NULL) {
+ g_object_unref (priv->model);
+ priv->model = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-e_calendar_table_init (ECalendarTable *cal_table)
+calendar_table_constructed (GObject *object)
{
- GtkWidget *table;
- ETable *e_table;
+ ECalendarTable *cal_table;
+ GtkWidget *widget;
+ ECalModel *model;
+ ETable *table;
ECell *cell, *popup_cell;
ETableExtras *extras;
gint i;
GdkPixbuf *pixbuf;
GList *strings;
AtkObject *a11y;
- char *etspecfile;
-
- /* Create the model */
-
- cal_table->model = (ECalModel *) e_cal_model_tasks_new ();
- g_signal_connect (cal_table->model, "row_appended", G_CALLBACK (row_appended_cb), cal_table);
+ gchar *etspecfile;
- cal_table->user_created_cal = NULL;
+ cal_table = E_CALENDAR_TABLE (object);
+ model = e_calendar_table_get_model (cal_table);
/* Create the header columns */
- extras = e_table_extras_new();
+ extras = e_table_extras_new ();
/*
* Normal string fields.
*/
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
+ g_object_set (cell,
"strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
"bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
"bg_color_column", E_CAL_MODEL_FIELD_COLOR,
@@ -526,7 +643,7 @@ 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),
+ g_object_set (cell,
"strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
"bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
"bg_color_column", E_CAL_MODEL_FIELD_COLOR,
@@ -535,13 +652,13 @@ e_calendar_table_init (ECalendarTable *cal_table)
popup_cell = e_cell_date_edit_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
g_object_unref (cell);
+
e_table_extras_add_cell (extras, "dateedit", popup_cell);
cal_table->dates_cell = E_CELL_DATE_EDIT (popup_cell);
- e_cell_date_edit_set_get_time_callback (E_CELL_DATE_EDIT (popup_cell),
- e_calendar_table_get_current_time,
- cal_table, NULL);
-
+ e_cell_date_edit_set_get_time_callback (
+ E_CELL_DATE_EDIT (popup_cell),
+ e_calendar_table_get_current_time, cal_table, NULL);
/*
* Combo fields.
@@ -549,7 +666,7 @@ e_calendar_table_init (ECalendarTable *cal_table)
/* Classification field. */
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
+ g_object_set (cell,
"strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT,
"bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE,
"bg_color_column", E_CAL_MODEL_FIELD_COLOR,
@@ -666,13 +783,13 @@ e_calendar_table_init (ECalendarTable *cal_table)
e_table_extras_add_cell (extras, "calstatus", popup_cell);
e_table_extras_add_compare (extras, "date-compare",
- date_compare_cb);
+ calendar_table_date_compare_cb);
e_table_extras_add_compare (extras, "percent-compare",
- percent_compare_cb);
+ calendar_table_percent_compare_cb);
e_table_extras_add_compare (extras, "priority-compare",
- priority_compare_cb);
+ calendar_table_priority_compare_cb);
e_table_extras_add_compare (extras, "status-compare",
- status_compare_cb);
+ calendar_table_status_compare_cb);
/* Create pixmaps */
@@ -691,55 +808,175 @@ e_calendar_table_init (ECalendarTable *cal_table)
/* Create the table */
- etspecfile = g_build_filename (EVOLUTION_ETSPECDIR,
- "e-calendar-table.etspec",
- NULL);
- table = e_table_scrolled_new_from_spec_file (E_TABLE_MODEL (cal_table->model),
- extras,
- etspecfile,
- NULL);
+ etspecfile = g_build_filename (
+ EVOLUTION_ETSPECDIR, "e-calendar-table.etspec", NULL);
+ widget = e_table_scrolled_new_from_spec_file (
+ E_TABLE_MODEL (model), extras, etspecfile, NULL);
+ gtk_table_attach (
+ GTK_TABLE (cal_table), widget, 0, 1, 0, 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ cal_table->etable = widget;
+ gtk_widget_show (widget);
g_free (etspecfile);
- /* FIXME: this causes a message from GLib about 'extras' having only a floating
- reference */
- /* g_object_unref (extras); */
+ table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
+ g_signal_connect_swapped (
+ table, "double-click",
+ G_CALLBACK (calendar_table_double_click_cb), cal_table);
+ g_signal_connect_swapped (
+ table, "query-tooltip",
+ G_CALLBACK (calendar_table_query_tooltip_cb), cal_table);
+ g_signal_connect_swapped (
+ table, "popup-menu",
+ G_CALLBACK (calendar_table_popup_menu_cb), cal_table);
+ g_signal_connect_swapped (
+ table, "right-click",
+ G_CALLBACK (calendar_table_right_click_cb), cal_table);
+ gtk_widget_set_has_tooltip (GTK_WIDGET (table), TRUE);
+
+ a11y = gtk_widget_get_accessible (GTK_WIDGET (table));
+ if (a11y)
+ atk_object_set_name (a11y, _("Tasks"));
+}
- cal_table->etable = table;
- gtk_table_attach (GTK_TABLE (cal_table), table, 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (table);
+static void
+calendar_table_class_init (ECalendarTableClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECalendarTablePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = calendar_table_set_property;
+ object_class->get_property = calendar_table_get_property;
+ object_class->dispose = calendar_table_dispose;
+ object_class->constructed = calendar_table_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MODEL,
+ g_param_spec_object (
+ "model",
+ _("Model"),
+ NULL,
+ E_TYPE_CAL_MODEL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_VIEW,
+ g_param_spec_object (
+ "shell-view",
+ _("Shell View"),
+ NULL,
+ E_TYPE_SHELL_VIEW,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ signals[OPEN_COMPONENT] = g_signal_new (
+ "open-component",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ECalendarTableClass, open_component),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_CAL_MODEL_COMPONENT);
+
+ signals[POPUP_EVENT] = g_signal_new (
+ "popup-event",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ECalendarTableClass, popup_event),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__BOXED,
+ G_TYPE_NONE, 1,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+ signals[STATUS_MESSAGE] = g_signal_new (
+ "status-message",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ECalendarTableClass, status_message),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
+
+ signals[USER_CREATED] = g_signal_new (
+ "user-created",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ECalendarTableClass, user_created),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+}
+static void
+calendar_table_init (ECalendarTable *cal_table)
+{
+ cal_table->priv = E_CALENDAR_TABLE_GET_PRIVATE (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);
- g_signal_connect (e_table, "popup_menu", G_CALLBACK (e_calendar_table_on_popup_menu), cal_table);
- g_signal_connect (e_table, "query-tooltip", G_CALLBACK (query_tooltip_cb), cal_table);
- gtk_widget_set_has_tooltip (GTK_WIDGET (e_table), TRUE);
+GType
+e_calendar_table_get_type (void)
+{
+ static GType type = 0;
- a11y = gtk_widget_get_accessible ((GtkWidget *)e_table);
- if (a11y)
- atk_object_set_name (a11y, _("Tasks"));
-}
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ECalendarTableClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) calendar_table_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ECalendarTable),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) calendar_table_init,
+ NULL /* value_table */
+ };
+ type = g_type_register_static (
+ GTK_TYPE_TABLE, "ECalendarTable", &type_info, 0);
+ }
+
+ return type;
+}
/**
* e_calendar_table_new:
- * @Returns: a new #ECalendarTable.
+ * @shell_view: an #EShellView
+ * @model: an #ECalModel for the table
+ *
+ * Returns a new #ECalendarTable.
*
- * Creates a new #ECalendarTable.
+ * Returns: a new #ECalendarTable
**/
GtkWidget *
-e_calendar_table_new (void)
+e_calendar_table_new (EShellView *shell_view,
+ ECalModel *model)
{
- GtkWidget *cal_table;
-
- cal_table = GTK_WIDGET (g_object_new (e_calendar_table_get_type (), NULL));
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
- return cal_table;
+ return g_object_new (
+ E_TYPE_CALENDAR_TABLE,
+ "model", model, "shell-view", shell_view, NULL);
}
+EShellView *
+e_calendar_table_get_shell_view (ECalendarTable *cal_table)
+{
+ g_return_val_if_fail (E_IS_CALENDAR_TABLE (cal_table), NULL);
+
+ return cal_table->priv->shell_view;
+}
/**
* e_calendar_table_get_model:
@@ -752,28 +989,12 @@ e_calendar_table_new (void)
ECalModel *
e_calendar_table_get_model (ECalendarTable *cal_table)
{
- g_return_val_if_fail (cal_table != NULL, NULL);
g_return_val_if_fail (E_IS_CALENDAR_TABLE (cal_table), NULL);
- return cal_table->model;
+ return cal_table->priv->model;
}
-static void
-e_calendar_table_destroy (GtkObject *object)
-{
- ECalendarTable *cal_table;
-
- cal_table = E_CALENDAR_TABLE (object);
-
- if (cal_table->model) {
- g_object_unref (cal_table->model);
- cal_table->model = NULL;
- }
-
- GTK_OBJECT_CLASS (e_calendar_table_parent_class)->destroy (object);
-}
-
/**
* e_calendar_table_get_table:
* @cal_table: A calendar table.
@@ -786,37 +1007,13 @@ e_calendar_table_destroy (GtkObject *object)
ETable *
e_calendar_table_get_table (ECalendarTable *cal_table)
{
- g_return_val_if_fail (cal_table != NULL, NULL);
- g_return_val_if_fail (E_IS_CALENDAR_TABLE (cal_table), NULL);
-
- return e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable));
-}
-
-void
-e_calendar_table_open_selected (ECalendarTable *cal_table)
-{
- ECalModelComponent *comp_data;
- icalproperty *prop;
+ ETableScrolled *table_scrolled;
- comp_data = e_calendar_table_get_selected_comp (cal_table);
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
- if (comp_data != NULL)
- e_calendar_table_open_task (cal_table, comp_data->client, comp_data->icalcomp, prop ? TRUE : FALSE);
-}
+ g_return_val_if_fail (E_IS_CALENDAR_TABLE (cal_table), NULL);
-/**
- * e_calendar_table_complete_selected:
- * @cal_table: A calendar table
- *
- * Marks the selected items as completed
- **/
-void
-e_calendar_table_complete_selected (ECalendarTable *cal_table)
-{
- g_return_if_fail (cal_table != NULL);
- g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
+ table_scrolled = E_TABLE_SCROLLED (cal_table->etable);
- mark_as_complete_cb (NULL, NULL, cal_table);
+ return e_table_scrolled_get_table (table_scrolled);
}
/* Used from e_table_selected_row_foreach(); puts the selected row number in an
@@ -831,16 +1028,19 @@ get_selected_row_cb (int model_row, gpointer data)
*row = model_row;
}
-/* Returns the component that is selected in the table; only works if there is
+/*
+ * Returns the component that is selected in the table; only works if there is
* one and only one selected row.
*/
-ECalModelComponent *
-e_calendar_table_get_selected_comp (ECalendarTable *cal_table)
+static ECalModelComponent *
+get_selected_comp (ECalendarTable *cal_table)
{
+ ECalModel *model;
ETable *etable;
int row;
- etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable));
+ model = e_calendar_table_get_model (cal_table);
+ etable = e_calendar_table_get_table (cal_table);
if (e_table_selected_count (etable) != 1)
return NULL;
@@ -850,7 +1050,7 @@ e_calendar_table_get_selected_comp (ECalendarTable *cal_table)
&row);
g_return_val_if_fail (row != -1, NULL);
- return e_cal_model_get_component_at (cal_table->model, row);
+ return e_cal_model_get_component_at (model, row);
}
struct get_selected_uids_closure {
@@ -862,40 +1062,27 @@ struct get_selected_uids_closure {
static void
add_uid_cb (int model_row, gpointer data)
{
- struct get_selected_uids_closure *closure;
+ struct get_selected_uids_closure *closure = data;
ECalModelComponent *comp_data;
+ ECalModel *model;
- closure = data;
-
- comp_data = e_cal_model_get_component_at (closure->cal_table->model, model_row);
+ model = e_calendar_table_get_model (closure->cal_table);
+ comp_data = e_cal_model_get_component_at (model, model_row);
closure->objects = g_slist_prepend (closure->objects, comp_data);
}
-static GSList *
-get_selected_objects (ECalendarTable *cal_table)
-{
- struct get_selected_uids_closure closure;
- ETable *etable;
-
- closure.cal_table = cal_table;
- closure.objects = NULL;
-
- etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable));
- e_table_selected_row_foreach (etable, add_uid_cb, &closure);
-
- return closure.objects;
-}
-
/* Deletes all of the selected components in the table */
static void
delete_selected_components (ECalendarTable *cal_table)
{
GSList *objs, *l;
+ const gchar *status_message;
- objs = get_selected_objects (cal_table);
+ objs = e_calendar_table_get_selected (cal_table);
- e_calendar_table_set_status_message (cal_table, _("Deleting selected objects"), -1);
+ status_message = _("Deleting selected objects");
+ calendar_table_emit_status_message (cal_table, status_message, -1.0);
for (l = objs; l; l = l->next) {
ECalModelComponent *comp_data = (ECalModelComponent *) l->data;
@@ -907,7 +1094,7 @@ delete_selected_components (ECalendarTable *cal_table)
g_clear_error (&error);
}
- e_calendar_table_set_status_message (cal_table, NULL, -1);
+ calendar_table_emit_status_message (cal_table, NULL, -1.0);
g_slist_free (objs);
}
@@ -968,14 +1155,14 @@ e_calendar_table_delete_selected (ECalendarTable *cal_table)
g_return_if_fail (cal_table != NULL);
g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
- etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable));
+ etable = e_calendar_table_get_table (cal_table);
n_selected = e_table_selected_count (etable);
if (n_selected <= 0)
return;
if (n_selected == 1)
- comp_data = e_calendar_table_get_selected_comp (cal_table);
+ comp_data = get_selected_comp (cal_table);
else
comp_data = NULL;
@@ -1039,7 +1226,16 @@ e_calendar_table_delete_selected (ECalendarTable *cal_table)
GSList *
e_calendar_table_get_selected (ECalendarTable *cal_table)
{
- return get_selected_objects(cal_table);
+ struct get_selected_uids_closure closure;
+ ETable *etable;
+
+ closure.cal_table = cal_table;
+ closure.objects = NULL;
+
+ etable = e_calendar_table_get_table (cal_table);
+ e_table_selected_row_foreach (etable, add_uid_cb, &closure);
+
+ return closure.objects;
}
/**
@@ -1083,6 +1279,7 @@ copy_row_cb (int model_row, gpointer data)
{
ECalendarTable *cal_table;
ECalModelComponent *comp_data;
+ ECalModel *model;
gchar *comp_str;
icalcomponent *child;
@@ -1090,7 +1287,8 @@ copy_row_cb (int model_row, gpointer data)
g_return_if_fail (cal_table->tmp_vcal != NULL);
- comp_data = e_cal_model_get_component_at (cal_table->model, model_row);
+ model = e_calendar_table_get_model (cal_table);
+ comp_data = e_cal_model_get_component_at (model, model_row);
if (!comp_data)
return;
@@ -1126,14 +1324,13 @@ e_calendar_table_copy_clipboard (ECalendarTable *cal_table)
/* create temporary VCALENDAR object */
cal_table->tmp_vcal = e_cal_util_new_top_level ();
- etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable));
+ etable = e_calendar_table_get_table (cal_table);
e_table_selected_row_foreach (etable, copy_row_cb, cal_table);
comp_str = icalcomponent_as_ical_string_r (cal_table->tmp_vcal);
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (cal_table), clipboard_atom);
if (!gtk_clipboard_set_with_data(clipboard, target_types, n_target_types,
clipboard_get_calendar_cb,
NULL, comp_str)) {
-
/* no-op */
} else {
gtk_clipboard_set_can_store (clipboard, target_types + 1, n_target_types - 1);
@@ -1151,8 +1348,10 @@ clipboard_get_calendar_data (ECalendarTable *cal_table, const gchar *text)
icalcomponent *icalcomp;
char *uid;
ECalComponent *comp;
+ ECalModel *model;
ECal *client;
icalcomponent_kind kind;
+ const gchar *status_message;
g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
@@ -1172,9 +1371,11 @@ clipboard_get_calendar_data (ECalendarTable *cal_table, const gchar *text)
return;
}
- client = e_cal_model_get_default_client (cal_table->model);
+ model = e_calendar_table_get_model (cal_table);
+ client = e_cal_model_get_default_client (model);
- e_calendar_table_set_status_message (cal_table, _("Updating objects"), -1);
+ status_message = _("Updating objects");
+ calendar_table_emit_status_message (cal_table, status_message, -1.0);
if (kind == ICAL_VCALENDAR_COMPONENT) {
icalcomponent_kind child_kind;
@@ -1219,7 +1420,7 @@ clipboard_get_calendar_data (ECalendarTable *cal_table, const gchar *text)
g_object_unref (comp);
}
- e_calendar_table_set_status_message (cal_table, NULL, -1);
+ calendar_table_emit_status_message (cal_table, NULL, -1.0);
}
static void
@@ -1228,7 +1429,7 @@ clipboard_paste_received_cb (GtkClipboard *clipboard,
gpointer data)
{
ECalendarTable *cal_table = E_CALENDAR_TABLE (data);
- ETable *e_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable));
+ ETable *e_table = e_calendar_table_get_table (cal_table);
GnomeCanvas *canvas = e_table->table_canvas;
GnomeCanvasItem *item = GNOME_CANVAS (canvas)->focused_item;
@@ -1263,446 +1464,15 @@ void
e_calendar_table_paste_clipboard (ECalendarTable *cal_table)
{
GtkClipboard *clipboard;
- g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
-
- clipboard = gtk_widget_get_clipboard (GTK_WIDGET (cal_table), clipboard_atom);
- g_object_ref (cal_table);
-
- gtk_clipboard_request_contents (clipboard,
- gdk_atom_intern (target_types[0].target, FALSE),
- clipboard_paste_received_cb, cal_table);
-}
-
-/* Opens a task in the task editor */
-void
-e_calendar_table_open_task (ECalendarTable *cal_table, ECal *client, icalcomponent *icalcomp, gboolean assign)
-{
- CompEditor *tedit;
- const char *uid;
- guint32 flags = 0;
-
- uid = icalcomponent_get_uid (icalcomp);
-
- tedit = e_comp_editor_registry_find (comp_editor_registry, uid);
- if (tedit == NULL) {
- ECalComponent *comp;
-
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
-
- if (assign) {
- flags |= COMP_EDITOR_IS_ASSIGNED;
- if (itip_organizer_is_user (comp, client) ||
- !e_cal_component_has_attendees (comp))
- flags |= COMP_EDITOR_USER_ORG;
- }
-
- tedit = task_editor_new (client, flags);
- comp_editor_edit_comp (tedit, comp);
- g_object_unref (comp);
-
- if (flags & COMP_EDITOR_IS_ASSIGNED)
- task_editor_show_assignment (TASK_EDITOR (tedit));
-
- e_comp_editor_registry_add (comp_editor_registry, tedit, FALSE);
- }
- gtk_window_present (GTK_WINDOW (tedit));
-}
-
-/* Opens the task in the specified row */
-static void
-open_task_by_row (ECalendarTable *cal_table, int row)
-{
- ECalModelComponent *comp_data;
- icalproperty *prop;
-
- comp_data = e_cal_model_get_component_at (cal_table->model, row);
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
- e_calendar_table_open_task (cal_table, comp_data->client, comp_data->icalcomp, prop ? TRUE : FALSE);
-}
-
-static void
-e_calendar_table_on_double_click (ETable *table,
- gint row,
- gint col,
- GdkEvent *event,
- ECalendarTable *cal_table)
-{
- open_task_by_row (cal_table, row);
-}
-
-/* popup menu callbacks */
-
-static void
-e_calendar_table_on_open_task (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ECalendarTable *cal_table = data;
- ECalModelComponent *comp_data;
- icalproperty *prop;
-
- comp_data = e_calendar_table_get_selected_comp (cal_table);
-
- if (!comp_data)
- return;
-
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
- e_calendar_table_open_task (cal_table, comp_data->client, comp_data->icalcomp, prop ? TRUE : FALSE);
-}
-
-static void
-e_calendar_table_on_save_as (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ECalendarTable *cal_table = data;
- ECalModelComponent *comp_data;
- char *filename;
- char *ical_string;
-
- comp_data = e_calendar_table_get_selected_comp (cal_table);
- if (comp_data == NULL)
- return;
-
- filename = e_file_dialog_save (_("Save as..."), NULL);
- if (filename == NULL)
- return;
-
- ical_string = e_cal_get_component_as_string (comp_data->client, comp_data->icalcomp);
- if (ical_string == NULL) {
- g_warning ("Couldn't convert item to a string");
- return;
- }
-
- e_write_file_uri (filename, ical_string);
-
- g_free (ical_string);
-}
-
-static void
-e_calendar_table_on_print_task (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ECalendarTable *cal_table = data;
- ECalModelComponent *comp_data;
- ECalComponent *comp;
-
- comp_data = e_calendar_table_get_selected_comp (cal_table);
- if (comp_data == NULL)
- return;
-
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- print_comp (comp, comp_data->client, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-
- g_object_unref (comp);
-}
-
-static void
-e_calendar_table_on_cut (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ECalendarTable *cal_table = data;
-
- e_calendar_table_cut_clipboard (cal_table);
-}
-
-static void
-e_calendar_table_on_copy (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ECalendarTable *cal_table = data;
-
- e_calendar_table_copy_clipboard (cal_table);
-}
-
-static void
-e_calendar_table_on_paste (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ECalendarTable *cal_table = data;
-
- e_calendar_table_paste_clipboard (cal_table);
-}
-
-static void
-e_calendar_table_on_assign (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ECalendarTable *cal_table = data;
- ECalModelComponent *comp_data;
-
- comp_data = e_calendar_table_get_selected_comp (cal_table);
- if (comp_data)
- e_calendar_table_open_task (cal_table, comp_data->client, comp_data->icalcomp, TRUE);
-}
-
-static void
-e_calendar_table_on_forward (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ECalendarTable *cal_table = data;
- ECalModelComponent *comp_data;
-
- comp_data = e_calendar_table_get_selected_comp (cal_table);
- if (comp_data) {
- ECalComponent *comp;
-
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL, NULL, TRUE);
-
- g_object_unref (comp);
- }
-}
-
-struct AffectedComponents {
- ECalendarTable *cal_table;
- GSList *components; /* contains pointers to ECalModelComponent */
-};
-
-/**
- * get_selected_components_cb
- * Helper function to fill list of selected components in ECalendarTable.
- * This function is called from e_table_selected_row_foreach.
- **/
-static void
-get_selected_components_cb (int model_row, gpointer data)
-{
- struct AffectedComponents *ac = (struct AffectedComponents *) data;
-
- if (!ac || !ac->cal_table)
- return;
-
- ac->components = g_slist_prepend (ac->components, e_cal_model_get_component_at (E_CAL_MODEL (ac->cal_table->model), model_row));
-}
-
-/**
- * do_for_selected_components
- * Calls function func for all selected components in cal_table.
- *
- * @param cal_table Table with selected components of our interest
- * @param func Function to be called on each selected component from cal_table.
- * The first parameter of this function is a pointer to ECalModelComponent and
- * the second parameter of this function is pointer to cal_table
- **/
-static void
-do_for_selected_components (ECalendarTable *cal_table, GFunc func)
-{
- ETable *etable;
- struct AffectedComponents ac;
-
- g_return_if_fail (cal_table != NULL);
-
- ac.cal_table = cal_table;
- ac.components = NULL;
-
- etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable));
- e_table_selected_row_foreach (etable, get_selected_components_cb, &ac);
-
- g_slist_foreach (ac.components, func, cal_table);
- g_slist_free (ac.components);
-}
-
-/**
- * mark_comp_complete_cb
- * Function used in call to @ref do_for_selected_components to mark each component as complete
- **/
-static void
-mark_comp_complete_cb (gpointer data, gpointer user_data)
-{
- ECalendarTable *cal_table;
- ECalModelComponent *comp_data;
-
- comp_data = (ECalModelComponent *) data;
- cal_table = E_CALENDAR_TABLE (user_data);
-
- e_cal_model_tasks_mark_comp_complete (E_CAL_MODEL_TASKS (cal_table->model), comp_data);
-}
-
-/**
- * mark_comp_incomplete_cb
- * Function used in call to @ref do_for_selected_components to mark each component as incomplete
- **/
-static void
-mark_comp_incomplete_cb (gpointer data, gpointer user_data)
-{
- ECalendarTable *cal_table;
- ECalModelComponent *comp_data;
-
- comp_data = (ECalModelComponent *) data;
- cal_table = E_CALENDAR_TABLE (user_data);
-
- e_cal_model_tasks_mark_comp_incomplete (E_CAL_MODEL_TASKS (cal_table->model), comp_data);
-}
-
-/* Callback used for the "mark tasks as incomplete" menu item */
-static void
-mark_as_incomplete_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- do_for_selected_components (data, mark_comp_incomplete_cb);
-}
-
-/* Callback used for the "mark tasks as complete" menu item */
-static void
-mark_as_complete_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- do_for_selected_components (data, mark_comp_complete_cb);
-}
-
-/* Opens the URL of the task */
-static void
-open_url_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ECalendarTable *cal_table = data;
- ECalModelComponent *comp_data;
- icalproperty *prop;
-
- comp_data = e_calendar_table_get_selected_comp (cal_table);
- if (!comp_data)
- return;
-
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_URL_PROPERTY);
- if (!prop)
- return;
-
- /* FIXME Pass a parent window. */
- e_show_uri (NULL, icalproperty_get_url (prop));
-}
-
-/* Opens a new task editor */
-static void
-on_new_task (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ECalendarTable *cal_table = data;
- ETasks *tasks = g_object_get_data (G_OBJECT (cal_table), "tasks");
-
- if (!tasks)
- return;
-
- e_tasks_new_task (tasks);
-
-}
-
-/* Callback for the "delete tasks" menu item */
-static void
-delete_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- ECalendarTable *cal_table = data;
-
- e_calendar_table_delete_selected (cal_table);
-}
-
-static EPopupItem tasks_popup_items [] = {
- { E_POPUP_ITEM, (gchar *) "00.newtask", (gchar *) N_("New _Task"), on_new_task, NULL, (gchar *) "stock_task", 0, 0},
- { E_POPUP_BAR, (gchar *) "01.bar" },
-
- { E_POPUP_ITEM, (gchar *) "03.open", (gchar *) N_("_Open"), e_calendar_table_on_open_task, NULL, (gchar *) GTK_STOCK_OPEN, E_CAL_POPUP_SELECT_ONE },
- { E_POPUP_ITEM, (gchar *) "05.openweb", (gchar *) N_("Open _Web Page"), open_url_cb, NULL, NULL, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_HASURL },
- { E_POPUP_ITEM, (gchar *) "10.saveas", (gchar *) N_("_Save As..."), e_calendar_table_on_save_as, NULL, (gchar *) GTK_STOCK_SAVE_AS, E_CAL_POPUP_SELECT_ONE },
- { E_POPUP_ITEM, (gchar *) "20.print", (gchar *) N_("P_rint..."), e_calendar_table_on_print_task, NULL, (gchar *) GTK_STOCK_PRINT, E_CAL_POPUP_SELECT_ONE },
-
- { E_POPUP_BAR, (gchar *) "30.bar" },
-
- { E_POPUP_ITEM, (gchar *) "40.cut", (gchar *) N_("C_ut"), e_calendar_table_on_cut, NULL, (gchar *) GTK_STOCK_CUT, 0, E_CAL_POPUP_SELECT_EDITABLE },
- { E_POPUP_ITEM, (gchar *) "50.copy", (gchar *) N_("_Copy"), e_calendar_table_on_copy, NULL, (gchar *) GTK_STOCK_COPY, 0, 0 },
- { E_POPUP_ITEM, (gchar *) "60.paste", (gchar *) N_("_Paste"), e_calendar_table_on_paste, NULL, (gchar *) GTK_STOCK_PASTE, 0, E_CAL_POPUP_SELECT_EDITABLE },
-
- { E_POPUP_BAR, (gchar *) "70.bar" },
-
- { E_POPUP_ITEM, (gchar *) "80.assign", (gchar *) N_("_Assign Task"), e_calendar_table_on_assign, NULL, NULL, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_EDITABLE|E_CAL_POPUP_SELECT_ASSIGNABLE },
- { E_POPUP_ITEM, (gchar *) "90.forward", (gchar *) N_("_Forward as iCalendar"), e_calendar_table_on_forward, NULL, (gchar *) "mail-forward", E_CAL_POPUP_SELECT_ONE },
- { E_POPUP_ITEM, (gchar *) "a0.markonecomplete", (gchar *) N_("_Mark as Complete"), mark_as_complete_cb, NULL, NULL, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_EDITABLE | E_CAL_POPUP_SELECT_NOTCOMPLETE},
- { E_POPUP_ITEM, (gchar *) "b0.markmanycomplete", (gchar *) N_("_Mark Selected Tasks as Complete"), mark_as_complete_cb, NULL, NULL, E_CAL_POPUP_SELECT_MANY, E_CAL_POPUP_SELECT_EDITABLE | E_CAL_POPUP_SELECT_NOTCOMPLETE },
- { E_POPUP_ITEM, (gchar *) "c0.markoneincomplete", (gchar *) N_("_Mark as Incomplete"), mark_as_incomplete_cb, NULL, NULL, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_EDITABLE|E_CAL_POPUP_SELECT_COMPLETE},
- { E_POPUP_ITEM, (gchar *) "d0.markmanyincomplete", (gchar *) N_("_Mark Selected Tasks as Incomplete"), mark_as_incomplete_cb, NULL, NULL, E_CAL_POPUP_SELECT_MANY, E_CAL_POPUP_SELECT_EDITABLE | E_CAL_POPUP_SELECT_COMPLETE },
-
- { E_POPUP_BAR, (gchar *) "e0.bar" },
-
- { E_POPUP_ITEM, (gchar *) "f0.delete", (gchar *) N_("_Delete"), delete_cb, NULL, (gchar *) GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_EDITABLE },
- { E_POPUP_ITEM, (gchar *) "g0.deletemany", (gchar *) N_("_Delete Selected Tasks"), delete_cb, NULL, (gchar *) GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_MANY, E_CAL_POPUP_SELECT_EDITABLE },
-};
-
-static void
-ect_popup_free(EPopup *ep, GSList *items, void *data)
-{
- g_slist_free(items);
-}
-
-static gint
-e_calendar_table_show_popup_menu (ETable *table,
- GdkEvent *gdk_event,
- ECalendarTable *cal_table)
-{
- GtkMenu *menu;
- GSList *selection, *l, *menus = NULL;
- GPtrArray *events;
- ECalPopup *ep;
- ECalPopupTargetSelect *t;
- int i;
-
- selection = get_selected_objects (cal_table);
- if (!selection)
- return TRUE;
-
- /** @HookPoint-ECalPopup: Tasks Table Context Menu
- * @Id: org.gnome.evolution.tasks.table.popup
- * @Class: org.gnome.evolution.calendar.popup:1.0
- * @Target: ECalPopupTargetSelect
- *
- * The context menu on the tasks table.
- */
- ep = e_cal_popup_new("org.gnome.evolution.tasks.table.popup");
-
- events = g_ptr_array_new();
- for (l=selection;l;l=g_slist_next(l))
- g_ptr_array_add(events, e_cal_model_copy_component_data((ECalModelComponent *)l->data));
- g_slist_free(selection);
-
- t = e_cal_popup_target_new_select(ep, cal_table->model, events);
- t->target.widget = (GtkWidget *)cal_table;
-
- for (i=0;i<sizeof(tasks_popup_items)/sizeof(tasks_popup_items[0]);i++)
- menus = g_slist_prepend(menus, &tasks_popup_items[i]);
- e_popup_add_items((EPopup *)ep, menus, NULL, ect_popup_free, cal_table);
-
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
-
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, gdk_event?gdk_event->button.button:0,
- gdk_event?gdk_event->button.time:gtk_get_current_event_time());
-
- return TRUE;
-}
-
-static gint
-e_calendar_table_on_right_click (ETable *table,
- gint row,
- gint col,
- GdkEvent *event,
- ECalendarTable *cal_table)
-{
- return e_calendar_table_show_popup_menu (table, event, cal_table);
-}
+ g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
-static gboolean
-e_calendar_table_on_popup_menu (GtkWidget *widget, gpointer data)
-{
- ETable *table = E_TABLE(widget);
- g_return_val_if_fail(table, FALSE);
+ clipboard = gtk_widget_get_clipboard (
+ GTK_WIDGET (cal_table), clipboard_atom);
- return e_calendar_table_show_popup_menu (table, NULL,
- E_CALENDAR_TABLE(data));
-}
-
-static gint
-e_calendar_table_on_key_press (ETable *table,
- gint row,
- gint col,
- GdkEventKey *event,
- ECalendarTable *cal_table)
-{
- if (event->keyval == GDK_Delete) {
- delete_cb (NULL, NULL, cal_table);
- return TRUE;
- } else if ((event->keyval == GDK_o)
- &&(event->state & GDK_CONTROL_MASK)) {
- open_task_by_row (cal_table, row);
- return TRUE;
- }
-
- return FALSE;
+ gtk_clipboard_request_contents (
+ clipboard, gdk_atom_intern (target_types[0].target, FALSE),
+ clipboard_paste_received_cb, g_object_ref (cal_table));
}
static void
@@ -1793,29 +1563,31 @@ show_completed_rows (ECalModel *model, GList *clients_list, char *show_sexp, GPt
/* Loads the state of the table (headers shown etc.) from the given file. */
void
-e_calendar_table_load_state (ECalendarTable *cal_table,
- gchar *filename)
+e_calendar_table_load_state (ECalendarTable *cal_table,
+ const gchar *filename)
{
- struct stat st;
+ ETable *table;
g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
+ g_return_if_fail (filename != NULL);
- if (g_stat (filename, &st) == 0 && st.st_size > 0
- && S_ISREG (st.st_mode)) {
- e_table_load_state (e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable)), filename);
- }
+ table = e_calendar_table_get_table (cal_table);
+ e_table_load_state (table, filename);
}
/* Saves the state of the table (headers shown etc.) to the given file. */
void
-e_calendar_table_save_state (ECalendarTable *cal_table,
- gchar *filename)
+e_calendar_table_save_state (ECalendarTable *cal_table,
+ const gchar *filename)
{
+ ETable *table;
+
g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
+ g_return_if_fail (filename != NULL);
- e_table_save_state (e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable)),
- filename);
+ table = e_calendar_table_get_table (cal_table);
+ e_table_save_state (table, filename);
}
/* Returns the current time, for the ECellDateEdit items.
@@ -1845,57 +1617,6 @@ e_calendar_table_get_current_time (ECellDateEdit *ecde, gpointer data)
return tmp_tm;
}
-
-#ifdef TRANSLATORS_ONLY
-
-static char *test[] = {
- N_("Click to add a task")
-};
-
-#endif
-
-void
-e_calendar_table_set_activity_handler (ECalendarTable *cal_table, EActivityHandler *activity_handler)
-{
- g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
-
- cal_table->activity_handler = activity_handler;
-}
-
-void
-e_calendar_table_set_status_message (ECalendarTable *cal_table, const gchar *message, int percent)
-{
- g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
-
- if (!cal_table->activity_handler)
- return;
-
- if (!message || !*message) {
- if (cal_table->activity_id != 0) {
- e_activity_handler_operation_finished (cal_table->activity_handler, cal_table->activity_id);
- cal_table->activity_id = 0;
- }
- } else if (cal_table->activity_id == 0) {
- char *client_id = g_strdup_printf ("%p", (gpointer) cal_table);
-
- cal_table->activity_id = e_activity_handler_operation_started (
- cal_table->activity_handler, client_id, message, TRUE);
-
- g_free (client_id);
- } else {
-
- double progress;
-
- if (percent < 0)
- progress = -1.0;
- else {
- progress = ((double) percent / 100);
- }
-
- e_activity_handler_operation_progressing (cal_table->activity_handler, cal_table->activity_id, message, progress);
- }
-}
-
/**
* e_calendar_table_hide_completed_tasks:
* @table: A calendar table model.
diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h
index d5dac7318e..4645be188b 100644
--- a/calendar/gui/e-calendar-table.h
+++ b/calendar/gui/e-calendar-table.h
@@ -23,34 +23,43 @@
#ifndef _E_CALENDAR_TABLE_H_
#define _E_CALENDAR_TABLE_H_
-#include <gtk/gtk.h>
+#include <shell/e-shell-view.h>
#include <table/e-table-scrolled.h>
-#include <misc/e-cell-date-edit.h>
-#include "e-activity-handler.h"
+#include <table/e-cell-date-edit.h>
#include "e-cal-model.h"
-G_BEGIN_DECLS
-
/*
* ECalendarTable - displays the iCalendar objects in a table (an ETable).
* Used for calendar events and tasks.
*/
+/* Standard GObject macros */
+#define E_TYPE_CALENDAR_TABLE \
+ (e_calendar_table_get_type ())
+#define E_CALENDAR_TABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CALENDAR_TABLE, ECalendarTable))
+#define E_CALENDAR_TABLE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CALENDAR_TABLE, ECalendarTableClass))
+#define E_IS_CALENDAR_TABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CALENDAR_TABLE))
+#define E_IS_CALENDAR_TABLE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CALENDAR_TABLE))
+#define E_CALENDAR_TABLE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CALENDAR_TABLE, ECalendarTableClass))
-#define E_CALENDAR_TABLE(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_calendar_table_get_type (), ECalendarTable)
-#define E_CALENDAR_TABLE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_calendar_table_get_type (), ECalendarTableClass)
-#define E_IS_CALENDAR_TABLE(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_calendar_table_get_type ())
-
-
-typedef struct _ECalendarTable ECalendarTable;
-typedef struct _ECalendarTableClass ECalendarTableClass;
+G_BEGIN_DECLS
+typedef struct _ECalendarTable ECalendarTable;
+typedef struct _ECalendarTableClass ECalendarTableClass;
+typedef struct _ECalendarTablePrivate ECalendarTablePrivate;
struct _ECalendarTable {
- GtkTable table;
-
- /* The model that we use */
- ECalModel *model;
+ GtkTable parent;
GtkWidget *etable;
@@ -60,61 +69,55 @@ struct _ECalendarTable {
/* Fields used for cut/copy/paste */
icalcomponent *tmp_vcal;
- /* Activity ID for the EActivityHandler (i.e. the status bar). */
- EActivityHandler *activity_handler;
- guint activity_id;
-
- /* We should know which calendar has been used to create object, so store it here
- before emitting "user_created" signal and make it NULL just after the emit. */
- ECal *user_created_cal;
+ ECalendarTablePrivate *priv;
};
struct _ECalendarTableClass {
GtkTableClass parent_class;
- /* Notification signals */
- void (* user_created) (ECalendarTable *cal_table);
+ /* Signals */
+ void (*open_component) (ECalendarTable *cal_table,
+ ECalModelComponent *comp_data);
+ void (*popup_event) (ECalendarTable *cal_table,
+ GdkEvent *event);
+ void (*status_message) (ECalendarTable *cal_table,
+ const gchar *message,
+ gdouble percent);
+ void (*user_created) (ECalendarTable *cal_table);
};
-
-GType e_calendar_table_get_type (void);
-GtkWidget* e_calendar_table_new (void);
-
-ECalModel *e_calendar_table_get_model (ECalendarTable *cal_table);
-
-ETable *e_calendar_table_get_table (ECalendarTable *cal_table);
-
-void e_calendar_table_open_selected (ECalendarTable *cal_table);
-void e_calendar_table_complete_selected (ECalendarTable *cal_table);
-void e_calendar_table_delete_selected (ECalendarTable *cal_table);
-
-GSList *e_calendar_table_get_selected (ECalendarTable *cal_table);
+GType e_calendar_table_get_type (void);
+GtkWidget * e_calendar_table_new (EShellView *shell_view,
+ ECalModel *model);
+ECalModel * e_calendar_table_get_model (ECalendarTable *cal_table);
+ETable * e_calendar_table_get_table (ECalendarTable *cal_table);
+EShellView * e_calendar_table_get_shell_view (ECalendarTable *cal_table);
+void e_calendar_table_delete_selected(ECalendarTable *cal_table);
+GSList * e_calendar_table_get_selected (ECalendarTable *cal_table);
/* Clipboard related functions */
-void e_calendar_table_cut_clipboard (ECalendarTable *cal_table);
-void e_calendar_table_copy_clipboard (ECalendarTable *cal_table);
-void e_calendar_table_paste_clipboard (ECalendarTable *cal_table);
+void e_calendar_table_cut_clipboard (ECalendarTable *cal_table);
+void e_calendar_table_copy_clipboard (ECalendarTable *cal_table);
+void e_calendar_table_paste_clipboard(ECalendarTable *cal_table);
/* These load and save the state of the table (headers shown etc.) to/from
the given file. */
-void e_calendar_table_load_state (ECalendarTable *cal_table,
- gchar *filename);
-void e_calendar_table_save_state (ECalendarTable *cal_table,
- gchar *filename);
-
-void e_calendar_table_set_activity_handler (ECalendarTable *cal_table,
- EActivityHandler *activity_handler);
-void e_calendar_table_set_status_message (ECalendarTable *cal_table,
- const gchar *message,
- int percent);
-void e_calendar_table_open_task (ECalendarTable *cal_table,
- ECal *client,
- icalcomponent *icalcomp,
- gboolean assign);
-ECalModelComponent * e_calendar_table_get_selected_comp (ECalendarTable *cal_table);
-void e_calendar_table_hide_completed_tasks (ECalendarTable *table, GList *clients_list, gboolean config_changed);
-
-void e_calendar_table_process_completed_tasks (ECalendarTable *table, GList *clients_list, gboolean config_changed);
+void e_calendar_table_load_state (ECalendarTable *cal_table,
+ const gchar *filename);
+void e_calendar_table_save_state (ECalendarTable *cal_table,
+ const gchar *filename);
+
+ECalModelComponent *
+ e_calendar_table_get_selected_comp
+ (ECalendarTable *cal_table);
+void e_calendar_table_hide_completed_tasks
+ (ECalendarTable *table,
+ GList *clients_list,
+ gboolean config_changed);
+void e_calendar_table_process_completed_tasks
+ (ECalendarTable *table,
+ GList *clients_list,
+ gboolean config_changed);
gboolean ec_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, GtkWidget *etable_wgt, ECalModel *model);
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 91f9eded7a..975052ba17 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -37,15 +37,14 @@
#include <e-util/e-icon-factory.h>
#include <libecal/e-cal-time-util.h>
#include <libecal/e-cal-component.h>
+#include <shell/e-shell.h>
#include "common/authentication.h"
#include "calendar-commands.h"
-#include "calendar-component.h"
#include "calendar-config.h"
#include "comp-util.h"
#include "e-cal-model-calendar.h"
#include "e-calendar-view.h"
-#include "e-comp-editor-registry.h"
#include "itip-utils.h"
#include "dialogs/delete-comp.h"
#include "dialogs/delete-error.h"
@@ -56,7 +55,7 @@
#include "dialogs/select-source-dialog.h"
#include "print.h"
#include "goto.h"
-#include "ea-calendar.h"
+#include "a11y/ea-calendar.h"
#include "e-cal-popup.h"
#include "misc.h"
@@ -67,10 +66,6 @@ struct _ECalendarViewPrivate {
/* The calendar model we are monitoring */
ECalModel *model;
- /* Current activity (for the EActivityHandler, i.e. the status bar). */
- EActivityHandler *activity_handler;
- guint activity_id;
-
/* The default category */
char *default_category;
};
@@ -79,7 +74,6 @@ static void e_calendar_view_get_property (GObject *object, guint property_id, GV
static void e_calendar_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
static void e_calendar_view_destroy (GtkObject *object);
-extern ECompEditorRegistry *comp_editor_registry;
/* Property IDs */
enum props {
@@ -254,8 +248,10 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
GDK_CONTROL_MASK,
"open_event", 0);
+#if 0 /* KILL-BONOBO */
/* init the accessibility support for e_day_view */
e_cal_view_a11y_init ();
+#endif
}
@@ -263,6 +259,7 @@ void
e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart,
icaltimezone *default_zone, icalcomponent *icalcomp, gboolean in_top_canvas)
{
+#if 0 /* KILL-BONOBO */
ECalComponent *comp;
struct icaltimetype itime, old_dtstart, old_dtend;
time_t tt_start, tt_end, new_dtstart = 0;
@@ -380,6 +377,7 @@ e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart
}
g_object_unref (comp);
+#endif
}
static void
@@ -536,55 +534,6 @@ e_calendar_view_set_use_24_hour_format (ECalendarView *cal_view, gboolean use_24
e_cal_model_set_use_24_hour_format (cal_view->priv->model, use_24_hour);
}
-void
-e_calendar_view_set_activity_handler (ECalendarView *cal_view, EActivityHandler *activity_handler)
-{
- ECalendarViewPrivate *priv;
-
- g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
-
- priv = cal_view->priv;
-
- priv->activity_handler = activity_handler;
-}
-
-void
-e_calendar_view_set_status_message (ECalendarView *cal_view, const gchar *message, int percent)
-{
- ECalendarViewPrivate *priv;
-
- g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
-
- priv = cal_view->priv;
-
- if (!priv->activity_handler)
- return;
-
- if (!message || !*message) {
- if (priv->activity_id != 0) {
- e_activity_handler_operation_finished (priv->activity_handler, priv->activity_id);
- priv->activity_id = 0;
- }
- } else if (priv->activity_id == 0) {
- char *client_id = g_strdup_printf ("%p", (gpointer) cal_view);
-
- priv->activity_id = e_activity_handler_operation_started (
- priv->activity_handler, client_id, message, TRUE);
-
- g_free (client_id);
- } else {
- double progress;
-
- if (percent < 0)
- progress = -1.0;
- else {
- progress = ((double) percent / 100);
- }
-
- e_activity_handler_operation_progressing (priv->activity_handler, priv->activity_id, message, progress);
- }
-}
-
GList *
e_calendar_view_get_selected_events (ECalendarView *cal_view)
{
@@ -655,7 +604,9 @@ e_calendar_view_cut_clipboard (ECalendarView *cal_view)
if (!selected)
return;
+#if 0 /* KILL-BONOBO */
e_calendar_view_set_status_message (cal_view, _("Deleting selected objects"), -1);
+#endif
e_calendar_view_copy_clipboard (cal_view);
for (l = selected; l != NULL; l = l->next) {
@@ -700,7 +651,9 @@ e_calendar_view_cut_clipboard (ECalendarView *cal_view)
g_object_unref (comp);
}
+#if 0 /* KILL-BONOBO */
e_calendar_view_set_status_message (cal_view, NULL, -1);
+#endif
g_list_free (selected);
}
@@ -869,7 +822,9 @@ clipboard_get_calendar_data (ECalendarView *cal_view, const gchar *text)
if (kind != ICAL_VCALENDAR_COMPONENT && kind != ICAL_VEVENT_COMPONENT)
return;
+#if 0 /* KILL-BONOBO */
e_calendar_view_set_status_message (cal_view, _("Updating objects"), -1);
+#endif
e_calendar_view_get_selected_time_range (cal_view, &selected_time_start, &selected_time_end);
if ((selected_time_end - selected_time_start) == 60 * 60 * 24)
@@ -917,7 +872,9 @@ clipboard_get_calendar_data (ECalendarView *cal_view, const gchar *text)
e_calendar_view_add_event (cal_view, client, selected_time_start, default_zone, icalcomp, in_top_canvas);
}
+#if 0 /* KILL-BONOBO */
e_calendar_view_set_status_message (cal_view, NULL, -1);
+#endif
}
static void
@@ -1268,11 +1225,13 @@ on_new_meeting (EPopup *ep, EPopupItem *pitem, void *data)
static void
on_new_task (EPopup *ep, EPopupItem *pitem, void *data)
{
+#if 0 /* KILL-BONOBO */
ECalendarView *cal_view = data;
time_t dtstart, dtend;
e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend);
gnome_calendar_new_task (cal_view->priv->calendar, &dtstart, &dtend);
+#endif
}
static void
@@ -1286,9 +1245,11 @@ on_goto_date (EPopup *ep, EPopupItem *pitem, void *data)
static void
on_goto_today (EPopup *ep, EPopupItem *pitem, void *data)
{
+#if 0 /* KILL-BONOBO */
ECalendarView *cal_view = data;
- calendar_goto_today (cal_view->priv->calendar);
+ gnome_calendar_goto_today (cal_view->priv->calendar);
+#endif
}
static void
@@ -1313,9 +1274,11 @@ on_edit_appointment (EPopup *ep, EPopupItem *pitem, void *data)
static void
on_print (EPopup *ep, EPopupItem *pitem, void *data)
{
+#if 0 /* KILL-BONOBO */
ECalendarView *cal_view = data;
calendar_command_print (cal_view->priv->calendar, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
+#endif
}
static void
@@ -1475,16 +1438,20 @@ transfer_selected_items (ECalendarView *cal_view, gboolean remove_item)
return;
}
+#if 0 /* KILL-BONOBO */
/* process all selected events */
if (remove_item)
e_calendar_view_set_status_message (cal_view, _("Moving items"), -1);
else
e_calendar_view_set_status_message (cal_view, _("Copying items"), -1);
+#endif
for (l = selected; l != NULL; l = l->next)
transfer_item_to ((ECalendarViewEvent *) l->data, dest_client, remove_item);
+#if 0 /* KILL-BONOBO */
e_calendar_view_set_status_message (cal_view, NULL, -1);
+#endif
/* free memory */
g_object_unref (destination_source);
@@ -1836,69 +1803,6 @@ static EPopupItem ecv_child_items [] = {
{ E_POPUP_ITEM, (gchar *) "54.delete", (gchar *) N_("Delete _All Occurrences"), on_delete_appointment, NULL, (gchar *) GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_RECURRING, E_CAL_POPUP_SELECT_NOTEDITING | E_CAL_POPUP_SELECT_EDITABLE },
};
-static void
-ecv_popup_free (EPopup *ep, GSList *list, void *data)
-{
- g_slist_free(list);
-}
-
-GtkMenu *
-e_calendar_view_create_popup_menu (ECalendarView *cal_view)
-{
- ECalPopup *ep;
- GSList *menus = NULL;
- GList *selected, *l;
- int i;
- ECalPopupTargetSelect *t;
- ECalModel *model;
- GPtrArray *events;
-
- g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
-
- /* We could do this using a factory on the ECalPopup class,
- * that way we would get called implicitly whenever a popup
- * menu was created rather than everyone having to call us.
- * We could also have a different menu id for each view */
-
- /** @HookPoint-ECalPopup: Calendar Main View Context Menu
- * @Id: org.gnome.evolution.calendar.view.popup
- * @Class: org.gnome.evolution.calendar.popup:1.0
- * @Target: ECalPopupTargetSelect
- *
- * The context menu on the main calendar view. This menu
- * applies to all view types.
- */
- ep = e_cal_popup_new("org.gnome.evolution.calendar.view.popup");
-
- model = e_calendar_view_get_model(cal_view);
- events = g_ptr_array_new();
- selected = e_calendar_view_get_selected_events(cal_view);
- for (l=selected;l;l=g_list_next(l)) {
- ECalendarViewEvent *event = l->data;
-
- if (event)
- g_ptr_array_add(events, e_cal_model_copy_component_data(event->comp_data));
- }
- g_list_free(selected);
-
- t = e_cal_popup_target_new_select(ep, model, events);
- t->target.widget = (GtkWidget *)cal_view;
-
- if (t->events->len == 0) {
- for (i=0;i<sizeof(ecv_main_items)/sizeof(ecv_main_items[0]);i++)
- menus = g_slist_prepend(menus, &ecv_main_items[i]);
-
- gnome_calendar_view_popup_factory(cal_view->priv->calendar, (EPopup *)ep, "60.view");
- } else {
- for (i=0;i<sizeof(ecv_child_items)/sizeof(ecv_child_items[0]);i++)
- menus = g_slist_prepend(menus, &ecv_child_items[i]);
- }
-
- e_popup_add_items((EPopup *)ep, menus, NULL, ecv_popup_free, cal_view);
-
- return e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
-}
-
void
e_calendar_view_open_event (ECalendarView *cal_view)
{
@@ -2097,7 +2001,9 @@ e_calendar_view_new_appointment (ECalendarView *cal_view)
static void
object_created_cb (CompEditor *ce, ECalendarView *cal_view)
{
+#if 0 /* KILL-BONOBO */
gnome_calendar_emit_user_created_signal (cal_view, e_calendar_view_get_calendar (cal_view), comp_editor_get_client (ce));
+#endif
}
CompEditor *
@@ -2106,13 +2012,16 @@ e_calendar_view_open_event_with_flags (ECalendarView *cal_view, ECal *client, ic
CompEditor *ce;
const char *uid;
ECalComponent *comp;
+ EShell *shell;
+ /* FIXME ECalendarView should own an EShell pointer. */
+ shell = e_shell_get_default ();
uid = icalcomponent_get_uid (icalcomp);
- ce = e_comp_editor_registry_find (comp_editor_registry, uid);
+ ce = comp_editor_find_instance (uid);
if (!ce) {
- ce = event_editor_new (client, flags);
+ ce = event_editor_new (client, shell, flags);
g_signal_connect (ce, "object_created", G_CALLBACK (object_created_cb), cal_view);
@@ -2122,8 +2031,6 @@ e_calendar_view_open_event_with_flags (ECalendarView *cal_view, ECal *client, ic
if (flags & COMP_EDITOR_MEETING)
event_editor_show_meeting (EVENT_EDITOR (ce));
- e_comp_editor_registry_add (comp_editor_registry, ce, FALSE);
-
g_object_unref (comp);
}
@@ -2660,29 +2567,8 @@ draw_curved_rectangle (cairo_t *cr, double x0, double y0,
static void
error_response(GtkWidget *widget, gint response, void *data)
{
- gtk_widget_destroy (widget);
-}
-
-void
-e_calendar_utils_show_error_silent (GtkWidget *widget)
-{
- EActivityHandler *handler = calendar_component_peek_activity_handler (calendar_component_peek ());
-
- if(!g_object_get_data ((GObject *) widget, "response-handled")) {
- g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL);
- }
-
- e_activity_handler_make_error (handler, "calendar", E_LOG_ERROR, widget);
-}
-
-void
-e_calendar_utils_show_info_silent (GtkWidget *widget)
-{
- EActivityHandler *handler = calendar_component_peek_activity_handler (calendar_component_peek ());
-
- if(!g_object_get_data ((GObject *) widget, "response-handled")) {
- g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL);
- }
-
- e_activity_handler_make_error (handler, "calendar", E_LOG_WARNINGS, widget);
+ if (response == GTK_RESPONSE_DELETE_EVENT)
+ gtk_widget_destroy(widget);
+ else if (response == GTK_RESPONSE_OK)
+ gtk_widget_destroy(widget);
}
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index 99d405d098..45a9573f04 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -27,7 +27,6 @@
#include <gtk/gtk.h>
#include "e-cal-model.h"
#include "gnome-cal.h"
-#include "e-activity-handler.h"
#include "dialogs/comp-editor.h"
G_BEGIN_DECLS
@@ -130,7 +129,6 @@ void e_calendar_view_set_default_category (ECalendarView *cal_view, co
gboolean e_calendar_view_get_use_24_hour_format (ECalendarView *view);
void e_calendar_view_set_use_24_hour_format (ECalendarView *view, gboolean use_24_hour);
-void e_calendar_view_set_activity_handler (ECalendarView *cal_view, EActivityHandler *activity_handler);
void e_calendar_view_set_status_message (ECalendarView *cal_view, const gchar *message, int percent);
GList *e_calendar_view_get_selected_events (ECalendarView *cal_view);
diff --git a/calendar/gui/e-cell-date-edit-config.h b/calendar/gui/e-cell-date-edit-config.h
index 455cca7287..9917378dd1 100644
--- a/calendar/gui/e-cell-date-edit-config.h
+++ b/calendar/gui/e-cell-date-edit-config.h
@@ -24,7 +24,7 @@
#ifndef _E_CELL_DATE_EDIT_CONFIG_H_
#define _E_CELL_DATE_EDIT_CONFIG_H_
-#include <misc/e-cell-date-edit.h>
+#include <table/e-cell-date-edit.h>
#include "e-cell-date-edit-text.h"
G_BEGIN_DECLS
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index e161477eec..86b723903f 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -32,7 +32,7 @@
#include "e-util/e-categories-config.h"
#include "e-day-view-layout.h"
#include "e-day-view-main-item.h"
-#include "ea-calendar.h"
+#include "a11y/ea-calendar.h"
#include "e-calendar-view.h"
#include "comp-util.h"
#include <libecal/e-cal-time-util.h>
@@ -111,7 +111,9 @@ e_day_view_main_item_class_init (EDayViewMainItemClass *class)
G_PARAM_WRITABLE));
/* init the accessibility support for e_day_view */
+#if 0 /* KILL-BONOBO */
e_day_view_main_item_a11y_init ();
+#endif
}
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index ef8a33625d..0d7aa97ca5 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -26,7 +26,7 @@
#endif
#include "e-day-view.h"
-#include "ea-calendar.h"
+#include "a11y/ea-calendar.h"
#include <math.h>
#include <time.h>
@@ -35,7 +35,7 @@
#include <misc/e-canvas-utils.h>
#include <misc/e-popup-menu.h>
#include <misc/e-gui-utils.h>
-#include <misc/e-unicode.h>
+#include <e-util/e-unicode.h>
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
#include <glib/gi18n.h>
#include <e-util/e-categories-config.h>
@@ -51,7 +51,6 @@
#include "print.h"
#include "comp-util.h"
#include "itip-utils.h"
-#include "calendar-commands.h"
#include "calendar-config.h"
#include "goto.h"
#include "e-cal-model-calendar.h"
@@ -466,8 +465,10 @@ e_day_view_class_init (EDayViewClass *class)
view_class->get_visible_time_range = e_day_view_get_visible_time_range;
view_class->paste_text = e_day_view_paste_text;
+#if 0 /* KILL-BONOBO */
/* init the accessibility support for e_day_view */
e_day_view_a11y_init ();
+#endif
}
static void
@@ -3397,9 +3398,11 @@ e_day_view_show_popup_menu (EDayView *day_view,
day_view->popup_event_day = day;
day_view->popup_event_num = event_num;
+#if 0 /* KILL-BONOBO */
popup = e_calendar_view_create_popup_menu (E_CALENDAR_VIEW (day_view));
g_object_weak_ref (G_OBJECT (popup), popup_destroyed_cb, day_view);
gtk_menu_popup (popup, NULL, NULL, NULL, NULL, gdk_event?gdk_event->button.button:0, gdk_event?gdk_event->button.time:gtk_get_current_event_time());
+#endif
}
static gboolean
@@ -5608,6 +5611,7 @@ e_day_view_cursor_key_down (EDayView *day_view, GdkEventKey *event)
static void
e_day_view_cursor_key_left (EDayView *day_view, GdkEventKey *event)
{
+#if 0 /* KILL-BONOBO */
if (day_view->selection_start_day == 0) {
gnome_calendar_previous (e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view)));
} else {
@@ -5621,12 +5625,14 @@ e_day_view_cursor_key_left (EDayView *day_view, GdkEventKey *event)
gtk_widget_queue_draw (day_view->main_canvas);
}
g_signal_emit_by_name (day_view, "selected_time_changed");
+#endif
}
static void
e_day_view_cursor_key_right (EDayView *day_view, GdkEventKey *event)
{
+#if 0 /* KILL-BONOBO */
if (day_view->selection_end_day == day_view->days_shown - 1) {
gnome_calendar_next (e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view)));
} else {
@@ -5640,6 +5646,7 @@ e_day_view_cursor_key_right (EDayView *day_view, GdkEventKey *event)
gtk_widget_queue_draw (day_view->main_canvas);
}
g_signal_emit_by_name (day_view, "selected_time_changed");
+#endif
}
@@ -6374,8 +6381,10 @@ e_day_view_on_editing_stopped (EDayView *day_view,
if (!on_server) {
if (!e_cal_create_object (client, icalcomp, NULL, NULL))
g_message (G_STRLOC ": Could not create the object!");
+#if 0 /* KILL-BONOBO */
else
gnome_calendar_emit_user_created_signal (day_view, e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view)), client);
+#endif
/* we remove the object since we either got the update from the server or failed */
e_day_view_remove_event_cb (day_view, day, event_num, NULL);
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 12442ba2c2..501a3f37a9 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -31,8 +31,6 @@
#include <unistd.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-exception.h>
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-embedded.h>
#include <gtkhtml/gtkhtml-stream.h>
@@ -52,6 +50,7 @@
#include "itip-utils.h"
#include "e-itip-control.h"
#include "common/authentication.h"
+#include <shell/e-shell.h>
struct _EItipControlPrivate {
GtkWidget *html;
@@ -243,12 +242,18 @@ source_changed_cb (ESourceComboBox *escb, EItipControl *itip)
static void
find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
{
+ EShell *shell;
+ EShellSettings *shell_settings;
EItipControlFindData *fd = data;
EItipControlPrivate *priv;
ESource *source;
ECalSourceType source_type;
icalcomponent *icalcomp;
+ /* FIXME Pass this in. */
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
source_type = e_cal_get_source_type (ecal);
source = e_cal_get_source (ecal);
@@ -275,20 +280,24 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
if (fd->count == 0) {
if (fd->show_selector && !priv->current_ecal && priv->vbox.widget) {
GtkWidget *escb;
+ const gchar *property_name;
char *uid;
switch (priv->type) {
case E_CAL_SOURCE_TYPE_EVENT:
- uid = calendar_config_get_primary_calendar ();
+ property_name = "cal-primary-calendar";
break;
case E_CAL_SOURCE_TYPE_TODO:
- uid = calendar_config_get_primary_tasks ();
+ property_name = "cal-primary-tasks";
break;
default:
uid = NULL;
g_return_if_reached ();
}
+ uid = e_shell_settings_get_string (
+ shell_settings, property_name);
+
if (uid) {
source = e_source_list_peek_source_by_uid (priv->source_lists[priv->type], uid);
g_free (uid);
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index c10a85e341..0fbcfb43ee 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -35,14 +35,13 @@
#include <glib/gi18n.h>
#include <libgnomecanvas/gnome-canvas-widget.h>
-#include <misc/e-canvas.h>
-#include <misc/e-canvas-utils.h>
+#include "misc/e-canvas.h"
+#include "misc/e-canvas-utils.h"
-#include <misc/e-dateedit.h>
-#include <e-util/e-cursor.h>
-#include <e-util/e-util.h>
+#include "misc/e-dateedit.h"
+#include "e-util/e-cursor.h"
+#include "e-util/e-util.h"
-#include "calendar-component.h"
#include "calendar-config.h"
#include "e-meeting-utils.h"
#include "e-meeting-list-view.h"
diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c
new file mode 100644
index 0000000000..e31a9d4b6e
--- /dev/null
+++ b/calendar/gui/e-memo-list-selector.c
@@ -0,0 +1,287 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-memo-list-selector.c
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-memo-list-selector.h"
+
+#include <string.h>
+#include <libecal/e-cal.h>
+#include "calendar/common/authentication.h"
+#include "calendar/gui/comp-util.h"
+
+#define E_MEMO_LIST_SELECTOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEMO_LIST_SELECTOR, EMemoListSelectorPrivate))
+
+struct _EMemoListSelectorPrivate {
+ gint dummy_value;
+};
+
+enum {
+ DND_TARGET_TYPE_CALENDAR_LIST
+};
+
+static GtkTargetEntry drag_types[] = {
+ { (gchar *) "text/calendar", 0, DND_TARGET_TYPE_CALENDAR_LIST },
+ { (gchar *) "text/x-calendar", 0, DND_TARGET_TYPE_CALENDAR_LIST }
+};
+
+static gpointer parent_class;
+
+static gboolean
+memo_list_selector_update_single_object (ECal *client,
+ icalcomponent *icalcomp)
+{
+ gchar *uid;
+ icalcomponent *tmp_icalcomp;
+
+ uid = (gchar *) icalcomponent_get_uid (icalcomp);
+
+ if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, NULL))
+ return e_cal_modify_object (
+ client, icalcomp, CALOBJ_MOD_ALL, NULL);
+
+ return e_cal_create_object (client, icalcomp, &uid, NULL);
+}
+
+static gboolean
+memo_list_selector_update_objects (ECal *client,
+ icalcomponent *icalcomp)
+{
+ icalcomponent *subcomp;
+ icalcomponent_kind kind;
+
+ kind = icalcomponent_isa (icalcomp);
+ if (kind == ICAL_VJOURNAL_COMPONENT)
+ return memo_list_selector_update_single_object (
+ client, icalcomp);
+ else if (kind != ICAL_VCALENDAR_COMPONENT)
+ return FALSE;
+
+ subcomp = icalcomponent_get_first_component (
+ icalcomp, ICAL_ANY_COMPONENT);
+ while (subcomp != NULL) {
+ gboolean success;
+
+ kind = icalcomponent_isa (subcomp);
+ if (kind == ICAL_VTIMEZONE_COMPONENT) {
+ icaltimezone *zone;
+
+ zone = icaltimezone_new ();
+ icaltimezone_set_component (zone, subcomp);
+
+ success = e_cal_add_timezone (client, zone, NULL);
+ icaltimezone_free (zone, 1);
+ if (!success)
+ return FALSE;
+ } else if (kind == ICAL_VJOURNAL_COMPONENT) {
+ success = memo_list_selector_update_single_object (
+ client, subcomp);
+ if (!success)
+ return FALSE;
+ }
+
+ subcomp = icalcomponent_get_next_component (
+ icalcomp, ICAL_ANY_COMPONENT);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+memo_list_selector_process_data (ESourceSelector *selector,
+ ECal *client,
+ const gchar *source_uid,
+ icalcomponent *icalcomp,
+ GdkDragAction action)
+{
+ ESourceList *source_list;
+ ESource *source;
+ icalcomponent *tmp_icalcomp = NULL;
+ const gchar *uid;
+ gchar *old_uid = NULL;
+ gboolean success = FALSE;
+ gboolean read_only = TRUE;
+ GError *error = NULL;
+
+ /* FIXME Deal with GDK_ACTION_ASK. */
+ if (action == GDK_ACTION_COPY) {
+ old_uid = g_strdup (icalcomponent_get_uid (icalcomp));
+ uid = e_cal_component_gen_uid ();
+ icalcomponent_set_uid (icalcomp, uid);
+ }
+
+ uid = icalcomponent_get_uid (icalcomp);
+ if (old_uid == NULL)
+ old_uid = g_strdup (uid);
+
+ if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, &error)) {
+ icalcomponent_free (tmp_icalcomp);
+ success = TRUE;
+ goto exit;
+ }
+
+ if (error != NULL && error->code != E_CALENDAR_STATUS_OBJECT_NOT_FOUND) {
+ g_message (
+ "Failed to search the object in destination "
+ "task list: %s", error->message);
+ g_error_free (error);
+ goto exit;
+ }
+
+ success = memo_list_selector_update_objects (client, icalcomp);
+
+ if (!success || action != GDK_ACTION_MOVE)
+ goto exit;
+
+ source_list = e_source_selector_get_source_list (selector);
+ source = e_source_list_peek_source_by_uid (source_list, source_uid);
+
+ if (!E_IS_SOURCE (source) || e_source_get_readonly (source))
+ goto exit;
+
+ client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL);
+ if (client == NULL) {
+ g_message ("Cannot create source client to remove old memo");
+ goto exit;
+ }
+
+ e_cal_is_read_only (client, &read_only, NULL);
+ if (!read_only && e_cal_open (client, TRUE, NULL))
+ e_cal_remove_object (client, old_uid, NULL);
+ else if (!read_only)
+ g_message ("Cannot open source client to remove old memo");
+
+ g_object_unref (client);
+
+exit:
+ g_free (old_uid);
+
+ return success;
+}
+
+static gboolean
+memo_list_selector_data_dropped (ESourceSelector *selector,
+ GtkSelectionData *selection_data,
+ ESource *destination,
+ GdkDragAction action,
+ guint info)
+{
+ ECal *client;
+ GSList *list, *iter;
+ gboolean success = FALSE;
+
+ client = auth_new_cal_from_source (
+ destination, E_CAL_SOURCE_TYPE_JOURNAL);
+
+ if (client == NULL || !e_cal_open (client, TRUE, NULL))
+ goto exit;
+
+ list = cal_comp_selection_get_string_list (selection_data);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ gchar *source_uid = iter->data;
+ icalcomponent *icalcomp;
+ gchar *component_string;
+
+ /* Each string is "source_uid\ncomponent_string". */
+ component_string = strchr (source_uid, '\n');
+ if (component_string == NULL)
+ continue;
+
+ *component_string++ = '\0';
+ icalcomp = icalparser_parse_string (component_string);
+ if (icalcomp == NULL)
+ continue;
+
+ success = memo_list_selector_process_data (
+ selector, client, source_uid, icalcomp, action);
+
+ icalcomponent_free (icalcomp);
+ }
+
+ g_slist_foreach (list, (GFunc) g_free, NULL);
+ g_slist_free (list);
+
+exit:
+ if (client != NULL)
+ g_object_unref (client);
+
+ return success;
+}
+
+static void
+memo_list_selector_class_init (EMemoListSelectorClass *class)
+{
+ ESourceSelectorClass *source_selector_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMemoListSelectorPrivate));
+
+ source_selector_class = E_SOURCE_SELECTOR_CLASS (class);
+ source_selector_class->data_dropped = memo_list_selector_data_dropped;
+}
+
+static void
+memo_list_selector_init (EMemoListSelector *selector)
+{
+ selector->priv = E_MEMO_LIST_SELECTOR_GET_PRIVATE (selector);
+
+ gtk_drag_dest_set (
+ GTK_WIDGET (selector), GTK_DEST_DEFAULT_ALL,
+ drag_types, G_N_ELEMENTS (drag_types),
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
+}
+
+GType
+e_memo_list_selector_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (EMemoListSelectorClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) memo_list_selector_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMemoListSelector),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) memo_list_selector_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_SOURCE_SELECTOR, "EMemoListSelector",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_memo_list_selector_new (ESourceList *source_list)
+{
+ g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+
+ return g_object_new (
+ E_TYPE_MEMO_LIST_SELECTOR,
+ "source-list", source_list, NULL);
+}
diff --git a/calendar/gui/e-memo-list-selector.h b/calendar/gui/e-memo-list-selector.h
new file mode 100644
index 0000000000..c10cff2a2e
--- /dev/null
+++ b/calendar/gui/e-memo-list-selector.h
@@ -0,0 +1,71 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-memo-list-selector.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* XXX This widget is nearly identical to ETaskListSelector. If
+ * ECalendarSelector ever learns how to move selections from
+ * one source to another, perhaps these ESourceSelector sub-
+ * classes could someday be combined. */
+
+#ifndef E_MEMO_LIST_SELECTOR_H
+#define E_MEMO_LIST_SELECTOR_H
+
+#include <libedataserver/e-source-list.h>
+#include <libedataserverui/e-source-selector.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MEMO_LIST_SELECTOR \
+ (e_memo_list_selector_get_type ())
+#define E_MEMO_LIST_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MEMO_LIST_SELECTOR, EMemoListSelector))
+#define E_MEMO_LIST_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MEMO_LIST_SELECTOR, EMemoListSelectorClass))
+#define E_IS_MEMO_LIST_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MEMO_LIST_SELECTOR))
+#define E_IS_MEMO_LIST_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MEMO_LIST_SELECTOR))
+#define E_MEMO_LIST_SELECTOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MEMO_LIST_SELECTOR, EMemoListSelectorClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMemoListSelector EMemoListSelector;
+typedef struct _EMemoListSelectorClass EMemoListSelectorClass;
+typedef struct _EMemoListSelectorPrivate EMemoListSelectorPrivate;
+
+struct _EMemoListSelector {
+ ESourceSelector parent;
+ EMemoListSelectorPrivate *priv;
+};
+
+struct _EMemoListSelectorClass {
+ ESourceSelectorClass parent_class;
+};
+
+GType e_memo_list_selector_get_type (void);
+GtkWidget * e_memo_list_selector_new (ESourceList *source_list);
+
+G_END_DECLS
+
+#endif /* E_MEMO_LIST_SELECTOR_H */
diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c
index ac43b39a5a..7f14d4f794 100644
--- a/calendar/gui/e-memo-table.c
+++ b/calendar/gui/e-memo-table.c
@@ -24,7 +24,7 @@
/*
* EMemoTable - displays the ECalComponent objects in a table (an ETable).
- * Used for memos.
+ * Used for calendar events and tasks.
*/
#ifdef HAVE_CONFIG_H
@@ -35,15 +35,17 @@
#include <unistd.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
-#include <gdk/gdkkeysyms.h>
#include <widgets/misc/e-gui-utils.h>
#include <table/e-cell-checkbox.h>
#include <table/e-cell-toggle.h>
#include <table/e-cell-text.h>
#include <table/e-cell-combo.h>
#include <e-util/e-dialog-utils.h>
-#include <widgets/misc/e-cell-date-edit.h>
-#include <widgets/misc/e-cell-percent.h>
+#include <e-util/e-util-private.h>
+#include <table/e-cell-date-edit.h>
+#include <table/e-cell-percent.h>
+#include <libecal/e-cal-time-util.h>
+#include <libedataserver/e-time-utils.h>
#include "calendar-config.h"
#include "dialogs/delete-comp.h"
@@ -51,64 +53,52 @@
#include "dialogs/memo-editor.h"
#include "e-cal-model-memos.h"
#include "e-memo-table.h"
+#include "e-calendar-view.h"
#include "e-cell-date-edit-text.h"
-#include "e-comp-editor-registry.h"
#include "print.h"
#include <e-util/e-icon-factory.h>
-#include <e-util/e-util-private.h>
#include "e-cal-popup.h"
-#include "e-calendar-table.h"
+#include "misc.h"
+
+#define E_MEMO_TABLE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEMO_TABLE, EMemoTablePrivate))
+
+struct _EMemoTablePrivate {
+ gpointer shell_view; /* weak pointer */
+ ECalModel *model;
+};
+
+enum {
+ PROP_0,
+ PROP_MODEL,
+ PROP_SHELL_VIEW
+};
-enum TargetType{
+enum {
+ OPEN_COMPONENT,
+ POPUP_EVENT,
+ STATUS_MESSAGE,
+ USER_CREATED,
+ LAST_SIGNAL
+};
+
+enum {
TARGET_TYPE_VCALENDAR
};
static GtkTargetEntry target_types[] = {
- { (gchar *) "text/x-calendar", 0, TARGET_TYPE_VCALENDAR },
- { (gchar *) "text/calendar", 0, TARGET_TYPE_VCALENDAR }
+ { (gchar *) "text/calendar", 0, TARGET_TYPE_VCALENDAR },
+ { (gchar *) "text/x-calendar", 0, TARGET_TYPE_VCALENDAR }
};
static guint n_target_types = G_N_ELEMENTS (target_types);
-
-extern ECompEditorRegistry *comp_editor_registry;
-
-static void e_memo_table_destroy (GtkObject *object);
-
-static void e_memo_table_on_double_click (ETable *table,
- gint row,
- gint col,
- GdkEvent *event,
- EMemoTable *memo_table);
-static gint e_memo_table_show_popup_menu (ETable *table,
- GdkEvent *gdk_event,
- EMemoTable *memo_table);
-
-static gint e_memo_table_on_right_click (ETable *table,
- gint row,
- gint col,
- GdkEvent *event,
- EMemoTable *memo_table);
-static gboolean e_memo_table_on_popup_menu (GtkWidget *widget,
- gpointer data);
-
-static gint e_memo_table_on_key_press (ETable *table,
- gint row,
- gint col,
- GdkEventKey *event,
- EMemoTable *memo_table);
static struct tm e_memo_table_get_current_time (ECellDateEdit *ecde, gpointer data);
-static ECalModelComponent *get_selected_comp (EMemoTable *memo_table);
-static void open_memo (EMemoTable *memo_table, ECalModelComponent *comp_data);
-
-/* Signal IDs */
-enum {
- USER_CREATED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+static GdkAtom clipboard_atom;
/* The icons to represent the task. */
#define E_MEMO_MODEL_NUM_ICONS 2
@@ -117,37 +107,45 @@ static const char* icon_names[E_MEMO_MODEL_NUM_ICONS] = {
};
static GdkPixbuf* icon_pixbufs[E_MEMO_MODEL_NUM_ICONS] = { NULL };
-static GdkAtom clipboard_atom = GDK_NONE;
-
-G_DEFINE_TYPE (EMemoTable, e_memo_table, GTK_TYPE_TABLE)
+static void
+memo_table_emit_open_component (EMemoTable *memo_table,
+ ECalModelComponent *comp_data)
+{
+ guint signal_id = signals[OPEN_COMPONENT];
+ g_signal_emit (memo_table, signal_id, 0, comp_data);
+}
static void
-e_memo_table_class_init (EMemoTableClass *klass)
+memo_table_emit_popup_event (EMemoTable *memo_table,
+ GdkEvent *event)
{
- GtkObjectClass *object_class;
+ guint signal_id = signals[POPUP_EVENT];
- object_class = (GtkObjectClass *) klass;
+ g_signal_emit (memo_table, signal_id, 0, event);
+}
- /* Method override */
- object_class->destroy = e_memo_table_destroy;
+static void
+memo_table_emit_status_message (EMemoTable *memo_table,
+ const gchar *message,
+ gdouble percent)
+{
+ guint signal_id = signals[STATUS_MESSAGE];
- signals[USER_CREATED] =
- g_signal_new ("user_created",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMemoTableClass, user_created),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_emit (memo_table, signal_id, 0, message, percent);
+}
+
+static void
+memo_table_emit_user_created (EMemoTable *memo_table)
+{
+ guint signal_id = signals[USER_CREATED];
- /* clipboard atom */
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+ g_signal_emit (memo_table, signal_id, 0);
}
static gint
-date_compare_cb (gconstpointer a, gconstpointer b)
+memo_table_date_compare_cb (gconstpointer a,
+ gconstpointer b)
{
ECellDateEditValue *dv1 = (ECellDateEditValue *) a;
ECellDateEditValue *dv2 = (ECellDateEditValue *) b;
@@ -175,76 +173,408 @@ date_compare_cb (gconstpointer a, gconstpointer b)
}
static void
-row_appended_cb (ECalModel *model, EMemoTable *memo_table)
+memo_table_double_click_cb (EMemoTable *memo_table,
+ gint row,
+ gint col,
+ GdkEvent *event)
+{
+ ECalModel *model;
+ ECalModelComponent *comp_data;
+
+ model = e_memo_table_get_model (memo_table);
+ comp_data = e_cal_model_get_component_at (model, row);
+ memo_table_emit_open_component (memo_table, comp_data);
+}
+
+static void
+memo_table_model_cal_view_progress_cb (EMemoTable *memo_table,
+ const gchar *message,
+ gint progress,
+ ECalSourceType type)
{
- g_signal_emit (memo_table, signals[USER_CREATED], 0);
+ gdouble percent = (gdouble) progress;
+
+ memo_table_emit_status_message (memo_table, message, percent);
+}
+
+static void
+memo_table_model_cal_view_done_cb (EMemoTable *memo_table,
+ ECalendarStatus status,
+ ECalSourceType type)
+{
+ memo_table_emit_status_message (memo_table, NULL, -1.0);
}
static gboolean
-query_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer user_data)
+memo_table_query_tooltip_cb (EMemoTable *memo_table,
+ gint x,
+ gint y,
+ gboolean keyboard_mode,
+ GtkTooltip *tooltip)
{
- EMemoTable *memo_table;
+ ECalModel *model;
+ ECalModelComponent *comp_data;
+ int row = -1, col = -1;
+ GtkWidget *box, *l, *w;
+ GtkStyle *style = gtk_widget_get_default_style ();
+ char *tmp;
+ const char *str;
+ GString *tmp2;
+ char buff[1001];
+ gboolean free_text = FALSE;
+ ECalComponent *new_comp;
+ ECalComponentOrganizer organizer;
+ ECalComponentDateTime dtstart, dtdue;
+ icalcomponent *clone;
+ icaltimezone *zone, *default_zone;
+ GSList *desc, *p;
+ int len;
+ ETable *etable;
+ ESelectionModel *esm;
+ struct tm tmp_tm;
+
+ if (keyboard_mode)
+ return FALSE;
+
+ etable = e_memo_table_get_table (memo_table);
+ e_table_get_mouse_over_cell (etable, &row, &col);
+ if (row == -1 || !etable)
+ return FALSE;
+
+ /* Respect sorting option; the 'e_table_get_mouse_over_cell'
+ * returns sorted row, not the model one. */
+ esm = e_table_get_selection_model (etable);
+ if (esm && esm->sorter && e_sorter_needs_sorting (esm->sorter))
+ row = e_sorter_sorted_to_model (esm->sorter, row);
+
+ model = e_memo_table_get_model (memo_table);
+ comp_data = e_cal_model_get_component_at (model, row);
+ if (!comp_data || !comp_data->icalcomp)
+ return FALSE;
+
+ new_comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ if (!e_cal_component_set_icalcomponent (new_comp, clone)) {
+ g_object_unref (new_comp);
+ return FALSE;
+ }
+
+ box = gtk_vbox_new (FALSE, 0);
+
+ str = e_calendar_view_get_icalcomponent_summary (
+ comp_data->client, comp_data->icalcomp, &free_text);
+ if (!(str && *str)) {
+ if (free_text)
+ g_free ((char *)str);
+ free_text = FALSE;
+ str = _("* No Summary *");
+ }
+
+ l = gtk_label_new (NULL);
+ tmp = g_markup_printf_escaped ("<b>%s</b>", str);
+ gtk_label_set_line_wrap (GTK_LABEL (l), TRUE);
+ gtk_label_set_markup (GTK_LABEL (l), tmp);
+ gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
+ w = gtk_event_box_new ();
+
+ gtk_widget_modify_bg (w, GTK_STATE_NORMAL, &(style->bg[GTK_STATE_SELECTED]));
+ gtk_widget_modify_fg (l, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED]));
+ gtk_container_add (GTK_CONTAINER (w), l);
+ gtk_box_pack_start (GTK_BOX (box), w, TRUE, TRUE, 0);
+ g_free (tmp);
+
+ if (free_text)
+ g_free ((char *)str);
+ free_text = FALSE;
+
+ w = gtk_event_box_new ();
+ gtk_widget_modify_bg (w, GTK_STATE_NORMAL, &(style->bg[GTK_STATE_NORMAL]));
+
+ l = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (w), l);
+ gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
+ w = l;
+
+ e_cal_component_get_organizer (new_comp, &organizer);
+ if (organizer.cn) {
+ char *ptr ;
+ ptr = strchr( organizer.value, ':');
+
+ if (ptr) {
+ ptr++;
+ /* To Translators: It will display "Organizer: NameOfTheUser <email@ofuser.com>" */
+ tmp = g_strdup_printf (_("Organizer: %s <%s>"), organizer.cn, ptr);
+ } else {
+ /* With SunOne accounts, there may be no ':' in organiser.value */
+ tmp = g_strdup_printf (_("Organizer: %s"), organizer.cn);
+ }
+
+ l = gtk_label_new (tmp);
+ gtk_label_set_line_wrap (GTK_LABEL (l), FALSE);
+ gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (w), l, FALSE, FALSE, 0);
+ g_free (tmp);
+ }
+
+ e_cal_component_get_dtstart (new_comp, &dtstart);
+ e_cal_component_get_due (new_comp, &dtdue);
+
+ default_zone = e_cal_model_get_timezone (model);
+
+ if (dtstart.tzid) {
+ zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (new_comp), dtstart.tzid);
+ if (!zone)
+ e_cal_get_timezone (
+ comp_data->client, dtstart.tzid, &zone, NULL);
+ if (!zone)
+ zone = default_zone;
+ } else {
+ zone = NULL;
+ }
+
+ tmp2 = g_string_new ("");
+
+ if (dtstart.value) {
+ buff[0] = 0;
+
+ tmp_tm = icaltimetype_to_tm_with_zone (
+ dtstart.value, zone, default_zone);
+ e_time_format_date_and_time (
+ &tmp_tm, calendar_config_get_24_hour_format (),
+ FALSE, FALSE, buff, 1000);
+
+ if (buff [0]) {
+ g_string_append (tmp2, _("Start: "));
+ g_string_append (tmp2, buff);
+ }
+ }
+
+ if (dtdue.value) {
+ buff[0] = 0;
+
+ tmp_tm = icaltimetype_to_tm_with_zone (
+ dtdue.value, zone, default_zone);
+ e_time_format_date_and_time (
+ &tmp_tm, calendar_config_get_24_hour_format (),
+ FALSE, FALSE, buff, 1000);
+
+ if (buff [0]) {
+ if (tmp2->len)
+ g_string_append (tmp2, "; ");
+
+ g_string_append (tmp2, _("Due: "));
+ g_string_append (tmp2, buff);
+ }
+ }
+
+ if (tmp2->len) {
+ l = gtk_label_new (tmp2->str);
+ gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (w), l, FALSE, FALSE, 0);
+ }
+
+ g_string_free (tmp2, TRUE);
+
+ e_cal_component_free_datetime (&dtstart);
+ e_cal_component_free_datetime (&dtdue);
+
+ tmp2 = g_string_new ("");
+ e_cal_component_get_description_list (new_comp, &desc);
+ for (len = 0, p = desc; p != NULL; p = p->next) {
+ ECalComponentText *text = p->data;
+
+ if (text->value != NULL) {
+ len += strlen (text->value);
+ g_string_append (tmp2, text->value);
+ if (len > 1024) {
+ g_string_set_size (tmp2, 1020);
+ g_string_append (tmp2, "...");
+ break;
+ }
+ }
+ }
+ e_cal_component_free_text_list (desc);
+
+ if (tmp2->len) {
+ l = gtk_label_new (tmp2->str);
+ gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (box), l, FALSE, FALSE, 0);
+ }
+
+ g_string_free (tmp2, TRUE);
+
+ gtk_widget_show_all (box);
+ gtk_tooltip_set_custom (tooltip, box);
+
+ g_object_unref (new_comp);
+
+ return TRUE;
+}
+
+static gboolean
+memo_table_popup_menu_cb (EMemoTable *memo_table)
+{
+ memo_table_emit_popup_event (memo_table, NULL);
+
+ return TRUE;
+}
+
+static gint
+memo_table_right_click_cb (EMemoTable *memo_table,
+ gint row,
+ gint col,
+ GdkEvent *event)
+{
+ memo_table_emit_popup_event (memo_table, event);
+
+ return TRUE;
+}
+
+static void
+memo_table_set_model (EMemoTable *memo_table,
+ ECalModel *model)
+{
+ g_return_if_fail (memo_table->priv->model == NULL);
+
+ memo_table->priv->model = g_object_ref (model);
+
+ g_signal_connect_swapped (
+ model, "row-appended",
+ G_CALLBACK (memo_table_emit_user_created), memo_table);
+
+ g_signal_connect_swapped (
+ model, "cal-view-progress",
+ G_CALLBACK (memo_table_model_cal_view_progress_cb),
+ memo_table);
+
+ g_signal_connect_swapped (
+ model, "cal-view-done",
+ G_CALLBACK (memo_table_model_cal_view_done_cb),
+ memo_table);
+}
+
+static void
+memo_table_set_shell_view (EMemoTable *memo_table,
+ EShellView *shell_view)
+{
+ g_return_if_fail (memo_table->priv->shell_view == NULL);
+
+ memo_table->priv->shell_view = shell_view;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_view),
+ &memo_table->priv->shell_view);
+}
+
+static void
+memo_table_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MODEL:
+ memo_table_set_model (
+ E_MEMO_TABLE (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SHELL_VIEW:
+ memo_table_set_shell_view (
+ E_MEMO_TABLE (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+memo_table_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MODEL:
+ g_value_set_object (
+ value, e_memo_table_get_model (
+ E_MEMO_TABLE (object)));
+ return;
+
+ case PROP_SHELL_VIEW:
+ g_value_set_object (
+ value, e_memo_table_get_shell_view (
+ E_MEMO_TABLE (object)));
+ return;
+ }
- g_return_val_if_fail (E_IS_MEMO_TABLE (user_data), FALSE);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+memo_table_dispose (GObject *object)
+{
+ EMemoTablePrivate *priv;
- memo_table = E_MEMO_TABLE (user_data);
+ priv = E_MEMO_TABLE_GET_PRIVATE (object);
- return ec_query_tooltip (widget, x, y, keyboard_mode, tooltip, GTK_WIDGET (e_memo_table_get_table (memo_table)), memo_table->model);
+ if (priv->model != NULL) {
+ g_object_unref (priv->model);
+ priv->model = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-e_memo_table_init (EMemoTable *memo_table)
+memo_table_constructed (GObject *object)
{
- GtkWidget *table;
- ETable *e_table;
+ EMemoTable *memo_table;
+ GtkWidget *widget;
+ ECalModel *model;
+ ETable *table;
ECell *cell, *popup_cell;
ETableExtras *extras;
gint i;
AtkObject *a11y;
gchar *etspecfile;
- /* Create the model */
-
- memo_table->model = (ECalModel *) e_cal_model_memos_new ();
- g_signal_connect (memo_table->model, "row_appended", G_CALLBACK (row_appended_cb), memo_table);
-
- memo_table->user_created_cal = NULL;
+ memo_table = E_MEMO_TABLE (object);
+ model = e_memo_table_get_model (memo_table);
/* Create the header columns */
- extras = e_table_extras_new();
+ extras = e_table_extras_new ();
/*
* Normal string fields.
*/
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
- NULL);
-
+ g_object_set (cell, "bg_color_column", E_CAL_MODEL_FIELD_COLOR, NULL);
e_table_extras_add_cell (extras, "calstring", cell);
/*
* Date fields.
*/
cell = e_cell_date_edit_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "bg_color_column", E_CAL_MODEL_FIELD_COLOR,
- NULL);
+ g_object_set (cell, "bg_color_column", E_CAL_MODEL_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);
+
e_table_extras_add_cell (extras, "dateedit", popup_cell);
memo_table->dates_cell = E_CELL_DATE_EDIT (popup_cell);
- e_cell_date_edit_set_get_time_callback (E_CELL_DATE_EDIT (popup_cell),
- e_memo_table_get_current_time,
- memo_table, NULL);
+ e_cell_date_edit_set_get_time_callback (
+ E_CELL_DATE_EDIT (popup_cell),
+ e_memo_table_get_current_time, memo_table, NULL);
/* Sorting */
- e_table_extras_add_compare (extras, "date-compare",
- date_compare_cb);
+ e_table_extras_add_compare (
+ extras, "date-compare", memo_table_date_compare_cb);
/* Create pixmaps */
@@ -254,60 +584,180 @@ e_memo_table_init (EMemoTable *memo_table)
}
cell = e_cell_toggle_new (0, E_MEMO_MODEL_NUM_ICONS, icon_pixbufs);
- e_table_extras_add_cell(extras, "icon", cell);
- e_table_extras_add_pixbuf(extras, "icon", icon_pixbufs[0]);
+ e_table_extras_add_cell (extras, "icon", cell);
+ e_table_extras_add_pixbuf (extras, "icon", icon_pixbufs[0]);
/* Create the table */
- etspecfile = g_build_filename (EVOLUTION_ETSPECDIR,
- "e-memo-table.etspec",
- NULL);
- table = e_table_scrolled_new_from_spec_file (E_TABLE_MODEL (memo_table->model),
- extras,
- etspecfile,
- NULL);
+ etspecfile = g_build_filename (
+ EVOLUTION_ETSPECDIR, "e-memo-table.etspec", NULL);
+ widget = e_table_scrolled_new_from_spec_file (
+ E_TABLE_MODEL (model), extras, etspecfile, NULL);
+ gtk_table_attach (
+ GTK_TABLE (memo_table), widget, 0, 1, 0, 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ memo_table->etable = widget;
+ gtk_widget_show (widget);
g_free (etspecfile);
- /* FIXME: this causes a message from GLib about 'extras' having only a floating
- reference */
- /* g_object_unref (extras); */
+ table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
+ g_signal_connect_swapped (
+ table, "double-click",
+ G_CALLBACK (memo_table_double_click_cb), memo_table);
+ g_signal_connect_swapped (
+ table, "query-tooltip",
+ G_CALLBACK (memo_table_query_tooltip_cb), memo_table);
+ g_signal_connect_swapped (
+ table, "popup-menu",
+ G_CALLBACK (memo_table_popup_menu_cb), memo_table);
+ g_signal_connect_swapped (
+ table, "right-click",
+ G_CALLBACK (memo_table_right_click_cb), memo_table);
+ gtk_widget_set_has_tooltip (GTK_WIDGET (table), TRUE);
+
+ a11y = gtk_widget_get_accessible (GTK_WIDGET (table));
+ if (a11y)
+ atk_object_set_name (a11y, _("Memos"));
+}
- memo_table->etable = table;
- gtk_table_attach (GTK_TABLE (memo_table), table, 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (table);
+static void
+memo_table_class_init (EMemoTableClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMemoTablePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = memo_table_set_property;
+ object_class->get_property = memo_table_get_property;
+ object_class->dispose = memo_table_dispose;
+ object_class->constructed = memo_table_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MODEL,
+ g_param_spec_object (
+ "model",
+ _("Model"),
+ NULL,
+ E_TYPE_CAL_MODEL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_VIEW,
+ g_param_spec_object (
+ "shell-view",
+ _("Shell View"),
+ NULL,
+ E_TYPE_SHELL_VIEW,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ signals[OPEN_COMPONENT] = g_signal_new (
+ "open-component",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EMemoTableClass, open_component),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_CAL_MODEL_COMPONENT);
+
+ signals[POPUP_EVENT] = g_signal_new (
+ "popup-event",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EMemoTableClass, popup_event),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__BOXED,
+ G_TYPE_NONE, 1,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+ signals[STATUS_MESSAGE] = g_signal_new (
+ "status-message",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EMemoTableClass, status_message),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
+
+ signals[USER_CREATED] = g_signal_new (
+ "user-created",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EMemoTableClass, user_created),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+}
+static void
+memo_table_init (EMemoTable *memo_table)
+{
+ memo_table->priv = E_MEMO_TABLE_GET_PRIVATE (memo_table);
+}
- e_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (table));
- g_signal_connect (e_table, "double_click", G_CALLBACK (e_memo_table_on_double_click), memo_table);
- g_signal_connect (e_table, "right_click", G_CALLBACK (e_memo_table_on_right_click), memo_table);
- g_signal_connect (e_table, "key_press", G_CALLBACK (e_memo_table_on_key_press), memo_table);
- g_signal_connect (e_table, "popup_menu", G_CALLBACK (e_memo_table_on_popup_menu), memo_table);
- g_signal_connect (e_table, "query-tooltip", G_CALLBACK (query_tooltip_cb), memo_table);
- gtk_widget_set_has_tooltip (GTK_WIDGET (e_table), TRUE);
+GType
+e_memo_table_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMemoTableClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) memo_table_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMemoTable),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) memo_table_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_TABLE, "EMemoTable", &type_info, 0);
+ }
- a11y = gtk_widget_get_accessible (GTK_WIDGET(e_table));
- if (a11y)
- atk_object_set_name (a11y, _("Memos"));
+ return type;
}
-
/**
* e_memo_table_new:
- * @Returns: a new #EMemoTable.
+ * @shell_view: an #EShellView
+ * @model: an #ECalModel for the table
+ *
+ * Returns a new #EMemoTable.
*
- * Creates a new #EMemoTable.
+ * Returns: a new #EMemoTable
**/
GtkWidget *
-e_memo_table_new (void)
+e_memo_table_new (EShellView *shell_view,
+ ECalModel *model)
{
- GtkWidget *memo_table;
-
- memo_table = GTK_WIDGET (g_object_new (e_memo_table_get_type (), NULL));
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
- return memo_table;
+ return g_object_new (
+ E_TYPE_MEMO_TABLE,
+ "model", model, "shell-view", shell_view, NULL);
}
+EShellView *
+e_memo_table_get_shell_view (EMemoTable *memo_table)
+{
+ g_return_val_if_fail (E_IS_MEMO_TABLE (memo_table), NULL);
+
+ return memo_table->priv->shell_view;
+}
/**
* e_memo_table_get_model:
@@ -323,25 +773,10 @@ e_memo_table_get_model (EMemoTable *memo_table)
g_return_val_if_fail (memo_table != NULL, NULL);
g_return_val_if_fail (E_IS_MEMO_TABLE (memo_table), NULL);
- return memo_table->model;
+ return memo_table->priv->model;
}
-static void
-e_memo_table_destroy (GtkObject *object)
-{
- EMemoTable *memo_table;
-
- memo_table = E_MEMO_TABLE (object);
-
- if (memo_table->model) {
- g_object_unref (memo_table->model);
- memo_table->model = NULL;
- }
-
- GTK_OBJECT_CLASS (e_memo_table_parent_class)->destroy (object);
-}
-
/**
* e_memo_table_get_table:
* @memo_table: A calendar table.
@@ -354,20 +789,13 @@ e_memo_table_destroy (GtkObject *object)
ETable *
e_memo_table_get_table (EMemoTable *memo_table)
{
- g_return_val_if_fail (memo_table != NULL, NULL);
- g_return_val_if_fail (E_IS_MEMO_TABLE (memo_table), NULL);
+ ETableScrolled *table_scrolled;
- return e_table_scrolled_get_table (E_TABLE_SCROLLED (memo_table->etable));
-}
+ g_return_val_if_fail (E_IS_MEMO_TABLE (memo_table), NULL);
-void
-e_memo_table_open_selected (EMemoTable *memo_table)
-{
- ECalModelComponent *comp_data;
+ table_scrolled = E_TABLE_SCROLLED (memo_table->etable);
- comp_data = get_selected_comp (memo_table);
- if (comp_data != NULL)
- open_memo (memo_table, comp_data);
+ return e_table_scrolled_get_table (table_scrolled);
}
/* Used from e_table_selected_row_foreach(); puts the selected row number in an
@@ -389,10 +817,12 @@ get_selected_row_cb (int model_row, gpointer data)
static ECalModelComponent *
get_selected_comp (EMemoTable *memo_table)
{
+ ECalModel *model;
ETable *etable;
int row;
- etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (memo_table->etable));
+ model = e_memo_table_get_model (memo_table);
+ etable = e_memo_table_get_table (memo_table);
if (e_table_selected_count (etable) != 1)
return NULL;
@@ -402,7 +832,7 @@ get_selected_comp (EMemoTable *memo_table)
&row);
g_return_val_if_fail (row != -1, NULL);
- return e_cal_model_get_component_at (memo_table->model, row);
+ return e_cal_model_get_component_at (model, row);
}
struct get_selected_uids_closure {
@@ -416,38 +846,27 @@ add_uid_cb (int model_row, gpointer data)
{
struct get_selected_uids_closure *closure;
ECalModelComponent *comp_data;
+ ECalModel *model;
closure = data;
- comp_data = e_cal_model_get_component_at (closure->memo_table->model, model_row);
+ model = e_memo_table_get_model (closure->memo_table);
+ comp_data = e_cal_model_get_component_at (model, model_row);
closure->objects = g_slist_prepend (closure->objects, comp_data);
}
-static GSList *
-get_selected_objects (EMemoTable *memo_table)
-{
- struct get_selected_uids_closure closure;
- ETable *etable;
-
- closure.memo_table = memo_table;
- closure.objects = NULL;
-
- etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (memo_table->etable));
- e_table_selected_row_foreach (etable, add_uid_cb, &closure);
-
- return closure.objects;
-}
-
/* Deletes all of the selected components in the table */
static void
delete_selected_components (EMemoTable *memo_table)
{
GSList *objs, *l;
+ const gchar *status_message;
- objs = get_selected_objects (memo_table);
+ objs = e_memo_table_get_selected (memo_table);
- e_memo_table_set_status_message (memo_table, _("Deleting selected objects"));
+ status_message = _("Deleting selected objects");
+ memo_table_emit_status_message (memo_table, status_message, -1.0);
for (l = objs; l; l = l->next) {
ECalModelComponent *comp_data = (ECalModelComponent *) l->data;
@@ -459,27 +878,12 @@ delete_selected_components (EMemoTable *memo_table)
g_clear_error (&error);
}
- e_memo_table_set_status_message (memo_table, NULL);
+ memo_table_emit_status_message (memo_table, NULL, -1.0);
g_slist_free (objs);
}
/**
- * e_memo_table_get_selected:
- * @memo_table:
- *
- * Get the currently selected ECalModelComponent's on the table.
- *
- * Return value: A GSList of the components, which should be
- * g_slist_free'd when finished with.
- **/
-GSList *
-e_memo_table_get_selected (EMemoTable *memo_table)
-{
- return get_selected_objects(memo_table);
-}
-
-/**
* e_memo_table_delete_selected:
* @memo_table: A memo table.
*
@@ -496,7 +900,7 @@ e_memo_table_delete_selected (EMemoTable *memo_table)
g_return_if_fail (memo_table != NULL);
g_return_if_fail (E_IS_MEMO_TABLE (memo_table));
- etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (memo_table->etable));
+ etable = e_memo_table_get_table (memo_table);
n_selected = e_table_selected_count (etable);
if (n_selected <= 0)
@@ -524,6 +928,30 @@ e_memo_table_delete_selected (EMemoTable *memo_table)
}
/**
+ * e_memo_table_get_selected:
+ * @memo_table:
+ *
+ * Get the currently selected ECalModelComponent's on the table.
+ *
+ * Return value: A GSList of the components, which should be
+ * g_slist_free'd when finished with.
+ **/
+GSList *
+e_memo_table_get_selected (EMemoTable *memo_table)
+{
+ struct get_selected_uids_closure closure;
+ ETable *etable;
+
+ closure.memo_table = memo_table;
+ closure.objects = NULL;
+
+ etable = e_memo_table_get_table (memo_table);
+ e_table_selected_row_foreach (etable, add_uid_cb, &closure);
+
+ return closure.objects;
+}
+
+/**
* e_memo_table_cut_clipboard:
* @memo_table: A calendar table.
*
@@ -538,12 +966,33 @@ e_memo_table_cut_clipboard (EMemoTable *memo_table)
delete_selected_components (memo_table);
}
+static void
+clipboard_get_calendar_cb (GtkClipboard *clipboard,
+ GtkSelectionData *selection_data,
+ guint info,
+ gpointer data)
+{
+ gchar *comp_str = (gchar *) data;
+
+ switch (info) {
+ case TARGET_TYPE_VCALENDAR:
+ gtk_selection_data_set (selection_data,
+ gdk_atom_intern (target_types[info].target, FALSE), 8,
+ (const guchar *) comp_str,
+ (gint) strlen (comp_str));
+ break;
+ default:
+ break;
+ }
+}
+
/* callback for e_table_selected_row_foreach */
static void
copy_row_cb (int model_row, gpointer data)
{
EMemoTable *memo_table;
ECalModelComponent *comp_data;
+ ECalModel *model;
gchar *comp_str;
icalcomponent *child;
@@ -551,7 +1000,8 @@ copy_row_cb (int model_row, gpointer data)
g_return_if_fail (memo_table->tmp_vcal != NULL);
- comp_data = e_cal_model_get_component_at (memo_table->model, model_row);
+ model = e_memo_table_get_model (memo_table);
+ comp_data = e_cal_model_get_component_at (model, model_row);
if (!comp_data)
return;
@@ -569,26 +1019,6 @@ copy_row_cb (int model_row, gpointer data)
g_free (comp_str);
}
-static void
-clipboard_get_calendar_cb (GtkClipboard *clipboard,
- GtkSelectionData *selection_data,
- guint info,
- gpointer data)
-{
- gchar *comp_str = (gchar *) data;
-
- switch (info) {
- case TARGET_TYPE_VCALENDAR:
- gtk_selection_data_set (selection_data,
- gdk_atom_intern (target_types[info].target, FALSE), 8,
- (const guchar *) comp_str,
- (gint) strlen (comp_str));
- break;
- default:
- break;
- }
-}
-
/**
* e_memo_table_copy_clipboard:
* @memo_table: A calendar table.
@@ -607,7 +1037,7 @@ e_memo_table_copy_clipboard (EMemoTable *memo_table)
/* create temporary VCALENDAR object */
memo_table->tmp_vcal = e_cal_util_new_top_level ();
- etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (memo_table->etable));
+ etable = e_memo_table_get_table (memo_table);
e_table_selected_row_foreach (etable, copy_row_cb, memo_table);
comp_str = icalcomponent_as_ical_string_r (memo_table->tmp_vcal);
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (memo_table), clipboard_atom);
@@ -632,7 +1062,9 @@ clipboard_get_calendar_data (EMemoTable *memo_table, const gchar *text)
char *uid;
ECalComponent *comp;
ECal *client;
+ ECalModel *model;
icalcomponent_kind kind;
+ const gchar *status_message;
g_return_if_fail (E_IS_MEMO_TABLE (memo_table));
@@ -646,13 +1078,17 @@ clipboard_get_calendar_data (EMemoTable *memo_table, const gchar *text)
/* check the type of the component */
kind = icalcomponent_isa (icalcomp);
if (kind != ICAL_VCALENDAR_COMPONENT &&
+ kind != ICAL_VEVENT_COMPONENT &&
+ kind != ICAL_VTODO_COMPONENT &&
kind != ICAL_VJOURNAL_COMPONENT) {
return;
}
- client = e_cal_model_get_default_client (memo_table->model);
+ model = e_memo_table_get_model (memo_table);
+ client = e_cal_model_get_default_client (model);
- e_memo_table_set_status_message (memo_table, _("Updating objects"));
+ status_message = _("Updating objects");
+ memo_table_emit_status_message (memo_table, status_message, -1.0);
if (kind == ICAL_VCALENDAR_COMPONENT) {
icalcomponent_kind child_kind;
@@ -664,7 +1100,9 @@ clipboard_get_calendar_data (EMemoTable *memo_table, const gchar *text)
vcal_comp, ICAL_ANY_COMPONENT);
while (subcomp) {
child_kind = icalcomponent_isa (subcomp);
- if (child_kind == ICAL_VJOURNAL_COMPONENT) {
+ if (child_kind == ICAL_VEVENT_COMPONENT ||
+ child_kind == ICAL_VTODO_COMPONENT ||
+ child_kind == ICAL_VJOURNAL_COMPONENT) {
ECalComponent *tmp_comp;
uid = e_cal_component_gen_uid ();
@@ -695,7 +1133,7 @@ clipboard_get_calendar_data (EMemoTable *memo_table, const gchar *text)
g_object_unref (comp);
}
- e_memo_table_set_status_message (memo_table, NULL);
+ memo_table_emit_status_message (memo_table, NULL, -1.0);
}
static void
@@ -704,7 +1142,7 @@ clipboard_paste_received_cb (GtkClipboard *clipboard,
gpointer data)
{
EMemoTable *memo_table = E_MEMO_TABLE (data);
- ETable *e_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (memo_table->etable));
+ ETable *e_table = e_memo_table_get_table (memo_table);
GnomeCanvas *canvas = e_table->table_canvas;
GnomeCanvasItem *item = GNOME_CANVAS (canvas)->focused_item;
@@ -739,335 +1177,44 @@ void
e_memo_table_paste_clipboard (EMemoTable *memo_table)
{
GtkClipboard *clipboard;
- g_return_if_fail (E_IS_MEMO_TABLE (memo_table));
-
-
- clipboard = gtk_widget_get_clipboard (GTK_WIDGET (memo_table), clipboard_atom);
- g_object_ref (memo_table);
-
- gtk_clipboard_request_contents (clipboard,
- gdk_atom_intern (target_types[0].target, FALSE),
- clipboard_paste_received_cb, memo_table);
-}
-
-/* Opens a task in the task editor */
-static void
-open_memo (EMemoTable *memo_table, ECalModelComponent *comp_data)
-{
- CompEditor *medit;
- const char *uid;
-
- uid = icalcomponent_get_uid (comp_data->icalcomp);
-
- medit = e_comp_editor_registry_find (comp_editor_registry, uid);
- if (medit == NULL) {
- ECalComponent *comp;
- CompEditorFlags flags = 0;
-
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
-
- if (e_cal_component_has_organizer (comp))
- flags |= COMP_EDITOR_IS_SHARED;
-
- if (itip_organizer_is_user (comp, comp_data->client))
- flags |= COMP_EDITOR_USER_ORG;
-
- medit = memo_editor_new (comp_data->client, flags);
-
- comp_editor_edit_comp (medit, comp);
- g_object_unref (comp);
-
- e_comp_editor_registry_add (comp_editor_registry, medit, FALSE);
- }
-
- gtk_window_present (GTK_WINDOW (medit));
-}
-
-/* Opens the task in the specified row */
-static void
-open_memo_by_row (EMemoTable *memo_table, int row)
-{
- ECalModelComponent *comp_data;
-
- comp_data = e_cal_model_get_component_at (memo_table->model, row);
- open_memo (memo_table, comp_data);
-}
-
-static void
-e_memo_table_on_double_click (ETable *table,
- gint row,
- gint col,
- GdkEvent *event,
- EMemoTable *memo_table)
-{
- open_memo_by_row (memo_table, row);
-}
-
-
-static void
-e_memo_table_on_open_memo (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMemoTable *memo_table = E_MEMO_TABLE (data);
- ECalModelComponent *comp_data;
-
- comp_data = get_selected_comp (memo_table);
- if (comp_data)
- open_memo (memo_table, comp_data);
-}
-
-static void
-e_memo_table_on_save_as (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMemoTable *memo_table = E_MEMO_TABLE (data);
- ECalModelComponent *comp_data;
- char *filename;
- char *ical_string;
-
- comp_data = get_selected_comp (memo_table);
- if (comp_data == NULL)
- return;
-
- filename = e_file_dialog_save (_("Save as..."), NULL);
- if (filename == NULL)
- return;
-
- ical_string = e_cal_get_component_as_string (comp_data->client, comp_data->icalcomp);
- if (ical_string == NULL) {
- g_warning ("Couldn't convert item to a string");
- return;
- }
-
- e_write_file_uri (filename, ical_string);
- g_free (ical_string);
-}
-
-static void
-e_memo_table_on_print_memo (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMemoTable *memo_table = E_MEMO_TABLE (data);
- ECalModelComponent *comp_data;
- ECalComponent *comp;
-
- comp_data = get_selected_comp (memo_table);
- if (comp_data == NULL)
- return;
-
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- print_comp (comp, comp_data->client, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-
- g_object_unref (comp);
-}
-
-static void
-e_memo_table_on_cut (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMemoTable *memo_table = E_MEMO_TABLE (data);
-
- e_memo_table_cut_clipboard (memo_table);
-}
-
-static void
-e_memo_table_on_copy (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMemoTable *memo_table = E_MEMO_TABLE (data);
-
- e_memo_table_copy_clipboard (memo_table);
-}
-
-static void
-e_memo_table_on_paste (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMemoTable *memo_table = E_MEMO_TABLE (data);
-
- e_memo_table_paste_clipboard (memo_table);
-}
-
-static void
-e_memo_table_on_forward (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMemoTable *memo_table = E_MEMO_TABLE (data);
- ECalModelComponent *comp_data;
-
- comp_data = get_selected_comp (memo_table);
- if (comp_data) {
- ECalComponent *comp;
-
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL, NULL, TRUE);
-
- g_object_unref (comp);
- }
-}
-
-/* Opens the URL of the memo */
-static void
-open_url_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMemoTable *memo_table = E_MEMO_TABLE (data);
- ECalModelComponent *comp_data;
- icalproperty *prop;
-
- comp_data = get_selected_comp (memo_table);
- if (!comp_data)
- return;
-
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_URL_PROPERTY);
- if (!prop)
- return;
-
- /* FIXME Pass a parent window. */
- e_show_uri (NULL, icalproperty_get_url (prop));
-}
-
-/* Callback for the "delete tasks" menu item */
-static void
-delete_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMemoTable *memo_table = E_MEMO_TABLE (data);
-
- e_memo_table_delete_selected (memo_table);
-}
-
-static EPopupItem memos_popup_items [] = {
- { E_POPUP_ITEM, (gchar *) "00.open", (gchar *) N_("_Open"), e_memo_table_on_open_memo, NULL, (gchar *) GTK_STOCK_OPEN, E_CAL_POPUP_SELECT_ONE },
- { E_POPUP_ITEM, (gchar *) "05.openweb", (gchar *) N_("Open _Web Page"), open_url_cb, NULL, NULL, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_HASURL },
- { E_POPUP_ITEM, (gchar *) "10.saveas", (gchar *) N_("_Save As..."), e_memo_table_on_save_as, NULL, (gchar *) GTK_STOCK_SAVE_AS, E_CAL_POPUP_SELECT_ONE },
- { E_POPUP_ITEM, (gchar *) "20.print", (gchar *) N_("P_rint..."), e_memo_table_on_print_memo, NULL, (gchar *) GTK_STOCK_PRINT, E_CAL_POPUP_SELECT_ONE },
-
- { E_POPUP_BAR, (gchar *) "30.bar" },
-
- { E_POPUP_ITEM, (gchar *) "40.cut", (gchar *) N_("C_ut"), e_memo_table_on_cut, NULL, (gchar *) GTK_STOCK_CUT, 0, E_CAL_POPUP_SELECT_EDITABLE },
- { E_POPUP_ITEM, (gchar *) "50.copy", (gchar *) N_("_Copy"), e_memo_table_on_copy, NULL, (gchar *) GTK_STOCK_COPY, 0, 0 },
- { E_POPUP_ITEM, (gchar *) "60.paste", (gchar *) N_("_Paste"), e_memo_table_on_paste, NULL, (gchar *) GTK_STOCK_PASTE, 0, E_CAL_POPUP_SELECT_EDITABLE },
-
- { E_POPUP_BAR, (gchar *) "70.bar" },
-
- { E_POPUP_ITEM, (gchar *) "80.forward", (gchar *) N_("_Forward as iCalendar"), e_memo_table_on_forward, NULL, (gchar *) "mail-forward", E_CAL_POPUP_SELECT_ONE },
-
- { E_POPUP_BAR, (gchar *) "90.bar" },
- { E_POPUP_ITEM, (gchar *) "a0.delete", (gchar *) N_("_Delete"), delete_cb, NULL, (gchar *) GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_EDITABLE },
- { E_POPUP_ITEM, (gchar *) "b0.deletemany", (gchar *) N_("_Delete Selected Memos"), delete_cb, NULL, (gchar *) GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_MANY, E_CAL_POPUP_SELECT_EDITABLE },
-};
-
-static void
-emt_popup_free(EPopup *ep, GSList *items, void *data)
-{
- g_slist_free(items);
-}
-
-static gint
-e_memo_table_show_popup_menu (ETable *table,
- GdkEvent *gdk_event,
- EMemoTable *memo_table)
-{
- GtkMenu *menu;
- GSList *selection, *l, *menus = NULL;
- GPtrArray *events;
- ECalPopup *ep;
- ECalPopupTargetSelect *t;
- int i;
-
- selection = get_selected_objects (memo_table);
- if (!selection)
- return TRUE;
-
- /** @HookPoint-ECalPopup: Tasks Table Context Menu
- * @Id: org.gnome.evolution.tasks.table.popup
- * @Class: org.gnome.evolution.calendar.popup:1.0
- * @Target: ECalPopupTargetSelect
- *
- * The context menu on the tasks table.
- */
- ep = e_cal_popup_new("org.gnome.evolution.memos.table.popup");
-
- events = g_ptr_array_new();
- for (l=selection;l;l=g_slist_next(l))
- g_ptr_array_add(events, e_cal_model_copy_component_data((ECalModelComponent *)l->data));
- g_slist_free(selection);
-
- t = e_cal_popup_target_new_select(ep, memo_table->model, events);
- t->target.widget = (GtkWidget *)memo_table;
-
- for (i=0;i<sizeof(memos_popup_items)/sizeof(memos_popup_items[0]);i++)
- menus = g_slist_prepend(menus, &memos_popup_items[i]);
- e_popup_add_items((EPopup *)ep, menus, NULL, emt_popup_free, memo_table);
-
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
-
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, gdk_event?gdk_event->button.button:0,
- gdk_event?gdk_event->button.time:gtk_get_current_event_time());
-
- return TRUE;
-}
-
-static gint
-e_memo_table_on_right_click (ETable *table,
- gint row,
- gint col,
- GdkEvent *event,
- EMemoTable *memo_table)
-{
- return e_memo_table_show_popup_menu (table, event, memo_table);
-}
+ g_return_if_fail (E_IS_MEMO_TABLE (memo_table));
-static gboolean
-e_memo_table_on_popup_menu (GtkWidget *widget, gpointer data)
-{
- ETable *table = E_TABLE(widget);
- g_return_val_if_fail(table, FALSE);
+ clipboard = gtk_widget_get_clipboard (
+ GTK_WIDGET (memo_table), clipboard_atom);
- return e_memo_table_show_popup_menu (table, NULL,
- E_MEMO_TABLE(data));
-}
-
-static gint
-e_memo_table_on_key_press (ETable *table,
- gint row,
- gint col,
- GdkEventKey *event,
- EMemoTable *memo_table)
-{
- if (event->keyval == GDK_Delete) {
- delete_cb (NULL, NULL, memo_table);
- return TRUE;
- } else if ((event->keyval == GDK_o)
- &&(event->state & GDK_CONTROL_MASK)) {
- open_memo_by_row (memo_table, row);
- return TRUE;
- }
-
- return FALSE;
+ gtk_clipboard_request_contents (
+ clipboard, gdk_atom_intern (target_types[0].target, FALSE),
+ clipboard_paste_received_cb, g_object_ref (memo_table));
}
/* Loads the state of the table (headers shown etc.) from the given file. */
void
e_memo_table_load_state (EMemoTable *memo_table,
- gchar *filename)
+ const gchar *filename)
{
- struct stat st;
+ ETable *table;
g_return_if_fail (E_IS_MEMO_TABLE (memo_table));
+ g_return_if_fail (filename != NULL);
- if (g_stat (filename, &st) == 0 && st.st_size > 0
- && S_ISREG (st.st_mode)) {
- e_table_load_state (e_table_scrolled_get_table (E_TABLE_SCROLLED (memo_table->etable)), filename);
- }
+ table = e_memo_table_get_table (memo_table);
+ e_table_load_state (table, filename);
}
/* Saves the state of the table (headers shown etc.) to the given file. */
void
-e_memo_table_save_state (EMemoTable *memo_table,
- gchar *filename)
+e_memo_table_save_state (EMemoTable *memo_table,
+ const gchar *filename)
{
+ ETable *table;
+
g_return_if_fail (E_IS_MEMO_TABLE (memo_table));
+ g_return_if_fail (filename != NULL);
- e_table_save_state (e_table_scrolled_get_table (E_TABLE_SCROLLED (memo_table->etable)),
- filename);
+ table = e_memo_table_get_table (memo_table);
+ e_table_save_state (table, filename);
}
/* Returns the current time, for the ECellDateEdit items.
@@ -1096,45 +1243,3 @@ e_memo_table_get_current_time (ECellDateEdit *ecde, gpointer data)
return tmp_tm;
}
-
-
-#ifdef TRANSLATORS_ONLY
-
-static char *test[] = {
- N_("Click to add a memo")
-};
-
-#endif
-
-void
-e_memo_table_set_activity_handler (EMemoTable *memo_table, EActivityHandler *activity_handler)
-{
- g_return_if_fail (E_IS_MEMO_TABLE (memo_table));
-
- memo_table->activity_handler = activity_handler;
-}
-
-void
-e_memo_table_set_status_message (EMemoTable *memo_table, const gchar *message)
-{
- g_return_if_fail (E_IS_MEMO_TABLE (memo_table));
-
- if (!memo_table->activity_handler)
- return;
-
- if (!message || !*message) {
- if (memo_table->activity_id != 0) {
- e_activity_handler_operation_finished (memo_table->activity_handler, memo_table->activity_id);
- memo_table->activity_id = 0;
- }
- } else if (memo_table->activity_id == 0) {
- char *client_id = g_strdup_printf ("%p", (gpointer) memo_table);
-
- memo_table->activity_id = e_activity_handler_operation_started (
- memo_table->activity_handler, client_id, message, TRUE);
-
- g_free (client_id);
- } else {
- e_activity_handler_operation_progressing (memo_table->activity_handler, memo_table->activity_id, message, -1.0);
- }
-}
diff --git a/calendar/gui/e-memo-table.h b/calendar/gui/e-memo-table.h
index b593b9445b..f3b02e0c04 100644
--- a/calendar/gui/e-memo-table.h
+++ b/calendar/gui/e-memo-table.h
@@ -25,34 +25,47 @@
#ifndef _E_MEMO_TABLE_H_
#define _E_MEMO_TABLE_H_
-#include <gtk/gtk.h>
+#include <shell/e-shell-view.h>
#include <table/e-table-scrolled.h>
-#include <widgets/misc/e-cell-date-edit.h>
-#include "e-activity-handler.h"
+#include <table/e-cell-date-edit.h>
#include "e-cal-model.h"
-G_BEGIN_DECLS
-
/*
* EMemoTable - displays the iCalendar objects in a table (an ETable).
* Used for memo events and tasks.
+ *
+ * XXX We should look at merging this back into ECalendarTable, or at
+ * least making ECalendarTable subclassable so we don't have so
+ * much duplicate code.
*/
+/* Standard GObject macros */
+#define E_TYPE_MEMO_TABLE \
+ (e_memo_table_get_type ())
+#define E_MEMO_TABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MEMO_TABLE, EMemoTable))
+#define E_MEMO_TABLE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MEMO_TABLE, EMemoTableClass))
+#define E_IS_MEMO_TABLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MEMO_TABLE))
+#define E_IS_MEMO_TABLE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MEMO_TABLE))
+#define E_MEMO_TABLE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MEMO_TABLE, EMemoTableClass))
-#define E_MEMO_TABLE(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_memo_table_get_type (), EMemoTable)
-#define E_MEMO_TABLE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_memo_table_get_type (), EMemoTableClass)
-#define E_IS_MEMO_TABLE(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_memo_table_get_type ())
-
-
-typedef struct _EMemoTable EMemoTable;
-typedef struct _EMemoTableClass EMemoTableClass;
+G_BEGIN_DECLS
+typedef struct _EMemoTable EMemoTable;
+typedef struct _EMemoTableClass EMemoTableClass;
+typedef struct _EMemoTablePrivate EMemoTablePrivate;
struct _EMemoTable {
- GtkTable table;
-
- /* The model that we use */
- ECalModel *model;
+ GtkTable parent;
GtkWidget *etable;
@@ -62,51 +75,43 @@ struct _EMemoTable {
/* Fields used for cut/copy/paste */
icalcomponent *tmp_vcal;
- /* Activity ID for the EActivityHandler (i.e. the status bar). */
- EActivityHandler *activity_handler;
- guint activity_id;
-
- /* We should know which calendar has been used to create object, so store it here
- before emitting "user_created" signal and make it NULL just after the emit. */
- ECal *user_created_cal;
+ EMemoTablePrivate *priv;
};
struct _EMemoTableClass {
GtkTableClass parent_class;
- /* Notification signals */
- void (* user_created) (EMemoTable *memo_table);
+ /* Signals */
+ void (*open_component) (EMemoTable *memo_table,
+ ECalModelComponent *comp_data);
+ void (*popup_event) (EMemoTable *memo_table,
+ GdkEvent *event);
+ void (*status_message) (EMemoTable *memo_table,
+ const gchar *message,
+ gdouble percent);
+ void (*user_created) (EMemoTable *memo_table);
};
-
-GType e_memo_table_get_type (void);
-GtkWidget* e_memo_table_new (void);
-
-ECalModel *e_memo_table_get_model (EMemoTable *memo_table);
-
-ETable *e_memo_table_get_table (EMemoTable *memo_table);
-
-void e_memo_table_open_selected (EMemoTable *memo_table);
-void e_memo_table_delete_selected (EMemoTable *memo_table);
-
-GSList *e_memo_table_get_selected (EMemoTable *memo_table);
+GType e_memo_table_get_type (void);
+GtkWidget * e_memo_table_new (EShellView *shell_view,
+ ECalModel *model);
+ECalModel * e_memo_table_get_model (EMemoTable *memo_table);
+ETable * e_memo_table_get_table (EMemoTable *memo_table);
+EShellView * e_memo_table_get_shell_view (EMemoTable *memo_table);
+void e_memo_table_delete_selected (EMemoTable *memo_table);
+GSList * e_memo_table_get_selected (EMemoTable *memo_table);
/* Clipboard related functions */
-void e_memo_table_cut_clipboard (EMemoTable *memo_table);
-void e_memo_table_copy_clipboard (EMemoTable *memo_table);
-void e_memo_table_paste_clipboard (EMemoTable *memo_table);
+void e_memo_table_cut_clipboard (EMemoTable *memo_table);
+void e_memo_table_copy_clipboard (EMemoTable *memo_table);
+void e_memo_table_paste_clipboard (EMemoTable *memo_table);
/* These load and save the state of the table (headers shown etc.) to/from
the given file. */
-void e_memo_table_load_state (EMemoTable *memo_table,
- gchar *filename);
-void e_memo_table_save_state (EMemoTable *memo_table,
- gchar *filename);
-
-void e_memo_table_set_activity_handler (EMemoTable *memo_table,
- EActivityHandler *activity_handler);
-void e_memo_table_set_status_message (EMemoTable *memo_table,
- const gchar *message);
+void e_memo_table_load_state (EMemoTable *memo_table,
+ const gchar *filename);
+void e_memo_table_save_state (EMemoTable *memo_table,
+ const gchar *filename);
G_END_DECLS
diff --git a/calendar/gui/e-memos.c b/calendar/gui/e-memos.c
index f6f1cff91c..cbfc13eb87 100644
--- a/calendar/gui/e-memos.c
+++ b/calendar/gui/e-memos.c
@@ -38,7 +38,6 @@
#include "e-util/e-error.h"
#include "e-util/e-categories-config.h"
#include "e-util/e-util-private.h"
-#include "shell/e-user-creatable-items-handler.h"
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-url.h>
#include <libedataserver/e-categories.h>
@@ -46,11 +45,9 @@
#include "dialogs/delete-error.h"
#include "calendar-config.h"
#include "cal-search-bar.h"
-#include "calendar-component.h"
#include "comp-util.h"
#include "e-memo-table-config.h"
#include "misc.h"
-#include "memos-component.h"
#include "e-cal-component-memo-preview.h"
#include "e-memos.h"
#include "common/authentication.h"
@@ -72,9 +69,6 @@ struct _EMemosPrivate {
/* Calendar search bar for memos */
GtkWidget *search_bar;
- /* Paned widget */
- GtkWidget *paned;
-
/* The preview */
GtkWidget *preview;
@@ -93,7 +87,6 @@ static void e_memos_destroy (GtkObject *object);
static void update_view (EMemos *memos);
static void categories_changed_cb (gpointer object, gpointer user_data);
-static void backend_error_cb (ECal *client, const char *message, gpointer data);
/* Signal IDs */
enum {
@@ -103,100 +96,10 @@ enum {
LAST_SIGNAL
};
-enum DndTargetType {
- TARGET_VCALENDAR
-};
-
-static GtkTargetEntry list_drag_types[] = {
- { (gchar *) "text/calendar", 0, TARGET_VCALENDAR },
- { (gchar *) "text/x-calendar", 0, TARGET_VCALENDAR }
-};
-static const int num_list_drag_types = sizeof (list_drag_types) / sizeof (list_drag_types[0]);
-
static guint e_memos_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (EMemos, e_memos, GTK_TYPE_TABLE)
-/* Callback used when the cursor changes in the table */
-static void
-table_cursor_change_cb (ETable *etable, int row, gpointer data)
-{
- EMemos *memos;
- EMemosPrivate *priv;
- ECalModel *model;
- ECalModelComponent *comp_data;
- ECalComponent *comp;
- const char *uid;
-
- int n_selected;
-
- memos = E_MEMOS (data);
- priv = memos->priv;
-
- n_selected = e_table_selected_count (etable);
-
- /* update the HTML widget */
- if (n_selected != 1) {
- e_cal_component_memo_preview_clear (E_CAL_COMPONENT_MEMO_PREVIEW (priv->preview));
-
- return;
- }
-
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
-
- comp_data = e_cal_model_get_component_at (model, e_table_get_cursor_row (etable));
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
-
- e_cal_component_memo_preview_display (E_CAL_COMPONENT_MEMO_PREVIEW (priv->preview), comp_data->client, comp);
-
- e_cal_component_get_uid (comp, &uid);
- if (priv->current_uid)
- g_free (priv->current_uid);
- priv->current_uid = g_strdup (uid);
-
- g_object_unref (comp);
-}
-
-/* Callback used when the selection changes in the table. */
-static void
-table_selection_change_cb (ETable *etable, gpointer data)
-{
- EMemos *memos;
- int n_selected;
-
- memos = E_MEMOS (data);
-
- n_selected = e_table_selected_count (etable);
- g_signal_emit (memos, e_memos_signals[SELECTION_CHANGED], 0, n_selected);
-
- if (n_selected != 1)
- e_cal_component_memo_preview_clear (E_CAL_COMPONENT_MEMO_PREVIEW (memos->priv->preview));
-
-}
-
-static void
-user_created_cb (GtkWidget *view, EMemos *memos)
-{
- EMemosPrivate *priv;
- EMemoTable *memo_table;
- ECal *ecal;
-
- priv = memos->priv;
- memo_table = E_MEMO_TABLE (priv->memos_view);
-
- if (memo_table->user_created_cal)
- ecal = memo_table->user_created_cal;
- else {
- ECalModel *model;
-
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
- ecal = e_cal_model_get_default_client (model);
- }
-
- e_memos_add_memo_source (memos, e_cal_get_source (ecal));
-}
-
/* Callback used when the sexp in the search bar changes */
static void
search_bar_sexp_changed_cb (CalSearchBar *cal_search, const char *sexp, gpointer data)
@@ -230,14 +133,6 @@ search_bar_category_changed_cb (CalSearchBar *cal_search, const char *category,
e_cal_model_set_default_category (model, category);
}
-static gboolean
-vpaned_resized_cb (GtkWidget *widget, GdkEventButton *event, EMemos *memos)
-{
- calendar_config_set_task_vpane_pos (gtk_paned_get_position (GTK_PANED (widget)));
-
- return FALSE;
-}
-
static void
set_timezone (EMemos *memos)
{
@@ -256,10 +151,6 @@ set_timezone (EMemos *memos)
e_cal_set_default_timezone (client, zone, NULL);
}
- if (priv->default_client && e_cal_get_load_state (priv->default_client) == E_CAL_LOAD_LOADED)
- /* FIXME Error checking */
- e_cal_set_default_timezone (priv->default_client, zone, NULL);
-
if (priv->preview)
e_cal_component_memo_preview_set_default_timezone (E_CAL_COMPONENT_MEMO_PREVIEW (priv->preview), zone);
}
@@ -288,33 +179,6 @@ update_view (EMemos *memos)
}
static void
-model_row_changed_cb (ETableModel *etm, int row, gpointer data)
-{
- EMemos *memos;
- EMemosPrivate *priv;
- ECalModelComponent *comp_data;
-
- memos = E_MEMOS (data);
- priv = memos->priv;
-
- if (priv->current_uid) {
- const char *uid;
-
- comp_data = e_cal_model_get_component_at (E_CAL_MODEL (etm), row);
- if (comp_data) {
- uid = icalcomponent_get_uid (comp_data->icalcomp);
- if (!strcmp (uid ? uid : "", priv->current_uid)) {
- ETable *etable;
-
- etable = e_table_scrolled_get_table (
- E_TABLE_SCROLLED (E_MEMO_TABLE (priv->memos_view)->etable));
- table_cursor_change_cb (etable, 0, memos);
- }
- }
- }
-}
-
-static void
setup_config (EMemos *memos)
{
EMemosPrivate *priv;
@@ -329,155 +193,6 @@ setup_config (EMemos *memos)
priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
}
-struct AffectedComponents {
- EMemoTable *memo_table;
- GSList *components; /* contains pointers to ECalModelComponent */
-};
-
-/**
- * get_selected_components_cb
- * Helper function to fill list of selected components in EMemoTable.
- * This function is called from e_table_selected_row_foreach.
- **/
-static void
-get_selected_components_cb (int model_row, gpointer data)
-{
- struct AffectedComponents *ac = (struct AffectedComponents *) data;
-
- if (!ac || !ac->memo_table)
- return;
-
- ac->components = g_slist_prepend (ac->components, e_cal_model_get_component_at (E_CAL_MODEL (e_memo_table_get_model (ac->memo_table)), model_row));
-}
-
-/**
- * do_for_selected_components
- * Calls function func for all selected components in memo_table.
- *
- * @param memo_table Table with selected components of our interest.
- * @param func Function to be called on each selected component from cal_table.
- * The first parameter of this function is a pointer to ECalModelComponent and
- * the second parameter of this function is pointer to cal_table
- * @param user_data User data, will be passed to func.
- **/
-static void
-do_for_selected_components (EMemoTable *memo_table, GFunc func, gpointer user_data)
-{
- ETable *etable;
- struct AffectedComponents ac;
-
- g_return_if_fail (memo_table != NULL);
-
- ac.memo_table = memo_table;
- ac.components = NULL;
-
- etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (memo_table->etable));
- e_table_selected_row_foreach (etable, get_selected_components_cb, &ac);
-
- g_slist_foreach (ac.components, func, user_data);
- g_slist_free (ac.components);
-}
-
-/**
- * obtain_list_of_components
- * As a callback function to convert each ECalModelComponent to string
- * of format "source_uid\ncomponent_str" and add this newly allocated
- * string to the list of components. Strings should be freed with g_free.
- *
- * @param data ECalModelComponent object.
- * @param user_data Pointer to GSList list, where to put new strings.
- **/
-static void
-obtain_list_of_components (gpointer data, gpointer user_data)
-{
- GSList **list;
- ECalModelComponent *comp_data;
-
- list = (GSList **) user_data;
- comp_data = (ECalModelComponent *) data;
-
- if (list && comp_data) {
- char *comp_str;
- icalcomponent *vcal;
-
- vcal = e_cal_util_new_top_level ();
- e_cal_util_add_timezones_from_component (vcal, comp_data->icalcomp);
- icalcomponent_add_component (vcal, icalcomponent_new_clone (comp_data->icalcomp));
-
- comp_str = icalcomponent_as_ical_string_r (vcal);
- if (comp_str) {
- ESource *source = e_cal_get_source (comp_data->client);
- const char *source_uid = e_source_peek_uid (source);
-
- *list = g_slist_prepend (*list, g_strdup_printf ("%s\n%s", source_uid, comp_str));
-
- /* do not free this pointer, it owns libical */
- /* g_free (comp_str); */
- }
-
- icalcomponent_free (vcal);
- g_free (comp_str);
- }
-}
-
-static void
-table_drag_data_get (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- EMemos *memos)
-{
- EMemosPrivate *priv;
-
- priv = memos->priv;
-
- if (info == TARGET_VCALENDAR) {
- /* we will pass an icalcalendar component for both types */
- GSList *components = NULL;
-
- do_for_selected_components (E_MEMO_TABLE (priv->memos_view), obtain_list_of_components, &components);
-
- if (components) {
- cal_comp_selection_set_string_list (selection_data, components);
-
- g_slist_foreach (components, (GFunc)g_free, NULL);
- g_slist_free (components);
- }
- }
-}
-
-static void
-table_drag_data_delete (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- EMemos *memos)
-{
- /* Moved components are deleted from source immediately when moved,
- because some of them can be part of destination source, and we
- don't want to delete not-moved tasks. There is no such information
- which event has been moved and which not, so skip this method.
- */
-}
-
-#define E_MEMOS_TABLE_DEFAULT_STATE \
- "<?xml version=\"1.0\"?>" \
- "<ETableState>" \
- "<column source=\"1\"/>" \
- "<column source=\"0\"/>" \
- "<column source=\"2\"/>" \
- "<grouping></grouping>" \
- "</ETableState>"
-
-static void
-pane_realized (GtkWidget *widget, EMemos *memos)
-{
- gtk_paned_set_position ((GtkPaned *)widget, calendar_config_get_task_vpane_pos ());
-}
-
static void
setup_widgets (EMemos *memos)
{
@@ -499,51 +214,12 @@ setup_widgets (EMemos *memos)
GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0, 0);
gtk_widget_show (priv->search_bar);
- /* add the paned widget for the memo list and memo detail areas */
- priv->paned = gtk_vpaned_new ();
- g_signal_connect (priv->paned, "realize", G_CALLBACK (pane_realized), memos);
-
- g_signal_connect (G_OBJECT (priv->paned), "button_release_event",
- G_CALLBACK (vpaned_resized_cb), memos);
- gtk_table_attach (GTK_TABLE (memos), priv->paned, 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (priv->paned);
-
/* create the memo list */
priv->memos_view = e_memo_table_new ();
priv->memos_view_config = e_memo_table_config_new (E_MEMO_TABLE (priv->memos_view));
- g_signal_connect (priv->memos_view, "user_created", G_CALLBACK (user_created_cb), memos);
-
- etable = e_table_scrolled_get_table (
- E_TABLE_SCROLLED (E_MEMO_TABLE (priv->memos_view)->etable));
- e_table_set_state (etable, E_MEMOS_TABLE_DEFAULT_STATE);
-
- gtk_paned_add1 (GTK_PANED (priv->paned), priv->memos_view);
- gtk_widget_show (priv->memos_view);
-
-
- e_table_drag_source_set (etable, GDK_BUTTON1_MASK,
- list_drag_types, num_list_drag_types,
- GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_ASK);
-
g_signal_connect (etable, "table_drag_data_get",
G_CALLBACK(table_drag_data_get), memos);
- g_signal_connect (etable, "table_drag_data_delete",
- G_CALLBACK(table_drag_data_delete), memos);
-
- g_signal_connect (etable, "cursor_change", G_CALLBACK (table_cursor_change_cb), memos);
- g_signal_connect (etable, "selection_change", G_CALLBACK (table_selection_change_cb), memos);
-
- /* create the memo detail */
- priv->preview = e_cal_component_memo_preview_new ();
- e_cal_component_memo_preview_set_default_timezone (E_CAL_COMPONENT_MEMO_PREVIEW (priv->preview), calendar_config_get_icaltimezone ());
- gtk_paned_add2 (GTK_PANED (priv->paned), priv->preview);
- gtk_widget_show (priv->preview);
-
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
- g_signal_connect (G_OBJECT (model), "model_row_changed",
- G_CALLBACK (model_row_changed_cb), memos);
}
/* Class initialization function for the gnome calendar */
@@ -637,32 +313,9 @@ e_memos_init (EMemos *memos)
priv->view_menus = NULL;
priv->current_uid = NULL;
priv->sexp = g_strdup ("#t");
- priv->default_client = NULL;
update_view (memos);
}
-GtkWidget *
-e_memos_new (void)
-{
- EMemos *memos;
-
- memos = g_object_new (e_memos_get_type (), NULL);
-
- return GTK_WIDGET (memos);
-}
-
-
-void
-e_memos_set_ui_component (EMemos *memos,
- BonoboUIComponent *ui_component)
-{
- g_return_if_fail (E_IS_MEMOS (memos));
- g_return_if_fail (ui_component == NULL || BONOBO_IS_UI_COMPONENT (ui_component));
-
- e_search_bar_set_ui_component (E_SEARCH_BAR (memos->priv->search_bar), ui_component);
-}
-
-
static void
e_memos_destroy (GtkObject *object)
{
@@ -689,10 +342,6 @@ e_memos_destroy (GtkObject *object)
g_hash_table_destroy (priv->clients);
g_list_free (priv->clients_list);
- if (priv->default_client)
- g_object_unref (priv->default_client);
- priv->default_client = NULL;
-
if (priv->current_uid) {
g_free (priv->current_uid);
priv->current_uid = NULL;
@@ -720,325 +369,6 @@ e_memos_destroy (GtkObject *object)
(* GTK_OBJECT_CLASS (e_memos_parent_class)->destroy) (object);
}
-static void
-set_status_message (EMemos *memos, const char *message, ...)
-{
- EMemosPrivate *priv;
- va_list args;
- char sz[2048], *msg_string = NULL;
-
- if (message) {
- va_start (args, message);
- vsnprintf (sz, sizeof sz, message, args);
- va_end (args);
- msg_string = sz;
- }
-
- priv = memos->priv;
-
- e_memo_table_set_status_message (E_MEMO_TABLE (priv->memos_view), msg_string);
-}
-
-/* Callback from the calendar client when an error occurs in the backend */
-static void
-backend_error_cb (ECal *client, const char *message, gpointer data)
-{
- EMemos *memos;
- GtkWidget *dialog;
- char *urinopwd;
-
- memos = E_MEMOS (data);
-
- urinopwd = get_uri_without_password (e_cal_get_uri (client));
-
- dialog = gtk_message_dialog_new (
- GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (memos))),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Error on %s:\n %s"), urinopwd, message);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- g_free (urinopwd);
-}
-
-/* Callback from the calendar client when the backend dies */
-static void
-backend_died_cb (ECal *client, gpointer data)
-{
- EMemos *memos;
- EMemosPrivate *priv;
- ESource *source;
-
- memos = E_MEMOS (data);
- priv = memos->priv;
-
- source = g_object_ref (e_cal_get_source (client));
-
- priv->clients_list = g_list_remove (priv->clients_list, client);
- g_hash_table_remove (priv->clients, e_source_peek_uid (source));
-
- g_signal_emit (memos, e_memos_signals[SOURCE_REMOVED], 0, source);
-
- e_memo_table_set_status_message (E_MEMO_TABLE (e_memos_get_calendar_table (memos)), NULL);
-
- e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (memos))),
- "calendar:memos-crashed", NULL);
-
- g_object_unref (source);
-}
-
-/* Callback from the calendar client when the calendar is opened */
-static void
-client_cal_opened_cb (ECal *ecal, ECalendarStatus status, EMemos *memos)
-{
- ECalModel *model;
- ESource *source;
- EMemosPrivate *priv;
-
- priv = memos->priv;
-
- source = e_cal_get_source (ecal);
-
- if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED || status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
- auth_cal_forget_password (ecal);
-
- switch (status) {
- case E_CALENDAR_STATUS_OK :
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, client_cal_opened_cb, NULL);
-
- set_status_message (memos, _("Loading memos"));
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
- e_cal_model_add_client (model, ecal);
-
- set_timezone (memos);
- set_status_message (memos, NULL);
- break;
- case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
- /* try to reopen calendar - it'll ask for a password once again */
- e_cal_open_async (ecal, FALSE);
- return;
- case E_CALENDAR_STATUS_BUSY :
- break;
- case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
- e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (memos))), "calendar:prompt-no-contents-offline-memos", NULL);
- default :
- /* Make sure the source doesn't disappear on us */
- g_object_ref (source);
-
- priv->clients_list = g_list_remove (priv->clients_list, ecal);
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, memos);
-
- /* Do this last because it unrefs the client */
- g_hash_table_remove (priv->clients, e_source_peek_uid (source));
-
- g_signal_emit (memos, e_memos_signals[SOURCE_REMOVED], 0, source);
-
- set_status_message (memos, NULL);
- g_object_unref (source);
-
- break;
- }
-}
-
-static void
-default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, EMemos *memos)
-{
- ECalModel *model;
- ESource *source;
- EMemosPrivate *priv;
-
- priv = memos->priv;
-
- source = e_cal_get_source (ecal);
-
- if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED || status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
- auth_cal_forget_password (ecal);
-
- switch (status) {
- case E_CALENDAR_STATUS_OK :
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, default_client_cal_opened_cb, NULL);
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
-
- set_timezone (memos);
- e_cal_model_set_default_client (model, ecal);
- set_status_message (memos, NULL);
- break;
- case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
- /* try to reopen calendar - it'll ask for a password once again */
- e_cal_open_async (ecal, FALSE);
- return;
- case E_CALENDAR_STATUS_BUSY:
- break;
- default :
- /* Make sure the source doesn't disappear on us */
- g_object_ref (source);
-
- priv->clients_list = g_list_remove (priv->clients_list, ecal);
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, memos);
-
- /* Do this last because it unrefs the client */
- g_hash_table_remove (priv->clients, e_source_peek_uid (source));
-
- g_signal_emit (memos, e_memos_signals[SOURCE_REMOVED], 0, source);
-
- set_status_message (memos, NULL);
- g_object_unref (priv->default_client);
- priv->default_client = NULL;
- g_object_unref (source);
-
- break;
- }
-}
-
-typedef void (*open_func) (ECal *, ECalendarStatus, EMemos *);
-
-static gboolean
-open_ecal (EMemos *memos, ECal *cal, gboolean only_if_exists, open_func of)
-{
- set_status_message (memos, _("Opening memos at %s"), e_cal_get_uri (cal));
-
- g_signal_connect (G_OBJECT (cal), "cal_opened", G_CALLBACK (of), memos);
- e_cal_open_async (cal, only_if_exists);
-
- return TRUE;
-}
-
-void
-e_memos_open_memo (EMemos *memos)
-{
- EMemoTable *cal_table;
-
- cal_table = e_memos_get_calendar_table (memos);
- e_memo_table_open_selected (cal_table);
-}
-
-void
-e_memos_new_memo (EMemos *memos)
-{
- /* used for click_to_add ?? Can't figure out anything else it's used for */
-}
-
-gboolean
-e_memos_add_memo_source (EMemos *memos, ESource *source)
-{
- EMemosPrivate *priv;
- ECal *client;
- const char *uid;
-
- g_return_val_if_fail (memos != NULL, FALSE);
- g_return_val_if_fail (E_IS_MEMOS (memos), FALSE);
- g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
-
- priv = memos->priv;
-
- uid = e_source_peek_uid (source);
- client = g_hash_table_lookup (priv->clients, uid);
- if (client) {
- /* We already have it */
-
- return TRUE;
- } else {
- ESource *default_source;
-
- if (priv->default_client) {
- default_source = e_cal_get_source (priv->default_client);
-
- /* We don't have it but the default client is it */
- if (!strcmp (e_source_peek_uid (default_source), uid))
- client = g_object_ref (priv->default_client);
- }
-
- /* Create a new one */
- if (!client) {
- client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL);
- if (!client)
- return FALSE;
- }
- }
-
- g_signal_connect (G_OBJECT (client), "backend_error", G_CALLBACK (backend_error_cb), memos);
- g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), memos);
-
- /* add the client to internal structure */
- g_hash_table_insert (priv->clients, g_strdup (uid) , client);
- priv->clients_list = g_list_prepend (priv->clients_list, client);
-
- g_signal_emit (memos, e_memos_signals[SOURCE_ADDED], 0, source);
-
- open_ecal (memos, client, FALSE, client_cal_opened_cb);
-
- return TRUE;
-}
-
-gboolean
-e_memos_remove_memo_source (EMemos *memos, ESource *source)
-{
- EMemosPrivate *priv;
- ECal *client;
- ECalModel *model;
- const char *uid;
-
- g_return_val_if_fail (memos != NULL, FALSE);
- g_return_val_if_fail (E_IS_MEMOS (memos), FALSE);
- g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
-
- priv = memos->priv;
-
- uid = e_source_peek_uid (source);
- client = g_hash_table_lookup (priv->clients, uid);
- if (!client)
- return TRUE;
-
-
- priv->clients_list = g_list_remove (priv->clients_list, client);
- g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, memos);
-
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
- e_cal_model_remove_client (model, client);
-
- g_hash_table_remove (priv->clients, uid);
-
-
- g_signal_emit (memos, e_memos_signals[SOURCE_REMOVED], 0, source);
-
- return TRUE;
-}
-
-gboolean
-e_memos_set_default_source (EMemos *memos, ESource *source)
-{
- EMemosPrivate *priv;
- ECal *ecal;
-
- g_return_val_if_fail (memos != NULL, FALSE);
- g_return_val_if_fail (E_IS_MEMOS (memos), FALSE);
- g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
-
- priv = memos->priv;
-
- ecal = g_hash_table_lookup (priv->clients, e_source_peek_uid (source));
-
- if (priv->default_client)
- g_object_unref (priv->default_client);
-
- if (ecal) {
- priv->default_client = g_object_ref (ecal);
- } else {
- priv->default_client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL);
- if (!priv->default_client)
- return FALSE;
- }
-
- open_ecal (memos, priv->default_client, FALSE, default_client_cal_opened_cb);
-
- return TRUE;
-}
-
ECal *
e_memos_get_default_client (EMemos *memos)
{
@@ -1051,188 +381,3 @@ e_memos_get_default_client (EMemos *memos)
return e_cal_model_get_default_client (e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view)));
}
-
-
-/**
- * e_memos_delete_selected:
- * @memos: A memos control widget.
- *
- * Deletes the selected memos in the memo list.
- **/
-void
-e_memos_delete_selected (EMemos *memos)
-{
- EMemosPrivate *priv;
- EMemoTable *cal_table;
-
- g_return_if_fail (memos != NULL);
- g_return_if_fail (E_IS_MEMOS (memos));
-
- priv = memos->priv;
-
- cal_table = E_MEMO_TABLE (priv->memos_view);
- set_status_message (memos, _("Deleting selected objects..."));
- e_memo_table_delete_selected (cal_table);
- set_status_message (memos, NULL);
-
- e_cal_component_memo_preview_clear (E_CAL_COMPONENT_MEMO_PREVIEW (priv->preview));
-}
-
-
-/* Callback used from the view collection when we need to display a new view */
-static void
-display_view_cb (GalViewInstance *instance, GalView *view, gpointer data)
-{
- EMemos *memos;
-
- memos = E_MEMOS (data);
-
- if (GAL_IS_VIEW_ETABLE (view)) {
- gal_view_etable_attach_table (GAL_VIEW_ETABLE (view), e_table_scrolled_get_table (E_TABLE_SCROLLED (E_MEMO_TABLE (memos->priv->memos_view)->etable)));
- }
-
- gtk_paned_set_position ((GtkPaned *)memos->priv->paned, calendar_config_get_task_vpane_pos ());
-}
-
-/**
- * e_memos_setup_view_menus:
- * @memos: A memos widget.
- * @uic: UI controller to use for the menus.
- *
- * Sets up the #GalView menus for a memos control. This function should be
- * called from the Bonobo control activation callback for this memos control.
- * Also, the menus should be discarded using e_memos_discard_view_menus().
- */
-void
-e_memos_setup_view_menus (EMemos *memos, BonoboUIComponent *uic)
-{
- EMemosPrivate *priv;
- GalViewFactory *factory;
- ETableSpecification *spec;
- char *dir0, *dir1, *filename;
- static GalViewCollection *collection = NULL;
-
- g_return_if_fail (memos != NULL);
- g_return_if_fail (E_IS_MEMOS (memos));
- g_return_if_fail (uic != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (uic));
-
- priv = memos->priv;
-
- g_return_if_fail (priv->view_instance == NULL);
-
- g_return_if_fail (priv->view_instance == NULL);
- g_return_if_fail (priv->view_menus == NULL);
-
- /* Create the view instance */
-
- if (collection == NULL) {
- collection = gal_view_collection_new ();
-
- gal_view_collection_set_title (collection, _("Memos"));
-
- dir0 = g_build_filename (EVOLUTION_GALVIEWSDIR,
- "memos",
- NULL);
- dir1 = g_build_filename (memos_component_peek_base_directory (memos_component_peek ()),
- "views", NULL);
- gal_view_collection_set_storage_directories (collection,
- dir0,
- dir1);
- g_free (dir1);
- g_free (dir0);
-
- /* Create the views */
-
- spec = e_table_specification_new ();
- filename = g_build_filename (EVOLUTION_ETSPECDIR,
- "e-memo-table.etspec",
- NULL);
- if (!e_table_specification_load_from_file (spec, filename))
- g_error ("Unable to load ETable specification file "
- "for memos");
- g_free (filename);
-
- factory = gal_view_factory_etable_new (spec);
- g_object_unref (spec);
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- /* Load the collection and create the menus */
-
- gal_view_collection_load (collection);
- }
-
- priv->view_instance = gal_view_instance_new (collection, NULL);
-
- priv->view_menus = gal_view_menus_new (priv->view_instance);
- gal_view_menus_apply (priv->view_menus, uic, NULL);
- g_signal_connect (priv->view_instance, "display_view", G_CALLBACK (display_view_cb), memos);
- display_view_cb (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), memos);
-}
-
-/**
- * e_memos_discard_view_menus:
- * @memos: A memos widget.
- *
- * Discards the #GalView menus used by a memos control. This function should be
- * called from the Bonobo control deactivation callback for this memos control.
- * The menus should have been set up with e_memos_setup_view_menus().
- **/
-void
-e_memos_discard_view_menus (EMemos *memos)
-{
- EMemosPrivate *priv;
-
- g_return_if_fail (memos != NULL);
- g_return_if_fail (E_IS_MEMOS (memos));
-
- priv = memos->priv;
-
- g_return_if_fail (priv->view_instance != NULL);
-
- g_return_if_fail (priv->view_instance != NULL);
- g_return_if_fail (priv->view_menus != NULL);
-
- g_object_unref (priv->view_instance);
- priv->view_instance = NULL;
-
- g_object_unref (priv->view_menus);
- priv->view_menus = NULL;
-}
-
-/**
- * e_memos_get_calendar_table:
- * @memos: A memos widget.
- *
- * Queries the #EMemoTable contained in a memos widget.
- *
- * Return value: The #EMemoTable that the memos widget uses to display its
- * information.
- **/
-EMemoTable *
-e_memos_get_calendar_table (EMemos *memos)
-{
- EMemosPrivate *priv;
-
- g_return_val_if_fail (memos != NULL, NULL);
- g_return_val_if_fail (E_IS_MEMOS (memos), NULL);
-
- priv = memos->priv;
- return E_MEMO_TABLE (priv->memos_view);
-}
-
-/**
- * e_memos_get_preview:
- * @memos: A memos widget.
- *
- * Queries the #ECalComponentMemoPreview contained in a memos widget.
- **/
-GtkWidget *
-e_memos_get_preview (EMemos *memos)
-{
- g_return_val_if_fail (memos != NULL, NULL);
- g_return_val_if_fail (E_IS_MEMOS (memos), NULL);
-
- return memos->priv->preview;
-}
diff --git a/calendar/gui/e-memos.h b/calendar/gui/e-memos.h
index 0a000f0d73..7b484830fd 100644
--- a/calendar/gui/e-memos.h
+++ b/calendar/gui/e-memos.h
@@ -25,7 +25,6 @@
#ifndef _E_MEMOS_H_
#define _E_MEMOS_H_
-#include <bonobo/bonobo-ui-component.h>
#include <gtk/gtk.h>
#include <libedataserver/e-source.h>
#include <libecal/e-cal.h>
@@ -64,9 +63,6 @@ GtkWidget *e_memos_construct (EMemos *memos);
GtkWidget *e_memos_new (void);
-void e_memos_set_ui_component (EMemos *memos,
- BonoboUIComponent *ui_component);
-
gboolean e_memos_add_memo_source (EMemos *memos, ESource *source);
gboolean e_memos_remove_memo_source (EMemos *memos, ESource *source);
gboolean e_memos_set_default_source (EMemos *memos, ESource *source);
diff --git a/calendar/gui/e-task-list-selector.c b/calendar/gui/e-task-list-selector.c
new file mode 100644
index 0000000000..fa6bd328d9
--- /dev/null
+++ b/calendar/gui/e-task-list-selector.c
@@ -0,0 +1,288 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-task-list-selector.c
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-task-list-selector.h"
+
+#include <string.h>
+#include <libecal/e-cal.h>
+#include "calendar/common/authentication.h"
+#include "calendar/gui/comp-util.h"
+
+#define E_TASK_LIST_SELECTOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TASK_LIST_SELECTOR, ETaskListSelectorPrivate))
+
+struct _ETaskListSelectorPrivate {
+ gint dummy_value;
+};
+
+enum {
+ DND_TARGET_TYPE_CALENDAR_LIST
+};
+
+static GtkTargetEntry drag_types[] = {
+ { (gchar *) "text/calendar", 0, DND_TARGET_TYPE_CALENDAR_LIST },
+ { (gchar *) "text/x-calendar", 0, DND_TARGET_TYPE_CALENDAR_LIST }
+};
+
+static gpointer parent_class;
+
+static gboolean
+task_list_selector_update_single_object (ECal *client,
+ icalcomponent *icalcomp)
+{
+ gchar *uid;
+ icalcomponent *tmp_icalcomp;
+
+ uid = (gchar *) icalcomponent_get_uid (icalcomp);
+
+ if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, NULL))
+ return e_cal_modify_object (
+ client, icalcomp, CALOBJ_MOD_ALL, NULL);
+
+ return e_cal_create_object (client, icalcomp, &uid, NULL);
+}
+
+static gboolean
+task_list_selector_update_objects (ECal *client,
+ icalcomponent *icalcomp)
+{
+ icalcomponent *subcomp;
+ icalcomponent_kind kind;
+
+ kind = icalcomponent_isa (icalcomp);
+ if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT)
+ return task_list_selector_update_single_object (
+ client, icalcomp);
+ else if (kind != ICAL_VCALENDAR_COMPONENT)
+ return FALSE;
+
+ subcomp = icalcomponent_get_first_component (
+ icalcomp, ICAL_ANY_COMPONENT);
+ while (subcomp != NULL) {
+ gboolean success;
+
+ kind = icalcomponent_isa (subcomp);
+ if (kind == ICAL_VTIMEZONE_COMPONENT) {
+ icaltimezone *zone;
+
+ zone = icaltimezone_new ();
+ icaltimezone_set_component (zone, subcomp);
+
+ success = e_cal_add_timezone (client, zone, NULL);
+ icaltimezone_free (zone, 1);
+ if (!success)
+ return FALSE;
+ } else if (kind == ICAL_VTODO_COMPONENT ||
+ kind == ICAL_VEVENT_COMPONENT) {
+ success = task_list_selector_update_single_object (
+ client, subcomp);
+ if (!success)
+ return FALSE;
+ }
+
+ subcomp = icalcomponent_get_next_component (
+ icalcomp, ICAL_ANY_COMPONENT);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+task_list_selector_process_data (ESourceSelector *selector,
+ ECal *client,
+ const gchar *source_uid,
+ icalcomponent *icalcomp,
+ GdkDragAction action)
+{
+ ESourceList *source_list;
+ ESource *source;
+ icalcomponent *tmp_icalcomp = NULL;
+ const gchar *uid;
+ gchar *old_uid = NULL;
+ gboolean success = FALSE;
+ gboolean read_only = TRUE;
+ GError *error = NULL;
+
+ /* FIXME Deal with GDK_ACTION_ASK. */
+ if (action == GDK_ACTION_COPY) {
+ old_uid = g_strdup (icalcomponent_get_uid (icalcomp));
+ uid = e_cal_component_gen_uid ();
+ icalcomponent_set_uid (icalcomp, uid);
+ }
+
+ uid = icalcomponent_get_uid (icalcomp);
+ if (old_uid == NULL)
+ old_uid = g_strdup (uid);
+
+ if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, &error)) {
+ icalcomponent_free (tmp_icalcomp);
+ success = TRUE;
+ goto exit;
+ }
+
+ if (error != NULL && error->code != E_CALENDAR_STATUS_OBJECT_NOT_FOUND) {
+ g_message (
+ "Failed to search the object in destination "
+ "task list: %s", error->message);
+ g_error_free (error);
+ goto exit;
+ }
+
+ success = task_list_selector_update_objects (client, icalcomp);
+
+ if (!success || action != GDK_ACTION_MOVE)
+ goto exit;
+
+ source_list = e_source_selector_get_source_list (selector);
+ source = e_source_list_peek_source_by_uid (source_list, source_uid);
+
+ if (!E_IS_SOURCE (source) || e_source_get_readonly (source))
+ goto exit;
+
+ client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
+ if (client == NULL) {
+ g_message ("Cannot create source client to remove old task");
+ goto exit;
+ }
+
+ e_cal_is_read_only (client, &read_only, NULL);
+ if (!read_only && e_cal_open (client, TRUE, NULL))
+ e_cal_remove_object (client, old_uid, NULL);
+ else if (!read_only)
+ g_message ("Cannot open source client to remove old task");
+
+ g_object_unref (client);
+
+exit:
+ g_free (old_uid);
+
+ return success;
+}
+
+static gboolean
+task_list_selector_data_dropped (ESourceSelector *selector,
+ GtkSelectionData *selection_data,
+ ESource *destination,
+ GdkDragAction action,
+ guint info)
+{
+ ECal *client;
+ GSList *list, *iter;
+ gboolean success = FALSE;
+
+ client = auth_new_cal_from_source (
+ destination, E_CAL_SOURCE_TYPE_TODO);
+
+ if (client == NULL || !e_cal_open (client, TRUE, NULL))
+ goto exit;
+
+ list = cal_comp_selection_get_string_list (selection_data);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ gchar *source_uid = iter->data;
+ icalcomponent *icalcomp;
+ gchar *component_string;
+
+ /* Each string is "source_uid\ncomponent_string". */
+ component_string = strchr (source_uid, '\n');
+ if (component_string == NULL)
+ continue;
+
+ *component_string++ = '\0';
+ icalcomp = icalparser_parse_string (component_string);
+ if (icalcomp == NULL)
+ continue;
+
+ success = task_list_selector_process_data (
+ selector, client, source_uid, icalcomp, action);
+
+ icalcomponent_free (icalcomp);
+ }
+
+ g_slist_foreach (list, (GFunc) g_free, NULL);
+ g_slist_free (list);
+
+exit:
+ if (client != NULL)
+ g_object_unref (client);
+
+ return success;
+}
+
+static void
+task_list_selector_class_init (ETaskListSelectorClass *class)
+{
+ ESourceSelectorClass *source_selector_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ETaskListSelectorPrivate));
+
+ source_selector_class = E_SOURCE_SELECTOR_CLASS (class);
+ source_selector_class->data_dropped = task_list_selector_data_dropped;
+}
+
+static void
+task_list_selector_init (ETaskListSelector *selector)
+{
+ selector->priv = E_TASK_LIST_SELECTOR_GET_PRIVATE (selector);
+
+ gtk_drag_dest_set (
+ GTK_WIDGET (selector), GTK_DEST_DEFAULT_ALL,
+ drag_types, G_N_ELEMENTS (drag_types),
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
+}
+
+GType
+e_task_list_selector_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (ETaskListSelectorClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) task_list_selector_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ETaskListSelector),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) task_list_selector_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_SOURCE_SELECTOR, "ETaskListSelector",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_task_list_selector_new (ESourceList *source_list)
+{
+ g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+
+ return g_object_new (
+ E_TYPE_TASK_LIST_SELECTOR,
+ "source-list", source_list, NULL);
+}
diff --git a/calendar/gui/e-task-list-selector.h b/calendar/gui/e-task-list-selector.h
new file mode 100644
index 0000000000..847a221ba4
--- /dev/null
+++ b/calendar/gui/e-task-list-selector.h
@@ -0,0 +1,71 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-task-list-selector.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* XXX This widget is nearly identical to EMemoListSelector. If
+ * ECalendarSelector ever learns how to move selections from
+ * one source to another, perhaps these ESourceSelector sub-
+ * classes could someday be combined. */
+
+#ifndef E_TASK_LIST_SELECTOR_H
+#define E_TASK_LIST_SELECTOR_H
+
+#include <libedataserver/e-source-list.h>
+#include <libedataserverui/e-source-selector.h>
+
+/* Standard GObject macros */
+#define E_TYPE_TASK_LIST_SELECTOR \
+ (e_task_list_selector_get_type ())
+#define E_TASK_LIST_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_TASK_LIST_SELECTOR, ETaskListSelector))
+#define E_TASK_LIST_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_TASK_LIST_SELECTOR, ETaskListSelectorClass))
+#define E_IS_TASK_LIST_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_TASK_LIST_SELECTOR))
+#define E_IS_TASK_LIST_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_TASK_LIST_SELECTOR))
+#define E_TASK_LIST_SELECTOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_TASK_LIST_SELECTOR, ETaskListSelectorClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ETaskListSelector ETaskListSelector;
+typedef struct _ETaskListSelectorClass ETaskListSelectorClass;
+typedef struct _ETaskListSelectorPrivate ETaskListSelectorPrivate;
+
+struct _ETaskListSelector {
+ ESourceSelector parent;
+ ETaskListSelectorPrivate *priv;
+};
+
+struct _ETaskListSelectorClass {
+ ESourceSelectorClass parent_class;
+};
+
+GType e_task_list_selector_get_type (void);
+GtkWidget * e_task_list_selector_new (ESourceList *source_list);
+
+G_END_DECLS
+
+#endif /* E_TASK_LIST_SELECTOR_H */
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index 16d8b7636a..e70e90a29f 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -73,9 +73,6 @@ struct _ETasksPrivate {
/* Calendar search bar for tasks */
GtkWidget *search_bar;
- /* Tasks menu */
- ECalMenu *tasks_menu;
-
/* Paned widget */
GtkWidget *paned;
@@ -86,18 +83,12 @@ struct _ETasksPrivate {
char *sexp;
guint update_timeout;
- /* View instance and the view menus handler */
- GalViewInstance *view_instance;
- GalViewMenus *view_menus;
-
GList *notifications;
};
static void setup_widgets (ETasks *tasks);
static void e_tasks_destroy (GtkObject *object);
-static void update_view (ETasks *tasks);
-static void categories_changed_cb (gpointer object, gpointer user_data);
static void backend_error_cb (ECal *client, const char *message, gpointer data);
/* Signal IDs */
@@ -108,126 +99,10 @@ enum {
LAST_SIGNAL
};
-enum DndTargetType {
- TARGET_VCALENDAR
-};
-
-static GtkTargetEntry list_drag_types[] = {
- { (gchar *) "text/calendar", 0, TARGET_VCALENDAR },
- { (gchar *) "text/x-calendar", 0, TARGET_VCALENDAR }
-};
-static const int num_list_drag_types = sizeof (list_drag_types) / sizeof (list_drag_types[0]);
-
static guint e_tasks_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (ETasks, e_tasks, GTK_TYPE_TABLE)
-/* Callback used when the cursor changes in the table */
-static void
-table_cursor_change_cb (ETable *etable, int row, gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
- ECalModel *model;
- ECalModelComponent *comp_data;
- ECalComponent *comp;
- const char *uid;
-
- int n_selected;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- n_selected = e_table_selected_count (etable);
-
- /* update the HTML widget */
- if (n_selected != 1) {
- e_cal_component_preview_clear (E_CAL_COMPONENT_PREVIEW (priv->preview));
-
- return;
- }
-
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
-
- comp_data = e_cal_model_get_component_at (model, e_table_get_cursor_row (etable));
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
-
- e_cal_component_preview_display (E_CAL_COMPONENT_PREVIEW (priv->preview), comp_data->client, comp);
-
- e_cal_component_get_uid (comp, &uid);
- if (priv->current_uid)
- g_free (priv->current_uid);
- priv->current_uid = g_strdup (uid);
-
- g_object_unref (comp);
-}
-
-ECalMenu *
-e_tasks_get_tasks_menu (ETasks *tasks)
-{
- g_return_val_if_fail (E_IS_TASKS (tasks), NULL);
-
- return tasks->priv->tasks_menu;
-}
-
-
-/* Callback used when the selection changes in the table. */
-static void
-table_selection_change_cb (ETable *etable, gpointer data)
-{
- ETasks *tasks;
- int n_selected;
-
- tasks = E_TASKS (data);
-
- n_selected = e_table_selected_count (etable);
- g_signal_emit (tasks, e_tasks_signals[SELECTION_CHANGED], 0, n_selected);
-
- if (n_selected != 1)
- e_cal_component_preview_clear (E_CAL_COMPONENT_PREVIEW (tasks->priv->preview));
-}
-
-static void
-user_created_cb (GtkWidget *view, ETasks *tasks)
-{
- ETasksPrivate *priv;
- ECalendarTable *cal_table;
- ECal *ecal;
-
- priv = tasks->priv;
- cal_table = E_CALENDAR_TABLE (priv->tasks_view);
-
- if (cal_table->user_created_cal)
- ecal = cal_table->user_created_cal;
- else {
- ECalModel *model;
-
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
- ecal = e_cal_model_get_default_client (model);
- }
-
- e_tasks_add_todo_source (tasks, e_cal_get_source (ecal));
-}
-
-/* Callback used when the sexp in the search bar changes */
-static void
-search_bar_sexp_changed_cb (CalSearchBar *cal_search, const char *sexp, gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- if (priv->sexp)
- g_free (priv->sexp);
-
- priv->sexp = g_strdup (sexp);
-
- update_view (tasks);
-}
-
/* Callback used when the selected category in the search bar changes */
static void
search_bar_category_changed_cb (CalSearchBar *cal_search, const char *category, gpointer data)
@@ -243,194 +118,6 @@ search_bar_category_changed_cb (CalSearchBar *cal_search, const char *category,
e_cal_model_set_default_category (model, category);
}
-static gboolean
-vpaned_resized_cb (GtkWidget *widget, GdkEventButton *event, ETasks *tasks)
-{
- calendar_config_set_task_vpane_pos (gtk_paned_get_position (GTK_PANED (widget)));
-
- return FALSE;
-}
-
-static void
-set_timezone (ETasks *tasks)
-{
- ETasksPrivate *priv;
- icaltimezone *zone;
- GList *l;
-
- priv = tasks->priv;
-
- zone = calendar_config_get_icaltimezone ();
- for (l = priv->clients_list; l != NULL; l = l->next) {
- ECal *client = l->data;
- /* FIXME Error checking */
- e_cal_set_default_timezone (client, zone, NULL);
- }
-
- if (priv->default_client)
- /* FIXME Error checking */
- e_cal_set_default_timezone (priv->default_client, zone, NULL);
-
- if (priv->preview)
- e_cal_component_preview_set_default_timezone (E_CAL_COMPONENT_PREVIEW (priv->preview), zone);
-}
-
-static void
-timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- ETasks *tasks = data;
-
- set_timezone (tasks);
-}
-
-static void
-update_view (ETasks *tasks)
-{
- ETasksPrivate *priv;
- ECalModel *model;
- char *real_sexp = NULL;
- char *new_sexp = NULL;
-
- priv = tasks->priv;
-
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
-
- if ((new_sexp = calendar_config_get_hide_completed_tasks_sexp (FALSE)) != NULL) {
- real_sexp = g_strdup_printf ("(and %s %s)", new_sexp, priv->sexp);
- e_cal_model_set_search_query (model, real_sexp);
- g_free (new_sexp);
- g_free (real_sexp);
- } else
- e_cal_model_set_search_query (model, priv->sexp);
-
- e_cal_component_preview_clear (E_CAL_COMPONENT_PREVIEW (priv->preview));
-}
-
-static void
-process_completed_tasks (ETasks *tasks, gboolean config_changed)
-{
- ETasksPrivate *priv;
-
- g_return_if_fail (tasks != NULL);
- g_return_if_fail (E_IS_TASKS (tasks));
-
- priv = tasks->priv;
-
- e_calendar_table_process_completed_tasks (e_tasks_get_calendar_table (tasks), priv->clients_list, config_changed);
-}
-
-static gboolean
-update_view_cb (ETasks *tasks)
-{
- ECalModel *model;
-
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (tasks->priv->tasks_view));
-
- process_completed_tasks (tasks, FALSE);
- e_cal_model_tasks_update_due_tasks (E_CAL_MODEL_TASKS (model));
-
- return TRUE;
-}
-
-static void
-config_hide_completed_tasks_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- process_completed_tasks (data, TRUE);
- update_view (data);
-}
-
-static void
-model_row_changed_cb (ETableModel *etm, int row, gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
- ECalModelComponent *comp_data;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- if (priv->current_uid) {
- const char *uid;
-
- comp_data = e_cal_model_get_component_at (E_CAL_MODEL (etm), row);
- if (comp_data) {
- uid = icalcomponent_get_uid (comp_data->icalcomp);
- if (!strcmp (uid ? uid : "", priv->current_uid)) {
- ETable *etable;
-
- etable = e_table_scrolled_get_table (
- E_TABLE_SCROLLED (E_CALENDAR_TABLE (priv->tasks_view)->etable));
- table_cursor_change_cb (etable, 0, tasks);
- }
- }
- }
-}
-
-static void
-view_progress_cb (ECalModel *model, const char *message, int percent, ECalSourceType type, ETasks *tasks)
-{
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (e_tasks_get_calendar_table (tasks)),
- message, percent);
-}
-
-static void
-view_done_cb (ECalModel *model, ECalendarStatus status, ECalSourceType type, ETasks *tasks)
-{
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (e_tasks_get_calendar_table (tasks)),
- NULL, -1);
-
-}
-
-static void
-config_preview_state_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- gboolean state;
- GConfValue *value;
- ETasks *tasks = (ETasks *)data;
-
- g_return_if_fail (gconf_entry_get_key (entry) != NULL);
- g_return_if_fail ((value = gconf_entry_get_value (entry)) != NULL);
-
- state = gconf_value_get_bool (value);
- e_tasks_show_preview (tasks, state);
- bonobo_ui_component_set_prop (E_SEARCH_BAR (tasks->priv->search_bar)->ui_component, "/commands/ViewPreview", "state", state ? "1" : "0", NULL);
-}
-
-static void
-setup_config (ETasks *tasks)
-{
- ETasksPrivate *priv;
- guint not;
-
- priv = tasks->priv;
-
- /* Timezone */
- set_timezone (tasks);
-
- not = calendar_config_add_notification_timezone (timezone_changed_cb, tasks);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- not = calendar_config_add_notification_hide_completed_tasks (config_hide_completed_tasks_changed_cb,
- tasks);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- not = calendar_config_add_notification_hide_completed_tasks_units (config_hide_completed_tasks_changed_cb,
- tasks);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- not = calendar_config_add_notification_hide_completed_tasks_value (config_hide_completed_tasks_changed_cb,
- tasks);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- not = calendar_config_add_notification_preview_state (config_preview_state_changed_cb, tasks);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-}
-
-struct AffectedComponents {
- ECalendarTable *cal_table;
- GSList *components; /* contains pointers to ECalModelComponent */
-};
-
/**
* get_selected_components_cb
* Helper function to fill list of selected components in ECalendarTable.
@@ -614,7 +301,6 @@ setup_widgets (ETasks *tasks)
G_CALLBACK (search_bar_sexp_changed_cb), tasks);
g_signal_connect (priv->search_bar, "category_changed",
G_CALLBACK (search_bar_category_changed_cb), tasks);
- categories_changed_cb (NULL, tasks);
gtk_table_attach (GTK_TABLE (tasks), priv->search_bar, 0, 1, 0, 1,
GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0, 0);
@@ -624,8 +310,6 @@ setup_widgets (ETasks *tasks)
priv->paned = gtk_vpaned_new ();
g_signal_connect (priv->paned, "realize", G_CALLBACK (pane_realized), tasks);
- g_signal_connect (G_OBJECT (priv->paned), "button_release_event",
- G_CALLBACK (vpaned_resized_cb), tasks);
gtk_table_attach (GTK_TABLE (tasks), priv->paned, 0, 1, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (priv->paned);
@@ -665,12 +349,8 @@ setup_widgets (ETasks *tasks)
"table_drag_data_received", G_CALLBACK(table_drag_data_received_cb), editor);
*/
- g_signal_connect (etable, "cursor_change", G_CALLBACK (table_cursor_change_cb), tasks);
g_signal_connect (etable, "selection_change", G_CALLBACK (table_selection_change_cb), tasks);
- /* Timeout check to hide completed items */
- priv->update_timeout = g_timeout_add_full (G_PRIORITY_LOW, 60000, (GSourceFunc) update_view_cb, tasks, NULL);
-
/* create the task detail */
priv->preview = e_cal_component_preview_new ();
e_cal_component_preview_set_default_timezone (E_CAL_COMPONENT_PREVIEW (priv->preview), calendar_config_get_icaltimezone ());
@@ -679,15 +359,6 @@ setup_widgets (ETasks *tasks)
if (state)
gtk_widget_show (priv->preview);
-
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
- g_signal_connect (G_OBJECT (model), "model_row_changed",
- G_CALLBACK (model_row_changed_cb), tasks);
-
- g_signal_connect (G_OBJECT (model), "cal_view_progress",
- G_CALLBACK (view_progress_cb), tasks);
- g_signal_connect (G_OBJECT (model), "cal_view_done",
- G_CALLBACK (view_done_cb), tasks);
}
/* Class initialization function for the gnome calendar */
@@ -738,29 +409,6 @@ e_tasks_class_init (ETasksClass *class)
}
-static void
-categories_changed_cb (gpointer object, gpointer user_data)
-{
- GList *cat_list;
- GPtrArray *cat_array;
- ETasksPrivate *priv;
- ETasks *tasks = user_data;
-
- priv = tasks->priv;
-
- cat_array = g_ptr_array_new ();
- cat_list = e_categories_get_list ();
- while (cat_list != NULL) {
- if (e_categories_is_searchable ((const char *) cat_list->data))
- g_ptr_array_add (cat_array, cat_list->data);
- cat_list = g_list_remove (cat_list, cat_list->data);
- }
-
- cal_search_bar_set_categories ((CalSearchBar *)priv->search_bar, cat_array);
-
- g_ptr_array_free (cat_array, TRUE);
-}
-
/* Object initialization function for the gnome calendar */
static void
e_tasks_init (ETasks *tasks)
@@ -770,20 +418,13 @@ e_tasks_init (ETasks *tasks)
priv = g_new0 (ETasksPrivate, 1);
tasks->priv = priv;
- e_categories_register_change_listener (G_CALLBACK (categories_changed_cb), tasks);
-
- setup_config (tasks);
setup_widgets (tasks);
priv->clients = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
priv->query = NULL;
- priv->view_instance = NULL;
- priv->view_menus = NULL;
priv->current_uid = NULL;
priv->sexp = g_strdup ("#t");
priv->default_client = NULL;
- priv->tasks_menu = e_cal_menu_new ("org.gnome.evolution.tasks.view");
- update_view (tasks);
}
GtkWidget *
@@ -796,18 +437,6 @@ e_tasks_new (void)
return GTK_WIDGET (tasks);
}
-
-void
-e_tasks_set_ui_component (ETasks *tasks,
- BonoboUIComponent *ui_component)
-{
- g_return_if_fail (E_IS_TASKS (tasks));
- g_return_if_fail (ui_component == NULL || BONOBO_IS_UI_COMPONENT (ui_component));
-
- e_search_bar_set_ui_component (E_SEARCH_BAR (tasks->priv->search_bar), ui_component);
-}
-
-
static void
e_tasks_destroy (GtkObject *object)
{
@@ -823,8 +452,6 @@ e_tasks_destroy (GtkObject *object)
if (priv) {
GList *l;
- e_categories_unregister_change_listener (G_CALLBACK (categories_changed_cb), tasks);
-
/* disconnect from signals on all the clients */
for (l = priv->clients_list; l != NULL; l = l->next) {
g_signal_handlers_disconnect_matched (l->data, G_SIGNAL_MATCH_DATA,
@@ -848,11 +475,6 @@ e_tasks_destroy (GtkObject *object)
priv->sexp = NULL;
}
- if (priv->update_timeout) {
- g_source_remove (priv->update_timeout);
- priv->update_timeout = 0;
- }
-
if (priv->tasks_view_config) {
g_object_unref (priv->tasks_view_config);
priv->tasks_view_config = NULL;
@@ -889,160 +511,6 @@ set_status_message (ETasks *tasks, const char *message, ...)
e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->tasks_view), msg_string, -1);
}
-/* Callback from the calendar client when an error occurs in the backend */
-static void
-backend_error_cb (ECal *client, const char *message, gpointer data)
-{
- ETasks *tasks;
- GtkWidget *dialog;
- char *urinopwd;
-
- tasks = E_TASKS (data);
-
- urinopwd = get_uri_without_password (e_cal_get_uri (client));
-
- dialog = gtk_message_dialog_new (
- GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Error on %s:\n %s"),
- urinopwd, message);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- g_free (urinopwd);
-}
-
-/* Callback from the calendar client when the backend dies */
-static void
-backend_died_cb (ECal *client, gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
- ESource *source;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- source = g_object_ref (e_cal_get_source (client));
-
- priv->clients_list = g_list_remove (priv->clients_list, client);
- g_hash_table_remove (priv->clients, e_source_peek_uid (source));
-
- g_signal_emit (tasks, e_tasks_signals[SOURCE_REMOVED], 0, source);
-
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (e_tasks_get_calendar_table (tasks)), NULL, -1);
-
- e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))),
- "calendar:tasks-crashed", NULL);
-
- g_object_unref (source);
-}
-
-/* Callback from the calendar client when the calendar is opened */
-static void
-client_cal_opened_cb (ECal *ecal, ECalendarStatus status, ETasks *tasks)
-{
- ECalModel *model;
- ESource *source;
- ETasksPrivate *priv;
-
- priv = tasks->priv;
-
- source = e_cal_get_source (ecal);
-
- if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED || status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
- auth_cal_forget_password (ecal);
-
- switch (status) {
- case E_CALENDAR_STATUS_OK :
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, client_cal_opened_cb, NULL);
-
- set_status_message (tasks, _("Loading tasks"));
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
- e_cal_model_add_client (model, ecal);
-
- set_status_message (tasks, NULL);
- break;
- case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
- /* try to reopen calendar - it'll ask for a password once again */
- e_cal_open_async (ecal, FALSE);
- return;
- case E_CALENDAR_STATUS_BUSY :
- break;
- case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
- e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))), "calendar:prompt-no-contents-offline-tasks", NULL);
- default :
- /* Make sure the source doesn't disappear on us */
- g_object_ref (source);
-
- priv->clients_list = g_list_remove (priv->clients_list, ecal);
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, tasks);
-
- /* Do this last because it unrefs the client */
- g_hash_table_remove (priv->clients, e_source_peek_uid (source));
-
- g_signal_emit (tasks, e_tasks_signals[SOURCE_REMOVED], 0, source);
-
- set_status_message (tasks, NULL);
- g_object_unref (source);
-
- break;
- }
-}
-
-static void
-default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, ETasks *tasks)
-{
- ECalModel *model;
- ESource *source;
- ETasksPrivate *priv;
-
- priv = tasks->priv;
-
- source = e_cal_get_source (ecal);
-
- if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED || status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
- auth_cal_forget_password (ecal);
-
- switch (status) {
- case E_CALENDAR_STATUS_OK :
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, default_client_cal_opened_cb, NULL);
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
-
- e_cal_model_set_default_client (model, ecal);
- set_status_message (tasks, NULL);
- break;
- case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
- /* try to reopen calendar - it'll ask for a password once again */
- e_cal_open_async (ecal, FALSE);
- return;
- case E_CALENDAR_STATUS_BUSY:
- break;
- default :
- /* Make sure the source doesn't disappear on us */
- g_object_ref (source);
-
- priv->clients_list = g_list_remove (priv->clients_list, ecal);
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, tasks);
-
- /* Do this last because it unrefs the client */
- g_hash_table_remove (priv->clients, e_source_peek_uid (source));
-
- g_signal_emit (tasks, e_tasks_signals[SOURCE_REMOVED], 0, source);
-
- set_status_message (tasks, NULL);
- g_object_unref (priv->default_client);
- priv->default_client = NULL;
- g_object_unref (source);
-
- break;
- }
-}
-
typedef void (*open_func) (ECal *, ECalendarStatus, ETasks *);
static gboolean
@@ -1107,104 +575,6 @@ e_tasks_new_task (ETasks *tasks)
gtk_window_present (GTK_WINDOW (editor));
}
-void
-e_tasks_show_preview (ETasks *tasks, gboolean state)
-{
- ETasksPrivate *priv;
-
- g_return_if_fail (tasks != NULL);
- g_return_if_fail (E_IS_TASKS (tasks));
- priv = tasks->priv;
-
- if (state) {
- ECalModel *model;
- ECalModelComponent *comp_data;
- ECalComponent *comp;
- ETable *etable;
- const char *uid;
- int n_selected;
-
- etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (E_CALENDAR_TABLE (priv->tasks_view)->etable));
- n_selected = e_table_selected_count (etable);
-
- if (n_selected != 1) {
- e_cal_component_preview_clear (E_CAL_COMPONENT_PREVIEW (priv->preview));
- } else {
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
-
- comp_data = e_cal_model_get_component_at (model, e_table_get_cursor_row (etable));
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
-
- e_cal_component_preview_display (E_CAL_COMPONENT_PREVIEW (priv->preview), comp_data->client, comp);
-
- e_cal_component_get_uid (comp, &uid);
- if (priv->current_uid)
- g_free (priv->current_uid);
- priv->current_uid = g_strdup (uid);
-
- g_object_unref (comp);
- }
- gtk_widget_show (priv->preview);
-
- } else {
- e_cal_component_preview_clear (E_CAL_COMPONENT_PREVIEW (priv->preview));
- gtk_widget_hide (priv->preview);
- }
-}
-
-gboolean
-e_tasks_add_todo_source (ETasks *tasks, ESource *source)
-{
- ETasksPrivate *priv;
- ECal *client;
- const char *uid;
-
- g_return_val_if_fail (tasks != NULL, FALSE);
- g_return_val_if_fail (E_IS_TASKS (tasks), FALSE);
- g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
-
- priv = tasks->priv;
-
- uid = e_source_peek_uid (source);
- client = g_hash_table_lookup (priv->clients, uid);
- if (client) {
- /* We already have it */
-
- return TRUE;
- } else {
- ESource *default_source;
-
- if (priv->default_client) {
- default_source = e_cal_get_source (priv->default_client);
-
- /* We don't have it but the default client is it */
- if (!strcmp (e_source_peek_uid (default_source), uid))
- client = g_object_ref (priv->default_client);
- }
-
- /* Create a new one */
- if (!client) {
- client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
- if (!client)
- return FALSE;
- }
- }
-
- g_signal_connect (G_OBJECT (client), "backend_error", G_CALLBACK (backend_error_cb), tasks);
- g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), tasks);
-
- /* add the client to internal structure */
- g_hash_table_insert (priv->clients, g_strdup (uid) , client);
- priv->clients_list = g_list_prepend (priv->clients_list, client);
-
- g_signal_emit (tasks, e_tasks_signals[SOURCE_ADDED], 0, source);
-
- open_ecal (tasks, client, FALSE, client_cal_opened_cb);
-
- return TRUE;
-}
-
gboolean
e_tasks_remove_todo_source (ETasks *tasks, ESource *source)
{
@@ -1270,68 +640,6 @@ e_tasks_set_default_source (ETasks *tasks, ESource *source)
return TRUE;
}
-ECal *
-e_tasks_get_default_client (ETasks *tasks)
-{
- ETasksPrivate *priv;
-
- g_return_val_if_fail (tasks != NULL, NULL);
- g_return_val_if_fail (E_IS_TASKS (tasks), NULL);
-
- priv = tasks->priv;
-
- return e_cal_model_get_default_client (e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view)));
-}
-
-/**
- * e_tasks_complete_selected:
- * @tasks: A tasks control widget
- *
- * Marks the selected tasks complete
- **/
-void
-e_tasks_complete_selected (ETasks *tasks)
-{
- ETasksPrivate *priv;
- ECalendarTable *cal_table;
-
- g_return_if_fail (tasks != NULL);
- g_return_if_fail (E_IS_TASKS (tasks));
-
- priv = tasks->priv;
-
- cal_table = E_CALENDAR_TABLE (priv->tasks_view);
-
- set_status_message (tasks, _("Completing tasks..."));
- e_calendar_table_complete_selected (cal_table);
- set_status_message (tasks, NULL);
-}
-
-/**
- * e_tasks_delete_selected:
- * @tasks: A tasks control widget.
- *
- * Deletes the selected tasks in the task list.
- **/
-void
-e_tasks_delete_selected (ETasks *tasks)
-{
- ETasksPrivate *priv;
- ECalendarTable *cal_table;
-
- g_return_if_fail (tasks != NULL);
- g_return_if_fail (E_IS_TASKS (tasks));
-
- priv = tasks->priv;
-
- cal_table = E_CALENDAR_TABLE (priv->tasks_view);
- set_status_message (tasks, _("Deleting selected objects..."));
- e_calendar_table_delete_selected (cal_table);
- set_status_message (tasks, NULL);
-
- e_cal_component_preview_clear (E_CAL_COMPONENT_PREVIEW (priv->preview));
-}
-
/**
* e_tasks_expunge:
* @tasks: A tasks control widget
@@ -1383,126 +691,6 @@ e_tasks_delete_completed (ETasks *tasks)
g_free (sexp);
}
-/* Callback used from the view collection when we need to display a new view */
-static void
-display_view_cb (GalViewInstance *instance, GalView *view, gpointer data)
-{
- ETasks *tasks;
-
- tasks = E_TASKS (data);
-
- if (GAL_IS_VIEW_ETABLE (view)) {
- gal_view_etable_attach_table (GAL_VIEW_ETABLE (view), e_table_scrolled_get_table (E_TABLE_SCROLLED (E_CALENDAR_TABLE (tasks->priv->tasks_view)->etable)));
- }
-
- gtk_paned_set_position ((GtkPaned *)tasks->priv->paned, calendar_config_get_task_vpane_pos ());
-}
-
-/**
- * e_tasks_setup_view_menus:
- * @tasks: A tasks widget.
- * @uic: UI controller to use for the menus.
- *
- * Sets up the #GalView menus for a tasks control. This function should be
- * called from the Bonobo control activation callback for this tasks control.
- * Also, the menus should be discarded using e_tasks_discard_view_menus().
- **/
-void
-e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic)
-{
- ETasksPrivate *priv;
- GalViewFactory *factory;
- ETableSpecification *spec;
- char *dir0, *dir1, *filename;
- static GalViewCollection *collection = NULL;
-
- g_return_if_fail (tasks != NULL);
- g_return_if_fail (E_IS_TASKS (tasks));
- g_return_if_fail (uic != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (uic));
-
- priv = tasks->priv;
-
- g_return_if_fail (priv->view_instance == NULL);
-
- g_return_if_fail (priv->view_instance == NULL);
- g_return_if_fail (priv->view_menus == NULL);
-
- /* Create the view instance */
-
- if (collection == NULL) {
- collection = gal_view_collection_new ();
-
- gal_view_collection_set_title (collection, _("Tasks"));
-
- dir0 = g_build_filename (EVOLUTION_GALVIEWSDIR,
- "tasks",
- NULL);
- dir1 = g_build_filename (tasks_component_peek_base_directory (tasks_component_peek ()),
- "tasks", "views", NULL);
- gal_view_collection_set_storage_directories (collection,
- dir0,
- dir1);
- g_free (dir1);
- g_free (dir0);
-
- /* Create the views */
-
- spec = e_table_specification_new ();
- filename = g_build_filename (EVOLUTION_ETSPECDIR,
- "e-calendar-table.etspec",
- NULL);
- if (!e_table_specification_load_from_file (spec, filename))
- g_error ("Unable to load ETable specification file "
- "for tasks");
- g_free (filename);
-
- factory = gal_view_factory_etable_new (spec);
- g_object_unref (spec);
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- /* Load the collection and create the menus */
-
- gal_view_collection_load (collection);
- }
-
- priv->view_instance = gal_view_instance_new (collection, NULL);
-
- priv->view_menus = gal_view_menus_new (priv->view_instance);
- gal_view_menus_apply (priv->view_menus, uic, NULL);
- g_signal_connect (priv->view_instance, "display_view", G_CALLBACK (display_view_cb), tasks);
- display_view_cb (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), tasks);
-}
-
-/**
- * e_tasks_discard_view_menus:
- * @tasks: A tasks widget.
- *
- * Discards the #GalView menus used by a tasks control. This function should be
- * called from the Bonobo control deactivation callback for this tasks control.
- * The menus should have been set up with e_tasks_setup_view_menus().
- **/
-void
-e_tasks_discard_view_menus (ETasks *tasks)
-{
- ETasksPrivate *priv;
-
- g_return_if_fail (tasks != NULL);
- g_return_if_fail (E_IS_TASKS (tasks));
-
- priv = tasks->priv;
-
- g_return_if_fail (priv->view_instance != NULL);
- g_return_if_fail (priv->view_menus != NULL);
-
- g_object_unref (priv->view_instance);
- priv->view_instance = NULL;
-
- g_object_unref (priv->view_menus);
- priv->view_menus = NULL;
-}
-
void
e_tasks_open_task_id (ETasks *tasks,
const char *src_uid,
@@ -1541,39 +729,3 @@ e_tasks_open_task_id (ETasks *tasks,
return;
}
-
-/**
- * e_tasks_get_calendar_table:
- * @tasks: A tasks widget.
- *
- * Queries the #ECalendarTable contained in a tasks widget.
- *
- * Return value: The #ECalendarTable that the tasks widget uses to display its
- * information.
- **/
-ECalendarTable *
-e_tasks_get_calendar_table (ETasks *tasks)
-{
- ETasksPrivate *priv;
-
- g_return_val_if_fail (tasks != NULL, NULL);
- g_return_val_if_fail (E_IS_TASKS (tasks), NULL);
-
- priv = tasks->priv;
- return E_CALENDAR_TABLE (priv->tasks_view);
-}
-
-/**
- * e_tasks_get_preview:
- * @tasks: A tasks widget.
- *
- * Queries the #ECalComponentPreview contained in a tasks widget.
- **/
-GtkWidget *
-e_tasks_get_preview (ETasks *tasks)
-{
- g_return_val_if_fail (tasks != NULL, NULL);
- g_return_val_if_fail (E_IS_TASKS (tasks), NULL);
-
- return tasks->priv->preview;
-}
diff --git a/calendar/gui/e-tasks.h b/calendar/gui/e-tasks.h
index 67989ee021..578da81625 100644
--- a/calendar/gui/e-tasks.h
+++ b/calendar/gui/e-tasks.h
@@ -63,30 +63,15 @@ GtkWidget *e_tasks_construct (ETasks *tasks);
GtkWidget *e_tasks_new (void);
-void e_tasks_set_ui_component (ETasks *tasks,
- BonoboUIComponent *ui_component);
-
gboolean e_tasks_add_todo_source (ETasks *tasks, ESource *source);
gboolean e_tasks_remove_todo_source (ETasks *tasks, ESource *source);
gboolean e_tasks_set_default_source (ETasks *tasks, ESource *source);
-ECal *e_tasks_get_default_client (ETasks *tasks);
-
void e_tasks_open_task (ETasks *tasks);
void e_tasks_open_task_id (ETasks *tasks,
const char *src_uid,
const char *comp_uid,
const char *comp_rid);
void e_tasks_new_task (ETasks *tasks);
-void e_tasks_complete_selected (ETasks *tasks);
-void e_tasks_delete_selected (ETasks *tasks);
void e_tasks_delete_completed (ETasks *tasks);
-void e_tasks_show_preview (ETasks *tasks, gboolean state);
-void e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic);
-void e_tasks_discard_view_menus (ETasks *tasks);
-
-struct _ECalMenu *e_tasks_get_tasks_menu (ETasks *tasks);
-ECalendarTable *e_tasks_get_calendar_table (ETasks *tasks);
-GtkWidget *e_tasks_get_preview (ETasks *tasks);
-
#endif /* _E_TASKS_H_ */
diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c
index e1c090b196..c2095dc90b 100644
--- a/calendar/gui/e-week-view-main-item.c
+++ b/calendar/gui/e-week-view-main-item.c
@@ -29,7 +29,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include "e-week-view-main-item.h"
-#include "ea-calendar.h"
+#include "a11y/ea-calendar.h"
static void e_week_view_main_item_set_property (GObject *object,
guint property_id,
@@ -91,8 +91,10 @@ e_week_view_main_item_class_init (EWeekViewMainItemClass *class)
NULL,
G_PARAM_WRITABLE));
+#if 0 /* KILL-BONOBO */
/* init the accessibility support for e_week_view_main_item */
e_week_view_main_item_a11y_init ();
+#endif
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 57c0547af0..f2082c5f11 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -30,7 +30,7 @@
#endif
#include "e-week-view.h"
-#include "ea-calendar.h"
+#include "a11y/ea-calendar.h"
#include <math.h>
#include <gdk/gdkkeysyms.h>
@@ -39,7 +39,7 @@
#include <text/e-text.h>
#include <misc/e-canvas-utils.h>
#include <misc/e-gui-utils.h>
-#include <misc/e-unicode.h>
+#include <e-util/e-unicode.h>
#include <e-util/e-categories-config.h>
#include <e-util/e-dialog-utils.h>
#include <e-util/e-util.h>
@@ -51,7 +51,6 @@
#include "comp-util.h"
#include "itip-utils.h"
#include <libecal/e-cal-time-util.h>
-#include "calendar-commands.h"
#include "calendar-config.h"
#include "print.h"
#include "goto.h"
@@ -226,8 +225,10 @@ e_week_view_class_init (EWeekViewClass *class)
view_class->get_visible_time_range = e_week_view_get_visible_time_range;
view_class->paste_text = e_week_view_paste_text;
+#if 0 /* KILL-BONOBO */
/* init the accessibility support for e_week_view */
e_week_view_a11y_init ();
+#endif
}
static void
@@ -1937,6 +1938,9 @@ set_text_as_bold (EWeekViewEvent *event, EWeekViewEventSpan *span)
break;
}
}
+ e_cal_component_free_attendee_list (attendees);
+ g_free (address);
+ g_object_unref (comp);
/* The attendee has not yet accepted the meeting, display the summary as bolded.
If the attendee is not present, it might have come through a mailing list.
@@ -3612,8 +3616,10 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
if (!on_server) {
if (!e_cal_create_object (client, icalcomp, NULL, NULL))
g_message (G_STRLOC ": Could not create the object!");
+#if 0 /* KILL-BONOBO */
else
gnome_calendar_emit_user_created_signal (week_view, e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view)), client);
+#endif
/* we remove the object since we either got the update from the server or failed */
e_week_view_remove_event_cb (week_view, event_num, NULL);
@@ -4032,6 +4038,8 @@ e_week_view_cursor_key_right (EWeekView *week_view, GnomeCalendarViewType view_t
static gboolean
e_week_view_add_new_event_in_selected_range (EWeekView *week_view, const gchar *initial_text)
{
+#if 0 /* KILL-BONOBO */
+ EWeekView *week_view;
ECal *ecal;
ECalModel *model;
ECalComponent *comp;
@@ -4220,6 +4228,7 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
g_free (initial_text);
return ret_val;
+#endif
}
static gint
@@ -4255,6 +4264,7 @@ e_week_view_get_adjust_days_for_move_right (EWeekView *week_view,gint current_da
static gboolean
e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
{
+#if 0 /* KILL-BONOBO */
gboolean handled = FALSE;
handled = e_week_view_do_key_press (widget, event);
@@ -4262,6 +4272,7 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
if (!handled)
handled = GTK_WIDGET_CLASS (e_week_view_parent_class)->key_press_event (widget, event);
return handled;
+#endif
}
static void
@@ -4281,9 +4292,11 @@ e_week_view_show_popup_menu (EWeekView *week_view,
week_view->popup_event_num = event_num;
+#if 0 /* KILL-BONOBO */
popup = e_calendar_view_create_popup_menu (E_CALENDAR_VIEW (week_view));
g_object_weak_ref (G_OBJECT (popup), popup_destroyed_cb, week_view);
gtk_menu_popup (popup, NULL, NULL, NULL, NULL, bevent?bevent->button:0, bevent?bevent->time:gtk_get_current_event_time());
+#endif
}
static gboolean
@@ -4298,6 +4311,7 @@ e_week_view_popup_menu (GtkWidget *widget)
void
e_week_view_jump_to_button_item (EWeekView *week_view, GnomeCanvasItem *item)
{
+#if 0 /* KILL-BONOBO */
gint day;
GnomeCalendar *calendar;
@@ -4313,6 +4327,7 @@ e_week_view_jump_to_button_item (EWeekView *week_view, GnomeCanvasItem *item)
return;
}
}
+#endif
}
static gboolean
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 18f4a47276..7e0043d12a 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -53,7 +53,6 @@
#include "e-comp-editor-registry.h"
#include "dialogs/delete-error.h"
#include "dialogs/event-editor.h"
-#include "dialogs/task-editor.h"
#include "comp-util.h"
#include "e-cal-model-calendar.h"
#include "e-day-view.h"
@@ -65,11 +64,9 @@
#include "e-cal-list-view-config.h"
#include "e-mini-calendar-config.h"
#include "e-calendar-table-config.h"
-#include "e-memo-table-config.h"
#include "evolution-calendar.h"
#include "gnome-cal.h"
#include "calendar-component.h"
-#include "memos-component.h"
#include "cal-search-bar.h"
#include "calendar-commands.h"
#include "calendar-config.h"
@@ -77,11 +74,10 @@
#include "calendar-view-factory.h"
#include "tag-calendar.h"
#include "misc.h"
-#include "ea-calendar.h"
+#include "a11y/ea-calendar.h"
#include "common/authentication.h"
#include "e-cal-popup.h"
#include "e-cal-menu.h"
-#include "e-cal-model-tasks.h"
/* FIXME glib 2.4 and above has this */
#ifndef G_MAXINT32
@@ -97,9 +93,9 @@ static GHashTable *non_intrusive_error_table = NULL;
struct _GnomeCalendarPrivate {
/* The clients for display */
- GHashTable *clients[E_CAL_SOURCE_TYPE_LAST];
- GList *clients_list[E_CAL_SOURCE_TYPE_LAST];
- ECal *default_client[E_CAL_SOURCE_TYPE_LAST];
+ GHashTable *clients;
+ GList *clients_list;
+ ECal *default_client;
/*
* Fields for the calendar view
@@ -118,11 +114,6 @@ struct _GnomeCalendarPrivate {
ECalendar *date_navigator;
EMiniCalendarConfig *date_navigator_config;
- GtkWidget *todo;
- ECalendarTableConfig *todo_config;
-
- GtkWidget *memo;
- EMemoTableConfig *memo_config;
GtkWidget *day_view;
GtkWidget *work_week_view;
@@ -135,8 +126,6 @@ struct _GnomeCalendarPrivate {
/* plugin menu managers */
ECalMenu *calendar_menu;
- ECalMenu *taskpad_menu;
- ECalMenu *memopad_menu;
/* Calendar query for the date navigator */
GList *dn_queries; /* list of CalQueries */
@@ -167,10 +156,6 @@ struct _GnomeCalendarPrivate {
/* The signal handler id for our GtkCalendar "day_selected" handler. */
guint day_selected_id;
- /* View instance and menus for the control */
- GalViewInstance *view_instance;
- GalViewMenus *view_menus;
-
/* Our current week start */
int week_start;
@@ -201,11 +186,6 @@ struct _GnomeCalendarPrivate {
enum {
DATES_SHOWN_CHANGED,
CALENDAR_SELECTION_CHANGED,
- TASKPAD_SELECTION_CHANGED,
- MEMOPAD_SELECTION_CHANGED,
- CALENDAR_FOCUS_CHANGE,
- TASKPAD_FOCUS_CHANGE,
- MEMOPAD_FOCUS_CHANGE,
GOTO_DATE,
SOURCE_ADDED,
SOURCE_REMOVED,
@@ -213,14 +193,6 @@ enum {
LAST_SIGNAL
};
-/* Used to indicate who has the focus within the calendar view */
-typedef enum {
- FOCUS_CALENDAR,
- FOCUS_TASKPAD,
- FOCUS_MEMOPAD,
- FOCUS_OTHER
-} FocusLocation;
-
static guint gnome_calendar_signals[LAST_SIGNAL];
@@ -317,55 +289,6 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- gnome_calendar_signals[TASKPAD_SELECTION_CHANGED] =
- g_signal_new ("taskpad_selection_changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GnomeCalendarClass, taskpad_selection_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- gnome_calendar_signals[MEMOPAD_SELECTION_CHANGED] =
- g_signal_new ("memopad_selection_changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GnomeCalendarClass, memopad_selection_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-
- gnome_calendar_signals[CALENDAR_FOCUS_CHANGE] =
- g_signal_new ("calendar_focus_change",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GnomeCalendarClass, calendar_focus_change),
- NULL, NULL,
- g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE, 1,
- G_TYPE_BOOLEAN);
-
- gnome_calendar_signals[TASKPAD_FOCUS_CHANGE] =
- g_signal_new ("taskpad_focus_change",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GnomeCalendarClass, taskpad_focus_change),
- NULL, NULL,
- g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE, 1,
- G_TYPE_BOOLEAN);
-
- gnome_calendar_signals[MEMOPAD_FOCUS_CHANGE] =
- g_signal_new ("memopad_focus_change",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GnomeCalendarClass, memopad_focus_change),
- NULL, NULL,
- g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE, 1,
- G_TYPE_BOOLEAN);
-
gnome_calendar_signals[SOURCE_ADDED] =
g_signal_new ("source_added",
G_TYPE_FROM_CLASS (object_class),
@@ -414,11 +337,6 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
class->dates_shown_changed = NULL;
class->calendar_selection_changed = NULL;
- class->taskpad_selection_changed = NULL;
- class->memopad_selection_changed = NULL;
- class->calendar_focus_change = NULL;
- class->taskpad_focus_change = NULL;
- class->memopad_focus_change = NULL;
class->source_added = NULL;
class->source_removed = NULL;
class->goto_date = gnome_calendar_goto_date;
@@ -725,69 +643,6 @@ get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_
}
}
-/* Gets the focus location based on who is the focused widget within the
- * calendar view.
- */
-static FocusLocation
-get_focus_location (GnomeCalendar *gcal)
-{
- GnomeCalendarPrivate *priv;
- ETable *etable, *m_etable;
-
- priv = gcal->priv;
-
- etable = e_calendar_table_get_table (E_CALENDAR_TABLE (priv->todo));
- m_etable = e_memo_table_get_table (E_MEMO_TABLE (priv->memo));
-
- if (GTK_WIDGET_HAS_FOCUS (etable->table_canvas))
- return FOCUS_TASKPAD;
- else if (GTK_WIDGET_HAS_FOCUS (m_etable->table_canvas))
- return FOCUS_MEMOPAD;
- else {
- GtkWidget *widget;
- EDayView *dv;
- EWeekView *wv;
- ECalListView *lv;
-
- widget = gnome_calendar_get_current_view_widget (gcal);
-
- switch (priv->current_view_type) {
- case GNOME_CAL_DAY_VIEW:
- case GNOME_CAL_WORK_WEEK_VIEW:
- dv = E_DAY_VIEW (widget);
-
- if (GTK_WIDGET_HAS_FOCUS (dv->top_canvas)
- || GNOME_CANVAS (dv->top_canvas)->focused_item != NULL
- || GTK_WIDGET_HAS_FOCUS (dv->main_canvas)
- || GNOME_CANVAS (dv->main_canvas)->focused_item != NULL)
- return FOCUS_CALENDAR;
- else
- return FOCUS_OTHER;
-
- case GNOME_CAL_WEEK_VIEW:
- case GNOME_CAL_MONTH_VIEW:
- wv = E_WEEK_VIEW (widget);
-
- if (GTK_WIDGET_HAS_FOCUS (wv->main_canvas)
- || GNOME_CANVAS (wv->main_canvas)->focused_item != NULL)
- return FOCUS_CALENDAR;
- else
- return FOCUS_OTHER;
-
- case GNOME_CAL_LIST_VIEW:
- lv = E_CAL_LIST_VIEW (widget);
-
- if (GTK_WIDGET_HAS_FOCUS (e_table_scrolled_get_table (lv->table_scrolled)))
- return FOCUS_CALENDAR;
- else
- return FOCUS_OTHER;
-
- default:
- g_return_val_if_reached (FOCUS_OTHER);
- }
- }
-}
-
/* Computes the range of time that the date navigator is showing */
static void
get_date_navigator_range (GnomeCalendar *gcal, time_t *start_time, time_t *end_time)
@@ -891,7 +746,7 @@ update_query_async (struct _date_query_msg *msg)
}
/* create queries for each loaded client */
- for (l = priv->clients_list[E_CAL_SOURCE_TYPE_EVENT]; l != NULL; l = l->next) {
+ for (l = priv->clients_list; l != NULL; l = l->next) {
GError *error = NULL;
gint tries = 0;
@@ -1061,8 +916,9 @@ search_bar_category_changed_cb (CalSearchBar *cal_search, const char *category,
category);
}
+ /* [KILL-BONOBO] Delete this when moved to ECalShellView.
model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo));
- e_cal_model_set_default_category (model, category);
+ e_cal_model_set_default_category (model, category); */
}
static void
@@ -1113,112 +969,6 @@ user_created_cb (GtkWidget *view, GnomeCalendar *gcal)
}
-/* Callback used when the taskpad receives a focus event. We emit the
- * corresponding signal so that parents can change the menus as appropriate.
- */
-static gint
-table_canvas_focus_change_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- g_signal_emit (gcal, gnome_calendar_signals [TASKPAD_FOCUS_CHANGE], 0,
- event->in ? TRUE : FALSE);
-
- return FALSE;
-}
-
-static gint
-memo_canvas_focus_change_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- g_signal_emit (gcal, gnome_calendar_signals [MEMOPAD_FOCUS_CHANGE], 0,
- event->in ? TRUE : FALSE);
-
- return FALSE;
-}
-
-static gint
-calendar_focus_change_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- g_signal_emit (gcal, gnome_calendar_signals [CALENDAR_FOCUS_CHANGE], 0,
- event->in ? TRUE : FALSE);
-
- return FALSE;
-}
-
-/* Connects to the focus change signals of a day view widget */
-static void
-connect_day_view_focus (GnomeCalendar *gcal, EDayView *dv)
-{
- g_signal_connect_after (dv->top_canvas, "focus_in_event",
- G_CALLBACK (calendar_focus_change_cb), gcal);
- g_signal_connect_after (dv->top_canvas, "focus_out_event",
- G_CALLBACK (calendar_focus_change_cb), gcal);
-
- g_signal_connect_after (dv->main_canvas, "focus_in_event",
- G_CALLBACK (calendar_focus_change_cb), gcal);
- g_signal_connect_after (dv->main_canvas, "focus_out_event",
- G_CALLBACK (calendar_focus_change_cb), gcal);
-}
-
-/* Connects to the focus change signals of a week view widget */
-static void
-connect_week_view_focus (GnomeCalendar *gcal, EWeekView *wv)
-{
- if (!E_IS_WEEK_VIEW (wv))
- return;
-
- g_signal_connect (wv->main_canvas, "focus_in_event",
- G_CALLBACK (calendar_focus_change_cb), gcal);
- g_signal_connect (wv->main_canvas, "focus_out_event",
- G_CALLBACK (calendar_focus_change_cb), gcal);
-}
-
-static void
-connect_list_view_focus (GnomeCalendar *gcal, ECalListView *lv)
-{
- ETable *etable;
-
- etable = e_table_scrolled_get_table (lv->table_scrolled);
-
- g_signal_connect (etable->table_canvas, "focus_in_event",
- G_CALLBACK (calendar_focus_change_cb), gcal);
- g_signal_connect (etable->table_canvas, "focus_out_event",
- G_CALLBACK (calendar_focus_change_cb), gcal);
-}
-
-/* Callback used when the selection in the taskpad table changes. We just proxy
- * the signal with our own one.
- */
-static void
-table_selection_change_cb (ETable *etable, gpointer data)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- g_signal_emit (gcal, gnome_calendar_signals[TASKPAD_SELECTION_CHANGED], 0);
-}
-
-static void
-memo_selection_change_cb (ETable *etable, gpointer data)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- g_signal_emit (gcal, gnome_calendar_signals[MEMOPAD_SELECTION_CHANGED], 0);
-}
-
static void
set_week_start (GnomeCalendar *calendar)
{
@@ -1271,27 +1021,18 @@ static void
set_timezone (GnomeCalendar *calendar)
{
GnomeCalendarPrivate *priv;
- int i;
+ GList *l;
priv = calendar->priv;
priv->zone = calendar_config_get_icaltimezone ();
- for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) {
- GList *l;
-
- for (l = priv->clients_list[i]; l != NULL; l = l->next) {
- ECal *client = l->data;
-
- if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
- /* FIXME Error checking */
- e_cal_set_default_timezone (client, priv->zone, NULL);
- }
+ for (l = priv->clients_list; l != NULL; l = l->next) {
+ ECal *client = l->data;
- if (priv->default_client[i]
- && e_cal_get_load_state (priv->default_client[i]) == E_CAL_LOAD_LOADED)
+ if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
/* FIXME Error checking */
- e_cal_set_default_timezone (priv->default_client[i], priv->zone, NULL);
+ e_cal_set_default_timezone (client, priv->zone, NULL);
}
if (priv->views [priv->current_view_type])
@@ -1567,26 +1308,15 @@ categories_changed_cb (gpointer object, gpointer user_data)
static void
view_progress_cb (ECalModel *model, const char *message, int percent, ECalSourceType type, GnomeCalendar *gcal)
{
- if (type == E_CAL_SOURCE_TYPE_EVENT) {
+ if (type == E_CAL_SOURCE_TYPE_EVENT)
e_calendar_view_set_status_message (E_CALENDAR_VIEW (gcal->priv->week_view), message, percent);
- } else if (type == E_CAL_SOURCE_TYPE_TODO) {
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (gcal->priv->todo), message, percent);
- } else if (type == E_CAL_SOURCE_TYPE_JOURNAL) {
- e_memo_table_set_status_message (E_MEMO_TABLE (gcal->priv->memo), message);
- }
}
static void
view_done_cb (ECalModel *model, ECalendarStatus status, ECalSourceType type, GnomeCalendar *gcal)
{
- if (type == E_CAL_SOURCE_TYPE_EVENT) {
+ if (type == E_CAL_SOURCE_TYPE_EVENT)
e_calendar_view_set_status_message (E_CALENDAR_VIEW (gcal->priv->week_view), NULL, -1);
- } else if (type == E_CAL_SOURCE_TYPE_TODO) {
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (gcal->priv->todo), NULL, -1);
- } else if (type == E_CAL_SOURCE_TYPE_JOURNAL) {
- e_memo_table_set_status_message (E_MEMO_TABLE (gcal->priv->memo), NULL);
- }
-
}
GtkWidget *
@@ -1691,36 +1421,11 @@ setup_widgets (GnomeCalendar *gcal)
g_free (tmp);
gtk_box_pack_start ((GtkBox *)vbox, label, FALSE, TRUE, 0);
- priv->todo = e_calendar_table_new ();
- priv->todo_config = e_calendar_table_config_new (E_CALENDAR_TABLE (priv->todo));
- gtk_paned_pack1 (GTK_PANED (priv->vpane), vbox, FALSE, FALSE);
- gtk_box_pack_end ((GtkBox *)vbox, priv->todo, TRUE, TRUE, 0);
-
- gtk_widget_show (priv->todo);
gtk_widget_show (label);
gtk_widget_show (vbox);
gtk_widget_show (sep);
- filename = g_build_filename (calendar_component_peek_config_directory (calendar_component_peek ()),
- "TaskPad", NULL);
- e_calendar_table_load_state (E_CALENDAR_TABLE (priv->todo), filename);
-
/* update_todo_view (gcal); */
- g_free (filename);
-
- etable = e_calendar_table_get_table (E_CALENDAR_TABLE (priv->todo));
- g_signal_connect (etable->table_canvas, "focus_in_event",
- G_CALLBACK (table_canvas_focus_change_cb), gcal);
- g_signal_connect (etable->table_canvas, "focus_out_event",
- G_CALLBACK (table_canvas_focus_change_cb), gcal);
-
- g_signal_connect (etable, "selection_change",
- G_CALLBACK (table_selection_change_cb), gcal);
-
- g_signal_connect (e_calendar_table_get_model ((ECalendarTable *)priv->todo), "cal_view_progress",
- G_CALLBACK (view_progress_cb), gcal);
- g_signal_connect (e_calendar_table_get_model ((ECalendarTable *)priv->todo), "cal_view_done",
- G_CALLBACK (view_done_cb), gcal);
/* Timeout check to hide completed items */
priv->update_timeout = g_timeout_add_full (G_PRIORITY_LOW, 60000, (GSourceFunc) update_todo_view_cb, gcal, NULL);
@@ -1735,7 +1440,6 @@ setup_widgets (GnomeCalendar *gcal)
e_calendar_view_set_timezone (E_CALENDAR_VIEW (priv->day_view), priv->zone);
g_signal_connect (priv->day_view, "selection_changed",
G_CALLBACK (view_selection_changed_cb), gcal);
- connect_day_view_focus (gcal, E_DAY_VIEW (priv->day_view));
/* The Work Week View. */
priv->work_week_view = e_day_view_new (cal_model);
@@ -1744,7 +1448,6 @@ setup_widgets (GnomeCalendar *gcal)
e_day_view_set_days_shown (E_DAY_VIEW (priv->work_week_view), 5);
e_calendar_view_set_calendar (E_CALENDAR_VIEW (priv->work_week_view), gcal);
e_calendar_view_set_timezone (E_CALENDAR_VIEW (priv->work_week_view), priv->zone);
- connect_day_view_focus (gcal, E_DAY_VIEW (priv->work_week_view));
/* The Marcus Bains line */
priv->update_marcus_bains_line_timeout = g_timeout_add_full (G_PRIORITY_LOW, 60000, (GSourceFunc) update_marcus_bains_line_cb, gcal, NULL);
@@ -1756,8 +1459,6 @@ setup_widgets (GnomeCalendar *gcal)
g_signal_connect (priv->week_view, "selection_changed",
G_CALLBACK (view_selection_changed_cb), gcal);
- connect_week_view_focus (gcal, E_WEEK_VIEW (priv->week_view));
-
adjustment = gtk_range_get_adjustment (GTK_RANGE (E_WEEK_VIEW (priv->week_view)->vscrollbar));
g_signal_connect (adjustment, "value_changed",
G_CALLBACK (week_view_adjustment_changed_cb),
@@ -1777,8 +1478,6 @@ setup_widgets (GnomeCalendar *gcal)
g_signal_connect (priv->month_view, "selection_changed",
G_CALLBACK (view_selection_changed_cb), gcal);
- connect_week_view_focus (gcal, E_WEEK_VIEW (priv->month_view));
-
adjustment = gtk_range_get_adjustment (GTK_RANGE (E_WEEK_VIEW (priv->month_view)->vscrollbar));
g_signal_connect (adjustment, "value_changed",
G_CALLBACK (month_view_adjustment_changed_cb),
@@ -1792,8 +1491,6 @@ setup_widgets (GnomeCalendar *gcal)
g_signal_connect (priv->list_view, "selection_changed",
G_CALLBACK (view_selection_changed_cb), gcal);
- connect_list_view_focus (gcal, E_CAL_LIST_VIEW (priv->list_view));
-
priv->views[GNOME_CAL_DAY_VIEW] = E_CALENDAR_VIEW (priv->day_view);
priv->configs[GNOME_CAL_DAY_VIEW] = G_OBJECT (e_day_view_config_new (E_DAY_VIEW (priv->views[GNOME_CAL_DAY_VIEW])));
priv->views[GNOME_CAL_WORK_WEEK_VIEW] = E_CALENDAR_VIEW (priv->work_week_view);
@@ -1822,38 +1519,14 @@ setup_widgets (GnomeCalendar *gcal)
gtk_label_set_markup ((GtkLabel *)label, tmp);
g_free (tmp);
gtk_box_pack_start ((GtkBox *)vbox, label, FALSE, TRUE, 0);
- priv->memo = e_memo_table_new ();
- priv->memo_config = e_memo_table_config_new (E_MEMO_TABLE (priv->memo));
- gtk_paned_pack2 (GTK_PANED (priv->vpane), vbox, TRUE, FALSE);
- gtk_box_pack_end ((GtkBox *)vbox, priv->memo, TRUE, TRUE, 0);
-
- gtk_widget_show (priv->memo);
gtk_widget_show (label);
gtk_widget_show (vbox);
- filename = g_build_filename (memos_component_peek_config_directory (memos_component_peek ()),
- "MemoPad", NULL);
- e_memo_table_load_state (E_MEMO_TABLE (priv->memo), filename);
+ e_cal_model_set_default_time_func (e_memo_table_get_model (E_MEMO_TABLE (priv->memo)), gc_get_default_time, gcal);
e_cal_model_set_default_time_func (e_memo_table_get_model (E_MEMO_TABLE (priv->memo)), gc_get_default_time, gcal);
update_memo_view (gcal);
- g_free (filename);
-
- etable = e_memo_table_get_table (E_MEMO_TABLE (priv->memo));
- g_signal_connect (etable->table_canvas, "focus_in_event",
- G_CALLBACK (memo_canvas_focus_change_cb), gcal);
- g_signal_connect (etable->table_canvas, "focus_out_event",
- G_CALLBACK (memo_canvas_focus_change_cb), gcal);
-
- g_signal_connect (etable, "selection_change",
- G_CALLBACK (memo_selection_change_cb), gcal);
-
- g_signal_connect (e_memo_table_get_model ((EMemoTable *)priv->memo), "cal_view_progress",
- G_CALLBACK (view_progress_cb), gcal);
- g_signal_connect (e_memo_table_get_model ((EMemoTable *)priv->memo), "cal_view_done",
- G_CALLBACK (view_done_cb), gcal);
-
}
/* Object initialization function for the gnome calendar */
@@ -1861,13 +1534,14 @@ static void
gnome_calendar_init (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
- int i;
priv = g_new0 (GnomeCalendarPrivate, 1);
gcal->priv = priv;
- for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++)
- priv->clients[i] = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+ priv->clients = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+
+ if (non_intrusive_error_table == NULL)
+ non_intrusive_error_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
if (non_intrusive_error_table == NULL)
non_intrusive_error_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
@@ -1884,8 +1558,6 @@ gnome_calendar_init (GnomeCalendar *gcal)
setup_widgets (gcal);
priv->calendar_menu = e_cal_menu_new("org.gnome.evolution.calendar.view");
- priv->taskpad_menu = e_cal_menu_new("org.gnome.evolution.calendar.taskpad");
- priv->memopad_menu = e_cal_menu_new ("org.gnome.evolution.calendar.memopad");
priv->dn_queries = NULL;
priv->sexp = g_strdup ("#t"); /* Match all */
@@ -1893,7 +1565,6 @@ gnome_calendar_init (GnomeCalendar *gcal)
priv->memo_sexp = g_strdup ("#t");
priv->view_instance = NULL;
- priv->view_menus = NULL;
priv->visible_start = -1;
priv->visible_end = -1;
@@ -1921,37 +1592,24 @@ gnome_calendar_destroy (GtkObject *object)
e_categories_unregister_change_listener (G_CALLBACK (categories_changed_cb), gcal);
/* Clean up the clients */
- for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) {
- for (l = priv->clients_list[i]; l != NULL; l = l->next) {
- ESource *source = e_cal_get_source (l->data);
-
- g_signal_handlers_disconnect_matched (l->data, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, gcal);
-
- if (source)
- g_signal_handlers_disconnect_matched (source, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, gcal);
- }
-
- g_hash_table_destroy (priv->clients[i]);
- g_list_free (priv->clients_list[i]);
-
- priv->clients[i] = NULL;
- priv->clients_list[i] = NULL;
-
- if (priv->default_client[i]) {
- ESource *source = e_cal_get_source (priv->default_client[i]);
+ for (l = priv->clients_list; l != NULL; l = l->next) {
+ g_signal_handlers_disconnect_matched (l->data, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, gcal);
+ }
- g_signal_handlers_disconnect_matched (priv->default_client[i],
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, gcal);
+ g_hash_table_destroy (priv->clients);
+ g_list_free (priv->clients_list);
- if (source)
- g_signal_handlers_disconnect_matched (source, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, gcal);
+ priv->clients = NULL;
+ priv->clients_list = NULL;
- g_object_unref (priv->default_client[i]);
- }
- priv->default_client[i] = NULL;
+ if (priv->default_client) {
+ g_signal_handlers_disconnect_matched (priv->default_client,
+ G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, gcal);
+ g_object_unref (priv->default_client);
}
+ priv->default_client = NULL;
for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) {
if (priv->configs[i])
@@ -1959,26 +1617,12 @@ gnome_calendar_destroy (GtkObject *object)
priv->configs[i] = NULL;
}
g_object_unref (priv->date_navigator_config);
- g_object_unref (priv->todo_config);
- g_object_unref (priv->memo_config);
for (l = priv->notifications; l; l = l->next)
calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
g_list_free (priv->notifications);
priv->notifications = NULL;
- /* Save the TaskPad layout. */
- filename = g_build_filename (calendar_component_peek_config_directory (calendar_component_peek ()),
- "TaskPad", NULL);
- e_calendar_table_save_state (E_CALENDAR_TABLE (priv->todo), filename);
- g_free (filename);
-
- /* Save the MemoPad layout. */
- filename = g_build_filename (memos_component_peek_config_directory (memos_component_peek ()),
- "MemoPad", NULL);
- e_memo_table_save_state (E_MEMO_TABLE (priv->memo), filename);
- g_free (filename);
-
if (priv->dn_queries) {
for (l = priv->dn_queries; l != NULL; l = l->next) {
g_signal_handlers_disconnect_matched ((ECalView *) l->data, G_SIGNAL_MATCH_DATA,
@@ -2000,50 +1644,21 @@ gnome_calendar_destroy (GtkObject *object)
priv->sexp = NULL;
}
- if (priv->todo_sexp) {
- g_free (priv->todo_sexp);
- priv->todo_sexp = NULL;
- }
-
- if (priv->memo_sexp) {
- g_free (priv->memo_sexp);
- priv->memo_sexp = NULL;
- }
-
if (priv->update_timeout) {
g_source_remove (priv->update_timeout);
priv->update_timeout = 0;
}
- if (priv->view_instance) {
- g_object_unref (priv->view_instance);
- priv->view_instance = NULL;
- }
-
if (priv->update_marcus_bains_line_timeout) {
g_source_remove (priv->update_marcus_bains_line_timeout);
priv->update_marcus_bains_line_timeout = 0;
}
- if (priv->view_menus) {
- g_object_unref (priv->view_menus);
- priv->view_menus = NULL;
- }
-
if (priv->calendar_menu) {
g_object_unref (priv->calendar_menu);
priv->calendar_menu = NULL;
}
- if (priv->taskpad_menu) {
- g_object_unref (priv->taskpad_menu);
- priv->taskpad_menu = NULL;
- }
-
- if (priv->memopad_menu) {
- g_object_unref (priv->memopad_menu);
- priv->memopad_menu = NULL;
- }
/* Disconnect all handlers */
cal_model = e_calendar_view_get_model ((ECalendarView *)priv->week_view);
g_signal_handlers_disconnect_by_func (cal_model,
@@ -2051,17 +1666,7 @@ gnome_calendar_destroy (GtkObject *object)
g_signal_handlers_disconnect_by_func (cal_model,
G_CALLBACK (view_done_cb), gcal);
- cal_model = e_calendar_table_get_model ((ECalendarTable *) priv->todo);
- g_signal_handlers_disconnect_by_func (cal_model,
- G_CALLBACK (view_progress_cb), gcal);
- g_signal_handlers_disconnect_by_func (cal_model,
- G_CALLBACK (view_done_cb), gcal);
-
- cal_model = e_memo_table_get_model ((EMemoTable *)priv->memo);
- g_signal_handlers_disconnect_by_func (cal_model,
- G_CALLBACK (view_progress_cb), gcal);
- g_signal_handlers_disconnect_by_func (cal_model,
- G_CALLBACK (view_done_cb), gcal);
+ g_mutex_free (priv->todo_update_lock);
g_mutex_free (priv->todo_update_lock);
@@ -2486,272 +2091,55 @@ display_view_cb (GalViewInstance *view_instance, GalView *view, gpointer data)
}
-/**
- * gnome_calendar_setup_view_menus:
- * @gcal: A calendar.
- * @uic: UI controller to use for the menus.
- *
- * Sets up the #GalView menus for a calendar. This function should be called
- * from the Bonobo control activation callback for this calendar. Also, the
- * menus should be discarded using gnome_calendar_discard_view_menus().
- **/
-void
-gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
+static void
+gnome_calendar_set_pane_positions (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
- char *path0, *path1, *etspecfile;
- CalendarViewFactory *factory;
- GalViewFactory *gal_factory;
- static GalViewCollection *collection = NULL;
-
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (uic != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (uic));
priv = gcal->priv;
- g_return_if_fail (priv->view_instance == NULL);
- g_return_if_fail (priv->view_menus == NULL);
-
- /* Create the view instance */
- if (collection == NULL) {
- ETableSpecification *spec;
-
- collection = gal_view_collection_new ();
-
- gal_view_collection_set_title (collection, _("Calendar"));
-
- path0 = g_build_filename (EVOLUTION_GALVIEWSDIR,
- "calendar",
- NULL);
- path1 = g_build_filename (calendar_component_peek_base_directory (calendar_component_peek ()),
- "views", NULL);
- gal_view_collection_set_storage_directories (collection,
- path0,
- path1);
- g_free (path1);
- g_free (path0);
-
- /* Create the views */
-
- factory = calendar_view_factory_new (GNOME_CAL_DAY_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- g_object_unref (factory);
-
- factory = calendar_view_factory_new (GNOME_CAL_WORK_WEEK_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- g_object_unref (factory);
-
- factory = calendar_view_factory_new (GNOME_CAL_WEEK_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- g_object_unref (factory);
-
- factory = calendar_view_factory_new (GNOME_CAL_MONTH_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- g_object_unref (factory);
-
- spec = e_table_specification_new ();
- etspecfile = g_build_filename (EVOLUTION_ETSPECDIR,
- "e-cal-list-view.etspec",
- NULL);
- if (!e_table_specification_load_from_file (spec, etspecfile))
- g_error ("Unable to load ETable specification file "
- "for calendar");
- g_free (etspecfile);
- gal_factory = gal_view_factory_etable_new (spec);
- g_object_unref (spec);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (gal_factory));
- g_object_unref (gal_factory);
-
- /* Load the collection and create the menus */
-
- gal_view_collection_load (collection);
-
+ if (priv->current_view_type == GNOME_CAL_MONTH_VIEW && !priv->range_selected) {
+ gtk_paned_set_position (GTK_PANED (priv->hpane), priv->hpane_pos_month_view);
+ gtk_paned_set_position (GTK_PANED (priv->vpane), priv->vpane_pos_month_view);
+ } else {
+ gtk_paned_set_position (GTK_PANED (priv->hpane), priv->hpane_pos);
+ gtk_paned_set_position (GTK_PANED (priv->vpane), priv->vpane_pos);
}
-
- priv->view_instance = gal_view_instance_new (collection, NULL);
- priv->view_menus = gal_view_menus_new (priv->view_instance);
- gal_view_menus_apply (priv->view_menus, uic, NULL);
-
- g_signal_connect (priv->view_instance, "display_view", G_CALLBACK (display_view_cb), gcal);
- display_view_cb (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), gcal);
-}
-
-/**
- * gnome_calendar_discard_view_menus:
- * @gcal: A calendar.
- *
- * Discards the #GalView menus used by a calendar. This function should be
- * called from the Bonobo control deactivation callback for this calendar. The
- * menus should have been set up with gnome_calendar_setup_view_menus().
- **/
-void
-gnome_calendar_discard_view_menus (GnomeCalendar *gcal)
-{
- GnomeCalendarPrivate *priv;
-
- g_return_if_fail (gcal != NULL);
-
- priv = gcal->priv;
-
- g_return_if_fail (priv->view_instance != NULL);
- g_return_if_fail (priv->view_menus != NULL);
-
- g_object_unref (priv->view_instance);
- priv->view_instance = NULL;
-
- g_object_unref (priv->view_menus);
- priv->view_menus = NULL;
-}
-
-/* This is copied/moved from gal-view-instance, only the calendar uses this for a popup menu */
-static void
-gc_set_view(EPopup *ep, EPopupItem *pitem, void *data)
-{
- GnomeCalendar *gcal = data;
-
- if (pitem->type & E_POPUP_ACTIVE)
- gal_view_instance_set_current_view_id(gcal->priv->view_instance, (char *)pitem->user_data);
}
-static void
-gc_save_custom_view(EPopup *ep, EPopupItem *pitem, void *data)
-{
- GnomeCalendar *gcal = data;
-
- gal_view_instance_save_as(gcal->priv->view_instance);
-}
-
-static void
-gc_define_views_response(GtkWidget *d, int id, GnomeCalendar *gcal)
-{
- if (id == GTK_RESPONSE_OK)
- gal_view_collection_save(gcal->priv->view_instance->collection);
-
- gtk_widget_destroy(d);
-}
-
-static void
-gc_define_views(EPopup *ep, EPopupItem *pitem, void *data)
-{
- GnomeCalendar *gcal = data;
- GtkWidget *dialog = gal_define_views_dialog_new(gcal->priv->view_instance->collection);
-
- g_signal_connect(dialog, "response", G_CALLBACK(gc_define_views_response), data);
- gtk_widget_show(dialog);
-}
-
-static EPopupItem gc_popups[] = {
- /* Code generates the path to fit */
- { E_POPUP_BAR, NULL },
- { E_POPUP_RADIO|E_POPUP_ACTIVE, NULL, (gchar *) N_("_Custom View"), },
- { E_POPUP_ITEM, NULL, (gchar *) N_("_Save Custom View"), gc_save_custom_view },
-
- /* index == 3, when we have non-custom view */
-
- { E_POPUP_BAR, NULL },
- { E_POPUP_ITEM, NULL, (gchar *) N_("_Define Views..."), gc_define_views },
+struct _mclient_msg {
+ Message header;
+ ECalModel *model;
+ ECal *client;
};
static void
-gc_popup_free (EPopup *ep, GSList *list, void *data)
+add_mclient_async (struct _mclient_msg *msg)
{
- while (list) {
- GSList *n = list->next;
- EPopupItem *pitem = list->data;
-
- g_free(pitem->path);
- g_free(pitem->label);
- g_free(pitem->user_data);
- g_free(pitem);
- g_slist_free_1(list);
- list = n;
- }
-}
+ e_cal_model_add_client (msg->model, msg->client);
-static void
-gc_popup_free_static (EPopup *ep, GSList *list, void *data)
-{
- while (list) {
- GSList *n = list->next;
- EPopupItem *pitem = list->data;
-
- g_free(pitem->path);
- g_free(pitem);
- g_slist_free_1(list);
- list = n;
- }
+ g_object_unref (msg->client);
+ g_object_unref (msg->model);
+ g_slice_free (struct _mclient_msg, msg);
}
-void
-gnome_calendar_view_popup_factory (GnomeCalendar *gcal, EPopup *ep, const char *prefix)
+static void
+add_mclient (ECalModel *model, ECal *client)
{
- GnomeCalendarPrivate *priv;
- int length;
- int i;
- gboolean found = FALSE;
- char *id;
- GSList *menus = NULL;
- EPopupItem *pitem;
-
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (prefix != NULL);
-
- priv = gcal->priv;
-
- g_return_if_fail (priv->view_instance != NULL);
-
- length = gal_view_collection_get_count(priv->view_instance->collection);
- id = gal_view_instance_get_current_view_id (priv->view_instance);
-
- for (i = 0; i < length; i++) {
- GalViewCollectionItem *item = gal_view_collection_get_view_item(priv->view_instance->collection, i);
-
- pitem = g_malloc0(sizeof(*pitem));
- pitem->type = E_POPUP_RADIO;
- pitem->path = g_strdup_printf("%s/%02d.item", prefix, i);
- pitem->label = g_strdup(item->title);
- pitem->activate = gc_set_view;
- pitem->user_data = g_strdup(item->id);
-
- if (!found && id && !strcmp (id, item->id)) {
- found = TRUE;
- pitem->type |= E_POPUP_ACTIVE;
- }
-
- menus = g_slist_prepend(menus, pitem);
- }
-
- if (menus)
- e_popup_add_items(ep, menus, NULL, gc_popup_free, gcal);
+ struct _mclient_msg *msg;
- menus = NULL;
- for (i = found?3:0; i<sizeof(gc_popups)/sizeof(gc_popups[0]);i++) {
- pitem = g_malloc0(sizeof(*pitem));
- memcpy(pitem, &gc_popups[i], sizeof(*pitem));
- pitem->path = g_strdup_printf("%s/%02d.item", prefix, i+length);
- menus = g_slist_prepend(menus, pitem);
- }
+ msg = g_slice_new0 (struct _mclient_msg);
+ msg->header.func = (MessageFunc) add_mclient_async;
+ msg->model = g_object_ref (model);
+ msg->client = g_object_ref (client);
- e_popup_add_items(ep, menus, NULL, gc_popup_free_static, gcal);
+ message_push ((Message *) msg);
}
static void
-gnome_calendar_set_pane_positions (GnomeCalendar *gcal)
+non_intrusive_error_remove(GtkWidget *w, void *data)
{
- GnomeCalendarPrivate *priv;
-
- priv = gcal->priv;
-
- if (priv->current_view_type == GNOME_CAL_MONTH_VIEW && !priv->range_selected) {
- gtk_paned_set_position (GTK_PANED (priv->hpane), priv->hpane_pos_month_view);
- gtk_paned_set_position (GTK_PANED (priv->vpane), priv->vpane_pos_month_view);
- } else {
- gtk_paned_set_position (GTK_PANED (priv->hpane), priv->hpane_pos);
- gtk_paned_set_position (GTK_PANED (priv->vpane), priv->vpane_pos);
- }
+ g_hash_table_remove(non_intrusive_error_table, data);
}
struct _mclient_msg {
@@ -2793,7 +2181,6 @@ static void
client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
- ECalSourceType source_type;
ESource *source;
ECalModel *model;
ECalLoadState state;
@@ -2803,23 +2190,9 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
priv = gcal->priv;
- source_type = e_cal_get_source_type (ecal);
source = e_cal_get_source (ecal);
state = e_cal_get_load_state (ecal);
- switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
- e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1);
- break;
- case E_CAL_SOURCE_TYPE_TODO:
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL, -1);
- break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
- e_memo_table_set_status_message (E_MEMO_TABLE (priv->memo), NULL);
- default:
- break;
- }
-
if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED || status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
auth_cal_forget_password (ecal);
@@ -2851,32 +2224,27 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
e_cal_open_async (ecal, FALSE);
return;
case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
- if (source_type == E_CAL_SOURCE_TYPE_EVENT)
- {
- /* check to see if we have dialog already running for this operation */
- id = g_strdup ("calendar:unable-to-load-the-calendar");
-
- if (g_hash_table_lookup(non_intrusive_error_table, id)) {
- /* We already have it */
- g_message("Error occurred while existing dialog active:\n");
- return;
- }
+ /* check to see if we have dialog already running for this operation */
+ id = g_strdup ("calendar:unable-to-load-the-calendar");
- w = e_error_new(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), "calendar:unable-to-load-the-calendar", e_cal_get_error_message (status), NULL);
- e_calendar_utils_show_error_silent (w);
- g_hash_table_insert (non_intrusive_error_table, id, g_object_ref(w));
- g_signal_connect(w, "destroy", G_CALLBACK(non_intrusive_error_remove), id);
+ if (g_hash_table_lookup(non_intrusive_error_table, id)) {
+ /* We already have it */
+ g_message("Error occurred while existing dialog active:\n");
+ return;
}
+
+ w = e_error_new(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), "calendar:unable-to-load-the-calendar", e_cal_get_error_message (status), NULL);
+ e_calendar_utils_show_error_silent (w);
+ g_hash_table_insert (non_intrusive_error_table, id, g_object_ref(w));
+ g_signal_connect(w, "destroy", G_CALLBACK(non_intrusive_error_remove), id);
default:
/* Make sure the source doesn't disappear on us */
g_object_ref (source);
- g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, gcal);
-
- priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], ecal);
- g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source));
+ priv->clients_list = g_list_remove (priv->clients_list, ecal);
+ g_hash_table_remove (priv->clients, e_source_peek_uid (source));
- g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source_type, source);
+ g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source);
g_object_unref (source);
g_warning ("Unable to load the calendar %s \n", e_cal_get_error_message (status));
@@ -2886,74 +2254,35 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, client_cal_opened_cb, NULL);
- switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT :
- msg = g_strdup_printf (_("Loading appointments at %s"), e_cal_get_uri (ecal));
- e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), msg, -1);
- g_free (msg);
-
- /* add client to the views */
- model = e_calendar_view_get_model (priv->views[priv->current_view_type]);
- add_mclient (model, ecal);
-
- /* update date navigator query */
- update_query (gcal);
-
- e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1);
- break;
+ msg = g_strdup_printf (_("Loading appointments at %s"), e_cal_get_uri (ecal));
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), msg, -1);
+ g_free (msg);
- case E_CAL_SOURCE_TYPE_TODO :
- msg = g_strdup_printf (_("Loading tasks at %s"), e_cal_get_uri (ecal));
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), msg, -1);
- g_free (msg);
+ /* add client to the views */
+ model = e_calendar_view_get_model (priv->views[priv->current_view_type]);
+ add_mclient (model, ecal);
- e_cal_model_add_client (e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)), ecal);
+ /* update date navigator query */
+ update_query (gcal);
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL, -1);
- break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
- msg = g_strdup_printf (_("Loading memos at %s"), e_cal_get_uri (ecal));
- e_memo_table_set_status_message (E_MEMO_TABLE (priv->memo), msg);
- g_free (msg);
- e_cal_model_add_client (e_memo_table_get_model (E_MEMO_TABLE (priv->memo)), ecal);
- e_memo_table_set_status_message (E_MEMO_TABLE (priv->memo), NULL);
- break;
- default:
- g_return_if_reached ();
- }
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1);
}
static void
default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
- ECalSourceType source_type;
ESource *source;
ECalLoadState state;
priv = gcal->priv;
- source_type = e_cal_get_source_type (ecal);
source = e_cal_get_source (ecal);
state = e_cal_get_load_state (ecal);
if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED || status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
auth_cal_forget_password (ecal);
- switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
- e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1);
- break;
- case E_CAL_SOURCE_TYPE_TODO:
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL, -1);
- break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
- e_memo_table_set_status_message (E_MEMO_TABLE (priv->memo), NULL);
- break;
- default:
- break;
- }
-
switch (status) {
case E_CALENDAR_STATUS_OK:
break;
@@ -2974,15 +2303,15 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar
g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, gcal);
/* FIXME should we do this to prevent multiple error dialogs? */
- priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], ecal);
- g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source));
+ priv->clients_list = g_list_remove (priv->clients_list, ecal);
+ g_hash_table_remove (priv->clients, e_source_peek_uid (source));
/* FIXME Is there a better way to handle this? */
- if (priv->default_client[source_type])
- g_object_unref (priv->default_client[source_type]);
- priv->default_client[source_type] = NULL;
+ if (priv->default_client)
+ g_object_unref (priv->default_client);
+ priv->default_client = NULL;
- g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source_type, source);
+ g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source);
g_object_unref (source);
g_warning ("Unable to load the calendar %s \n", e_cal_get_error_message (status));
@@ -2992,22 +2321,10 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar
g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, default_client_cal_opened_cb, NULL);
- switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
- e_cal_model_set_default_client (
- e_calendar_view_get_model (E_CALENDAR_VIEW (priv->views[priv->current_view_type])),
- ecal);
- break;
-
- case E_CAL_SOURCE_TYPE_TODO:
- e_cal_model_set_default_client (e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)), ecal);
- break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
- e_cal_model_set_default_client (e_memo_table_get_model (E_MEMO_TABLE (priv->memo)), ecal);
- break;
- default:
- break;
- }
+ e_cal_model_set_default_client (
+ e_calendar_view_get_model (
+ E_CALENDAR_VIEW (priv->views[priv->current_view_type])),
+ ecal);
}
typedef void (*open_func) (ECal *, ECalendarStatus, GnomeCalendar *);
@@ -3025,20 +2342,7 @@ open_ecal (GnomeCalendar *gcal, ECal *cal, gboolean only_if_exists, open_func of
e_cal_set_default_timezone (cal, zone, NULL);
msg = g_strdup_printf (_("Opening %s"), e_cal_get_uri (cal));
- switch (e_cal_get_source_type (cal)) {
- case E_CAL_SOURCE_TYPE_EVENT :
- e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), msg, -1);
- break;
- case E_CAL_SOURCE_TYPE_TODO :
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), msg, -1);
- break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
- e_memo_table_set_status_message (E_MEMO_TABLE (priv->memo), msg);
- break;
- default:
- g_free (msg);
- g_return_val_if_reached (FALSE);
- }
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), msg, -1);
g_free (msg);
@@ -3083,7 +2387,6 @@ backend_died_cb (ECal *ecal, gpointer data)
{
GnomeCalendar *gcal;
GnomeCalendarPrivate *priv;
- ECalSourceType source_type;
ESource *source;
const char *id;
GtkWidget *w = NULL;
@@ -3094,39 +2397,16 @@ backend_died_cb (ECal *ecal, gpointer data)
/* FIXME What about default sources? */
/* Make sure the source doesn't go away on us since we use it below */
- source_type = e_cal_get_source_type (ecal);
source = g_object_ref (e_cal_get_source (ecal));
- priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], ecal);
- g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source));
-
- switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
- id = g_strdup ("calendar:calendar-crashed");
-
- e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1);
-
- g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source_type, source);
- break;
-
- case E_CAL_SOURCE_TYPE_TODO:
- id = g_strdup ("calendar:calendar-crashed");
+ priv->clients_list = g_list_remove (priv->clients_list, ecal);
+ g_hash_table_remove (priv->clients, e_source_peek_uid (source));
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL, -1);
+ id = g_strdup ("calendar:calendar-crashed");
- g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source_type, source);
- break;
-
- case E_CAL_SOURCE_TYPE_JOURNAL:
- id = g_strdup ("calendar:calendar-crashed");
-
- e_memo_table_set_status_message (E_MEMO_TABLE (priv->memo), NULL);
+ e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1);
- g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source_type, source);
- break;
- default:
- g_return_if_reached ();
- }
+ g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source);
g_object_unref (source);
@@ -3171,35 +2451,6 @@ gnome_calendar_new (void)
return GTK_WIDGET (gcal);
}
-void
-gnome_calendar_set_activity_handler (GnomeCalendar *cal, EActivityHandler *activity_handler)
-{
- GnomeCalendarPrivate *priv;
- int i;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (cal));
-
- priv = cal->priv;
-
- priv->activity_handler = activity_handler;
-
- for (i = 0; i < GNOME_CAL_LAST_VIEW; i++)
- e_calendar_view_set_activity_handler (priv->views[i], activity_handler);
-
- e_calendar_table_set_activity_handler (E_CALENDAR_TABLE (priv->todo), activity_handler);
-}
-
-void
-gnome_calendar_set_ui_component (GnomeCalendar *gcal,
- BonoboUIComponent *ui_component)
-{
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (ui_component == NULL || BONOBO_IS_UI_COMPONENT (ui_component));
-
- e_search_bar_set_ui_component (E_SEARCH_BAR (gcal->priv->search_bar), ui_component);
-}
-
/**
* gnome_calendar_get_calendar_model:
* @gcal: A calendar view.
@@ -3247,7 +2498,7 @@ gnome_calendar_get_default_client (GnomeCalendar *gcal)
* Returns: TRUE if successful, FALSE if error.
*/
gboolean
-gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source)
+gnome_calendar_add_source (GnomeCalendar *gcal, ESource *source)
{
GnomeCalendarPrivate *priv;
ECal *client;
@@ -3258,7 +2509,7 @@ gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESou
priv = gcal->priv;
- client = g_hash_table_lookup (priv->clients[source_type], e_source_peek_uid (source));
+ client = g_hash_table_lookup (priv->clients, e_source_peek_uid (source));
if (client) {
/* We already have it */
@@ -3266,18 +2517,18 @@ gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESou
} else {
ESource *default_source;
- if (priv->default_client[source_type]) {
- default_source = e_cal_get_source (priv->default_client[source_type]);
+ if (priv->default_client) {
+ default_source = e_cal_get_source (priv->default_client);
g_message ("Check if default client matches (%s %s)", e_source_peek_uid (default_source), e_source_peek_uid (source));
/* We don't have it but the default client is it */
if (!strcmp (e_source_peek_uid (default_source), e_source_peek_uid (source)))
- client = g_object_ref (priv->default_client[source_type]);
+ client = g_object_ref (priv->default_client);
}
/* Create a new one */
if (!client) {
- client = auth_new_cal_from_source (source, source_type);
+ client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT);
if (!client)
return FALSE;
}
@@ -3287,10 +2538,10 @@ gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESou
g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), gcal);
/* add the client to internal structure */
- g_hash_table_insert (priv->clients[source_type], g_strdup (e_source_peek_uid (source)), client);
- priv->clients_list[source_type] = g_list_prepend (priv->clients_list[source_type], client);
+ g_hash_table_insert (priv->clients, g_strdup (e_source_peek_uid (source)), client);
+ priv->clients_list = g_list_prepend (priv->clients_list, client);
- g_signal_emit (gcal, gnome_calendar_signals[SOURCE_ADDED], 0, source_type, source);
+ g_signal_emit (gcal, gnome_calendar_signals[SOURCE_ADDED], 0, source);
open_ecal (gcal, client, FALSE, client_cal_opened_cb);
@@ -3308,7 +2559,7 @@ gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESou
* Returns: TRUE if successful, FALSE otherwise.
*/
gboolean
-gnome_calendar_remove_source (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source)
+gnome_calendar_remove_source (GnomeCalendar *gcal, ESource *source)
{
gboolean result;
@@ -3316,15 +2567,15 @@ gnome_calendar_remove_source (GnomeCalendar *gcal, ECalSourceType source_type, E
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
- result = gnome_calendar_remove_source_by_uid (gcal, source_type, e_source_peek_uid (source));
+ result = gnome_calendar_remove_source_by_uid (gcal, e_source_peek_uid (source));
if (result)
- g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source_type, source);
+ g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source);
return result;
}
gboolean
-gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, ECalSourceType source_type, const char *uid)
+gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, const char *uid)
{
GnomeCalendarPrivate *priv;
ECal *client;
@@ -3337,51 +2588,34 @@ gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, ECalSourceType source_
priv = gcal->priv;
- client = g_hash_table_lookup (priv->clients[source_type], uid);
+ client = g_hash_table_lookup (priv->clients, uid);
if (!client)
return TRUE;
- priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], client);
+ priv->clients_list = g_list_remove (priv->clients_list, client);
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
- switch (source_type) {
- case E_CAL_SOURCE_TYPE_EVENT:
- /* remove the query for this client */
- for (l = priv->dn_queries; l != NULL; l = l->next) {
- ECalView *query = l->data;
+ /* remove the query for this client */
+ for (l = priv->dn_queries; l != NULL; l = l->next) {
+ ECalView *query = l->data;
- if (query && (client == e_cal_view_get_client (query))) {
- g_signal_handlers_disconnect_matched (query, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, gcal);
- priv->dn_queries = g_list_remove (priv->dn_queries, query);
- g_object_unref (query);
- break;
- }
+ if (query && (client == e_cal_view_get_client (query))) {
+ g_signal_handlers_disconnect_matched (query, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, gcal);
+ priv->dn_queries = g_list_remove (priv->dn_queries, query);
+ g_object_unref (query);
+ break;
}
+ }
- model = e_calendar_view_get_model (priv->views[priv->current_view_type]);
- e_cal_model_remove_client (model, client);
-
- /* update date navigator query */
- update_query (gcal);
- break;
-
- case E_CAL_SOURCE_TYPE_TODO:
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo));
- e_cal_model_remove_client (model, client);
- break;
-
- case E_CAL_SOURCE_TYPE_JOURNAL:
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memo));
- e_cal_model_remove_client (model, client);
- break;
+ model = e_calendar_view_get_model (priv->views[priv->current_view_type]);
+ e_cal_model_remove_client (model, client);
- default:
- g_return_val_if_reached (TRUE);
- }
+ /* update date navigator query */
+ update_query (gcal);
- g_hash_table_remove (priv->clients[source_type], uid);
+ g_hash_table_remove (priv->clients, uid);
return TRUE;
}
@@ -3399,7 +2633,7 @@ gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, ECalSourceType source_
* otherwise
**/
gboolean
-gnome_calendar_set_default_source (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source)
+gnome_calendar_set_default_source (GnomeCalendar *gcal, ESource *source)
{
GnomeCalendarPrivate *priv;
ECal *client;
@@ -3410,21 +2644,21 @@ gnome_calendar_set_default_source (GnomeCalendar *gcal, ECalSourceType source_ty
priv = gcal->priv;
- client = g_hash_table_lookup (priv->clients[source_type], e_source_peek_uid (source));
+ client = g_hash_table_lookup (priv->clients, e_source_peek_uid (source));
- if (priv->default_client[source_type])
- g_object_unref (priv->default_client[source_type]);
+ if (priv->default_client)
+ g_object_unref (priv->default_client);
if (client) {
- priv->default_client[source_type] = g_object_ref (client);
+ priv->default_client = g_object_ref (client);
} else {
- priv->default_client[source_type] = auth_new_cal_from_source (source, source_type);
- if (!priv->default_client[source_type])
+ priv->default_client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT);
+ if (!priv->default_client)
return FALSE;
}
- open_ecal (gcal, priv->default_client[source_type], FALSE, default_client_cal_opened_cb);
+ open_ecal (gcal, priv->default_client, FALSE, default_client_cal_opened_cb);
return TRUE;
}
@@ -3787,55 +3021,34 @@ gnome_calendar_vpane_resized (GtkWidget *w, GdkEventButton *e, GnomeCalendar *gc
void
gnome_calendar_cut_clipboard (GnomeCalendar *gcal)
{
- GnomeCalendarPrivate *priv;
- FocusLocation location;
-
- priv = gcal->priv;
+ GtkWidget *widget;
- location = get_focus_location (gcal);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- if (location == FOCUS_CALENDAR) {
- e_calendar_view_cut_clipboard (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)));
- } else if (location == FOCUS_TASKPAD)
- e_calendar_table_cut_clipboard (E_CALENDAR_TABLE (priv->todo));
- else if (location == FOCUS_MEMOPAD)
- e_memo_table_cut_clipboard (E_MEMO_TABLE (priv->memo));
+ widget = gnome_calendar_get_current_view_widget (gcal);
+ e_calendar_view_cut_clipboard (E_CALENDAR_VIEW (widget));
}
void
gnome_calendar_copy_clipboard (GnomeCalendar *gcal)
{
- GnomeCalendarPrivate *priv;
- FocusLocation location;
-
- priv = gcal->priv;
+ GtkWidget *widget;
- location = get_focus_location (gcal);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- if (location == FOCUS_CALENDAR) {
- e_calendar_view_copy_clipboard (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)));
- } else if (location == FOCUS_TASKPAD)
- e_calendar_table_copy_clipboard (E_CALENDAR_TABLE (priv->todo));
- else if (location == FOCUS_MEMOPAD)
- e_memo_table_copy_clipboard (E_MEMO_TABLE (priv->memo));
+ widget = gnome_calendar_get_current_view_widget (gcal);
+ e_calendar_view_copy_clipboard (E_CALENDAR_VIEW (widget));
}
void
gnome_calendar_paste_clipboard (GnomeCalendar *gcal)
{
- GnomeCalendarPrivate *priv;
- FocusLocation location;
+ GtkWidget *widget;
- priv = gcal->priv;
-
- location = get_focus_location (gcal);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- if (location == FOCUS_CALENDAR) {
- e_calendar_view_paste_clipboard (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)));
- } else if (location == FOCUS_TASKPAD)
- e_calendar_table_paste_clipboard (E_CALENDAR_TABLE (priv->todo));
- else if (location == FOCUS_MEMOPAD)
- e_memo_table_paste_clipboard (E_MEMO_TABLE (priv->memo));
+ widget = gnome_calendar_get_current_view_widget (gcal);
+ e_calendar_view_paste_clipboard (E_CALENDAR_VIEW (widget));
}
@@ -3897,69 +3110,26 @@ gnome_calendar_get_num_events_selected (GnomeCalendar *gcal)
return retval;
}
-/**
- * gnome_calendar_get_num_tasks_selected:
- * @gcal: A calendar view.
- *
- * Queries the number of tasks that are currently selected in the task pad of a
- * calendar view.
- *
- * Return value: Number of selected tasks.
- **/
-gint
-gnome_calendar_get_num_tasks_selected (GnomeCalendar *gcal)
-{
- GnomeCalendarPrivate *priv;
- ETable *etable;
-
- g_return_val_if_fail (gcal != NULL, -1);
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), -1);
-
- priv = gcal->priv;
-
- etable = e_calendar_table_get_table (E_CALENDAR_TABLE (priv->todo));
- return e_table_selected_count (etable);
-}
-
-
void
-gnome_calendar_delete_selection (GnomeCalendar *gcal)
+gnome_calendar_delete_selection (GnomeCalendar *gcal)
{
- GnomeCalendarPrivate *priv;
- FocusLocation location;
- GtkWidget *view;
+ GtkWidget *widget;
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- priv = gcal->priv;
-
- location = get_focus_location (gcal);
-
- if (location == FOCUS_CALENDAR) {
- view = gnome_calendar_get_current_view_widget (gcal);
-
- e_calendar_view_delete_selected_events (E_CALENDAR_VIEW (view));
- } else if (location == FOCUS_TASKPAD)
- e_calendar_table_delete_selected (E_CALENDAR_TABLE (priv->todo));
- else if (location == FOCUS_MEMOPAD)
- e_memo_table_delete_selected (E_MEMO_TABLE (priv->memo));
+ widget = gnome_calendar_get_current_view_widget (gcal);
+ e_calendar_view_delete_selected_events (E_CALENDAR_VIEW (widget));
}
void
gnome_calendar_delete_selected_occurrence (GnomeCalendar *gcal)
{
- FocusLocation location;
- GtkWidget *view;
+ GtkWidget *widget;
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- location = get_focus_location (gcal);
-
- if (location == FOCUS_CALENDAR) {
-
- view = gnome_calendar_get_current_view_widget (gcal);
- e_calendar_view_delete_selected_occurrence (E_CALENDAR_VIEW (view));
- }
+ widget = gnome_calendar_get_current_view_widget (gcal);
+ e_calendar_view_delete_selected_occurrence (E_CALENDAR_VIEW (widget));
}
static gboolean
@@ -4058,14 +3228,6 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than)
}
-ECalendarTable*
-gnome_calendar_get_task_pad (GnomeCalendar *gcal)
-{
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
-
- return E_CALENDAR_TABLE (gcal->priv->todo);
-}
-
GtkWidget *
gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal)
{
@@ -4090,13 +3252,6 @@ gnome_calendar_get_view_notebook_widget (GnomeCalendar *gcal)
return GTK_WIDGET(gcal->priv->notebook);
}
-ECalMenu *gnome_calendar_get_taskpad_menu (GnomeCalendar *gcal)
-{
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
-
- return gcal->priv->taskpad_menu;
-}
-
ECalMenu *gnome_calendar_get_calendar_menu (GnomeCalendar *gcal)
{
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
@@ -4104,14 +3259,6 @@ ECalMenu *gnome_calendar_get_calendar_menu (GnomeCalendar *gcal)
return gcal->priv->calendar_menu;
}
-ECalMenu *gnome_calendar_get_memopad_menu (GnomeCalendar *gcal)
-{
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
-
- return gcal->priv->memopad_menu;
-}
-
-
void
gnome_calendar_edit_appointment (GnomeCalendar *gcal,
const char* src_uid,
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 947559bac5..a483260d2c 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -87,17 +87,13 @@ struct _GnomeCalendarClass {
void (* dates_shown_changed) (GnomeCalendar *gcal);
void (* calendar_selection_changed) (GnomeCalendar *gcal);
- void (* taskpad_selection_changed) (GnomeCalendar *gcal);
- void (* memopad_selection_changed) (GnomeCalendar *gcal);
void (* calendar_focus_change) (GnomeCalendar *gcal, gboolean in);
- void (* taskpad_focus_change) (GnomeCalendar *gcal, gboolean in);
- void (* memopad_focus_change) (GnomeCalendar *gcal, gboolean in);
- void (* change_view) (GnomeCalendar *gcal,
- GnomeCalendarViewType view_type);
+ void (* change_view) (GnomeCalendar *gcal,
+ GnomeCalendarViewType view_type);
- void (* source_added) (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source);
- void (* source_removed) (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source);
+ void (* source_added) (GnomeCalendar *gcal, ESource *source);
+ void (* source_removed) (GnomeCalendar *gcal, ESource *source);
/* Action signals */
void (* goto_date) (GnomeCalendar *gcal, GnomeCalendarGotoDateType date);
@@ -109,16 +105,15 @@ GtkWidget *gnome_calendar_construct (GnomeCalendar *gcal);
GtkWidget *gnome_calendar_new (void);
-void gnome_calendar_set_activity_handler (GnomeCalendar *cal, EActivityHandler *activity_handler);
-void gnome_calendar_set_ui_component (GnomeCalendar *cal, BonoboUIComponent *ui_component);
+ECalendarTable *gnome_calendar_get_task_pad (GnomeCalendar *gcal);
ECalModel *gnome_calendar_get_calendar_model (GnomeCalendar *gcal);
ECal *gnome_calendar_get_default_client (GnomeCalendar *gcal);
-gboolean gnome_calendar_add_source (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source);
-gboolean gnome_calendar_remove_source (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source);
-gboolean gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, ECalSourceType source_type, const char *uid);
-gboolean gnome_calendar_set_default_source (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source);
+gboolean gnome_calendar_add_source (GnomeCalendar *gcal, ESource *source);
+gboolean gnome_calendar_remove_source (GnomeCalendar *gcal, ESource *source);
+gboolean gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, const char *uid);
+gboolean gnome_calendar_set_default_source (GnomeCalendar *gcal, ESource *source);
void gnome_calendar_next (GnomeCalendar *gcal);
void gnome_calendar_previous (GnomeCalendar *gcal);
@@ -134,20 +129,12 @@ void gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_ty
GtkWidget *gnome_calendar_get_current_view_widget (GnomeCalendar *gcal);
-ECalendarTable *gnome_calendar_get_task_pad (GnomeCalendar *gcal);
GtkWidget *gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal);
GtkWidget *gnome_calendar_get_search_bar_widget (GnomeCalendar *gcal);
GtkWidget *gnome_calendar_get_view_notebook_widget (GnomeCalendar *gcal);
GtkWidget *gnome_calendar_get_tag (GnomeCalendar *gcal);
-struct _ECalMenu *gnome_calendar_get_taskpad_menu (GnomeCalendar *gcal);
struct _ECalMenu *gnome_calendar_get_calendar_menu (GnomeCalendar *gcal);
-struct _ECalMenu *gnome_calendar_get_memopad_menu (GnomeCalendar *gcal);
-
-void gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic);
-void gnome_calendar_discard_view_menus (GnomeCalendar *gcal);
-
-void gnome_calendar_view_popup_factory (GnomeCalendar *gcal, struct _EPopup *ep, const char *prefix);
void gnome_calendar_set_selected_time_range (GnomeCalendar *gcal,
time_t start_time,
@@ -174,9 +161,6 @@ gboolean gnome_calendar_get_visible_time_range (GnomeCalendar *gcal,
/* Returns the number of selected events (0 or 1 at present). */
gint gnome_calendar_get_num_events_selected (GnomeCalendar *gcal);
-/* Returns the number of selected tasks */
-gint gnome_calendar_get_num_tasks_selected (GnomeCalendar *gcal);
-
/* Get the current timezone. */
icaltimezone *gnome_calendar_get_timezone (GnomeCalendar *gcal);
diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c
index d341245fec..cb4bb12bfd 100644
--- a/calendar/gui/goto.c
+++ b/calendar/gui/goto.c
@@ -28,7 +28,6 @@
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "e-util/e-util-private.h"
-#include "calendar-commands.h"
#include "calendar-config.h"
#include "tag-calendar.h"
#include "goto.h"
@@ -76,12 +75,14 @@ month_changed (GtkToggleButton *toggle, gpointer data)
static void
ecal_date_range_changed (ECalendarItem *calitem, gpointer user_data)
{
+#if 0 /* KILL-BONOBO */
GoToDialog *dlg = user_data;
ECal *client;
client = gnome_calendar_get_default_client (dlg->gcal);
if (client)
tag_calendar_by_client (dlg->ecal, client);
+#endif
}
/* Event handler for day groups in the month item. A button press makes the calendar jump to the
@@ -90,6 +91,7 @@ ecal_date_range_changed (ECalendarItem *calitem, gpointer user_data)
static void
ecal_event (ECalendarItem *calitem, gpointer user_data)
{
+#if 0 /* KILL-BONOBO */
GoToDialog *dlg = user_data;
GDate start_date, end_date;
struct icaltimetype tt = icaltime_null_time ();
@@ -106,6 +108,7 @@ ecal_event (ECalendarItem *calitem, gpointer user_data)
gnome_calendar_goto (dlg->gcal, et);
gtk_dialog_response (GTK_DIALOG (dlg->dialog), GTK_RESPONSE_NONE);
+#endif
}
/* Returns the current time, for the ECalendarItem. */
@@ -160,7 +163,9 @@ create_ecal (GoToDialog *dlg)
static void
goto_today (GoToDialog *dlg)
{
+#if 0 /* KILL-BONOBO */
gnome_calendar_goto_today (dlg->gcal);
+#endif
}
/* Gets the widgets from the XML file and returns if they are all available. */
@@ -201,6 +206,7 @@ goto_dialog_init_widgets (GoToDialog *dlg)
void
goto_dialog (GnomeCalendar *gcal)
{
+#if 0 /* KILL-BONOBO */
time_t start_time;
struct icaltimetype tt;
int b;
@@ -269,4 +275,5 @@ goto_dialog (GnomeCalendar *gcal)
g_object_unref (dlg->xml);
g_free (dlg);
dlg = NULL;
+#endif
}
diff --git a/calendar/gui/itip-bonobo-control.c b/calendar/gui/itip-bonobo-control.c
deleted file mode 100644
index f63e3e187a..0000000000
--- a/calendar/gui/itip-bonobo-control.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Evolution calendar - Control for displaying iTIP mail messages
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Jesse Pavel <jpavel@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include <config.h>
-#include <string.h>
-#include <gtk/gtk.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-property-bag.h>
-#include <bonobo/bonobo-persist-stream.h>
-#include <bonobo/bonobo-stream-client.h>
-#include <bonobo/bonobo-context.h>
-#include <bonobo/bonobo-exception.h>
-#include <libical/ical.h>
-
-#include "e-itip-control.h"
-#include "itip-bonobo-control.h"
-
-extern gchar *evolution_dir;
-
-enum E_ITIP_BONOBO_ARGS {
- FROM_ADDRESS_ARG_ID,
- VIEW_ONLY_ARG_ID
-};
-
-/*
- * Bonobo::PersistStream
- *
- * These two functions implement the Bonobo::PersistStream load and
- * save methods which allow data to be loaded into and out of the
- * BonoboObject.
- */
-
-static char *
-stream_read (Bonobo_Stream stream)
-{
- Bonobo_Stream_iobuf *buffer;
- CORBA_Environment ev;
- gchar *data = NULL;
- gint length = 0;
-
- CORBA_exception_init (&ev);
- do {
-#define READ_CHUNK_SIZE 65536
- Bonobo_Stream_read (stream, READ_CHUNK_SIZE,
- &buffer, &ev);
-
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- if (buffer->_length <= 0)
- break;
-
- data = g_realloc (data, length + buffer->_length + 1);
- memcpy (data + length, buffer->_buffer, buffer->_length);
- length += buffer->_length;
- data[length] = '\0';
-
- CORBA_free (buffer);
-#undef READ_CHUNK_SIZE
- } while (1);
-
- CORBA_free (buffer);
- CORBA_exception_free (&ev);
-
- if (data == NULL)
- data = g_strdup("");
-
- return data;
-} /* stream_read */
-
-/*
- * This function implements the Bonobo::PersistStream:load method.
- */
-typedef struct {
- EItipControl *itip;
- char *text;
-} idle_data;
-
-static gboolean
-set_data_idle_cb (gpointer data)
-{
- idle_data *id = data;
-
- e_itip_control_set_data (id->itip, id->text);
- g_object_unref (id->itip);
- g_free (id->text);
- g_free (id);
-
- return FALSE;
-}
-
-static void
-pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream,
- Bonobo_Persist_ContentType type, void *data,
- CORBA_Environment *ev)
-{
- EItipControl *itip = data;
- idle_data *id;
-
- if (type && g_ascii_strcasecmp (type, "text/calendar") != 0 &&
- g_ascii_strcasecmp (type, "text/x-calendar") != 0) {
- bonobo_exception_set (ev, ex_Bonobo_Persist_WrongDataType);
- return;
- }
-
- id = g_new0 (idle_data, 1);
- if ((id->text = stream_read (stream)) == NULL) {
- bonobo_exception_set (ev, ex_Bonobo_Persist_FileNotFound);
- g_free (id);
- return;
- }
- g_object_ref (itip);
- id->itip = itip;
-
- g_idle_add (set_data_idle_cb, id);
-}
-/*
- * This function implements the Bonobo::PersistStream:save method.
- */
-static void
-pstream_save (BonoboPersistStream *ps, const Bonobo_Stream stream,
- Bonobo_Persist_ContentType type, void *data,
- CORBA_Environment *ev)
-{
- EItipControl *itip = data;
- gchar *text;
- gint len;
-
- if (type && g_ascii_strcasecmp (type, "text/calendar") != 0 &&
- g_ascii_strcasecmp (type, "text/x-calendar") != 0) {
- bonobo_exception_set (ev, ex_Bonobo_Persist_WrongDataType);
- return;
- }
-
- text = e_itip_control_get_data (itip);
- len = e_itip_control_get_data_size (itip);
-
- bonobo_stream_client_write (stream, text, len, ev);
- g_free (text);
-} /* pstream_save */
-
-/* static CORBA_long */
-/* pstream_get_max_size (BonoboPersistStream *ps, void *data, */
-/* CORBA_Environment *ev) */
-/* { */
-/* EItipControl *itip = data; */
-/* gint len; */
-
-/* len = e_itip_control_get_data_size (itip); */
-
-/* if (len > 0) */
-/* return len; */
-
-/* return 0L; */
-/* } */
-
-static Bonobo_Persist_ContentTypeList *
-pstream_get_content_types (BonoboPersistStream *ps, void *closure,
- CORBA_Environment *ev)
-{
- return bonobo_persist_generate_content_types (2, "text/calendar", "text/x-calendar");
-}
-
-static void
-get_prop (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- EItipControl *itip = user_data;
-
- switch (arg_id) {
- case FROM_ADDRESS_ARG_ID:
- BONOBO_ARG_SET_STRING (arg, e_itip_control_get_from_address (itip));
- break;
- case VIEW_ONLY_ARG_ID:
- BONOBO_ARG_SET_INT (arg, e_itip_control_get_view_only (itip));
- break;
- }
-}
-
-static void
-set_prop ( BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- EItipControl *itip = user_data;
-
- switch (arg_id) {
- case FROM_ADDRESS_ARG_ID:
- e_itip_control_set_from_address (itip, BONOBO_ARG_GET_STRING (arg));
- break;
- case VIEW_ONLY_ARG_ID:
- e_itip_control_set_view_only (itip, BONOBO_ARG_GET_INT (arg));
- break;
- }
-}
-
-
-BonoboControl *
-itip_bonobo_control_new (void)
-{
- BonoboControl *control;
- BonoboPropertyBag *prop_bag;
- BonoboPersistStream *stream;
- GtkWidget *itip;
-
- itip = e_itip_control_new ();
- gtk_widget_show (itip);
- control = bonobo_control_new (itip);
-
- /* create a property bag */
- prop_bag = bonobo_property_bag_new (get_prop, set_prop, itip);
- bonobo_property_bag_add (prop_bag, "from_address", FROM_ADDRESS_ARG_ID, BONOBO_ARG_STRING, NULL,
- "from_address", 0 );
- bonobo_property_bag_add (prop_bag, "view_only", VIEW_ONLY_ARG_ID, BONOBO_ARG_INT, NULL,
- "view_only", 0 );
-
- bonobo_control_set_properties (control, bonobo_object_corba_objref (BONOBO_OBJECT (prop_bag)), NULL);
- bonobo_object_unref (BONOBO_OBJECT (prop_bag));
-
- bonobo_control_set_automerge (control, TRUE);
-
- stream = bonobo_persist_stream_new (pstream_load, pstream_save,
- pstream_get_content_types,
- "OAFIID:GNOME_Evolution_Calendar_iTip_Control:" BASE_VERSION,
- itip);
-
- if (stream == NULL) {
- bonobo_object_unref (BONOBO_OBJECT (control));
- return NULL;
- }
-
- bonobo_object_add_interface (BONOBO_OBJECT (control),
- BONOBO_OBJECT (stream));
-
- return control;
-}
diff --git a/calendar/gui/itip-bonobo-control.h b/calendar/gui/itip-bonobo-control.h
deleted file mode 100644
index c79b8f7d09..0000000000
--- a/calendar/gui/itip-bonobo-control.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Evolution calendar - Control for displaying iTIP mail messages
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Jesse Pavel <jpavel@ximian.com>
- * JP Rosevear <jpr@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef __ITIP_CONTROL_FACTORY_H__
-#define __ITIP_CONTROL_FACTORY_H__
-
-#include <bonobo/bonobo-control.h>
-
-BonoboControl *itip_bonobo_control_new (void);
-
-#endif /* __ITIP_CONTROL_H__ */
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index ae822c9b9c..bf270de0af 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -37,7 +37,6 @@
#include <time.h>
#include <composer/e-msg-composer.h>
-#include <mail/em-composer-utils.h>
#include <camel/camel-mime-filter-tohtml.h>
static const gchar *itip_methods[] = {
@@ -1250,7 +1249,6 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
composer = e_msg_composer_new ();
table = e_msg_composer_get_header_table (composer);
- em_composer_utils_setup_default_callbacks (composer);
e_composer_header_table_set_subject (table, subject);
e_composer_header_table_set_account_name (table, from);
@@ -1358,7 +1356,6 @@ reply_to_calendar_comp (ECalComponentItipMethod method,
composer = e_msg_composer_new ();
table = e_msg_composer_get_header_table (composer);
- em_composer_utils_setup_default_callbacks (composer);
e_composer_header_table_set_subject (table, subject);
e_composer_header_table_set_account_name (table, from);
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
deleted file mode 100644
index 1687328fa4..0000000000
--- a/calendar/gui/main.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <libgnome/gnome-init.h>
-#include <glade/glade.h>
-
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-shlib-factory.h>
-#include <bonobo/bonobo-exception.h>
-
-#include "dialogs/cal-prefs-dialog.h"
-#include "calendar-commands.h"
-#include "calendar-config.h"
-#include "calendar-component.h"
-#include "e-comp-editor-registry.h"
-#include "comp-editor-factory.h"
-#include "control-factory.h"
-#include "itip-bonobo-control.h"
-#include "tasks-control.h"
-#include "tasks-component.h"
-#include "memos-component.h"
-
-#include <e-util/e-plugin.h>
-#include <e-util/e-import.h>
-#include "e-cal-config.h"
-#include "e-cal-popup.h"
-#include "e-cal-menu.h"
-#include "e-cal-event.h"
-#include "calendar/importers/evolution-calendar-importer.h"
-
-#define FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_Factory:" BASE_VERSION
-
-#define CALENDAR_COMPONENT_ID "OAFIID:GNOME_Evolution_Calendar_Component:" BASE_VERSION
-#define TASKS_COMPONENT_ID "OAFIID:GNOME_Evolution_Tasks_Component:" BASE_VERSION
-#define MEMOS_COMPONENT_ID "OAFIID:GNOME_Evolution_Memos_Component:" BASE_VERSION
-#define ITIP_CONTROL_ID "OAFIID:GNOME_Evolution_Calendar_iTip_Control:" BASE_VERSION
-#define CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_Calendar_ConfigControl:" BASE_VERSION
-#define COMP_EDITOR_FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_CompEditorFactory:" BASE_VERSION
-
-ECompEditorRegistry *comp_editor_registry = NULL;
-
-/* The component editor factory */
-static CompEditorFactory *comp_editor_factory = NULL;
-
-
-/* Factory function for the calendar component factory; just creates and
- * references a singleton service object.
- */
-static BonoboObject *
-comp_editor_factory_fn (void)
-{
- if (!comp_editor_factory) {
- comp_editor_factory = comp_editor_factory_new ();
- if (!comp_editor_factory)
- return NULL;
- }
-
- bonobo_object_ref (BONOBO_OBJECT (comp_editor_factory));
- return BONOBO_OBJECT (comp_editor_factory);
-}
-
-
-/* Does a simple activation and unreffing of the alarm notification service so
- * that the daemon will be launched if it is not running yet.
- */
-static gboolean
-launch_alarm_daemon_cb (gpointer data)
-{
- CORBA_Environment ev;
- CORBA_Object an;
-
- /* activate the alarm daemon */
- CORBA_exception_init (&ev);
- an = bonobo_activation_activate_from_id (
- (Bonobo_ActivationID) "OAFIID:GNOME_Evolution_Calendar_AlarmNotify:" BASE_VERSION, 0, NULL, &ev);
-
- if (BONOBO_EX (&ev)) {
- g_message ("launch_alarm_daemon_cb(): %s", bonobo_exception_get_text (&ev));
- CORBA_exception_free (&ev);
- return FALSE;
- }
- CORBA_exception_free (&ev);
-
- /* Just get rid of it; what we are interested in is that it gets launched */
-
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (an, &ev);
- if (BONOBO_EX (&ev))
- g_message ("add_alarms(): Could not unref the alarm notification service");
-
- CORBA_exception_free (&ev);
-
- return FALSE;
-}
-
-static void
-launch_alarm_daemon (void)
-{
- g_idle_add ((GSourceFunc) launch_alarm_daemon_cb, NULL);
-}
-
-static void
-initialize (void)
-{
- EImportClass *klass;
-
- comp_editor_registry = E_COMP_EDITOR_REGISTRY (e_comp_editor_registry_new ());
-
-#if 0
- itip_control_factory_init ();
- component_editor_factory_init ();
-#endif
-
- launch_alarm_daemon ();
-
-
- /* Initialize plugin system */
- e_plugin_hook_register_type (e_cal_popup_hook_get_type());
- e_plugin_hook_register_type (e_cal_menu_hook_get_type());
- e_plugin_hook_register_type (e_cal_config_hook_get_type ());
- e_plugin_hook_register_type (e_cal_event_hook_get_type ());
-
- klass = g_type_class_ref(e_import_get_type());
- e_import_class_add_importer(klass, gnome_calendar_importer_peek(), NULL, NULL);
- e_import_class_add_importer(klass, ical_importer_peek(), NULL, NULL);
- e_import_class_add_importer(klass, vcal_importer_peek(), NULL, NULL);
-}
-
-static BonoboObject *
-factory (BonoboGenericFactory *factory,
- const char *component_id,
- void *closure)
-{
- static gboolean initialized = FALSE;
-
- if (! initialized) {
- initialize ();
- initialized = TRUE;
- }
-
- if (strcmp (component_id, CALENDAR_COMPONENT_ID) == 0) {
- BonoboObject *object = BONOBO_OBJECT (calendar_component_peek ());
- bonobo_object_ref (object);
- return object;
- } else if (strcmp (component_id, TASKS_COMPONENT_ID) == 0) {
- BonoboObject *object = BONOBO_OBJECT (tasks_component_peek ());
- bonobo_object_ref (object);
- return object;
- } else if (strcmp (component_id, MEMOS_COMPONENT_ID) == 0){
- BonoboObject *object = BONOBO_OBJECT (memos_component_peek ());
- bonobo_object_ref (object);
- return object;
- } else if (strcmp (component_id, ITIP_CONTROL_ID) == 0)
- return BONOBO_OBJECT (itip_bonobo_control_new ());
- else if (strcmp (component_id, CONFIG_CONTROL_ID) == 0) {
- GtkWidget *prefs;
- EvolutionConfigControl *control;
-
- prefs = calendar_prefs_dialog_new ();
- gtk_widget_show (prefs);
- control = evolution_config_control_new (prefs);
-
- return BONOBO_OBJECT (control);
- } else if (strcmp (component_id, COMP_EDITOR_FACTORY_ID) == 0)
- return BONOBO_OBJECT (comp_editor_factory_fn ());
-
- g_warning (FACTORY_ID ": Don't know what to do with %s", component_id);
- return NULL;
-}
-
-BONOBO_ACTIVATION_SHLIB_FACTORY (FACTORY_ID, "Evolution Calendar component factory", factory, NULL)
diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c
index d14b350d1c..44bc1350d0 100644
--- a/calendar/gui/memos-component.c
+++ b/calendar/gui/memos-component.c
@@ -58,28 +58,13 @@
#define CREATE_SHARED_MEMO_ID "shared-memo"
#define CREATE_MEMO_LIST_ID "memo-list"
-enum DndTargetType {
- DND_TARGET_TYPE_CALENDAR_LIST
-};
-#define CALENDAR_TYPE "text/calendar"
-#define XCALENDAR_TYPE "text/x-calendar"
#define WEB_BASE_URI "webcal://"
#define PERSONAL_RELATIVE_URI "system"
-static GtkTargetEntry drag_types[] = {
- { (gchar *) CALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST },
- { (gchar *) XCALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST }
-};
-static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]);
-
#define PARENT_TYPE bonobo_object_get_type ()
static BonoboObjectClass *parent_class = NULL;
-/* Memos should have their own registry */
-extern ECompEditorRegistry *comp_editor_registry;
-
-
typedef struct _MemosComponentView
{
ESourceList *source_list;
@@ -90,29 +75,17 @@ typedef struct _MemosComponentView
ETable *table;
ETableModel *model;
- EInfoLabel *info_label;
GtkWidget *source_selector;
- BonoboControl *view_control;
- BonoboControl *sidebar_control;
- BonoboControl *statusbar_control;
-
GList *notifications;
- EUserCreatableItemsHandler *creatable_items_handler;
-
- EActivityHandler *activity_handler;
} MemosComponentView;
struct _MemosComponentPrivate {
- char *base_directory;
- char *config_directory;
ESourceList *source_list;
GSList *source_selection;
- GList *views;
-
ECal *create_ecal;
GList *notifications;
@@ -120,109 +93,6 @@ struct _MemosComponentPrivate {
#define d(x)
-static void
-ensure_sources (MemosComponent *component)
-{
- ESourceList *source_list;
- ESourceGroup *on_this_computer;
- ESource *personal_source;
- char *base_uri, *base_uri_proto, base_uri_proto_seventh;
- const gchar *base_dir;
-
- personal_source = NULL;
-
- if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_JOURNAL, NULL)) {
- g_warning ("Could not get memo source list from GConf!");
- return;
- }
-
- base_dir = memos_component_peek_base_directory (component);
- base_uri = g_build_filename (base_dir, "local", NULL);
-
- base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
- if (strlen (base_uri_proto) > 7) {
- /* compare only file:// part. If user home dir name changes we do not want to create
- one more group */
- base_uri_proto_seventh = base_uri_proto[7];
- base_uri_proto[7] = 0;
- } else {
- base_uri_proto_seventh = -1;
- }
-
- on_this_computer = e_source_list_ensure_group (source_list, _("On This Computer"), base_uri_proto, TRUE);
- e_source_list_ensure_group (source_list, _("On The Web"), WEB_BASE_URI, FALSE);
-
- if (base_uri_proto_seventh != -1) {
- base_uri_proto[7] = base_uri_proto_seventh;
- }
-
- if (on_this_computer) {
- /* make sure "Personal" shows up as a source under
- this group */
- GSList *sources = e_source_group_peek_sources (on_this_computer);
- GSList *s;
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
- const gchar *relative_uri;
-
- relative_uri = e_source_peek_relative_uri (source);
- if (relative_uri == NULL)
- continue;
- if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
- personal_source = source;
- break;
- }
- }
- /* Make sure we have the correct base uri. This can change when user's
- homedir name changes */
- if (strcmp (base_uri_proto, e_source_group_peek_base_uri (on_this_computer))) {
- e_source_group_set_base_uri (on_this_computer, base_uri_proto);
-
- /* *sigh* . We shouldn't need this sync call here as set_base_uri
- call results in synching to gconf, but that happens in idle loop
- and too late to prevent user seeing "Can not Open ... because of invalid uri" error.*/
- e_source_list_sync (source_list,NULL);
- }
- }
-
- if (personal_source) {
- /* ensure the source name is in current locale, not read from configuration */
- e_source_set_name (personal_source, _("Personal"));
- } else {
- GSList *memos_selected;
- /* Create the default Person addressbook */
- ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
- e_source_group_add_source (on_this_computer, source, -1);
- g_object_unref (source);
-
- memos_selected = calendar_config_get_memos_selected ();
-
- if (!calendar_config_get_primary_memos () && !memos_selected) {
- GSList selected;
-
- calendar_config_set_primary_memos (e_source_peek_uid (source));
-
- selected.data = (gpointer)e_source_peek_uid (source);
- selected.next = NULL;
- calendar_config_set_memos_selected (&selected);
- }
-
- if (memos_selected) {
- g_slist_foreach (memos_selected, (GFunc) g_free, NULL);
- g_slist_free (memos_selected);
- }
-
- e_source_set_color_spec (source, "#BECEDD");
- personal_source = source;
- }
-
- component->priv->source_list = source_list;
-
- g_object_unref (on_this_computer);
- g_free (base_uri_proto);
- g_free (base_uri);
-}
-
/* Utility functions. */
/* FIXME Some of these are duplicated from calendar-component.c */
static gboolean
@@ -256,7 +126,7 @@ is_in_uids (GSList *uids, ESource *source)
}
static void
-update_uris_for_selection (MemosComponentView *component_view)
+source_selection_changed_cb (ESourceSelector *selector, MemosComponentView *component_view)
{
GSList *selection, *l, *uids_selected = NULL;
@@ -284,339 +154,8 @@ update_uris_for_selection (MemosComponentView *component_view)
g_slist_free (uids_selected);
}
-static void
-update_uri_for_primary_selection (MemosComponentView *component_view)
-{
- ESource *source;
- EMemoTable *cal_table;
- ETable *etable;
-
- source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!source)
- return;
-
- /* Set the default */
- e_memos_set_default_source (component_view->memos, source);
-
- cal_table = e_memos_get_calendar_table (component_view->memos);
- etable = e_memo_table_get_table (cal_table);
-
- memos_control_sensitize_commands (component_view->view_control, component_view->memos, e_table_selected_count (etable));
-
- /* Save the selection for next time we start up */
- calendar_config_set_primary_memos (e_source_peek_uid (source));
-}
-
-static void
-update_selection (MemosComponentView *component_view)
-{
- GSList *selection, *uids_selected, *l;
-
- d(g_message("memos-component.c: update_selection called");)
-
- /* Get the selection in gconf */
- uids_selected = calendar_config_get_memos_selected ();
-
- /* Remove any that aren't there any more */
- selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (component_view->source_selector));
-
- for (l = selection; l; l = l->next) {
- ESource *source = l->data;
-
- if (!is_in_uids (uids_selected, source))
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
- }
-
- e_source_selector_free_selection (selection);
-
- /* Make sure the whole selection is there */
- for (l = uids_selected; l; l = l->next) {
- char *uid = l->data;
- ESource *source;
-
- source = e_source_list_peek_source_by_uid (component_view->source_list, uid);
- if (source)
- e_source_selector_select_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
-
- g_free (uid);
- }
- g_slist_free (uids_selected);
-}
-
-static void
-update_primary_selection (MemosComponentView *component_view)
-{
- ESource *source = NULL;
- char *uid;
-
- uid = calendar_config_get_primary_memos ();
- if (uid) {
- source = e_source_list_peek_source_by_uid (component_view->source_list, uid);
- g_free (uid);
- }
-
- if (source) {
- e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector), source);
- } else {
- /* Try to create a default if there isn't one */
- source = e_source_list_peek_source_any (component_view->source_list);
- if (source)
- e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector), source);
- }
-
-}
-
-
-/* Callbacks. */
-/* TODO: doesn't work! */
-static void
-copy_memo_list_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- MemosComponentView *component_view = data;
- ESource *selected_source;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- copy_source_dialog (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), selected_source, E_CAL_SOURCE_TYPE_JOURNAL);
-}
-
-static void
-delete_memo_list_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- MemosComponentView *component_view = data;
- ESource *selected_source;
- ECal *cal;
- char *uri;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- if (e_error_run((GtkWindow *)gtk_widget_get_toplevel(ep->target->widget),
- "calendar:prompt-delete-memo-list", e_source_peek_name(selected_source), NULL) != GTK_RESPONSE_YES)
- return;
-
- /* first, ask the backend to remove the memo list */
- uri = e_source_get_uri (selected_source);
- cal = e_cal_model_get_client_for_uri (
- e_memo_table_get_model (E_MEMO_TABLE (e_memos_get_calendar_table (component_view->memos))),
- uri);
- if (!cal)
- cal = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_JOURNAL);
- g_free (uri);
- if (cal) {
- if (e_cal_remove (cal, NULL)) {
- if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (component_view->source_selector),
- selected_source)) {
- e_memos_remove_memo_source (component_view->memos, selected_source);
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector),
- selected_source);
- }
-
- e_source_group_remove_source (e_source_peek_group (selected_source), selected_source);
- e_source_list_sync (component_view->source_list, NULL);
- }
- }
-}
-
-static void
-new_memo_list_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- calendar_setup_new_memo_list (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)));
-}
-
-static void
-rename_memo_list_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- MemosComponentView *component_view = data;
- ESourceSelector *selector;
-
- selector = E_SOURCE_SELECTOR (component_view->source_selector);
- e_source_selector_edit_primary_selection (selector);
-}
-
-static void
-edit_memo_list_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- MemosComponentView *component_view = data;
- ESource *selected_source;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- calendar_setup_edit_memo_list (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), selected_source);
-}
-
-static void
-set_offline_availability (EPopup *ep, EPopupItem *pitem, void *data, const char *value)
-{
- MemosComponentView *component_view = data;
- ESource *selected_source;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- e_source_set_property (selected_source, "offline_sync", value);
-}
-
-static void
-mark_no_offline_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- set_offline_availability (ep, pitem, data, "0");
-}
-
-static void
-mark_offline_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- set_offline_availability (ep, pitem, data, "1");
-}
-
-static EPopupItem emc_source_popups[] = {
- { E_POPUP_ITEM, (gchar *) "10.new", (gchar *) N_("_New Memo List"), new_memo_list_cb, NULL, (gchar *) "stock_notes", 0, 0 },
- { E_POPUP_ITEM, (gchar *) "15.copy", (gchar *) N_("_Copy..."), copy_memo_list_cb, NULL, (gchar *) "edit-copy", 0, E_CAL_POPUP_SOURCE_PRIMARY },
- { E_POPUP_ITEM, (gchar *) "18.rename", (gchar *) N_("_Rename..."), rename_memo_list_cb, NULL, NULL, 0, E_CAL_POPUP_SOURCE_PRIMARY },
-
- { E_POPUP_BAR, (gchar *) "20.bar" },
- { E_POPUP_ITEM, (gchar *) "20.delete", (gchar *) N_("_Delete"), delete_memo_list_cb, NULL, (gchar *) "edit-delete", 0, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY },
- { E_POPUP_ITEM, (gchar *) "30.mark_memos_offline", (gchar *) N_("_Make available for offline use"), mark_offline_cb, NULL, (gchar *) "stock_disconnect", E_CAL_POPUP_SOURCE_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_OFFLINE },
- { E_POPUP_ITEM, (gchar *) "40.mark_memos_no_offline", (gchar *) N_("_Do not make available for offline use"), mark_no_offline_cb, NULL, (gchar *) "stock_connect", E_CAL_POPUP_SOURCE_NO_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_NO_OFFLINE },
-
- { E_POPUP_BAR, (gchar *) "99.bar" },
- { E_POPUP_ITEM, (gchar *) "99.properties", (gchar *) N_("_Properties"), edit_memo_list_cb, NULL, (gchar *) "document-properties", 0, E_CAL_POPUP_SOURCE_PRIMARY },
-};
-
-static void
-emc_source_popup_free(EPopup *ep, GSList *list, void *data)
-{
- g_slist_free(list);
-}
-
-static gboolean
-popup_event_cb(ESourceSelector *selector, ESource *insource, GdkEventButton *event, MemosComponentView *component_view)
-{
- ECalPopup *ep;
- ECalPopupTargetSource *t;
- GSList *menus = NULL;
- int i;
- GtkMenu *menu;
-
- /** @HookPoint-ECalPopup: Memos Source Selector Context Menu
- * @Id: org.gnome.evolution.memos.source.popup
- * @Class: org.gnome.evolution.calendar.popup:1.0
- * @Target: ECalPopupTargetSource
- *
- * The context menu on the source selector in the memos window.
- */
- ep = e_cal_popup_new("org.gnome.evolution.memos.source.popup");
- t = e_cal_popup_target_new_source(ep, selector);
- t->target.widget = (GtkWidget *)component_view->memos;
-
- for (i=0;i<sizeof(emc_source_popups)/sizeof(emc_source_popups[0]);i++)
- menus = g_slist_prepend(menus, &emc_source_popups[i]);
-
- e_popup_add_items((EPopup *)ep, menus, NULL,emc_source_popup_free, component_view);
-
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event?event->button:0, event?event->time:gtk_get_current_event_time());
-
- return TRUE;
-}
-
-static void
-source_selection_changed_cb (ESourceSelector *selector, MemosComponentView *component_view)
-{
- update_uris_for_selection (component_view);
-}
-
-static void
-primary_source_selection_changed_cb (ESourceSelector *selector, MemosComponentView *component_view)
-{
- update_uri_for_primary_selection (component_view);
-}
-
-static void
-source_added_cb (EMemos *memos, ESource *source, MemosComponentView *component_view)
-{
- e_source_selector_select_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
-}
-
-static void
-source_removed_cb (EMemos *memos, ESource *source, MemosComponentView *component_view)
-{
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
-}
-
-static void
-set_info (MemosComponentView *component_view)
-{
- GString *message = g_string_new (NULL);
- int rows, selected_rows;
-
- rows = e_table_model_row_count (component_view->model);
- selected_rows = e_table_selected_count (component_view->table);
-
- g_string_append_printf(message, ngettext("%d memo", "%d memos", rows), rows);
- if (selected_rows > 0)
- g_string_append_printf(message, ngettext(", %d selected", ", %d selected", selected_rows), selected_rows);
-
- e_info_label_set_info (component_view->info_label, _("Memos"), message->str);
-
- g_string_free (message, TRUE);
-}
-
-static void
-table_selection_change_cb (ETableModel *etm, MemosComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
-model_changed_cb (ETableModel *etm, MemosComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
-model_rows_inserted_cb (ETableModel *etm, int row, int count, MemosComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
-model_rows_deleted_cb (ETableModel *etm, int row, int count, MemosComponentView *component_view)
-{
- set_info (component_view);
-}
-
/* Evolution::Component CORBA methods */
-static void
-impl_upgradeFromVersion (PortableServer_Servant servant,
- CORBA_short major,
- CORBA_short minor,
- CORBA_short revision,
- CORBA_Environment *ev)
-{
- GError *err = NULL;
- MemosComponent *component = MEMOS_COMPONENT (bonobo_object_from_servant (servant));
-
- if (!migrate_memos(component, major, minor, revision, &err)) {
- GNOME_Evolution_Component_UpgradeFailed *failedex;
-
- failedex = GNOME_Evolution_Component_UpgradeFailed__alloc();
- failedex->what = CORBA_string_dup(_("Failed upgrading memos."));
- failedex->why = CORBA_string_dup(err->message);
- CORBA_exception_set(ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UpgradeFailed, failedex);
- }
-
- if (err)
- g_error_free(err);
-}
-
static gboolean
selector_tree_data_dropped (ESourceSelector *selector,
GtkSelectionData *data,
@@ -668,19 +207,6 @@ selector_tree_data_dropped (ESourceSelector *selector,
}
static void
-control_activate_cb (BonoboControl *control, gboolean activate, gpointer data)
-{
- MemosComponentView *component_view = data;
-
- if (activate) {
- BonoboUIComponent *uic;
- uic = bonobo_control_get_ui_component (component_view->view_control);
-
- e_user_creatable_items_handler_activate (component_view->creatable_items_handler, uic);
- }
-}
-
-static void
config_create_ecal_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
{
MemosComponent *component = data;
@@ -812,140 +338,32 @@ create_new_memo (MemosComponent *memo_component, gboolean is_assigned, MemosComp
return TRUE;
}
-static void
-create_local_item_cb (EUserCreatableItemsHandler *handler, const char *item_type_name, void *data)
-{
- MemosComponent *memos_component = data;
- MemosComponentPrivate *priv;
- MemosComponentView *component_view = NULL;
- GList *l;
-
- priv = memos_component->priv;
-
- for (l = priv->views; l; l = l->next) {
- component_view = l->data;
-
- if (component_view->creatable_items_handler == handler)
- break;
-
- component_view = NULL;
- }
-
- if (strcmp (item_type_name, CREATE_MEMO_ID) == 0) {
- create_new_memo (memos_component, FALSE, component_view);
- } else if (strcmp (item_type_name, CREATE_SHARED_MEMO_ID) == 0) {
- create_new_memo (memos_component, TRUE, component_view);
- } else if (strcmp (item_type_name, CREATE_MEMO_LIST_ID) == 0) {
- calendar_setup_new_memo_list (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (component_view->memos))));
- }
-}
-
static MemosComponentView *
create_component_view (MemosComponent *memos_component)
{
MemosComponentPrivate *priv;
MemosComponentView *component_view;
- GtkWidget *selector_scrolled_window, *vbox;
GtkWidget *statusbar_widget;
- AtkObject *a11y;
priv = memos_component->priv;
/* Create the calendar component view */
component_view = g_new0 (MemosComponentView, 1);
- /* Add the source lists */
- component_view->source_list = g_object_ref (priv->source_list);
-
/* Create sidebar selector */
- component_view->source_selector = e_source_selector_new (memos_component->priv->source_list);
- e_source_selector_set_select_new ((ESourceSelector *)component_view->source_selector, TRUE);
- a11y = gtk_widget_get_accessible (GTK_WIDGET (component_view->source_selector));
- atk_object_set_name (a11y, _("Memo Source Selector"));
-
- g_signal_connect (
- component_view->source_selector, "data-dropped",
- G_CALLBACK (selector_tree_data_dropped), memos_component);
-
- gtk_drag_dest_set(component_view->source_selector, GTK_DEST_DEFAULT_ALL, drag_types,
- num_drag_types, GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
- gtk_widget_show (component_view->source_selector);
-
- selector_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (selector_scrolled_window), component_view->source_selector);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (selector_scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (selector_scrolled_window),
- GTK_SHADOW_IN);
- gtk_widget_show (selector_scrolled_window);
-
- component_view->info_label = (EInfoLabel *)e_info_label_new("evolution-memos");
- e_info_label_set_info(component_view->info_label, _("Memos"), "");
- gtk_widget_show (GTK_WIDGET (component_view->info_label));
-
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX (vbox), GTK_WIDGET (component_view->info_label), FALSE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX (vbox), selector_scrolled_window, TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- component_view->sidebar_control = bonobo_control_new (vbox);
-
- /* Create main view */
- component_view->view_control = memos_control_new ();
- if (!component_view->view_control) {
- /* FIXME free memory */
-
- return NULL;
- }
+ g_signal_connect (component_view->source_selector, "drag-data-received",
+ G_CALLBACK (selector_tree_drag_data_received), memos_component);
component_view->memos = (EMemos *) bonobo_control_get_widget (component_view->view_control);
component_view->table = e_memo_table_get_table (e_memos_get_calendar_table (component_view->memos));
component_view->model = E_TABLE_MODEL (e_memo_table_get_model (e_memos_get_calendar_table (component_view->memos)));
- /* This signal is thrown if backends die - we update the selector */
- g_signal_connect (component_view->memos, "source_added",
- G_CALLBACK (source_added_cb), component_view);
- g_signal_connect (component_view->memos, "source_removed",
- G_CALLBACK (source_removed_cb), component_view);
-
- /* Create status bar */
- statusbar_widget = e_task_bar_new ();
- component_view->activity_handler = e_activity_handler_new ();
- e_activity_handler_attach_task_bar (component_view->activity_handler, E_TASK_BAR (statusbar_widget));
- gtk_widget_show (statusbar_widget);
-
- component_view->statusbar_control = bonobo_control_new (statusbar_widget);
-
- e_memo_table_set_activity_handler (e_memos_get_calendar_table (component_view->memos), component_view->activity_handler);
-
/* connect after setting the initial selections, or we'll get unwanted calls
to calendar_control_sensitize_calendar_commands */
g_signal_connect (component_view->source_selector, "selection_changed",
G_CALLBACK (source_selection_changed_cb), component_view);
g_signal_connect (component_view->source_selector, "primary_selection_changed",
G_CALLBACK (primary_source_selection_changed_cb), component_view);
- g_signal_connect (component_view->source_selector, "popup_event",
- G_CALLBACK (popup_event_cb), component_view);
-
- /* Set up the "new" item handler */
- component_view->creatable_items_handler = e_user_creatable_items_handler_new ("memos", create_local_item_cb, memos_component);
- g_signal_connect (component_view->view_control, "activate", G_CALLBACK (control_activate_cb), component_view);
-
- /* We use this to update the component information */
- set_info (component_view);
- g_signal_connect (component_view->table, "selection_change",
- G_CALLBACK (table_selection_change_cb), component_view);
- g_signal_connect (component_view->model, "model_changed",
- G_CALLBACK (model_changed_cb), component_view);
- g_signal_connect (component_view->model, "model_rows_inserted",
- G_CALLBACK (model_rows_inserted_cb), component_view);
- g_signal_connect (component_view->model, "model_rows_deleted",
- G_CALLBACK (model_rows_deleted_cb), component_view);
-
- /* Load the selection from the last run */
- update_selection (component_view);
- update_primary_selection (component_view);
return component_view;
}
@@ -965,130 +383,9 @@ destroy_component_view (MemosComponentView *component_view)
calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
g_list_free (component_view->notifications);
- if (component_view->creatable_items_handler)
- g_object_unref (component_view->creatable_items_handler);
-
- if (component_view->activity_handler)
- g_object_unref (component_view->activity_handler);
-
g_free (component_view);
}
-static void
-view_destroyed_cb (gpointer data, GObject *where_the_object_was)
-{
- MemosComponent *memos_component = data;
- MemosComponentPrivate *priv;
- GList *l;
-
- priv = memos_component->priv;
-
- for (l = priv->views; l; l = l->next) {
- MemosComponentView *component_view = l->data;
-
- if (G_OBJECT (component_view->view_control) == where_the_object_was) {
- priv->views = g_list_remove (priv->views, component_view);
- destroy_component_view (component_view);
-
- break;
- }
- }
-}
-
-static GNOME_Evolution_ComponentView
-impl_createView (PortableServer_Servant servant,
- GNOME_Evolution_ShellView parent,
- CORBA_boolean select_item,
- CORBA_Environment *ev)
-{
- MemosComponent *component = MEMOS_COMPONENT (bonobo_object_from_servant (servant));
- MemosComponentPrivate *priv;
- MemosComponentView *component_view;
- EComponentView *ecv;
-
- priv = component->priv;
-
- /* Create the calendar component view */
- component_view = create_component_view (component);
- if (!component_view) {
- /* FIXME Should we describe the problem in a control? */
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
-
- return CORBA_OBJECT_NIL;
- }
-
- g_object_weak_ref (G_OBJECT (component_view->view_control), view_destroyed_cb, component);
- priv->views = g_list_append (priv->views, component_view);
-
- /* TODO: Make CalendarComponentView just subclass EComponentView */
- ecv = e_component_view_new_controls (parent, "memos", component_view->sidebar_control,
- component_view->view_control, component_view->statusbar_control);
-
- return BONOBO_OBJREF(ecv);
-}
-
-static GNOME_Evolution_CreatableItemTypeList *
-impl__get_userCreatableItems (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GNOME_Evolution_CreatableItemTypeList *list = GNOME_Evolution_CreatableItemTypeList__alloc ();
-
- list->_length = 3;
- list->_maximum = list->_length;
- list->_buffer = GNOME_Evolution_CreatableItemTypeList_allocbuf (list->_length);
-
- CORBA_sequence_set_release (list, FALSE);
-
- list->_buffer[0].id = (char *) CREATE_MEMO_ID;
- list->_buffer[0].description = (char *) _("New memo");
- list->_buffer[0].menuDescription = (char *) C_("New", "Mem_o");
- list->_buffer[0].tooltip = (char *) _("Create a new memo");
- list->_buffer[0].menuShortcut = 'o';
- list->_buffer[0].iconName = (char *) "stock_insert-note";
- list->_buffer[0].type = GNOME_Evolution_CREATABLE_OBJECT;
-
- list->_buffer[1].id = (char *) CREATE_SHARED_MEMO_ID;
- list->_buffer[1].description = (char *) _("New shared memo");
- list->_buffer[1].menuDescription = (char *) C_("New", "_Shared memo");
- list->_buffer[1].tooltip = (char *) _("Create a shared new memo");
- list->_buffer[1].menuShortcut = 'h';
- list->_buffer[1].iconName = (char *) "stock_insert-note";
- list->_buffer[1].type = GNOME_Evolution_CREATABLE_OBJECT;
-
- list->_buffer[2].id = (char *) CREATE_MEMO_LIST_ID;
- list->_buffer[2].description = (char *) _("New memo list");
- list->_buffer[2].menuDescription = (char *) C_("New", "Memo li_st");
- list->_buffer[2].tooltip = (char *) _("Create a new memo list");
- list->_buffer[2].menuShortcut = '\0';
- list->_buffer[2].iconName = (char *) "stock_notes";
- list->_buffer[2].type = GNOME_Evolution_CREATABLE_FOLDER;
-
- return list;
-}
-
-static void
-impl_requestCreateItem (PortableServer_Servant servant,
- const CORBA_char *item_type_name,
- CORBA_Environment *ev)
-{
- MemosComponent *memos_component = MEMOS_COMPONENT (bonobo_object_from_servant (servant));
-
- if (strcmp (item_type_name, CREATE_MEMO_ID) == 0) {
- if (!create_new_memo (memos_component, FALSE, NULL))
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
- }
- else if (strcmp (item_type_name, CREATE_MEMO_LIST_ID) == 0) {
- /* FIXME Should we use the last opened window? */
- calendar_setup_new_memo_list (NULL);
- } else if (strcmp (item_type_name, CREATE_SHARED_MEMO_ID) == 0) {
- if (!create_new_memo (memos_component, TRUE, NULL))
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
- }
- else {
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_UnknownType);
- }
-}
-
/* GObject methods. */
static void
@@ -1112,14 +409,6 @@ impl_dispose (GObject *object)
priv->create_ecal = NULL;
}
- for (l = priv->views; l; l = l->next) {
- MemosComponentView *component_view = l->data;
-
- g_object_weak_unref (G_OBJECT (component_view->view_control), view_destroyed_cb, memos_component);
- }
- g_list_free (priv->views);
- priv->views = NULL;
-
for (l = priv->notifications; l; l = l->next)
calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
g_list_free (priv->notifications);
@@ -1127,98 +416,3 @@ impl_dispose (GObject *object)
(* G_OBJECT_CLASS (parent_class)->dispose) (object);
}
-
-static void
-impl_finalize (GObject *object)
-{
- MemosComponentPrivate *priv = MEMOS_COMPONENT (object)->priv;
- GList *l;
-
- for (l = priv->views; l; l = l->next) {
- MemosComponentView *component_view = l->data;
-
- destroy_component_view (component_view);
- }
- g_list_free (priv->views);
-
- g_free (priv->base_directory);
- g_free (priv->config_directory);
- g_free (priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-memos_component_class_init (MemosComponentClass *klass)
-{
- POA_GNOME_Evolution_Component__epv *epv = &klass->epv;
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-
- parent_class = g_type_class_peek_parent (klass);
-
- epv->upgradeFromVersion = impl_upgradeFromVersion;
- epv->createView = impl_createView;
- epv->_get_userCreatableItems = impl__get_userCreatableItems;
- epv->requestCreateItem = impl_requestCreateItem;
-
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
-}
-
-static void
-memos_component_init (MemosComponent *component, MemosComponentClass *klass)
-{
- MemosComponentPrivate *priv;
-
- priv = g_new0 (MemosComponentPrivate, 1);
-
- priv->base_directory = g_build_filename (e_get_user_data_dir (), "memos", NULL);
- priv->config_directory = g_build_filename (priv->base_directory, "config", NULL);
-
- component->priv = priv;
- ensure_sources (component);
-}
-
-/* Public API */
-
-MemosComponent *
-memos_component_peek (void)
-{
- static MemosComponent *component = NULL;
-
- if (component == NULL) {
- component = g_object_new (memos_component_get_type (), NULL);
-
- if (g_mkdir_with_parents (component->priv->config_directory, 0777) != 0) {
- g_warning (G_STRLOC ": Cannot create directory %s: %s",
- component->priv->config_directory, g_strerror (errno));
- g_object_unref (component);
- component = NULL;
- }
- }
-
- return component;
-}
-
-const char *
-memos_component_peek_base_directory (MemosComponent *component)
-{
- return component->priv->base_directory;
-}
-
-const char *
-memos_component_peek_config_directory (MemosComponent *component)
-{
- return component->priv->config_directory;
-}
-
-ESourceList *
-memos_component_peek_source_list (MemosComponent *component)
-{
- return component->priv->source_list;
-}
-
-BONOBO_TYPE_FUNC_FULL (MemosComponent, GNOME_Evolution_Component, PARENT_TYPE, memos_component)
diff --git a/calendar/gui/memos-component.h b/calendar/gui/memos-component.h
index 3ca01a50f7..f1ba3de204 100644
--- a/calendar/gui/memos-component.h
+++ b/calendar/gui/memos-component.h
@@ -57,8 +57,4 @@ struct _MemosComponentClass {
GType memos_component_get_type (void);
MemosComponent *memos_component_peek (void);
-const char *memos_component_peek_base_directory (MemosComponent *component);
-const char *memos_component_peek_config_directory (MemosComponent *component);
-ESourceList *memos_component_peek_source_list (MemosComponent *component);
-
#endif /* _MEMOS_COMPONENT_H_ */
diff --git a/calendar/gui/memos-control.c b/calendar/gui/memos-control.c
deleted file mode 100644
index 2f7bd9b1bb..0000000000
--- a/calendar/gui/memos-control.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Damon Chaplin <damon@ximian.com>
- * Ettore Perazzoli
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <e-util/e-dialog-utils.h>
-#include <e-util/e-icon-factory.h>
-#include <e-util/e-print.h>
-#include <e-util/e-util-private.h>
-#include <gtkhtml/gtkhtml.h>
-
-#include "calendar-config.h"
-#include "e-memos.h"
-#include "e-memo-table.h"
-#include "print.h"
-#include "memos-control.h"
-#include "e-cal-component-memo-preview.h"
-#include "evolution-shell-component-utils.h"
-
-#define FIXED_MARGIN .05
-
-
-static void memos_control_activate_cb (BonoboControl *control,
- gboolean activate,
- gpointer user_data);
-static void memos_control_open_memo_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void memos_control_new_memo_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void memos_control_cut_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void memos_control_copy_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void memos_control_paste_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void memos_control_delete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void memos_control_print_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void memos_control_print_preview_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-
-struct focus_changed_data {
- BonoboControl *control;
- EMemos *memos;
-};
-
-static gboolean memos_control_focus_changed (GtkWidget *widget, GdkEventFocus *event, struct focus_changed_data *fc_data);
-
-BonoboControl *
-memos_control_new (void)
-{
- BonoboControl *control;
- GtkWidget *memos, *preview;
- struct focus_changed_data *fc_data;
-
- memos = e_memos_new ();
- if (!memos)
- return NULL;
- gtk_widget_show (memos);
-
- control = bonobo_control_new (memos);
- if (!control) {
- gtk_widget_destroy (memos);
- g_message ("control_factory_fn(): could not create the control!");
- return NULL;
- }
-
- g_signal_connect (control, "activate", G_CALLBACK (memos_control_activate_cb), memos);
-
- fc_data = g_new0 (struct focus_changed_data, 1);
- fc_data->control = control;
- fc_data->memos = E_MEMOS (memos);
-
- preview = e_cal_component_memo_preview_get_html (E_CAL_COMPONENT_MEMO_PREVIEW (e_memos_get_preview (fc_data->memos)));
- g_object_set_data_full (G_OBJECT (preview), "memos-ctrl-fc-data", fc_data, g_free);
- g_signal_connect (preview, "focus-in-event", G_CALLBACK (memos_control_focus_changed), fc_data);
- g_signal_connect (preview, "focus-out-event", G_CALLBACK (memos_control_focus_changed), fc_data);
-
- return control;
-}
-
-
-static void
-memos_control_activate_cb (BonoboControl *control,
- gboolean activate,
- gpointer user_data)
-{
- EMemos *memos;
-
- memos = E_MEMOS (user_data);
-
- if (activate)
- memos_control_activate (control, memos);
- else
- memos_control_deactivate (control, memos);
-}
-
-/* Sensitizes the UI Component menu/toolbar commands based on the number of
- * selected memos.
- */
-void
-memos_control_sensitize_commands (BonoboControl *control, EMemos *memos, int n_selected)
-{
- BonoboUIComponent *uic;
- gboolean read_only = TRUE, preview_active;
- ECal *ecal;
- ECalModel *model;
- GtkWidget *preview;
-
- uic = bonobo_control_get_ui_component (control);
- g_return_if_fail (uic != NULL);
-
- if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL)
- return;
-
- preview = e_cal_component_memo_preview_get_html (E_CAL_COMPONENT_MEMO_PREVIEW (e_memos_get_preview (memos)));
- preview_active = preview && GTK_WIDGET_VISIBLE (preview) && GTK_WIDGET_HAS_FOCUS (preview);
-
- model = e_memo_table_get_model (e_memos_get_calendar_table (memos));
- ecal = e_cal_model_get_default_client (model);
- if (ecal)
- e_cal_is_read_only (ecal, &read_only, NULL);
-
- bonobo_ui_component_set_prop (uic, "/commands/MemosOpenMemo", "sensitive",
- n_selected != 1 ? "0" : "1",
- NULL);
- bonobo_ui_component_set_prop (uic, "/commands/MemosCut", "sensitive",
- n_selected == 0 || read_only || preview_active ? "0" : "1",
- NULL);
- bonobo_ui_component_set_prop (uic, "/commands/MemosCopy", "sensitive",
- n_selected == 0 ? "0" : "1",
- NULL);
- bonobo_ui_component_set_prop (uic, "/commands/MemosPaste", "sensitive",
- read_only || preview_active ? "0" : "1",
- NULL);
- bonobo_ui_component_set_prop (uic, "/commands/MemosDelete", "sensitive",
- n_selected == 0 || read_only ? "0" : "1",
- NULL);
-}
-
-/* Callback used when the selection in the table changes */
-static void
-selection_changed_cb (EMemos *memos, int n_selected, gpointer data)
-{
- BonoboControl *control;
-
- control = BONOBO_CONTROL (data);
-
- memos_control_sensitize_commands (control, memos, n_selected);
-}
-
-static gboolean
-memos_control_focus_changed (GtkWidget *widget, GdkEventFocus *event, struct focus_changed_data *fc_data)
-{
- g_return_val_if_fail (fc_data != NULL, FALSE);
-
- memos_control_sensitize_commands (fc_data->control, fc_data->memos, e_table_selected_count (e_memo_table_get_table (e_memos_get_calendar_table (fc_data->memos))));
-
- return FALSE;
-}
-
-static BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("MemosOpenMemo", memos_control_open_memo_cmd),
- BONOBO_UI_VERB ("MemosNewMemo", memos_control_new_memo_cmd),
- BONOBO_UI_VERB ("MemosCut", memos_control_cut_cmd),
- BONOBO_UI_VERB ("MemosCopy", memos_control_copy_cmd),
- BONOBO_UI_VERB ("MemosPaste", memos_control_paste_cmd),
- BONOBO_UI_VERB ("MemosDelete", memos_control_delete_cmd),
- BONOBO_UI_VERB ("MemosPrint", memos_control_print_cmd),
- BONOBO_UI_VERB ("MemosPrintPreview", memos_control_print_preview_cmd),
-
- BONOBO_UI_VERB_END
-};
-
-static EPixmap pixmaps [] = {
- E_PIXMAP ("/commands/MemosCopy", "edit-copy", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MemosCut", "edit-cut", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MemosDelete", "edit-delete", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MemosPaste", "edit-paste", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MemosPrint", "document-print", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MemosPrintPreview", "document-print-preview", GTK_ICON_SIZE_MENU),
-
- E_PIXMAP ("/Toolbar/Cut", "edit-cut", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Copy", "edit-copy", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Paste", "edit-paste", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Print", "document-print", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Delete", "edit-delete", GTK_ICON_SIZE_LARGE_TOOLBAR),
-
- E_PIXMAP_END
-};
-
-void
-memos_control_activate (BonoboControl *control, EMemos *memos)
-{
- Bonobo_UIContainer remote_uih;
- BonoboUIComponent *uic;
- int n_selected;
- EMemoTable *cal_table;
- ETable *etable;
- char *xmlfile;
-
- uic = bonobo_control_get_ui_component (control);
- g_return_if_fail (uic != NULL);
-
- remote_uih = bonobo_control_get_remote_ui_container (control, NULL);
- bonobo_ui_component_set_container (uic, remote_uih, NULL);
- bonobo_object_release_unref (remote_uih, NULL);
-
- e_memos_set_ui_component (memos, uic);
-
- bonobo_ui_component_add_verb_list_with_data (uic, verbs, memos);
-
- bonobo_ui_component_freeze (uic, NULL);
-
- xmlfile = g_build_filename (EVOLUTION_UIDIR,
- "evolution-memos.xml",
- NULL);
- bonobo_ui_util_set_ui (uic, PREFIX,
- xmlfile,
- "evolution-memos",
- NULL);
- g_free (xmlfile);
-
- e_pixmaps_update (uic, pixmaps);
-
- e_memos_setup_view_menus (memos, uic);
-
- /* Signals from the memos widget; also sensitize the menu items as appropriate */
-
- g_signal_connect (memos, "selection_changed", G_CALLBACK (selection_changed_cb), control);
-
- cal_table = e_memos_get_calendar_table (memos);
- etable = e_memo_table_get_table (cal_table);
- n_selected = e_table_selected_count (etable);
-
- memos_control_sensitize_commands (control, memos, n_selected);
-
- bonobo_ui_component_thaw (uic, NULL);
-}
-
-
-void
-memos_control_deactivate (BonoboControl *control, EMemos *memos)
-{
- BonoboUIComponent *uic = bonobo_control_get_ui_component (control);
-
- g_return_if_fail (uic != NULL);
-
- e_memos_set_ui_component (memos, NULL);
-
- e_memos_discard_view_menus (memos);
-
- /* Stop monitoring the "selection_changed" signal */
- g_signal_handlers_disconnect_matched (memos, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, control);
-
- bonobo_ui_component_rm (uic, "/", NULL);
- bonobo_ui_component_unset_container (uic, NULL);
-}
-
-static void memos_control_open_memo_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos;
-
- memos = E_MEMOS (data);
- e_memos_open_memo (memos);
-}
-
-static void
-memos_control_new_memo_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos;
-
- memos = E_MEMOS (data);
- e_memos_new_memo (memos);
-}
-
-static void
-memos_control_cut_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos;
- EMemoTable *cal_table;
-
- memos = E_MEMOS (data);
- cal_table = e_memos_get_calendar_table (memos);
- e_memo_table_cut_clipboard (cal_table);
-}
-
-static void
-memos_control_copy_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos;
- EMemoTable *cal_table;
- GtkWidget *preview;
-
- memos = E_MEMOS (data);
-
- preview = e_cal_component_memo_preview_get_html (E_CAL_COMPONENT_MEMO_PREVIEW (e_memos_get_preview (memos)));
- if (preview && GTK_WIDGET_VISIBLE (preview) && GTK_WIDGET_HAS_FOCUS (preview)) {
- /* copy selected text in a preview when that's shown and focused */
- gtk_html_copy (GTK_HTML (preview));
- } else {
- cal_table = e_memos_get_calendar_table (memos);
- e_memo_table_copy_clipboard (cal_table);
- }
-}
-
-static void
-memos_control_paste_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos;
- EMemoTable *cal_table;
-
- memos = E_MEMOS (data);
- cal_table = e_memos_get_calendar_table (memos);
- e_memo_table_paste_clipboard (cal_table);
-}
-
-static void
-memos_control_delete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos;
-
- memos = E_MEMOS (data);
- e_memos_delete_selected (memos);
-}
-
-/* File/Print callback */
-static void
-memos_control_print_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos = E_MEMOS (data);
- ETable *table;
-
- table = e_memo_table_get_table (
- E_MEMO_TABLE (e_memos_get_calendar_table (memos)));
-
- print_table (
- table, _("Print Memos"), _("Memos"),
- GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-}
-
-static void
-memos_control_print_preview_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- EMemos *memos = E_MEMOS (data);
- ETable *table;
-
- table = e_memo_table_get_table (
- E_MEMO_TABLE (e_memos_get_calendar_table (memos)));
-
- print_table (
- table, _("Print Memos"), _("Memos"),
- GTK_PRINT_OPERATION_ACTION_PREVIEW);
-}
diff --git a/calendar/gui/memos-control.h b/calendar/gui/memos-control.h
deleted file mode 100644
index 565ac160ed..0000000000
--- a/calendar/gui/memos-control.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Federico Mena Quintero <federico@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _MEMOS_CONTROL_H_
-#define _MEMOS_CONTROL_H_
-
-#include "e-memos.h"
-
-BonoboControl *memos_control_new (void);
-void memos_control_activate (BonoboControl *control, EMemos *memos);
-void memos_control_deactivate (BonoboControl *control, EMemos *memos);
-void memos_control_sensitize_commands (BonoboControl *control, EMemos *memos, int n_selected);
-
-#endif /* _MEMOS_CONTROL_H_ */
diff --git a/calendar/gui/migration.h b/calendar/gui/migration.h
deleted file mode 100644
index c16fd831b9..0000000000
--- a/calendar/gui/migration.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef MIGRATION_H
-#define MIGRATION_H
-
-#include <libedataserver/e-source-group.h>
-#include "calendar-component.h"
-#include "tasks-component.h"
-#include "memos-component.h"
-
-struct _GError;
-
-gboolean migrate_calendars (CalendarComponent *component, int major, int minor, int revision, struct _GError **err);
-gboolean migrate_tasks (TasksComponent *component, int major, int minor, int revision, struct _GError **err);
-gboolean migrate_memos (MemosComponent *component, int major, int minor, int revision, struct _GError **err);
-#endif
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index 3fca566bf2..2a5cda4090 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -43,7 +43,6 @@
#include <e-util/e-print.h>
#include <libecal/e-cal-time-util.h>
#include <libecal/e-cal-component.h>
-#include "calendar-commands.h"
#include "calendar-config.h"
#include "e-cal-model.h"
#include "e-day-view.h"
@@ -579,6 +578,7 @@ print_month_small (GtkPrintContext *context, GnomeCalendar *gcal, time_t month,
int titleflags, time_t greystart, time_t greyend,
int bordertitle)
{
+#if 0 /* KILL-BONOBO */
icaltimezone *zone = calendar_config_get_icaltimezone ();
PangoFontDescription *font, *font_bold, *font_normal;
time_t now, next;
@@ -704,6 +704,7 @@ print_month_small (GtkPrintContext *context, GnomeCalendar *gcal, time_t month,
}
pango_font_description_free (font_normal);
pango_font_description_free (font_bold);
+#endif
}
/* wraps text into the print context, not taking up more than its allowed space */
@@ -1248,6 +1249,7 @@ static void
print_day_details (GtkPrintContext *context, GnomeCalendar *gcal, time_t whence,
double left, double right, double top, double bottom)
{
+#if 0 /* KILL-BONOBO */
icaltimezone *zone = calendar_config_get_icaltimezone ();
EDayViewEvent *event;
PangoFontDescription *font;
@@ -1366,6 +1368,7 @@ print_day_details (GtkPrintContext *context, GnomeCalendar *gcal, time_t whence,
g_array_free (pdi.long_events, TRUE);
free_event_array (pdi.events[0]);
g_array_free (pdi.events[0], TRUE);
+#endif
}
/* Returns TRUE if the event is a one-day event (i.e. not a long event). */
@@ -1741,6 +1744,7 @@ print_week_summary (GtkPrintContext *context, GnomeCalendar *gcal,
int month, double font_size,
double left, double right, double top, double bottom)
{
+#if 0 /* KILL-BONOBO */
icaltimezone *zone = calendar_config_get_icaltimezone ();
EWeekViewEvent *event;
struct psinfo psi;
@@ -1834,6 +1838,7 @@ print_week_summary (GtkPrintContext *context, GnomeCalendar *gcal,
}
g_array_free (psi.events, TRUE);
g_array_free (spans, TRUE);
+#endif
}
@@ -1965,6 +1970,7 @@ print_todo_details (GtkPrintContext *context, GnomeCalendar *gcal,
time_t start, time_t end,
double left, double right, double top, double bottom)
{
+#if 0 /* KILL-BONOBO */
PangoFontDescription *font_summary;
double y, yend, x, xend;
struct icaltimetype *tt;
@@ -2054,6 +2060,7 @@ print_todo_details (GtkPrintContext *context, GnomeCalendar *gcal,
}
pango_font_description_free (font_summary);
+#endif
}
static void
@@ -2395,6 +2402,7 @@ print_calendar_draw_page (GtkPrintOperation *operation,
gint page_nr,
PrintCalItem *pcali)
{
+#if 0 /* KILL-BONOBO */
switch (gnome_calendar_get_view (pcali->gcal)) {
case GNOME_CAL_DAY_VIEW:
print_day_view (context, pcali->gcal, pcali->start);
@@ -2409,12 +2417,14 @@ print_calendar_draw_page (GtkPrintOperation *operation,
default:
g_return_if_reached ();
}
+#endif
}
void
print_calendar (GnomeCalendar *gcal, GtkPrintOperationAction action,
time_t start)
{
+#if 0 /* KILL-BONOBO */
GtkPrintOperation *operation;
PrintCalItem pcali;
@@ -2434,6 +2444,7 @@ print_calendar (GnomeCalendar *gcal, GtkPrintOperationAction action,
gtk_print_operation_run (operation, action, NULL, NULL);
g_object_unref (operation);
+#endif
}
/* returns number of required pages, when page_nr is -1 */
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index 68536b29cb..533e071a7c 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -57,28 +57,13 @@
#define CREATE_TASK_ASSIGNED_ID "task-assigned"
#define CREATE_TASK_LIST_ID "task-list"
-enum DndTargetType {
- DND_TARGET_TYPE_CALENDAR_LIST
-};
-#define CALENDAR_TYPE "text/calendar"
-#define XCALENDAR_TYPE "text/x-calendar"
#define WEB_BASE_URI "webcal://"
#define PERSONAL_RELATIVE_URI "system"
-static GtkTargetEntry drag_types[] = {
- { (gchar *) CALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST },
- { (gchar *) XCALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST }
-};
-static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]);
-
#define PARENT_TYPE bonobo_object_get_type ()
static BonoboObjectClass *parent_class = NULL;
-/* Tasks should have their own registry */
-extern ECompEditorRegistry *comp_editor_registry;
-
-
typedef struct
{
ESourceList *source_list;
@@ -89,23 +74,15 @@ typedef struct
ETable *table;
ETableModel *model;
- EInfoLabel *info_label;
GtkWidget *source_selector;
BonoboControl *view_control;
- BonoboControl *sidebar_control;
- BonoboControl *statusbar_control;
GList *notifications;
- EUserCreatableItemsHandler *creatable_items_handler;
-
- EActivityHandler *activity_handler;
} TasksComponentView;
struct _TasksComponentPrivate {
- char *base_directory;
- char *config_directory;
ESourceList *source_list;
GSList *source_selection;
@@ -117,109 +94,6 @@ struct _TasksComponentPrivate {
GList *notifications;
};
-static void
-ensure_sources (TasksComponent *component)
-{
- ESourceList *source_list;
- ESourceGroup *on_this_computer;
- ESource *personal_source;
- char *base_uri, *base_uri_proto, base_uri_proto_seventh;
- const gchar *base_dir;
-
- personal_source = NULL;
-
- if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_TODO, NULL)) {
- g_warning ("Could not get task source list from GConf!");
- return;
- }
-
- base_dir = tasks_component_peek_base_directory (component);
- base_uri = g_build_filename (base_dir, "local", NULL);
-
- base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
- if (strlen (base_uri_proto) > 7) {
- /* compare only file:// part. If user home dir name changes we do not want to create
- one more group */
- base_uri_proto_seventh = base_uri_proto[7];
- base_uri_proto[7] = 0;
- } else {
- base_uri_proto_seventh = -1;
- }
-
- on_this_computer = e_source_list_ensure_group (source_list, _("On This Computer"), base_uri_proto, TRUE);
- e_source_list_ensure_group (source_list, _("On The Web"), WEB_BASE_URI, FALSE);
-
- if (base_uri_proto_seventh != -1) {
- base_uri_proto[7] = base_uri_proto_seventh;
- }
-
- if (on_this_computer) {
- /* make sure "Personal" shows up as a source under
- this group */
- GSList *sources = e_source_group_peek_sources (on_this_computer);
- GSList *s;
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
- const gchar *relative_uri;
-
- relative_uri = e_source_peek_relative_uri (source);
- if (relative_uri == NULL)
- continue;
- if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
- personal_source = source;
- break;
- }
- }
- /* Make sure we have the correct base uri. This can change when user's
- homedir name changes */
- if (strcmp (base_uri_proto, e_source_group_peek_base_uri (on_this_computer))) {
- e_source_group_set_base_uri (on_this_computer, base_uri_proto);
-
- /* *sigh* . We shouldn't need this sync call here as set_base_uri
- call results in synching to gconf, but that happens in idle loop
- and too late to prevent user seeing "Can not Open ... because of invalid uri" error.*/
- e_source_list_sync (source_list,NULL);
- }
- }
-
- if (personal_source) {
- /* ensure the source name is in current locale, not read from configuration */
- e_source_set_name (personal_source, _("Personal"));
- } else {
- GSList *tasks_selected;
- /* Create the default Person addressbook */
- ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
- e_source_group_add_source (on_this_computer, source, -1);
- g_object_unref (source);
-
- tasks_selected = calendar_config_get_tasks_selected ();
-
- if (!calendar_config_get_primary_tasks () && !tasks_selected) {
- GSList selected;
-
- calendar_config_set_primary_tasks (e_source_peek_uid (source));
-
- selected.data = (gpointer)e_source_peek_uid (source);
- selected.next = NULL;
- calendar_config_set_tasks_selected (&selected);
- }
-
- if (tasks_selected) {
- g_slist_foreach (tasks_selected, (GFunc) g_free, NULL);
- g_slist_free (tasks_selected);
- }
-
- e_source_set_color_spec (source, "#BECEDD");
- personal_source = source;
- }
-
- component->priv->source_list = source_list;
-
- g_object_unref (on_this_computer);
- g_free (base_uri_proto);
- g_free (base_uri);
-}
-
/* Utility functions. */
/* FIXME Some of these are duplicated from calendar-component.c */
static gboolean
@@ -304,62 +178,6 @@ update_uri_for_primary_selection (TasksComponentView *component_view)
calendar_config_set_primary_tasks (e_source_peek_uid (source));
}
-static void
-update_selection (TasksComponentView *component_view)
-{
- GSList *selection, *uids_selected, *l;
-
- /* Get the selection in gconf */
- uids_selected = calendar_config_get_tasks_selected ();
-
- /* Remove any that aren't there any more */
- selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (component_view->source_selector));
-
- for (l = selection; l; l = l->next) {
- ESource *source = l->data;
-
- if (!is_in_uids (uids_selected, source))
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
- }
-
- e_source_selector_free_selection (selection);
-
- /* Make sure the whole selection is there */
- for (l = uids_selected; l; l = l->next) {
- char *uid = l->data;
- ESource *source;
-
- source = e_source_list_peek_source_by_uid (component_view->source_list, uid);
- if (source)
- e_source_selector_select_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
-
- g_free (uid);
- }
- g_slist_free (uids_selected);
-}
-
-static void
-update_primary_selection (TasksComponentView *component_view)
-{
- ESource *source = NULL;
- char *uid;
-
- uid = calendar_config_get_primary_tasks ();
- if (uid) {
- source = e_source_list_peek_source_by_uid (component_view->source_list, uid);
- g_free (uid);
- }
-
- if (source) {
- e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector), source);
- } else {
- /* Try to create a default if there isn't one */
- source = e_source_list_peek_source_any (component_view->source_list);
- if (source)
- e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector), source);
- }
-}
-
/* Callbacks. */
static void
copy_task_list_cb (EPopup *ep, EPopupItem *pitem, void *data)
@@ -531,84 +349,11 @@ primary_source_selection_changed_cb (ESourceSelector *selector, TasksComponentVi
}
static void
-source_added_cb (ETasks *tasks, ESource *source, TasksComponentView *component_view)
-{
- e_source_selector_select_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
-}
-
-static void
source_removed_cb (ETasks *tasks, ESource *source, TasksComponentView *component_view)
{
e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
}
-static void
-set_info (TasksComponentView *component_view)
-{
- GString *message = g_string_new (NULL);
- int rows, selected_rows;
-
- rows = e_table_model_row_count (component_view->model);
- selected_rows = e_table_selected_count (component_view->table);
-
- g_string_append_printf(message, ngettext("%d task", "%d tasks", rows), rows);
- if (selected_rows > 0)
- g_string_append_printf(message, ngettext(", %d selected", ", %d selected", selected_rows), selected_rows);
-
- e_info_label_set_info (component_view->info_label, _("Tasks"), message->str);
-
- g_string_free (message, TRUE);
-}
-
-static void
-table_selection_change_cb (ETableModel *etm, TasksComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
-model_changed_cb (ETableModel *etm, TasksComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
-model_rows_inserted_cb (ETableModel *etm, int row, int count, TasksComponentView *component_view)
-{
- set_info (component_view);
-}
-
-static void
-model_rows_deleted_cb (ETableModel *etm, int row, int count, TasksComponentView *component_view)
-{
- set_info (component_view);
-}
-
-/* Evolution::Component CORBA methods */
-
-static void
-impl_upgradeFromVersion (PortableServer_Servant servant,
- CORBA_short major,
- CORBA_short minor,
- CORBA_short revision,
- CORBA_Environment *ev)
-{
- GError *err = NULL;
- TasksComponent *component = TASKS_COMPONENT (bonobo_object_from_servant (servant));
-
- if (!migrate_tasks(component, major, minor, revision, &err)) {
- GNOME_Evolution_Component_UpgradeFailed *failedex;
-
- failedex = GNOME_Evolution_Component_UpgradeFailed__alloc();
- failedex->what = CORBA_string_dup(_("Failed upgrading tasks."));
- failedex->why = CORBA_string_dup(err->message);
- CORBA_exception_set(ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UpgradeFailed, failedex);
- }
-
- if (err)
- g_error_free(err);
-}
-
static gboolean
selector_tree_data_dropped (ESourceSelector *selector,
GtkSelectionData *data,
@@ -659,19 +404,6 @@ selector_tree_data_dropped (ESourceSelector *selector,
}
static void
-control_activate_cb (BonoboControl *control, gboolean activate, gpointer data)
-{
- TasksComponentView *component_view = data;
-
- if (activate) {
- BonoboUIComponent *uic;
- uic = bonobo_control_get_ui_component (component_view->view_control);
-
- e_user_creatable_items_handler_activate (component_view->creatable_items_handler, uic);
- }
-}
-
-static void
config_create_ecal_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
{
TasksComponent *component = data;
@@ -808,42 +540,11 @@ create_new_todo (TasksComponent *task_component, gboolean is_assigned, TasksComp
return TRUE;
}
-static void
-create_local_item_cb (EUserCreatableItemsHandler *handler, const char *item_type_name, void *data)
-{
- TasksComponent *tasks_component = data;
- TasksComponentPrivate *priv;
- TasksComponentView *component_view = NULL;
- GList *l;
-
- priv = tasks_component->priv;
-
- for (l = priv->views; l; l = l->next) {
- component_view = l->data;
-
- if (component_view->creatable_items_handler == handler)
- break;
-
- component_view = NULL;
- }
-
- if (strcmp (item_type_name, CREATE_TASK_ID) == 0) {
- create_new_todo (tasks_component, FALSE, component_view);
- } else if (strcmp (item_type_name, CREATE_TASK_ASSIGNED_ID) == 0) {
- create_new_todo (tasks_component, TRUE, component_view);
- } else if (strcmp (item_type_name, CREATE_TASK_LIST_ID) == 0) {
- calendar_setup_new_task_list (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (component_view->tasks))));
- }
-}
-
static TasksComponentView *
create_component_view (TasksComponent *tasks_component)
{
TasksComponentPrivate *priv;
TasksComponentView *component_view;
- GtkWidget *selector_scrolled_window, *vbox;
- GtkWidget *statusbar_widget;
- AtkObject *a11y;
priv = tasks_component->priv;
@@ -855,66 +556,18 @@ create_component_view (TasksComponent *tasks_component)
/* Create sidebar selector */
component_view->source_selector = e_source_selector_new (tasks_component->priv->source_list);
- e_source_selector_set_select_new ((ESourceSelector *)component_view->source_selector, TRUE);
- a11y = gtk_widget_get_accessible (GTK_WIDGET (component_view->source_selector));
- atk_object_set_name (a11y, _("Task Source Selector"));
-
- g_signal_connect (
- component_view->source_selector, "data-dropped",
- G_CALLBACK (selector_tree_data_dropped), tasks_component);
-
- gtk_drag_dest_set(component_view->source_selector, GTK_DEST_DEFAULT_ALL, drag_types,
- num_drag_types, GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
- gtk_widget_show (component_view->source_selector);
-
- selector_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (selector_scrolled_window), component_view->source_selector);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (selector_scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (selector_scrolled_window),
- GTK_SHADOW_IN);
- gtk_widget_show (selector_scrolled_window);
-
- component_view->info_label = (EInfoLabel *)e_info_label_new("evolution-tasks");
- e_info_label_set_info(component_view->info_label, _("Tasks"), "");
- gtk_widget_show (GTK_WIDGET (component_view->info_label));
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX (vbox), GTK_WIDGET (component_view->info_label), FALSE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX (vbox), selector_scrolled_window, TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- component_view->sidebar_control = bonobo_control_new (vbox);
-
- /* Create main view */
- component_view->view_control = tasks_control_new ();
- if (!component_view->view_control) {
- /* FIXME free memory */
-
- return NULL;
- }
+ g_signal_connect (component_view->source_selector, "drag-data-received",
+ G_CALLBACK (selector_tree_drag_data_received), tasks_component);
component_view->tasks = (ETasks *) bonobo_control_get_widget (component_view->view_control);
component_view->table = e_calendar_table_get_table (e_tasks_get_calendar_table (component_view->tasks));
component_view->model = E_TABLE_MODEL (e_calendar_table_get_model (e_tasks_get_calendar_table (component_view->tasks)));
/* This signal is thrown if backends die - we update the selector */
- g_signal_connect (component_view->tasks, "source_added",
- G_CALLBACK (source_added_cb), component_view);
g_signal_connect (component_view->tasks, "source_removed",
G_CALLBACK (source_removed_cb), component_view);
- /* Create status bar */
- statusbar_widget = e_task_bar_new ();
- component_view->activity_handler = e_activity_handler_new ();
- e_activity_handler_attach_task_bar (component_view->activity_handler, E_TASK_BAR (statusbar_widget));
- gtk_widget_show (statusbar_widget);
-
- component_view->statusbar_control = bonobo_control_new (statusbar_widget);
-
- e_calendar_table_set_activity_handler (e_tasks_get_calendar_table (component_view->tasks), component_view->activity_handler);
-
/* connect after setting the initial selections, or we'll get unwanted calls
to calendar_control_sensitize_calendar_commands */
g_signal_connect (component_view->source_selector, "selection_changed",
@@ -924,25 +577,6 @@ create_component_view (TasksComponent *tasks_component)
g_signal_connect (component_view->source_selector, "popup_event",
G_CALLBACK (popup_event_cb), component_view);
- /* Set up the "new" item handler */
- component_view->creatable_items_handler = e_user_creatable_items_handler_new ("tasks", create_local_item_cb, tasks_component);
- g_signal_connect (component_view->view_control, "activate", G_CALLBACK (control_activate_cb), component_view);
-
- /* We use this to update the component information */
- set_info (component_view);
- g_signal_connect (component_view->table, "selection_change",
- G_CALLBACK (table_selection_change_cb), component_view);
- g_signal_connect (component_view->model, "model_changed",
- G_CALLBACK (model_changed_cb), component_view);
- g_signal_connect (component_view->model, "model_rows_inserted",
- G_CALLBACK (model_rows_inserted_cb), component_view);
- g_signal_connect (component_view->model, "model_rows_deleted",
- G_CALLBACK (model_rows_deleted_cb), component_view);
-
- /* Load the selection from the last run */
- update_selection (component_view);
- update_primary_selection (component_view);
-
return component_view;
}
@@ -963,12 +597,6 @@ destroy_component_view (TasksComponentView *component_view)
calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
g_list_free (component_view->notifications);
- if (component_view->creatable_items_handler)
- g_object_unref (component_view->creatable_items_handler);
-
- if (component_view->activity_handler)
- g_object_unref (component_view->activity_handler);
-
g_free (component_view);
}
@@ -993,38 +621,6 @@ view_destroyed_cb (gpointer data, GObject *where_the_object_was)
}
}
-static GNOME_Evolution_ComponentView
-impl_createView (PortableServer_Servant servant,
- GNOME_Evolution_ShellView parent,
- CORBA_boolean select_item,
- CORBA_Environment *ev)
-{
- TasksComponent *component = TASKS_COMPONENT (bonobo_object_from_servant (servant));
- TasksComponentPrivate *priv;
- TasksComponentView *component_view;
- EComponentView *ecv;
-
- priv = component->priv;
-
- /* Create the calendar component view */
- component_view = create_component_view (component);
- if (!component_view) {
- /* FIXME Should we describe the problem in a control? */
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
-
- return CORBA_OBJECT_NIL;
- }
-
- g_object_weak_ref (G_OBJECT (component_view->view_control), view_destroyed_cb, component);
- priv->views = g_list_append (priv->views, component_view);
-
- /* TODO: Make TasksComponentView just subclass EComponentView */
- ecv = e_component_view_new_controls (parent, "tasks", component_view->sidebar_control,
- component_view->view_control, component_view->statusbar_control);
-
- return BONOBO_OBJREF(ecv);
-}
-
static void
impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environment *ev)
{
@@ -1098,45 +694,6 @@ impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environme
return;
}
-static GNOME_Evolution_CreatableItemTypeList *
-impl__get_userCreatableItems (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GNOME_Evolution_CreatableItemTypeList *list = GNOME_Evolution_CreatableItemTypeList__alloc ();
-
- list->_length = 3;
- list->_maximum = list->_length;
- list->_buffer = GNOME_Evolution_CreatableItemTypeList_allocbuf (list->_length);
-
- CORBA_sequence_set_release (list, FALSE);
-
- list->_buffer[0].id = (char *) CREATE_TASK_ID;
- list->_buffer[0].description = (char *) _("New task");
- list->_buffer[0].menuDescription = (char *) C_("New", "_Task");
- list->_buffer[0].tooltip = (char *) _("Create a new task");
- list->_buffer[0].menuShortcut = 't';
- list->_buffer[0].iconName = (char *) "stock_task";
- list->_buffer[0].type = GNOME_Evolution_CREATABLE_OBJECT;
-
- list->_buffer[1].id = (char *) CREATE_TASK_ASSIGNED_ID;
- list->_buffer[1].description = (char *) _("New assigned task");
- list->_buffer[1].menuDescription = (char *) C_("New", "Assigne_d Task");
- list->_buffer[1].tooltip = (char *) _("Create a new assigned task");
- list->_buffer[1].menuShortcut = '\0';
- list->_buffer[1].iconName = (char *) "stock_task";
- list->_buffer[1].type = GNOME_Evolution_CREATABLE_OBJECT;
-
- list->_buffer[2].id = (char *) CREATE_TASK_LIST_ID;
- list->_buffer[2].description = (char *) _("New task list");
- list->_buffer[2].menuDescription = (char *) C_("New", "Tas_k list");
- list->_buffer[2].tooltip = (char *) _("Create a new task list");
- list->_buffer[2].menuShortcut = '\0';
- list->_buffer[2].iconName = (char *) "stock_todo";
- list->_buffer[2].type = GNOME_Evolution_CREATABLE_FOLDER;
-
- return list;
-}
-
static void
impl_requestCreateItem (PortableServer_Servant servant,
const CORBA_char *item_type_name,
@@ -1210,8 +767,6 @@ impl_finalize (GObject *object)
}
g_list_free (priv->views);
- g_free (priv->base_directory);
- g_free (priv->config_directory);
g_free (priv);
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
@@ -1228,9 +783,6 @@ tasks_component_class_init (TasksComponentClass *klass)
parent_class = g_type_class_peek_parent (klass);
- epv->upgradeFromVersion = impl_upgradeFromVersion;
- epv->createView = impl_createView;
- epv->_get_userCreatableItems = impl__get_userCreatableItems;
epv->requestCreateItem = impl_requestCreateItem;
epv->handleURI = impl_handleURI;
@@ -1245,50 +797,5 @@ tasks_component_init (TasksComponent *component, TasksComponentClass *klass)
priv = g_new0 (TasksComponentPrivate, 1);
- priv->base_directory = g_build_filename (e_get_user_data_dir (), "tasks", NULL);
- priv->config_directory = g_build_filename (priv->base_directory, "config", NULL);
-
component->priv = priv;
- ensure_sources (component);
-}
-
-/* Public API */
-
-TasksComponent *
-tasks_component_peek (void)
-{
- static TasksComponent *component = NULL;
-
- if (component == NULL) {
- component = g_object_new (tasks_component_get_type (), NULL);
-
- if (g_mkdir_with_parents (component->priv->config_directory, 0777) != 0) {
- g_warning (G_STRLOC ": Cannot create directory %s: %s",
- component->priv->config_directory, g_strerror (errno));
- g_object_unref (component);
- component = NULL;
- }
- }
-
- return component;
-}
-
-const char *
-tasks_component_peek_base_directory (TasksComponent *component)
-{
- return component->priv->base_directory;
-}
-
-const char *
-tasks_component_peek_config_directory (TasksComponent *component)
-{
- return component->priv->config_directory;
-}
-
-ESourceList *
-tasks_component_peek_source_list (TasksComponent *component)
-{
- return component->priv->source_list;
}
-
-BONOBO_TYPE_FUNC_FULL (TasksComponent, GNOME_Evolution_Component, PARENT_TYPE, tasks_component)
diff --git a/calendar/gui/tasks-component.h b/calendar/gui/tasks-component.h
index 0667fc2523..aae49fc287 100644
--- a/calendar/gui/tasks-component.h
+++ b/calendar/gui/tasks-component.h
@@ -54,10 +54,5 @@ struct _TasksComponentClass {
GType tasks_component_get_type (void);
-TasksComponent *tasks_component_peek (void);
-
-const char *tasks_component_peek_base_directory (TasksComponent *component);
-const char *tasks_component_peek_config_directory (TasksComponent *component);
-ESourceList *tasks_component_peek_source_list (TasksComponent *component);
#endif /* _TASKS_COMPONENT_H_ */
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index 7ee468e768..1be68ac35e 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -53,36 +53,15 @@
static void tasks_control_activate_cb (BonoboControl *control,
gboolean activate,
gpointer user_data);
-static void tasks_control_open_task_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
static void tasks_control_new_task_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
-static void tasks_control_cut_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void tasks_control_copy_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void tasks_control_paste_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void tasks_control_delete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
static void tasks_control_complete_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
static void tasks_control_purge_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
-static void tasks_control_print_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void tasks_control_print_preview_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
static void tasks_control_assign_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
@@ -91,68 +70,6 @@ static void tasks_control_forward_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
-static void tasks_control_view_preview (BonoboUIComponent *uic,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- void *data);
-
-struct focus_changed_data {
- BonoboControl *control;
- ETasks *tasks;
-};
-
-static gboolean tasks_control_focus_changed (GtkWidget *widget, GdkEventFocus *event, struct focus_changed_data *fc_data);
-
-BonoboControl *
-tasks_control_new (void)
-{
- BonoboControl *control;
- GtkWidget *tasks, *preview;
- struct focus_changed_data *fc_data;
-
- tasks = e_tasks_new ();
- if (!tasks)
- return NULL;
- gtk_widget_show (tasks);
-
- control = bonobo_control_new (tasks);
- if (!control) {
- gtk_widget_destroy (tasks);
- g_message ("control_factory_fn(): could not create the control!");
- return NULL;
- }
-
- g_signal_connect (control, "activate", G_CALLBACK (tasks_control_activate_cb), tasks);
-
- fc_data = g_new0 (struct focus_changed_data, 1);
- fc_data->control = control;
- fc_data->tasks = E_TASKS (tasks);
-
- preview = e_cal_component_preview_get_html (E_CAL_COMPONENT_PREVIEW (e_tasks_get_preview (fc_data->tasks)));
- g_object_set_data_full (G_OBJECT (preview), "tasks-ctrl-fc-data", fc_data, g_free);
- g_signal_connect (preview, "focus-in-event", G_CALLBACK (tasks_control_focus_changed), fc_data);
- g_signal_connect (preview, "focus-out-event", G_CALLBACK (tasks_control_focus_changed), fc_data);
-
- return control;
-}
-
-
-static void
-tasks_control_activate_cb (BonoboControl *control,
- gboolean activate,
- gpointer user_data)
-{
- ETasks *tasks;
-
- tasks = E_TASKS (user_data);
-
- if (activate)
- tasks_control_activate (control, tasks);
- else
- tasks_control_deactivate (control, tasks);
-}
-
struct _tasks_sensitize_item {
const gchar *command;
guint32 enable;
@@ -267,38 +184,14 @@ tasks_control_focus_changed (GtkWidget *widget, GdkEventFocus *event, struct foc
}
static BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("TasksOpenTask", tasks_control_open_task_cmd),
BONOBO_UI_VERB ("TasksNewTask", tasks_control_new_task_cmd),
- BONOBO_UI_VERB ("TasksCut", tasks_control_cut_cmd),
- BONOBO_UI_VERB ("TasksCopy", tasks_control_copy_cmd),
- BONOBO_UI_VERB ("TasksPaste", tasks_control_paste_cmd),
- BONOBO_UI_VERB ("TasksDelete", tasks_control_delete_cmd),
BONOBO_UI_VERB ("TasksMarkComplete", tasks_control_complete_cmd),
BONOBO_UI_VERB ("TasksPurge", tasks_control_purge_cmd),
- BONOBO_UI_VERB ("TasksPrint", tasks_control_print_cmd),
- BONOBO_UI_VERB ("TasksPrintPreview", tasks_control_print_preview_cmd),
BONOBO_UI_VERB ("TasksAssign", tasks_control_assign_cmd),
BONOBO_UI_VERB ("TasksForward", tasks_control_forward_cmd),
BONOBO_UI_VERB_END
};
-static EPixmap pixmaps [] = {
- E_PIXMAP ("/commands/TasksCopy", "edit-copy", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/TasksCut", "edit-cut", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/TasksDelete", "edit-delete", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/TasksForward", "mail-forward", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/TasksPaste", "edit-paste", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/TasksPrint", "document-print", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/TasksPrintPreview", "document-print-preview", GTK_ICON_SIZE_MENU),
-
- E_PIXMAP ("/Toolbar/Cut", "edit-cut", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Copy", "edit-copy", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Paste", "edit-paste", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Print", "document-print", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/Delete", "edit-delete", GTK_ICON_SIZE_LARGE_TOOLBAR),
-
- E_PIXMAP_END
-};
void
tasks_control_activate (BonoboControl *control, ETasks *tasks)
{
@@ -332,8 +225,6 @@ tasks_control_activate (BonoboControl *control, ETasks *tasks)
NULL);
g_free (xmlfile);
- e_pixmaps_update (uic, pixmaps);
-
e_tasks_setup_view_menus (tasks, uic);
/* Signals from the tasks widget; also sensitize the menu items as appropriate */
@@ -375,16 +266,6 @@ tasks_control_deactivate (BonoboControl *control, ETasks *tasks)
bonobo_ui_component_unset_container (uic, NULL);
}
-static void tasks_control_open_task_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
-
- tasks = E_TASKS (data);
- e_tasks_open_task (tasks);
-}
-
static void
tasks_control_new_task_cmd (BonoboUIComponent *uic,
gpointer data,
@@ -397,65 +278,6 @@ tasks_control_new_task_cmd (BonoboUIComponent *uic,
}
static void
-tasks_control_cut_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
- ECalendarTable *cal_table;
-
- tasks = E_TASKS (data);
- cal_table = e_tasks_get_calendar_table (tasks);
- e_calendar_table_cut_clipboard (cal_table);
-}
-
-static void
-tasks_control_copy_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
- ECalendarTable *cal_table;
- GtkWidget *preview;
-
- tasks = E_TASKS (data);
-
-
- preview = e_cal_component_preview_get_html (E_CAL_COMPONENT_PREVIEW (e_tasks_get_preview (tasks)));
- if (preview && GTK_WIDGET_VISIBLE (preview) && GTK_WIDGET_HAS_FOCUS (preview)) {
- /* copy selected text in a preview when that's shown and focused */
- gtk_html_copy (GTK_HTML (preview));
- } else {
- cal_table = e_tasks_get_calendar_table (tasks);
- e_calendar_table_copy_clipboard (cal_table);
- }
-}
-
-static void
-tasks_control_paste_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
- ECalendarTable *cal_table;
-
- tasks = E_TASKS (data);
- cal_table = e_tasks_get_calendar_table (tasks);
- e_calendar_table_paste_clipboard (cal_table);
-}
-
-static void
-tasks_control_delete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
-
- tasks = E_TASKS (data);
- e_tasks_delete_selected (tasks);
-}
-
-static void
tasks_control_complete_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path)
@@ -511,87 +333,3 @@ tasks_control_purge_cmd (BonoboUIComponent *uic,
if (confirm_purge (tasks))
e_tasks_delete_completed (tasks);
}
-
-/* File/Print callback */
-static void
-tasks_control_print_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks = E_TASKS (data);
- ETable *table;
-
- table = e_calendar_table_get_table (
- E_CALENDAR_TABLE (e_tasks_get_calendar_table (tasks)));
-
- print_table (
- table, _("Print Tasks"), _("Tasks"),
- GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-}
-
-static void
-tasks_control_print_preview_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks = E_TASKS (data);
- ETable *table;
-
- table = e_calendar_table_get_table (
- E_CALENDAR_TABLE (e_tasks_get_calendar_table (tasks)));
-
- print_table (
- table, _("Print Tasks"), _("Tasks"),
- GTK_PRINT_OPERATION_ACTION_PREVIEW);
-}
-
-static void
-tasks_control_assign_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
- ECalendarTable *cal_table;
- ECalModelComponent *comp_data;
-
- tasks = E_TASKS (data);
- cal_table = e_tasks_get_calendar_table (tasks);
- comp_data = e_calendar_table_get_selected_comp (cal_table);
- if (comp_data)
- e_calendar_table_open_task (cal_table, comp_data->client, comp_data->icalcomp, TRUE);
-}
-
-static void
-tasks_control_forward_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
- ECalendarTable *cal_table;
- ECalModelComponent *comp_data;
-
- tasks = E_TASKS (data);
- cal_table = e_tasks_get_calendar_table (tasks);
- comp_data = e_calendar_table_get_selected_comp (cal_table);
- if (comp_data) {
- ECalComponent *comp;
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL, NULL, TRUE);
- g_object_unref (comp);
- }
-}
-
-static void
-tasks_control_view_preview (BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- ETasks *tasks;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- tasks = E_TASKS (data);
-
- calendar_config_set_preview_state (state[0] != '0');
- e_tasks_show_preview (tasks, state[0] != '0');
-}
diff --git a/calendar/importers/main.c b/calendar/importers/main.c
deleted file mode 100644
index dc91f378f5..0000000000
--- a/calendar/importers/main.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Evolution calendar importer component
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <string.h>
-#include <bonobo/bonobo-shlib-factory.h>
-#include <bonobo/bonobo-context.h>
-#include <bonobo/bonobo-main.h>
-#include "evolution-calendar-importer.h"
-
-#define IMPORTER_FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_ImporterFactory:" BASE_VERSION
-#define ICALENDAR_IMPORTER_ID "OAFIID:GNOME_Evolution_Calendar_iCalendar_Importer:" BASE_VERSION
-#define VCALENDAR_IMPORTER_ID "OAFIID:GNOME_Evolution_Calendar_vCalendar_Importer:" BASE_VERSION
-#define GNOME_CALENDAR_IMPORTER_ID "OAFIID:GNOME_Evolution_Gnome_Calendar_Intelligent_Importer:" BASE_VERSION
-
-static BonoboObject *
-importer_factory_fn (BonoboGenericFactory *factory, const char *id, void *closure)
-{
- BonoboObject *object = NULL;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- if (!strcmp (id, ICALENDAR_IMPORTER_ID))
- object = ical_importer_new ();
- else if (!strcmp (id, VCALENDAR_IMPORTER_ID))
- object = vcal_importer_new ();
- else if (!strcmp (id, GNOME_CALENDAR_IMPORTER_ID))
- object = gnome_calendar_importer_new ();
- else
- g_warning ("Component not supported by this factory");
-
- return object;
-}
-
-BONOBO_ACTIVATION_SHLIB_FACTORY (IMPORTER_FACTORY_ID, "Evolution Calendar importer factory", importer_factory_fn, NULL)
diff --git a/calendar/module/Makefile.am b/calendar/module/Makefile.am
new file mode 100644
index 0000000000..49442cb955
--- /dev/null
+++ b/calendar/module/Makefile.am
@@ -0,0 +1,79 @@
+INCLUDES = \
+ -DG_LOG_DOMAIN=\"calendar-modules\" \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/widgets \
+ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
+ $(EVOLUTION_CALENDAR_CFLAGS)
+
+module_LTLIBRARIES = \
+ libevolution-module-calendar.la
+
+libevolution_module_calendar_la_SOURCES = \
+ evolution-module-calendar.c \
+ e-cal-shell-backend.c \
+ e-cal-shell-backend.h \
+ e-cal-shell-content.c \
+ e-cal-shell-content.h \
+ e-cal-shell-migrate.c \
+ e-cal-shell-migrate.h \
+ e-cal-shell-settings.c \
+ e-cal-shell-settings.h \
+ e-cal-shell-sidebar.c \
+ e-cal-shell-sidebar.h \
+ e-cal-shell-view.c \
+ e-cal-shell-view.h \
+ e-cal-shell-view-actions.c \
+ e-cal-shell-view-actions.h \
+ e-cal-shell-view-memopad.c \
+ e-cal-shell-view-private.c \
+ e-cal-shell-view-private.h \
+ e-cal-shell-view-taskpad.c \
+ e-memo-shell-backend.c \
+ e-memo-shell-backend.h \
+ e-memo-shell-content.c \
+ e-memo-shell-content.h \
+ e-memo-shell-migrate.c \
+ e-memo-shell-migrate.h \
+ e-memo-shell-sidebar.c \
+ e-memo-shell-sidebar.h \
+ e-memo-shell-view.c \
+ e-memo-shell-view.h \
+ e-memo-shell-view-actions.c \
+ e-memo-shell-view-actions.h \
+ e-memo-shell-view-private.c \
+ e-memo-shell-view-private.h \
+ e-task-shell-backend.c \
+ e-task-shell-backend.h \
+ e-task-shell-content.c \
+ e-task-shell-content.h \
+ e-task-shell-migrate.c \
+ e-task-shell-migrate.h \
+ e-task-shell-sidebar.c \
+ e-task-shell-sidebar.h \
+ e-task-shell-view.c \
+ e-task-shell-view.h \
+ e-task-shell-view-actions.c \
+ e-task-shell-view-actions.h \
+ e-task-shell-view-private.c \
+ e-task-shell-view-private.h
+
+# Removed from all three
+# $(top_builddir)/a11y/calendar/libevolution-calendar-a11y.la
+
+libevolution_module_calendar_la_LIBADD = \
+ $(top_builddir)/shell/libeshell.la \
+ $(top_builddir)/calendar/gui/libcal-gui.la \
+ $(top_builddir)/calendar/importers/libevolution-calendar-importers.la \
+ $(top_builddir)/mail/libevolution-module-mail.la \
+ $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \
+ $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/filter/libfilter.la \
+ $(top_builddir)/widgets/menus/libmenus.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/widgets/table/libetable.la \
+ $(CAMEL_LIBS) \
+ $(EVOLUTION_CALENDAR_LIBS)
+
+libevolution_module_calendar_la_LDFLAGS = \
+ -module -avoid-version $(NO_UNDEFINED)
diff --git a/calendar/module/e-cal-shell-backend.c b/calendar/module/e-cal-shell-backend.c
new file mode 100644
index 0000000000..675a3d4fa6
--- /dev/null
+++ b/calendar/module/e-cal-shell-backend.c
@@ -0,0 +1,666 @@
+/*
+ * e-cal-shell-backend.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-cal-shell-backend.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <libecal/e-cal.h>
+#include <libedataserver/e-url.h>
+#include <libedataserver/e-source.h>
+#include <libedataserver/e-source-group.h>
+
+#include "e-util/e-import.h"
+#include "shell/e-shell.h"
+#include "shell/e-shell-backend.h"
+#include "shell/e-shell-window.h"
+#include "widgets/misc/e-preferences-window.h"
+
+#include "calendar/common/authentication.h"
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/comp-util.h"
+#include "calendar/gui/e-attachment-handler-calendar.h"
+#include "calendar/gui/e-cal-config.h"
+#include "calendar/gui/e-cal-event.h"
+#include "calendar/gui/dialogs/cal-prefs-dialog.h"
+#include "calendar/gui/dialogs/calendar-setup.h"
+#include "calendar/gui/dialogs/event-editor.h"
+#include "calendar/importers/evolution-calendar-importer.h"
+
+#include "e-cal-shell-migrate.h"
+#include "e-cal-shell-settings.h"
+#include "e-cal-shell-view.h"
+
+#define E_CAL_SHELL_BACKEND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendPrivate))
+
+#define CONTACTS_BASE_URI "contacts://"
+#define WEATHER_BASE_URI "weather://"
+#define WEB_BASE_URI "webcal://"
+#define PERSONAL_RELATIVE_URI "system"
+
+struct _ECalShellBackendPrivate {
+ ESourceList *source_list;
+};
+
+enum {
+ PROP_0,
+ PROP_SOURCE_LIST
+};
+
+static gpointer parent_class;
+static GType cal_shell_backend_type;
+
+static void
+cal_shell_backend_ensure_sources (EShellBackend *shell_backend)
+{
+ /* XXX This is basically the same algorithm across all backends.
+ * Maybe we could somehow integrate this into EShellBackend? */
+
+ ECalShellBackendPrivate *priv;
+ ESourceGroup *on_this_computer;
+ ESourceGroup *on_the_web;
+ ESourceGroup *contacts;
+ ESourceGroup *weather;
+ ESource *birthdays;
+ ESource *personal;
+ EShell *shell;
+ EShellSettings *shell_settings;
+ GSList *groups, *iter;
+ const gchar *data_dir;
+ const gchar *name;
+ gchar *base_uri;
+ gchar *filename;
+ gchar *property;
+
+ on_this_computer = NULL;
+ on_the_web = NULL;
+ contacts = NULL;
+ weather = NULL;
+ birthdays = NULL;
+ personal = NULL;
+
+ priv = E_CAL_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ if (!e_cal_get_sources (&priv->source_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) {
+ g_warning ("Could not get calendar sources from GConf!");
+ return;
+ }
+
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ filename = g_build_filename (data_dir, "local", NULL);
+ base_uri = g_filename_to_uri (filename, NULL, NULL);
+ g_free (filename);
+
+ groups = e_source_list_peek_groups (priv->source_list);
+ for (iter = groups; iter != NULL; iter = iter->next) {
+ ESourceGroup *source_group = iter->data;
+ const gchar *group_base_uri;
+
+ group_base_uri = e_source_group_peek_base_uri (source_group);
+
+ /* Compare only "file://" part. if the user's home
+ * changes, we do not want to create another group. */
+ if (on_this_computer == NULL &&
+ strncmp (base_uri, group_base_uri, 7) == 0)
+ on_this_computer = source_group;
+
+ else if (on_the_web == NULL &&
+ strcmp (WEB_BASE_URI, group_base_uri) == 0)
+ on_the_web = source_group;
+
+ else if (contacts == NULL &&
+ strcmp (CONTACTS_BASE_URI, group_base_uri) == 0)
+ contacts = source_group;
+
+ else if (weather == NULL &&
+ strcmp (WEATHER_BASE_URI, group_base_uri) == 0)
+ weather = source_group;
+ }
+
+ name = _("On This Computer");
+
+ if (on_this_computer != NULL) {
+ GSList *sources;
+ const gchar *group_base_uri;
+
+ /* Force the group name to the current locale. */
+ e_source_group_set_name (on_this_computer, name);
+
+ sources = e_source_group_peek_sources (on_this_computer);
+ group_base_uri = e_source_group_peek_base_uri (on_this_computer);
+
+ /* Make sure this group includes a "Personal" source. */
+ for (iter = sources; iter != NULL; iter = iter->next) {
+ ESource *source = iter->data;
+ const gchar *relative_uri;
+
+ relative_uri = e_source_peek_relative_uri (source);
+ if (relative_uri == NULL)
+ continue;
+
+ if (strcmp (PERSONAL_RELATIVE_URI, relative_uri) != 0)
+ continue;
+
+ personal = source;
+ break;
+ }
+
+ /* Make sure we have the correct base URI. This can
+ * change when the user's home directory changes. */
+ if (strcmp (base_uri, group_base_uri) != 0) {
+ e_source_group_set_base_uri (
+ on_this_computer, base_uri);
+
+ /* XXX We shouldn't need this sync call here as
+ * set_base_uri() results in synching to GConf,
+ * but that happens in an idle loop and too late
+ * to prevent the user from seeing a "Cannot
+ * Open ... because of invalid URI" error. */
+ e_source_list_sync (priv->source_list, NULL);
+ }
+
+ } else {
+ ESourceGroup *source_group;
+
+ source_group = e_source_group_new (name, base_uri);
+ e_source_list_add_group (priv->source_list, source_group, -1);
+ g_object_unref (source_group);
+ }
+
+ name = _("Personal");
+
+ if (personal == NULL) {
+ ESource *source;
+ GSList *selected;
+ gchar *primary;
+
+ source = e_source_new (name, PERSONAL_RELATIVE_URI);
+ e_source_group_add_source (on_this_computer, source, -1);
+ g_object_unref (source);
+
+ primary = e_shell_settings_get_string (
+ shell_settings, "cal-primary-calendar");
+
+ selected = calendar_config_get_calendars_selected ();
+
+ if (primary == NULL && selected == NULL) {
+ const gchar *uid;
+
+ uid = e_source_peek_uid (source);
+ selected = g_slist_prepend (NULL, g_strdup (uid));
+
+ e_shell_settings_set_string (
+ shell_settings, "cal-primary-calendar", uid);
+ calendar_config_set_calendars_selected (selected);
+ }
+
+ g_slist_foreach (selected, (GFunc) g_free, NULL);
+ g_slist_free (selected);
+ g_free (primary);
+ } else {
+ /* Force the source name to the current locale. */
+ e_source_set_name (personal, name);
+ }
+
+ name = _("On The Web");
+
+ if (on_the_web == NULL) {
+ ESourceGroup *source_group;
+
+ source_group = e_source_group_new (name, WEB_BASE_URI);
+ e_source_list_add_group (priv->source_list, source_group, -1);
+ g_object_unref (source_group);
+ } else {
+ /* Force the group name to the current locale. */
+ e_source_group_set_name (on_the_web, name);
+ }
+
+ name = _("Contacts");
+
+ if (contacts != NULL) {
+ GSList *sources;
+
+ /* Force the group name to the current locale. */
+ e_source_group_set_name (contacts, name);
+
+ sources = e_source_group_peek_sources (contacts);
+
+ if (sources != NULL) {
+ GSList *trash;
+
+ /* There is only one source under Contacts. */
+ birthdays = E_SOURCE (sources->data);
+ sources = g_slist_next (sources);
+
+ /* Delete any other sources in this group.
+ * Earlier versions allowed you to create
+ * additional sources under Contacts. */
+ trash = g_slist_copy (sources);
+ while (trash != NULL) {
+ ESource *source = trash->data;
+ e_source_group_remove_source (contacts, source);
+ trash = g_slist_delete_link (trash, trash);
+ }
+
+ }
+ } else {
+ ESourceGroup *source_group;
+
+ source_group = e_source_group_new (name, CONTACTS_BASE_URI);
+ e_source_list_add_group (priv->source_list, source_group, -1);
+ g_object_unref (source_group);
+
+ /* This is now a borrowed reference. */
+ contacts = source_group;
+ }
+
+ /* XXX e_source_group_get_property() returns a newly-allocated
+ * string when it could just as easily return a const string.
+ * Unfortunately, fixing that would break the API. */
+ property = e_source_group_get_property (contacts, "create_source");
+ if (property == NULL)
+ e_source_group_set_property (contacts, "create_source", "no");
+ g_free (property);
+
+ name = _("Birthdays & Anniversaries");
+
+ if (birthdays == NULL) {
+ ESource *source;
+ const gchar *name;
+
+ name = _("Birthdays & Anniversaries");
+ source = e_source_new (name, "/");
+ e_source_group_add_source (contacts, source, -1);
+ g_object_unref (source);
+
+ /* This is now a borrowed reference. */
+ birthdays = source;
+ } else {
+ /* Force the source name to the current locale. */
+ e_source_set_name (birthdays, name);
+ }
+
+ if (e_source_get_property (birthdays, "delete") == NULL)
+ e_source_set_property (birthdays, "delete", "no");
+
+ if (e_source_peek_color_spec (birthdays) == NULL)
+ e_source_set_color_spec (birthdays, "#DDBECE");
+
+ name = _("Weather");
+
+ if (weather == NULL) {
+ ESourceGroup *source_group;
+
+ source_group = e_source_group_new (name, WEATHER_BASE_URI);
+ e_source_list_add_group (priv->source_list, source_group, -1);
+ g_object_unref (source_group);
+ } else {
+ /* Force the group name to the current locale. */
+ e_source_group_set_name (weather, name);
+ }
+
+ g_free (base_uri);
+}
+
+static void
+cal_shell_backend_cal_opened_cb (ECal *cal,
+ ECalendarStatus status,
+ GtkAction *action)
+{
+ EShell *shell;
+ ECalComponent *comp;
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ const gchar *action_name;
+ gboolean all_day;
+
+ /* FIXME Pass this in. */
+ shell = e_shell_get_default ();
+
+ /* XXX Handle errors better. */
+ if (status != E_CALENDAR_STATUS_OK)
+ return;
+
+ action_name = gtk_action_get_name (action);
+
+ flags |= COMP_EDITOR_NEW_ITEM;
+ flags |= COMP_EDITOR_USER_ORG;
+ if (strcmp (action_name, "event-meeting-new") == 0)
+ flags |= COMP_EDITOR_MEETING;
+
+ all_day = (strcmp (action_name, "event-all-day-new") == 0);
+
+ editor = event_editor_new (cal, shell, flags);
+ comp = cal_comp_event_new_with_current_time (cal, all_day);
+ comp_editor_edit_comp (editor, comp);
+
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (comp);
+ g_object_unref (cal);
+}
+
+static void
+action_event_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ ECal *cal = NULL;
+ ECalSourceType source_type;
+ ESourceList *source_list;
+ EShellSettings *shell_settings;
+ EShell *shell;
+ gchar *uid;
+
+ /* This callback is used for both appointments and meetings. */
+
+ source_type = E_CAL_SOURCE_TYPE_EVENT;
+
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ if (!e_cal_get_sources (&source_list, source_type, NULL)) {
+ g_warning ("Could not get calendar sources from GConf!");
+ return;
+ }
+
+ uid = e_shell_settings_get_string (
+ shell_settings, "cal-primary-calendar");
+
+ if (uid != NULL) {
+ ESource *source;
+
+ source = e_source_list_peek_source_by_uid (source_list, uid);
+ if (source != NULL)
+ cal = auth_new_cal_from_source (source, source_type);
+ g_free (uid);
+ }
+
+ if (cal == NULL)
+ cal = auth_new_cal_from_default (source_type);
+
+ g_return_if_fail (cal != NULL);
+
+ g_signal_connect (
+ cal, "cal-opened",
+ G_CALLBACK (cal_shell_backend_cal_opened_cb), action);
+
+ e_cal_open_async (cal, FALSE);
+}
+
+static void
+action_calendar_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ calendar_setup_new_calendar (GTK_WINDOW (shell_window));
+}
+
+static GtkActionEntry item_entries[] = {
+
+ { "event-new",
+ "appointment-new",
+ NC_("New", "_Appointment"),
+ "<Shift><Control>a",
+ N_("Create a new appointment"),
+ G_CALLBACK (action_event_new_cb) },
+
+ { "event-all-day-new",
+ "stock_new-24h-appointment",
+ NC_("New", "All Day A_ppointment"),
+ NULL,
+ N_("Create a new all-day appointment"),
+ G_CALLBACK (action_event_new_cb) },
+
+ { "event-meeting-new",
+ "stock_new-meeting",
+ NC_("New", "M_eeting"),
+ "<Shift><Control>e",
+ N_("Create a new meeting request"),
+ G_CALLBACK (action_event_new_cb) }
+};
+
+static GtkActionEntry source_entries[] = {
+
+ { "calendar-new",
+ "x-office-calendar",
+ NC_("New", "Cale_ndar"),
+ NULL,
+ N_("Create a new calendar"),
+ G_CALLBACK (action_calendar_new_cb) }
+};
+
+static void
+cal_shell_backend_init_hooks (void)
+{
+ e_plugin_hook_register_type (e_cal_config_hook_get_type ());
+ e_plugin_hook_register_type (e_cal_event_hook_get_type ());
+}
+
+static void
+cal_shell_backend_init_importers (void)
+{
+ EImportClass *import_class;
+ EImportImporter *importer;
+
+ import_class = g_type_class_ref (e_import_get_type ());
+
+ importer = gnome_calendar_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+
+ importer = ical_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+
+ importer = vcal_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+}
+
+static void
+cal_shell_backend_init_preferences (EShell *shell)
+{
+ GtkWidget *preferences_window;
+
+ preferences_window = e_shell_get_preferences_window (shell);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "calendar-and-tasks",
+ "preferences-calendar-and-tasks",
+ _("Calendar and Tasks"),
+ calendar_prefs_dialog_new (shell),
+ 600);
+}
+
+static gboolean
+cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
+ const gchar *uri)
+{
+ /* FIXME */
+ return FALSE;
+}
+
+static void
+cal_shell_backend_window_created_cb (EShellBackend *shell_backend,
+ GtkWindow *window)
+{
+ const gchar *backend_name;
+
+ if (!E_IS_SHELL_WINDOW (window))
+ return;
+
+ backend_name = E_SHELL_BACKEND_GET_CLASS (shell_backend)->name;
+
+ e_shell_window_register_new_item_actions (
+ E_SHELL_WINDOW (window), backend_name,
+ item_entries, G_N_ELEMENTS (item_entries));
+
+ e_shell_window_register_new_source_actions (
+ E_SHELL_WINDOW (window), backend_name,
+ source_entries, G_N_ELEMENTS (source_entries));
+}
+
+static void
+cal_shell_backend_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SOURCE_LIST:
+ g_value_set_object (
+ value,
+ e_cal_shell_backend_get_source_list (
+ E_CAL_SHELL_BACKEND (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+cal_shell_backend_dispose (GObject *object)
+{
+ ECalShellBackendPrivate *priv;
+
+ priv = E_CAL_SHELL_BACKEND_GET_PRIVATE (object);
+
+ if (priv->source_list != NULL) {
+ g_object_unref (priv->source_list);
+ priv->source_list = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+cal_shell_backend_constructed (GObject *object)
+{
+ EShell *shell;
+ EShellBackend *shell_backend;
+
+ shell_backend = E_SHELL_BACKEND (object);
+ shell = e_shell_backend_get_shell (shell_backend);
+
+ cal_shell_backend_ensure_sources (shell_backend);
+
+ g_signal_connect_swapped (
+ shell, "handle-uri",
+ G_CALLBACK (cal_shell_backend_handle_uri_cb),
+ shell_backend);
+
+ g_signal_connect_swapped (
+ shell, "window-created",
+ G_CALLBACK (cal_shell_backend_window_created_cb),
+ shell_backend);
+
+ cal_shell_backend_init_hooks ();
+ cal_shell_backend_init_importers ();
+
+ /* Initialize settings before initializing preferences,
+ * since the preferences bind to the shell settings. */
+ e_cal_shell_backend_init_settings (shell);
+ cal_shell_backend_init_preferences (shell);
+
+ e_attachment_handler_calendar_get_type ();
+}
+
+static void
+cal_shell_backend_class_init (ECalShellBackendClass *class)
+{
+ GObjectClass *object_class;
+ EShellBackendClass *shell_backend_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECalShellBackendPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = cal_shell_backend_get_property;
+ object_class->dispose = cal_shell_backend_dispose;
+ object_class->constructed = cal_shell_backend_constructed;
+
+ shell_backend_class = E_SHELL_BACKEND_CLASS (class);
+ shell_backend_class->shell_view_type = E_TYPE_CAL_SHELL_VIEW;
+ shell_backend_class->name = "calendar";
+ shell_backend_class->aliases = "";
+ shell_backend_class->schemes = "calendar";
+ shell_backend_class->sort_order = 400;
+ shell_backend_class->start = NULL;
+ shell_backend_class->is_busy = NULL;
+ shell_backend_class->shutdown = NULL;
+ shell_backend_class->migrate = e_cal_shell_backend_migrate;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SOURCE_LIST,
+ g_param_spec_object (
+ "source-list",
+ _("Source List"),
+ _("The registry of calendars"),
+ E_TYPE_SOURCE_LIST,
+ G_PARAM_READABLE));
+}
+
+static void
+cal_shell_backend_init (ECalShellBackend *cal_shell_backend)
+{
+ cal_shell_backend->priv =
+ E_CAL_SHELL_BACKEND_GET_PRIVATE (cal_shell_backend);
+}
+
+GType
+e_cal_shell_backend_get_type (void)
+{
+ return cal_shell_backend_type;
+}
+
+void
+e_cal_shell_backend_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (ECalShellBackendClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) cal_shell_backend_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ECalShellBackend),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) cal_shell_backend_init,
+ NULL /* value_table */
+ };
+
+ cal_shell_backend_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_BACKEND,
+ "ECalShellBackend", &type_info, 0);
+}
+
+ESourceList *
+e_cal_shell_backend_get_source_list (ECalShellBackend *cal_shell_backend)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_BACKEND (cal_shell_backend), NULL);
+
+ return cal_shell_backend->priv->source_list;
+}
diff --git a/calendar/module/e-cal-shell-backend.h b/calendar/module/e-cal-shell-backend.h
new file mode 100644
index 0000000000..497e200490
--- /dev/null
+++ b/calendar/module/e-cal-shell-backend.h
@@ -0,0 +1,70 @@
+/*
+ * e-cal-shell-backend.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_CAL_SHELL_BACKEND_H
+#define E_CAL_SHELL_BACKEND_H
+
+#include <shell/e-shell-backend.h>
+#include <libedataserver/e-source-list.h>
+
+/* Standard GObject macros */
+#define E_TYPE_CAL_SHELL_BACKEND \
+ (e_cal_shell_backend_get_type ())
+#define E_CAL_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackend))
+#define E_CAL_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendClass))
+#define E_IS_CAL_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CAL_SHELL_BACKEND))
+#define E_IS_CAL_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CAL_SHELL_BACKEND))
+#define E_CAL_SHELL_BACKEND_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CAL_SHELL_BACKEND, ECalShellBackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ECalShellBackend ECalShellBackend;
+typedef struct _ECalShellBackendClass ECalShellBackendClass;
+typedef struct _ECalShellBackendPrivate ECalShellBackendPrivate;
+
+struct _ECalShellBackend {
+ EShellBackend parent;
+ ECalShellBackendPrivate *priv;
+};
+
+struct _ECalShellBackendClass {
+ EShellBackendClass parent_class;
+};
+
+GType e_cal_shell_backend_get_type (void);
+void e_cal_shell_backend_register_type
+ (GTypeModule *type_module);
+ESourceList * e_cal_shell_backend_get_source_list
+ (ECalShellBackend *cal_shell_backend);
+
+G_END_DECLS
+
+#endif /* E_CAL_SHELL_BACKEND_H */
diff --git a/calendar/module/e-cal-shell-content.c b/calendar/module/e-cal-shell-content.c
new file mode 100644
index 0000000000..6afb40dce7
--- /dev/null
+++ b/calendar/module/e-cal-shell-content.c
@@ -0,0 +1,827 @@
+/*
+ * e-cal-shell-content.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-cal-shell-content.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+
+#include "e-util/gconf-bridge.h"
+
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/e-cal-list-view-config.h"
+#include "calendar/gui/e-cal-model-calendar.h"
+#include "calendar/gui/e-calendar-table.h"
+#include "calendar/gui/e-calendar-table-config.h"
+#include "calendar/gui/e-day-view-config.h"
+#include "calendar/gui/e-memo-table-config.h"
+#include "calendar/gui/e-week-view-config.h"
+
+#include "widgets/menus/gal-view-etable.h"
+
+#define E_CAL_SHELL_CONTENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CAL_SHELL_CONTENT, ECalShellContentPrivate))
+
+struct _ECalShellContentPrivate {
+ GtkWidget *hpaned;
+ GtkWidget *notebook;
+ GtkWidget *vpaned;
+
+ GtkWidget *day_view;
+ GtkWidget *work_week_view;
+ GtkWidget *week_view;
+ GtkWidget *month_view;
+ GtkWidget *list_view;
+ GtkWidget *task_table;
+ GtkWidget *memo_table;
+
+ EDayViewConfig *day_view_config;
+ EDayViewConfig *work_week_view_config;
+ EWeekViewConfig *week_view_config;
+ EWeekViewConfig *month_view_config;
+ ECalListViewConfig *list_view_config;
+ ECalendarTableConfig *task_table_config;
+ EMemoTableConfig *memo_table_config;
+
+ GalViewInstance *view_instance;
+
+ guint paned_binding_id;
+};
+
+enum {
+ PROP_0
+};
+
+/* Used to indicate who has the focus within the calendar view. */
+typedef enum {
+ FOCUS_CALENDAR,
+ FOCUS_MEMO_TABLE,
+ FOCUS_TASK_TABLE,
+ FOCUS_OTHER
+} FocusLocation;
+
+static gpointer parent_class;
+static GType cal_shell_content_type;
+
+static void
+cal_shell_content_display_view_cb (ECalShellContent *cal_shell_content,
+ GalView *gal_view)
+{
+ /* FIXME */
+}
+
+static void
+cal_shell_content_notify_view_id_cb (ECalShellContent *cal_shell_content)
+{
+ EShellContent *shell_content;
+ EShellView *shell_view;
+ GConfBridge *bridge;
+ GtkWidget *paned;
+ guint binding_id;
+ const gchar *key;
+ const gchar *view_id;
+
+ bridge = gconf_bridge_get ();
+ paned = cal_shell_content->priv->hpaned;
+ binding_id = cal_shell_content->priv->paned_binding_id;
+
+ shell_content = E_SHELL_CONTENT (cal_shell_content);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ view_id = e_shell_view_get_view_id (shell_view);
+
+ if (binding_id > 0)
+ gconf_bridge_unbind (bridge, binding_id);
+
+ if (view_id != NULL && strcmp (view_id, "Month_View") == 0)
+ key = "/apps/evolution/calendar/display/month_hpane_position";
+ else
+ key = "/apps/evolution/calendar/display/hpane_position";
+
+ binding_id = gconf_bridge_bind_property_delayed (
+ bridge, key, G_OBJECT (paned), "position");
+
+ cal_shell_content->priv->paned_binding_id = binding_id;
+}
+
+static FocusLocation
+cal_shell_content_get_focus_location (ECalShellContent *cal_shell_content)
+{
+ return FOCUS_OTHER;
+#if 0 /* TEMPORARILY DISABLED */
+ GtkWidget *widget;
+ GnomeCalendar *calendar;
+ ECalendarTable *task_table;
+ EMemoTable *memo_table;
+ ETable *table;
+ ECalendarView *calendar_view;
+
+ calendar = GNOME_CALENDAR (cal_shell_content->priv->calendar);
+ widget = gnome_calendar_get_current_view_widget (calendar);
+
+ memo_table = E_MEMO_TABLE (cal_shell_content->priv->memo_table);
+ task_table = E_CALENDAR_TABLE (cal_shell_content->priv->task_table);
+
+ table = e_memo_table_get_table (memo_table);
+ if (GTK_WIDGET_HAS_FOCUS (table->table_canvas))
+ return FOCUS_MEMO_TABLE;
+
+ table = e_calendar_table_get_table (task_table);
+ if (GTK_WIDGET_HAS_FOCUS (table->table_canvas))
+ return FOCUS_TASK_TABLE;
+
+ if (E_IS_DAY_VIEW (widget)) {
+ EDayView *view = E_DAY_VIEW (widget);
+
+ if (GTK_WIDGET_HAS_FOCUS (view->top_canvas))
+ return FOCUS_CALENDAR;
+
+ if (GNOME_CANVAS (view->top_canvas)->focused_item != NULL)
+ return FOCUS_CALENDAR;
+
+ if (GTK_WIDGET_HAS_FOCUS (view->main_canvas))
+ return FOCUS_CALENDAR;
+
+ if (GNOME_CANVAS (view->main_canvas)->focused_item != NULL)
+ return FOCUS_CALENDAR;
+
+ } else if (E_IS_WEEK_VIEW (widget)) {
+ EWeekView *view = E_WEEK_VIEW (widget);
+
+ if (GTK_WIDGET_HAS_FOCUS (view->main_canvas))
+ return FOCUS_CALENDAR;
+
+ if (GNOME_CANVAS (view->main_canvas)->focused_item != NULL)
+ return FOCUS_CALENDAR;
+
+ } else if (E_IS_CAL_LIST_VIEW (widget)) {
+ ECalListView *view = E_CAL_LIST_VIEW (widget);
+
+ table = e_table_scrolled_get_table (view->table_scrolled);
+ if (GTK_WIDGET_HAS_FOCUS (table))
+ return FOCUS_CALENDAR;
+ }
+
+ return FOCUS_OTHER;
+#endif
+}
+
+static void
+cal_shell_content_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+cal_shell_content_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+cal_shell_content_dispose (GObject *object)
+{
+ ECalShellContentPrivate *priv;
+
+ priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (object);
+
+ if (priv->hpaned != NULL) {
+ g_object_unref (priv->hpaned);
+ priv->hpaned = NULL;
+ }
+
+ if (priv->notebook != NULL) {
+ g_object_unref (priv->notebook);
+ priv->notebook = NULL;
+ }
+
+ if (priv->vpaned != NULL) {
+ g_object_unref (priv->vpaned);
+ priv->vpaned = NULL;
+ }
+
+ if (priv->day_view != NULL) {
+ g_object_unref (priv->day_view);
+ priv->day_view = NULL;
+ }
+
+ if (priv->work_week_view != NULL) {
+ g_object_unref (priv->work_week_view);
+ priv->work_week_view = NULL;
+ }
+
+ if (priv->week_view != NULL) {
+ g_object_unref (priv->week_view);
+ priv->week_view = NULL;
+ }
+
+ if (priv->month_view != NULL) {
+ g_object_unref (priv->month_view);
+ priv->month_view = NULL;
+ }
+
+ if (priv->list_view != NULL) {
+ g_object_unref (priv->list_view);
+ priv->list_view = NULL;
+ }
+
+ if (priv->task_table != NULL) {
+ g_object_unref (priv->task_table);
+ priv->task_table = NULL;
+ }
+
+ if (priv->memo_table != NULL) {
+ g_object_unref (priv->memo_table);
+ priv->memo_table = NULL;
+ }
+
+ if (priv->day_view_config != NULL) {
+ g_object_unref (priv->day_view_config);
+ priv->day_view_config = NULL;
+ }
+
+ if (priv->work_week_view_config != NULL) {
+ g_object_unref (priv->work_week_view_config);
+ priv->work_week_view_config = NULL;
+ }
+
+ if (priv->week_view_config != NULL) {
+ g_object_unref (priv->week_view_config);
+ priv->week_view_config = NULL;
+ }
+
+ if (priv->month_view_config != NULL) {
+ g_object_unref (priv->month_view_config);
+ priv->month_view_config = NULL;
+ }
+
+ if (priv->list_view_config != NULL) {
+ g_object_unref (priv->list_view_config);
+ priv->list_view_config = NULL;
+ }
+
+ if (priv->task_table_config != NULL) {
+ g_object_unref (priv->task_table_config);
+ priv->task_table_config = NULL;
+ }
+
+ if (priv->memo_table_config != NULL) {
+ g_object_unref (priv->memo_table_config);
+ priv->memo_table_config = NULL;
+ }
+
+ if (priv->view_instance != NULL) {
+ g_object_unref (priv->view_instance);
+ priv->view_instance = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+cal_shell_content_finalize (GObject *object)
+{
+ ECalShellContentPrivate *priv;
+
+ priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (object);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+cal_shell_content_constructed (GObject *object)
+{
+ ECalShellContentPrivate *priv;
+ ECalModelCalendar *cal_model;
+ ECalModel *memo_model;
+ ECalModel *task_model;
+ EShellContent *shell_content;
+ EShellBackend *shell_backend;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellContent *foreign_content;
+ EShellView *foreign_view;
+ GalViewInstance *view_instance;
+ GConfBridge *bridge;
+ GtkWidget *container;
+ GtkWidget *widget;
+ const gchar *config_dir;
+ const gchar *key;
+ gchar *filename;
+ gchar *markup;
+ gint page_num;
+
+ priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ shell_content = E_SHELL_CONTENT (object);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ config_dir = e_shell_backend_get_config_dir (shell_backend);
+
+ /* Calendar model for the views. */
+ cal_model = e_cal_model_calendar_new ();
+ e_cal_model_set_flags (
+ E_CAL_MODEL (cal_model),
+ E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES);
+
+ /* We borrow the memopad and taskpad models from the memo
+ * and task views, loading the views if necessary. */
+
+ foreign_view = e_shell_window_get_shell_view (shell_window, "memos");
+ foreign_content = e_shell_view_get_shell_content (foreign_view);
+ g_object_get (foreign_content, "model", &memo_model, NULL);
+
+ foreign_view = e_shell_window_get_shell_view (shell_window, "tasks");
+ foreign_content = e_shell_view_get_shell_content (foreign_view);
+ g_object_get (foreign_content, "model", &task_model, NULL);
+
+ /* Build content widgets. */
+
+ container = GTK_WIDGET (object);
+
+ /* FIXME Need to deal with saving and restoring the position.
+ * Month view has its own position. */
+ widget = gtk_hpaned_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->hpaned = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = priv->hpaned;
+
+ widget = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
+ gtk_paned_pack1 (GTK_PANED (container), widget, FALSE, TRUE);
+ priv->notebook = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* FIXME Need to deal with saving and restoring the position.
+ * Month view has its own position. */
+ widget = gtk_vpaned_new ();
+ gtk_paned_pack2 (GTK_PANED (container), widget, TRUE, TRUE);
+ priv->vpaned = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = priv->notebook;
+
+ /* Add views in the order defined by GnomeCalendarViewType, such
+ * that the notebook page number corresponds to the view type.
+ * The assertions below ensure that stays true. */
+
+#if 0 /* Not so fast... get the memo/task pads working first. */
+ /* FIXME Need to establish a calendar and timezone first. */
+ widget = e_day_view_new (E_CAL_MODEL (cal_model));
+ e_calendar_view_set_calendar (
+ E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
+ e_calendar_view_set_timezone (
+ E_CALENDAR_VIEW (widget), priv->timezone);
+ page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
+ gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
+ g_return_if_fail (page_num == GNOME_CAL_DAY_VIEW);
+ priv->day_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* FIXME Need to establish a calendar and timezone first. */
+ widget = e_day_view_new (E_CAL_MODEL (cal_model));
+ e_day_view_set_work_week_view (E_DAY_VIEW (widget), TRUE);
+ e_day_view_set_days_shown (E_DAY_VIEW (widget), 5);
+ e_calendar_view_set_calendar (
+ E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
+ e_calendar_view_set_timezone (
+ E_CALENDAR_VIEW (widget), priv->timezone);
+ page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
+ gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
+ g_return_if_fail (page_num == GNOME_CAL_WORK_WEEK_VIEW);
+ priv->work_week_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* FIXME Need to establish a calendar and timezone first. */
+ widget = e_week_view_new (E_CAL_MODEL (cal_model));
+ e_calendar_view_set_calendar (
+ E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
+ e_calendar_view_set_timezone (
+ E_CALENDAR_VIEW (widget), priv->timezone);
+ page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
+ gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
+ g_return_if_fail (page_num == GNOME_CAL_WEEK_VIEW);
+ priv->week_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* FIXME Need to establish a calendar and timezone first. */
+ widget = e_week_view_new (E_CAL_MODEL (cal_model));
+ e_week_view_set_multi_week_view (E_WEEK_VIEW (widget), TRUE);
+ e_week_view_set_weeks_shown (E_WEEK_VIEW (widget), 6);
+ e_calendar_view_set_calendar (
+ E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
+ e_calendar_view_set_timezone (
+ E_CALENDAR_VIEW (widget), priv->timezone);
+ page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
+ gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
+ g_return_if_fail (page_num == GNOME_CAL_MONTH_VIEW);
+ priv->month_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* FIXME Need to establish a calendar and timezone first. */
+ widget = e_cal_list_view_new (E_CAL_MODEL (cal_model));
+ e_calendar_view_set_calendar (
+ E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
+ e_calendar_view_set_timezone (
+ E_CALENDAR_VIEW (widget), priv->timezone);
+ page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
+ gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
+ g_return_if_fail (page_num == GNOME_CAL_LIST_VIEW);
+ priv->list_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+#endif
+
+ container = priv->vpaned;
+
+ widget = gtk_vbox_new (FALSE, 0);
+ gtk_paned_pack1 (GTK_PANED (container), widget, FALSE, FALSE);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_hseparator_new ();
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, TRUE, 0);
+ gtk_widget_show (widget);
+
+ widget = gtk_label_new (NULL);
+ markup = g_strdup_printf ("<b>%s</b>", _("Tasks"));
+ gtk_label_set_markup (GTK_LABEL (widget), markup);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, TRUE, 0);
+ gtk_widget_show (widget);
+ g_free (markup);
+
+ widget = e_calendar_table_new (shell_view, task_model);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ priv->task_table = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ filename = g_build_filename (config_dir, "TaskPad", NULL);
+ e_calendar_table_load_state (E_CALENDAR_TABLE (widget), filename);
+ g_free (filename);
+
+ container = priv->vpaned;
+
+ widget = gtk_vbox_new (FALSE, 0);
+ gtk_paned_pack2 (GTK_PANED (container), widget, TRUE, FALSE);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_label_new (NULL);
+ markup = g_strdup_printf ("<b>%s</b>", _("Memos"));
+ gtk_label_set_markup (GTK_LABEL (widget), markup);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, TRUE, 0);
+ gtk_widget_show (widget);
+ g_free (markup);
+
+ widget = e_memo_table_new (shell_view, memo_model);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ priv->memo_table = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ filename = g_build_filename (config_dir, "MemoPad", NULL);
+ e_memo_table_load_state (E_MEMO_TABLE (widget), filename);
+ g_free (filename);
+
+ /* Configuration managers for views and tables. */
+ priv->day_view_config = e_day_view_config_new (
+ E_DAY_VIEW (priv->day_view));
+ priv->work_week_view_config = e_day_view_config_new (
+ E_DAY_VIEW (priv->work_week_view));
+ priv->week_view_config = e_week_view_config_new (
+ E_WEEK_VIEW (priv->week_view));
+ priv->month_view_config = e_week_view_config_new (
+ E_WEEK_VIEW (priv->month_view));
+ priv->list_view_config = e_cal_list_view_config_new (
+ E_CAL_LIST_VIEW (priv->list_view));
+ priv->task_table_config = e_calendar_table_config_new (
+ E_CALENDAR_TABLE (priv->task_table));
+ priv->memo_table_config = e_memo_table_config_new (
+ E_MEMO_TABLE (priv->memo_table));
+
+ /* Load the view instance. */
+
+ view_instance = e_shell_view_new_view_instance (shell_view, NULL);
+ g_signal_connect_swapped (
+ view_instance, "display-view",
+ G_CALLBACK (cal_shell_content_display_view_cb),
+ object);
+ gal_view_instance_load (view_instance);
+ priv->view_instance = view_instance;
+
+ g_signal_connect_swapped (
+ shell_view, "notify::view-id",
+ G_CALLBACK (cal_shell_content_notify_view_id_cb),
+ object);
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (priv->vpaned);
+ key = "/apps/evolution/calendar/display/vpane_position";
+ gconf_bridge_bind_property_delayed (bridge, key, object, "position");
+
+ g_object_unref (memo_model);
+ g_object_unref (task_model);
+}
+
+static void
+cal_shell_content_class_init (ECalShellContentClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECalShellContentPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = cal_shell_content_set_property;
+ object_class->get_property = cal_shell_content_get_property;
+ object_class->dispose = cal_shell_content_dispose;
+ object_class->finalize = cal_shell_content_finalize;
+ object_class->constructed = cal_shell_content_constructed;
+}
+
+static void
+cal_shell_content_init (ECalShellContent *cal_shell_content)
+{
+ cal_shell_content->priv =
+ E_CAL_SHELL_CONTENT_GET_PRIVATE (cal_shell_content);
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_cal_shell_content_get_type (void)
+{
+ return cal_shell_content_type;
+}
+
+void
+e_cal_shell_content_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (ECalShellContentClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) cal_shell_content_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ECalShellContent),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) cal_shell_content_init,
+ NULL /* value_table */
+ };
+
+ cal_shell_content_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_CONTENT,
+ "ECalShellContent", &type_info, 0);
+}
+
+GtkWidget *
+e_cal_shell_content_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_CAL_SHELL_CONTENT,
+ "shell-view", shell_view, NULL);
+}
+
+GnomeCalendar *
+e_cal_shell_content_get_calendar (ECalShellContent *cal_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
+
+ /* FIXME */
+ /*return GNOME_CALENDAR (cal_shell_content->priv->calendar);*/
+ return NULL;
+}
+
+EMemoTable *
+e_cal_shell_content_get_memo_table (ECalShellContent *cal_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
+
+ return E_MEMO_TABLE (cal_shell_content->priv->memo_table);
+}
+
+ECalendarTable *
+e_cal_shell_content_get_task_table (ECalShellContent *cal_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
+
+ return E_CALENDAR_TABLE (cal_shell_content->priv->task_table);
+}
+
+icaltimezone *
+e_cal_shell_content_get_timezone (ECalShellContent *cal_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
+
+ /* FIXME */
+ /*return cal_shell_content->priv->timezone;*/
+ return NULL;
+}
+
+GalViewInstance *
+e_cal_shell_content_get_view_instance (ECalShellContent *cal_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
+
+ return cal_shell_content->priv->view_instance;
+}
+
+void
+e_cal_shell_content_copy_clipboard (ECalShellContent *cal_shell_content)
+{
+#if 0
+ GnomeCalendar *calendar;
+ EMemoTable *memo_table;
+ ECalendarTable *task_table;
+
+ g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
+
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ switch (cal_shell_content_get_focus_location (cal_shell_content)) {
+ case FOCUS_CALENDAR:
+ gnome_calendar_copy_clipboard (calendar);
+ break;
+
+ case FOCUS_MEMO_TABLE:
+ e_memo_table_copy_clipboard (memo_table);
+ break;
+
+ case FOCUS_TASK_TABLE:
+ e_calendar_table_copy_clipboard (task_table);
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+#endif
+}
+
+void
+e_cal_shell_content_cut_clipboard (ECalShellContent *cal_shell_content)
+{
+#if 0
+ GnomeCalendar *calendar;
+ EMemoTable *memo_table;
+ ECalendarTable *task_table;
+
+ g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
+
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ switch (cal_shell_content_get_focus_location (cal_shell_content)) {
+ case FOCUS_CALENDAR:
+ gnome_calendar_cut_clipboard (calendar);
+ break;
+
+ case FOCUS_MEMO_TABLE:
+ e_memo_table_copy_clipboard (memo_table);
+ break;
+
+ case FOCUS_TASK_TABLE:
+ e_calendar_table_copy_clipboard (task_table);
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+#endif
+}
+
+void
+e_cal_shell_content_paste_clipboard (ECalShellContent *cal_shell_content)
+{
+#if 0
+ GnomeCalendar *calendar;
+ EMemoTable *memo_table;
+ ECalendarTable *task_table;
+
+ g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
+
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ switch (cal_shell_content_get_focus_location (cal_shell_content)) {
+ case FOCUS_CALENDAR:
+ gnome_calendar_paste_clipboard (calendar);
+ break;
+
+ case FOCUS_MEMO_TABLE:
+ e_memo_table_copy_clipboard (memo_table);
+ break;
+
+ case FOCUS_TASK_TABLE:
+ e_calendar_table_copy_clipboard (task_table);
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+#endif
+}
+
+void
+e_cal_shell_content_delete_selection (ECalShellContent *cal_shell_content)
+{
+#if 0
+ GnomeCalendar *calendar;
+ EMemoTable *memo_table;
+ ECalendarTable *task_table;
+
+ g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
+
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ switch (cal_shell_content_get_focus_location (cal_shell_content)) {
+ case FOCUS_CALENDAR:
+ gnome_calendar_delete_selection (calendar);
+ break;
+
+ case FOCUS_MEMO_TABLE:
+ e_memo_table_delete_selected (memo_table);
+ break;
+
+ case FOCUS_TASK_TABLE:
+ e_calendar_table_delete_selected (task_table);
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+#endif
+}
+
+void
+e_cal_shell_content_delete_selected_occurrence (ECalShellContent *cal_shell_content)
+{
+#if 0
+ GnomeCalendar *calendar;
+ FocusLocation focus;
+
+ g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
+
+ focus = cal_shell_content_get_focus_location (cal_shell_content);
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+
+ if (focus == FOCUS_CALENDAR)
+ gnome_calendar_delete_selected_occurrence (calendar);
+#endif
+}
diff --git a/calendar/module/e-cal-shell-content.h b/calendar/module/e-cal-shell-content.h
new file mode 100644
index 0000000000..44e13f733c
--- /dev/null
+++ b/calendar/module/e-cal-shell-content.h
@@ -0,0 +1,108 @@
+/*
+ * e-cal-shell-content.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_CAL_SHELL_CONTENT_H
+#define E_CAL_SHELL_CONTENT_H
+
+#include <shell/e-shell-content.h>
+#include <shell/e-shell-view.h>
+
+#include <calendar/gui/e-memo-table.h>
+#include <calendar/gui/gnome-cal.h>
+#include <menus/gal-view-instance.h>
+
+/* Standard GObject macros */
+#define E_TYPE_CAL_SHELL_CONTENT \
+ (e_cal_shell_content_get_type ())
+#define E_CAL_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CAL_SHELL_CONTENT, ECalShellContent))
+#define E_CAL_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CAL_SHELL_CONTENT, ECalShellContentClass))
+#define E_IS_CAL_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CAL_SHELL_CONTENT))
+#define E_IS_CAL_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CAL_SHELL_CONTENT))
+#define E_CAL_SHELL_CONTENT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CAL_SHELL_CONTENT, ECalShellContentClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ECalShellContent ECalShellContent;
+typedef struct _ECalShellContentClass ECalShellContentClass;
+typedef struct _ECalShellContentPrivate ECalShellContentPrivate;
+
+enum {
+ E_CAL_SHELL_CONTENT_SELECTION_SINGLE = 1 << 0,
+ E_CAL_SHELL_CONTENT_SELECTION_MULTIPLE = 1 << 1,
+ E_CAL_SHELL_CONTENT_SELECTION_IS_ASSIGNABLE = 1 << 2,
+ E_CAL_SHELL_CONTENT_SELECTION_IS_COMPLETE = 1 << 3,
+ E_CAL_SHELL_CONTENT_SELECTION_IS_EDITABLE = 1 << 4,
+ E_CAL_SHELL_CONTENT_SELECTION_IS_MEETING = 1 << 5,
+ E_CAL_SHELL_CONTENT_SELECTION_IS_ORGANIZER = 1 << 6,
+ E_CAL_SHELL_CONTENT_SELECTION_IS_RECURRING = 1 << 7,
+ E_CAL_SHELL_CONTENT_SELECTION_CAN_ACCEPT = 1 << 8,
+ E_CAL_SHELL_CONTENT_SELECTION_CAN_DELEGATE = 1 << 9,
+ E_CAL_SHELL_CONTENT_SELECTION_CAN_SAVE = 1 << 10
+};
+
+struct _ECalShellContent {
+ EShellContent parent;
+ ECalShellContentPrivate *priv;
+};
+
+struct _ECalShellContentClass {
+ EShellContentClass parent_class;
+};
+
+GType e_cal_shell_content_get_type (void);
+void e_cal_shell_content_register_type
+ (GTypeModule *type_module);
+GtkWidget * e_cal_shell_content_new (EShellView *shell_view);
+GnomeCalendar * e_cal_shell_content_get_calendar
+ (ECalShellContent *cal_shell_content);
+EMemoTable * e_cal_shell_content_get_memo_table
+ (ECalShellContent *cal_shell_content);
+ECalendarTable *e_cal_shell_content_get_task_table
+ (ECalShellContent *cal_shell_content);
+icaltimezone * e_cal_shell_content_get_timezone
+ (ECalShellContent *cal_shell_content);
+GalViewInstance *
+ e_cal_shell_content_get_view_instance
+ (ECalShellContent *cal_shell_content);
+void e_cal_shell_content_copy_clipboard
+ (ECalShellContent *cal_shell_content);
+void e_cal_shell_content_cut_clipboard
+ (ECalShellContent *cal_shell_content);
+void e_cal_shell_content_paste_clipboard
+ (ECalShellContent *cal_shell_content);
+void e_cal_shell_content_delete_selection
+ (ECalShellContent *cal_shell_content);
+void e_cal_shell_content_delete_selected_occurrence
+ (ECalShellContent *cal_shell_content);
+
+G_END_DECLS
+
+#endif /* E_CAL_SHELL_CONTENT_H */
diff --git a/calendar/gui/migration.c b/calendar/module/e-cal-shell-migrate.c
index 97cc575b20..5414f4a391 100644
--- a/calendar/gui/migration.c
+++ b/calendar/module/e-cal-shell-migrate.c
@@ -1,4 +1,6 @@
/*
+ * e-cal-shell-backend-migrate.c
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,14 +15,11 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Rodrigo Moya <rodrigo@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#include <config.h>
+#include "e-cal-shell-migrate.h"
#include <string.h>
#include <sys/types.h>
@@ -29,32 +28,26 @@
#include <fcntl.h>
#include <errno.h>
-#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
-
-#include <libecal/e-cal.h>
-
#include <libebackend/e-dbhash.h>
+#include <libedataserver/e-source.h>
+#include <libedataserver/e-source-group.h>
+#include <libedataserver/e-source-list.h>
#include <libedataserver/e-xml-hash-utils.h>
-#include <libedataserver/e-xml-utils.h>
-#include <libedataserver/e-account-list.h>
-#include <camel/camel-url.h>
#include "e-util/e-bconf-map.h"
#include "e-util/e-folder-map.h"
#include "e-util/e-util-private.h"
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/calendar-config-keys.h"
+#include "calendar/gui/e-cal-event.h"
+#include "shell/e-shell.h"
-#include "calendar-config-keys.h"
-#include "calendar-config.h"
-#include "e-cal-event.h"
-#include "migration.h"
-
-#ifndef G_OS_WIN32
-
-/* No previous versions have been available on Win32, so don't
- * bother with upgrade support from 1.x on Win32.
- */
+#define WEBCAL_BASE_URI "webcal://"
+#define CONTACTS_BASE_URI "contacts://"
+#define BAD_CONTACTS_BASE_URI "contact://"
+#define PERSONAL_RELATIVE_URI "system"
static e_gconf_map_t calendar_display_map[] = {
/* /Calendar/Display */
@@ -77,22 +70,6 @@ static e_gconf_map_t calendar_display_map[] = {
{ NULL },
};
-static e_gconf_map_t calendar_tasks_map[] = {
- /* /Calendar/Tasks */
- { "HideCompletedTasks", "calendar/tasks/hide_completed", E_GCONF_MAP_BOOL },
- { "HideCompletedTasksUnits", "calendar/tasks/hide_completed_units", E_GCONF_MAP_STRING },
- { "HideCompletedTasksValue", "calendar/tasks/hide_completed_value", E_GCONF_MAP_INT },
- { NULL },
-};
-
-static e_gconf_map_t calendar_tasks_colours_map[] = {
- /* /Calendar/Tasks/Colors */
- { "TasksDueToday", "calendar/tasks/colors/due_today", E_GCONF_MAP_STRING },
- { "TasksOverDue", "calendar/tasks/colors/overdue", E_GCONF_MAP_STRING },
- { "TasksDueToday", "calendar/tasks/colors/due_today", E_GCONF_MAP_STRING },
- { NULL },
-};
-
static e_gconf_map_t calendar_other_map[] = {
/* /Calendar/Other */
{ "ConfirmDelete", "calendar/prompts/confirm_delete", E_GCONF_MAP_BOOL },
@@ -127,20 +104,18 @@ static e_gconf_map_list_t calendar_remap_list[] = {
{ NULL },
};
-static e_gconf_map_list_t task_remap_list[] = {
-
- { "/Calendar/Tasks", calendar_tasks_map },
- { "/Calendar/Tasks/Colors", calendar_tasks_colours_map },
-
- { NULL },
-};
-
static GtkWidget *window;
static GtkLabel *label;
static GtkProgressBar *progress;
+#ifndef G_OS_WIN32
+
+/* No previous versions have been available on Win32, so don't
+ * bother with upgrade support from 1.x on Win32.
+ */
+
static void
-setup_progress_dialog (gboolean tasks)
+setup_progress_dialog (void)
{
GtkWidget *vbox, *hbox, *w;
@@ -153,30 +128,25 @@ setup_progress_dialog (gboolean tasks)
gtk_widget_show (vbox);
gtk_container_add ((GtkContainer *) window, vbox);
- if (tasks)
- w = gtk_label_new (_("The location and hierarchy of the Evolution task "
- "folders has changed since Evolution 1.x.\n\nPlease be "
- "patient while Evolution migrates your folders..."));
- else
- w = gtk_label_new (_("The location and hierarchy of the Evolution calendar "
- "folders has changed since Evolution 1.x.\n\nPlease be "
- "patient while Evolution migrates your folders..."));
+ w = gtk_label_new (_("The location and hierarchy of the Evolution calendar "
+ "folders has changed since Evolution 1.x.\n\nPlease be "
+ "patient while Evolution migrates your folders..."));
gtk_label_set_line_wrap ((GtkLabel *) w, TRUE);
gtk_widget_show (w);
- gtk_box_pack_start ((GtkBox *) vbox, w, TRUE, TRUE, 0);
+ gtk_box_pack_start_defaults ((GtkBox *) vbox, w);
hbox = gtk_hbox_new (FALSE, 6);
gtk_widget_show (hbox);
- gtk_box_pack_start ((GtkBox *) vbox, hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start_defaults ((GtkBox *) vbox, hbox);
label = (GtkLabel *) gtk_label_new ("");
gtk_widget_show ((GtkWidget *) label);
- gtk_box_pack_start ((GtkBox *) hbox, (GtkWidget *) label, TRUE, TRUE, 0);
+ gtk_box_pack_start_defaults ((GtkBox *) hbox, (GtkWidget *) label);
progress = (GtkProgressBar *) gtk_progress_bar_new ();
gtk_widget_show ((GtkWidget *) progress);
- gtk_box_pack_start ((GtkBox *) hbox, (GtkWidget *) progress, TRUE, TRUE, 0);
+ gtk_box_pack_start_defaults ((GtkBox *) hbox, (GtkWidget *) progress);
gtk_widget_show (window);
}
@@ -317,7 +287,7 @@ migrate_ical_folder_to_source (char *old_path, ESource *new_source, ECalSourceTy
ECal *old_ecal = NULL, *new_ecal = NULL;
ESource *old_source;
ESourceGroup *group;
- char *old_uri = g_filename_to_uri (old_path, NULL, NULL);
+ char *old_uri = g_strdup_printf ("file://%s", old_path);
GError *error = NULL;
gboolean retval = FALSE;
@@ -380,11 +350,126 @@ migrate_ical_folder (char *old_path, ESourceGroup *dest_group, char *source_name
#endif /* !G_OS_WIN32 */
-#define WEBCAL_BASE_URI "webcal://"
-#define CONTACTS_BASE_URI "contacts://"
-#define BAD_CONTACTS_BASE_URI "contact://"
-#define PERSONAL_RELATIVE_URI "system"
-#define GROUPWISE_BASE_URI "groupwise://"
+#ifndef G_OS_WIN32
+
+static void
+migrate_pilot_db_key (const char *key, gpointer user_data)
+{
+ EXmlHash *xmlhash = user_data;
+
+ e_xmlhash_add (xmlhash, key, "");
+}
+
+static void
+migrate_pilot_data (const char *component, const char *conduit, const char *old_path, const char *new_path)
+{
+ char *changelog, *map;
+ const char *dent;
+ const char *ext;
+ char *filename;
+ GDir *dir;
+
+ if (!(dir = g_dir_open (old_path, 0, NULL)))
+ return;
+
+ map = g_alloca (12 + strlen (conduit));
+ sprintf (map, "pilot-map-%s-", conduit);
+
+ changelog = g_alloca (24 + strlen (conduit));
+ sprintf (changelog, "pilot-sync-evolution-%s-", conduit);
+
+ while ((dent = g_dir_read_name (dir))) {
+ if (!strncmp (dent, map, strlen (map)) &&
+ ((ext = strrchr (dent, '.')) && !strcmp (ext, ".xml"))) {
+ /* pilot map file - src and dest file formats are identical */
+ unsigned char inbuf[4096];
+ size_t nread, nwritten;
+ int fd0, fd1;
+ ssize_t n;
+
+ filename = g_build_filename (old_path, dent, NULL);
+ if ((fd0 = g_open (filename, O_RDONLY|O_BINARY, 0)) == -1) {
+ g_free (filename);
+ continue;
+ }
+
+ g_free (filename);
+ filename = g_build_filename (new_path, dent, NULL);
+ if ((fd1 = g_open (filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666)) == -1) {
+ g_free (filename);
+ close (fd0);
+ continue;
+ }
+
+ do {
+ do {
+ n = read (fd0, inbuf, sizeof (inbuf));
+ } while (n == -1 && errno == EINTR);
+
+ if (n < 1)
+ break;
+
+ nread = n;
+ nwritten = 0;
+ do {
+ do {
+ n = write (fd1, inbuf + nwritten, nread - nwritten);
+ } while (n == -1 && errno == EINTR);
+
+ if (n > 0)
+ nwritten += n;
+ } while (nwritten < nread && n != -1);
+
+ if (n == -1)
+ break;
+ } while (1);
+
+ if (n != -1)
+ n = fsync (fd1);
+
+ if (n == -1) {
+ g_warning ("Failed to migrate %s: %s", dent, strerror (errno));
+ g_unlink (filename);
+ }
+
+ close (fd0);
+ close (fd1);
+ g_free (filename);
+ } else if (!strncmp (dent, changelog, strlen (changelog)) &&
+ ((ext = strrchr (dent, '.')) && !strcmp (ext, ".db"))) {
+ /* src and dest formats differ, src format is db3 while dest format is xml */
+ EXmlHash *xmlhash;
+ EDbHash *dbhash;
+ struct stat st;
+
+ filename = g_build_filename (old_path, dent, NULL);
+ if (g_stat (filename, &st) == -1) {
+ g_free (filename);
+ continue;
+ }
+
+ dbhash = e_dbhash_new (filename);
+ g_free (filename);
+
+ filename = g_strdup_printf ("%s/%s.ics-%s", new_path, component, dent);
+ if (g_stat (filename, &st) != -1)
+ g_unlink (filename);
+ xmlhash = e_xmlhash_new (filename);
+ g_free (filename);
+
+ e_dbhash_foreach_key (dbhash, migrate_pilot_db_key, xmlhash);
+
+ e_dbhash_destroy (dbhash);
+
+ e_xmlhash_write (xmlhash);
+ e_xmlhash_destroy (xmlhash);
+ }
+ }
+
+ g_dir_close (dir);
+}
+
+#endif
static ESourceGroup *
create_calendar_contact_source (ESourceList *source_list)
@@ -407,13 +492,15 @@ create_calendar_contact_source (ESourceList *source_list)
}
static void
-create_calendar_sources (CalendarComponent *component,
- ESourceList *source_list,
+create_calendar_sources (EShellBackend *shell_backend,
+ ESourceList *source_list,
ESourceGroup **on_this_computer,
ESource **personal_source,
ESourceGroup **on_the_web,
ESourceGroup **contacts)
{
+ EShell *shell;
+ EShellSettings *shell_settings;
GSList *groups;
ESourceGroup *group;
char *base_uri, *base_uri_proto;
@@ -424,7 +511,10 @@ create_calendar_sources (CalendarComponent *component,
*contacts = NULL;
*personal_source = NULL;
- base_dir = calendar_component_peek_base_directory (component);
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ base_dir = e_shell_backend_get_config_dir (shell_backend);
base_uri = g_build_filename (base_dir, "local", NULL);
base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
@@ -479,16 +569,21 @@ create_calendar_sources (CalendarComponent *component,
}
if (!*personal_source) {
- char *primary_calendar = calendar_config_get_primary_calendar ();
+ char *primary_calendar;
/* Create the default Person calendar */
ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
e_source_group_add_source (*on_this_computer, source, -1);
+ primary_calendar = e_shell_settings_get_string (
+ shell_settings, "cal-primary-calendar");
+
if (!primary_calendar && !calendar_config_get_calendars_selected ()) {
GSList selected;
- calendar_config_set_primary_calendar (e_source_peek_uid (source));
+ e_shell_settings_set_string (
+ shell_settings, "cal-primary-calendar",
+ e_source_peek_uid (source));
selected.data = (gpointer)e_source_peek_uid (source);
selected.next = NULL;
@@ -518,233 +613,29 @@ create_calendar_sources (CalendarComponent *component,
g_free (base_uri);
}
-static void
-create_task_sources (TasksComponent *component,
- ESourceList *source_list,
- ESourceGroup **on_this_computer,
- ESourceGroup **on_the_web,
- ESource **personal_source)
-{
- GSList *groups;
- ESourceGroup *group;
- char *base_uri, *base_uri_proto;
- const gchar *base_dir;
-
- *on_this_computer = NULL;
- *on_the_web = NULL;
- *personal_source = NULL;
-
- base_dir = tasks_component_peek_base_directory (component);
- base_uri = g_build_filename (base_dir, "local", NULL);
-
- base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
-
- groups = e_source_list_peek_groups (source_list);
- if (groups) {
- /* groups are already there, we need to search for things... */
- GSList *g;
-
- for (g = groups; g; g = g->next) {
-
- group = E_SOURCE_GROUP (g->data);
-
- if (!*on_this_computer && !strcmp (base_uri_proto, e_source_group_peek_base_uri (group)))
- *on_this_computer = g_object_ref (group);
- else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI, e_source_group_peek_base_uri (group)))
- *on_the_web = g_object_ref (group);
- }
- }
-
- if (*on_this_computer) {
- /* make sure "Personal" shows up as a source under
- this group */
- GSList *sources = e_source_group_peek_sources (*on_this_computer);
- GSList *s;
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
- const gchar *relative_uri;
-
- relative_uri = e_source_peek_relative_uri (source);
- if (relative_uri == NULL)
- continue;
- if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
- *personal_source = g_object_ref (source);
- break;
- }
- }
- } else {
- /* create the local source group */
- group = e_source_group_new (_("On This Computer"), base_uri_proto);
- e_source_list_add_group (source_list, group, -1);
-
- *on_this_computer = group;
- }
-
- if (!*personal_source) {
- /* Create the default Person task list */
- ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
- e_source_group_add_source (*on_this_computer, source, -1);
-
- if (!calendar_config_get_primary_tasks () && !calendar_config_get_tasks_selected ()) {
- GSList selected;
-
- calendar_config_set_primary_tasks (e_source_peek_uid (source));
-
- selected.data = (gpointer)e_source_peek_uid (source);
- selected.next = NULL;
- calendar_config_set_tasks_selected (&selected);
- }
-
- e_source_set_color_spec (source, "#BECEDD");
- *personal_source = source;
- }
-
- if (!*on_the_web) {
- /* Create the Webcal source group */
- group = e_source_group_new (_("On The Web"), WEBCAL_BASE_URI);
- e_source_list_add_group (source_list, group, -1);
-
- *on_the_web = group;
- }
-
- g_free (base_uri_proto);
- g_free (base_uri);
-}
-
-#ifndef G_OS_WIN32
-
-static void
-migrate_pilot_db_key (const char *key, gpointer user_data)
-{
- EXmlHash *xmlhash = user_data;
-
- e_xmlhash_add (xmlhash, key, "");
-}
-
-static void
-migrate_pilot_data (const char *component, const char *conduit, const char *old_path, const char *new_path)
-{
- char *changelog, *map;
- const char *dent;
- const char *ext;
- char *filename;
- GDir *dir;
-
- if (!(dir = g_dir_open (old_path, 0, NULL)))
- return;
-
- map = g_alloca (12 + strlen (conduit));
- sprintf (map, "pilot-map-%s-", conduit);
-
- changelog = g_alloca (24 + strlen (conduit));
- sprintf (changelog, "pilot-sync-evolution-%s-", conduit);
-
- while ((dent = g_dir_read_name (dir))) {
- if (!strncmp (dent, map, strlen (map)) &&
- ((ext = strrchr (dent, '.')) && !strcmp (ext, ".xml"))) {
- /* pilot map file - src and dest file formats are identical */
- unsigned char inbuf[4096];
- size_t nread, nwritten;
- int fd0, fd1;
- ssize_t n;
-
- filename = g_build_filename (old_path, dent, NULL);
- if ((fd0 = g_open (filename, O_RDONLY|O_BINARY, 0)) == -1) {
- g_free (filename);
- continue;
- }
-
- g_free (filename);
- filename = g_build_filename (new_path, dent, NULL);
- if ((fd1 = g_open (filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666)) == -1) {
- g_free (filename);
- close (fd0);
- continue;
- }
-
- do {
- do {
- n = read (fd0, inbuf, sizeof (inbuf));
- } while (n == -1 && errno == EINTR);
-
- if (n < 1)
- break;
-
- nread = n;
- nwritten = 0;
- do {
- do {
- n = write (fd1, inbuf + nwritten, nread - nwritten);
- } while (n == -1 && errno == EINTR);
-
- if (n > 0)
- nwritten += n;
- } while (nwritten < nread && n != -1);
-
- if (n == -1)
- break;
- } while (1);
-
- if (n != -1)
- n = fsync (fd1);
-
- if (n == -1) {
- g_warning ("Failed to migrate %s: %s", dent, g_strerror (errno));
- g_unlink (filename);
- }
-
- close (fd0);
- close (fd1);
- g_free (filename);
- } else if (!strncmp (dent, changelog, strlen (changelog)) &&
- ((ext = strrchr (dent, '.')) && !strcmp (ext, ".db"))) {
- /* src and dest formats differ, src format is db3 while dest format is xml */
- EXmlHash *xmlhash;
- EDbHash *dbhash;
- struct stat st;
-
- filename = g_build_filename (old_path, dent, NULL);
- if (g_stat (filename, &st) == -1) {
- g_free (filename);
- continue;
- }
-
- dbhash = e_dbhash_new (filename);
- g_free (filename);
-
- filename = g_strdup_printf ("%s/%s.ics-%s", new_path, component, dent);
- if (g_stat (filename, &st) != -1)
- g_unlink (filename);
- xmlhash = e_xmlhash_new (filename);
- g_free (filename);
-
- e_dbhash_foreach_key (dbhash, migrate_pilot_db_key, xmlhash);
-
- e_dbhash_destroy (dbhash);
-
- e_xmlhash_write (xmlhash);
- e_xmlhash_destroy (xmlhash);
- }
- }
-
- g_dir_close (dir);
-}
-
-#endif
-
gboolean
-migrate_calendars (CalendarComponent *component, int major, int minor, int revision, GError **err)
+e_cal_shell_backend_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error)
{
ESourceGroup *on_this_computer = NULL, *on_the_web = NULL, *contacts = NULL;
ESource *personal_source = NULL;
+ ESourceList *source_list;
ECalEvent *ece;
- ECalEventTargetComponent *target;
+ ECalEventTargetModule *target;
gboolean retval = FALSE;
+ source_list = g_object_get_data (
+ G_OBJECT (shell_backend), "source-list");
+
/* we call this unconditionally now - create_groups either
creates the groups/sources or it finds the necessary
groups/sources. */
- create_calendar_sources (component, calendar_component_peek_source_list (component), &on_this_computer, &personal_source, &on_the_web, &contacts);
+ create_calendar_sources (
+ shell_backend, source_list, &on_this_computer,
+ &personal_source, &on_the_web, &contacts);
#ifndef G_OS_WIN32
if (major == 1) {
@@ -772,7 +663,7 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
if (res != 0) {
/* FIXME: set proper domain/code */
- g_set_error(err, 0, 0, _("Unable to migrate old settings from evolution/config.xmldb"));
+ g_set_error(error, 0, 0, _("Unable to migrate old settings from evolution/config.xmldb"));
goto fail;
}
}
@@ -781,7 +672,7 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
GSList *migration_dirs, *l;
char *path, *local_cal_folder;
- setup_progress_dialog (FALSE);
+ setup_progress_dialog ();
path = g_build_filename (g_get_home_dir (), "evolution", "local", NULL);
migration_dirs = e_folder_map_local_folders (path, "calendar");
@@ -801,7 +692,7 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
if (!migrate_ical_folder (l->data, on_this_computer, source_name, E_CAL_SOURCE_TYPE_EVENT)) {
/* FIXME: domain/code */
- g_set_error(err, 0, 0, _("Unable to migrate calendar `%s'"), source_name);
+ g_set_error(error, 0, 0, _("Unable to migrate calendar `%s'"), source_name);
g_free(source_name);
goto fail;
}
@@ -814,7 +705,7 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
dialog_close ();
}
- if (minor <= 4 || (minor == 5 && revision < 5)) {
+ if (minor <= 4 || (minor == 5 && micro < 5)) {
GConfClient *gconf;
GConfValue *gconf_val;
int i;
@@ -840,11 +731,11 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
g_object_unref (gconf);
}
- if (minor < 5 || (minor == 5 && revision <= 10)) {
+ if (minor < 5 || (minor == 5 && micro <= 10)) {
char *old_path, *new_path;
old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Calendar", NULL);
- new_path = g_build_filename (calendar_component_peek_base_directory (component),
+ new_path = g_build_filename (e_shell_backend_get_config_dir (shell_backend),
"local", "system", NULL);
migrate_pilot_data ("calendar", "calendar", old_path, new_path);
g_free (new_path);
@@ -857,9 +748,9 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
during one phase of development, as they take
precedent over relative uris (but aren't updated
when editing an ESource). */
- if (minor == 5 && revision <= 11) {
+ if (minor == 5 && micro <= 11) {
GSList *g;
- for (g = e_source_list_peek_groups (calendar_component_peek_source_list (component)); g; g = g->next) {
+ for (g = e_source_list_peek_groups (source_list); g; g = g->next) {
ESourceGroup *group = g->data;
GSList *s;
@@ -873,7 +764,7 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
}
#endif /* !G_OS_WIN32 */
- e_source_list_sync (calendar_component_peek_source_list (component), NULL);
+ e_source_list_sync (source_list, NULL);
/** @Event: component.migration
* @Title: Migration step in component initialization
@@ -886,8 +777,8 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
*/
/* Fire off migration event */
ece = e_cal_event_peek ();
- target = e_cal_event_target_new_component (ece, calendar_component_peek (), 0);
- e_event_emit ((EEvent *) ece, "component.migration", (EEventTarget *) target);
+ target = e_cal_event_target_new_module (ece, shell_backend, 0);
+ e_event_emit ((EEvent *) ece, "module.migration", (EEventTarget *) target);
retval = TRUE;
fail:
@@ -903,343 +794,3 @@ fail:
return retval;
}
-gboolean
-migrate_tasks (TasksComponent *component, int major, int minor, int revision, GError **err)
-{
- ESourceGroup *on_this_computer = NULL;
- ESourceGroup *on_the_web = NULL;
- ESource *personal_source = NULL;
- gboolean retval = FALSE;
-
- /* we call this unconditionally now - create_groups either
- creates the groups/sources or it finds the necessary
- groups/sources. */
- create_task_sources (component, tasks_component_peek_source_list (component), &on_this_computer, &on_the_web, &personal_source);
-
-#ifndef G_OS_WIN32
- if (major == 1) {
- xmlDocPtr config_doc = NULL;
- char *conf_file;
-
- conf_file = g_build_filename (g_get_home_dir (), "evolution", "config.xmldb", NULL);
- if (g_file_test (conf_file, G_FILE_TEST_IS_REGULAR))
- config_doc = e_xml_parse_file (conf_file);
- g_free (conf_file);
-
- if (config_doc && minor <= 2) {
- GConfClient *gconf;
- int res = 0;
-
- /* move bonobo config to gconf */
- gconf = gconf_client_get_default ();
-
- res = e_bconf_import (gconf, config_doc, task_remap_list);
-
- g_object_unref (gconf);
-
- xmlFreeDoc(config_doc);
-
- if (res != 0) {
- g_set_error(err, 0, 0, _("Unable to migrate old settings from evolution/config.xmldb"));
- goto fail;
- }
- }
-
- if (minor <= 4) {
- GSList *migration_dirs, *l;
- char *path, *local_task_folder;
-
- setup_progress_dialog (TRUE);
-
- path = g_build_filename (g_get_home_dir (), "evolution", "local", NULL);
- migration_dirs = e_folder_map_local_folders (path, "tasks");
- local_task_folder = g_build_filename (path, "Tasks", NULL);
- g_free (path);
-
- if (personal_source)
- migrate_ical_folder_to_source (local_task_folder, personal_source, E_CAL_SOURCE_TYPE_TODO);
-
- for (l = migration_dirs; l; l = l->next) {
- char *source_name;
-
- if (personal_source && !strcmp ((char*)l->data, local_task_folder))
- continue;
-
- source_name = get_source_name (on_this_computer, (char*)l->data);
-
- if (!migrate_ical_folder (l->data, on_this_computer, source_name, E_CAL_SOURCE_TYPE_TODO)) {
- /* FIXME: domain/code */
- g_set_error(err, 0, 0, _("Unable to migrate tasks `%s'"), source_name);
- g_free(source_name);
- goto fail;
- }
-
- g_free (source_name);
- }
-
- g_free (local_task_folder);
-
- dialog_close ();
- }
-
- if (minor < 5 || (minor == 5 && revision <= 10)) {
- char *old_path, *new_path;
-
- old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Tasks", NULL);
- new_path = g_build_filename (tasks_component_peek_base_directory (component),
- "local", "system", NULL);
- migrate_pilot_data ("tasks", "todo", old_path, new_path);
- g_free (new_path);
- g_free (old_path);
- }
-
- /* we only need to do this next step if people ran
- older versions of 1.5. We need to clear out the
- absolute URI's that were assigned to ESources
- during one phase of development, as they take
- precedent over relative uris (but aren't updated
- when editing an ESource). */
- if (minor == 5 && revision <= 11) {
- GSList *g;
- for (g = e_source_list_peek_groups (tasks_component_peek_source_list (component)); g; g = g->next) {
- ESourceGroup *group = g->data;
- GSList *s;
-
- for (s = e_source_group_peek_sources (group); s; s = s->next) {
- ESource *source = s->data;
- e_source_set_absolute_uri (source, NULL);
- }
- }
- }
- }
-#endif /* !G_OS_WIN32 */
- e_source_list_sync (tasks_component_peek_source_list (component), NULL);
- retval = TRUE;
-fail:
- if (on_this_computer)
- g_object_unref (on_this_computer);
- if (on_the_web)
- g_object_unref (on_the_web);
- if (personal_source)
- g_object_unref (personal_source);
-
- return retval;
-}
-
-/********************************************************************************************************
- *
- * MEMOS
- *
- ********************************************************************************************************/
-
-static void
-create_memo_sources (MemosComponent *component,
- ESourceList *source_list,
- ESourceGroup **on_this_computer,
- ESourceGroup **on_the_web,
- ESource **personal_source)
-{
- GSList *groups;
- ESourceGroup *group;
- char *base_uri, *base_uri_proto;
- const gchar *base_dir;
-
- *on_this_computer = NULL;
- *on_the_web = NULL;
- *personal_source = NULL;
-
- base_dir = memos_component_peek_base_directory (component);
- base_uri = g_build_filename (base_dir, "local", NULL);
-
- base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
-
- groups = e_source_list_peek_groups (source_list);
- if (groups) {
- /* groups are already there, we need to search for things... */
- GSList *g;
-
- for (g = groups; g; g = g->next) {
-
- group = E_SOURCE_GROUP (g->data);
-
- if (!*on_this_computer && !strcmp (base_uri_proto, e_source_group_peek_base_uri (group)))
- *on_this_computer = g_object_ref (group);
- else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI, e_source_group_peek_base_uri (group)))
- *on_the_web = g_object_ref (group);
- }
- }
-
- if (*on_this_computer) {
- /* make sure "Personal" shows up as a source under
- this group */
- GSList *sources = e_source_group_peek_sources (*on_this_computer);
- GSList *s;
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
- const gchar *relative_uri;
-
- relative_uri = e_source_peek_relative_uri (source);
- if (relative_uri == NULL)
- continue;
- if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
- *personal_source = g_object_ref (source);
- break;
- }
- }
- } else {
- /* create the local source group */
- group = e_source_group_new (_("On This Computer"), base_uri_proto);
- e_source_list_add_group (source_list, group, -1);
-
- *on_this_computer = group;
- }
-
- if (!*personal_source) {
- /* Create the default Person task list */
- ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
- e_source_group_add_source (*on_this_computer, source, -1);
-
- if (!calendar_config_get_primary_memos () && !calendar_config_get_memos_selected ()) {
- GSList selected;
-
- calendar_config_set_primary_memos (e_source_peek_uid (source));
-
- selected.data = (gpointer)e_source_peek_uid (source);
- selected.next = NULL;
- calendar_config_set_memos_selected (&selected);
- }
-
- e_source_set_color_spec (source, "#BECEDD");
- *personal_source = source;
- }
-
- if (!*on_the_web) {
- /* Create the Webcal source group */
- group = e_source_group_new (_("On The Web"), WEBCAL_BASE_URI);
- e_source_list_add_group (source_list, group, -1);
-
- *on_the_web = group;
- }
-
- g_free (base_uri_proto);
- g_free (base_uri);
-}
-
-static gboolean
-is_groupwise_account (EAccount *account)
-{
- if (account->source->url != NULL) {
- return g_str_has_prefix (account->source->url, GROUPWISE_BASE_URI);
- } else {
- return FALSE;
- }
-}
-
-static void
-add_gw_esource (ESourceList *source_list, const char *group_name, const char *source_name, CamelURL *url, GConfClient *client)
-{
- ESourceGroup *group;
- ESource *source;
- GSList *ids, *temp ;
- GError *error = NULL;
- char *relative_uri;
- const char *soap_port;
- const char * use_ssl;
- const char *poa_address;
- const char *offline_sync;
-
-
- poa_address = url->host;
- if (!poa_address || strlen (poa_address) ==0)
- return;
- soap_port = camel_url_get_param (url, "soap_port");
-
- if (!soap_port || strlen (soap_port) == 0)
- soap_port = "7191";
-
- use_ssl = camel_url_get_param (url, "use_ssl");
- offline_sync = camel_url_get_param (url, "offline_sync");
-
- group = e_source_group_new (group_name, GROUPWISE_BASE_URI);
- if (!e_source_list_add_group (source_list, group, -1))
- return;
- relative_uri = g_strdup_printf ("%s@%s/", url->user, poa_address);
-
- source = e_source_new (source_name, relative_uri);
- e_source_set_property (source, "auth", "1");
- e_source_set_property (source, "username", url->user);
- e_source_set_property (source, "port", camel_url_get_param (url, "soap_port"));
- e_source_set_property (source, "auth-domain", "Groupwise");
- e_source_set_property (source, "use_ssl", use_ssl);
- e_source_set_property (source, "offline_sync", offline_sync ? "1" : "0" );
-
- e_source_set_color_spec (source, "#EEBC60");
- e_source_group_add_source (group, source, -1);
-
- ids = gconf_client_get_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, &error);
- if ( error != NULL ) {
- g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
- g_error_free(error);
- }
- ids = g_slist_append (ids, g_strdup (e_source_peek_uid (source)));
- gconf_client_set_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, ids, NULL);
- temp = ids;
- for (; temp != NULL; temp = g_slist_next (temp))
- g_free (temp->data);
-
- g_slist_free (ids);
- g_object_unref (source);
- g_object_unref (group);
- g_free (relative_uri);
-}
-
-gboolean
-migrate_memos (MemosComponent *component, int major, int minor, int revision, struct _GError **err)
-{
- ESourceGroup *on_this_computer = NULL;
- ESourceGroup *on_the_web = NULL;
- ESource *personal_source = NULL;
- ESourceList *source_list = NULL;
- gboolean retval = FALSE;
-
- source_list = memos_component_peek_source_list (component);
-
- /* we call this unconditionally now - create_groups either
- creates the groups/sources or it finds the necessary
- groups/sources. */
- create_memo_sources (component, source_list, &on_this_computer, &on_the_web, &personal_source);
-
- /* Migration for Gw accounts between versions < 2.8 */
- if (major == 2 && minor < 8) {
- EAccountList *al;
- EAccount *a;
- CamelURL *url;
- EIterator *it;
- GConfClient *gconf_client = gconf_client_get_default ();
- al = e_account_list_new (gconf_client);
- for (it = e_list_get_iterator((EList *)al);
- e_iterator_is_valid(it);
- e_iterator_next(it)) {
- a = (EAccount *) e_iterator_get(it);
- if (!a->enabled || !is_groupwise_account (a))
- continue;
- url = camel_url_new (a->source->url, NULL);
- add_gw_esource (source_list, a->name, _("Notes"), url, gconf_client);
- camel_url_free (url);
- }
- g_object_unref (al);
- g_object_unref (gconf_client);
- }
-
- e_source_list_sync (source_list, NULL);
- retval = TRUE;
-
- if (on_this_computer)
- g_object_unref (on_this_computer);
- if (on_the_web)
- g_object_unref (on_the_web);
- if (personal_source)
- g_object_unref (personal_source);
-
- return retval;
-}
diff --git a/mail/em-migrate.h b/calendar/module/e-cal-shell-migrate.h
index 238f4fda1c..359ca5ea22 100644
--- a/mail/em-migrate.h
+++ b/calendar/module/e-cal-shell-migrate.h
@@ -1,4 +1,6 @@
/*
+ * e-cal-shell-backend-migrate.h
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,27 +15,24 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Jeffrey Stedfast <fejj@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifndef __EM_MIGRATE_H__
-#define __EM_MIGRATE_H__
+#ifndef E_CAL_SHELL_BACKEND_MIGRATE_H
+#define E_CAL_SHELL_BACKEND_MIGRATE_H
-#include <camel/camel-exception.h>
+#include <glib.h>
+#include <shell/e-shell-backend.h>
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+G_BEGIN_DECLS
-int em_migrate (const char *evolution_dir, int major, int minor, int revision, CamelException *ex);
+gboolean e_cal_shell_backend_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
-#endif /* __EM_MIGRATE_H__ */
+#endif /* E_CAL_SHELL_BACKEND_MIGRATE_H */
diff --git a/calendar/module/e-cal-shell-settings.c b/calendar/module/e-cal-shell-settings.c
new file mode 100644
index 0000000000..03af4aeebc
--- /dev/null
+++ b/calendar/module/e-cal-shell-settings.c
@@ -0,0 +1,59 @@
+/*
+ * e-cal-shell-backend-settings.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-cal-shell-settings.h"
+
+#include <gconf/gconf-client.h>
+
+void
+e_cal_shell_backend_init_settings (EShell *shell)
+{
+ EShellSettings *shell_settings;
+
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ /* XXX Default values should match the GConf schema.
+ * Yes it's redundant, but we're stuck with GConf. */
+
+ e_shell_settings_install_property (
+ g_param_spec_string (
+ "cal-primary-calendar",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-primary-calendar",
+ "/apps/evolution/calendar/display/primary_calendar");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "cal-use-system-timezone",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "cal-use-system-timezone",
+ "/apps/evolution/calendar/display/use_system_timezone");
+}
diff --git a/shell/e-shell-window-commands.h b/calendar/module/e-cal-shell-settings.h
index 0696a8a5d0..de8b22888b 100644
--- a/shell/e-shell-window-commands.h
+++ b/calendar/module/e-cal-shell-settings.h
@@ -1,4 +1,5 @@
/*
+ * e-cal-shell-backend-settings.h
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -14,18 +15,19 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifndef _E_SHELL_WINDOW_COMMANDS_H_
-#define _E_SHELL_WINDOW_COMMANDS_H_
+#ifndef E_CAL_SHELL_BACKEND_SETTINGS_H
+#define E_CAL_SHELL_BACKEND_SETTINGS_H
+
+#include <shell/e-shell.h>
+
+G_BEGIN_DECLS
-#include "e-shell-window.h"
+void e_cal_shell_backend_init_settings (EShell *shell);
-void e_shell_window_commands_setup (EShellWindow *window);
+G_END_DECLS
-#endif /* _E_SHELL_WINDOW_COMMANDS_H_ */
+#endif /* E_CAL_SHELL_BACKEND_SETTINGS_H */
diff --git a/calendar/module/e-cal-shell-sidebar.c b/calendar/module/e-cal-shell-sidebar.c
new file mode 100644
index 0000000000..dc7df596d6
--- /dev/null
+++ b/calendar/module/e-cal-shell-sidebar.c
@@ -0,0 +1,759 @@
+/*
+ * e-cal-shell-sidebar.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-cal-shell-sidebar.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+
+#include "e-util/e-error.h"
+#include "e-util/gconf-bridge.h"
+#include "calendar/common/authentication.h"
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/e-calendar-selector.h"
+#include "calendar/gui/e-mini-calendar-config.h"
+#include "calendar/gui/misc.h"
+
+#include "e-cal-shell-backend.h"
+#include "e-cal-shell-view.h"
+
+#define E_CAL_SHELL_SIDEBAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarPrivate))
+
+struct _ECalShellSidebarPrivate {
+ GtkWidget *paned;
+ GtkWidget *selector;
+ GtkWidget *mini_calendar;
+
+ /* UID -> Client */
+ GHashTable *client_table;
+
+ EMiniCalendarConfig *mini_calendar_config;
+};
+
+enum {
+ PROP_0,
+ PROP_MINI_CALENDAR,
+ PROP_SELECTOR
+};
+
+enum {
+ CLIENT_ADDED,
+ CLIENT_REMOVED,
+ STATUS_MESSAGE,
+ LAST_SIGNAL
+};
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+static GType cal_shell_sidebar_type;
+
+static void
+cal_shell_sidebar_emit_client_added (ECalShellSidebar *cal_shell_sidebar,
+ ECal *client)
+{
+ guint signal_id = signals[CLIENT_ADDED];
+
+ g_signal_emit (cal_shell_sidebar, signal_id, 0, client);
+}
+
+static void
+cal_shell_sidebar_emit_client_removed (ECalShellSidebar *cal_shell_sidebar,
+ ECal *client)
+{
+ guint signal_id = signals[CLIENT_REMOVED];
+
+ g_signal_emit (cal_shell_sidebar, signal_id, 0, client);
+}
+
+static void
+cal_shell_sidebar_emit_status_message (ECalShellSidebar *cal_shell_sidebar,
+ const gchar *status_message)
+{
+ guint signal_id = signals[STATUS_MESSAGE];
+
+ g_signal_emit (cal_shell_sidebar, signal_id, 0, status_message);
+}
+
+static void
+cal_shell_sidebar_backend_died_cb (ECalShellSidebar *cal_shell_sidebar,
+ ECal *client)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellSidebar *shell_sidebar;
+ GHashTable *client_table;
+ ESource *source;
+ const gchar *uid;
+
+ client_table = cal_shell_sidebar->priv->client_table;
+
+ shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ source = e_cal_get_source (client);
+ uid = e_source_peek_uid (source);
+
+ g_object_ref (source);
+
+ g_hash_table_remove (client_table, uid);
+ cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL);
+
+ e_error_run (
+ GTK_WINDOW (shell_window),
+ "calendar:calendar-crashed", NULL);
+
+ g_object_unref (source);
+}
+
+static void
+cal_shell_sidebar_backend_error_cb (ECalShellSidebar *cal_shell_sidebar,
+ const gchar *message,
+ ECal *client)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellSidebar *shell_sidebar;
+ GtkWidget *dialog;
+ const gchar *uri;
+ gchar *uri_no_passwd;
+
+ shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ uri = e_cal_get_uri (client);
+ uri_no_passwd = get_uri_without_password (uri);
+
+ dialog = gtk_message_dialog_new (
+ GTK_WINDOW (shell_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ _("Error on %s\n%s"),
+ uri_no_passwd, message);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ g_free (uri_no_passwd);
+}
+
+static void
+cal_shell_sidebar_client_opened_cb (ECalShellSidebar *cal_shell_sidebar,
+ ECalendarStatus status,
+ ECal *client)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellSidebar *shell_sidebar;
+ ESource *source;
+
+ source = e_cal_get_source (client);
+
+ shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED ||
+ status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
+ auth_cal_forget_password (client);
+
+ switch (status) {
+ case E_CALENDAR_STATUS_OK:
+ g_signal_handlers_disconnect_matched (
+ client, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
+ cal_shell_sidebar_client_opened_cb, NULL);
+
+ cal_shell_sidebar_emit_status_message (
+ cal_shell_sidebar, _("Loading calendars"));
+ cal_shell_sidebar_emit_client_added (
+ cal_shell_sidebar, client);
+ cal_shell_sidebar_emit_status_message (
+ cal_shell_sidebar, NULL);
+ break;
+
+ case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
+ e_cal_open_async (client, FALSE);
+ break;
+
+ case E_CALENDAR_STATUS_BUSY:
+ break;
+
+ case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
+ e_error_run (
+ GTK_WINDOW (shell_window),
+ "calendar:prompt-no-contents-offline-calendar",
+ NULL);
+ break;
+
+ default:
+ cal_shell_sidebar_emit_client_removed (
+ cal_shell_sidebar, client);
+ break;
+ }
+}
+
+static void
+cal_shell_sidebar_row_changed_cb (ECalShellSidebar *cal_shell_sidebar,
+ GtkTreePath *tree_path,
+ GtkTreeIter *tree_iter,
+ GtkTreeModel *tree_model)
+{
+ ESourceSelector *selector;
+ ESource *source;
+
+ /* XXX ESourceSelector's underlying tree store has only one
+ * column: ESource objects. While we're not supposed to
+ * know this, listening for "row-changed" signals from
+ * the model is easier to deal with than the selector's
+ * "selection-changed" signal, which doesn't tell you
+ * _which_ row changed. */
+
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+ gtk_tree_model_get (tree_model, tree_iter, 0, &source, -1);
+
+ /* XXX This signal gets emitted a lot while the model is being
+ * rebuilt, during which time we won't get a valid ESource.
+ * ESourceSelector should probably block this signal while
+ * rebuilding the model, but we'll be forgiving and not
+ * emit a warning. */
+ if (!E_IS_SOURCE (source))
+ return;
+
+ if (e_source_selector_source_is_selected (selector, source))
+ e_cal_shell_sidebar_add_source (cal_shell_sidebar, source);
+ else
+ e_cal_shell_sidebar_remove_source (cal_shell_sidebar, source);
+}
+
+static void
+cal_shell_sidebar_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar,
+ ESourceSelector *selector)
+{
+ GSList *list, *iter;
+
+ /* This signal is emitted less frequently than "row-changed",
+ * especially when the model is being rebuilt. So we'll take
+ * it easy on poor GConf. */
+
+ list = e_source_selector_get_selection (selector);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ESource *source = iter->data;
+
+ iter->data = (gpointer) e_source_peek_uid (source);
+ g_object_unref (source);
+ }
+
+ calendar_config_set_calendars_selected (list);
+
+ g_slist_free (list);
+}
+
+static void
+cal_shell_sidebar_primary_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar,
+ ESourceSelector *selector)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellSidebar *shell_sidebar;
+ EShellSettings *shell_settings;
+ ESource *source;
+
+ /* XXX ESourceSelector needs a "primary-selection-uid" property
+ * so we can just bind the property with GConfBridge. */
+
+ source = e_source_selector_peek_primary_selection (selector);
+ if (source == NULL)
+ return;
+
+ shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ e_shell_settings_set_string (
+ shell_settings, "cal-primary-calendar",
+ e_source_peek_uid (source));
+}
+
+static void
+cal_shell_sidebar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MINI_CALENDAR:
+ g_value_set_object (
+ value, e_cal_shell_sidebar_get_mini_calendar (
+ E_CAL_SHELL_SIDEBAR (object)));
+ return;
+
+ case PROP_SELECTOR:
+ g_value_set_object (
+ value, e_cal_shell_sidebar_get_selector (
+ E_CAL_SHELL_SIDEBAR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+cal_shell_sidebar_dispose (GObject *object)
+{
+ ECalShellSidebarPrivate *priv;
+
+ priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ if (priv->paned != NULL) {
+ g_object_unref (priv->paned);
+ priv->paned = NULL;
+ }
+
+ if (priv->selector != NULL) {
+ g_object_unref (priv->selector);
+ priv->selector = NULL;
+ }
+
+ if (priv->mini_calendar != NULL) {
+ g_object_unref (priv->mini_calendar);
+ priv->mini_calendar = NULL;
+ }
+
+ g_hash_table_remove_all (priv->client_table);
+
+ if (priv->mini_calendar_config != NULL) {
+ g_object_unref (priv->mini_calendar_config);
+ priv->mini_calendar = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+cal_shell_sidebar_finalize (GObject *object)
+{
+ ECalShellSidebarPrivate *priv;
+
+ priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->client_table);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+cal_shell_sidebar_constructed (GObject *object)
+{
+ ECalShellSidebarPrivate *priv;
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellBackend *shell_backend;
+ EShellSidebar *shell_sidebar;
+ EShellSettings *shell_settings;
+ ESourceSelector *selector;
+ ESourceList *source_list;
+ ESource *source;
+ ECalendarItem *calitem;
+ GConfBridge *bridge;
+ GtkTreeModel *model;
+ GtkWidget *container;
+ GtkWidget *widget;
+ AtkObject *a11y;
+ GSList *list, *iter;
+ const gchar *key;
+ gchar *uid;
+
+ priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ shell_sidebar = E_SHELL_SIDEBAR (object);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ source_list = e_cal_shell_backend_get_source_list (
+ E_CAL_SHELL_BACKEND (shell_backend));
+
+ container = GTK_WIDGET (shell_sidebar);
+
+ widget = gtk_vpaned_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->paned = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_paned_add1 (GTK_PANED (container), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = e_calendar_selector_new (source_list);
+ e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ a11y = gtk_widget_get_accessible (widget);
+ atk_object_set_name (a11y, _("Calendar Selector"));
+ priv->selector = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = priv->paned;
+
+ widget = e_calendar_new ();
+ calitem = E_CALENDAR (widget)->calitem;
+ e_calendar_item_set_days_start_week_sel (calitem, 9);
+ e_calendar_item_set_max_days_sel (calitem, 42);
+ gtk_paned_add2 (GTK_PANED (container), widget);
+ priv->mini_calendar = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ priv->mini_calendar_config =
+ e_mini_calendar_config_new (E_CALENDAR (widget));
+
+ /* Restore the selector state from the last session. */
+
+ selector = E_SOURCE_SELECTOR (priv->selector);
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector));
+
+ g_signal_connect_swapped (
+ model, "row-changed",
+ G_CALLBACK (cal_shell_sidebar_row_changed_cb),
+ object);
+
+ source = NULL;
+ uid = e_shell_settings_get_string (
+ shell_settings, "cal-primary-calendar");
+ if (uid != NULL)
+ source = e_source_list_peek_source_by_uid (source_list, uid);
+ if (source == NULL)
+ source = e_source_list_peek_source_any (source_list);
+ if (source != NULL)
+ e_source_selector_set_primary_selection (selector, source);
+ g_free (uid);
+
+ list = calendar_config_get_calendars_selected ();
+ for (iter = list; iter != NULL; iter = iter->next) {
+ uid = iter->data;
+ source = e_source_list_peek_source_by_uid (source_list, uid);
+ g_free (uid);
+
+ if (source == NULL)
+ continue;
+
+ e_source_selector_select_source (selector, source);
+ }
+ g_slist_free (list);
+
+ /* Listen for subsequent changes to the selector. */
+
+ g_signal_connect_swapped (
+ selector, "selection-changed",
+ G_CALLBACK (cal_shell_sidebar_selection_changed_cb),
+ object);
+
+ g_signal_connect_swapped (
+ selector, "primary-selection-changed",
+ G_CALLBACK (cal_shell_sidebar_primary_selection_changed_cb),
+ object);
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (priv->paned);
+ key = "/apps/evolution/calendar/display/date_navigator_vpane_position";
+ gconf_bridge_bind_property_delayed (bridge, key, object, "position");
+}
+
+static void
+cal_shell_sidebar_client_removed (ECalShellSidebar *cal_shell_sidebar,
+ ECal *client)
+{
+ ESourceSelector *selector;
+ GHashTable *client_table;
+ ESource *source;
+ const gchar *uid;
+
+ client_table = cal_shell_sidebar->priv->client_table;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+
+ g_signal_handlers_disconnect_matched (
+ client, G_SIGNAL_MATCH_DATA, 0, 0,
+ NULL, NULL, cal_shell_sidebar);
+
+ source = e_cal_get_source (client);
+ e_source_selector_unselect_source (selector, source);
+
+ uid = e_source_peek_uid (source);
+ g_hash_table_remove (client_table, uid);
+
+ cal_shell_sidebar_emit_status_message (cal_shell_sidebar, NULL);
+}
+
+static void
+cal_shell_sidebar_class_init (ECalShellSidebarClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECalShellSidebarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = cal_shell_sidebar_get_property;
+ object_class->dispose = cal_shell_sidebar_dispose;
+ object_class->finalize = cal_shell_sidebar_finalize;
+ object_class->constructed = cal_shell_sidebar_constructed;
+
+ class->client_removed = cal_shell_sidebar_client_removed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MINI_CALENDAR,
+ g_param_spec_object (
+ "mini-calendar",
+ _("Mini-Calendar Widget"),
+ _("This widget displays a miniature calendar"),
+ E_TYPE_CALENDAR,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SELECTOR,
+ g_param_spec_object (
+ "selector",
+ _("Source Selector Widget"),
+ _("This widget displays groups of calendars"),
+ E_TYPE_SOURCE_SELECTOR,
+ G_PARAM_READABLE));
+
+ signals[CLIENT_ADDED] = g_signal_new (
+ "client-added",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECalShellSidebarClass, client_added),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_CAL);
+
+ signals[CLIENT_REMOVED] = g_signal_new (
+ "client-removed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECalShellSidebarClass, client_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_CAL);
+
+ signals[STATUS_MESSAGE] = g_signal_new (
+ "status-message",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ECalShellSidebarClass, status_message),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
+}
+
+static void
+cal_shell_sidebar_init (ECalShellSidebar *cal_shell_sidebar)
+{
+ GHashTable *client_table;
+
+ client_table = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_object_unref);
+
+ cal_shell_sidebar->priv =
+ E_CAL_SHELL_SIDEBAR_GET_PRIVATE (cal_shell_sidebar);
+
+ cal_shell_sidebar->priv->client_table = client_table;
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_cal_shell_sidebar_get_type (void)
+{
+ return cal_shell_sidebar_type;
+}
+
+void
+e_cal_shell_sidebar_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (ECalShellSidebarClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) cal_shell_sidebar_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ECalShellSidebar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) cal_shell_sidebar_init,
+ NULL /* value_table */
+ };
+
+ cal_shell_sidebar_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_SIDEBAR,
+ "ECalShellSidebar", &type_info, 0);
+}
+
+GtkWidget *
+e_cal_shell_sidebar_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_CAL_SHELL_SIDEBAR,
+ "shell-view", shell_view, NULL);
+}
+
+GList *
+e_cal_shell_sidebar_get_clients (ECalShellSidebar *cal_shell_sidebar)
+{
+ GHashTable *client_table;
+
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar), NULL);
+
+ client_table = cal_shell_sidebar->priv->client_table;
+
+ return g_hash_table_get_values (client_table);
+}
+
+ECalendar *
+e_cal_shell_sidebar_get_mini_calendar (ECalShellSidebar *cal_shell_sidebar)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar), NULL);
+
+ return E_CALENDAR (cal_shell_sidebar->priv->mini_calendar);
+}
+
+ESourceSelector *
+e_cal_shell_sidebar_get_selector (ECalShellSidebar *cal_shell_sidebar)
+{
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar), NULL);
+
+ return E_SOURCE_SELECTOR (cal_shell_sidebar->priv->selector);
+}
+
+void
+e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
+ ESource *source)
+{
+ ESourceSelector *selector;
+ GHashTable *client_table;
+ ECal *client;
+ const gchar *uid;
+ const gchar *uri;
+ gchar *message;
+
+ g_return_if_fail (E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar));
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ client_table = cal_shell_sidebar->priv->client_table;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+
+ uid = e_source_peek_uid (source);
+ client = g_hash_table_lookup (client_table, uid);
+
+ if (client != NULL)
+ return;
+
+ client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT);
+ g_return_if_fail (client != NULL);
+
+ g_signal_connect_swapped (
+ client, "backend-died",
+ G_CALLBACK (cal_shell_sidebar_backend_died_cb),
+ cal_shell_sidebar);
+
+ g_signal_connect_swapped (
+ client, "backend-error",
+ G_CALLBACK (cal_shell_sidebar_backend_error_cb),
+ cal_shell_sidebar);
+
+ g_hash_table_insert (client_table, g_strdup (uid), client);
+ e_source_selector_select_source (selector, source);
+
+ uri = e_cal_get_uri (client);
+ message = g_strdup_printf (_("Opening calendar at %s"), uri);
+ cal_shell_sidebar_emit_status_message (cal_shell_sidebar, message);
+ g_free (message);
+
+ g_signal_connect_swapped (
+ client, "cal-opened",
+ G_CALLBACK (cal_shell_sidebar_client_opened_cb),
+ cal_shell_sidebar);
+
+ e_cal_open_async (client, FALSE);
+}
+
+void
+e_cal_shell_sidebar_remove_source (ECalShellSidebar *cal_shell_sidebar,
+ ESource *source)
+{
+ ESourceSelector *selector;
+ GHashTable *client_table;
+ ECal *client;
+ const gchar *uid;
+
+ g_return_if_fail (E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar));
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ client_table = cal_shell_sidebar->priv->client_table;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+
+ uid = e_source_peek_uid (source);
+ client = g_hash_table_lookup (client_table, uid);
+
+ if (client == NULL)
+ return;
+
+ cal_shell_sidebar_emit_client_removed (cal_shell_sidebar, client);
+}
diff --git a/calendar/module/e-cal-shell-sidebar.h b/calendar/module/e-cal-shell-sidebar.h
new file mode 100644
index 0000000000..c555537abf
--- /dev/null
+++ b/calendar/module/e-cal-shell-sidebar.h
@@ -0,0 +1,101 @@
+/*
+ * e-cal-shell-sidebar.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_CAL_SHELL_SIDEBAR_H
+#define E_CAL_SHELL_SIDEBAR_H
+
+#include <libecal/e-cal.h>
+#include <libedataserverui/e-source-selector.h>
+
+#include <shell/e-shell-sidebar.h>
+#include <shell/e-shell-view.h>
+#include <misc/e-calendar.h>
+
+/* Standard GObject macros */
+#define E_TYPE_CAL_SHELL_SIDEBAR \
+ (e_cal_shell_sidebar_get_type ())
+#define E_CAL_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebar))
+#define E_CAL_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarClass))
+#define E_IS_CAL_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CAL_SHELL_SIDEBAR))
+#define E_IS_CAL_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CAL_SHELL_SIDEBAR))
+#define E_CAL_SHELL_SIDEBAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CAL_SHELL_SIDEBAR, ECalShellSidebarClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ECalShellSidebar ECalShellSidebar;
+typedef struct _ECalShellSidebarClass ECalShellSidebarClass;
+typedef struct _ECalShellSidebarPrivate ECalShellSidebarPrivate;
+
+enum {
+ E_CAL_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE = 1 << 0,
+ E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_EMPTY = 1 << 1,
+ E_CAL_SHELL_SIDEBAR_SOURCE_CAN_GO_OFFLINE = 1 << 2,
+ E_CAL_SHELL_SIDEBAR_SOURCE_CAN_DELETE = 1 << 3
+};
+
+struct _ECalShellSidebar {
+ EShellSidebar parent;
+ ECalShellSidebarPrivate *priv;
+};
+
+struct _ECalShellSidebarClass {
+ EShellSidebarClass parent_class;
+
+ /* Signals */
+ void (*client_added) (ECalShellSidebar *cal_shell_sidebar,
+ ECal *client);
+ void (*client_removed) (ECalShellSidebar *cal_shell_sidebar,
+ ECal *client);
+ void (*status_message) (ECalShellSidebar *cal_shell_sidebar,
+ const gchar *status_message);
+};
+
+GType e_cal_shell_sidebar_get_type (void);
+void e_cal_shell_sidebar_register_type
+ (GTypeModule *type_module);
+GtkWidget * e_cal_shell_sidebar_new (EShellView *shell_view);
+GList * e_cal_shell_sidebar_get_clients
+ (ECalShellSidebar *cal_shell_sidebar);
+ECalendar * e_cal_shell_sidebar_get_mini_calendar
+ (ECalShellSidebar *cal_shell_sidebar);
+ESourceSelector *
+ e_cal_shell_sidebar_get_selector
+ (ECalShellSidebar *cal_shell_sidebar);
+void e_cal_shell_sidebar_add_source
+ (ECalShellSidebar *cal_shell_sidebar,
+ ESource *source);
+void e_cal_shell_sidebar_remove_source
+ (ECalShellSidebar *cal_shell_sidebar,
+ ESource *source);
+
+G_END_DECLS
+
+#endif /* E_CAL_SHELL_SIDEBAR_H */
diff --git a/calendar/module/e-cal-shell-view-actions.c b/calendar/module/e-cal-shell-view-actions.c
new file mode 100644
index 0000000000..a5d0dd826b
--- /dev/null
+++ b/calendar/module/e-cal-shell-view-actions.c
@@ -0,0 +1,1173 @@
+/*
+ * e-cal-shell-view-actions.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-cal-shell-view-private.h"
+
+static void
+action_calendar_copy_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellSidebar *cal_shell_sidebar;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ ESourceSelector *selector;
+ ESource *source;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ copy_source_dialog (
+ GTK_WINDOW (shell_window),
+ source, E_CAL_SOURCE_TYPE_EVENT);
+}
+
+static void
+action_calendar_delete_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+#if 0
+ ECalShellContent *cal_shell_content;
+ ECalShellSidebar *cal_shell_sidebar;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ ECalendarView *calendar_view;
+ GnomeCalendarViewType view_type;
+ ECalModel *model;
+ ESourceSelector *selector;
+ ESourceGroup *source_group;
+ ESourceList *source_list;
+ ESource *source;
+ gint response;
+ gchar *uri;
+ GError *error = NULL;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_content = cal_shell_content->priv->cal_shell_content;
+ view_type = e_cal_shell_content_get_current_view (cal_shell_content);
+ calendar_view = e_cal_shell_content_get_calendar_view (
+ cal_shell_content, view_type);
+ model = e_calendar_view_get_model (calendar_view);
+
+ cal_shell_sidebar = cal_shell_sidebar->priv->cal_shell_sidebar;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ /* Ask for confirmation. */
+ response = e_error_run (
+ GTK_WINDOW (shell_window),
+ "calendar:prompt-delete-calendar",
+ e_source_peek_name (source));
+ if (response != GTK_RESPONSE_YES)
+ return;
+
+ uri = e_source_get_uri (source);
+ client = e_cal_model_get_client_for_uri (model, uri);
+ if (client == NULL)
+ client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_EVENT);
+ g_free (uri);
+
+ g_return_if_fail (client != NULL);
+
+ if (!e_cal_remove (client, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ if (e_source_selector_source_is_selected (selector, source)) {
+ e_cal_shell_sidebar_remove_source (
+ cal_shell_sidebar, source);
+ e_source_selector_unselect_source (selector, source);
+ }
+
+ source_group = e_source_peek_group (source);
+ e_source_group_remove_source (source_group, source);
+
+ source_list = cal_shell_view->priv->source_list;
+ if (!e_source_list_sync (source_list, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+#endif
+}
+
+static void
+action_calendar_go_back_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+#if 0
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+
+ gnome_calendar_previous (calendar);
+#endif
+}
+
+static void
+action_calendar_go_forward_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+#if 0
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+
+ gnome_calendar_next (calendar);
+#endif
+}
+
+static void
+action_calendar_go_today_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+#if 0
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+
+ gnome_calendar_goto_today (calendar);
+#endif
+}
+
+static void
+action_calendar_jump_to_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+#if 0
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+
+ goto_dialog (calendar);
+#endif
+}
+
+static void
+action_calendar_new_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+#if 0
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ calendar_setup_new_calendar (GTK_WINDOW (shell_window));
+#endif
+}
+
+static void
+action_calendar_print_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+#if 0
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+ GtkPrintOperationAction print_action;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+
+ if (gnome_calendar_get_view (calendar) == GNOME_CAL_LIST_VIEW) {
+ ECalListView *list_view;
+ GtkWidget *widget;
+ ETable *table;
+
+ widget = gnome_calendar_get_current_view_widget (calendar);
+ list_view = E_CAL_LIST_VIEW (widget);
+ table = e_table_scrolled_get_table (list_view->table_scrolled);
+ print_table (table, _("Print"), _("Calendar"), action);
+ } else {
+ time_t start;
+
+ gnome_calendar_get_current_time_range (calendar, &start, NULL);
+ print_calendar (calendar, action, start);
+ }
+#endif
+}
+
+static void
+action_calendar_print_preview_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+#if 0
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+ GtkPrintOperationAction print_action;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
+
+ if (gnome_calendar_get_view (calendar) == GNOME_CAL_LIST_VIEW) {
+ ECalListView *list_view;
+ GtkWidget *widget;
+ ETable *table;
+
+ widget = gnome_calendar_get_current_view_widget (calendar);
+ list_view = E_CAL_LIST_VIEW (widget);
+ table = e_table_scrolled_get_table (list_view->table_scrolled);
+ print_table (table, _("Print"), _("Calendar"), action);
+ } else {
+ time_t start;
+
+ gnome_calendar_get_current_time_range (calendar, &start, NULL);
+ print_calendar (calendar, action, start);
+ }
+#endif
+}
+
+static void
+action_calendar_properties_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+#if 0
+ ECalShellSidebar *cal_shell_sidebar;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESource *source;
+ ESourceSelector *selector;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ calendar_setup_edit_calendar (GTK_WINDOW (shell_window), source);
+#endif
+}
+
+static void
+action_calendar_purge_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_calendar_rename_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellSidebar *cal_shell_sidebar;
+ ESourceSelector *selector;
+
+ cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+
+ e_source_selector_edit_primary_selection (selector);
+}
+
+static void
+action_calendar_select_one_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellSidebar *cal_shell_sidebar;
+ ESourceSelector *selector;
+ ESource *primary;
+ GSList *list, *iter;
+
+ /* XXX ESourceSelector should provide a function for this. */
+
+ cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+ primary = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (primary != NULL);
+
+ list = e_source_selector_get_selection (selector);
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ESource *source = iter->data;
+
+ if (source == primary)
+ continue;
+
+ e_source_selector_unselect_source (selector, source);
+ }
+ e_source_selector_free_selection (list);
+
+ e_source_selector_select_source (selector, primary);
+}
+
+static void
+action_calendar_view_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ ECalShellView *cal_shell_view)
+{
+ EShellView *shell_view;
+ GnomeCalendarViewType view_type;
+ const gchar *view_id;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ view_type = gtk_radio_action_get_current_value (action);
+
+ switch (view_type) {
+ case GNOME_CAL_DAY_VIEW:
+ view_id = "Day_View";
+ break;
+
+ case GNOME_CAL_WORK_WEEK_VIEW:
+ view_id = "Work_Week_View";
+ break;
+
+ case GNOME_CAL_WEEK_VIEW:
+ view_id = "Week_View";
+ break;
+
+ case GNOME_CAL_MONTH_VIEW:
+ view_id = "Month_View";
+ break;
+
+ case GNOME_CAL_LIST_VIEW:
+ view_id = "List_View";
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+
+ e_shell_view_set_view_id (shell_view, view_id);
+}
+
+static void
+action_event_all_day_new_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_clipboard_copy_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ e_cal_shell_content_copy_clipboard (cal_shell_content);
+}
+
+static void
+action_event_clipboard_cut_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ e_cal_shell_content_cut_clipboard (cal_shell_content);
+}
+
+static void
+action_event_clipboard_paste_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ e_cal_shell_content_paste_clipboard (cal_shell_content);
+}
+
+static void
+action_event_copy_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_delegate_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_delete_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ e_cal_shell_content_delete_selection (cal_shell_content);
+}
+
+static void
+action_event_delete_occurrence_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ e_cal_shell_content_delete_selected_occurrence (cal_shell_content);
+}
+
+static void
+action_event_delete_occurrence_all_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+
+ /* XXX Same as "event-delete". */
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ e_cal_shell_content_delete_selection (cal_shell_content);
+}
+
+static void
+action_event_forward_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_meeting_new_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_move_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_new_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_occurrence_movable_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_open_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+#if 0
+ ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+ GtkWidget *widget;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ widget = gnome_calendar_get_current_view_widget (calendar);
+
+ e_calendar_view_open_event (E_CALENDAR_VIEW (widget));
+#endif
+}
+
+static void
+action_event_print_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_reply_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_reply_all_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_save_as_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_event_schedule_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+static void
+action_gal_save_custom_view_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EShellView *shell_view;
+ GalViewInstance *view_instance;
+
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with saving the custom view. */
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ view_instance = e_cal_shell_content_get_view_instance (cal_shell_content);
+ gal_view_instance_save_as (view_instance);
+}
+
+static void
+action_search_execute_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ EShellView *shell_view;
+
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with executing the search. */
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ e_cal_shell_view_execute_search (cal_shell_view);
+}
+
+static void
+action_search_filter_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ ECalShellView *cal_shell_view)
+{
+ e_cal_shell_view_execute_search (cal_shell_view);
+}
+
+static GtkActionEntry calendar_entries[] = {
+
+ { "calendar-copy",
+ GTK_STOCK_COPY,
+ N_("_Copy..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_copy_cb) },
+
+ { "calendar-delete",
+ GTK_STOCK_DELETE,
+ NULL,
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_delete_cb) },
+
+ { "calendar-go-back",
+ GTK_STOCK_GO_BACK,
+ N_("Previous"),
+ NULL,
+ N_("Go Back"),
+ G_CALLBACK (action_calendar_go_back_cb) },
+
+ { "calendar-go-forward",
+ GTK_STOCK_GO_FORWARD,
+ N_("Next"),
+ NULL,
+ N_("Go Forward"),
+ G_CALLBACK (action_calendar_go_forward_cb) },
+
+ { "calendar-go-today",
+ "go-today",
+ N_("Select _Today"),
+ "<Control>t",
+ N_("Select today"),
+ G_CALLBACK (action_calendar_go_today_cb) },
+
+ { "calendar-jump-to",
+ GTK_STOCK_JUMP_TO,
+ N_("Select _Date"),
+ "<Control>g",
+ N_("Select a specific date"),
+ G_CALLBACK (action_calendar_jump_to_cb) },
+
+ { "calendar-new",
+ "x-office-calendar",
+ N_("_New Calendar"),
+ NULL,
+ N_("Create a new calendar"),
+ G_CALLBACK (action_calendar_new_cb) },
+
+ { "calendar-properties",
+ GTK_STOCK_PROPERTIES,
+ NULL,
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_properties_cb) },
+
+ { "calendar-purge",
+ NULL,
+ N_("Purg_e"),
+ "<Control>e",
+ N_("Purge old appointments and meetings"),
+ G_CALLBACK (action_calendar_purge_cb) },
+
+ { "calendar-rename",
+ NULL,
+ N_("_Rename..."),
+ "F2",
+ N_("Rename the selected calendar"),
+ G_CALLBACK (action_calendar_rename_cb) },
+
+ { "calendar-select-one",
+ "stock_check-filled",
+ N_("Show _Only This Calendar"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_select_one_cb) },
+
+ { "event-clipboard-copy",
+ GTK_STOCK_COPY,
+ NULL,
+ NULL,
+ N_("Copy the selection"),
+ G_CALLBACK (action_event_clipboard_copy_cb) },
+
+ { "event-clipboard-cut",
+ GTK_STOCK_CUT,
+ NULL,
+ NULL,
+ N_("Cut the selection"),
+ G_CALLBACK (action_event_clipboard_cut_cb) },
+
+ { "event-clipboard-paste",
+ GTK_STOCK_PASTE,
+ NULL,
+ NULL,
+ N_("Paste the clipboard"),
+ G_CALLBACK (action_event_clipboard_paste_cb) },
+
+ { "event-copy",
+ NULL,
+ N_("Cop_y to Calendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_copy_cb) },
+
+ { "event-delegate",
+ NULL,
+ N_("_Delegate Meeting..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_delegate_cb) },
+
+ { "event-delete",
+ GTK_STOCK_DELETE,
+ NULL,
+ NULL,
+ N_("Delete the appointment"),
+ G_CALLBACK (action_event_delete_cb) },
+
+ { "event-delete-occurrence",
+ GTK_STOCK_DELETE,
+ N_("Delete This _Occurrence"),
+ NULL,
+ N_("Delete this occurrence"),
+ G_CALLBACK (action_event_delete_occurrence_cb) },
+
+ { "event-delete-occurrence-all",
+ GTK_STOCK_DELETE,
+ N_("Delete _All Occurrences"),
+ NULL,
+ N_("Delete all occurrences"),
+ G_CALLBACK (action_event_delete_occurrence_all_cb) },
+
+ { "event-all-day-new",
+ NULL,
+ N_("New All Day _Event..."),
+ NULL,
+ N_("Create a new all day event"),
+ G_CALLBACK (action_event_all_day_new_cb) },
+
+ { "event-forward",
+ "mail-forward",
+ N_("_Forward as iCalendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_forward_cb) },
+
+ { "event-meeting-new",
+ NULL,
+ N_("New _Meeting..."),
+ NULL,
+ N_("Create a new meeting"),
+ G_CALLBACK (action_event_meeting_new_cb) },
+
+ { "event-move",
+ NULL,
+ N_("Mo_ve to Calendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_move_cb) },
+
+ { "event-new",
+ NULL,
+ N_("New _Appointment..."),
+ NULL,
+ N_("Create a new appointment"),
+ G_CALLBACK (action_event_new_cb) },
+
+ { "event-occurrence-movable",
+ NULL,
+ N_("Make this Occurrence _Movable"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_occurrence_movable_cb) },
+
+ { "event-open",
+ NULL,
+ N_("_Open Appointment"),
+ "<Control>o",
+ N_("View the current appointment"),
+ G_CALLBACK (action_event_open_cb) },
+
+ { "event-reply",
+ "mail-reply-sender",
+ N_("_Reply"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_reply_cb) },
+
+ { "event-reply-all",
+ "mail-reply-all",
+ N_("Reply to _All"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_reply_all_cb) },
+
+ { "event-save-as",
+ GTK_STOCK_SAVE_AS,
+ NULL,
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_save_as_cb) },
+
+ { "event-schedule",
+ NULL,
+ N_("_Schedule Meeting..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_schedule_cb) },
+
+ /*** Menus ***/
+
+ { "calendar-actions-menu",
+ NULL,
+ N_("_Actions"),
+ NULL,
+ NULL,
+ NULL }
+};
+
+static EPopupActionEntry calendar_popup_entries[] = {
+
+ /* FIXME No equivalent main menu items for the any of the calendar
+ * popup menu items and for many of the event popup menu items.
+ * This is an accessibility issue. */
+
+ { "calendar-popup-copy",
+ NULL,
+ "calendar-copy" },
+
+ { "calendar-popup-delete",
+ NULL,
+ "calendar-delete" },
+
+ { "calendar-popup-go-today",
+ NULL,
+ "calendar-go-today" },
+
+ { "calendar-popup-jump-to",
+ NULL,
+ "calendar-jump-to" },
+
+ { "calendar-popup-properties",
+ NULL,
+ "calendar-properties" },
+
+ { "calendar-popup-rename",
+ NULL,
+ "calendar-rename" },
+
+ { "calendar-popup-select-one",
+ NULL,
+ "calendar-select-one" },
+
+ { "event-popup-clipboard-copy",
+ NULL,
+ "event-clipboard-copy" },
+
+ { "event-popup-clipboard-cut",
+ NULL,
+ "event-clipboard-cut" },
+
+ { "event-popup-clipboard-paste",
+ NULL,
+ "event-clipboard-paste" },
+
+ { "event-popup-copy",
+ NULL,
+ "event-copy" },
+
+ { "event-popup-delegate",
+ NULL,
+ "event-delegate" },
+
+ { "event-popup-delete",
+ NULL,
+ "event-delete" },
+
+ { "event-popup-delete-occurrence",
+ NULL,
+ "event-delete-occurrence" },
+
+ { "event-popup-delete-occurrence-all",
+ NULL,
+ "event-delete-occurrence-all" },
+
+ { "event-popup-forward",
+ NULL,
+ "event-forward" },
+
+ { "event-popup-move",
+ NULL,
+ "event-move" },
+
+ { "event-popup-occurrence-movable",
+ NULL,
+ "event-occurrence-movable" },
+
+ { "event-popup-open",
+ NULL,
+ "event-open" },
+
+ { "event-popup-reply",
+ NULL,
+ "event-reply" },
+
+ { "event-popup-reply-all",
+ NULL,
+ "event-reply-all" },
+
+ { "event-popup-save-as",
+ NULL,
+ "event-save-as" },
+
+ { "event-popup-schedule",
+ NULL,
+ "event-schedule" }
+};
+
+static GtkRadioActionEntry calendar_view_entries[] = {
+
+ { "calendar-view-day",
+ "view-calendar-day",
+ N_("Day"),
+ NULL,
+ N_("Show one day"),
+ GNOME_CAL_DAY_VIEW },
+
+ { "calendar-view-list",
+ "view-calendar-list",
+ N_("List"),
+ NULL,
+ N_("Show as list"),
+ GNOME_CAL_LIST_VIEW },
+
+ { "calendar-view-month",
+ "view-calendar-month",
+ N_("Month"),
+ NULL,
+ N_("Show one month"),
+ GNOME_CAL_MONTH_VIEW },
+
+ { "calendar-view-week",
+ "view-calendar-week",
+ N_("Week"),
+ NULL,
+ N_("Show one week"),
+ GNOME_CAL_WEEK_VIEW },
+
+ { "calendar-view-workweek",
+ "view-calendar-workweek",
+ N_("Work Week"),
+ NULL,
+ N_("Show one work week"),
+ GNOME_CAL_WORK_WEEK_VIEW }
+};
+
+static GtkRadioActionEntry calendar_filter_entries[] = {
+
+ { "calendar-filter-active-appointments",
+ NULL,
+ N_("Active Appointements"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_FILTER_ACTIVE_APPOINTMENTS },
+
+ { "calendar-filter-any-category",
+ NULL,
+ N_("Any Category"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_FILTER_ANY_CATEGORY },
+
+ { "calendar-filter-next-7-days-appointments",
+ NULL,
+ N_("Next 7 Days' Appointments"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS },
+
+ { "calendar-filter-unmatched",
+ NULL,
+ N_("Unmatched"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_FILTER_UNMATCHED }
+};
+
+static GtkRadioActionEntry calendar_search_entries[] = {
+
+ { "calendar-search-any-field-contains",
+ NULL,
+ N_("Any field contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_SEARCH_ANY_FIELD_CONTAINS },
+
+ { "calendar-search-description-contains",
+ NULL,
+ N_("Description contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_SEARCH_DESCRIPTION_CONTAINS },
+
+ { "calendar-search-summary-contains",
+ NULL,
+ N_("Summary contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ CALENDAR_SEARCH_SUMMARY_CONTAINS }
+};
+
+static GtkActionEntry lockdown_printing_entries[] = {
+
+ { "calendar-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ "<Control>p",
+ N_("Print this calendar"),
+ G_CALLBACK (action_calendar_print_cb) },
+
+ { "calendar-print-preview",
+ GTK_STOCK_PRINT_PREVIEW,
+ NULL,
+ NULL,
+ N_("Preview the calendar to be printed"),
+ G_CALLBACK (action_calendar_print_preview_cb) },
+
+ { "event-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_event_print_cb) }
+};
+
+static EPopupActionEntry lockdown_printing_popup_entries[] = {
+
+ { "event-popup-print",
+ NULL,
+ "event-print" }
+};
+
+void
+e_cal_shell_view_actions_init (ECalShellView *cal_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+ GtkAction *action;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ /* Calendar Actions */
+ action_group = ACTION_GROUP (CALENDAR);
+ gtk_action_group_add_actions (
+ action_group, calendar_entries,
+ G_N_ELEMENTS (calendar_entries), cal_shell_view);
+ e_action_group_add_popup_actions (
+ action_group, calendar_popup_entries,
+ G_N_ELEMENTS (calendar_popup_entries));
+ gtk_action_group_add_radio_actions (
+ action_group, calendar_view_entries,
+ G_N_ELEMENTS (calendar_view_entries), GNOME_CAL_DAY_VIEW,
+ G_CALLBACK (action_calendar_view_cb), cal_shell_view);
+ gtk_action_group_add_radio_actions (
+ action_group, calendar_search_entries,
+ G_N_ELEMENTS (calendar_search_entries),
+ CALENDAR_SEARCH_SUMMARY_CONTAINS,
+ NULL, NULL);
+
+ /* Lockdown Printing Actions */
+ action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
+ gtk_action_group_add_actions (
+ action_group, lockdown_printing_entries,
+ G_N_ELEMENTS (lockdown_printing_entries), cal_shell_view);
+ e_action_group_add_popup_actions (
+ action_group, lockdown_printing_popup_entries,
+ G_N_ELEMENTS (lockdown_printing_popup_entries));
+
+ /* Fine tuning. */
+
+ action = ACTION (CALENDAR_GO_TODAY);
+ g_object_set (action, "short-label", _("Today"), NULL);
+
+ action = ACTION (CALENDAR_JUMP_TO);
+ g_object_set (action, "short-label", _("Go To"), NULL);
+
+ action = ACTION (EVENT_DELETE);
+ g_object_set (action, "short-label", _("Delete"), NULL);
+
+ g_signal_connect (
+ ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
+ G_CALLBACK (action_gal_save_custom_view_cb), cal_shell_view);
+
+ g_signal_connect (
+ ACTION (SEARCH_EXECUTE), "activate",
+ G_CALLBACK (action_search_execute_cb), cal_shell_view);
+
+ /* Initialize the memo and task pad actions. */
+ e_cal_shell_view_memopad_actions_init (cal_shell_view);
+ e_cal_shell_view_taskpad_actions_init (cal_shell_view);
+}
+
+void
+e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view)
+{
+ EShellContent *shell_content;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ GtkActionGroup *action_group;
+ GtkRadioAction *radio_action;
+ GList *list, *iter;
+ GSList *group;
+ gint ii;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ action_group = ACTION_GROUP (CALENDAR_FILTER);
+ e_action_group_remove_all_actions (action_group);
+
+ /* Add the standard filter actions. */
+ gtk_action_group_add_radio_actions (
+ action_group, calendar_filter_entries,
+ G_N_ELEMENTS (calendar_filter_entries),
+ CALENDAR_FILTER_ANY_CATEGORY,
+ G_CALLBACK (action_search_filter_cb),
+ cal_shell_view);
+
+ /* Retrieve the radio group from an action we just added. */
+ list = gtk_action_group_list_actions (action_group);
+ radio_action = GTK_RADIO_ACTION (list->data);
+ group = gtk_radio_action_get_group (radio_action);
+ g_list_free (list);
+
+ /* Build the category actions. */
+
+ list = e_categories_get_list ();
+ for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
+ const gchar *category_name = iter->data;
+ const gchar *filename;
+ GtkAction *action;
+ gchar *action_name;
+
+ action_name = g_strdup_printf (
+ "calendar-filter-category-%d", ii);
+ radio_action = gtk_radio_action_new (
+ action_name, category_name, NULL, NULL, ii);
+ g_free (action_name);
+
+ /* Convert the category icon file to a themed icon name. */
+ filename = e_categories_get_icon_file_for (category_name);
+ if (filename != NULL && *filename != '\0') {
+ gchar *basename;
+ gchar *cp;
+
+ basename = g_path_get_basename (filename);
+
+ /* Lose the file extension. */
+ if ((cp = strrchr (basename, '.')) != NULL)
+ *cp = '\0';
+
+ g_object_set (
+ radio_action, "icon-name", basename, NULL);
+
+ g_free (basename);
+ }
+
+ gtk_radio_action_set_group (radio_action, group);
+ group = gtk_radio_action_get_group (radio_action);
+
+ /* The action group takes ownership of the action. */
+ action = GTK_ACTION (radio_action);
+ gtk_action_group_add_action (action_group, action);
+ g_object_unref (radio_action);
+ }
+ g_list_free (list);
+
+ /* Use any action in the group; doesn't matter which. */
+ e_shell_content_set_filter_action (shell_content, radio_action);
+
+ ii = CALENDAR_FILTER_UNMATCHED;
+ e_shell_content_add_filter_separator_after (shell_content, ii);
+
+ ii = CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS;
+ e_shell_content_add_filter_separator_after (shell_content, ii);
+}
diff --git a/calendar/module/e-cal-shell-view-actions.h b/calendar/module/e-cal-shell-view-actions.h
new file mode 100644
index 0000000000..b02906f179
--- /dev/null
+++ b/calendar/module/e-cal-shell-view-actions.h
@@ -0,0 +1,153 @@
+/*
+ * e-cal-shell-view-actions.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_CAL_SHELL_VIEW_ACTIONS_H
+#define E_CAL_SHELL_VIEW_ACTIONS_H
+
+#include <shell/e-shell-window-actions.h>
+
+/* Calendar Actions */
+#define E_SHELL_WINDOW_ACTION_CALENDAR_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-copy")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-delete")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_GO_BACK(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-go-back")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_GO_FORWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-go-forward")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_GO_TODAY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-go-today")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_JUMP_TO(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-jump-to")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-new")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_PRINT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-print")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_PRINT_PREVIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-print-preview")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_PROPERTIES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-properties")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_PURGE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-purge")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_RENAME(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-rename")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_SELECT_ONE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-select-one")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_VIEW_DAY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-view-day")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_VIEW_LIST(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-view-list")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_VIEW_MONTH(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-view-month")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_VIEW_WEEK(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-view-week")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_VIEW_WORKWEEK(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-view-workweek")
+
+/* Event Actions */
+#define E_SHELL_WINDOW_ACTION_EVENT_CLIPBOARD_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "event-clipboard-copy")
+#define E_SHELL_WINDOW_ACTION_EVENT_CLIPBOARD_CUT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "event-clipboard-cut")
+#define E_SHELL_WINDOW_ACTION_EVENT_CLIPBOARD_PASTE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "event-clipboard-paste")
+#define E_SHELL_WINDOW_ACTION_EVENT_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "event-delete")
+#define E_SHELL_WINDOW_ACTION_EVENT_DELETE_OCCURRENCE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "event-delete-occurrence")
+#define E_SHELL_WINDOW_ACTION_EVENT_DELETE_OCCURRENCE_ALL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "event-delete-occurrence-all")
+#define E_SHELL_WINDOW_ACTION_EVENT_OPEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "event-open")
+
+/* Memo Pad Actions */
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_CLIPBOARD_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-clipboard-copy")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_CLIPBOARD_CUT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-clipboard-cut")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_CLIPBOARD_PASTE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-clipboard-paste")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-delete")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_FORWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-forward")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-new")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_OPEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-open")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_OPEN_URL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-open-url")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_PRINT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-print")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_SAVE_AS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-save-as")
+
+/* Task Pad Actions */
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_ASSIGN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-assign")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_CLIPBOARD_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-clipboard-copy")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_CLIPBOARD_CUT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-clipboard-cut")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_CLIPBOARD_PASTE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-clipboard-paste")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-delete")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_FORWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-forward")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_MARK_COMPLETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-mark-complete")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_MARK_INCOMPLETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-mark-incomplete")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-new")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_OPEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-open")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_OPEN_URL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-open-url")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_PRINT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-print")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_SAVE_AS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-save-as")
+
+/* Calendar Query Actions */
+#define E_SHELL_WINDOW_ACTION_CALENDAR_FILTER_ACTIVE_APPOINTMENTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-filter-active-appointments")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_FILTER_ANY_CATEGORY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-filter-any-category")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-filter-next-7-days-appointments")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_FILTER_UNMATCHED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-filter-unmatched")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_SEARCH_ANY_FIELD_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-search-any-field-contains")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_SEARCH_DESCRIPTION_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-search-description-contains")
+#define E_SHELL_WINDOW_ACTION_CALENDAR_SEARCH_SUMMARY_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "calendar-search-summary-contains")
+
+/* Action Groups */
+#define E_SHELL_WINDOW_ACTION_GROUP_CALENDAR(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "calendar")
+#define E_SHELL_WINDOW_ACTION_GROUP_CALENDAR_FILTER(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "calendar-filter")
+
+#endif /* E_CAL_SHELL_VIEW_ACTIONS_H */
diff --git a/calendar/module/e-cal-shell-view-memopad.c b/calendar/module/e-cal-shell-view-memopad.c
new file mode 100644
index 0000000000..ecee72d8b5
--- /dev/null
+++ b/calendar/module/e-cal-shell-view-memopad.c
@@ -0,0 +1,526 @@
+/*
+ * e-cal-shell-view-memopad.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-cal-shell-view-private.h"
+
+/* Much of this file is based on e-memo-shell-view-actions.c. */
+
+static void
+action_calendar_memopad_clipboard_copy_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ e_memo_table_copy_clipboard (memo_table);
+}
+
+static void
+action_calendar_memopad_clipboard_cut_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ e_memo_table_cut_clipboard (memo_table);
+}
+
+static void
+action_calendar_memopad_clipboard_paste_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ e_memo_table_paste_clipboard (memo_table);
+}
+
+static void
+action_calendar_memopad_delete_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ e_cal_shell_view_memopad_set_status_message (
+ cal_shell_view, _("Deleting selected memos..."), -1.0);
+ e_memo_table_delete_selected (memo_table);
+ e_cal_shell_view_memopad_set_status_message (
+ cal_shell_view, NULL, -1.0);
+}
+
+static void
+action_calendar_memopad_forward_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only forward the first selected memo. */
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_component_set_icalcomponent (comp, clone);
+ itip_send_comp (
+ E_CAL_COMPONENT_METHOD_PUBLISH, comp,
+ comp_data->client, NULL, NULL, NULL, TRUE);
+ g_object_unref (comp);
+}
+
+static void
+action_calendar_memopad_new_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ ECal *client;
+ ECalComponent *comp;
+ CompEditor *editor;
+ GSList *list;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ client = comp_data->client;
+ editor = memo_editor_new (client, shell, COMP_EDITOR_NEW_ITEM);
+ comp = cal_comp_memo_new_with_defaults (client);
+ comp_editor_edit_comp (editor, comp);
+
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (comp);
+ g_object_unref (client);
+}
+
+static void
+action_calendar_memopad_open_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only open the first selected memo. */
+ e_cal_shell_view_memopad_open_memo (cal_shell_view, comp_data);
+}
+
+static void
+action_calendar_memopad_open_url_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ icalproperty *prop;
+ const gchar *uri;
+ GSList *list;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only open the URI of the first selected memo. */
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ g_return_if_fail (prop == NULL);
+
+ uri = icalproperty_get_url (prop);
+ e_show_uri (GTK_WINDOW (shell_window), uri);
+}
+
+static void
+action_calendar_memopad_print_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ GtkPrintOperationAction print_action;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only print the first selected memo. */
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+ e_cal_component_set_icalcomponent (comp, clone);
+ print_comp (comp, comp_data->client, print_action);
+ g_object_unref (comp);
+}
+
+static void
+action_calendar_memopad_save_as_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+ gchar *filename;
+ gchar *string;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ filename = e_file_dialog_save (_("Save as..."), NULL);
+ if (filename == NULL)
+ return;
+
+ /* XXX We only save the first selected memo. */
+ string = e_cal_get_component_as_string (
+ comp_data->client, comp_data->icalcomp);
+ if (string == NULL) {
+ g_warning ("Could not convert memo to a string.");
+ return;
+ }
+
+ e_write_file_uri (filename, string);
+
+ g_free (filename);
+ g_free (string);
+}
+
+static GtkActionEntry calendar_memopad_entries[] = {
+
+ { "calendar-memopad-clipboard-copy",
+ GTK_STOCK_COPY,
+ NULL,
+ NULL,
+ N_("Copy selected memo"),
+ G_CALLBACK (action_calendar_memopad_clipboard_copy_cb) },
+
+ { "calendar-memopad-clipboard-cut",
+ GTK_STOCK_CUT,
+ NULL,
+ NULL,
+ N_("Cut selected memo"),
+ G_CALLBACK (action_calendar_memopad_clipboard_cut_cb) },
+
+ { "calendar-memopad-clipboard-paste",
+ GTK_STOCK_PASTE,
+ NULL,
+ NULL,
+ N_("Paste memo from the clipboard"),
+ G_CALLBACK (action_calendar_memopad_clipboard_paste_cb) },
+
+ { "calendar-memopad-delete",
+ GTK_STOCK_DELETE,
+ N_("_Delete Memo"),
+ NULL,
+ N_("Delete selected memos"),
+ G_CALLBACK (action_calendar_memopad_delete_cb) },
+
+ { "calendar-memopad-forward",
+ "mail-forward",
+ N_("_Forward as iCalendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_memopad_forward_cb) },
+
+ { "calendar-memopad-new",
+ "stock_insert-note",
+ N_("New _Memo"),
+ NULL,
+ N_("Create a new memo"),
+ G_CALLBACK (action_calendar_memopad_new_cb) },
+
+ { "calendar-memopad-open",
+ GTK_STOCK_OPEN,
+ N_("_Open Memo"),
+ NULL,
+ N_("View the selected memo"),
+ G_CALLBACK (action_calendar_memopad_open_cb) },
+
+ { "calendar-memopad-open-url",
+ "applications-internet",
+ N_("Open _Web Page"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_memopad_open_url_cb) },
+
+ { "calendar-memopad-save-as",
+ GTK_STOCK_SAVE_AS,
+ NULL,
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_memopad_save_as_cb) }
+};
+
+static GtkActionEntry lockdown_printing_entries[] = {
+
+ { "calendar-memopad-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ NULL,
+ N_("Print the selected memo"),
+ G_CALLBACK (action_calendar_memopad_print_cb) }
+};
+
+void
+e_cal_shell_view_memopad_actions_init (ECalShellView *cal_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ /* Calendar Actions */
+ action_group = ACTION_GROUP (CALENDAR);
+ gtk_action_group_add_actions (
+ action_group, calendar_memopad_entries,
+ G_N_ELEMENTS (calendar_memopad_entries), cal_shell_view);
+
+ /* Lockdown Printing Actions */
+ action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
+ gtk_action_group_add_actions (
+ action_group, lockdown_printing_entries,
+ G_N_ELEMENTS (lockdown_printing_entries), cal_shell_view);
+}
+
+void
+e_cal_shell_view_memopad_actions_update (ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ EMemoTable *memo_table;
+ ETable *table;
+ GtkAction *action;
+ GSList *list, *iter;
+ const gchar *label;
+ gboolean editable = TRUE;
+ gboolean has_url = FALSE;
+ gboolean sensitive;
+ gint n_selected;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+
+ table = e_memo_table_get_table (memo_table);
+ n_selected = e_table_selected_count (table);
+
+ list = e_memo_table_get_selected (memo_table);
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ icalproperty *prop;
+ gboolean read_only;
+
+ e_cal_is_read_only (comp_data->client, &read_only, NULL);
+ editable &= !read_only;
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ has_url |= (prop != NULL);
+ }
+ g_slist_free (list);
+
+ action = ACTION (CALENDAR_MEMOPAD_CLIPBOARD_COPY);
+ sensitive = (n_selected > 0);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_CLIPBOARD_CUT);
+ sensitive = (n_selected > 0) && editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_CLIPBOARD_PASTE);
+ sensitive = editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_DELETE);
+ sensitive = (n_selected > 0) && editable;
+ gtk_action_set_sensitive (action, sensitive);
+ label = ngettext ("Delete Memo", "Delete Memos", n_selected);
+ g_object_set (action, "label", label, NULL);
+
+ action = ACTION (CALENDAR_MEMOPAD_FORWARD);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_OPEN);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_OPEN_URL);
+ sensitive = (n_selected == 1) && has_url;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_PRINT);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_MEMOPAD_SAVE_AS);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+}
+
+void
+e_cal_shell_view_memopad_open_memo (ECalShellView *cal_shell_view,
+ ECalModelComponent *comp_data)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ const gchar *uid;
+
+ g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view));
+ g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data));
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ editor = comp_editor_find_instance (uid);
+
+ if (editor != NULL)
+ goto exit;
+
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_component_set_icalcomponent (comp, clone);
+
+ if (e_cal_component_has_organizer (comp))
+ flags |= COMP_EDITOR_IS_SHARED;
+
+ if (itip_organizer_is_user (comp, comp_data->client))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ editor = memo_editor_new (comp_data->client, shell, flags);
+ comp_editor_edit_comp (editor, comp);
+
+ g_object_unref (comp);
+
+exit:
+ gtk_window_present (GTK_WINDOW (editor));
+}
+
+void
+e_cal_shell_view_memopad_set_status_message (ECalShellView *cal_shell_view,
+ const gchar *status_message,
+ gdouble percent)
+{
+ EActivity *activity;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+
+ g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view));
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ activity = cal_shell_view->priv->memopad_activity;
+
+ if (status_message == NULL || *status_message == '\0') {
+ if (activity != NULL) {
+ e_activity_complete (activity);
+ g_object_unref (activity);
+ activity = NULL;
+ }
+
+ } else if (activity == NULL) {
+ activity = e_activity_new (status_message);
+ e_activity_set_percent (activity, percent);
+ e_shell_backend_add_activity (shell_backend, activity);
+
+ } else {
+ e_activity_set_percent (activity, percent);
+ e_activity_set_primary_text (activity, status_message);
+ }
+
+ cal_shell_view->priv->memopad_activity = activity;
+}
diff --git a/calendar/module/e-cal-shell-view-private.c b/calendar/module/e-cal-shell-view-private.c
new file mode 100644
index 0000000000..f681a2c2f3
--- /dev/null
+++ b/calendar/module/e-cal-shell-view-private.c
@@ -0,0 +1,650 @@
+/*
+ * e-cal-shell-view-private.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-cal-shell-view-private.h"
+
+#include "calendar/gui/calendar-view-factory.h"
+#include "widgets/menus/gal-view-factory-etable.h"
+
+static void
+cal_shell_view_process_completed_tasks (ECalShellView *cal_shell_view,
+ gboolean config_changed)
+{
+#if 0
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ e_calendar_table_process_completed_tasks (
+ task_table, clients, config_changed);
+#endif
+}
+
+static void
+cal_shell_view_config_timezone_changed_cb (GConfClient *client,
+ guint id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ ECalShellView *cal_shell_view = user_data;
+
+ e_cal_shell_view_update_timezone (cal_shell_view);
+}
+
+static struct tm
+cal_shell_view_get_current_time (ECalendarItem *calitem,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ struct icaltimetype tt;
+ icaltimezone *timezone;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ timezone = e_cal_shell_content_get_timezone (cal_shell_content);
+
+ tt = icaltime_from_timet_with_zone (time (NULL), FALSE, timezone);
+
+ return icaltimetype_to_tm (&tt);
+}
+
+static void
+cal_shell_view_mini_calendar_date_range_changed_cb (ECalShellView *cal_shell_view,
+ ECalendarItem *calitem)
+{
+ /* FIXME gnome-calendar.c calls update_query() here. */
+}
+
+static void
+cal_shell_view_mini_calendar_selection_changed_cb (ECalShellView *cal_shell_view,
+ ECalendarItem *calitem)
+{
+ /* FIXME */
+}
+
+static void
+cal_shell_view_mini_calendar_scroll_event_cb (ECalShellView *cal_shell_view,
+ GdkEventScroll *event,
+ ECalendar *mini_calendar)
+{
+ ECalendarItem *calitem;
+ GDate start_date, end_date;
+
+ calitem = mini_calendar->calitem;
+ if (!e_calendar_item_get_selection (calitem, &start_date, &end_date))
+ return;
+
+ switch (event->direction) {
+ case GDK_SCROLL_UP:
+ g_date_subtract_months (&start_date, 1);
+ g_date_subtract_months (&end_date, 1);
+ break;
+
+ case GDK_SCROLL_DOWN:
+ g_date_add_months (&start_date, 1);
+ g_date_add_months (&end_date, 1);
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+
+ /* XXX Does ECalendarItem emit a signal for this? If so, maybe
+ * we could move this handler into ECalShellSidebar. */
+ e_calendar_item_set_selection (calitem, &start_date, &end_date);
+
+ cal_shell_view_mini_calendar_date_range_changed_cb (
+ cal_shell_view, calitem);
+}
+
+static gboolean
+cal_shell_view_selector_popup_event_cb (EShellView *shell_view,
+ ESource *primary_source,
+ GdkEventButton *event)
+{
+ const gchar *widget_path;
+
+ widget_path = "/calendar-popup";
+ e_shell_view_show_popup_menu (shell_view, widget_path, event);
+
+ return TRUE;
+}
+
+static void
+cal_shell_view_memopad_popup_event_cb (EShellView *shell_view,
+ GdkEventButton *event)
+{
+ const gchar *widget_path;
+
+ widget_path = "/calendar-memopad-popup";
+ e_shell_view_show_popup_menu (shell_view, widget_path, event);
+}
+
+static void
+cal_shell_view_taskpad_popup_event_cb (EShellView *shell_view,
+ GdkEventButton *event)
+{
+ const gchar *widget_path;
+
+ widget_path = "/calendar-taskpad-popup";
+ e_shell_view_show_popup_menu (shell_view, widget_path, event);
+}
+
+static void
+cal_shell_view_load_view_collection (EShellViewClass *shell_view_class)
+{
+ GalViewCollection *collection;
+ GalViewFactory *factory;
+ ETableSpecification *spec;
+ const gchar *base_dir;
+ gchar *filename;
+
+ collection = shell_view_class->view_collection;
+
+ base_dir = EVOLUTION_ETSPECDIR;
+ spec = e_table_specification_new ();
+ filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
+ if (!e_table_specification_load_from_file (spec, filename))
+ g_critical ("Unable to load ETable specification file "
+ "for calendars");
+ g_free (filename);
+
+ factory = calendar_view_factory_new (GNOME_CAL_DAY_VIEW);
+ gal_view_collection_add_factory (collection, factory);
+ g_object_unref (factory);
+
+ factory = calendar_view_factory_new (GNOME_CAL_WORK_WEEK_VIEW);
+ gal_view_collection_add_factory (collection, factory);
+ g_object_unref (factory);
+
+ factory = calendar_view_factory_new (GNOME_CAL_WEEK_VIEW);
+ gal_view_collection_add_factory (collection, factory);
+ g_object_unref (factory);
+
+ factory = calendar_view_factory_new (GNOME_CAL_MONTH_VIEW);
+ gal_view_collection_add_factory (collection, factory);
+ g_object_unref (factory);
+
+ factory = gal_view_factory_etable_new (spec);
+ gal_view_collection_add_factory (collection, factory);
+ g_object_unref (factory);
+ g_object_unref (spec);
+
+ gal_view_collection_load (collection);
+}
+
+static void
+cal_shell_view_notify_view_id_cb (ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ GalViewInstance *view_instance;
+ const gchar *view_id;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ view_instance =
+ e_cal_shell_content_get_view_instance (cal_shell_content);
+ view_id = e_shell_view_get_view_id (E_SHELL_VIEW (cal_shell_view));
+
+ /* A NULL view ID implies we're in a custom view. But you can
+ * only get to a custom view via the "Define Views" dialog, which
+ * would have already modified the view instance appropriately.
+ * Furthermore, there's no way to refer to a custom view by ID
+ * anyway, since custom views have no IDs. */
+ if (view_id == NULL)
+ return;
+
+ gal_view_instance_set_current_view_id (view_instance, view_id);
+}
+
+void
+e_cal_shell_view_private_init (ECalShellView *cal_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ if (!gal_view_collection_loaded (shell_view_class->view_collection))
+ cal_shell_view_load_view_collection (shell_view_class);
+
+ g_signal_connect (
+ cal_shell_view, "notify::view-id",
+ G_CALLBACK (cal_shell_view_notify_view_id_cb), NULL);
+}
+
+void
+e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
+{
+ ECalShellViewPrivate *priv = cal_shell_view->priv;
+ ECalShellContent *cal_shell_content;
+ ECalShellSidebar *cal_shell_sidebar;
+ EShellBackend *shell_backend;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ GnomeCalendar *calendar;
+ ECalendar *mini_calendar;
+ EMemoTable *memo_table;
+ ECalendarTable *task_table;
+ ESourceSelector *selector;
+ guint id;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ e_shell_window_add_action_group (shell_window, "calendar");
+ e_shell_window_add_action_group (shell_window, "calendar-filter");
+
+ /* Cache these to avoid lots of awkward casting. */
+ priv->cal_shell_backend = g_object_ref (shell_backend);
+ priv->cal_shell_content = g_object_ref (shell_content);
+ priv->cal_shell_sidebar = g_object_ref (shell_sidebar);
+
+ cal_shell_content = E_CAL_SHELL_CONTENT (shell_content);
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ cal_shell_sidebar = E_CAL_SHELL_SIDEBAR (shell_sidebar);
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+ mini_calendar = e_cal_shell_sidebar_get_mini_calendar (cal_shell_sidebar);
+
+ e_calendar_item_set_get_time_callback (
+ mini_calendar->calitem, (ECalendarItemGetTimeCallback)
+ cal_shell_view_get_current_time, cal_shell_view, NULL);
+
+#if 0 /* KILL-BONOBO */
+ g_signal_connect_swapped (
+ calendar, "dates-shown-changed",
+ G_CALLBACK (e_cal_shell_view_update_sidebar),
+ cal_shell_view);
+#endif
+
+ g_signal_connect_swapped (
+ mini_calendar, "scroll-event",
+ G_CALLBACK (cal_shell_view_mini_calendar_scroll_event_cb),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
+ mini_calendar->calitem, "date-range-changed",
+ G_CALLBACK (cal_shell_view_mini_calendar_date_range_changed_cb),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
+ mini_calendar->calitem, "selection-changed",
+ G_CALLBACK (cal_shell_view_mini_calendar_selection_changed_cb),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
+ selector, "popup-event",
+ G_CALLBACK (cal_shell_view_selector_popup_event_cb),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
+ memo_table, "popup-event",
+ G_CALLBACK (cal_shell_view_memopad_popup_event_cb),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
+ memo_table, "status-message",
+ G_CALLBACK (e_cal_shell_view_memopad_set_status_message),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
+ task_table, "popup-event",
+ G_CALLBACK (cal_shell_view_taskpad_popup_event_cb),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
+ task_table, "status-message",
+ G_CALLBACK (e_cal_shell_view_taskpad_set_status_message),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
+ e_memo_table_get_table (memo_table), "selection-change",
+ G_CALLBACK (e_cal_shell_view_memopad_actions_update),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
+ e_calendar_table_get_table (task_table), "selection-change",
+ G_CALLBACK (e_cal_shell_view_taskpad_actions_update),
+ cal_shell_view);
+
+ e_categories_register_change_listener (
+ G_CALLBACK (e_cal_shell_view_update_search_filter),
+ cal_shell_view);
+
+ /* Listen for configuration changes. */
+
+ /* Timezone */
+ id = calendar_config_add_notification_timezone (
+ cal_shell_view_config_timezone_changed_cb, cal_shell_view);
+ priv->notifications = g_list_prepend (
+ priv->notifications, GUINT_TO_POINTER (id));
+
+ e_cal_shell_view_actions_init (cal_shell_view);
+ e_cal_shell_view_update_sidebar (cal_shell_view);
+ e_cal_shell_view_update_search_filter (cal_shell_view);
+ e_cal_shell_view_update_timezone (cal_shell_view);
+}
+
+void
+e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view)
+{
+ ECalShellViewPrivate *priv = cal_shell_view->priv;
+ GList *iter;
+
+ DISPOSE (priv->cal_shell_backend);
+ DISPOSE (priv->cal_shell_content);
+ DISPOSE (priv->cal_shell_sidebar);
+
+ if (priv->calendar_activity != NULL) {
+ /* XXX Activity is not cancellable. */
+ e_activity_complete (priv->calendar_activity);
+ g_object_unref (priv->calendar_activity);
+ priv->calendar_activity = NULL;
+ }
+
+ if (priv->memopad_activity != NULL) {
+ /* XXX Activity is not cancellable. */
+ e_activity_complete (priv->memopad_activity);
+ g_object_unref (priv->memopad_activity);
+ priv->memopad_activity = NULL;
+ }
+
+ if (priv->taskpad_activity != NULL) {
+ /* XXX Activity is not cancellable. */
+ e_activity_complete (priv->taskpad_activity);
+ g_object_unref (priv->taskpad_activity);
+ priv->taskpad_activity = NULL;
+ }
+
+ for (iter = priv->notifications; iter != NULL; iter = iter->next) {
+ guint notification_id = GPOINTER_TO_UINT (iter->data);
+ calendar_config_remove_notification (notification_id);
+ }
+ g_list_free (priv->notifications);
+ priv->notifications = NULL;
+}
+
+void
+e_cal_shell_view_private_finalize (ECalShellView *cal_shell_view)
+{
+ /* XXX Nothing to do? */
+}
+
+void
+e_cal_shell_view_execute_search (ECalShellView *cal_shell_view)
+{
+ /* FIXME */
+}
+
+void
+e_cal_shell_view_open_event (ECalShellView *cal_shell_view,
+ ECalModelComponent *comp_data)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ icalproperty *prop;
+ const gchar *uid;
+
+ g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view));
+ g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data));
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ editor = comp_editor_find_instance (uid);
+
+ if (editor != NULL)
+ goto exit;
+
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_component_set_icalcomponent (comp, clone);
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
+ if (prop != NULL)
+ flags |= COMP_EDITOR_MEETING;
+
+ if (itip_organizer_is_user (comp, comp_data->client))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ if (itip_sentby_is_user (comp, comp_data->client))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ if (!e_cal_component_has_attendees (comp))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ editor = event_editor_new (comp_data->client, shell, flags);
+ comp_editor_edit_comp (editor, comp);
+
+ g_object_ref (comp);
+
+exit:
+ gtk_window_present (GTK_WINDOW (editor));
+}
+
+void
+e_cal_shell_view_set_status_message (ECalShellView *cal_shell_view,
+ const gchar *status_message,
+ gdouble percent)
+{
+ EActivity *activity;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+
+ g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view));
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ activity = cal_shell_view->priv->calendar_activity;
+
+ if (status_message == NULL || *status_message == '\0') {
+ if (activity != NULL) {
+ e_activity_complete (activity);
+ g_object_unref (activity);
+ activity = NULL;
+ }
+
+ } else if (activity == NULL) {
+ activity = e_activity_new (status_message);
+ e_activity_set_percent (activity, percent);
+ e_shell_backend_add_activity (shell_backend, activity);
+
+ } else {
+ e_activity_set_percent (activity, percent);
+ e_activity_set_primary_text (activity, status_message);
+ }
+
+ cal_shell_view->priv->calendar_activity = activity;
+}
+
+void
+e_cal_shell_view_update_sidebar (ECalShellView *cal_shell_view)
+{
+#if 0 /* KILL-BONOBO */
+ EShellView *shell_view;
+ EShellSidebar *shell_sidebar;
+ GnomeCalendar *calendar;
+ GnomeCalendarViewType view;
+ time_t start_time, end_time;
+ struct tm start_tm, end_tm;
+ struct icaltimetype start_tt, end_tt;
+ icaltimezone *timezone;
+ gchar buffer[512];
+ gchar end_buffer[512];
+
+ g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view));
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ calendar = e_cal_shell_view_get_calendar (cal_shell_view);
+
+ gnome_calendar_get_visible_time_range (
+ calendar, &start_time, &end_time);
+ timezone = gnome_calendar_get_timezone (calendar);
+ view = gnome_calendar_get_view (calendar);
+
+ start_tt = icaltime_from_timet_with_zone (start_time, FALSE, timezone);
+ start_tm.tm_year = start_tt.year - 1900;
+ start_tm.tm_mon = start_tt.month - 1;
+ start_tm.tm_mday = start_tt.day;
+ start_tm.tm_hour = start_tt.hour;
+ start_tm.tm_min = start_tt.minute;
+ start_tm.tm_sec = start_tt.second;
+ start_tm.tm_isdst = -1;
+ start_tm.tm_wday = time_day_of_week (
+ start_tt.day, start_tt.month - 1, start_tt.year);
+
+ /* Subtract one from end_time so we don't get an extra day. */
+ end_tt = icaltime_from_timet_with_zone (end_time - 1, FALSE, timezone);
+ end_tm.tm_year = end_tt.year - 1900;
+ end_tm.tm_mon = end_tt.month - 1;
+ end_tm.tm_mday = end_tt.day;
+ end_tm.tm_hour = end_tt.hour;
+ end_tm.tm_min = end_tt.minute;
+ end_tm.tm_sec = end_tt.second;
+ end_tm.tm_isdst = -1;
+ end_tm.tm_wday = time_day_of_week (
+ end_tt.day, end_tt.month - 1, end_tt.year);
+
+ switch (view) {
+ case GNOME_CAL_DAY_VIEW:
+ case GNOME_CAL_WORK_WEEK_VIEW:
+ case GNOME_CAL_WEEK_VIEW:
+ if (start_tm.tm_year == end_tm.tm_year &&
+ start_tm.tm_mon == end_tm.tm_mon &&
+ start_tm.tm_mday == end_tm.tm_mday) {
+ e_utf8_strftime (
+ buffer, sizeof (buffer),
+ _("%A %d %b %Y"), &start_tm);
+ } else if (start_tm.tm_year == end_tm.tm_year) {
+ e_utf8_strftime (
+ buffer, sizeof (buffer),
+ _("%a %d %b"), &start_tm);
+ e_utf8_strftime (
+ end_buffer, sizeof (end_buffer),
+ _("%a %d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ } else {
+ e_utf8_strftime (
+ buffer, sizeof (buffer),
+ _("%a %d %b %Y"), &start_tm);
+ e_utf8_strftime (
+ end_buffer, sizeof (end_buffer),
+ _("%a %d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ }
+ break;
+
+ case GNOME_CAL_MONTH_VIEW:
+ case GNOME_CAL_LIST_VIEW:
+ if (start_tm.tm_year == end_tm.tm_year) {
+ if (start_tm.tm_mon == end_tm.tm_mon) {
+ e_utf8_strftime (
+ buffer,
+ sizeof (buffer),
+ "%d", &start_tm);
+ e_utf8_strftime (
+ end_buffer,
+ sizeof (end_buffer),
+ _("%d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ } else {
+ e_utf8_strftime (
+ buffer,
+ sizeof (buffer),
+ _("%d %b"), &start_tm);
+ e_utf8_strftime (
+ end_buffer,
+ sizeof (end_buffer),
+ _("%d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ }
+ } else {
+ e_utf8_strftime (
+ buffer, sizeof (buffer),
+ _("%d %b %Y"), &start_tm);
+ e_utf8_strftime (
+ end_buffer, sizeof (end_buffer),
+ _("%d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ }
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+
+ e_shell_sidebar_set_secondary_text (shell_sidebar, buffer);
+#endif
+}
+
+void
+e_cal_shell_view_update_timezone (ECalShellView *cal_shell_view)
+{
+#if 0
+ ECalShellContent *cal_shell_content;
+ ECalShellSidebar *cal_shell_sidebar;
+ GnomeCalendarViewType view_type;
+ ECalendarView *calendar_view;
+ icaltimezone *timezone;
+ GList *clients, *iter;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ view_type = e_cal_shell_content_get_current_view (cal_shell_content);
+ calendar_view = e_cal_shell_content_get_calendar_view (
+ cal_shell_content, view_type);
+
+ cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
+ clients = e_cal_shell_sidebar_get_clients (cal_shell_sidebar);
+
+ timezone = calendar_config_get_icaltimezone ();
+
+ for (iter = clients; iter != NULL; iter = iter->next) {
+ ECal *client = iter->data;
+
+ if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
+ e_cal_set_default_timezone (client, timezone, NULL);
+ }
+
+ e_calendar_view_set_icaltimezone (calendar_view, timezone);
+
+ g_list_free (clients);
+#endif
+}
diff --git a/calendar/module/e-cal-shell-view-private.h b/calendar/module/e-cal-shell-view-private.h
new file mode 100644
index 0000000000..8308e0bf7f
--- /dev/null
+++ b/calendar/module/e-cal-shell-view-private.h
@@ -0,0 +1,170 @@
+/*
+ * e-cal-shell-view-private.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_CAL_SHELL_VIEW_PRIVATE_H
+#define E_CAL_SHELL_VIEW_PRIVATE_H
+
+#include "e-cal-shell-view.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <libecal/e-cal-time-util.h>
+#include <libedataserver/e-categories.h>
+#include <libedataserver/e-data-server-util.h>
+
+#include "e-util/e-util.h"
+#include "e-util/e-dialog-utils.h"
+#include "widgets/misc/e-popup-action.h"
+
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/comp-util.h"
+#include "calendar/gui/e-cal-list-view.h"
+#include "calendar/gui/e-cal-model-tasks.h"
+#include "calendar/gui/e-calendar-view.h"
+#include "calendar/gui/gnome-cal.h"
+/*#include "calendar/gui/goto.h"*/
+#include "calendar/gui/print.h"
+#include "calendar/gui/dialogs/copy-source-dialog.h"
+#include "calendar/gui/dialogs/event-editor.h"
+#include "calendar/gui/dialogs/memo-editor.h"
+#include "calendar/gui/dialogs/task-editor.h"
+
+#include "e-cal-shell-backend.h"
+#include "e-cal-shell-content.h"
+#include "e-cal-shell-sidebar.h"
+#include "e-cal-shell-view-actions.h"
+
+#define E_CAL_SHELL_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CAL_SHELL_VIEW, ECalShellViewPrivate))
+
+/* Shorthand, requires a variable named "shell_window". */
+#define ACTION(name) \
+ (E_SHELL_WINDOW_ACTION_##name (shell_window))
+#define ACTION_GROUP(name) \
+ (E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window))
+
+/* For use in dispose() methods. */
+#define DISPOSE(obj) \
+ G_STMT_START { \
+ if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \
+ } G_STMT_END
+
+/* ETable Specifications */
+#define ETSPEC_FILENAME "e-calendar-table.etspec"
+
+G_BEGIN_DECLS
+
+/* Filter items are displayed in ascending order.
+ * Non-negative values are reserved for categories. */
+enum {
+ CALENDAR_FILTER_ANY_CATEGORY = -4,
+ CALENDAR_FILTER_UNMATCHED = -3,
+ CALENDAR_FILTER_ACTIVE_APPOINTMENTS = -2,
+ CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS = -1
+};
+
+/* Search items are displayed in ascending order. */
+enum {
+ CALENDAR_SEARCH_SUMMARY_CONTAINS,
+ CALENDAR_SEARCH_DESCRIPTION_CONTAINS,
+ CALENDAR_SEARCH_ANY_FIELD_CONTAINS
+};
+
+struct _ECalShellViewPrivate {
+
+ /* These are just for convenience. */
+ ECalShellBackend *cal_shell_backend;
+ ECalShellContent *cal_shell_content;
+ ECalShellSidebar *cal_shell_sidebar;
+
+ /* The last time explicitly selected by the user. */
+ time_t base_view_time;
+
+ EActivity *calendar_activity;
+ EActivity *memopad_activity;
+ EActivity *taskpad_activity;
+
+ /* GConf notification IDs */
+ GList *notifications;
+};
+
+void e_cal_shell_view_private_init
+ (ECalShellView *cal_shell_view,
+ EShellViewClass *shell_view_class);
+void e_cal_shell_view_private_constructed
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_private_dispose
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_private_finalize
+ (ECalShellView *cal_shell_view);
+
+/* Private Utilities */
+
+void e_cal_shell_view_actions_init
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_execute_search
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_open_event
+ (ECalShellView *cal_shell_view,
+ ECalModelComponent *comp_data);
+void e_cal_shell_view_set_status_message
+ (ECalShellView *cal_shell_view,
+ const gchar *status_message,
+ gdouble percent);
+void e_cal_shell_view_update_sidebar
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_update_search_filter
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_update_timezone
+ (ECalShellView *cal_shell_view);
+
+/* Memo Pad Utilities */
+
+void e_cal_shell_view_memopad_actions_init
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_memopad_actions_update
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_memopad_open_memo
+ (ECalShellView *cal_shell_view,
+ ECalModelComponent *comp_data);
+void e_cal_shell_view_memopad_set_status_message
+ (ECalShellView *cal_shell_view,
+ const gchar *status_message,
+ gdouble percent);
+
+/* Task Pad Utilities */
+
+void e_cal_shell_view_taskpad_actions_init
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_taskpad_actions_update
+ (ECalShellView *cal_shell_view);
+void e_cal_shell_view_taskpad_open_task
+ (ECalShellView *cal_shell_view,
+ ECalModelComponent *comp_data);
+void e_cal_shell_view_taskpad_set_status_message
+ (ECalShellView *cal_shell_view,
+ const gchar *status_message,
+ gdouble percent);
+
+G_END_DECLS
+
+#endif /* E_CAL_SHELL_VIEW_PRIVATE_H */
diff --git a/calendar/module/e-cal-shell-view-taskpad.c b/calendar/module/e-cal-shell-view-taskpad.c
new file mode 100644
index 0000000000..bdd136b6f7
--- /dev/null
+++ b/calendar/module/e-cal-shell-view-taskpad.c
@@ -0,0 +1,654 @@
+/*
+ * e-cal-shell-view-taskpad.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-cal-shell-view-private.h"
+
+/* Much of this file is based on e-task-shell-view-actions.c. */
+
+static void
+action_calendar_taskpad_assign_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only open the first selected task. */
+ e_cal_shell_view_taskpad_open_task (cal_shell_view, comp_data);
+
+ /* FIXME Need to actually assign the task. */
+}
+
+static void
+action_calendar_taskpad_clipboard_copy_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ e_calendar_table_copy_clipboard (task_table);
+}
+
+static void
+action_calendar_taskpad_clipboard_cut_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ e_calendar_table_cut_clipboard (task_table);
+}
+
+static void
+action_calendar_taskpad_clipboard_paste_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ e_calendar_table_paste_clipboard (task_table);
+}
+
+static void
+action_calendar_taskpad_delete_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ e_cal_shell_view_taskpad_set_status_message (
+ cal_shell_view, _("Deleting selected tasks..."), -1.0);
+ e_calendar_table_delete_selected (task_table);
+ e_cal_shell_view_taskpad_set_status_message (
+ cal_shell_view, NULL, -1.0);
+}
+
+static void
+action_calendar_taskpad_forward_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only forward the first selected task. */
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_component_set_icalcomponent (comp, clone);
+ itip_send_comp (
+ E_CAL_COMPONENT_METHOD_PUBLISH, comp,
+ comp_data->client, NULL, NULL, NULL, TRUE);
+ g_object_unref (comp);
+}
+
+static void
+action_calendar_taskpad_mark_complete_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModel *model;
+ GSList *list, *iter;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+ list = e_calendar_table_get_selected (task_table);
+ model = e_calendar_table_get_model (task_table);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ e_cal_model_tasks_mark_comp_complete (
+ E_CAL_MODEL_TASKS (model), comp_data);
+ }
+
+ g_slist_free (list);
+}
+
+static void
+action_calendar_taskpad_mark_incomplete_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModel *model;
+ GSList *list, *iter;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+ list = e_calendar_table_get_selected (task_table);
+ model = e_calendar_table_get_model (task_table);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ e_cal_model_tasks_mark_comp_incomplete (
+ E_CAL_MODEL_TASKS (model), comp_data);
+ }
+
+ g_slist_free (list);
+}
+
+static void
+action_calendar_taskpad_new_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ ECal *client;
+ ECalComponent *comp;
+ CompEditor *editor;
+ GSList *list;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ client = comp_data->client;
+ editor = task_editor_new (client, shell, COMP_EDITOR_NEW_ITEM);
+ comp = cal_comp_task_new_with_defaults (client);
+ comp_editor_edit_comp (editor, comp);
+
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (comp);
+ g_object_unref (client);
+}
+
+static void
+action_calendar_taskpad_open_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only open the first selected task. */
+ e_cal_shell_view_taskpad_open_task (cal_shell_view, comp_data);
+}
+
+static void
+action_calendar_taskpad_open_url_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ icalproperty *prop;
+ const gchar *uri;
+ GSList *list;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+
+ /* XXX We only open the URI of the first selected task. */
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ g_return_if_fail (prop == NULL);
+
+ uri = icalproperty_get_url (prop);
+ e_show_uri (GTK_WINDOW (shell_window), uri);
+}
+
+static void
+action_calendar_taskpad_print_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ GtkPrintOperationAction print_action;
+ GSList *list;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only print the first selected task. */
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+ e_cal_component_set_icalcomponent (comp, clone);
+ print_comp (comp, comp_data->client, print_action);
+ g_object_unref (comp);
+}
+
+static void
+action_calendar_taskpad_save_as_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+ gchar *filename;
+ gchar *string;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ filename = e_file_dialog_save (_("Save as..."), NULL);
+ if (filename == NULL)
+ return;
+
+ string = e_cal_get_component_as_string (
+ comp_data->client, comp_data->icalcomp);
+ if (string == NULL) {
+ g_warning ("Could not convert task to a string");
+ return;
+ }
+
+ e_write_file_uri (filename, string);
+
+ g_free (filename);
+ g_free (string);
+}
+
+static GtkActionEntry calendar_taskpad_entries[] = {
+
+ { "calendar-taskpad-assign",
+ NULL,
+ N_("_Assign Task"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_taskpad_assign_cb) },
+
+ { "calendar-taskpad-clipboard-copy",
+ GTK_STOCK_COPY,
+ NULL,
+ NULL,
+ N_("Copy selected tasks"),
+ G_CALLBACK (action_calendar_taskpad_clipboard_copy_cb) },
+
+ { "calendar-taskpad-clipboard-cut",
+ GTK_STOCK_CUT,
+ NULL,
+ NULL,
+ N_("Cut selected tasks"),
+ G_CALLBACK (action_calendar_taskpad_clipboard_cut_cb) },
+
+ { "calendar-taskpad-clipboard-paste",
+ GTK_STOCK_PASTE,
+ NULL,
+ NULL,
+ N_("Paste tasks from the clipboard"),
+ G_CALLBACK (action_calendar_taskpad_clipboard_paste_cb) },
+
+ { "calendar-taskpad-delete",
+ GTK_STOCK_DELETE,
+ N_("_Delete Task"),
+ NULL,
+ N_("Delete selected tasks"),
+ G_CALLBACK (action_calendar_taskpad_delete_cb) },
+
+ { "calendar-taskpad-forward",
+ "mail-forward",
+ N_("_Forward as iCalendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_taskpad_forward_cb) },
+
+ { "calendar-taskpad-mark-complete",
+ NULL,
+ N_("_Mark as Complete"),
+ NULL,
+ N_("Mark selected tasks as complete"),
+ G_CALLBACK (action_calendar_taskpad_mark_complete_cb) },
+
+ { "calendar-taskpad-mark-incomplete",
+ NULL,
+ N_("_Mar_k as Incomplete"),
+ NULL,
+ N_("Mark selected tasks as incomplete"),
+ G_CALLBACK (action_calendar_taskpad_mark_incomplete_cb) },
+
+ { "calendar-taskpad-new",
+ "stock_task",
+ N_("New _Task"),
+ NULL,
+ N_("Create a new task"),
+ G_CALLBACK (action_calendar_taskpad_new_cb) },
+
+ { "calendar-taskpad-open",
+ GTK_STOCK_OPEN,
+ N_("_Open Task"),
+ NULL,
+ N_("View the selected task"),
+ G_CALLBACK (action_calendar_taskpad_open_cb) },
+
+ { "calendar-taskpad-open-url",
+ "applications-internet",
+ N_("Open _Web Page"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_taskpad_open_url_cb) },
+
+ { "calendar-taskpad-save-as",
+ GTK_STOCK_SAVE_AS,
+ N_("_Save as iCalendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_taskpad_save_as_cb) }
+};
+
+static GtkActionEntry lockdown_printing_entries[] = {
+
+ { "calendar-taskpad-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ NULL,
+ N_("Print the selected task"),
+ G_CALLBACK (action_calendar_taskpad_print_cb) }
+};
+
+void
+e_cal_shell_view_taskpad_actions_init (ECalShellView *cal_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ /* Calendar Actions */
+ action_group = ACTION_GROUP (CALENDAR);
+ gtk_action_group_add_actions (
+ action_group, calendar_taskpad_entries,
+ G_N_ELEMENTS (calendar_taskpad_entries), cal_shell_view);
+
+ /* Lockdown Printing Actions */
+ action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
+ gtk_action_group_add_actions (
+ action_group, lockdown_printing_entries,
+ G_N_ELEMENTS (lockdown_printing_entries), cal_shell_view);
+}
+
+void
+e_cal_shell_view_taskpad_actions_update (ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ ECalendarTable *task_table;
+ ETable *table;
+ GtkAction *action;
+ GSList *list, *iter;
+ const gchar *label;
+ gboolean assignable = TRUE;
+ gboolean editable = TRUE;
+ gboolean has_url = FALSE;
+ gboolean sensitive;
+ gint n_selected;
+ gint n_complete = 0;
+ gint n_incomplete = 0;
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ task_table = e_cal_shell_content_get_task_table (cal_shell_content);
+
+ table = e_calendar_table_get_table (task_table);
+ n_selected = e_table_selected_count (table);
+
+ list = e_calendar_table_get_selected (task_table);
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ icalproperty *prop;
+ const gchar *cap;
+ gboolean read_only;
+
+ e_cal_is_read_only (comp_data->client, &read_only, NULL);
+ editable &= !read_only;
+
+ cap = CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT;
+ if (e_cal_get_static_capability (comp_data->client, cap))
+ assignable = FALSE;
+
+ cap = CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK;
+ if (e_cal_get_static_capability (comp_data->client, cap))
+ assignable = FALSE;
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ has_url |= (prop != NULL);
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
+ if (prop != NULL)
+ n_complete++;
+ else
+ n_incomplete++;
+ }
+ g_slist_free (list);
+
+ action = ACTION (CALENDAR_TASKPAD_ASSIGN);
+ sensitive = (n_selected == 1) && editable && assignable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_CLIPBOARD_COPY);
+ sensitive = (n_selected > 0);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_CLIPBOARD_CUT);
+ sensitive = (n_selected > 0) && editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_CLIPBOARD_PASTE);
+ sensitive = editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_DELETE);
+ sensitive = (n_selected > 0) && editable;
+ gtk_action_set_sensitive (action, sensitive);
+ label = ngettext ("Delete Task", "Delete Tasks", n_selected);
+ g_object_set (action, "label", label, NULL);
+
+ action = ACTION (CALENDAR_TASKPAD_FORWARD);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_MARK_COMPLETE);
+ sensitive = (n_selected > 0) && editable && (n_incomplete > 0);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_MARK_INCOMPLETE);
+ sensitive = (n_selected > 0) && editable && (n_complete > 0);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_OPEN);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_OPEN_URL);
+ sensitive = (n_selected == 1) && has_url;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_PRINT);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_TASKPAD_SAVE_AS);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+}
+
+void
+e_cal_shell_view_taskpad_open_task (ECalShellView *cal_shell_view,
+ ECalModelComponent *comp_data)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ icalproperty *prop;
+ const gchar *uid;
+
+ g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view));
+ g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data));
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ editor = comp_editor_find_instance (uid);
+
+ if (editor != NULL)
+ goto exit;
+
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_component_set_icalcomponent (comp, clone);
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
+ if (prop != NULL)
+ flags |= COMP_EDITOR_IS_ASSIGNED;
+
+ if (itip_organizer_is_user (comp, comp_data->client))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ if (!e_cal_component_has_attendees (comp))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ editor = task_editor_new (comp_data->client, shell, flags);
+ comp_editor_edit_comp (editor, comp);
+
+ g_object_ref (comp);
+
+ if (flags & COMP_EDITOR_IS_ASSIGNED)
+ task_editor_show_assignment (TASK_EDITOR (editor));
+
+exit:
+ gtk_window_present (GTK_WINDOW (editor));
+}
+
+void
+e_cal_shell_view_taskpad_set_status_message (ECalShellView *cal_shell_view,
+ const gchar *status_message,
+ gdouble percent)
+{
+ EActivity *activity;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+
+ g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view));
+
+ shell_view = E_SHELL_VIEW (cal_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ activity = cal_shell_view->priv->taskpad_activity;
+
+ if (status_message == NULL || *status_message == '\0') {
+ if (activity != NULL) {
+ e_activity_complete (activity);
+ g_object_unref (activity);
+ activity = NULL;
+ }
+
+ } else if (activity == NULL) {
+ activity = e_activity_new (status_message);
+ e_activity_set_percent (activity, percent);
+ e_shell_backend_add_activity (shell_backend, activity);
+
+ } else {
+ e_activity_set_percent (activity, percent);
+ e_activity_set_primary_text (activity, status_message);
+ }
+
+ cal_shell_view->priv->taskpad_activity = activity;
+}
diff --git a/calendar/module/e-cal-shell-view.c b/calendar/module/e-cal-shell-view.c
new file mode 100644
index 0000000000..5bf1c749a1
--- /dev/null
+++ b/calendar/module/e-cal-shell-view.c
@@ -0,0 +1,226 @@
+/*
+ * e-cal-shell-view.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-cal-shell-view-private.h"
+
+static gpointer parent_class;
+static GType cal_shell_view_type;
+
+static void
+cal_shell_view_dispose (GObject *object)
+{
+ e_cal_shell_view_private_dispose (E_CAL_SHELL_VIEW (object));
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+cal_shell_view_finalize (GObject *object)
+{
+ e_cal_shell_view_private_finalize (E_CAL_SHELL_VIEW (object));
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+cal_shell_view_constructed (GObject *object)
+{
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ e_cal_shell_view_private_constructed (E_CAL_SHELL_VIEW (object));
+}
+
+static void
+cal_shell_view_update_actions (EShellView *shell_view)
+{
+#if 0
+ ECalShellViewPrivate *priv;
+ ECalShellContent *cal_shell_content;
+ ECalShellSidebar *cal_shell_sidebar;
+ EShellWindow *shell_window;
+ GnomeCalendar *calendar;
+ ECalModel *model;
+ ESourceSelector *selector;
+ ESource *source;
+ GtkAction *action;
+ GtkWidget *widget;
+ GList *list, *iter;
+ const gchar *uri = NULL;
+ gboolean user_created_source;
+ gboolean editable = TRUE;
+ gboolean recurring = FALSE;
+ gboolean sensitive;
+ gint n_selected;
+
+ priv = E_CAL_SHELL_VIEW_GET_PRIVATE (shell_view);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ cal_shell_content = priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ widget = gnome_calendar_get_current_view_widget (calendar);
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (widget));
+
+ cal_shell_sidebar = priv->cal_shell_sidebar;
+ selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
+
+ list = e_calendar_view_get_selected_events (E_CALENDAR_VIEW (widget));
+ n_selected = g_list_length (list);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ gboolean read_only;
+
+ e_cal_is_read_only (comp_data->client, &read_only, NULL);
+ editable &= !read_only;
+
+ if (e_cal_util_component_has_recurrences (comp_data->icalcomp))
+ recurring |= TRUE;
+ else if (e_cal_util_component_is_instance (comp_data->icalcomp))
+ recurring |= TRUE;
+ }
+
+ source = e_source_selector_peek_primary_selection (selector);
+ if (source != NULL)
+ uri = e_source_peek_relative_uri (source);
+ user_created_source = (uri != NULL && strcmp (uri, "system") != 0);
+
+ action = ACTION (CALENDAR_COPY);
+ sensitive = (source != NULL);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_DELETE);
+ sensitive = user_created_source;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_PROPERTIES);
+ sensitive = (source != NULL);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (CALENDAR_RENAME);
+ sensitive = has_primary_source;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_CLIPBOARD_COPY);
+ sensitive = (n_selected > 0);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_CLIPBOARD_CUT);
+ sensitive = (n_selected > 0) && editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_CLIPBOARD_PASTE);
+ sensitive = editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_DELETE);
+ sensitive = (n_selected > 0) && editable && !recurring;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_DELETE_OCCURRENCE);
+ sensitive = (n_selected > 0) && editable && recurring;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_DELETE_OCCURRENCE_ALL);
+ sensitive = (n_selected > 0) && editable && recurring;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (EVENT_OPEN);
+ sensitive = (n_selected == 1);
+ gtk_action_set_sensitive (action, sensitive);
+#endif
+}
+
+static void
+cal_shell_view_class_init (ECalShellViewClass *class,
+ GTypeModule *type_module)
+{
+ GObjectClass *object_class;
+ EShellViewClass *shell_view_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECalShellViewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = cal_shell_view_dispose;
+ object_class->finalize = cal_shell_view_finalize;
+ object_class->constructed = cal_shell_view_constructed;
+
+ shell_view_class = E_SHELL_VIEW_CLASS (class);
+ shell_view_class->label = _("Calendar");
+ shell_view_class->icon_name = "x-office-calendar";
+ shell_view_class->ui_definition = "evolution-calendars.ui";
+ shell_view_class->ui_manager_id = "org.gnome.evolution.calendars";
+ shell_view_class->search_options = "/calendar-search-options";
+ shell_view_class->search_rules = "caltypes.xml";
+ shell_view_class->new_shell_content = e_cal_shell_content_new;
+ shell_view_class->new_shell_sidebar = e_cal_shell_sidebar_new;
+ shell_view_class->update_actions = cal_shell_view_update_actions;
+}
+
+static void
+cal_shell_view_init (ECalShellView *cal_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ cal_shell_view->priv =
+ E_CAL_SHELL_VIEW_GET_PRIVATE (cal_shell_view);
+
+ e_cal_shell_view_private_init (cal_shell_view, shell_view_class);
+}
+
+GType
+e_cal_shell_view_get_type (void)
+{
+ return cal_shell_view_type;
+}
+
+void
+e_cal_shell_view_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (ECalShellViewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) cal_shell_view_class_init,
+ (GClassFinalizeFunc) NULL,
+ type_module,
+ sizeof (ECalShellView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) cal_shell_view_init,
+ NULL /* value_table */
+ };
+
+ cal_shell_view_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_VIEW,
+ "ECalShellView", &type_info, 0);
+}
+
+GnomeCalendar *
+e_cal_shell_view_get_calendar (ECalShellView *cal_shell_view)
+{
+ g_return_val_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view), NULL);
+
+ /* FIXME */
+ return NULL;
+}
diff --git a/calendar/module/e-cal-shell-view.h b/calendar/module/e-cal-shell-view.h
new file mode 100644
index 0000000000..67fa15220c
--- /dev/null
+++ b/calendar/module/e-cal-shell-view.h
@@ -0,0 +1,69 @@
+/*
+ * e-cal-shell-view.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_CAL_SHELL_VIEW_H
+#define E_CAL_SHELL_VIEW_H
+
+#include <shell/e-shell-view.h>
+#include <calendar/gui/gnome-cal.h>
+#include <libedataserver/e-source-list.h>
+
+/* Standard GObject macros */
+#define E_TYPE_CAL_SHELL_VIEW \
+ (e_cal_shell_view_get_type ())
+#define E_CAL_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CAL_SHELL_VIEW, ECalShellView))
+#define E_CAL_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CAL_SHELL_VIEW, ECalShellViewClass))
+#define E_IS_CAL_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CAL_SHELL_VIEW))
+#define E_IS_CAL_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CAL_SHELL_VIEW))
+#define E_CAL_SHELL_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CAL_SHELL_VIEW, ECalShellViewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ECalShellView ECalShellView;
+typedef struct _ECalShellViewClass ECalShellViewClass;
+typedef struct _ECalShellViewPrivate ECalShellViewPrivate;
+
+struct _ECalShellView {
+ EShellView parent;
+ ECalShellViewPrivate *priv;
+};
+
+struct _ECalShellViewClass {
+ EShellViewClass parent_class;
+};
+
+GType e_cal_shell_view_get_type (void);
+void e_cal_shell_view_register_type (GTypeModule *type_module);
+GnomeCalendar * e_cal_shell_view_get_calendar (ECalShellView *cal_shell_view);
+
+G_END_DECLS
+
+#endif /* E_CAL_SHELL_VIEW_H */
diff --git a/calendar/module/e-memo-shell-backend.c b/calendar/module/e-memo-shell-backend.c
new file mode 100644
index 0000000000..d2734e066a
--- /dev/null
+++ b/calendar/module/e-memo-shell-backend.c
@@ -0,0 +1,613 @@
+/*
+ * e-memo-shell-backend.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-memo-shell-backend.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <libecal/e-cal.h>
+#include <libedataserver/e-url.h>
+#include <libedataserver/e-source.h>
+#include <libedataserver/e-source-list.h>
+#include <libedataserver/e-source-group.h>
+
+#include "shell/e-shell.h"
+#include "shell/e-shell-backend.h"
+#include "shell/e-shell-window.h"
+
+#include "calendar/common/authentication.h"
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/comp-util.h"
+#include "calendar/gui/dialogs/calendar-setup.h"
+#include "calendar/gui/dialogs/memo-editor.h"
+
+#include "e-memo-shell-migrate.h"
+#include "e-memo-shell-view.h"
+
+#define E_MEMO_SHELL_BACKEND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendPrivate))
+
+#define WEB_BASE_URI "webcal://"
+#define PERSONAL_RELATIVE_URI "system"
+
+struct _EMemoShellBackendPrivate {
+ ESourceList *source_list;
+};
+
+enum {
+ PROP_0,
+ PROP_SOURCE_LIST
+};
+
+static gpointer parent_class;
+static GType memo_shell_backend_type;
+
+static void
+memo_module_ensure_sources (EShellBackend *shell_backend)
+{
+ /* XXX This is basically the same algorithm across all modules.
+ * Maybe we could somehow integrate this into EShellBackend? */
+
+ EMemoShellBackendPrivate *priv;
+ ESourceGroup *on_this_computer;
+ ESourceGroup *on_the_web;
+ ESource *personal;
+ GSList *groups, *iter;
+ const gchar *data_dir;
+ const gchar *name;
+ gchar *base_uri;
+ gchar *filename;
+
+ on_this_computer = NULL;
+ on_the_web = NULL;
+ personal = NULL;
+
+ priv = E_MEMO_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+
+ if (!e_cal_get_sources (&priv->source_list, E_CAL_SOURCE_TYPE_JOURNAL, NULL)) {
+ g_warning ("Could not get memo sources from GConf!");
+ return;
+ }
+
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ filename = g_build_filename (data_dir, "local", NULL);
+ base_uri = g_filename_to_uri (filename, NULL, NULL);
+ g_free (filename);
+
+ groups = e_source_list_peek_groups (priv->source_list);
+ for (iter = groups; iter != NULL; iter = iter->next) {
+ ESourceGroup *source_group = iter->data;
+ const gchar *group_base_uri;
+
+ group_base_uri = e_source_group_peek_base_uri (source_group);
+
+ /* Compare only "file://" part. If the user's home
+ * changes, we do not want to create another group. */
+ if (on_this_computer == NULL &&
+ strncmp (base_uri, group_base_uri, 7) == 0)
+ on_this_computer = source_group;
+
+ else if (on_the_web == NULL &&
+ strcmp (WEB_BASE_URI, group_base_uri) == 0)
+ on_the_web = source_group;
+ }
+
+ name = _("On This Computer");
+
+ if (on_this_computer != NULL) {
+ GSList *sources;
+ const gchar *group_base_uri;
+
+ /* Force the group name to the current locale. */
+ e_source_group_set_name (on_this_computer, name);
+
+ sources = e_source_group_peek_sources (on_this_computer);
+ group_base_uri = e_source_group_peek_base_uri (on_this_computer);
+
+ /* Make sure this group includes a "Personal" source. */
+ for (iter = sources; iter != NULL; iter = iter->next) {
+ ESource *source = iter->data;
+ const gchar *relative_uri;
+
+ relative_uri = e_source_peek_relative_uri (source);
+ if (relative_uri == NULL)
+ continue;
+
+ if (strcmp (PERSONAL_RELATIVE_URI, relative_uri) != 0)
+ continue;
+
+ personal = source;
+ break;
+ }
+
+ /* Make sure we have the correct base URI. This can
+ * change when the user's home directory changes. */
+ if (strcmp (base_uri, group_base_uri) != 0) {
+ e_source_group_set_base_uri (
+ on_this_computer, base_uri);
+
+ /* XXX We shouldn't need this sync call here as
+ * set_base_uri() results in synching to GConf,
+ * but that happens in an idle loop and too late
+ * to prevent the user from seeing a "Cannot
+ * Open ... because of invalid URI" error. */
+ e_source_list_sync (priv->source_list, NULL);
+ }
+
+ } else {
+ ESourceGroup *source_group;
+
+ source_group = e_source_group_new (name, base_uri);
+ e_source_list_add_group (priv->source_list, source_group, -1);
+ g_object_unref (source_group);
+ }
+
+ name = _("Personal");
+
+ if (personal == NULL) {
+ ESource *source;
+ GSList *selected;
+ gchar *primary;
+
+ source = e_source_new (name, PERSONAL_RELATIVE_URI);
+ e_source_group_add_source (on_this_computer, source, -1);
+ g_object_unref (source);
+
+ primary = calendar_config_get_primary_memos ();
+ selected = calendar_config_get_memos_selected ();
+
+ if (primary == NULL && selected == NULL) {
+ const gchar *uid;
+
+ uid = e_source_peek_uid (source);
+ selected = g_slist_prepend (NULL, g_strdup (uid));
+
+ calendar_config_set_primary_memos (uid);
+ calendar_config_set_memos_selected (selected);
+ }
+
+ g_slist_foreach (selected, (GFunc) g_free, NULL);
+ g_slist_free (selected);
+ g_free (primary);
+ } else {
+ /* Force the source name to the current locale. */
+ e_source_set_name (personal, name);
+ }
+
+ name = _("On The Web");
+
+ if (on_the_web == NULL) {
+ ESourceGroup *source_group;
+
+ source_group = e_source_group_new (name, WEB_BASE_URI);
+ e_source_list_add_group (priv->source_list, source_group, -1);
+ g_object_unref (source_group);
+ } else {
+ /* Force the group name to the current locale. */
+ e_source_group_set_name (on_the_web, name);
+ }
+
+ g_free (base_uri);
+}
+
+static void
+memo_module_cal_opened_cb (ECal *cal,
+ ECalendarStatus status,
+ GtkAction *action)
+{
+ EShell *shell;
+ ECalComponent *comp;
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ const gchar *action_name;
+
+ /* FIXME Pass this in. */
+ shell = e_shell_get_default ();
+
+ /* XXX Handle errors better. */
+ if (status != E_CALENDAR_STATUS_OK)
+ return;
+
+ action_name = gtk_action_get_name (action);
+
+ flags |= COMP_EDITOR_NEW_ITEM;
+ if (strcmp (action_name, "memo-shared-new") == 0) {
+ flags |= COMP_EDITOR_IS_SHARED;
+ flags |= COMP_EDITOR_USER_ORG;
+ }
+
+ editor = memo_editor_new (cal, shell, flags);
+ comp = cal_comp_memo_new_with_defaults (cal);
+ comp_editor_edit_comp (editor, comp);
+
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (comp);
+ g_object_unref (cal);
+}
+
+static void
+action_memo_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ ECal *cal = NULL;
+ ECalSourceType source_type;
+ ESourceList *source_list;
+ gchar *uid;
+
+ /* This callback is used for both memos and shared memos. */
+
+ source_type = E_CAL_SOURCE_TYPE_JOURNAL;
+
+ if (!e_cal_get_sources (&source_list, source_type, NULL)) {
+ g_warning ("Could not get memo sources from GConf!");
+ return;
+ }
+
+ uid = calendar_config_get_primary_memos ();
+
+ if (uid != NULL) {
+ ESource *source;
+
+ source = e_source_list_peek_source_by_uid (source_list, uid);
+ if (source != NULL)
+ cal = auth_new_cal_from_source (source, source_type);
+ g_free (uid);
+ }
+
+ if (cal == NULL)
+ cal = auth_new_cal_from_default (source_type);
+
+ g_return_if_fail (cal != NULL);
+
+ g_signal_connect (
+ cal, "cal-opened",
+ G_CALLBACK (memo_module_cal_opened_cb), action);
+
+ e_cal_open_async (cal, FALSE);
+}
+
+static void
+action_memo_list_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ calendar_setup_new_memo_list (GTK_WINDOW (shell_window));
+}
+
+static GtkActionEntry item_entries[] = {
+
+ { "memo-new",
+ "stock_insert-note",
+ NC_("New", "Mem_o"),
+ "<Shift><Control>o",
+ N_("Create a new memo"),
+ G_CALLBACK (action_memo_new_cb) },
+
+ { "memo-shared-new",
+ "stock_insert-note",
+ N_("_Shared Memo"),
+ "<Shift><Control>h",
+ N_("Create a new shared memo"),
+ G_CALLBACK (action_memo_new_cb) }
+};
+
+static GtkActionEntry source_entries[] = {
+
+ { "memo-list-new",
+ "stock_notes",
+ NC_("New", "Memo Li_st"),
+ NULL,
+ N_("Create a new memo list"),
+ G_CALLBACK (action_memo_list_new_cb) }
+};
+
+static gboolean
+memo_module_handle_uri_cb (EShellBackend *shell_backend,
+ const gchar *uri)
+{
+ EShell *shell;
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ ECal *client;
+ ECalComponent *comp;
+ ESource *source;
+ ESourceList *source_list;
+ ECalSourceType source_type;
+ EUri *euri;
+ icalcomponent *icalcomp;
+ const gchar *cp;
+ gchar *source_uid = NULL;
+ gchar *comp_uid = NULL;
+ gchar *comp_rid = NULL;
+ gboolean handled = FALSE;
+ GError *error = NULL;
+
+ source_type = E_CAL_SOURCE_TYPE_JOURNAL;
+ shell = e_shell_backend_get_shell (shell_backend);
+
+ if (strncmp (uri, "memo:", 5) != 0)
+ return FALSE;
+
+ euri = e_uri_new (uri);
+ cp = euri->query;
+ if (cp == NULL)
+ goto exit;
+
+ while (*cp != '\0') {
+ gchar *header;
+ gchar *content;
+ gsize header_len;
+ gsize content_len;
+
+ header_len = strcspn (cp, "=&");
+
+ /* If it's malformed, give up. */
+ if (cp[header_len] != '=')
+ break;
+
+ header = (gchar *) cp;
+ header[header_len] = '\0';
+ cp += header_len + 1;
+
+ content_len = strcspn (cp, "&");
+
+ content = g_strndup (cp, content_len);
+ if (g_ascii_strcasecmp (header, "source-uid") == 0)
+ source_uid = g_strdup (content);
+ else if (g_ascii_strcasecmp (header, "comp-uid") == 0)
+ comp_uid = g_strdup (content);
+ else if (g_ascii_strcasecmp (header, "comp-rid") == 0)
+ comp_rid = g_strdup (content);
+ g_free (content);
+
+ cp += content_len;
+ if (*cp == '&') {
+ cp++;
+ if (strcmp (cp, "amp;") == 0)
+ cp += 4;
+ }
+ }
+
+ if (source_uid == NULL || comp_uid == NULL)
+ goto exit;
+
+ /* URI is valid, so consider it handled. Whether
+ * we successfully open it is another matter... */
+ handled = TRUE;
+
+ if (!e_cal_get_sources (&source_list, source_type, NULL)) {
+ g_printerr ("Could not get memo sources from GConf!\n");
+ goto exit;
+ }
+
+ source = e_source_list_peek_source_by_uid (source_list, source_uid);
+ if (source == NULL) {
+ g_printerr ("No source for UID `%s'\n", source_uid);
+ g_object_unref (source_list);
+ goto exit;
+ }
+
+ client = auth_new_cal_from_source (source, source_type);
+ if (client == NULL || !e_cal_open (client, TRUE, &error)) {
+ g_printerr ("%s\n", error->message);
+ g_object_unref (source_list);
+ g_error_free (error);
+ goto exit;
+ }
+
+ /* XXX Copied from e_memo_shell_view_open_memo().
+ * Clearly a new utility function is needed. */
+
+ editor = comp_editor_find_instance (comp_uid);
+
+ if (editor != NULL)
+ goto present;
+
+ if (!e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, &error)) {
+ g_printerr ("%s\n", error->message);
+ g_object_unref (source_list);
+ g_error_free (error);
+ goto exit;
+ }
+
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomp);
+
+ if (e_cal_component_has_organizer (comp))
+ flags |= COMP_EDITOR_IS_SHARED;
+
+ if (itip_organizer_is_user (comp, client))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ editor = memo_editor_new (client, shell, flags);
+ comp_editor_edit_comp (editor, comp);
+
+ g_object_unref (comp);
+
+present:
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (source_list);
+ g_object_unref (client);
+
+exit:
+ g_free (source_uid);
+ g_free (comp_uid);
+ g_free (comp_rid);
+
+ e_uri_free (euri);
+
+ return handled;
+}
+
+static void
+memo_module_window_created_cb (EShellBackend *shell_backend,
+ GtkWindow *window)
+{
+ const gchar *module_name;
+
+ if (!E_IS_SHELL_WINDOW (window))
+ return;
+
+ module_name = E_SHELL_BACKEND_GET_CLASS (shell_backend)->name;
+
+ e_shell_window_register_new_item_actions (
+ E_SHELL_WINDOW (window), module_name,
+ item_entries, G_N_ELEMENTS (item_entries));
+
+ e_shell_window_register_new_source_actions (
+ E_SHELL_WINDOW (window), module_name,
+ source_entries, G_N_ELEMENTS (source_entries));
+}
+
+static void
+memo_shell_backend_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SOURCE_LIST:
+ g_value_set_object (
+ value,
+ e_memo_shell_backend_get_source_list (
+ E_MEMO_SHELL_BACKEND (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+memo_shell_backend_dispose (GObject *object)
+{
+ EMemoShellBackendPrivate *priv;
+
+ priv = E_MEMO_SHELL_BACKEND_GET_PRIVATE (object);
+
+ if (priv->source_list != NULL) {
+ g_object_unref (priv->source_list);
+ priv->source_list = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+memo_shell_backend_constructed (GObject *object)
+{
+ EShell *shell;
+ EShellBackend *shell_backend;
+
+ shell_backend = E_SHELL_BACKEND (object);
+ shell = e_shell_backend_get_shell (shell_backend);
+
+ memo_module_ensure_sources (shell_backend);
+
+ g_signal_connect_swapped (
+ shell, "handle-uri",
+ G_CALLBACK (memo_module_handle_uri_cb), shell_backend);
+
+ g_signal_connect_swapped (
+ shell, "window-created",
+ G_CALLBACK (memo_module_window_created_cb), shell_backend);
+}
+
+static void
+memo_shell_backend_class_init (EMemoShellBackendClass *class)
+{
+ GObjectClass *object_class;
+ EShellBackendClass *shell_backend_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMemoShellBackendPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = memo_shell_backend_get_property;
+ object_class->dispose = memo_shell_backend_dispose;
+ object_class->constructed = memo_shell_backend_constructed;
+
+ shell_backend_class = E_SHELL_BACKEND_CLASS (class);
+ shell_backend_class->shell_view_type = E_TYPE_MEMO_SHELL_VIEW;
+ shell_backend_class->name = "memos";
+ shell_backend_class->aliases = "";
+ shell_backend_class->schemes = "memo";
+ shell_backend_class->sort_order = 500;
+ shell_backend_class->start = NULL;
+ shell_backend_class->is_busy = NULL;
+ shell_backend_class->shutdown = NULL;
+ shell_backend_class->migrate = e_memo_shell_backend_migrate;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SOURCE_LIST,
+ g_param_spec_object (
+ "source-list",
+ _("Source List"),
+ _("The registry of memo lists"),
+ E_TYPE_SOURCE_LIST,
+ G_PARAM_READABLE));
+}
+
+static void
+memo_shell_backend_init (EMemoShellBackend *memo_shell_backend)
+{
+ memo_shell_backend->priv =
+ E_MEMO_SHELL_BACKEND_GET_PRIVATE (memo_shell_backend);
+}
+
+GType
+e_memo_shell_backend_get_type (void)
+{
+ return memo_shell_backend_type;
+}
+
+void
+e_memo_shell_backend_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (EMemoShellBackendClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) memo_shell_backend_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMemoShellBackend),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) memo_shell_backend_init,
+ NULL /* value_table */
+ };
+
+ memo_shell_backend_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_BACKEND,
+ "EMemoShellBackend", &type_info, 0);
+}
+
+ESourceList *
+e_memo_shell_backend_get_source_list (EMemoShellBackend *memo_shell_backend)
+{
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_BACKEND (memo_shell_backend), NULL);
+
+ return memo_shell_backend->priv->source_list;
+}
diff --git a/calendar/module/e-memo-shell-backend.h b/calendar/module/e-memo-shell-backend.h
new file mode 100644
index 0000000000..37fe41a784
--- /dev/null
+++ b/calendar/module/e-memo-shell-backend.h
@@ -0,0 +1,70 @@
+/*
+ * e-memo-shell-backend.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MEMO_SHELL_BACKEND_H
+#define E_MEMO_SHELL_BACKEND_H
+
+#include <shell/e-shell-backend.h>
+#include <libedataserver/e-source-list.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MEMO_SHELL_BACKEND \
+ (e_memo_shell_backend_get_type ())
+#define E_MEMO_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackend))
+#define E_MEMO_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendClass))
+#define E_IS_MEMO_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MEMO_SHELL_BACKEND))
+#define E_IS_MEMO_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MEMO_SHELL_BACKEND))
+#define E_MEMO_SHELL_BACKEND_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMemoShellBackend EMemoShellBackend;
+typedef struct _EMemoShellBackendClass EMemoShellBackendClass;
+typedef struct _EMemoShellBackendPrivate EMemoShellBackendPrivate;
+
+struct _EMemoShellBackend {
+ EShellBackend parent;
+ EMemoShellBackendPrivate *priv;
+};
+
+struct _EMemoShellBackendClass {
+ EShellBackendClass parent_class;
+};
+
+GType e_memo_shell_backend_get_type (void);
+void e_memo_shell_backend_register_type
+ (GTypeModule *type_module);
+ESourceList * e_memo_shell_backend_get_source_list
+ (EMemoShellBackend *memo_shell_backend);
+
+G_END_DECLS
+
+#endif /* E_MEMO_SHELL_BACKEND_H */
diff --git a/calendar/module/e-memo-shell-content.c b/calendar/module/e-memo-shell-content.c
new file mode 100644
index 0000000000..ce020158ae
--- /dev/null
+++ b/calendar/module/e-memo-shell-content.c
@@ -0,0 +1,676 @@
+/*
+ * e-memo-shell-content.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-memo-shell-content.h"
+
+#include <glib/gi18n.h>
+
+#include "e-util/gconf-bridge.h"
+
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/comp-util.h"
+#include "calendar/gui/e-cal-model-memos.h"
+#include "calendar/gui/e-memo-table.h"
+#include "calendar/gui/e-memo-table-config.h"
+
+#include "widgets/menus/gal-view-etable.h"
+
+#define E_MEMO_SHELL_CONTENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContentPrivate))
+
+#define E_MEMO_TABLE_DEFAULT_STATE \
+ "<?xml version=\"1.0\"?>" \
+ "<ETableState>" \
+ " <column source=\"1\"/>" \
+ " <column source=\"0\"/>" \
+ " <column source=\"2\"/>" \
+ " <grouping/>" \
+ "</ETableState>"
+
+struct _EMemoShellContentPrivate {
+ GtkWidget *paned;
+ GtkWidget *memo_table;
+ GtkWidget *memo_preview;
+
+ ECalModel *memo_model;
+ EMemoTableConfig *table_config;
+ GalViewInstance *view_instance;
+
+ gchar *current_uid;
+};
+
+enum {
+ PROP_0,
+ PROP_MODEL,
+ PROP_PREVIEW_VISIBLE
+};
+
+enum {
+ TARGET_VCALENDAR
+};
+
+static GtkTargetEntry drag_types[] = {
+ { (gchar *) "text/calendar", 0, TARGET_VCALENDAR },
+ { (gchar *) "text/x-calendar", 0, TARGET_VCALENDAR }
+};
+
+static gpointer parent_class;
+static GType memo_shell_content_type;
+
+static void
+memo_shell_content_display_view_cb (EMemoShellContent *memo_shell_content,
+ GalView *gal_view)
+{
+ EMemoTable *memo_table;
+ ETable *table;
+
+ if (!GAL_IS_VIEW_ETABLE (gal_view))
+ return;
+
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ table = e_memo_table_get_table (memo_table);
+
+ gal_view_etable_attach_table (GAL_VIEW_ETABLE (gal_view), table);
+}
+
+static void
+memo_shell_content_table_foreach_cb (gint model_row,
+ gpointer user_data)
+{
+ ECalModelComponent *comp_data;
+ icalcomponent *clone;
+ icalcomponent *vcal;
+ gchar *string;
+
+ struct {
+ ECalModel *model;
+ GSList *list;
+ } *foreach_data = user_data;
+
+ comp_data = e_cal_model_get_component_at (
+ foreach_data->model, model_row);
+
+ vcal = e_cal_util_new_top_level ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_util_add_timezones_from_component (vcal, comp_data->icalcomp);
+ icalcomponent_add_component (vcal, clone);
+
+ /* String is owned by libical; do not free. */
+ string = icalcomponent_as_ical_string (vcal);
+ if (string != NULL) {
+ ESource *source;
+ const gchar *source_uid;
+
+ source = e_cal_get_source (comp_data->client);
+ source_uid = e_source_peek_uid (source);
+
+ foreach_data->list = g_slist_prepend (
+ foreach_data->list,
+ g_strdup_printf ("%s\n%s", source_uid, string));
+ }
+
+ icalcomponent_free (vcal);
+}
+
+static void
+memo_shell_content_table_drag_data_get_cb (EMemoShellContent *memo_shell_content,
+ gint row,
+ gint col,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time)
+{
+ EMemoTable *memo_table;
+ ETable *table;
+
+ struct {
+ ECalModel *model;
+ GSList *list;
+ } foreach_data;
+
+ if (info != TARGET_VCALENDAR)
+ return;
+
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ table = e_memo_table_get_table (memo_table);
+
+ foreach_data.model = e_memo_table_get_model (memo_table);
+ foreach_data.list = NULL;
+
+ e_table_selected_row_foreach (
+ table, memo_shell_content_table_foreach_cb,
+ &foreach_data);
+
+ if (foreach_data.list != NULL) {
+ cal_comp_selection_set_string_list (
+ selection_data, foreach_data.list);
+ g_slist_foreach (foreach_data.list, (GFunc) g_free, NULL);
+ g_slist_free (foreach_data.list);
+ }
+}
+
+static void
+memo_shell_content_table_drag_data_delete_cb (EMemoShellContent *memo_shell_content,
+ gint row,
+ gint col,
+ GdkDragContext *context)
+{
+ /* Moved components are deleted from source immediately when moved,
+ * because some of them can be part of destination source, and we
+ * don't want to delete not-moved memos. There is no such information
+ * which event has been moved and which not, so skip this method. */
+}
+
+static void
+memo_shell_content_cursor_change_cb (EMemoShellContent *memo_shell_content,
+ gint row,
+ ETable *table)
+{
+ ECalComponentPreview *memo_preview;
+ EMemoTable *memo_table;
+ ECalModel *memo_model;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ const gchar *uid;
+
+ memo_model = e_memo_shell_content_get_memo_model (memo_shell_content);
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ memo_preview = e_memo_shell_content_get_memo_preview (memo_shell_content);
+
+ if (e_table_selected_count (table) != 1) {
+ e_cal_component_preview_clear (memo_preview);
+ return;
+ }
+
+ row = e_table_get_cursor_row (table);
+ comp_data = e_cal_model_get_component_at (memo_model, row);
+
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (
+ comp, icalcomponent_new_clone (comp_data->icalcomp));
+ e_cal_component_preview_display (
+ memo_preview, comp_data->client, comp);
+
+ e_cal_component_get_uid (comp, &uid);
+ g_free (memo_shell_content->priv->current_uid);
+ memo_shell_content->priv->current_uid = g_strdup (uid);
+
+ g_object_unref (comp);
+}
+
+static void
+memo_shell_content_selection_change_cb (EMemoShellContent *memo_shell_content,
+ ETable *table)
+{
+ ECalComponentPreview *memo_preview;
+
+ memo_preview = e_memo_shell_content_get_memo_preview (memo_shell_content);
+
+ /* XXX Old code emits a "selection-changed" signal here. */
+
+ if (e_table_selected_count (table) != 1)
+ e_cal_component_preview_clear (memo_preview);
+}
+
+static void
+memo_shell_content_model_row_changed_cb (EMemoShellContent *memo_shell_content,
+ gint row,
+ ETableModel *model)
+{
+ ECalModelComponent *comp_data;
+ EMemoTable *memo_table;
+ ETable *table;
+ const gchar *current_uid;
+ const gchar *uid;
+
+ current_uid = memo_shell_content->priv->current_uid;
+ if (current_uid == NULL)
+ return;
+
+ comp_data = e_cal_model_get_component_at (E_CAL_MODEL (model), row);
+ if (comp_data == NULL)
+ return;
+
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ if (g_strcmp0 (uid, current_uid) != 0)
+ return;
+
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ table = e_memo_table_get_table (memo_table);
+
+ memo_shell_content_cursor_change_cb (memo_shell_content, 0, table);
+}
+
+static void
+memo_shell_content_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_PREVIEW_VISIBLE:
+ e_memo_shell_content_set_preview_visible (
+ E_MEMO_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+memo_shell_content_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MODEL:
+ g_value_set_object (
+ value, e_memo_shell_content_get_memo_model (
+ E_MEMO_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_PREVIEW_VISIBLE:
+ g_value_set_boolean (
+ value, e_memo_shell_content_get_preview_visible (
+ E_MEMO_SHELL_CONTENT (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+memo_shell_content_dispose (GObject *object)
+{
+ EMemoShellContentPrivate *priv;
+
+ priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object);
+
+ if (priv->paned != NULL) {
+ g_object_unref (priv->paned);
+ priv->paned = NULL;
+ }
+
+ if (priv->memo_table != NULL) {
+ g_object_unref (priv->memo_table);
+ priv->memo_table = NULL;
+ }
+
+ if (priv->memo_preview != NULL) {
+ g_object_unref (priv->memo_preview);
+ priv->memo_preview = NULL;
+ }
+
+ if (priv->memo_model != NULL) {
+ g_object_unref (priv->memo_model);
+ priv->memo_model = NULL;
+ }
+
+ if (priv->table_config != NULL) {
+ g_object_unref (priv->table_config);
+ priv->table_config = NULL;
+ }
+
+ if (priv->view_instance != NULL) {
+ g_object_unref (priv->view_instance);
+ priv->view_instance = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+memo_shell_content_finalize (GObject *object)
+{
+ EMemoShellContentPrivate *priv;
+
+ priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object);
+
+ g_free (priv->current_uid);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+memo_shell_content_constructed (GObject *object)
+{
+ EMemoShellContentPrivate *priv;
+ EShellContent *shell_content;
+ EShellView *shell_view;
+ GalViewInstance *view_instance;
+ ETable *table;
+ GConfBridge *bridge;
+ GtkWidget *container;
+ GtkWidget *widget;
+ const gchar *key;
+
+ priv = E_MEMO_SHELL_CONTENT_GET_PRIVATE (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ shell_content = E_SHELL_CONTENT (object);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+
+ /* Build content widgets. */
+
+ container = GTK_WIDGET (object);
+
+ widget = gtk_vpaned_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->paned = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = e_memo_table_new (shell_view, priv->memo_model);
+ gtk_paned_add1 (GTK_PANED (container), widget);
+ priv->memo_table = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_paned_add2 (GTK_PANED (container), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = e_cal_component_preview_new ();
+ e_cal_component_preview_set_default_timezone (
+ E_CAL_COMPONENT_PREVIEW (widget),
+ calendar_config_get_icaltimezone ());
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->memo_preview = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Configure the memo table. */
+
+ widget = E_MEMO_TABLE (priv->memo_table)->etable;
+ table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
+
+ priv->table_config = e_memo_table_config_new (
+ E_MEMO_TABLE (priv->memo_table));
+
+ e_table_set_state (table, E_MEMO_TABLE_DEFAULT_STATE);
+
+ e_table_drag_source_set (
+ table, GDK_BUTTON1_MASK,
+ drag_types, G_N_ELEMENTS (drag_types),
+ GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_ASK);
+
+ g_signal_connect_swapped (
+ table, "table-drag-data-get",
+ G_CALLBACK (memo_shell_content_table_drag_data_get_cb),
+ object);
+
+ g_signal_connect_swapped (
+ table, "table-drag-data-delete",
+ G_CALLBACK (memo_shell_content_table_drag_data_delete_cb),
+ object);
+
+ g_signal_connect_swapped (
+ table, "cursor-change",
+ G_CALLBACK (memo_shell_content_cursor_change_cb),
+ object);
+
+ g_signal_connect_swapped (
+ table, "selection-change",
+ G_CALLBACK (memo_shell_content_selection_change_cb),
+ object);
+
+ g_signal_connect_swapped (
+ priv->memo_model, "model-row-changed",
+ G_CALLBACK (memo_shell_content_model_row_changed_cb),
+ object);
+
+ /* Load the view instance. */
+
+ view_instance = e_shell_view_new_view_instance (shell_view, NULL);
+ g_signal_connect_swapped (
+ view_instance, "display-view",
+ G_CALLBACK (memo_shell_content_display_view_cb),
+ object);
+ gal_view_instance_load (view_instance);
+ priv->view_instance = view_instance;
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (priv->paned);
+ key = "/apps/evolution/calendar/display/memo_vpane_position";
+ gconf_bridge_bind_property_delayed (bridge, key, object, "position");
+}
+
+static guint32
+memo_shell_content_check_state (EShellContent *shell_content)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+ ETable *table;
+ GSList *list, *iter;
+ gboolean editable = TRUE;
+ gboolean has_url = FALSE;
+ gint n_selected;
+ guint32 state = 0;
+
+ memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content);
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
+ table = e_memo_table_get_table (memo_table);
+ n_selected = e_table_selected_count (table);
+
+ list = e_memo_table_get_selected (memo_table);
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ icalproperty *prop;
+ gboolean read_only;
+
+ e_cal_is_read_only (comp_data->client, &read_only, NULL);
+ editable &= !read_only;
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ has_url |= (prop != NULL);
+ }
+ g_slist_free (list);
+
+ if (n_selected == 1)
+ state |= E_MEMO_SHELL_CONTENT_SELECTION_SINGLE;
+ if (n_selected > 1)
+ state |= E_MEMO_SHELL_CONTENT_SELECTION_MULTIPLE;
+ if (editable)
+ state |= E_MEMO_SHELL_CONTENT_SELECTION_CAN_EDIT;
+ if (has_url)
+ state |= E_MEMO_SHELL_CONTENT_SELECTION_HAS_URL;
+
+ return state;
+}
+
+static void
+memo_shell_content_class_init (EMemoShellContentClass *class)
+{
+ GObjectClass *object_class;
+ EShellContentClass *shell_content_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMemoShellContentPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = memo_shell_content_set_property;
+ object_class->get_property = memo_shell_content_get_property;
+ object_class->dispose = memo_shell_content_dispose;
+ object_class->finalize = memo_shell_content_finalize;
+ object_class->constructed = memo_shell_content_constructed;
+
+ shell_content_class = E_SHELL_CONTENT_CLASS (class);
+ shell_content_class->check_state = memo_shell_content_check_state;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MODEL,
+ g_param_spec_object (
+ "model",
+ _("Model"),
+ _("The memo table model"),
+ E_TYPE_CAL_MODEL,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PREVIEW_VISIBLE,
+ g_param_spec_boolean (
+ "preview-visible",
+ _("Preview is Visible"),
+ _("Whether the preview pane is visible"),
+ TRUE,
+ G_PARAM_READWRITE));
+}
+
+static void
+memo_shell_content_init (EMemoShellContent *memo_shell_content)
+{
+ memo_shell_content->priv =
+ E_MEMO_SHELL_CONTENT_GET_PRIVATE (memo_shell_content);
+
+ memo_shell_content->priv->memo_model = e_cal_model_memos_new ();
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_memo_shell_content_get_type (void)
+{
+ return memo_shell_content_type;
+}
+
+void
+e_memo_shell_content_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (EMemoShellContentClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) memo_shell_content_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMemoShellContent),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) memo_shell_content_init,
+ NULL /* value_table */
+ };
+
+ memo_shell_content_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_CONTENT,
+ "EMemoShellContent", &type_info, 0);
+}
+
+GtkWidget *
+e_memo_shell_content_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_MEMO_SHELL_CONTENT,
+ "shell-view", shell_view, NULL);
+}
+
+ECalModel *
+e_memo_shell_content_get_memo_model (EMemoShellContent *memo_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_CONTENT (memo_shell_content), NULL);
+
+ return memo_shell_content->priv->memo_model;
+}
+
+ECalComponentPreview *
+e_memo_shell_content_get_memo_preview (EMemoShellContent *memo_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_CONTENT (memo_shell_content), NULL);
+
+ return E_CAL_COMPONENT_PREVIEW (
+ memo_shell_content->priv->memo_preview);
+}
+
+EMemoTable *
+e_memo_shell_content_get_memo_table (EMemoShellContent *memo_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_CONTENT (memo_shell_content), NULL);
+
+ return E_MEMO_TABLE (memo_shell_content->priv->memo_table);
+}
+
+GalViewInstance *
+e_memo_shell_content_get_view_instance (EMemoShellContent *memo_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_CONTENT (memo_shell_content), NULL);
+
+ return memo_shell_content->priv->view_instance;
+}
+
+gboolean
+e_memo_shell_content_get_preview_visible (EMemoShellContent *memo_shell_content)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_CONTENT (memo_shell_content), FALSE);
+
+ paned = GTK_PANED (memo_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ return GTK_WIDGET_VISIBLE (child);
+}
+
+void
+e_memo_shell_content_set_preview_visible (EMemoShellContent *memo_shell_content,
+ gboolean preview_visible)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_if_fail (E_IS_MEMO_SHELL_CONTENT (memo_shell_content));
+
+ paned = GTK_PANED (memo_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ if (preview_visible)
+ gtk_widget_show (child);
+ else
+ gtk_widget_hide (child);
+
+ g_object_notify (G_OBJECT (memo_shell_content), "preview-visible");
+}
diff --git a/calendar/module/e-memo-shell-content.h b/calendar/module/e-memo-shell-content.h
new file mode 100644
index 0000000000..84c22d6ce4
--- /dev/null
+++ b/calendar/module/e-memo-shell-content.h
@@ -0,0 +1,96 @@
+/*
+ * e-memo-shell-content.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MEMO_SHELL_CONTENT_H
+#define E_MEMO_SHELL_CONTENT_H
+
+#include <shell/e-shell-content.h>
+#include <shell/e-shell-view.h>
+
+#include <calendar/gui/e-memo-table.h>
+#include <calendar/gui/e-cal-component-preview.h>
+
+#include <menus/gal-view-instance.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MEMO_SHELL_CONTENT \
+ (e_memo_shell_content_get_type ())
+#define E_MEMO_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContent))
+#define E_MEMO_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContentClass))
+#define E_IS_MEMO_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MEMO_SHELL_CONTENT))
+#define E_IS_MEMO_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MEMO_SHELL_CONTENT))
+#define E_MEMO_SHELL_CONTENT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContentClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMemoShellContent EMemoShellContent;
+typedef struct _EMemoShellContentClass EMemoShellContentClass;
+typedef struct _EMemoShellContentPrivate EMemoShellContentPrivate;
+
+enum {
+ E_MEMO_SHELL_CONTENT_SELECTION_SINGLE = 1 << 0,
+ E_MEMO_SHELL_CONTENT_SELECTION_MULTIPLE = 1 << 1,
+ E_MEMO_SHELL_CONTENT_SELECTION_CAN_EDIT = 1 << 2,
+ E_MEMO_SHELL_CONTENT_SELECTION_HAS_URL = 1 << 3
+};
+
+struct _EMemoShellContent {
+ EShellContent parent;
+ EMemoShellContentPrivate *priv;
+};
+
+struct _EMemoShellContentClass {
+ EShellContentClass parent_class;
+};
+
+GType e_memo_shell_content_get_type (void);
+void e_memo_shell_content_register_type
+ (GTypeModule *type_module);
+GtkWidget * e_memo_shell_content_new(EShellView *shell_view);
+ECalModel * e_memo_shell_content_get_memo_model
+ (EMemoShellContent *memo_shell_conent);
+ECalComponentPreview *
+ e_memo_shell_content_get_memo_preview
+ (EMemoShellContent *memo_shell_content);
+EMemoTable * e_memo_shell_content_get_memo_table
+ (EMemoShellContent *memo_shell_content);
+GalViewInstance *
+ e_memo_shell_content_get_view_instance
+ (EMemoShellContent *memo_shell_content);
+gboolean e_memo_shell_content_get_preview_visible
+ (EMemoShellContent *memo_shell_content);
+void e_memo_shell_content_set_preview_visible
+ (EMemoShellContent *memo_shell_content,
+ gboolean preview_visible);
+
+G_END_DECLS
+
+#endif /* E_MEMO_SHELL_CONTENT_H */
diff --git a/calendar/module/e-memo-shell-migrate.c b/calendar/module/e-memo-shell-migrate.c
new file mode 100644
index 0000000000..de40a7e702
--- /dev/null
+++ b/calendar/module/e-memo-shell-migrate.c
@@ -0,0 +1,257 @@
+/*
+ * e-memo-shell-migrate.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-memo-shell-migrate.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <camel/camel-url.h>
+#include <libedataserver/e-account.h>
+#include <libedataserver/e-account-list.h>
+#include <libedataserver/e-source.h>
+#include <libedataserver/e-source-group.h>
+#include <libedataserver/e-source-list.h>
+
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/calendar-config-keys.h"
+
+#define WEBCAL_BASE_URI "webcal://"
+#define PERSONAL_RELATIVE_URI "system"
+#define GROUPWISE_BASE_URI "groupwise://"
+
+static void
+create_memo_sources (EShellBackend *shell_backend,
+ ESourceList *source_list,
+ ESourceGroup **on_this_computer,
+ ESourceGroup **on_the_web,
+ ESource **personal_source)
+{
+ GSList *groups;
+ ESourceGroup *group;
+ char *base_uri, *base_uri_proto;
+ const gchar *base_dir;
+
+ *on_this_computer = NULL;
+ *on_the_web = NULL;
+ *personal_source = NULL;
+
+ base_dir = e_shell_backend_get_config_dir (shell_backend);
+ base_uri = g_build_filename (base_dir, "local", NULL);
+
+ base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
+
+ groups = e_source_list_peek_groups (source_list);
+ if (groups) {
+ /* groups are already there, we need to search for things... */
+ GSList *g;
+
+ for (g = groups; g; g = g->next) {
+
+ group = E_SOURCE_GROUP (g->data);
+
+ if (!*on_this_computer && !strcmp (base_uri_proto, e_source_group_peek_base_uri (group)))
+ *on_this_computer = g_object_ref (group);
+ else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI, e_source_group_peek_base_uri (group)))
+ *on_the_web = g_object_ref (group);
+ }
+ }
+
+ if (*on_this_computer) {
+ /* make sure "Personal" shows up as a source under
+ this group */
+ GSList *sources = e_source_group_peek_sources (*on_this_computer);
+ GSList *s;
+ for (s = sources; s; s = s->next) {
+ ESource *source = E_SOURCE (s->data);
+ const gchar *relative_uri;
+
+ relative_uri = e_source_peek_relative_uri (source);
+ if (relative_uri == NULL)
+ continue;
+ if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
+ *personal_source = g_object_ref (source);
+ break;
+ }
+ }
+ } else {
+ /* create the local source group */
+ group = e_source_group_new (_("On This Computer"), base_uri_proto);
+ e_source_list_add_group (source_list, group, -1);
+
+ *on_this_computer = group;
+ }
+
+ if (!*personal_source) {
+ /* Create the default Person task list */
+ ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
+ e_source_group_add_source (*on_this_computer, source, -1);
+
+ if (!calendar_config_get_primary_memos () && !calendar_config_get_memos_selected ()) {
+ GSList selected;
+
+ calendar_config_set_primary_memos (e_source_peek_uid (source));
+
+ selected.data = (gpointer)e_source_peek_uid (source);
+ selected.next = NULL;
+ calendar_config_set_memos_selected (&selected);
+ }
+
+ e_source_set_color_spec (source, "#BECEDD");
+ *personal_source = source;
+ }
+
+ if (!*on_the_web) {
+ /* Create the Webcal source group */
+ group = e_source_group_new (_("On The Web"), WEBCAL_BASE_URI);
+ e_source_list_add_group (source_list, group, -1);
+
+ *on_the_web = group;
+ }
+
+ g_free (base_uri_proto);
+ g_free (base_uri);
+}
+
+static gboolean
+is_groupwise_account (EAccount *account)
+{
+ if (account->source->url != NULL) {
+ return g_str_has_prefix (account->source->url, GROUPWISE_BASE_URI);
+ } else {
+ return FALSE;
+ }
+}
+
+static void
+add_gw_esource (ESourceList *source_list, const char *group_name, const char *source_name, CamelURL *url, GConfClient *client)
+{
+ ESourceGroup *group;
+ ESource *source;
+ GSList *ids, *temp ;
+ GError *error = NULL;
+ char *relative_uri;
+ const char *soap_port;
+ const char * use_ssl;
+ const char *poa_address;
+ const char *offline_sync;
+
+
+ poa_address = url->host;
+ if (!poa_address || strlen (poa_address) ==0)
+ return;
+ soap_port = camel_url_get_param (url, "soap_port");
+
+ if (!soap_port || strlen (soap_port) == 0)
+ soap_port = "7191";
+
+ use_ssl = camel_url_get_param (url, "use_ssl");
+ offline_sync = camel_url_get_param (url, "offline_sync");
+
+ group = e_source_group_new (group_name, GROUPWISE_BASE_URI);
+ if (!e_source_list_add_group (source_list, group, -1))
+ return;
+ relative_uri = g_strdup_printf ("%s@%s/", url->user, poa_address);
+
+ source = e_source_new (source_name, relative_uri);
+ e_source_set_property (source, "auth", "1");
+ e_source_set_property (source, "username", url->user);
+ e_source_set_property (source, "port", camel_url_get_param (url, "soap_port"));
+ e_source_set_property (source, "auth-domain", "Groupwise");
+ e_source_set_property (source, "use_ssl", use_ssl);
+ e_source_set_property (source, "offline_sync", offline_sync ? "1" : "0" );
+
+ e_source_set_color_spec (source, "#EEBC60");
+ e_source_group_add_source (group, source, -1);
+
+ ids = gconf_client_get_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, &error);
+ if ( error != NULL ) {
+ g_warning("%s (%s) %s\n", G_STRLOC, G_STRFUNC, error->message);
+ g_error_free(error);
+ }
+ ids = g_slist_append (ids, g_strdup (e_source_peek_uid (source)));
+ gconf_client_set_list (client, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, ids, NULL);
+ temp = ids;
+ for (; temp != NULL; temp = g_slist_next (temp))
+ g_free (temp->data);
+
+ g_slist_free (ids);
+ g_object_unref (source);
+ g_object_unref (group);
+ g_free (relative_uri);
+}
+
+gboolean
+e_memo_shell_backend_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint revision,
+ GError **error)
+{
+ ESourceGroup *on_this_computer = NULL;
+ ESourceGroup *on_the_web = NULL;
+ ESource *personal_source = NULL;
+ ESourceList *source_list = NULL;
+ gboolean retval = FALSE;
+
+ source_list = g_object_get_data (
+ G_OBJECT (shell_backend), "source-list");
+
+ /* we call this unconditionally now - create_groups either
+ creates the groups/sources or it finds the necessary
+ groups/sources. */
+ create_memo_sources (
+ shell_backend, source_list, &on_this_computer,
+ &on_the_web, &personal_source);
+
+ /* Migration for Gw accounts between versions < 2.8 */
+ if (major == 2 && minor < 8) {
+ EAccountList *al;
+ EAccount *a;
+ CamelURL *url;
+ EIterator *it;
+ GConfClient *gconf_client = gconf_client_get_default ();
+ al = e_account_list_new (gconf_client);
+ for (it = e_list_get_iterator((EList *)al);
+ e_iterator_is_valid(it);
+ e_iterator_next(it)) {
+ a = (EAccount *) e_iterator_get(it);
+ if (!a->enabled || !is_groupwise_account (a))
+ continue;
+ url = camel_url_new (a->source->url, NULL);
+ add_gw_esource (source_list, a->name, _("Notes"), url, gconf_client);
+ camel_url_free (url);
+ }
+ g_object_unref (al);
+ g_object_unref (gconf_client);
+ }
+
+ e_source_list_sync (source_list, NULL);
+ retval = TRUE;
+
+ if (on_this_computer)
+ g_object_unref (on_this_computer);
+ if (on_the_web)
+ g_object_unref (on_the_web);
+ if (personal_source)
+ g_object_unref (personal_source);
+
+ return retval;
+}
diff --git a/mail/mail-crypto.h b/calendar/module/e-memo-shell-migrate.h
index a6ba393bf7..ba163c6950 100644
--- a/mail/mail-crypto.h
+++ b/calendar/module/e-memo-shell-migrate.h
@@ -1,4 +1,6 @@
/*
+ * e-memo-shell-backend-migrate.h
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,28 +15,24 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Jeffrey Stedfast <fejj@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifndef MAIL_CRYPTO_H
-#define MAIL_CRYPTO_H
+#ifndef E_MEMO_SHELL_BACKEND_MIGRATE_H
+#define E_MEMO_SHELL_BACKEND_MIGRATE_H
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+#include <glib.h>
+#include <shell/e-shell-backend.h>
-struct _EAccount;
+G_BEGIN_DECLS
-/* PGP/MIME convenience wrappers */
-struct _CamelCipherContext *mail_crypto_get_pgp_cipher_context(struct _EAccount *account);
+gboolean e_memo_shell_backend_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
-#endif /* ! MAIL_CRYPTO_H */
+#endif /* E_MEMO_SHELL_BACKEND_MIGRATE_H */
diff --git a/calendar/module/e-memo-shell-sidebar.c b/calendar/module/e-memo-shell-sidebar.c
new file mode 100644
index 0000000000..ca5d05c40b
--- /dev/null
+++ b/calendar/module/e-memo-shell-sidebar.c
@@ -0,0 +1,718 @@
+/*
+ * e-memo-shell-sidebar.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-memo-shell-sidebar.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <libecal/e-cal.h>
+
+#include "e-util/e-error.h"
+#include "e-util/e-util.h"
+#include "calendar/common/authentication.h"
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/e-memo-list-selector.h"
+#include "calendar/gui/misc.h"
+
+#include "e-memo-shell-view.h"
+#include "e-memo-shell-backend.h"
+
+#define E_MEMO_SHELL_SIDEBAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarPrivate))
+
+struct _EMemoShellSidebarPrivate {
+ GtkWidget *selector;
+
+ /* UID -> Client */
+ GHashTable *client_table;
+};
+
+enum {
+ PROP_0,
+ PROP_SELECTOR
+};
+
+enum {
+ CLIENT_ADDED,
+ CLIENT_REMOVED,
+ STATUS_MESSAGE,
+ LAST_SIGNAL
+};
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+static GType memo_shell_sidebar_type;
+
+static void
+memo_shell_sidebar_emit_client_added (EMemoShellSidebar *memo_shell_sidebar,
+ ECal *client)
+{
+ guint signal_id = signals[CLIENT_ADDED];
+
+ g_signal_emit (memo_shell_sidebar, signal_id, 0, client);
+}
+
+static void
+memo_shell_sidebar_emit_client_removed (EMemoShellSidebar *memo_shell_sidebar,
+ ECal *client)
+{
+ guint signal_id = signals[CLIENT_REMOVED];
+
+ g_signal_emit (memo_shell_sidebar, signal_id, 0, client);
+}
+
+static void
+memo_shell_sidebar_emit_status_message (EMemoShellSidebar *memo_shell_sidebar,
+ const gchar *status_message)
+{
+ guint signal_id = signals[STATUS_MESSAGE];
+
+ g_signal_emit (memo_shell_sidebar, signal_id, 0, status_message, -1.0);
+}
+
+static void
+memo_shell_sidebar_update_timezone (EMemoShellSidebar *memo_shell_sidebar)
+{
+ GHashTable *client_table;
+ icaltimezone *zone;
+ GList *values;
+
+ zone = calendar_config_get_icaltimezone ();
+ client_table = memo_shell_sidebar->priv->client_table;
+ values = g_hash_table_get_values (client_table);
+
+ while (values != NULL) {
+ ECal *client = values->data;
+
+ if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
+ e_cal_set_default_timezone (client, zone, NULL);
+
+ values = g_list_delete_link (values, values);
+ }
+
+ /* XXX Need to call e_cal_component_preview_set_default_timezone()
+ * here but the sidebar is not really supposed to access content
+ * stuff. I guess we could emit an "update-timezone" signal
+ * here, but that feels wrong. Maybe this whole thing should
+ * be in EMemoShellView instead. */
+}
+
+static void
+memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
+ ECal *client)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellSidebar *shell_sidebar;
+ GHashTable *client_table;
+ ESource *source;
+ const gchar *uid;
+
+ client_table = memo_shell_sidebar->priv->client_table;
+
+ shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ source = e_cal_get_source (client);
+ uid = e_source_peek_uid (source);
+
+ g_object_ref (source);
+
+ g_hash_table_remove (client_table, uid);
+ memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL);
+
+ e_error_run (
+ GTK_WINDOW (shell_window),
+ "calendar:memos-crashed", NULL);
+
+ g_object_unref (source);
+}
+
+static void
+memo_shell_sidebar_backend_error_cb (EMemoShellSidebar *memo_shell_sidebar,
+ const gchar *message,
+ ECal *client)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellSidebar *shell_sidebar;
+ GtkWidget *dialog;
+ const gchar *uri;
+ gchar *uri_no_passwd;
+
+ shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ uri = e_cal_get_uri (client);
+ uri_no_passwd = get_uri_without_password (uri);
+
+ dialog = gtk_message_dialog_new (
+ GTK_WINDOW (shell_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ _("Error on %s\n%s"),
+ uri_no_passwd, message);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ g_free (uri_no_passwd);
+}
+
+static void
+memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar,
+ ECalendarStatus status,
+ ECal *client)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellSidebar *shell_sidebar;
+ ESource *source;
+
+ source = e_cal_get_source (client);
+
+ shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED ||
+ status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
+ auth_cal_forget_password (client);
+
+ switch (status) {
+ case E_CALENDAR_STATUS_OK:
+ g_signal_handlers_disconnect_matched (
+ client, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
+ memo_shell_sidebar_client_opened_cb, NULL);
+
+ memo_shell_sidebar_emit_status_message (
+ memo_shell_sidebar, _("Loading memos"));
+ memo_shell_sidebar_emit_client_added (
+ memo_shell_sidebar, client);
+ memo_shell_sidebar_emit_status_message (
+ memo_shell_sidebar, NULL);
+ break;
+
+ case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
+ e_cal_open_async (client, FALSE);
+ break;
+
+ case E_CALENDAR_STATUS_BUSY:
+ break;
+
+ case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
+ e_error_run (
+ GTK_WINDOW (shell_window),
+ "calendar:prompt-no-contents-offline-memos",
+ NULL);
+ break;
+
+ default:
+ memo_shell_sidebar_emit_client_removed (
+ memo_shell_sidebar, client);
+ break;
+ }
+}
+
+static void
+memo_shell_sidebar_row_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
+ GtkTreePath *tree_path,
+ GtkTreeIter *tree_iter,
+ GtkTreeModel *tree_model)
+{
+ ESourceSelector *selector;
+ ESource *source;
+
+ /* XXX ESourceSelector's underlying tree store has only one
+ * column: ESource objects. While we're not supposed to
+ * know this, listening for "row-changed" signals from
+ * the model is easier to deal with than the selector's
+ * "selection-changed" signal, which doesn't tell you
+ * _which_ row changed. */
+
+ selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+ gtk_tree_model_get (tree_model, tree_iter, 0, &source, -1);
+
+ /* XXX This signal gets emitted a lot while the model is being
+ * rebuilt, during which time we won't get a valid ESource.
+ * ESourceSelector should probably block this signal while
+ * rebuilding the model, but we'll be forgiving and not
+ * emit a warning. */
+ if (!E_IS_SOURCE (source))
+ return;
+
+ if (e_source_selector_source_is_selected (selector, source))
+ e_memo_shell_sidebar_add_source (memo_shell_sidebar, source);
+ else
+ e_memo_shell_sidebar_remove_source (memo_shell_sidebar, source);
+}
+
+static void
+memo_shell_sidebar_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
+ ESourceSelector *selector)
+{
+ GSList *list, *iter;
+
+ /* This signal is emitted less frequently than "row-changed",
+ * especially when the model is being rebuilt. So we'll take
+ * it easy on poor GConf. */
+
+ list = e_source_selector_get_selection (selector);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ESource *source = iter->data;
+
+ iter->data = (gpointer) e_source_peek_uid (source);
+ g_object_unref (source);
+ }
+
+ calendar_config_set_memos_selected (list);
+
+ g_slist_free (list);
+}
+
+static void
+memo_shell_sidebar_primary_selection_changed_cb (EMemoShellSidebar *memo_shell_sidebar,
+ ESourceSelector *selector)
+{
+ ESource *source;
+ const gchar *uid;
+
+ /* XXX ESourceSelector needs a "primary-selection-uid" property
+ * so we can just bind the property with GConfBridge. */
+
+ source = e_source_selector_peek_primary_selection (selector);
+ if (source == NULL)
+ return;
+
+ uid = e_source_peek_uid (source);
+ calendar_config_set_primary_memos (uid);
+}
+
+static void
+memo_shell_sidebar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SELECTOR:
+ g_value_set_object (
+ value, e_memo_shell_sidebar_get_selector (
+ E_MEMO_SHELL_SIDEBAR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+memo_shell_sidebar_dispose (GObject *object)
+{
+ EMemoShellSidebarPrivate *priv;
+
+ priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ if (priv->selector != NULL) {
+ g_object_unref (priv->selector);
+ priv->selector = NULL;
+ }
+
+ g_hash_table_remove_all (priv->client_table);
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+memo_shell_sidebar_finalize (GObject *object)
+{
+ EMemoShellSidebarPrivate *priv;
+
+ priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->client_table);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+memo_shell_sidebar_constructed (GObject *object)
+{
+ EMemoShellSidebarPrivate *priv;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ EShellSidebar *shell_sidebar;
+ ESourceSelector *selector;
+ ESourceList *source_list;
+ ESource *source;
+ GtkContainer *container;
+ GtkTreeModel *model;
+ GtkWidget *widget;
+ AtkObject *a11y;
+ GSList *list, *iter;
+ gchar *uid;
+
+ priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ shell_sidebar = E_SHELL_SIDEBAR (object);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ source_list = e_memo_shell_backend_get_source_list (
+ E_MEMO_SHELL_BACKEND (shell_backend));
+
+ container = GTK_CONTAINER (shell_sidebar);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_container_add (container, widget);
+ gtk_widget_show (widget);
+
+ container = GTK_CONTAINER (widget);
+
+ widget = e_memo_list_selector_new (source_list);
+ e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
+ gtk_container_add (container, widget);
+ a11y = gtk_widget_get_accessible (widget);
+ atk_object_set_name (a11y, _("Memo List Selector"));
+ priv->selector = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Restore the selector state from the last session. */
+
+ selector = E_SOURCE_SELECTOR (priv->selector);
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
+
+ g_signal_connect_swapped (
+ model, "row-changed",
+ G_CALLBACK (memo_shell_sidebar_row_changed_cb),
+ object);
+
+ source = NULL;
+ uid = calendar_config_get_primary_memos ();
+ if (uid != NULL)
+ source = e_source_list_peek_source_by_uid (source_list, uid);
+ if (source == NULL)
+ source = e_source_list_peek_source_any (source_list);
+ if (source != NULL)
+ e_source_selector_set_primary_selection (selector, source);
+ g_free (uid);
+
+ list = calendar_config_get_memos_selected ();
+ for (iter = list; iter != NULL; iter = iter->next) {
+ uid = iter->data;
+ source = e_source_list_peek_source_by_uid (source_list, uid);
+ g_free (uid);
+
+ if (source == NULL)
+ continue;
+
+ e_source_selector_select_source (selector, source);
+ }
+ g_slist_free (list);
+
+ /* Listen for subsequent changes to the selector. */
+
+ g_signal_connect_swapped (
+ widget, "selection-changed",
+ G_CALLBACK (memo_shell_sidebar_selection_changed_cb),
+ object);
+
+ g_signal_connect_swapped (
+ widget, "primary-selection-changed",
+ G_CALLBACK (memo_shell_sidebar_primary_selection_changed_cb),
+ object);
+}
+
+static guint32
+memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
+{
+ EMemoShellSidebar *memo_shell_sidebar;
+ ESourceSelector *selector;
+ ESource *source;
+ gboolean is_system = FALSE;
+ guint32 state = 0;
+
+ memo_shell_sidebar = E_MEMO_SHELL_SIDEBAR (shell_sidebar);
+ selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+
+ if (source != NULL) {
+ const gchar *uri;
+
+ uri = e_source_peek_relative_uri (source);
+ is_system = (uri == NULL || strcmp (uri, "system") == 0);
+ }
+
+ if (source != NULL)
+ state |= E_MEMO_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
+ if (is_system)
+ state |= E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM;
+
+ return state;
+}
+
+static void
+memo_shell_sidebar_client_added (EMemoShellSidebar *memo_shell_sidebar,
+ ECal *client)
+{
+ memo_shell_sidebar_update_timezone (memo_shell_sidebar);
+}
+
+static void
+memo_shell_sidebar_client_removed (EMemoShellSidebar *memo_shell_sidebar,
+ ECal *client)
+{
+ ESourceSelector *selector;
+ GHashTable *client_table;
+ ESource *source;
+ const gchar *uid;
+
+ client_table = memo_shell_sidebar->priv->client_table;
+ selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+
+ g_signal_handlers_disconnect_matched (
+ client, G_SIGNAL_MATCH_DATA, 0, 0,
+ NULL, NULL, memo_shell_sidebar);
+
+ source = e_cal_get_source (client);
+ e_source_selector_unselect_source (selector, source);
+
+ uid = e_source_peek_uid (source);
+ g_hash_table_remove (client_table, uid);
+
+ memo_shell_sidebar_emit_status_message (memo_shell_sidebar, NULL);
+}
+
+static void
+memo_shell_sidebar_class_init (EMemoShellSidebarClass *class)
+{
+ GObjectClass *object_class;
+ EShellSidebarClass *shell_sidebar_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMemoShellSidebarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = memo_shell_sidebar_get_property;
+ object_class->dispose = memo_shell_sidebar_dispose;
+ object_class->finalize = memo_shell_sidebar_finalize;
+ object_class->constructed = memo_shell_sidebar_constructed;
+
+ shell_sidebar_class = E_SHELL_SIDEBAR_CLASS (class);
+ shell_sidebar_class->check_state = memo_shell_sidebar_check_state;
+
+ class->client_added = memo_shell_sidebar_client_added;
+ class->client_removed = memo_shell_sidebar_client_removed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SELECTOR,
+ g_param_spec_object (
+ "selector",
+ _("Source Selector Widget"),
+ _("This widget displays groups of memo lists"),
+ E_TYPE_SOURCE_SELECTOR,
+ G_PARAM_READABLE));
+
+ signals[CLIENT_ADDED] = g_signal_new (
+ "client-added",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EMemoShellSidebarClass, client_added),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_CAL);
+
+ signals[CLIENT_REMOVED] = g_signal_new (
+ "client-removed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EMemoShellSidebarClass, client_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_CAL);
+
+ signals[STATUS_MESSAGE] = g_signal_new (
+ "status-message",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EMemoShellSidebarClass, status_message),
+ NULL, NULL,
+ e_marshal_VOID__STRING_DOUBLE,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING,
+ G_TYPE_DOUBLE);
+}
+
+static void
+memo_shell_sidebar_init (EMemoShellSidebar *memo_shell_sidebar)
+{
+ GHashTable *client_table;
+
+ client_table = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_object_unref);
+
+ memo_shell_sidebar->priv =
+ E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (memo_shell_sidebar);
+
+ memo_shell_sidebar->priv->client_table = client_table;
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_memo_shell_sidebar_get_type (void)
+{
+ return memo_shell_sidebar_type;
+}
+
+void
+e_memo_shell_sidebar_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (EMemoShellSidebarClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) memo_shell_sidebar_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMemoShellSidebar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) memo_shell_sidebar_init,
+ NULL /* value_table */
+ };
+
+ memo_shell_sidebar_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_SIDEBAR,
+ "EMemoShellSidebar", &type_info, 0);
+}
+
+GtkWidget *
+e_memo_shell_sidebar_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_MEMO_SHELL_SIDEBAR,
+ "shell-view", shell_view, NULL);
+}
+
+ESourceSelector *
+e_memo_shell_sidebar_get_selector (EMemoShellSidebar *memo_shell_sidebar)
+{
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_SIDEBAR (memo_shell_sidebar), NULL);
+
+ return E_SOURCE_SELECTOR (memo_shell_sidebar->priv->selector);
+}
+
+void
+e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
+ ESource *source)
+{
+ ESourceSelector *selector;
+ GHashTable *client_table;
+ ECal *client;
+ const gchar *uid;
+ const gchar *uri;
+ gchar *message;
+
+ g_return_if_fail (E_IS_MEMO_SHELL_SIDEBAR (memo_shell_sidebar));
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ client_table = memo_shell_sidebar->priv->client_table;
+ selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+
+ uid = e_source_peek_uid (source);
+ client = g_hash_table_lookup (client_table, uid);
+
+ if (client != NULL)
+ return;
+
+ client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL);
+ g_return_if_fail (client != NULL);
+
+ g_signal_connect_swapped (
+ client, "backend-died",
+ G_CALLBACK (memo_shell_sidebar_backend_died_cb),
+ memo_shell_sidebar);
+
+ g_signal_connect_swapped (
+ client, "backend-error",
+ G_CALLBACK (memo_shell_sidebar_backend_error_cb),
+ memo_shell_sidebar);
+
+ g_hash_table_insert (client_table, g_strdup (uid), client);
+ e_source_selector_select_source (selector, source);
+
+ uri = e_cal_get_uri (client);
+ message = g_strdup_printf (_("Opening memos at %s"), uri);
+ memo_shell_sidebar_emit_status_message (memo_shell_sidebar, message);
+ g_free (message);
+
+ g_signal_connect_swapped (
+ client, "cal-opened",
+ G_CALLBACK (memo_shell_sidebar_client_opened_cb),
+ memo_shell_sidebar);
+
+ e_cal_open_async (client, FALSE);
+}
+
+void
+e_memo_shell_sidebar_remove_source (EMemoShellSidebar *memo_shell_sidebar,
+ ESource *source)
+{
+ ESourceSelector *selector;
+ GHashTable *client_table;
+ ECal *client;
+ const gchar *uid;
+
+ g_return_if_fail (E_IS_MEMO_SHELL_SIDEBAR (memo_shell_sidebar));
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ client_table = memo_shell_sidebar->priv->client_table;
+ selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+
+ uid = e_source_peek_uid (source);
+ client = g_hash_table_lookup (client_table, uid);
+
+ if (client == NULL)
+ return;
+
+ memo_shell_sidebar_emit_client_removed (memo_shell_sidebar, client);
+}
diff --git a/calendar/module/e-memo-shell-sidebar.h b/calendar/module/e-memo-shell-sidebar.h
new file mode 100644
index 0000000000..665c8f218a
--- /dev/null
+++ b/calendar/module/e-memo-shell-sidebar.h
@@ -0,0 +1,95 @@
+/*
+ * e-memo-shell-sidebar.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MEMO_SHELL_SIDEBAR_H
+#define E_MEMO_SHELL_SIDEBAR_H
+
+#include <libecal/e-cal.h>
+#include <libedataserverui/e-source-selector.h>
+
+#include <shell/e-shell-sidebar.h>
+#include <shell/e-shell-view.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MEMO_SHELL_SIDEBAR \
+ (e_memo_shell_sidebar_get_type ())
+#define E_MEMO_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebar))
+#define E_MEMO_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarClass))
+#define E_IS_MEMO_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MEMO_SHELL_SIDEBAR))
+#define E_IS_MEMO_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MEMO_SHELL_SIDEBAR))
+#define E_MEMO_SHELL_SIDEBAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MEMO_SHELL_SIDEBAR, EMemoShellSidebarClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMemoShellSidebar EMemoShellSidebar;
+typedef struct _EMemoShellSidebarClass EMemoShellSidebarClass;
+typedef struct _EMemoShellSidebarPrivate EMemoShellSidebarPrivate;
+
+enum {
+ E_MEMO_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE = 1 << 0,
+ E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM = 1 << 1
+};
+
+struct _EMemoShellSidebar {
+ EShellSidebar parent;
+ EMemoShellSidebarPrivate *priv;
+};
+
+struct _EMemoShellSidebarClass {
+ EShellSidebarClass parent_class;
+
+ /* Signals */
+ void (*client_added) (EMemoShellSidebar *memo_shell_sidebar,
+ ECal *client);
+ void (*client_removed) (EMemoShellSidebar *memo_shell_sidebar,
+ ECal *client);
+ void (*status_message) (EMemoShellSidebar *memo_shell_sidebar,
+ const gchar *status_message,
+ gdouble percent);
+};
+
+GType e_memo_shell_sidebar_get_type (void);
+void e_memo_shell_sidebar_register_type
+ (GTypeModule *type_module);
+GtkWidget * e_memo_shell_sidebar_new(EShellView *shell_view);
+ESourceSelector *
+ e_memo_shell_sidebar_get_selector
+ (EMemoShellSidebar *memo_shell_sidebar);
+void e_memo_shell_sidebar_add_source
+ (EMemoShellSidebar *memo_shell_sidebar,
+ ESource *source);
+void e_memo_shell_sidebar_remove_source
+ (EMemoShellSidebar *memo_shell_sidebar,
+ ESource *source);
+
+G_END_DECLS
+
+#endif /* E_MEMO_SHELL_SIDEBAR_H */
diff --git a/calendar/module/e-memo-shell-view-actions.c b/calendar/module/e-memo-shell-view-actions.c
new file mode 100644
index 0000000000..ab0b9f0fe3
--- /dev/null
+++ b/calendar/module/e-memo-shell-view-actions.c
@@ -0,0 +1,920 @@
+/*
+ * e-memo-shell-view-actions.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-memo-shell-view-private.h"
+
+static void
+action_gal_save_custom_view_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EShellView *shell_view;
+ GalViewInstance *view_instance;
+
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with saving the custom view. */
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ view_instance = e_memo_shell_content_get_view_instance (memo_shell_content);
+ gal_view_instance_save_as (view_instance);
+}
+
+static void
+action_memo_clipboard_copy_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
+ e_memo_table_copy_clipboard (memo_table);
+}
+
+static void
+action_memo_clipboard_cut_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
+ e_memo_table_cut_clipboard (memo_table);
+}
+
+static void
+action_memo_clipboard_paste_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
+ e_memo_table_paste_clipboard (memo_table);
+}
+
+static void
+action_memo_delete_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ ECalComponentPreview *memo_preview;
+ EMemoTable *memo_table;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ memo_preview = e_memo_shell_content_get_memo_preview (memo_shell_content);
+
+ e_memo_shell_view_set_status_message (
+ memo_shell_view, _("Deleting selected memos..."), -1.0);
+ e_memo_table_delete_selected (memo_table);
+ e_memo_shell_view_set_status_message (memo_shell_view, NULL, -1.0);
+
+ e_cal_component_preview_clear (memo_preview);
+}
+
+static void
+action_memo_forward_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ GSList *list;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only forward the first selected memo. */
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_component_set_icalcomponent (comp, clone);
+ itip_send_comp (
+ E_CAL_COMPONENT_METHOD_PUBLISH, comp,
+ comp_data->client, NULL, NULL, NULL, TRUE);
+ g_object_unref (comp);
+}
+
+static void
+action_memo_list_copy_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellSidebar *memo_shell_sidebar;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ ESourceSelector *selector;
+ ESource *source;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
+ selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ copy_source_dialog (
+ GTK_WINDOW (shell_window),
+ source, E_CAL_SOURCE_TYPE_JOURNAL);
+}
+
+static void
+action_memo_list_delete_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellBackend *memo_shell_backend;
+ EMemoShellContent *memo_shell_content;
+ EMemoShellSidebar *memo_shell_sidebar;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ EMemoTable *memo_table;
+ ECal *client;
+ ECalModel *model;
+ ESourceSelector *selector;
+ ESourceGroup *source_group;
+ ESourceList *source_list;
+ ESource *source;
+ gint response;
+ gchar *uri;
+ GError *error = NULL;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ memo_shell_backend = memo_shell_view->priv->memo_shell_backend;
+ source_list = e_memo_shell_backend_get_source_list (memo_shell_backend);
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ model = e_memo_table_get_model (memo_table);
+
+ memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
+ selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ /* Ask for confirmation. */
+ response = e_error_run (
+ GTK_WINDOW (shell_window),
+ "calendar:prompt-delete-memo-list",
+ e_source_peek_name (source));
+ if (response != GTK_RESPONSE_YES)
+ return;
+
+ uri = e_source_get_uri (source);
+ client = e_cal_model_get_client_for_uri (model, uri);
+ if (client == NULL)
+ client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_JOURNAL);
+ g_free (uri);
+
+ g_return_if_fail (client != NULL);
+
+ if (!e_cal_remove (client, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ if (e_source_selector_source_is_selected (selector, source)) {
+ e_memo_shell_sidebar_remove_source (
+ memo_shell_sidebar, source);
+ e_source_selector_unselect_source (selector, source);
+ }
+
+ source_group = e_source_peek_group (source);
+ e_source_group_remove_source (source_group, source);
+
+ if (!e_source_list_sync (source_list, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+action_memo_list_new_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ calendar_setup_new_memo_list (GTK_WINDOW (shell_window));
+}
+
+static void
+action_memo_list_print_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+ ETable *table;
+ GtkPrintOperationAction print_action;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ table = e_memo_table_get_table (memo_table);
+
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+ print_table (table, _("Print Memos"), _("Memos"), print_action);
+}
+
+static void
+action_memo_list_print_preview_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+ ETable *table;
+ GtkPrintOperationAction print_action;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ table = e_memo_table_get_table (memo_table);
+
+ print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
+ print_table (table, _("Print Memos"), _("Memos"), print_action);
+}
+
+static void
+action_memo_list_properties_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellSidebar *memo_shell_sidebar;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESource *source;
+ ESourceSelector *selector;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
+ selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ calendar_setup_edit_memo_list (GTK_WINDOW (shell_window), source);
+}
+
+static void
+action_memo_list_rename_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellSidebar *memo_shell_sidebar;
+ ESourceSelector *selector;
+
+ memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
+ selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+
+ e_source_selector_edit_primary_selection (selector);
+}
+
+static void
+action_memo_list_select_one_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellSidebar *memo_shell_sidebar;
+ ESourceSelector *selector;
+ ESource *primary;
+ GSList *list, *iter;
+
+ /* XXX ESourceSelector should provide a function for this. */
+
+ memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
+ selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+ primary = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (primary != NULL);
+
+ list = e_source_selector_get_selection (selector);
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ESource *source = iter->data;
+
+ if (source == primary)
+ continue;
+
+ e_source_selector_unselect_source (selector, source);
+ }
+ e_source_selector_free_selection (list);
+
+ e_source_selector_select_source (selector, primary);
+}
+
+static void
+action_memo_new_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ ECal *client;
+ ECalComponent *comp;
+ CompEditor *editor;
+ GSList *list;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ client = comp_data->client;
+ editor = memo_editor_new (client, shell, COMP_EDITOR_NEW_ITEM);
+ comp = cal_comp_memo_new_with_defaults (client);
+ comp_editor_edit_comp (editor, comp);
+
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (comp);
+ g_object_unref (client);
+}
+
+static void
+action_memo_open_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only open the first selected memo. */
+ e_memo_shell_view_open_memo (memo_shell_view, comp_data);
+}
+
+static void
+action_memo_open_url_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ icalproperty *prop;
+ const gchar *uri;
+ GSList *list;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only open the URI of the first selected memo. */
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ g_return_if_fail (prop == NULL);
+
+ uri = icalproperty_get_url (prop);
+ e_show_uri (GTK_WINDOW (shell_window), uri);
+}
+
+static void
+action_memo_preview_cb (GtkToggleAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ gboolean visible;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ visible = gtk_toggle_action_get_active (action);
+ e_memo_shell_content_set_preview_visible (memo_shell_content, visible);
+}
+
+static void
+action_memo_print_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ GtkPrintOperationAction print_action;
+ GSList *list;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only print the first selected memo. */
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+ e_cal_component_set_icalcomponent (comp, clone);
+ print_comp (comp, comp_data->client, print_action);
+ g_object_unref (comp);
+}
+
+static void
+action_memo_save_as_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+ gchar *filename;
+ gchar *string;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
+ list = e_memo_table_get_selected (memo_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ filename = e_file_dialog_save (_("Save as..."), NULL);
+ if (filename == NULL)
+ return;
+
+ /* XXX We only save the first selected memo. */
+ string = e_cal_get_component_as_string (
+ comp_data->client, comp_data->icalcomp);
+ if (string == NULL) {
+ g_warning ("Could not convert memo to a string");
+ return;
+ }
+
+ e_write_file_uri (filename, string);
+
+ g_free (filename);
+ g_free (string);
+}
+
+static void
+action_search_execute_cb (GtkAction *action,
+ EMemoShellView *memo_shell_view)
+{
+ EShellView *shell_view;
+
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with executing the search. */
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ e_memo_shell_view_execute_search (memo_shell_view);
+}
+
+static void
+action_search_filter_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EMemoShellView *memo_shell_view)
+{
+ e_memo_shell_view_execute_search (memo_shell_view);
+}
+
+static GtkActionEntry memo_entries[] = {
+
+ { "memo-clipboard-copy",
+ GTK_STOCK_COPY,
+ NULL,
+ NULL,
+ N_("Copy selected memo"),
+ G_CALLBACK (action_memo_clipboard_copy_cb) },
+
+ { "memo-clipboard-cut",
+ GTK_STOCK_CUT,
+ NULL,
+ NULL,
+ N_("Cut selected memo"),
+ G_CALLBACK (action_memo_clipboard_cut_cb) },
+
+ { "memo-clipboard-paste",
+ GTK_STOCK_PASTE,
+ NULL,
+ NULL,
+ N_("Paste memo from the clipboard"),
+ G_CALLBACK (action_memo_clipboard_paste_cb) },
+
+ { "memo-delete",
+ GTK_STOCK_DELETE,
+ N_("_Delete Memo"),
+ NULL,
+ N_("Delete selected memos"),
+ G_CALLBACK (action_memo_delete_cb) },
+
+ { "memo-forward",
+ "mail-forward",
+ N_("_Forward as iCalendar..."),
+ "<Control>f",
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_memo_forward_cb) },
+
+ { "memo-list-copy",
+ GTK_STOCK_COPY,
+ N_("_Copy..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_memo_list_copy_cb) },
+
+ { "memo-list-delete",
+ GTK_STOCK_DELETE,
+ N_("_Delete"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_memo_list_delete_cb) },
+
+ { "memo-list-new",
+ "stock_notes",
+ N_("_New Memo List"),
+ NULL,
+ N_("Create a new memo list"),
+ G_CALLBACK (action_memo_list_new_cb) },
+
+ { "memo-list-properties",
+ GTK_STOCK_PROPERTIES,
+ NULL,
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_memo_list_properties_cb) },
+
+ { "memo-list-rename",
+ NULL,
+ N_("_Rename..."),
+ "F2",
+ N_("Rename the selected memo list"),
+ G_CALLBACK (action_memo_list_rename_cb) },
+
+ { "memo-list-select-one",
+ "stock_check-filled",
+ N_("Show _Only This Memo List"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_memo_list_select_one_cb) },
+
+ { "memo-new",
+ "stock_insert-note",
+ N_("New _Memo"),
+ NULL,
+ N_("Create a new memo"),
+ G_CALLBACK (action_memo_new_cb) },
+
+ { "memo-open",
+ GTK_STOCK_OPEN,
+ N_("_Open Memo"),
+ "<Control>o",
+ N_("View the selected memo"),
+ G_CALLBACK (action_memo_open_cb) },
+
+ { "memo-open-url",
+ "applications-internet",
+ N_("Open _Web Page"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_memo_open_url_cb) },
+
+ { "memo-save-as",
+ GTK_STOCK_SAVE_AS,
+ N_("_Save as iCalendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_memo_save_as_cb) }
+};
+
+static EPopupActionEntry memo_popup_entries[] = {
+
+ { "memo-list-popup-copy",
+ NULL,
+ "memo-list-copy" },
+
+ { "memo-list-popup-delete",
+ NULL,
+ "memo-list-delete" },
+
+ { "memo-list-popup-properties",
+ NULL,
+ "memo-list-properties" },
+
+ { "memo-list-popup-rename",
+ NULL,
+ "memo-list-rename" },
+
+ { "memo-list-popup-select-one",
+ NULL,
+ "memo-list-select-one" },
+
+ { "memo-popup-clipboard-copy",
+ NULL,
+ "memo-clipboard-copy" },
+
+ { "memo-popup-clipboard-cut",
+ NULL,
+ "memo-clipboard-cut" },
+
+ { "memo-popup-clipboard-paste",
+ NULL,
+ "memo-clipboard-paste" },
+
+ { "memo-popup-delete",
+ NULL,
+ "memo-delete" },
+
+ { "memo-popup-forward",
+ NULL,
+ "memo-forward" },
+
+ { "memo-popup-open",
+ NULL,
+ "memo-open" },
+
+ { "memo-popup-open-url",
+ NULL,
+ "memo-open-url" },
+
+ { "memo-popup-save-as",
+ NULL,
+ "memo-save-as" }
+};
+
+static GtkToggleActionEntry memo_toggle_entries[] = {
+
+ { "memo-preview",
+ NULL,
+ N_("Memo _Preview"),
+ "<Control>m",
+ N_("Show memo preview pane"),
+ G_CALLBACK (action_memo_preview_cb),
+ TRUE }
+};
+
+static GtkRadioActionEntry memo_filter_entries[] = {
+
+ { "memo-filter-any-category",
+ NULL,
+ N_("Any Category"),
+ NULL,
+ NULL,
+ MEMO_FILTER_ANY_CATEGORY },
+
+ { "memo-filter-unmatched",
+ NULL,
+ N_("Unmatched"),
+ NULL,
+ NULL,
+ MEMO_FILTER_UNMATCHED }
+};
+
+static GtkRadioActionEntry memo_search_entries[] = {
+
+ { "memo-search-any-field-contains",
+ NULL,
+ N_("Any field contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MEMO_SEARCH_ANY_FIELD_CONTAINS },
+
+ { "memo-search-description-contains",
+ NULL,
+ N_("Description contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MEMO_SEARCH_DESCRIPTION_CONTAINS },
+
+ { "memo-search-summary-contains",
+ NULL,
+ N_("Summary contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MEMO_SEARCH_SUMMARY_CONTAINS }
+};
+
+static GtkActionEntry lockdown_printing_entries[] = {
+
+ { "memo-list-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ "<Control>p",
+ N_("Print the list of memos"),
+ G_CALLBACK (action_memo_list_print_cb) },
+
+ { "memo-list-print-preview",
+ GTK_STOCK_PRINT_PREVIEW,
+ NULL,
+ NULL,
+ N_("Preview the list of memos to be printed"),
+ G_CALLBACK (action_memo_list_print_preview_cb) },
+
+ { "memo-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ NULL,
+ N_("Print the selected memo"),
+ G_CALLBACK (action_memo_print_cb) }
+};
+
+static EPopupActionEntry lockdown_printing_popup_entries[] = {
+
+ { "memo-popup-print",
+ NULL,
+ "memo-print" }
+};
+
+void
+e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+ GConfBridge *bridge;
+ GtkAction *action;
+ GObject *object;
+ const gchar *key;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ /* Memo Actions */
+ action_group = ACTION_GROUP (MEMOS);
+ gtk_action_group_add_actions (
+ action_group, memo_entries,
+ G_N_ELEMENTS (memo_entries), memo_shell_view);
+ e_action_group_add_popup_actions (
+ action_group, memo_popup_entries,
+ G_N_ELEMENTS (memo_popup_entries));
+ gtk_action_group_add_toggle_actions (
+ action_group, memo_toggle_entries,
+ G_N_ELEMENTS (memo_toggle_entries), memo_shell_view);
+ gtk_action_group_add_radio_actions (
+ action_group, memo_search_entries,
+ G_N_ELEMENTS (memo_search_entries),
+ MEMO_SEARCH_SUMMARY_CONTAINS,
+ NULL, NULL);
+
+ /* Lockdown Printing Actions */
+ action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
+ gtk_action_group_add_actions (
+ action_group, lockdown_printing_entries,
+ G_N_ELEMENTS (lockdown_printing_entries), memo_shell_view);
+ e_action_group_add_popup_actions (
+ action_group, lockdown_printing_popup_entries,
+ G_N_ELEMENTS (lockdown_printing_popup_entries));
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (ACTION (MEMO_PREVIEW));
+ key = "/apps/evolution/calendar/display/show_memo_preview";
+ gconf_bridge_bind_property (bridge, key, object, "active");
+
+ /* Fine tuning. */
+
+ action = ACTION (MEMO_DELETE);
+ g_object_set (action, "short-label", _("Delete"), NULL);
+
+ g_signal_connect (
+ ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
+ G_CALLBACK (action_gal_save_custom_view_cb), memo_shell_view);
+
+ g_signal_connect (
+ ACTION (SEARCH_EXECUTE), "activate",
+ G_CALLBACK (action_search_execute_cb), memo_shell_view);
+}
+
+void
+e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view)
+{
+ EShellContent *shell_content;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ GtkActionGroup *action_group;
+ GtkRadioAction *radio_action;
+ GList *list, *iter;
+ GSList *group;
+ gint ii;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ action_group = ACTION_GROUP (MEMOS_FILTER);
+ e_action_group_remove_all_actions (action_group);
+
+ /* Add the standard filter actions. */
+ gtk_action_group_add_radio_actions (
+ action_group, memo_filter_entries,
+ G_N_ELEMENTS (memo_filter_entries),
+ MEMO_FILTER_ANY_CATEGORY,
+ G_CALLBACK (action_search_filter_cb),
+ memo_shell_view);
+
+ /* Retrieve the radio group from an action we just added. */
+ list = gtk_action_group_list_actions (action_group);
+ radio_action = GTK_RADIO_ACTION (list->data);
+ group = gtk_radio_action_get_group (radio_action);
+ g_list_free (list);
+
+ /* Build the category actions. */
+
+ list = e_categories_get_list ();
+ for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
+ const gchar *category_name = iter->data;
+ const gchar *filename;
+ GtkAction *action;
+ gchar *action_name;
+
+ action_name = g_strdup_printf (
+ "memo-filter-category-%d", ii);
+ radio_action = gtk_radio_action_new (
+ action_name, category_name, NULL, NULL, ii);
+ g_free (action_name);
+
+ /* Convert the category icon file to a themed icon name. */
+ filename = e_categories_get_icon_file_for (category_name);
+ if (filename != NULL && *filename != '\0') {
+ gchar *basename;
+ gchar *cp;
+
+ basename = g_path_get_basename (filename);
+
+ /* Lose the file extension. */
+ if ((cp = strrchr (basename, '.')) != NULL)
+ *cp = '\0';
+
+ g_object_set (
+ radio_action, "icon-name", basename, NULL);
+
+ g_free (basename);
+ }
+
+ gtk_radio_action_set_group (radio_action, group);
+ group = gtk_radio_action_get_group (radio_action);
+
+ /* The action group takes ownership of the action. */
+ action = GTK_ACTION (radio_action);
+ gtk_action_group_add_action (action_group, action);
+ g_object_unref (radio_action);
+ }
+ g_list_free (list);
+
+ /* Use any action in the group; doesn't matter which. */
+ e_shell_content_set_filter_action (shell_content, radio_action);
+
+ ii = MEMO_FILTER_UNMATCHED;
+ e_shell_content_add_filter_separator_after (shell_content, ii);
+}
diff --git a/calendar/module/e-memo-shell-view-actions.h b/calendar/module/e-memo-shell-view-actions.h
new file mode 100644
index 0000000000..d6fd3ca514
--- /dev/null
+++ b/calendar/module/e-memo-shell-view-actions.h
@@ -0,0 +1,87 @@
+/*
+ * e-memo-shell-view-actions.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MEMO_SHELL_VIEW_ACTIONS_H
+#define E_MEMO_SHELL_VIEW_ACTIONS_H
+
+#include <shell/e-shell-window-actions.h>
+
+/* Memo Actions */
+#define E_SHELL_WINDOW_ACTION_MEMO_CLIPBOARD_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-clipboard-copy")
+#define E_SHELL_WINDOW_ACTION_MEMO_CLIPBOARD_CUT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-clipboard-cut")
+#define E_SHELL_WINDOW_ACTION_MEMO_CLIPBOARD_PASTE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-clipboard-paste")
+#define E_SHELL_WINDOW_ACTION_MEMO_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-delete")
+#define E_SHELL_WINDOW_ACTION_MEMO_FORWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-forward")
+#define E_SHELL_WINDOW_ACTION_MEMO_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-new")
+#define E_SHELL_WINDOW_ACTION_MEMO_OPEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-open")
+#define E_SHELL_WINDOW_ACTION_MEMO_OPEN_URL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-open-url")
+#define E_SHELL_WINDOW_ACTION_MEMO_PREVIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-preview")
+#define E_SHELL_WINDOW_ACTION_MEMO_PRINT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-print")
+#define E_SHELL_WINDOW_ACTION_MEMO_SAVE_AS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-save-as")
+
+/* Memo List Actions */
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-list-copy")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-list-delete")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-list-new")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_PRINT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-list-print")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_PRINT_PREVIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-list-print-preview")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_PROPERTIES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-list-properties")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_RENAME(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-list-rename")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_SELECT_ONE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-list-select-one")
+
+/* Memo Query Actions */
+#define E_SHELL_WINDOW_ACTION_MEMO_FILTER_ANY_CATEGORY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-filter-any-category")
+#define E_SHELL_WINDOW_ACTION_MEMO_FILTER_UNMATCHED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-filter-unmatched")
+#define E_SHELL_WINDOW_ACTION_MEMO_SEARCH_ANY_FIELD_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-search-any-field-contains")
+#define E_SHELL_WINDOW_ACTION_MEMO_SEARCH_DESCRIPTION_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-search-description-contains")
+#define E_SHELL_WINDOW_ACTION_MEMO_SEARCH_SUMMARY_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "memo-search-summary-contains")
+
+/* Action Groups */
+#define E_SHELL_WINDOW_ACTION_GROUP_MEMOS(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "memos")
+#define E_SHELL_WINDOW_ACTION_GROUP_MEMOS_FILTER(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "memos-filter")
+
+#endif /* E_MEMO_SHELL_VIEW_ACTIONS_H */
diff --git a/calendar/module/e-memo-shell-view-private.c b/calendar/module/e-memo-shell-view-private.c
new file mode 100644
index 0000000000..69d6c0afe2
--- /dev/null
+++ b/calendar/module/e-memo-shell-view-private.c
@@ -0,0 +1,524 @@
+/*
+ * e-memo-shell-view-private.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-memo-shell-view-private.h"
+
+#include "widgets/menus/gal-view-factory-etable.h"
+
+static void
+memo_shell_view_table_popup_event_cb (EShellView *shell_view,
+ GdkEventButton *event)
+{
+ const gchar *widget_path;
+
+ widget_path = "/memo-popup";
+ e_shell_view_show_popup_menu (shell_view, widget_path, event);
+}
+
+static void
+memo_shell_view_table_user_created_cb (EMemoShellView *memo_shell_view,
+ EMemoTable *memo_table)
+{
+ EMemoShellSidebar *memo_shell_sidebar;
+ ECalModel *model;
+ ECal *client;
+ ESource *source;
+
+ /* This is the "Click to Add" handler. */
+
+ model = e_memo_table_get_model (memo_table);
+ client = e_cal_model_get_default_client (model);
+ source = e_cal_get_source (client);
+
+ memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
+ e_memo_shell_sidebar_add_source (memo_shell_sidebar, source);
+
+ e_cal_model_add_client (model, client);
+}
+
+static void
+memo_shell_view_selector_client_added_cb (EMemoShellView *memo_shell_view,
+ ECal *client)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+ ECalModel *model;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ model = e_memo_table_get_model (memo_table);
+
+ e_cal_model_add_client (model, client);
+}
+
+static void
+memo_shell_view_selector_client_removed_cb (EMemoShellView *memo_shell_view,
+ ECal *client)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoTable *memo_table;
+ ECalModel *model;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ model = e_memo_table_get_model (memo_table);
+
+ e_cal_model_remove_client (model, client);
+}
+
+static gboolean
+memo_shell_view_selector_popup_event_cb (EShellView *shell_view,
+ ESource *primary_source,
+ GdkEventButton *event)
+{
+ const gchar *widget_path;
+
+ widget_path = "/memo-list-popup";
+ e_shell_view_show_popup_menu (shell_view, widget_path, event);
+
+ return TRUE;
+}
+
+static void
+memo_shell_view_load_view_collection (EShellViewClass *shell_view_class)
+{
+ GalViewCollection *collection;
+ GalViewFactory *factory;
+ ETableSpecification *spec;
+ const gchar *base_dir;
+ gchar *filename;
+
+ collection = shell_view_class->view_collection;
+
+ base_dir = EVOLUTION_ETSPECDIR;
+ spec = e_table_specification_new ();
+ filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
+ if (!e_table_specification_load_from_file (spec, filename))
+ g_critical ("Unable to load ETable specification file "
+ "for memos");
+ g_free (filename);
+
+ factory = gal_view_factory_etable_new (spec);
+ gal_view_collection_add_factory (collection, factory);
+ g_object_unref (factory);
+ g_object_unref (spec);
+
+ gal_view_collection_load (collection);
+}
+
+static void
+memo_shell_view_notify_view_id_cb (EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ GalViewInstance *view_instance;
+ const gchar *view_id;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ view_instance =
+ e_memo_shell_content_get_view_instance (memo_shell_content);
+ view_id = e_shell_view_get_view_id (E_SHELL_VIEW (memo_shell_view));
+
+ /* A NULL view ID implies we're in a custom view. But you can
+ * only get to a custom view via the "Define Views" dialog, which
+ * would have already modified the view instance appropriately.
+ * Furthermore, there's no way to refer to a custom view by ID
+ * anyway, since custom views have no IDs. */
+ if (view_id == NULL)
+ return;
+
+ gal_view_instance_set_current_view_id (view_instance, view_id);
+}
+
+void
+e_memo_shell_view_private_init (EMemoShellView *memo_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ if (!gal_view_collection_loaded (shell_view_class->view_collection))
+ memo_shell_view_load_view_collection (shell_view_class);
+
+ g_signal_connect (
+ memo_shell_view, "notify::view-id",
+ G_CALLBACK (memo_shell_view_notify_view_id_cb), NULL);
+}
+
+void
+e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
+{
+ EMemoShellViewPrivate *priv = memo_shell_view->priv;
+ EMemoShellContent *memo_shell_content;
+ EMemoShellSidebar *memo_shell_sidebar;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellWindow *shell_window;
+ EMemoTable *memo_table;
+ ECalModel *model;
+ ETable *table;
+ ESourceSelector *selector;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ e_shell_window_add_action_group (shell_window, "memos");
+ e_shell_window_add_action_group (shell_window, "memos-filter");
+
+ /* Cache these to avoid lots of awkward casting. */
+ priv->memo_shell_backend = g_object_ref (shell_backend);
+ priv->memo_shell_content = g_object_ref (shell_content);
+ priv->memo_shell_sidebar = g_object_ref (shell_sidebar);
+
+ memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content);
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ model = e_memo_table_get_model (memo_table);
+ table = e_memo_table_get_table (memo_table);
+
+ memo_shell_sidebar = E_MEMO_SHELL_SIDEBAR (shell_sidebar);
+ selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+
+ g_signal_connect_swapped (
+ memo_table, "open-component",
+ G_CALLBACK (e_memo_shell_view_open_memo),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ memo_table, "popup-event",
+ G_CALLBACK (memo_shell_view_table_popup_event_cb),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ memo_table, "status-message",
+ G_CALLBACK (e_memo_shell_view_set_status_message),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ memo_table, "user-created",
+ G_CALLBACK (memo_shell_view_table_user_created_cb),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ model, "model-changed",
+ G_CALLBACK (e_memo_shell_view_update_sidebar),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ model, "model-rows-deleted",
+ G_CALLBACK (e_memo_shell_view_update_sidebar),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ model, "model-rows-inserted",
+ G_CALLBACK (e_memo_shell_view_update_sidebar),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ table, "selection-change",
+ G_CALLBACK (e_memo_shell_view_update_sidebar),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ memo_shell_sidebar, "client-added",
+ G_CALLBACK (memo_shell_view_selector_client_added_cb),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ memo_shell_sidebar, "client-removed",
+ G_CALLBACK (memo_shell_view_selector_client_removed_cb),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ memo_shell_sidebar, "status-message",
+ G_CALLBACK (e_memo_shell_view_set_status_message),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ selector, "popup-event",
+ G_CALLBACK (memo_shell_view_selector_popup_event_cb),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
+ selector, "primary-selection-changed",
+ G_CALLBACK (e_shell_view_update_actions),
+ memo_shell_view);
+
+ e_categories_register_change_listener (
+ G_CALLBACK (e_memo_shell_view_update_search_filter),
+ memo_shell_view);
+
+ e_memo_shell_view_actions_init (memo_shell_view);
+ e_memo_shell_view_update_sidebar (memo_shell_view);
+ e_memo_shell_view_update_search_filter (memo_shell_view);
+
+ e_memo_shell_view_execute_search (memo_shell_view);
+}
+
+void
+e_memo_shell_view_private_dispose (EMemoShellView *memo_shell_view)
+{
+ EMemoShellViewPrivate *priv = memo_shell_view->priv;
+
+ DISPOSE (priv->memo_shell_backend);
+ DISPOSE (priv->memo_shell_content);
+ DISPOSE (priv->memo_shell_sidebar);
+
+ if (memo_shell_view->priv->activity != NULL) {
+ /* XXX Activity is not cancellable. */
+ e_activity_complete (memo_shell_view->priv->activity);
+ g_object_unref (memo_shell_view->priv->activity);
+ memo_shell_view->priv->activity = NULL;
+ }
+}
+
+void
+e_memo_shell_view_private_finalize (EMemoShellView *memo_shell_view)
+{
+ /* XXX Nothing to do? */
+}
+
+void
+e_memo_shell_view_execute_search (EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellContent *shell_content;
+ GtkAction *action;
+ GString *string;
+ ECalComponentPreview *memo_preview;
+ EMemoTable *memo_table;
+ ECalModel *model;
+ FilterRule *rule;
+ const gchar *format;
+ const gchar *text;
+ gchar *query;
+ gchar *temp;
+ gint value;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ text = e_shell_content_get_search_text (shell_content);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ action = ACTION (MEMO_SEARCH_ANY_FIELD_CONTAINS);
+ value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
+
+ if (text == NULL || *text == '\0') {
+ text = "";
+ value = MEMO_SEARCH_SUMMARY_CONTAINS;
+ }
+
+ switch (value) {
+ default:
+ text = "";
+ /* fall through */
+
+ case MEMO_SEARCH_SUMMARY_CONTAINS:
+ format = "(contains? \"summary\" %s)";
+ break;
+
+ case MEMO_SEARCH_DESCRIPTION_CONTAINS:
+ format = "(contains? \"description\" %s)";
+ break;
+
+ case MEMO_SEARCH_ANY_FIELD_CONTAINS:
+ format = "(contains? \"any\" %s)";
+ break;
+ }
+
+ /* Build the query. */
+ string = g_string_new ("");
+ e_sexp_encode_string (string, text);
+ query = g_strdup_printf (format, string->str);
+ g_string_free (string, TRUE);
+
+ /* Apply selected filter. */
+ value = e_shell_content_get_filter_value (shell_content);
+ switch (value) {
+ case MEMO_FILTER_ANY_CATEGORY:
+ break;
+
+ case MEMO_FILTER_UNMATCHED:
+ temp = g_strdup_printf (
+ "(and (has-categories? #f) %s", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ default:
+ {
+ GList *categories;
+ const gchar *category_name;
+
+ categories = e_categories_get_list ();
+ category_name = g_list_nth_data (categories, value);
+ g_list_free (categories);
+
+ temp = g_strdup_printf (
+ "(and (has-categories? \"%s\") %s)",
+ category_name, query);
+ g_free (query);
+ query = temp;
+ }
+ }
+
+ /* XXX This is wrong. We need to programmatically construct a
+ * FilterRule, tell it to build code, and pass the resulting
+ * expression string to ECalModel. */
+ rule = filter_rule_new ();
+ e_shell_content_set_search_rule (shell_content, rule);
+ g_object_unref (rule);
+
+ /* Submit the query. */
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+ model = e_memo_table_get_model (memo_table);
+ e_cal_model_set_search_query (model, query);
+ g_free (query);
+
+ memo_preview =
+ e_memo_shell_content_get_memo_preview (memo_shell_content);
+ e_cal_component_preview_clear (memo_preview);
+}
+
+void
+e_memo_shell_view_open_memo (EMemoShellView *memo_shell_view,
+ ECalModelComponent *comp_data)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ const gchar *uid;
+
+ g_return_if_fail (E_IS_MEMO_SHELL_VIEW (memo_shell_view));
+ g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data));
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ editor = comp_editor_find_instance (uid);
+
+ if (editor != NULL)
+ goto exit;
+
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_component_set_icalcomponent (comp, clone);
+
+ if (e_cal_component_has_organizer (comp))
+ flags |= COMP_EDITOR_IS_SHARED;
+
+ if (itip_organizer_is_user (comp, comp_data->client))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ editor = memo_editor_new (comp_data->client, shell, flags);
+ comp_editor_edit_comp (editor, comp);
+
+ g_object_unref (comp);
+
+exit:
+ gtk_window_present (GTK_WINDOW (editor));
+}
+
+void
+e_memo_shell_view_set_status_message (EMemoShellView *memo_shell_view,
+ const gchar *status_message,
+ gdouble percent)
+{
+ EActivity *activity;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+
+ g_return_if_fail (E_IS_MEMO_SHELL_VIEW (memo_shell_view));
+
+ activity = memo_shell_view->priv->activity;
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ if (status_message == NULL || *status_message == '\0') {
+ if (activity != NULL) {
+ e_activity_complete (activity);
+ g_object_unref (activity);
+ activity = NULL;
+ }
+
+ } else if (activity == NULL) {
+ activity = e_activity_new (status_message);
+ e_activity_set_percent (activity, percent);
+ e_shell_backend_add_activity (shell_backend, activity);
+
+ } else {
+ e_activity_set_percent (activity, percent);
+ e_activity_set_primary_text (activity, status_message);
+ }
+
+ memo_shell_view->priv->activity = activity;
+}
+
+void
+e_memo_shell_view_update_sidebar (EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EShellView *shell_view;
+ EShellSidebar *shell_sidebar;
+ EMemoTable *memo_table;
+ ECalModel *model;
+ ETable *table;
+ GString *string;
+ const gchar *format;
+ gint n_rows;
+ gint n_selected;
+
+ shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
+ model = e_memo_table_get_model (memo_table);
+ table = e_memo_table_get_table (memo_table);
+
+ n_rows = e_table_model_row_count (E_TABLE_MODEL (model));
+ n_selected = e_table_selected_count (table);
+
+ string = g_string_sized_new (64);
+
+ format = ngettext ("%d memo", "%d memos", n_rows);
+ g_string_append_printf (string, format, n_rows);
+
+ if (n_selected > 0) {
+ format = _("%d selected");
+ g_string_append_len (string, ", ", 2);
+ g_string_append_printf (string, format, n_selected);
+ }
+
+ e_shell_sidebar_set_secondary_text (shell_sidebar, string->str);
+
+ g_string_free (string, TRUE);
+}
diff --git a/calendar/module/e-memo-shell-view-private.h b/calendar/module/e-memo-shell-view-private.h
new file mode 100644
index 0000000000..c41eaed7c0
--- /dev/null
+++ b/calendar/module/e-memo-shell-view-private.h
@@ -0,0 +1,126 @@
+/*
+ * e-memo-shell-view-private.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MEMO_SHELL_VIEW_PRIVATE_H
+#define E_MEMO_SHELL_VIEW_PRIVATE_H
+
+#include "e-memo-shell-view.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <libedataserver/e-categories.h>
+#include <libedataserver/e-sexp.h>
+
+#include "e-util/e-dialog-utils.h"
+#include "e-util/e-error.h"
+#include "e-util/e-util.h"
+#include "e-util/gconf-bridge.h"
+#include "widgets/misc/e-popup-action.h"
+
+#include "calendar/gui/comp-util.h"
+#include "calendar/gui/e-cal-component-preview.h"
+#include "calendar/gui/e-calendar-selector.h"
+#include "calendar/gui/print.h"
+#include "calendar/gui/dialogs/calendar-setup.h"
+#include "calendar/gui/dialogs/copy-source-dialog.h"
+#include "calendar/gui/dialogs/memo-editor.h"
+
+#include "e-memo-shell-backend.h"
+#include "e-memo-shell-content.h"
+#include "e-memo-shell-sidebar.h"
+#include "e-memo-shell-view-actions.h"
+
+#define E_MEMO_SHELL_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEMO_SHELL_VIEW, EMemoShellViewPrivate))
+
+/* Shorthand, requires a variable named "shell_window". */
+#define ACTION(name) \
+ (E_SHELL_WINDOW_ACTION_##name (shell_window))
+#define ACTION_GROUP(name) \
+ (E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window))
+
+/* For use in dispose() methods. */
+#define DISPOSE(obj) \
+ G_STMT_START { \
+ if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \
+ } G_STMT_END
+
+/* ETable Specifications */
+#define ETSPEC_FILENAME "e-memo-table.etspec"
+
+G_BEGIN_DECLS
+
+/* Filter items are displayed in ascending order.
+ * Non-negative values are reserved for categories. */
+enum {
+ MEMO_FILTER_ANY_CATEGORY = -2,
+ MEMO_FILTER_UNMATCHED = -1
+};
+
+/* Search items are displayed in ascending order. */
+enum {
+ MEMO_SEARCH_SUMMARY_CONTAINS,
+ MEMO_SEARCH_DESCRIPTION_CONTAINS,
+ MEMO_SEARCH_ANY_FIELD_CONTAINS
+};
+
+struct _EMemoShellViewPrivate {
+
+ /* These are just for convenience. */
+ EMemoShellBackend *memo_shell_backend;
+ EMemoShellContent *memo_shell_content;
+ EMemoShellSidebar *memo_shell_sidebar;
+
+ EActivity *activity;
+};
+
+void e_memo_shell_view_private_init
+ (EMemoShellView *memo_shell_view,
+ EShellViewClass *shell_view_class);
+void e_memo_shell_view_private_constructed
+ (EMemoShellView *memo_shell_view);
+void e_memo_shell_view_private_dispose
+ (EMemoShellView *memo_shell_view);
+void e_memo_shell_view_private_finalize
+ (EMemoShellView *memo_shell_view);
+
+/* Private Utilities */
+
+void e_memo_shell_view_actions_init
+ (EMemoShellView *memo_shell_view);
+void e_memo_shell_view_execute_search
+ (EMemoShellView *memo_shell_view);
+void e_memo_shell_view_open_memo
+ (EMemoShellView *memo_shell_view,
+ ECalModelComponent *comp_data);
+void e_memo_shell_view_set_status_message
+ (EMemoShellView *memo_shell_view,
+ const gchar *status_message,
+ gdouble percent);
+void e_memo_shell_view_update_sidebar
+ (EMemoShellView *memo_shell_view);
+void e_memo_shell_view_update_search_filter
+ (EMemoShellView *memo_shell_view);
+
+G_END_DECLS
+
+#endif /* E_MEMO_SHELL_VIEW_PRIVATE_H */
diff --git a/calendar/module/e-memo-shell-view.c b/calendar/module/e-memo-shell-view.c
new file mode 100644
index 0000000000..e2964b061c
--- /dev/null
+++ b/calendar/module/e-memo-shell-view.c
@@ -0,0 +1,222 @@
+/*
+ * e-memo-shell-view.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-memo-shell-view-private.h"
+
+static gpointer parent_class;
+static GType memo_shell_view_type;
+
+static void
+memo_shell_view_dispose (GObject *object)
+{
+ e_memo_shell_view_private_dispose (E_MEMO_SHELL_VIEW (object));
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+memo_shell_view_finalize (GObject *object)
+{
+ e_memo_shell_view_private_finalize (E_MEMO_SHELL_VIEW (object));
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+memo_shell_view_constructed (GObject *object)
+{
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ e_memo_shell_view_private_constructed (E_MEMO_SHELL_VIEW (object));
+}
+
+static void
+memo_shell_view_update_actions (EShellView *shell_view)
+{
+ EMemoShellViewPrivate *priv;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellWindow *shell_window;
+ GtkAction *action;
+ const gchar *label;
+ gboolean sensitive;
+ guint32 state;
+
+ /* Be descriptive. */
+ gboolean any_memos_selected;
+ gboolean has_primary_source;
+ gboolean multiple_memos_selected;
+ gboolean primary_source_is_system;
+ gboolean selection_has_url;
+ gboolean single_memo_selected;
+ gboolean sources_are_editable;
+
+ priv = E_MEMO_SHELL_VIEW_GET_PRIVATE (shell_view);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ state = e_shell_content_check_state (shell_content);
+
+ single_memo_selected =
+ (state & E_MEMO_SHELL_CONTENT_SELECTION_SINGLE);
+ multiple_memos_selected =
+ (state & E_MEMO_SHELL_CONTENT_SELECTION_MULTIPLE);
+ sources_are_editable =
+ (state & E_MEMO_SHELL_CONTENT_SELECTION_CAN_EDIT);
+ selection_has_url =
+ (state & E_MEMO_SHELL_CONTENT_SELECTION_HAS_URL);
+
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ state = e_shell_sidebar_check_state (shell_sidebar);
+
+ has_primary_source =
+ (state & E_MEMO_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE);
+ primary_source_is_system =
+ (state & E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM);
+
+ any_memos_selected =
+ (single_memo_selected || multiple_memos_selected);
+
+ action = ACTION (MEMO_CLIPBOARD_COPY);
+ sensitive = any_memos_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_CLIPBOARD_CUT);
+ sensitive = any_memos_selected && sources_are_editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_CLIPBOARD_PASTE);
+ sensitive = sources_are_editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_DELETE);
+ sensitive = any_memos_selected && sources_are_editable;
+ gtk_action_set_sensitive (action, sensitive);
+ if (multiple_memos_selected)
+ label = _("Delete Memos");
+ else
+ label = _("Delete Memo");
+ g_object_set (action, "label", label, NULL);
+
+ action = ACTION (MEMO_FORWARD);
+ sensitive = single_memo_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_LIST_COPY);
+ sensitive = has_primary_source;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_LIST_DELETE);
+ sensitive = has_primary_source && !primary_source_is_system;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_LIST_PROPERTIES);
+ sensitive = has_primary_source;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_LIST_RENAME);
+ sensitive = has_primary_source;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_OPEN);
+ sensitive = single_memo_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_OPEN_URL);
+ sensitive = single_memo_selected && selection_has_url;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_PRINT);
+ sensitive = single_memo_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MEMO_SAVE_AS);
+ sensitive = single_memo_selected;
+ gtk_action_set_sensitive (action, sensitive);
+}
+
+static void
+memo_shell_view_class_init (EMemoShellViewClass *class,
+ GTypeModule *type_module)
+{
+ GObjectClass *object_class;
+ EShellViewClass *shell_view_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMemoShellViewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = memo_shell_view_dispose;
+ object_class->finalize = memo_shell_view_finalize;
+ object_class->constructed = memo_shell_view_constructed;
+
+ shell_view_class = E_SHELL_VIEW_CLASS (class);
+ shell_view_class->label = _("Memos");
+ shell_view_class->icon_name = "evolution-memos";
+ shell_view_class->ui_definition = "evolution-memos.ui";
+ shell_view_class->ui_manager_id = "org.gnome.evolution.memos";
+ shell_view_class->search_options = "/memo-search-options";
+ shell_view_class->search_rules = "memotypes.xml";
+ shell_view_class->new_shell_content = e_memo_shell_content_new;
+ shell_view_class->new_shell_sidebar = e_memo_shell_sidebar_new;
+ shell_view_class->update_actions = memo_shell_view_update_actions;
+}
+
+static void
+memo_shell_view_init (EMemoShellView *memo_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ memo_shell_view->priv =
+ E_MEMO_SHELL_VIEW_GET_PRIVATE (memo_shell_view);
+
+ e_memo_shell_view_private_init (memo_shell_view, shell_view_class);
+}
+
+GType
+e_memo_shell_view_get_type (void)
+{
+ return memo_shell_view_type;
+}
+
+void
+e_memo_shell_view_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (EMemoShellViewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) memo_shell_view_class_init,
+ (GClassFinalizeFunc) NULL,
+ type_module,
+ sizeof (EMemoShellView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) memo_shell_view_init,
+ NULL /* value_table */
+ };
+
+ memo_shell_view_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_VIEW,
+ "EMemoShellView", &type_info, 0);
+}
diff --git a/calendar/module/e-memo-shell-view.h b/calendar/module/e-memo-shell-view.h
new file mode 100644
index 0000000000..686ae734c9
--- /dev/null
+++ b/calendar/module/e-memo-shell-view.h
@@ -0,0 +1,67 @@
+/*
+ * e-memo-shell-view.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MEMO_SHELL_VIEW_H
+#define E_MEMO_SHELL_VIEW_H
+
+#include <shell/e-shell-view.h>
+#include <libedataserver/e-source-list.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MEMO_SHELL_VIEW \
+ (e_memo_shell_view_get_type ())
+#define E_MEMO_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MEMO_SHELL_VIEW, EMemoShellView))
+#define E_MEMO_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MEMO_SHELL_VIEW, EMemoShellViewClass))
+#define E_IS_MEMO_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MEMO_SHELL_VIEW))
+#define E_IS_MEMO_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MEMO_SHELL_VIEW))
+#define E_MEMO_SHELL_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MEMO_SHELL_VIEW, EMemoShellViewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMemoShellView EMemoShellView;
+typedef struct _EMemoShellViewClass EMemoShellViewClass;
+typedef struct _EMemoShellViewPrivate EMemoShellViewPrivate;
+
+struct _EMemoShellView {
+ EShellView parent;
+ EMemoShellViewPrivate *priv;
+};
+
+struct _EMemoShellViewClass {
+ EShellViewClass parent_class;
+};
+
+GType e_memo_shell_view_get_type (void);
+void e_memo_shell_view_register_type (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_MEMO_SHELL_VIEW_H */
diff --git a/calendar/module/e-task-shell-backend.c b/calendar/module/e-task-shell-backend.c
new file mode 100644
index 0000000000..6bded3e412
--- /dev/null
+++ b/calendar/module/e-task-shell-backend.c
@@ -0,0 +1,621 @@
+/*
+ * e-task-shell-backend.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-task-shell-backend.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <libecal/e-cal.h>
+#include <libedataserver/e-url.h>
+#include <libedataserver/e-source.h>
+#include <libedataserver/e-source-list.h>
+#include <libedataserver/e-source-group.h>
+
+#include "shell/e-shell.h"
+#include "shell/e-shell-backend.h"
+#include "shell/e-shell-window.h"
+
+#include "calendar/common/authentication.h"
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/comp-util.h"
+#include "calendar/gui/dialogs/calendar-setup.h"
+#include "calendar/gui/dialogs/task-editor.h"
+
+#include "e-task-shell-content.h"
+#include "e-task-shell-migrate.h"
+#include "e-task-shell-sidebar.h"
+#include "e-task-shell-view.h"
+
+#define E_TASK_SHELL_BACKEND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackendPrivate))
+
+#define WEB_BASE_URI "webcal://"
+#define PERSONAL_RELATIVE_URI "system"
+
+struct _ETaskShellBackendPrivate {
+ ESourceList *source_list;
+};
+
+enum {
+ PROP_0,
+ PROP_SOURCE_LIST
+};
+
+static gpointer parent_class;
+static GType task_shell_backend_type;
+
+static void
+task_module_ensure_sources (EShellBackend *shell_backend)
+{
+ /* XXX This is basically the same algorithm across all modules.
+ * Maybe we could somehow integrate this into EShellBackend? */
+
+ ETaskShellBackendPrivate *priv;
+ ESourceGroup *on_this_computer;
+ ESourceGroup *on_the_web;
+ ESource *personal;
+ GSList *groups, *iter;
+ const gchar *data_dir;
+ const gchar *name;
+ gchar *base_uri;
+ gchar *filename;
+
+ on_this_computer = NULL;
+ on_the_web = NULL;
+ personal = NULL;
+
+ priv = E_TASK_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+
+ if (!e_cal_get_sources (&priv->source_list, E_CAL_SOURCE_TYPE_TODO, NULL)) {
+ g_warning ("Could not get task sources from GConf!");
+ return;
+ }
+
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ filename = g_build_filename (data_dir, "local", NULL);
+ base_uri = g_filename_to_uri (filename, NULL, NULL);
+ g_free (filename);
+
+ groups = e_source_list_peek_groups (priv->source_list);
+ for (iter = groups; iter != NULL; iter = iter->next) {
+ ESourceGroup *source_group = iter->data;
+ const gchar *group_base_uri;
+
+ group_base_uri = e_source_group_peek_base_uri (source_group);
+
+ /* Compare only "file://" part. If the user's home
+ * changes, we do not want to create another group. */
+ if (on_this_computer == NULL &&
+ strncmp (base_uri, group_base_uri, 7) == 0)
+ on_this_computer = source_group;
+
+ else if (on_the_web == NULL &&
+ strcmp (WEB_BASE_URI, group_base_uri) == 0)
+ on_the_web = source_group;
+ }
+
+ name = _("On This Computer");
+
+ if (on_this_computer != NULL) {
+ GSList *sources;
+ const gchar *group_base_uri;
+
+ /* Force the group name to the current locale. */
+ e_source_group_set_name (on_this_computer, name);
+
+ sources = e_source_group_peek_sources (on_this_computer);
+ group_base_uri = e_source_group_peek_base_uri (on_this_computer);
+
+ /* Make sure this group includes a "Personal" source. */
+ for (iter = sources; iter != NULL; iter = iter->next) {
+ ESource *source = iter->data;
+ const gchar *relative_uri;
+
+ relative_uri = e_source_peek_relative_uri (source);
+ if (relative_uri == NULL)
+ continue;
+
+ if (strcmp (PERSONAL_RELATIVE_URI, relative_uri) != 0)
+ continue;
+
+ personal = source;
+ break;
+ }
+
+ /* Make sure we have the correct base URI. This can
+ * change when the user's home directory changes. */
+ if (strcmp (base_uri, group_base_uri) != 0) {
+ e_source_group_set_base_uri (
+ on_this_computer, base_uri);
+
+ /* XXX We shouldn't need this sync call here as
+ * set_base_uri() results in synching to GConf,
+ * but that happens in an idle loop and too late
+ * to prevent the user from seeing a "Cannot
+ * Open ... because of invalid URI" error. */
+ e_source_list_sync (priv->source_list, NULL);
+ }
+
+ } else {
+ ESourceGroup *source_group;
+
+ source_group = e_source_group_new (name, base_uri);
+ e_source_list_add_group (priv->source_list, source_group, -1);
+ g_object_unref (source_group);
+ }
+
+ name = _("Personal");
+
+ if (personal == NULL) {
+ ESource *source;
+ GSList *selected;
+ gchar *primary;
+
+ source = e_source_new (name, PERSONAL_RELATIVE_URI);
+ e_source_group_add_source (on_this_computer, source, -1);
+ g_object_unref (source);
+
+ primary = calendar_config_get_primary_tasks ();
+ selected = calendar_config_get_tasks_selected ();
+
+ if (primary == NULL && selected == NULL) {
+ const gchar *uid;
+
+ uid = e_source_peek_uid (source);
+ selected = g_slist_prepend (NULL, g_strdup (uid));
+
+ calendar_config_set_primary_tasks (uid);
+ calendar_config_set_tasks_selected (selected);
+ }
+
+ g_slist_foreach (selected, (GFunc) g_free, NULL);
+ g_slist_free (selected);
+ g_free (primary);
+ } else {
+ /* Force the source name to the current locale. */
+ e_source_set_name (personal, name);
+ }
+
+ name = _("On The Web");
+
+ if (on_the_web == NULL) {
+ ESourceGroup *source_group;
+
+ source_group = e_source_group_new (name, WEB_BASE_URI);
+ e_source_list_add_group (priv->source_list, source_group, -1);
+ g_object_unref (source_group);
+ } else {
+ /* Force the group name to the current locale. */
+ e_source_group_set_name (on_the_web, name);
+ }
+
+ g_free (base_uri);
+}
+
+static void
+task_module_cal_opened_cb (ECal *cal,
+ ECalendarStatus status,
+ GtkAction *action)
+{
+ EShell *shell;
+ ECalComponent *comp;
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ const gchar *action_name;
+
+ /* FIXME Pass this in. */
+ shell = e_shell_get_default ();
+
+ /* XXX Handle errors better. */
+ if (status != E_CALENDAR_STATUS_OK)
+ return;
+
+ action_name = gtk_action_get_name (action);
+
+ flags |= COMP_EDITOR_NEW_ITEM;
+ if (strcmp (action_name, "task-assigned-new") == 0) {
+ flags |= COMP_EDITOR_IS_ASSIGNED;
+ flags |= COMP_EDITOR_USER_ORG;
+ }
+
+ editor = task_editor_new (cal, shell, flags);
+ comp = cal_comp_task_new_with_defaults (cal);
+ comp_editor_edit_comp (editor, comp);
+
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (comp);
+ g_object_unref (cal);
+}
+
+static void
+action_task_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ ECal *cal = NULL;
+ ECalSourceType source_type;
+ ESourceList *source_list;
+ gchar *uid;
+
+ /* This callback is used for both tasks and assigned tasks. */
+
+ source_type = E_CAL_SOURCE_TYPE_TODO;
+
+ if (!e_cal_get_sources (&source_list, source_type, NULL)) {
+ g_warning ("Could not get task sources from GConf!");
+ return;
+ }
+
+ uid = calendar_config_get_primary_tasks ();
+
+ if (uid != NULL) {
+ ESource *source;
+
+ source = e_source_list_peek_source_by_uid (source_list, uid);
+ if (source != NULL)
+ cal = auth_new_cal_from_source (source, source_type);
+ g_free (uid);
+ }
+
+ if (cal == NULL)
+ cal = auth_new_cal_from_default (source_type);
+
+ g_return_if_fail (cal != NULL);
+
+ g_signal_connect (
+ cal, "cal-opened",
+ G_CALLBACK (task_module_cal_opened_cb), action);
+
+ e_cal_open_async (cal, FALSE);
+}
+
+static void
+action_task_list_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ calendar_setup_new_task_list (GTK_WINDOW (shell_window));
+}
+
+static GtkActionEntry item_entries[] = {
+
+ { "task-new",
+ "stock_task",
+ NC_("New", "_Task"),
+ "<Shift><Control>t",
+ N_("Create a new task"),
+ G_CALLBACK (action_task_new_cb) },
+
+ { "task-assigned-new",
+ "stock_task",
+ N_("Assigne_d Task"),
+ NULL,
+ N_("Create a new assigned task"),
+ G_CALLBACK (action_task_new_cb) }
+};
+
+static GtkActionEntry source_entries[] = {
+
+ { "task-list-new",
+ "stock_todo",
+ NC_("New", "Tas_k List"),
+ NULL,
+ N_("Create a new task list"),
+ G_CALLBACK (action_task_list_new_cb) }
+};
+
+static gboolean
+task_module_handle_uri_cb (EShellBackend *shell_backend,
+ const gchar *uri)
+{
+ EShell *shell;
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ ECal *client;
+ ECalComponent *comp;
+ ESource *source;
+ ESourceList *source_list;
+ ECalSourceType source_type;
+ EUri *euri;
+ icalcomponent *icalcomp;
+ icalproperty *icalprop;
+ const gchar *cp;
+ gchar *source_uid = NULL;
+ gchar *comp_uid = NULL;
+ gchar *comp_rid = NULL;
+ gboolean handled = FALSE;
+ GError *error = NULL;
+
+ source_type = E_CAL_SOURCE_TYPE_TODO;
+ shell = e_shell_backend_get_shell (shell_backend);
+
+ if (strncmp (uri, "task:", 5) != 0)
+ return FALSE;
+
+ euri = e_uri_new (uri);
+ cp = euri->query;
+ if (cp == NULL)
+ goto exit;
+
+ while (*cp != '\0') {
+ gchar *header;
+ gchar *content;
+ gsize header_len;
+ gsize content_len;
+
+ header_len = strcspn (cp, "=&");
+
+ /* If it's malformed, give up. */
+ if (cp[header_len] != '=')
+ break;
+
+ header = (gchar *) cp;
+ header[header_len] = '\0';
+ cp += header_len + 1;
+
+ content_len = strcspn (cp, "&");
+
+ content = g_strndup (cp, content_len);
+ if (g_ascii_strcasecmp (header, "source-uid") == 0)
+ source_uid = g_strdup (content);
+ else if (g_ascii_strcasecmp (header, "comp-uid") == 0)
+ comp_uid = g_strdup (content);
+ else if (g_ascii_strcasecmp (header, "comp-rid") == 0)
+ comp_rid = g_strdup (content);
+ g_free (content);
+
+ cp += content_len;
+ if (*cp == '&') {
+ cp++;
+ if (strcmp (cp, "amp;") == 0)
+ cp += 4;
+ }
+ }
+
+ if (source_uid != NULL || comp_uid != NULL)
+ goto exit;
+
+ /* URI is valid, so consider it handled. Whether
+ * we successfully open it is another matter... */
+ handled = TRUE;
+
+ if (!e_cal_get_sources (&source_list, source_type, NULL)) {
+ g_printerr ("Could not get task sources from GConf!\n");
+ goto exit;
+ }
+
+ source = e_source_list_peek_source_by_uid (source_list, source_uid);
+ if (source == NULL) {
+ g_printerr ("No source for UID `%s'\n", source_uid);
+ g_object_unref (source_list);
+ goto exit;
+ }
+
+ client = auth_new_cal_from_source (source, source_type);
+ if (client == NULL || !e_cal_open (client, TRUE, &error)) {
+ g_printerr ("%s\n", error->message);
+ g_object_unref (source_list);
+ g_error_free (error);
+ goto exit;
+ }
+
+ /* XXX Copied from e_task_shell_view_open_task().
+ * Clearly a new utility function is needed. */
+
+ editor = comp_editor_find_instance (comp_uid);
+
+ if (editor != NULL)
+ goto present;
+
+ if (!e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, &error)) {
+ g_printerr ("%s\n", error->message);
+ g_object_unref (source_list);
+ g_error_free (error);
+ goto exit;
+ }
+
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomp);
+
+ icalprop = icalcomponent_get_first_property (
+ icalcomp, ICAL_ATTENDEE_PROPERTY);
+ if (icalprop != NULL)
+ flags |= COMP_EDITOR_IS_ASSIGNED;
+
+ if (itip_organizer_is_user (comp, client))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ if (!e_cal_component_has_attendees (comp))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ editor = task_editor_new (client, shell, flags);
+ comp_editor_edit_comp (editor, comp);
+
+ g_object_unref (comp);
+
+present:
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (source_list);
+ g_object_unref (client);
+
+exit:
+ g_free (source_uid);
+ g_free (comp_uid);
+ g_free (comp_rid);
+
+ e_uri_free (euri);
+
+ return handled;
+}
+
+static void
+task_module_window_created_cb (EShellBackend *shell_backend,
+ GtkWindow *window)
+{
+ const gchar *module_name;
+
+ if (!E_IS_SHELL_WINDOW (window))
+ return;
+
+ module_name = E_SHELL_BACKEND_GET_CLASS (shell_backend)->name;
+
+ e_shell_window_register_new_item_actions (
+ E_SHELL_WINDOW (window), module_name,
+ item_entries, G_N_ELEMENTS (item_entries));
+
+ e_shell_window_register_new_source_actions (
+ E_SHELL_WINDOW (window), module_name,
+ source_entries, G_N_ELEMENTS (source_entries));
+}
+
+static void
+task_shell_backend_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SOURCE_LIST:
+ g_value_set_object (
+ value,
+ e_task_shell_backend_get_source_list (
+ E_TASK_SHELL_BACKEND (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+task_shell_backend_dispose (GObject *object)
+{
+ ETaskShellBackendPrivate *priv;
+
+ priv = E_TASK_SHELL_BACKEND_GET_PRIVATE (object);
+
+ if (priv->source_list != NULL) {
+ g_object_unref (priv->source_list);
+ priv->source_list = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+task_shell_backend_constructed (GObject *object)
+{
+ EShell *shell;
+ EShellBackend *shell_backend;
+
+ shell_backend = E_SHELL_BACKEND (object);
+ shell = e_shell_backend_get_shell (shell_backend);
+
+ task_module_ensure_sources (shell_backend);
+
+ g_signal_connect_swapped (
+ shell, "handle-uri",
+ G_CALLBACK (task_module_handle_uri_cb), shell_backend);
+
+ g_signal_connect_swapped (
+ shell, "window-created",
+ G_CALLBACK (task_module_window_created_cb), shell_backend);
+}
+
+static void
+task_shell_backend_class_init (ETaskShellBackendClass *class)
+{
+ GObjectClass *object_class;
+ EShellBackendClass *shell_backend_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ETaskShellBackendPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = task_shell_backend_get_property;
+ object_class->dispose = task_shell_backend_dispose;
+ object_class->constructed = task_shell_backend_constructed;
+
+ shell_backend_class = E_SHELL_BACKEND_CLASS (class);
+ shell_backend_class->shell_view_type = E_TYPE_TASK_SHELL_VIEW;
+ shell_backend_class->name = "tasks";
+ shell_backend_class->aliases = "";
+ shell_backend_class->schemes = "task";
+ shell_backend_class->sort_order = 600;
+ shell_backend_class->start = NULL;
+ shell_backend_class->is_busy = NULL;
+ shell_backend_class->shutdown = NULL;
+ shell_backend_class->migrate = e_task_shell_backend_migrate;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SOURCE_LIST,
+ g_param_spec_object (
+ "source-list",
+ _("Source List"),
+ _("The registry of task lists"),
+ E_TYPE_SOURCE_LIST,
+ G_PARAM_READABLE));
+}
+
+static void
+task_shell_backend_init (ETaskShellBackend *task_shell_backend)
+{
+ task_shell_backend->priv =
+ E_TASK_SHELL_BACKEND_GET_PRIVATE (task_shell_backend);
+}
+
+GType
+e_task_shell_backend_get_type (void)
+{
+ return task_shell_backend_type;
+}
+
+void
+e_task_shell_backend_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (ETaskShellBackendClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) task_shell_backend_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ETaskShellBackend),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) task_shell_backend_init,
+ NULL /* value_table */
+ };
+
+ task_shell_backend_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_BACKEND,
+ "ETaskShellBackend", &type_info, 0);
+}
+
+ESourceList *
+e_task_shell_backend_get_source_list (ETaskShellBackend *task_shell_backend)
+{
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_BACKEND (task_shell_backend), NULL);
+
+ return task_shell_backend->priv->source_list;
+}
diff --git a/calendar/module/e-task-shell-backend.h b/calendar/module/e-task-shell-backend.h
new file mode 100644
index 0000000000..63b157ad85
--- /dev/null
+++ b/calendar/module/e-task-shell-backend.h
@@ -0,0 +1,70 @@
+/*
+ * e-task-shell-backend.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_TASK_SHELL_BACKEND_H
+#define E_TASK_SHELL_BACKEND_H
+
+#include <shell/e-shell-backend.h>
+#include <libedataserver/e-source-list.h>
+
+/* Standard GObject macros */
+#define E_TYPE_TASK_SHELL_BACKEND \
+ (e_task_shell_backend_get_type ())
+#define E_TASK_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackend))
+#define E_TASK_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackendClass))
+#define E_IS_TASK_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_TASK_SHELL_BACKEND))
+#define E_IS_TASK_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_TASK_SHELL_BACKEND))
+#define E_TASK_SHELL_BACKEND_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_TASK_SHELL_BACKEND, ETaskShellBackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ETaskShellBackend ETaskShellBackend;
+typedef struct _ETaskShellBackendClass ETaskShellBackendClass;
+typedef struct _ETaskShellBackendPrivate ETaskShellBackendPrivate;
+
+struct _ETaskShellBackend {
+ EShellBackend parent;
+ ETaskShellBackendPrivate *priv;
+};
+
+struct _ETaskShellBackendClass {
+ EShellBackendClass parent_class;
+};
+
+GType e_task_shell_backend_get_type (void);
+void e_task_shell_backend_register_type
+ (GTypeModule *type_module);
+ESourceList * e_task_shell_backend_get_source_list
+ (ETaskShellBackend *task_shell_backend);
+
+G_END_DECLS
+
+#endif /* E_TASK_SHELL_BACKEND_H */
diff --git a/calendar/module/e-task-shell-content.c b/calendar/module/e-task-shell-content.c
new file mode 100644
index 0000000000..0177c6c3c3
--- /dev/null
+++ b/calendar/module/e-task-shell-content.c
@@ -0,0 +1,700 @@
+/*
+ * e-task-shell-content.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-task-shell-content.h"
+
+#include <glib/gi18n.h>
+
+#include "e-util/gconf-bridge.h"
+
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/comp-util.h"
+#include "calendar/gui/e-cal-model-tasks.h"
+#include "calendar/gui/e-calendar-table.h"
+#include "calendar/gui/e-calendar-table-config.h"
+
+#include "widgets/menus/gal-view-etable.h"
+
+#define E_TASK_SHELL_CONTENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TASK_SHELL_CONTENT, ETaskShellContentPrivate))
+
+#define E_CALENDAR_TABLE_DEFAULT_STATE \
+ "<?xml version=\"1.0\"?>" \
+ "<ETableState>" \
+ " <column source=\"13\"/>" \
+ " <column source=\"14\"/>" \
+ " <column source=\"9\"/>" \
+ " <column source=\"5\"/>" \
+ " <grouping/>" \
+ "</ETableState>"
+
+struct _ETaskShellContentPrivate {
+ GtkWidget *paned;
+ GtkWidget *task_table;
+ GtkWidget *task_preview;
+
+ ECalModel *task_model;
+ ECalendarTableConfig *table_config;
+ GalViewInstance *view_instance;
+
+ gchar *current_uid;
+};
+
+enum {
+ PROP_0,
+ PROP_MODEL,
+ PROP_PREVIEW_VISIBLE
+};
+
+enum {
+ TARGET_VCALENDAR
+};
+
+static GtkTargetEntry drag_types[] = {
+ { (gchar *) "text/calendar", 0, TARGET_VCALENDAR },
+ { (gchar *) "text/x-calendar", 0, TARGET_VCALENDAR }
+};
+
+static gpointer parent_class;
+static GType task_shell_content_type;
+
+static void
+task_shell_content_display_view_cb (ETaskShellContent *task_shell_content,
+ GalView *gal_view)
+{
+ ECalendarTable *task_table;
+ ETable *table;
+
+ if (!GAL_IS_VIEW_ETABLE (gal_view))
+ return;
+
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ table = e_calendar_table_get_table (task_table);
+
+ gal_view_etable_attach_table (GAL_VIEW_ETABLE (gal_view), table);
+}
+
+static void
+task_shell_content_table_foreach_cb (gint model_row,
+ gpointer user_data)
+{
+ ECalModelComponent *comp_data;
+ icalcomponent *clone;
+ icalcomponent *vcal;
+ gchar *string;
+
+ struct {
+ ECalModel *model;
+ GSList *list;
+ } *foreach_data = user_data;
+
+ comp_data = e_cal_model_get_component_at (
+ foreach_data->model, model_row);
+
+ vcal = e_cal_util_new_top_level ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_util_add_timezones_from_component (vcal, comp_data->icalcomp);
+ icalcomponent_add_component (vcal, clone);
+
+ /* String is owned by libical; do not free. */
+ string = icalcomponent_as_ical_string (vcal);
+ if (string != NULL) {
+ ESource *source;
+ const gchar *source_uid;
+
+ source = e_cal_get_source (comp_data->client);
+ source_uid = e_source_peek_uid (source);
+
+ foreach_data->list = g_slist_prepend (
+ foreach_data->list,
+ g_strdup_printf ("%s\n%s", source_uid, string));
+ }
+
+ icalcomponent_free (vcal);
+}
+
+static void
+task_shell_content_table_drag_data_get_cb (ETaskShellContent *task_shell_content,
+ gint row,
+ gint col,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time)
+{
+ ECalendarTable *task_table;
+ ETable *table;
+
+ struct {
+ ECalModel *model;
+ GSList *list;
+ } foreach_data;
+
+ if (info != TARGET_VCALENDAR)
+ return;
+
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ table = e_calendar_table_get_table (task_table);
+
+ foreach_data.model = e_calendar_table_get_model (task_table);
+ foreach_data.list = NULL;
+
+ e_table_selected_row_foreach (
+ table, task_shell_content_table_foreach_cb,
+ &foreach_data);
+
+ if (foreach_data.list != NULL) {
+ cal_comp_selection_set_string_list (
+ selection_data, foreach_data.list);
+ g_slist_foreach (foreach_data.list, (GFunc) g_free, NULL);
+ g_slist_free (foreach_data.list);
+ }
+}
+
+static void
+task_shell_content_table_drag_data_delete_cb (ETaskShellContent *task_shell_content,
+ gint row,
+ gint col,
+ GdkDragContext *context)
+{
+ /* Moved components are deleted from source immediately when moved,
+ * because some of them can be part of destination source, and we
+ * don't want to delete not-moved tasks. There is no such information
+ * which event has been moved and which not, so skip this method. */
+}
+
+static void
+task_shell_content_cursor_change_cb (ETaskShellContent *task_shell_content,
+ gint row,
+ ETable *table)
+{
+ ECalComponentPreview *task_preview;
+ ECalendarTable *task_table;
+ ECalModel *task_model;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ const gchar *uid;
+
+ task_model = e_task_shell_content_get_task_model (task_shell_content);
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ task_preview = e_task_shell_content_get_task_preview (task_shell_content);
+
+ if (e_table_selected_count (table) != 1) {
+ e_cal_component_preview_clear (task_preview);
+ return;
+ }
+
+ row = e_table_get_cursor_row (table);
+ comp_data = e_cal_model_get_component_at (task_model, row);
+
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (
+ comp, icalcomponent_new_clone (comp_data->icalcomp));
+ e_cal_component_preview_display (
+ task_preview, comp_data->client, comp);
+
+ e_cal_component_get_uid (comp, &uid);
+ g_free (task_shell_content->priv->current_uid);
+ task_shell_content->priv->current_uid = g_strdup (uid);
+
+ g_object_unref (comp);
+}
+
+static void
+task_shell_content_selection_change_cb (ETaskShellContent *task_shell_content,
+ ETable *table)
+{
+ ECalComponentPreview *task_preview;
+
+ task_preview = e_task_shell_content_get_task_preview (task_shell_content);
+
+ if (e_table_selected_count (table) != 1)
+ e_cal_component_preview_clear (task_preview);
+}
+
+static void
+task_shell_content_model_row_changed_cb (ETaskShellContent *task_shell_content,
+ gint row,
+ ETableModel *model)
+{
+ ECalModelComponent *comp_data;
+ ECalendarTable *task_table;
+ ETable *table;
+ const gchar *current_uid;
+ const gchar *uid;
+
+ current_uid = task_shell_content->priv->current_uid;
+ if (current_uid == NULL)
+ return;
+
+ comp_data = e_cal_model_get_component_at (E_CAL_MODEL (model), row);
+ if (comp_data == NULL)
+ return;
+
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ if (g_strcmp0 (uid, current_uid) != 0)
+ return;
+
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ table = e_calendar_table_get_table (task_table);
+
+ task_shell_content_cursor_change_cb (task_shell_content, 0, table);
+}
+
+static void
+task_shell_content_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_PREVIEW_VISIBLE:
+ e_task_shell_content_set_preview_visible (
+ E_TASK_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+task_shell_content_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MODEL:
+ g_value_set_object (
+ value, e_task_shell_content_get_task_model (
+ E_TASK_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_PREVIEW_VISIBLE:
+ g_value_set_boolean (
+ value, e_task_shell_content_get_preview_visible (
+ E_TASK_SHELL_CONTENT (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+task_shell_content_dispose (GObject *object)
+{
+ ETaskShellContentPrivate *priv;
+
+ priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object);
+
+ if (priv->paned != NULL) {
+ g_object_unref (priv->paned);
+ priv->paned = NULL;
+ }
+
+ if (priv->task_table != NULL) {
+ g_object_unref (priv->task_table);
+ priv->task_table = NULL;
+ }
+
+ if (priv->task_preview != NULL) {
+ g_object_unref (priv->task_preview);
+ priv->task_preview = NULL;
+ }
+
+ if (priv->task_model != NULL) {
+ g_object_unref (priv->task_model);
+ priv->task_model = NULL;
+ }
+
+ if (priv->table_config != NULL) {
+ g_object_unref (priv->table_config);
+ priv->table_config = NULL;
+ }
+
+ if (priv->view_instance != NULL) {
+ g_object_unref (priv->view_instance);
+ priv->view_instance = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+task_shell_content_finalize (GObject *object)
+{
+ ETaskShellContentPrivate *priv;
+
+ priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object);
+
+ g_free (priv->current_uid);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+task_shell_content_constructed (GObject *object)
+{
+ ETaskShellContentPrivate *priv;
+ EShellContent *shell_content;
+ EShellView *shell_view;
+ GalViewInstance *view_instance;
+ ETable *table;
+ GConfBridge *bridge;
+ GtkWidget *container;
+ GtkWidget *widget;
+ const gchar *key;
+
+ priv = E_TASK_SHELL_CONTENT_GET_PRIVATE (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ shell_content = E_SHELL_CONTENT (object);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+
+ /* Build content widgets. */
+
+ container = GTK_WIDGET (object);
+
+ widget = gtk_vpaned_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->paned = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = e_calendar_table_new (shell_view, priv->task_model);
+ gtk_paned_add1 (GTK_PANED (container), widget);
+ priv->task_table = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_paned_add2 (GTK_PANED (container), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = e_cal_component_preview_new ();
+ e_cal_component_preview_set_default_timezone (
+ E_CAL_COMPONENT_PREVIEW (widget),
+ calendar_config_get_icaltimezone ());
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->task_preview = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Configure the task table. */
+
+ widget = E_CALENDAR_TABLE (priv->task_table)->etable;
+ table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
+
+ priv->table_config = e_calendar_table_config_new (
+ E_CALENDAR_TABLE (priv->task_table));
+
+ e_table_set_state (table, E_CALENDAR_TABLE_DEFAULT_STATE);
+
+ e_table_drag_source_set (
+ table, GDK_BUTTON1_MASK,
+ drag_types, G_N_ELEMENTS (drag_types),
+ GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_ASK);
+
+ g_signal_connect_swapped (
+ table, "table-drag-data-get",
+ G_CALLBACK (task_shell_content_table_drag_data_get_cb),
+ object);
+
+ g_signal_connect_swapped (
+ table, "table-drag-data-delete",
+ G_CALLBACK (task_shell_content_table_drag_data_delete_cb),
+ object);
+
+ g_signal_connect_swapped (
+ table, "cursor-change",
+ G_CALLBACK (task_shell_content_cursor_change_cb),
+ object);
+
+ g_signal_connect_swapped (
+ table, "selection-change",
+ G_CALLBACK (task_shell_content_selection_change_cb),
+ object);
+
+ g_signal_connect_swapped (
+ priv->task_model, "model-row-changed",
+ G_CALLBACK (task_shell_content_model_row_changed_cb),
+ object);
+
+ /* Load the view instance. */
+
+ view_instance = e_shell_view_new_view_instance (shell_view, NULL);
+ g_signal_connect_swapped (
+ view_instance, "display-view",
+ G_CALLBACK (task_shell_content_display_view_cb),
+ object);
+ gal_view_instance_load (view_instance);
+ priv->view_instance = view_instance;
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (priv->paned);
+ key = "/apps/evolution/calendar/display/task_vpane_position";
+ gconf_bridge_bind_property_delayed (bridge, key, object, "position");
+}
+
+static guint32
+task_shell_content_check_state (EShellContent *shell_content)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ETable *table;
+ GSList *list, *iter;
+ gboolean assignable = TRUE;
+ gboolean editable = TRUE;
+ gboolean has_url = FALSE;
+ gint n_selected;
+ gint n_complete = 0;
+ gint n_incomplete = 0;
+ guint32 state = 0;
+
+ task_shell_content = E_TASK_SHELL_CONTENT (shell_content);
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ table = e_calendar_table_get_table (task_table);
+ n_selected = e_table_selected_count (table);
+
+ list = e_calendar_table_get_selected (task_table);
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ icalproperty *prop;
+ const gchar *cap;
+ gboolean read_only;
+
+ e_cal_is_read_only (comp_data->client, &read_only, NULL);
+ editable &= !read_only;
+
+ cap = CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT;
+ if (e_cal_get_static_capability (comp_data->client, cap))
+ assignable = FALSE;
+
+ cap = CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK;
+ if (e_cal_get_static_capability (comp_data->client, cap))
+ assignable = FALSE;
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ has_url |= (prop != NULL);
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
+ if (prop != NULL)
+ n_complete++;
+ else
+ n_incomplete++;
+ }
+ g_slist_free (list);
+
+ if (n_selected == 1)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_SINGLE;
+ if (n_selected > 1)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_MULTIPLE;
+ if (assignable)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_CAN_ASSIGN;
+ if (editable)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_CAN_EDIT;
+ if (n_complete > 0)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_HAS_COMPLETE;
+ if (n_incomplete > 0)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_HAS_INCOMPLETE;
+ if (has_url)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_HAS_URL;
+
+ return state;
+}
+
+static void
+task_shell_content_class_init (ETaskShellContentClass *class)
+{
+ GObjectClass *object_class;
+ EShellContentClass *shell_content_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ETaskShellContentPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = task_shell_content_set_property;
+ object_class->get_property = task_shell_content_get_property;
+ object_class->dispose = task_shell_content_dispose;
+ object_class->finalize = task_shell_content_finalize;
+ object_class->constructed = task_shell_content_constructed;
+
+ shell_content_class = E_SHELL_CONTENT_CLASS (class);
+ shell_content_class->check_state = task_shell_content_check_state;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MODEL,
+ g_param_spec_object (
+ "model",
+ _("Model"),
+ _("The task table model"),
+ E_TYPE_CAL_MODEL,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PREVIEW_VISIBLE,
+ g_param_spec_boolean (
+ "preview-visible",
+ _("Preview is Visible"),
+ _("Whether the preview pane is visible"),
+ TRUE,
+ G_PARAM_READWRITE));
+}
+
+static void
+task_shell_content_init (ETaskShellContent *task_shell_content)
+{
+ task_shell_content->priv =
+ E_TASK_SHELL_CONTENT_GET_PRIVATE (task_shell_content);
+
+ task_shell_content->priv->task_model = e_cal_model_tasks_new ();
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_task_shell_content_get_type (void)
+{
+ return task_shell_content_type;
+}
+
+void
+e_task_shell_content_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (ETaskShellContentClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) task_shell_content_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ETaskShellContent),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) task_shell_content_init,
+ NULL /* value_table */
+ };
+
+ task_shell_content_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_CONTENT,
+ "ETaskShellContent", &type_info, 0);
+}
+
+GtkWidget *
+e_task_shell_content_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_TASK_SHELL_CONTENT,
+ "shell-view", shell_view, NULL);
+}
+
+ECalModel *
+e_task_shell_content_get_task_model (ETaskShellContent *task_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_CONTENT (task_shell_content), NULL);
+
+ return task_shell_content->priv->task_model;
+}
+
+ECalComponentPreview *
+e_task_shell_content_get_task_preview (ETaskShellContent *task_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_CONTENT (task_shell_content), NULL);
+
+ return E_CAL_COMPONENT_PREVIEW (
+ task_shell_content->priv->task_preview);
+}
+
+ECalendarTable *
+e_task_shell_content_get_task_table (ETaskShellContent *task_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_CONTENT (task_shell_content), NULL);
+
+ return E_CALENDAR_TABLE (task_shell_content->priv->task_table);
+}
+
+GalViewInstance *
+e_task_shell_content_get_view_instance (ETaskShellContent *task_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_CONTENT (task_shell_content), NULL);
+
+ return task_shell_content->priv->view_instance;
+}
+
+gboolean
+e_task_shell_content_get_preview_visible (ETaskShellContent *task_shell_content)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_CONTENT (task_shell_content), FALSE);
+
+ paned = GTK_PANED (task_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ return GTK_WIDGET_VISIBLE (child);
+}
+
+void
+e_task_shell_content_set_preview_visible (ETaskShellContent *task_shell_content,
+ gboolean preview_visible)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_if_fail (E_IS_TASK_SHELL_CONTENT (task_shell_content));
+
+ paned = GTK_PANED (task_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ if (preview_visible)
+ gtk_widget_show (child);
+ else
+ gtk_widget_hide (child);
+
+ g_object_notify (G_OBJECT (task_shell_content), "preview-visible");
+}
diff --git a/calendar/module/e-task-shell-content.h b/calendar/module/e-task-shell-content.h
new file mode 100644
index 0000000000..7e0b2128a7
--- /dev/null
+++ b/calendar/module/e-task-shell-content.h
@@ -0,0 +1,100 @@
+/*
+ * e-task-shell-content.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_TASK_SHELL_CONTENT_H
+#define E_TASK_SHELL_CONTENT_H
+
+#include <shell/e-shell-content.h>
+#include <shell/e-shell-view.h>
+
+#include <calendar/gui/e-cal-model.h>
+#include <calendar/gui/e-calendar-table.h>
+#include <calendar/gui/e-cal-component-preview.h>
+
+#include <menus/gal-view-instance.h>
+
+/* Standard GObject macros */
+#define E_TYPE_TASK_SHELL_CONTENT \
+ (e_task_shell_content_get_type ())
+#define E_TASK_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_TASK_SHELL_CONTENT, ETaskShellContent))
+#define E_TASK_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_TASK_SHELL_CONTENT, ETaskShellContentClass))
+#define E_IS_TASK_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_TASK_SHELL_CONTENT))
+#define E_IS_TASK_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_TASK_SHELL_CONTENT))
+#define E_TASK_SHELL_CONTENT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_TASK_SHELL_CONTENT, ETaskShellContentClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ETaskShellContent ETaskShellContent;
+typedef struct _ETaskShellContentClass ETaskShellContentClass;
+typedef struct _ETaskShellContentPrivate ETaskShellContentPrivate;
+
+enum {
+ E_TASK_SHELL_CONTENT_SELECTION_SINGLE = 1 << 0,
+ E_TASK_SHELL_CONTENT_SELECTION_MULTIPLE = 1 << 1,
+ E_TASK_SHELL_CONTENT_SELECTION_CAN_ASSIGN = 1 << 2,
+ E_TASK_SHELL_CONTENT_SELECTION_CAN_EDIT = 1 << 3,
+ E_TASK_SHELL_CONTENT_SELECTION_HAS_COMPLETE = 1 << 4,
+ E_TASK_SHELL_CONTENT_SELECTION_HAS_INCOMPLETE = 1 << 5,
+ E_TASK_SHELL_CONTENT_SELECTION_HAS_URL = 1 << 6
+};
+
+struct _ETaskShellContent {
+ EShellContent parent;
+ ETaskShellContentPrivate *priv;
+};
+
+struct _ETaskShellContentClass {
+ EShellContentClass parent_class;
+};
+
+GType e_task_shell_content_get_type (void);
+void e_task_shell_content_register_type
+ (GTypeModule *type_module);
+GtkWidget * e_task_shell_content_new(EShellView *shell_view);
+ECalModel * e_task_shell_content_get_task_model
+ (ETaskShellContent *task_shell_content);
+ECalComponentPreview *
+ e_task_shell_content_get_task_preview
+ (ETaskShellContent *task_shell_content);
+ECalendarTable *e_task_shell_content_get_task_table
+ (ETaskShellContent *task_shell_content);
+GalViewInstance *
+ e_task_shell_content_get_view_instance
+ (ETaskShellContent *task_shell_content);
+gboolean e_task_shell_content_get_preview_visible
+ (ETaskShellContent *task_shell_content);
+void e_task_shell_content_set_preview_visible
+ (ETaskShellContent *task_shell_content,
+ gboolean preview_visible);
+
+G_END_DECLS
+
+#endif /* E_TASK_SHELL_CONTENT_H */
diff --git a/calendar/module/e-task-shell-migrate.c b/calendar/module/e-task-shell-migrate.c
new file mode 100644
index 0000000000..9653fb95ea
--- /dev/null
+++ b/calendar/module/e-task-shell-migrate.c
@@ -0,0 +1,664 @@
+/*
+ * e-task-shell-backend-migrate.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-task-shell-migrate.h"
+
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <libebackend/e-dbhash.h>
+#include <libedataserver/e-source.h>
+#include <libedataserver/e-source-group.h>
+#include <libedataserver/e-source-list.h>
+#include <libedataserver/e-xml-hash-utils.h>
+#include <libedataserver/e-xml-utils.h>
+
+#include "e-util/e-bconf-map.h"
+#include "e-util/e-folder-map.h"
+#include "e-util/e-util-private.h"
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/calendar-config-keys.h"
+
+#define WEBCAL_BASE_URI "webcal://"
+#define PERSONAL_RELATIVE_URI "system"
+
+static e_gconf_map_t calendar_tasks_map[] = {
+ /* /Calendar/Tasks */
+ { "HideCompletedTasks", "calendar/tasks/hide_completed", E_GCONF_MAP_BOOL },
+ { "HideCompletedTasksUnits", "calendar/tasks/hide_completed_units", E_GCONF_MAP_STRING },
+ { "HideCompletedTasksValue", "calendar/tasks/hide_completed_value", E_GCONF_MAP_INT },
+ { NULL },
+};
+
+static e_gconf_map_t calendar_tasks_colours_map[] = {
+ /* /Calendar/Tasks/Colors */
+ { "TasksDueToday", "calendar/tasks/colors/due_today", E_GCONF_MAP_STRING },
+ { "TasksOverDue", "calendar/tasks/colors/overdue", E_GCONF_MAP_STRING },
+ { "TasksDueToday", "calendar/tasks/colors/due_today", E_GCONF_MAP_STRING },
+ { NULL },
+};
+
+static e_gconf_map_list_t task_remap_list[] = {
+
+ { "/Calendar/Tasks", calendar_tasks_map },
+ { "/Calendar/Tasks/Colors", calendar_tasks_colours_map },
+
+ { NULL },
+};
+
+static GtkWidget *window;
+static GtkLabel *label;
+static GtkProgressBar *progress;
+
+#ifndef G_OS_WIN32
+
+/* No previous versions have been available on Win32, so don't
+ * bother with upgrade support from 1.x on Win32.
+ */
+
+static void
+setup_progress_dialog (void)
+{
+ GtkWidget *vbox, *hbox, *w;
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title ((GtkWindow *) window, _("Migrating..."));
+ gtk_window_set_modal ((GtkWindow *) window, TRUE);
+ gtk_container_set_border_width ((GtkContainer *) window, 6);
+
+ vbox = gtk_vbox_new (FALSE, 6);
+ gtk_widget_show (vbox);
+ gtk_container_add ((GtkContainer *) window, vbox);
+
+ w = gtk_label_new (_("The location and hierarchy of the Evolution task "
+ "folders has changed since Evolution 1.x.\n\nPlease be "
+ "patient while Evolution migrates your folders..."));
+
+ gtk_label_set_line_wrap ((GtkLabel *) w, TRUE);
+ gtk_widget_show (w);
+ gtk_box_pack_start_defaults ((GtkBox *) vbox, w);
+
+ hbox = gtk_hbox_new (FALSE, 6);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start_defaults ((GtkBox *) vbox, hbox);
+
+ label = (GtkLabel *) gtk_label_new ("");
+ gtk_widget_show ((GtkWidget *) label);
+ gtk_box_pack_start_defaults ((GtkBox *) hbox, (GtkWidget *) label);
+
+ progress = (GtkProgressBar *) gtk_progress_bar_new ();
+ gtk_widget_show ((GtkWidget *) progress);
+ gtk_box_pack_start_defaults ((GtkBox *) hbox, (GtkWidget *) progress);
+
+ gtk_widget_show (window);
+}
+
+static void
+dialog_close (void)
+{
+ gtk_widget_destroy ((GtkWidget *) window);
+}
+
+static void
+dialog_set_folder_name (const char *folder_name)
+{
+ char *text;
+
+ text = g_strdup_printf (_("Migrating '%s':"), folder_name);
+ gtk_label_set_text (label, text);
+ g_free (text);
+
+ gtk_progress_bar_set_fraction (progress, 0.0);
+
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+}
+
+static void
+dialog_set_progress (double percent)
+{
+ char text[5];
+
+ snprintf (text, sizeof (text), "%d%%", (int) (percent * 100.0f));
+
+ gtk_progress_bar_set_fraction (progress, percent);
+ gtk_progress_bar_set_text (progress, text);
+
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+}
+
+static gboolean
+check_for_conflict (ESourceGroup *group, char *name)
+{
+ GSList *sources;
+ GSList *s;
+
+ sources = e_source_group_peek_sources (group);
+
+ for (s = sources; s; s = s->next) {
+ ESource *source = E_SOURCE (s->data);
+
+ if (!strcmp (e_source_peek_name (source), name))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static char *
+get_source_name (ESourceGroup *group, const char *path)
+{
+ char **p = g_strsplit (path, "/", 0);
+ int i, j, starting_index;
+ int num_elements;
+ gboolean conflict;
+ GString *s = g_string_new (NULL);
+
+ for (i = 0; p[i]; i ++) ;
+
+ num_elements = i;
+ i--;
+
+ /* p[i] is now the last path element */
+
+ /* check if it conflicts */
+ starting_index = i;
+ do {
+ for (j = starting_index; j < num_elements; j += 2) {
+ if (j != starting_index)
+ g_string_append_c (s, '_');
+ g_string_append (s, p[j]);
+ }
+
+ conflict = check_for_conflict (group, s->str);
+
+
+ /* if there was a conflict back up 2 levels (skipping the /subfolder/ element) */
+ if (conflict)
+ starting_index -= 2;
+
+ /* we always break out if we can't go any further,
+ regardless of whether or not we conflict. */
+ if (starting_index < 0)
+ break;
+
+ } while (conflict);
+ g_strfreev (p);
+
+ return g_string_free (s, FALSE);
+}
+
+static gboolean
+migrate_ical (ECal *old_ecal, ECal *new_ecal)
+{
+ GList *l, *objects;
+ int num_added = 0;
+ int num_objects;
+ gboolean retval = TRUE;
+
+ /* both ecals are loaded, start the actual migration */
+ if (!e_cal_get_object_list (old_ecal, "#t", &objects, NULL))
+ return FALSE;
+
+ num_objects = g_list_length (objects);
+ for (l = objects; l; l = l->next) {
+ icalcomponent *ical_comp = l->data;
+ GError *error = NULL;
+
+ if (!e_cal_create_object (new_ecal, ical_comp, NULL, &error)) {
+ g_warning ("Migration of object failed: %s", error->message);
+ retval = FALSE;
+ }
+
+ g_clear_error (&error);
+
+ num_added ++;
+ dialog_set_progress ((double)num_added / num_objects);
+ }
+
+ g_list_foreach (objects, (GFunc) icalcomponent_free, NULL);
+ g_list_free (objects);
+
+ return retval;
+}
+
+static gboolean
+migrate_ical_folder_to_source (char *old_path, ESource *new_source, ECalSourceType type)
+{
+ ECal *old_ecal = NULL, *new_ecal = NULL;
+ ESource *old_source;
+ ESourceGroup *group;
+ char *old_uri = g_strdup_printf ("file://%s", old_path);
+ GError *error = NULL;
+ gboolean retval = FALSE;
+
+ group = e_source_group_new ("", old_uri);
+ old_source = e_source_new ("", "");
+ e_source_group_add_source (group, old_source, -1);
+
+ dialog_set_folder_name (e_source_peek_name (new_source));
+
+ if (!(old_ecal = e_cal_new (old_source, type))) {
+ g_warning ("could not find a backend for '%s'", e_source_get_uri (old_source));
+ goto finish;
+ }
+ if (!e_cal_open (old_ecal, FALSE, &error)) {
+ g_warning ("failed to load source ecal for migration: '%s' (%s)", error->message,
+ e_source_get_uri (old_source));
+ goto finish;
+ }
+
+ if (!(new_ecal = e_cal_new (new_source, type))) {
+ g_warning ("could not find a backend for '%s'", e_source_get_uri (new_source));
+ goto finish;
+ }
+ if (!e_cal_open (new_ecal, FALSE, &error)) {
+ g_warning ("failed to load destination ecal for migration: '%s' (%s)", error->message,
+ e_source_get_uri (new_source));
+ goto finish;
+ }
+
+ retval = migrate_ical (old_ecal, new_ecal);
+
+finish:
+ g_clear_error (&error);
+ if (old_ecal)
+ g_object_unref (old_ecal);
+ g_object_unref (group);
+ if (new_ecal)
+ g_object_unref (new_ecal);
+ g_free (old_uri);
+
+ return retval;
+}
+
+static gboolean
+migrate_ical_folder (char *old_path, ESourceGroup *dest_group, char *source_name, ECalSourceType type)
+{
+ ESource *new_source;
+ gboolean retval;
+
+ new_source = e_source_new (source_name, source_name);
+ e_source_set_relative_uri (new_source, e_source_peek_uid (new_source));
+ e_source_group_add_source (dest_group, new_source, -1);
+
+ retval = migrate_ical_folder_to_source (old_path, new_source, type);
+
+ g_object_unref (new_source);
+
+ return retval;
+}
+
+#endif /* !G_OS_WIN32 */
+
+#ifndef G_OS_WIN32
+
+static void
+migrate_pilot_db_key (const char *key, gpointer user_data)
+{
+ EXmlHash *xmlhash = user_data;
+
+ e_xmlhash_add (xmlhash, key, "");
+}
+
+static void
+migrate_pilot_data (const char *component, const char *conduit, const char *old_path, const char *new_path)
+{
+ char *changelog, *map;
+ const char *dent;
+ const char *ext;
+ char *filename;
+ GDir *dir;
+
+ if (!(dir = g_dir_open (old_path, 0, NULL)))
+ return;
+
+ map = g_alloca (12 + strlen (conduit));
+ sprintf (map, "pilot-map-%s-", conduit);
+
+ changelog = g_alloca (24 + strlen (conduit));
+ sprintf (changelog, "pilot-sync-evolution-%s-", conduit);
+
+ while ((dent = g_dir_read_name (dir))) {
+ if (!strncmp (dent, map, strlen (map)) &&
+ ((ext = strrchr (dent, '.')) && !strcmp (ext, ".xml"))) {
+ /* pilot map file - src and dest file formats are identical */
+ unsigned char inbuf[4096];
+ size_t nread, nwritten;
+ int fd0, fd1;
+ ssize_t n;
+
+ filename = g_build_filename (old_path, dent, NULL);
+ if ((fd0 = g_open (filename, O_RDONLY|O_BINARY, 0)) == -1) {
+ g_free (filename);
+ continue;
+ }
+
+ g_free (filename);
+ filename = g_build_filename (new_path, dent, NULL);
+ if ((fd1 = g_open (filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666)) == -1) {
+ g_free (filename);
+ close (fd0);
+ continue;
+ }
+
+ do {
+ do {
+ n = read (fd0, inbuf, sizeof (inbuf));
+ } while (n == -1 && errno == EINTR);
+
+ if (n < 1)
+ break;
+
+ nread = n;
+ nwritten = 0;
+ do {
+ do {
+ n = write (fd1, inbuf + nwritten, nread - nwritten);
+ } while (n == -1 && errno == EINTR);
+
+ if (n > 0)
+ nwritten += n;
+ } while (nwritten < nread && n != -1);
+
+ if (n == -1)
+ break;
+ } while (1);
+
+ if (n != -1)
+ n = fsync (fd1);
+
+ if (n == -1) {
+ g_warning ("Failed to migrate %s: %s", dent, strerror (errno));
+ g_unlink (filename);
+ }
+
+ close (fd0);
+ close (fd1);
+ g_free (filename);
+ } else if (!strncmp (dent, changelog, strlen (changelog)) &&
+ ((ext = strrchr (dent, '.')) && !strcmp (ext, ".db"))) {
+ /* src and dest formats differ, src format is db3 while dest format is xml */
+ EXmlHash *xmlhash;
+ EDbHash *dbhash;
+ struct stat st;
+
+ filename = g_build_filename (old_path, dent, NULL);
+ if (g_stat (filename, &st) == -1) {
+ g_free (filename);
+ continue;
+ }
+
+ dbhash = e_dbhash_new (filename);
+ g_free (filename);
+
+ filename = g_strdup_printf ("%s/%s.ics-%s", new_path, component, dent);
+ if (g_stat (filename, &st) != -1)
+ g_unlink (filename);
+ xmlhash = e_xmlhash_new (filename);
+ g_free (filename);
+
+ e_dbhash_foreach_key (dbhash, migrate_pilot_db_key, xmlhash);
+
+ e_dbhash_destroy (dbhash);
+
+ e_xmlhash_write (xmlhash);
+ e_xmlhash_destroy (xmlhash);
+ }
+ }
+
+ g_dir_close (dir);
+}
+
+#endif
+
+static void
+create_task_sources (EShellBackend *shell_backend,
+ ESourceList *source_list,
+ ESourceGroup **on_this_computer,
+ ESourceGroup **on_the_web,
+ ESource **personal_source)
+{
+ GSList *groups;
+ ESourceGroup *group;
+ char *base_uri, *base_uri_proto;
+ const gchar *base_dir;
+
+ *on_this_computer = NULL;
+ *on_the_web = NULL;
+ *personal_source = NULL;
+
+ base_dir = e_shell_backend_get_config_dir (shell_backend);
+ base_uri = g_build_filename (base_dir, "local", NULL);
+
+ base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
+
+ groups = e_source_list_peek_groups (source_list);
+ if (groups) {
+ /* groups are already there, we need to search for things... */
+ GSList *g;
+
+ for (g = groups; g; g = g->next) {
+
+ group = E_SOURCE_GROUP (g->data);
+
+ if (!*on_this_computer && !strcmp (base_uri_proto, e_source_group_peek_base_uri (group)))
+ *on_this_computer = g_object_ref (group);
+ else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI, e_source_group_peek_base_uri (group)))
+ *on_the_web = g_object_ref (group);
+ }
+ }
+
+ if (*on_this_computer) {
+ /* make sure "Personal" shows up as a source under
+ this group */
+ GSList *sources = e_source_group_peek_sources (*on_this_computer);
+ GSList *s;
+ for (s = sources; s; s = s->next) {
+ ESource *source = E_SOURCE (s->data);
+ const gchar *relative_uri;
+
+ relative_uri = e_source_peek_relative_uri (source);
+ if (relative_uri == NULL)
+ continue;
+ if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
+ *personal_source = g_object_ref (source);
+ break;
+ }
+ }
+ } else {
+ /* create the local source group */
+ group = e_source_group_new (_("On This Computer"), base_uri_proto);
+ e_source_list_add_group (source_list, group, -1);
+
+ *on_this_computer = group;
+ }
+
+ if (!*personal_source) {
+ /* Create the default Person task list */
+ ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
+ e_source_group_add_source (*on_this_computer, source, -1);
+
+ if (!calendar_config_get_primary_tasks () && !calendar_config_get_tasks_selected ()) {
+ GSList selected;
+
+ calendar_config_set_primary_tasks (e_source_peek_uid (source));
+
+ selected.data = (gpointer)e_source_peek_uid (source);
+ selected.next = NULL;
+ calendar_config_set_tasks_selected (&selected);
+ }
+
+ e_source_set_color_spec (source, "#BECEDD");
+ *personal_source = source;
+ }
+
+ if (!*on_the_web) {
+ /* Create the Webcal source group */
+ group = e_source_group_new (_("On The Web"), WEBCAL_BASE_URI);
+ e_source_list_add_group (source_list, group, -1);
+
+ *on_the_web = group;
+ }
+
+ g_free (base_uri_proto);
+ g_free (base_uri);
+}
+
+gboolean
+e_task_shell_backend_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error)
+{
+ ESourceGroup *on_this_computer = NULL;
+ ESourceGroup *on_the_web = NULL;
+ ESource *personal_source = NULL;
+ ESourceList *source_list;
+ gboolean retval = FALSE;
+
+ source_list = g_object_get_data (
+ G_OBJECT (source_list), "source-list");
+
+ /* we call this unconditionally now - create_groups either
+ creates the groups/sources or it finds the necessary
+ groups/sources. */
+ create_task_sources (
+ shell_backend, source_list, &on_this_computer,
+ &on_the_web, &personal_source);
+
+#ifndef G_OS_WIN32
+ if (major == 1) {
+ xmlDocPtr config_doc = NULL;
+ char *conf_file;
+
+ conf_file = g_build_filename (g_get_home_dir (), "evolution", "config.xmldb", NULL);
+ if (g_file_test (conf_file, G_FILE_TEST_IS_REGULAR))
+ config_doc = e_xml_parse_file (conf_file);
+ g_free (conf_file);
+
+ if (config_doc && minor <= 2) {
+ GConfClient *gconf;
+ int res = 0;
+
+ /* move bonobo config to gconf */
+ gconf = gconf_client_get_default ();
+
+ res = e_bconf_import (gconf, config_doc, task_remap_list);
+
+ g_object_unref (gconf);
+
+ xmlFreeDoc(config_doc);
+
+ if (res != 0) {
+ g_set_error(error, 0, 0, _("Unable to migrate old settings from evolution/config.xmldb"));
+ goto fail;
+ }
+ }
+
+ if (minor <= 4) {
+ GSList *migration_dirs, *l;
+ char *path, *local_task_folder;
+
+ setup_progress_dialog ();
+
+ path = g_build_filename (g_get_home_dir (), "evolution", "local", NULL);
+ migration_dirs = e_folder_map_local_folders (path, "tasks");
+ local_task_folder = g_build_filename (path, "Tasks", NULL);
+ g_free (path);
+
+ if (personal_source)
+ migrate_ical_folder_to_source (local_task_folder, personal_source, E_CAL_SOURCE_TYPE_TODO);
+
+ for (l = migration_dirs; l; l = l->next) {
+ char *source_name;
+
+ if (personal_source && !strcmp ((char*)l->data, local_task_folder))
+ continue;
+
+ source_name = get_source_name (on_this_computer, (char*)l->data);
+
+ if (!migrate_ical_folder (l->data, on_this_computer, source_name, E_CAL_SOURCE_TYPE_TODO)) {
+ /* FIXME: domain/code */
+ g_set_error(error, 0, 0, _("Unable to migrate tasks `%s'"), source_name);
+ g_free(source_name);
+ goto fail;
+ }
+
+ g_free (source_name);
+ }
+
+ g_free (local_task_folder);
+
+ dialog_close ();
+ }
+
+ if (minor < 5 || (minor == 5 && micro <= 10)) {
+ char *old_path, *new_path;
+
+ old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Tasks", NULL);
+ new_path = g_build_filename (e_shell_backend_get_config_dir (shell_backend),
+ "local", "system", NULL);
+ migrate_pilot_data ("tasks", "todo", old_path, new_path);
+ g_free (new_path);
+ g_free (old_path);
+ }
+
+ /* we only need to do this next step if people ran
+ older versions of 1.5. We need to clear out the
+ absolute URI's that were assigned to ESources
+ during one phase of development, as they take
+ precedent over relative uris (but aren't updated
+ when editing an ESource). */
+ if (minor == 5 && micro <= 11) {
+ GSList *g;
+ for (g = e_source_list_peek_groups (source_list); g; g = g->next) {
+ ESourceGroup *group = g->data;
+ GSList *s;
+
+ for (s = e_source_group_peek_sources (group); s; s = s->next) {
+ ESource *source = s->data;
+ e_source_set_absolute_uri (source, NULL);
+ }
+ }
+ }
+ }
+#endif /* !G_OS_WIN32 */
+ e_source_list_sync (source_list, NULL);
+ retval = TRUE;
+fail:
+ if (on_this_computer)
+ g_object_unref (on_this_computer);
+ if (on_the_web)
+ g_object_unref (on_the_web);
+ if (personal_source)
+ g_object_unref (personal_source);
+
+ return retval;
+}
diff --git a/calendar/module/e-task-shell-migrate.h b/calendar/module/e-task-shell-migrate.h
new file mode 100644
index 0000000000..4cb91c9f4a
--- /dev/null
+++ b/calendar/module/e-task-shell-migrate.h
@@ -0,0 +1,38 @@
+/*
+ * e-task-shell-backend-migrate.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_TASK_SHELL_BACKEND_MIGRATE_H
+#define E_TASK_SHELL_BACKEND_MIGRATE_H
+
+#include <glib.h>
+#include <shell/e-shell-backend.h>
+
+G_BEGIN_DECLS
+
+gboolean e_task_shell_backend_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* E_TASK_SHELL_BACKEND_MIGRATE_H */
diff --git a/calendar/module/e-task-shell-sidebar.c b/calendar/module/e-task-shell-sidebar.c
new file mode 100644
index 0000000000..827a0a037e
--- /dev/null
+++ b/calendar/module/e-task-shell-sidebar.c
@@ -0,0 +1,696 @@
+/*
+ * e-task-shell-sidebar.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-task-shell-sidebar.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <libecal/e-cal.h>
+
+#include "e-util/e-error.h"
+#include "e-util/e-util.h"
+#include "calendar/common/authentication.h"
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/e-task-list-selector.h"
+#include "calendar/gui/misc.h"
+
+#include "e-task-shell-backend.h"
+#include "e-task-shell-view.h"
+
+#define E_TASK_SHELL_SIDEBAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarPrivate))
+
+struct _ETaskShellSidebarPrivate {
+ GtkWidget *selector;
+
+ /* UID -> Client */
+ GHashTable *client_table;
+};
+
+enum {
+ PROP_0,
+ PROP_SELECTOR
+};
+
+enum {
+ CLIENT_ADDED,
+ CLIENT_REMOVED,
+ STATUS_MESSAGE,
+ LAST_SIGNAL
+};
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+static GType task_shell_sidebar_type;
+
+static void
+task_shell_sidebar_emit_client_added (ETaskShellSidebar *task_shell_sidebar,
+ ECal *client)
+{
+ guint signal_id = signals[CLIENT_ADDED];
+
+ g_signal_emit (task_shell_sidebar, signal_id, 0, client);
+}
+
+static void
+task_shell_sidebar_emit_client_removed (ETaskShellSidebar *task_shell_sidebar,
+ ECal *client)
+{
+ guint signal_id = signals[CLIENT_REMOVED];
+
+ g_signal_emit (task_shell_sidebar, signal_id, 0, client);
+}
+
+static void
+task_shell_sidebar_emit_status_message (ETaskShellSidebar *task_shell_sidebar,
+ const gchar *status_message)
+{
+ guint signal_id = signals[STATUS_MESSAGE];
+
+ g_signal_emit (task_shell_sidebar, signal_id, 0, status_message, -1.0);
+}
+
+static void
+task_shell_sidebar_backend_died_cb (ETaskShellSidebar *task_shell_sidebar,
+ ECal *client)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellSidebar *shell_sidebar;
+ GHashTable *client_table;
+ ESource *source;
+ const gchar *uid;
+
+ client_table = task_shell_sidebar->priv->client_table;
+
+ shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ source = e_cal_get_source (client);
+ uid = e_source_peek_uid (source);
+
+ g_object_ref (source);
+
+ g_hash_table_remove (client_table, uid);
+ task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL);
+
+ e_error_run (
+ GTK_WINDOW (shell_window),
+ "calendar:tasks-crashed", NULL);
+
+ g_object_unref (source);
+}
+
+static void
+task_shell_sidebar_backend_error_cb (ETaskShellSidebar *task_shell_sidebar,
+ const gchar *message,
+ ECal *client)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellSidebar *shell_sidebar;
+ GtkWidget *dialog;
+ const gchar *uri;
+ gchar *uri_no_passwd;
+
+ shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ uri = e_cal_get_uri (client);
+ uri_no_passwd = get_uri_without_password (uri);
+
+ dialog = gtk_message_dialog_new (
+ GTK_WINDOW (shell_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ _("Error on %s\n%s"),
+ uri_no_passwd, message);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ g_free (uri_no_passwd);
+}
+
+static void
+task_shell_sidebar_client_opened_cb (ETaskShellSidebar *task_shell_sidebar,
+ ECalendarStatus status,
+ ECal *client)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellSidebar *shell_sidebar;
+ ESource *source;
+
+ source = e_cal_get_source (client);
+
+ shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED ||
+ status == E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED)
+ auth_cal_forget_password (client);
+
+ switch (status) {
+ case E_CALENDAR_STATUS_OK:
+ g_signal_handlers_disconnect_matched (
+ client, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
+ task_shell_sidebar_client_opened_cb, NULL);
+
+ task_shell_sidebar_emit_status_message (
+ task_shell_sidebar, _("Loading tasks"));
+ task_shell_sidebar_emit_client_added (
+ task_shell_sidebar, client);
+ task_shell_sidebar_emit_status_message (
+ task_shell_sidebar, NULL);
+ break;
+
+ case E_CALENDAR_STATUS_AUTHENTICATION_FAILED:
+ e_cal_open_async (client, FALSE);
+ break;
+
+ case E_CALENDAR_STATUS_BUSY:
+ break;
+
+ case E_CALENDAR_STATUS_REPOSITORY_OFFLINE:
+ e_error_run (
+ GTK_WINDOW (shell_window),
+ "calendar:prompt-no-contents-offline-tasks",
+ NULL);
+ break;
+
+ default:
+ task_shell_sidebar_emit_client_removed (
+ task_shell_sidebar, client);
+ break;
+ }
+}
+
+static void
+task_shell_sidebar_row_changed_cb (ETaskShellSidebar *task_shell_sidebar,
+ GtkTreePath *tree_path,
+ GtkTreeIter *tree_iter,
+ GtkTreeModel *tree_model)
+{
+ ESourceSelector *selector;
+ ESource *source;
+
+ /* XXX ESourceSelector's underlying tree store has only one
+ * column: ESource objects. While we're not supposed to
+ * know this, listening for "row-changed" signals from
+ * the model is easier to deal with than the selector's
+ * "selection-changed" signal, which doesn't tell you
+ * _which_ row changed. */
+
+ selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
+ gtk_tree_model_get (tree_model, tree_iter, 0, &source, -1);
+
+ /* XXX This signal gets emitted a lot while the model is being
+ * rebuilt, during which time we won't get a valid ESource.
+ * ESourceSelector should probably block this signal while
+ * rebuilding the model, but we'll be forgiving and not
+ * emit a warning. */
+ if (!E_IS_SOURCE (source))
+ return;
+
+ if (e_source_selector_source_is_selected (selector, source))
+ e_task_shell_sidebar_add_source (task_shell_sidebar, source);
+ else
+ e_task_shell_sidebar_remove_source (task_shell_sidebar, source);
+}
+
+static void
+task_shell_sidebar_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar,
+ ESourceSelector *selector)
+{
+ GSList *list, *iter;
+
+ /* This signal is emitted less frequently than "row-changed",
+ * especially when the model is being rebuilt. So we'll take
+ * it easy on poor GConf. */
+
+ list = e_source_selector_get_selection (selector);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ESource *source = iter->data;
+
+ iter->data = (gpointer) e_source_peek_uid (source);
+ g_object_unref (source);
+ }
+
+ calendar_config_set_tasks_selected (list);
+
+ g_slist_free (list);
+}
+
+static void
+task_shell_sidebar_primary_selection_changed_cb (ETaskShellSidebar *task_shell_sidebar,
+ ESourceSelector *selector)
+{
+ ESource *source;
+ const gchar *uid;
+
+ /* XXX ESourceSelector needs a "primary-selection-uid" property
+ * so we can just bind the property with GConfBridge. */
+
+ source = e_source_selector_peek_primary_selection (selector);
+ if (source == NULL)
+ return;
+
+ uid = e_source_peek_uid (source);
+ calendar_config_set_primary_tasks (uid);
+}
+
+static void
+task_shell_sidebar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SELECTOR:
+ g_value_set_object (
+ value, e_task_shell_sidebar_get_selector (
+ E_TASK_SHELL_SIDEBAR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+task_shell_sidebar_dispose (GObject *object)
+{
+ ETaskShellSidebarPrivate *priv;
+
+ priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ if (priv->selector != NULL) {
+ g_object_unref (priv->selector);
+ priv->selector = NULL;
+ }
+
+ g_hash_table_remove_all (priv->client_table);
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+task_shell_sidebar_finalize (GObject *object)
+{
+ ETaskShellSidebarPrivate *priv;
+
+ priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->client_table);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+task_shell_sidebar_constructed (GObject *object)
+{
+ ETaskShellSidebarPrivate *priv;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ EShellSidebar *shell_sidebar;
+ ESourceSelector *selector;
+ ESourceList *source_list;
+ ESource *source;
+ GtkContainer *container;
+ GtkTreeModel *model;
+ GtkWidget *widget;
+ AtkObject *a11y;
+ GSList *list, *iter;
+ gchar *uid;
+
+ priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ shell_sidebar = E_SHELL_SIDEBAR (object);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ source_list = e_task_shell_backend_get_source_list (
+ E_TASK_SHELL_BACKEND (shell_backend));
+
+ container = GTK_CONTAINER (shell_sidebar);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_container_add (container, widget);
+ gtk_widget_show (widget);
+
+ container = GTK_CONTAINER (widget);
+
+ widget = e_task_list_selector_new (source_list);
+ e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
+ gtk_container_add (container, widget);
+ a11y = gtk_widget_get_accessible (widget);
+ atk_object_set_name (a11y, _("Task List Selector"));
+ priv->selector = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Restore the selector state from the last session. */
+
+ selector = E_SOURCE_SELECTOR (priv->selector);
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
+
+ g_signal_connect_swapped (
+ model, "row-changed",
+ G_CALLBACK (task_shell_sidebar_row_changed_cb),
+ object);
+
+ source = NULL;
+ uid = calendar_config_get_primary_tasks ();
+ if (uid != NULL)
+ source = e_source_list_peek_source_by_uid (source_list, uid);
+ if (source == NULL)
+ source = e_source_list_peek_source_any (source_list);
+ if (source != NULL)
+ e_source_selector_set_primary_selection (selector, source);
+ g_free (uid);
+
+ list = calendar_config_get_tasks_selected ();
+ for (iter = list; iter != NULL; iter = iter->next) {
+ uid = iter->data;
+ source = e_source_list_peek_source_by_uid (source_list, uid);
+ g_free (uid);
+
+ if (source == NULL)
+ continue;
+
+ e_source_selector_select_source (selector, source);
+ }
+ g_slist_free (list);
+
+ /* Listen for subsequent changes to the selector. */
+
+ g_signal_connect_swapped (
+ widget, "selection-changed",
+ G_CALLBACK (task_shell_sidebar_selection_changed_cb),
+ object);
+
+ g_signal_connect_swapped (
+ widget, "primary-selection-changed",
+ G_CALLBACK (task_shell_sidebar_primary_selection_changed_cb),
+ object);
+}
+
+static guint32
+task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
+{
+ ETaskShellSidebar *task_shell_sidebar;
+ ESourceSelector *selector;
+ ESource *source;
+ gboolean is_system = FALSE;
+ guint32 state = 0;
+
+ task_shell_sidebar = E_TASK_SHELL_SIDEBAR (shell_sidebar);
+ selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+
+ if (source != NULL) {
+ const gchar *uri;
+
+ uri = e_source_peek_relative_uri (source);
+ is_system = (uri == NULL || strcmp (uri, "system") == 0);
+ }
+
+ if (source != NULL)
+ state |= E_TASK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE;
+ if (is_system)
+ state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM;
+
+ return state;
+}
+
+static void
+task_shell_sidebar_client_removed (ETaskShellSidebar *task_shell_sidebar,
+ ECal *client)
+{
+ ESourceSelector *selector;
+ GHashTable *client_table;
+ ESource *source;
+ const gchar *uid;
+
+ client_table = task_shell_sidebar->priv->client_table;
+ selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
+
+ g_signal_handlers_disconnect_matched (
+ client, G_SIGNAL_MATCH_DATA, 0, 0,
+ NULL, NULL, task_shell_sidebar);
+
+ source = e_cal_get_source (client);
+ e_source_selector_unselect_source (selector, source);
+
+ uid = e_source_peek_uid (source);
+ g_hash_table_remove (client_table, uid);
+
+ task_shell_sidebar_emit_status_message (task_shell_sidebar, NULL);
+}
+
+static void
+task_shell_sidebar_class_init (ETaskShellSidebarClass *class)
+{
+ GObjectClass *object_class;
+ EShellSidebarClass *shell_sidebar_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ETaskShellSidebarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = task_shell_sidebar_get_property;
+ object_class->dispose = task_shell_sidebar_dispose;
+ object_class->finalize = task_shell_sidebar_finalize;
+ object_class->constructed = task_shell_sidebar_constructed;
+
+ shell_sidebar_class = E_SHELL_SIDEBAR_CLASS (class);
+ shell_sidebar_class->check_state = task_shell_sidebar_check_state;
+
+ class->client_removed = task_shell_sidebar_client_removed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SELECTOR,
+ g_param_spec_object (
+ "selector",
+ _("Source Selector Widget"),
+ _("This widget displays groups of task lists"),
+ E_TYPE_SOURCE_SELECTOR,
+ G_PARAM_READABLE));
+
+ signals[CLIENT_ADDED] = g_signal_new (
+ "client-added",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETaskShellSidebarClass, client_added),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_CAL);
+
+ signals[CLIENT_REMOVED] = g_signal_new (
+ "client-removed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETaskShellSidebarClass, client_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_CAL);
+
+ signals[STATUS_MESSAGE] = g_signal_new (
+ "status-message",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ETaskShellSidebarClass, status_message),
+ NULL, NULL,
+ e_marshal_VOID__STRING_DOUBLE,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING,
+ G_TYPE_DOUBLE);
+}
+
+static void
+task_shell_sidebar_init (ETaskShellSidebar *task_shell_sidebar)
+{
+ GHashTable *client_table;
+
+ client_table = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_object_unref);
+
+ task_shell_sidebar->priv =
+ E_TASK_SHELL_SIDEBAR_GET_PRIVATE (task_shell_sidebar);
+
+ task_shell_sidebar->priv->client_table = client_table;
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_task_shell_sidebar_get_type (void)
+{
+ return task_shell_sidebar_type;
+}
+
+void
+e_task_shell_sidebar_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (ETaskShellSidebarClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) task_shell_sidebar_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ETaskShellSidebar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) task_shell_sidebar_init,
+ NULL /* value_table */
+ };
+
+ task_shell_sidebar_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_SIDEBAR,
+ "ETaskShellSidebar", &type_info, 0);
+}
+
+GtkWidget *
+e_task_shell_sidebar_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_TASK_SHELL_SIDEBAR,
+ "shell-view", shell_view, NULL);
+}
+
+GList *
+e_task_shell_sidebar_get_clients (ETaskShellSidebar *task_shell_sidebar)
+{
+ GHashTable *client_table;
+
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_SIDEBAR (task_shell_sidebar), NULL);
+
+ client_table = task_shell_sidebar->priv->client_table;
+
+ return g_hash_table_get_values (client_table);
+}
+
+ESourceSelector *
+e_task_shell_sidebar_get_selector (ETaskShellSidebar *task_shell_sidebar)
+{
+ g_return_val_if_fail (
+ E_IS_TASK_SHELL_SIDEBAR (task_shell_sidebar), NULL);
+
+ return E_SOURCE_SELECTOR (task_shell_sidebar->priv->selector);
+}
+
+void
+e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
+ ESource *source)
+{
+ ESourceSelector *selector;
+ GHashTable *client_table;
+ ECal *client;
+ const gchar *uid;
+ const gchar *uri;
+ gchar *message;
+
+ g_return_if_fail (E_IS_TASK_SHELL_SIDEBAR (task_shell_sidebar));
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ client_table = task_shell_sidebar->priv->client_table;
+ selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
+
+ uid = e_source_peek_uid (source);
+ client = g_hash_table_lookup (client_table, uid);
+
+ if (client != NULL)
+ return;
+
+ client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
+ g_return_if_fail (client != NULL);
+
+ g_signal_connect_swapped (
+ client, "backend-died",
+ G_CALLBACK (task_shell_sidebar_backend_died_cb),
+ task_shell_sidebar);
+
+ g_signal_connect_swapped (
+ client, "backend-error",
+ G_CALLBACK (task_shell_sidebar_backend_error_cb),
+ task_shell_sidebar);
+
+ g_hash_table_insert (client_table, g_strdup (uid), client);
+ e_source_selector_select_source (selector, source);
+
+ uri = e_cal_get_uri (client);
+ message = g_strdup_printf (_("Opening tasks at %s"), uri);
+ task_shell_sidebar_emit_status_message (task_shell_sidebar, message);
+ g_free (message);
+
+ g_signal_connect_swapped (
+ client, "cal-opened",
+ G_CALLBACK (task_shell_sidebar_client_opened_cb),
+ task_shell_sidebar);
+
+ e_cal_open_async (client, FALSE);
+}
+
+void
+e_task_shell_sidebar_remove_source (ETaskShellSidebar *task_shell_sidebar,
+ ESource *source)
+{
+ ESourceSelector *selector;
+ GHashTable *client_table;
+ ECal *client;
+ const gchar *uid;
+
+ g_return_if_fail (E_IS_TASK_SHELL_SIDEBAR (task_shell_sidebar));
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ client_table = task_shell_sidebar->priv->client_table;
+ selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
+
+ uid = e_source_peek_uid (source);
+ client = g_hash_table_lookup (client_table, uid);
+
+ if (client == NULL)
+ return;
+
+ task_shell_sidebar_emit_client_removed (task_shell_sidebar, client);
+}
diff --git a/calendar/module/e-task-shell-sidebar.h b/calendar/module/e-task-shell-sidebar.h
new file mode 100644
index 0000000000..5d4c74fe11
--- /dev/null
+++ b/calendar/module/e-task-shell-sidebar.h
@@ -0,0 +1,97 @@
+/*
+ * e-task-shell-sidebar.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_TASK_SHELL_SIDEBAR_H
+#define E_TASK_SHELL_SIDEBAR_H
+
+#include <libecal/e-cal.h>
+#include <libedataserverui/e-source-selector.h>
+
+#include <shell/e-shell-sidebar.h>
+#include <shell/e-shell-view.h>
+
+/* Standard GObject macros */
+#define E_TYPE_TASK_SHELL_SIDEBAR \
+ (e_task_shell_sidebar_get_type ())
+#define E_TASK_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebar))
+#define E_TASK_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarClass))
+#define E_IS_TASK_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_TASK_SHELL_SIDEBAR))
+#define E_IS_TASK_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_TASK_SHELL_SIDEBAR))
+#define E_TASK_SHELL_SIDEBAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_TASK_SHELL_SIDEBAR, ETaskShellSidebarClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ETaskShellSidebar ETaskShellSidebar;
+typedef struct _ETaskShellSidebarClass ETaskShellSidebarClass;
+typedef struct _ETaskShellSidebarPrivate ETaskShellSidebarPrivate;
+
+enum {
+ E_TASK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE = 1 << 0,
+ E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM = 1 << 1
+};
+
+struct _ETaskShellSidebar {
+ EShellSidebar parent;
+ ETaskShellSidebarPrivate *priv;
+};
+
+struct _ETaskShellSidebarClass {
+ EShellSidebarClass parent_class;
+
+ /* Signals */
+ void (*client_added) (ETaskShellSidebar *task_shell_sidebar,
+ ECal *client);
+ void (*client_removed) (ETaskShellSidebar *task_shell_sidebar,
+ ECal *client);
+ void (*status_message) (ETaskShellSidebar *task_shell_sidebar,
+ const gchar *status_message,
+ gdouble percent);
+};
+
+GType e_task_shell_sidebar_get_type (void);
+void e_task_shell_sidebar_register_type
+ (GTypeModule *type_module);
+GtkWidget * e_task_shell_sidebar_new(EShellView *shell_view);
+GList * e_task_shell_sidebar_get_clients
+ (ETaskShellSidebar *task_shell_sidebar);
+ESourceSelector *
+ e_task_shell_sidebar_get_selector
+ (ETaskShellSidebar *task_shell_sidebar);
+void e_task_shell_sidebar_add_source
+ (ETaskShellSidebar *task_shell_sidebar,
+ ESource *source);
+void e_task_shell_sidebar_remove_source
+ (ETaskShellSidebar *task_shell_sidebar,
+ ESource *source);
+
+G_END_DECLS
+
+#endif /* E_TASK_SHELL_SIDEBAR_H */
diff --git a/calendar/module/e-task-shell-view-actions.c b/calendar/module/e-task-shell-view-actions.c
new file mode 100644
index 0000000000..4645ac0e56
--- /dev/null
+++ b/calendar/module/e-task-shell-view-actions.c
@@ -0,0 +1,1125 @@
+/*
+ * e-task-shell-view-actions.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-task-shell-view-private.h"
+
+static void
+action_gal_save_custom_view_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ EShellView *shell_view;
+ GalViewInstance *view_instance;
+
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with saving the custom view. */
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ view_instance = e_task_shell_content_get_view_instance (task_shell_content);
+ gal_view_instance_save_as (view_instance);
+}
+
+static void
+action_search_execute_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ EShellView *shell_view;
+
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with executing the search. */
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ e_task_shell_view_execute_search (task_shell_view);
+}
+
+static void
+action_search_filter_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ ETaskShellView *task_shell_view)
+{
+ e_task_shell_view_execute_search (task_shell_view);
+}
+
+static void
+action_task_assign_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only open the first selected task. */
+ e_task_shell_view_open_task (task_shell_view, comp_data);
+
+ /* FIXME Need to actually assign the task. */
+}
+
+static void
+action_task_clipboard_copy_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ e_calendar_table_copy_clipboard (task_table);
+}
+
+static void
+action_task_clipboard_cut_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ e_calendar_table_cut_clipboard (task_table);
+}
+
+static void
+action_task_clipboard_paste_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ e_calendar_table_paste_clipboard (task_table);
+}
+
+static void
+action_task_delete_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalComponentPreview *task_preview;
+ ECalendarTable *task_table;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ task_preview = e_task_shell_content_get_task_preview (task_shell_content);
+
+ e_task_shell_view_set_status_message (
+ task_shell_view, _("Deleting selected tasks..."), -1.0);
+ e_calendar_table_delete_selected (task_table);
+ e_task_shell_view_set_status_message (task_shell_view, NULL, -1.0);
+
+ e_cal_component_preview_clear (task_preview);
+}
+
+static void
+action_task_forward_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ GSList *list;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only forward the first selected task. */
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_component_set_icalcomponent (comp, clone);
+ itip_send_comp (
+ E_CAL_COMPONENT_METHOD_PUBLISH, comp,
+ comp_data->client, NULL, NULL, NULL, TRUE);
+ g_object_unref (comp);
+}
+
+static void
+action_task_list_copy_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellSidebar *task_shell_sidebar;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ ESourceSelector *selector;
+ ESource *source;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
+ selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ copy_source_dialog (
+ GTK_WINDOW (shell_window),
+ source, E_CAL_SOURCE_TYPE_TODO);
+}
+
+static void
+action_task_list_delete_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellBackend *task_shell_backend;
+ ETaskShellContent *task_shell_content;
+ ETaskShellSidebar *task_shell_sidebar;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ ECalendarTable *task_table;
+ ECal *client;
+ ECalModel *model;
+ ESourceSelector *selector;
+ ESourceGroup *source_group;
+ ESourceList *source_list;
+ ESource *source;
+ gint response;
+ gchar *uri;
+ GError *error = NULL;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ task_shell_backend = task_shell_view->priv->task_shell_backend;
+ source_list = e_task_shell_backend_get_source_list (task_shell_backend);
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ model = e_calendar_table_get_model (task_table);
+
+ task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
+ selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ /* Ask for confirmation. */
+ response = e_error_run (
+ GTK_WINDOW (shell_window),
+ "calendar:prompt-delete-task-list",
+ e_source_peek_name (source));
+ if (response != GTK_RESPONSE_YES)
+ return;
+
+ uri = e_source_get_uri (source);
+ client = e_cal_model_get_client_for_uri (model, uri);
+ if (client == NULL)
+ client = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_JOURNAL);
+ g_free (uri);
+
+ g_return_if_fail (client != NULL);
+
+ if (!e_cal_remove (client, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ if (e_source_selector_source_is_selected (selector, source)) {
+ e_task_shell_sidebar_remove_source (
+ task_shell_sidebar, source);
+ e_source_selector_unselect_source (selector, source);
+ }
+
+ source_group = e_source_peek_group (source);
+ e_source_group_remove_source (source_group, source);
+
+ if (!e_source_list_sync (source_list, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+action_task_list_new_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ calendar_setup_new_task_list (GTK_WINDOW (shell_window));
+}
+
+static void
+action_task_list_print_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ETable *table;
+ GtkPrintOperationAction print_action;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ table = e_calendar_table_get_table (task_table);
+
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+ print_table (table, _("Print Tasks"), _("Tasks"), print_action);
+}
+
+static void
+action_task_list_print_preview_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ETable *table;
+ GtkPrintOperationAction print_action;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ table = e_calendar_table_get_table (task_table);
+
+ print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
+ print_table (table, _("Print Tasks"), _("Tasks"), print_action);
+}
+
+static void
+action_task_list_properties_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellSidebar *task_shell_sidebar;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ESource *source;
+ ESourceSelector *selector;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
+ selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
+ source = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (E_IS_SOURCE (source));
+
+ calendar_setup_edit_task_list (GTK_WINDOW (shell_window), source);
+}
+
+static void
+action_task_list_rename_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellSidebar *task_shell_sidebar;
+ ESourceSelector *selector;
+
+ task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
+ selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
+
+ e_source_selector_edit_primary_selection (selector);
+}
+
+static void
+action_task_list_select_one_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellSidebar *task_shell_sidebar;
+ ESourceSelector *selector;
+ ESource *primary;
+ GSList *list, *iter;
+
+ /* XXX ESourceSelector should provide a function for this. */
+
+ task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
+ selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
+ primary = e_source_selector_peek_primary_selection (selector);
+ g_return_if_fail (primary != NULL);
+
+ list = e_source_selector_get_selection (selector);
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ESource *source = iter->data;
+
+ if (source == primary)
+ continue;
+
+ e_source_selector_unselect_source (selector, source);
+ }
+ e_source_selector_free_selection (list);
+
+ e_source_selector_select_source (selector, primary);
+}
+
+static void
+action_task_mark_complete_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ECalModel *model;
+ GSList *list, *iter;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ list = e_calendar_table_get_selected (task_table);
+ model = e_calendar_table_get_model (task_table);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ e_cal_model_tasks_mark_comp_complete (
+ E_CAL_MODEL_TASKS (model), comp_data);
+ }
+
+ g_slist_free (list);
+}
+
+static void
+action_task_mark_incomplete_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ECalModel *model;
+ GSList *list, *iter;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ list = e_calendar_table_get_selected (task_table);
+ model = e_calendar_table_get_model (task_table);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ e_cal_model_tasks_mark_comp_incomplete (
+ E_CAL_MODEL_TASKS (model), comp_data);
+ }
+
+ g_slist_free (list);
+}
+
+static void
+action_task_new_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ ECal *client;
+ ECalComponent *comp;
+ CompEditor *editor;
+ GSList *list;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ client = comp_data->client;
+ editor = task_editor_new (client, shell, COMP_EDITOR_NEW_ITEM);
+ comp = cal_comp_task_new_with_defaults (client);
+ comp_editor_edit_comp (editor, comp);
+
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (comp);
+ g_object_unref (client);
+}
+
+static void
+action_task_open_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only open the first selected task. */
+ e_task_shell_view_open_task (task_shell_view, comp_data);
+}
+
+static void
+action_task_open_url_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ icalproperty *prop;
+ const gchar *uri;
+ GSList *list;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+
+ /* XXX We only open the URI of the first selected task. */
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ g_return_if_fail (prop == NULL);
+
+ uri = icalproperty_get_url (prop);
+ e_show_uri (GTK_WINDOW (shell_window), uri);
+}
+
+static void
+action_task_preview_cb (GtkToggleAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ gboolean visible;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ visible = gtk_toggle_action_get_active (action);
+ e_task_shell_content_set_preview_visible (task_shell_content, visible);
+}
+
+static void
+action_task_print_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ GtkPrintOperationAction print_action;
+ GSList *list;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ /* XXX We only print the first selected task. */
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+ e_cal_component_set_icalcomponent (comp, clone);
+ print_comp (comp, comp_data->client, print_action);
+ g_object_unref (comp);
+}
+
+static void
+action_task_purge_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkWidget *dialog;
+ GtkWidget *widget;
+ gboolean active;
+ gint response;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ if (!calendar_config_get_confirm_purge ())
+ goto purge;
+
+ /* XXX This needs reworked. The dialog looks like ass. */
+
+ dialog = gtk_message_dialog_new (
+ GTK_WINDOW (shell_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_YES_NO,
+ "%s", _("This operation will permanently erase all tasks "
+ "marked as completed. If you continue, you will not be able "
+ "to recover these tasks.\n\nReally erase these tasks?"));
+
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_NO);
+
+ widget = gtk_check_button_new_with_label (_("Do not ask me again"));
+ gtk_box_pack_start (
+ GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 6);
+ gtk_widget_show (widget);
+
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+ active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ gtk_widget_destroy (dialog);
+
+ if (response != GTK_RESPONSE_YES)
+ return;
+
+ if (active)
+ calendar_config_set_confirm_purge (FALSE);
+
+purge:
+
+ /* FIXME */
+ ;
+}
+
+static void
+action_task_save_as_cb (GtkAction *action,
+ ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ECalModelComponent *comp_data;
+ GSList *list;
+ gchar *filename;
+ gchar *string;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ list = e_calendar_table_get_selected (task_table);
+ g_return_if_fail (list != NULL);
+ comp_data = list->data;
+ g_slist_free (list);
+
+ filename = e_file_dialog_save (_("Save as..."), NULL);
+ if (filename == NULL)
+ return;
+
+ string = e_cal_get_component_as_string (
+ comp_data->client, comp_data->icalcomp);
+ if (string == NULL) {
+ g_warning ("Could not convert task to a string");
+ return;
+ }
+
+ e_write_file_uri (filename, string);
+
+ g_free (filename);
+ g_free (string);
+}
+
+static GtkActionEntry task_entries[] = {
+
+ { "task-assign",
+ NULL,
+ N_("_Assign Task"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_task_assign_cb) },
+
+ { "task-clipboard-copy",
+ GTK_STOCK_COPY,
+ NULL,
+ NULL,
+ N_("Copy selected tasks"),
+ G_CALLBACK (action_task_clipboard_copy_cb) },
+
+ { "task-clipboard-cut",
+ GTK_STOCK_CUT,
+ NULL,
+ NULL,
+ N_("Cut selected tasks"),
+ G_CALLBACK (action_task_clipboard_cut_cb) },
+
+ { "task-clipboard-paste",
+ GTK_STOCK_PASTE,
+ NULL,
+ NULL,
+ N_("Paste tasks from the clipboard"),
+ G_CALLBACK (action_task_clipboard_paste_cb) },
+
+ { "task-delete",
+ GTK_STOCK_DELETE,
+ N_("_Delete Task"),
+ NULL,
+ N_("Delete selected tasks"),
+ G_CALLBACK (action_task_delete_cb) },
+
+ { "task-forward",
+ "mail-forward",
+ N_("_Forward as iCalendar..."),
+ "<Control>f",
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_task_forward_cb) },
+
+ { "task-list-copy",
+ GTK_STOCK_COPY,
+ N_("Copy..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_task_list_copy_cb) },
+
+ { "task-list-delete",
+ GTK_STOCK_DELETE,
+ N_("_Delete"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_task_list_delete_cb) },
+
+ { "task-list-new",
+ "stock_todo",
+ N_("_New Task List"),
+ NULL,
+ N_("Create a new task list"),
+ G_CALLBACK (action_task_list_new_cb) },
+
+ { "task-list-properties",
+ GTK_STOCK_PROPERTIES,
+ NULL,
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_task_list_properties_cb) },
+
+ { "task-list-rename",
+ NULL,
+ N_("_Rename..."),
+ "F2",
+ N_("Rename the selected task list"),
+ G_CALLBACK (action_task_list_rename_cb) },
+
+ { "task-list-select-one",
+ "stock_check-filled",
+ N_("Show _Only This Task List"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_task_list_select_one_cb) },
+
+ { "task-mark-complete",
+ NULL,
+ N_("_Mark as Complete"),
+ "<Control>k",
+ N_("Mark selected tasks as complete"),
+ G_CALLBACK (action_task_mark_complete_cb) },
+
+ { "task-mark-incomplete",
+ NULL,
+ N_("Mar_k as Incomplete"),
+ NULL,
+ N_("Mark selected tasks as incomplete"),
+ G_CALLBACK (action_task_mark_incomplete_cb) },
+
+ { "task-new",
+ "stock_task",
+ N_("New _Task"),
+ NULL,
+ N_("Create a new task"),
+ G_CALLBACK (action_task_new_cb) },
+
+ { "task-open",
+ GTK_STOCK_OPEN,
+ N_("_Open Task"),
+ "<Control>o",
+ N_("View the selected task"),
+ G_CALLBACK (action_task_open_cb) },
+
+ { "task-open-url",
+ "applications-internet",
+ N_("Open _Web Page"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_task_open_url_cb) },
+
+ { "task-purge",
+ NULL,
+ N_("Purg_e"),
+ "<Control>e",
+ N_("Delete completed tasks"),
+ G_CALLBACK (action_task_purge_cb) },
+
+ { "task-save-as",
+ GTK_STOCK_SAVE_AS,
+ N_("_Save as iCalendar..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_task_save_as_cb) },
+
+ /*** Menus ***/
+
+ { "task-actions-menu",
+ NULL,
+ N_("_Actions"),
+ NULL,
+ NULL,
+ NULL }
+};
+
+static EPopupActionEntry task_popup_entries[] = {
+
+ { "task-list-popup-copy",
+ NULL,
+ "task-list-copy" },
+
+ { "task-list-popup-delete",
+ NULL,
+ "task-list-delete" },
+
+ { "task-list-popup-properties",
+ NULL,
+ "task-list-properties" },
+
+ { "task-list-popup-rename",
+ NULL,
+ "task-list-rename" },
+
+ { "task-list-popup-select-one",
+ NULL,
+ "task-list-select-one" },
+
+ { "task-popup-assign",
+ NULL,
+ "task-assign" },
+
+ { "task-popup-clipboard-copy",
+ NULL,
+ "task-clipboard-copy" },
+
+ { "task-popup-clipboard-cut",
+ NULL,
+ "task-clipboard-cut" },
+
+ { "task-popup-clipboard-paste",
+ NULL,
+ "task-clipboard-paste" },
+
+ { "task-popup-delete",
+ NULL,
+ "task-delete" },
+
+ { "task-popup-forward",
+ NULL,
+ "task-forward" },
+
+ { "task-popup-mark-complete",
+ NULL,
+ "task-mark-complete" },
+
+ { "task-popup-mark-incomplete",
+ NULL,
+ "task-mark-incomplete" },
+
+ { "task-popup-open",
+ NULL,
+ "task-open" },
+
+ { "task-popup-open-url",
+ NULL,
+ "task-open-url" },
+
+ { "task-popup-save-as",
+ NULL,
+ "task-save-as" },
+};
+
+static GtkToggleActionEntry task_toggle_entries[] = {
+
+ { "task-preview",
+ NULL,
+ N_("Task _Preview"),
+ "<Control>m",
+ N_("Show task preview pane"),
+ G_CALLBACK (action_task_preview_cb),
+ TRUE }
+};
+
+static GtkRadioActionEntry task_filter_entries[] = {
+
+ { "task-filter-active-tasks",
+ NULL,
+ N_("Active Tasks"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ TASK_FILTER_ACTIVE_TASKS },
+
+ { "task-filter-any-category",
+ NULL,
+ N_("Any Category"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ TASK_FILTER_ANY_CATEGORY },
+
+ { "task-filter-completed-tasks",
+ NULL,
+ N_("Completed Tasks"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ TASK_FILTER_COMPLETED_TASKS },
+
+ { "task-filter-next-7-days-tasks",
+ NULL,
+ N_("Next 7 Days' Tasks"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ TASK_FILTER_NEXT_7_DAYS_TASKS },
+
+ { "task-filter-overdue-tasks",
+ NULL,
+ N_("Overdue Tasks"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ TASK_FILTER_OVERDUE_TASKS },
+
+ { "task-filter-tasks-with-attachments",
+ NULL,
+ N_("Tasks with Attachments"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ TASK_FILTER_TASKS_WITH_ATTACHMENTS },
+
+ { "task-filter-unmatched",
+ NULL,
+ N_("Unmatched"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ TASK_FILTER_UNMATCHED }
+};
+
+static GtkRadioActionEntry task_search_entries[] = {
+
+ { "task-search-any-field-contains",
+ NULL,
+ N_("Any field contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ TASK_SEARCH_ANY_FIELD_CONTAINS },
+
+ { "task-search-description-contains",
+ NULL,
+ N_("Description contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ TASK_SEARCH_DESCRIPTION_CONTAINS },
+
+ { "task-search-summary-contains",
+ NULL,
+ N_("Summary contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ TASK_SEARCH_SUMMARY_CONTAINS }
+};
+
+static GtkActionEntry lockdown_printing_entries[] = {
+
+ { "task-list-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ "<Control>p",
+ N_("Print the list of tasks"),
+ G_CALLBACK (action_task_list_print_cb) },
+
+ { "task-list-print-preview",
+ GTK_STOCK_PRINT_PREVIEW,
+ NULL,
+ NULL,
+ N_("Preview the list of tasks to be printed"),
+ G_CALLBACK (action_task_list_print_preview_cb) },
+
+ { "task-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ NULL,
+ N_("Print the selected task"),
+ G_CALLBACK (action_task_print_cb) }
+};
+
+static EPopupActionEntry lockdown_printing_popup_entries[] = {
+
+ { "task-popup-print",
+ NULL,
+ "task-print" }
+};
+
+void
+e_task_shell_view_actions_init (ETaskShellView *task_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+ GConfBridge *bridge;
+ GtkAction *action;
+ GObject *object;
+ const gchar *key;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ /* Task Actions */
+ action_group = ACTION_GROUP (TASKS);
+ gtk_action_group_add_actions (
+ action_group, task_entries,
+ G_N_ELEMENTS (task_entries), task_shell_view);
+ e_action_group_add_popup_actions (
+ action_group, task_popup_entries,
+ G_N_ELEMENTS (task_popup_entries));
+ gtk_action_group_add_toggle_actions (
+ action_group, task_toggle_entries,
+ G_N_ELEMENTS (task_toggle_entries), task_shell_view);
+ gtk_action_group_add_radio_actions (
+ action_group, task_search_entries,
+ G_N_ELEMENTS (task_search_entries),
+ TASK_SEARCH_SUMMARY_CONTAINS,
+ NULL, NULL);
+
+ /* Lockdown Printing Actions */
+ action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
+ gtk_action_group_add_actions (
+ action_group, lockdown_printing_entries,
+ G_N_ELEMENTS (lockdown_printing_entries), task_shell_view);
+ e_action_group_add_popup_actions (
+ action_group, lockdown_printing_popup_entries,
+ G_N_ELEMENTS (lockdown_printing_popup_entries));
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (ACTION (TASK_PREVIEW));
+ key = "/apps/evolution/calendar/display/show_task_preview";
+ gconf_bridge_bind_property (bridge, key, object, "active");
+
+ /* Fine tuning. */
+
+ action = ACTION (TASK_DELETE);
+ g_object_set (action, "short-label", _("Delete"), NULL);
+
+ g_signal_connect (
+ ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
+ G_CALLBACK (action_gal_save_custom_view_cb), task_shell_view);
+
+ g_signal_connect (
+ ACTION (SEARCH_EXECUTE), "activate",
+ G_CALLBACK (action_search_execute_cb), task_shell_view);
+}
+
+void
+e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view)
+{
+ EShellContent *shell_content;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ GtkActionGroup *action_group;
+ GtkRadioAction *radio_action;
+ GList *list, *iter;
+ GSList *group;
+ gint ii;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ action_group = ACTION_GROUP (TASKS_FILTER);
+ e_action_group_remove_all_actions (action_group);
+
+ /* Add the standard filter actions. */
+ gtk_action_group_add_radio_actions (
+ action_group, task_filter_entries,
+ G_N_ELEMENTS (task_filter_entries),
+ TASK_FILTER_ANY_CATEGORY,
+ G_CALLBACK (action_search_filter_cb),
+ task_shell_view);
+
+ /* Retrieve the radio group from an action we just added. */
+ list = gtk_action_group_list_actions (action_group);
+ radio_action = GTK_RADIO_ACTION (list->data);
+ group = gtk_radio_action_get_group (radio_action);
+ g_list_free (list);
+
+ /* Build the category actions. */
+
+ list = e_categories_get_list ();
+ for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) {
+ const gchar *category_name = iter->data;
+ const gchar *filename;
+ GtkAction *action;
+ gchar *action_name;
+
+ action_name = g_strdup_printf (
+ "task-filter-category-%d", ii);
+ radio_action = gtk_radio_action_new (
+ action_name, category_name, NULL, NULL, ii);
+ g_free (action_name);
+
+ /* Convert the category icon file to a themed icon name. */
+ filename = e_categories_get_icon_file_for (category_name);
+ if (filename != NULL && *filename != '\0') {
+ gchar *basename;
+ gchar *cp;
+
+ basename = g_path_get_basename (filename);
+
+ /* Lose the file extension. */
+ if ((cp = strrchr (basename, '.')) != NULL)
+ *cp = '\0';
+
+ g_object_set (
+ radio_action, "icon-name", basename, NULL);
+
+ g_free (basename);
+ }
+
+ gtk_radio_action_set_group (radio_action, group);
+ group = gtk_radio_action_get_group (radio_action);
+
+ /* The action group takes ownership of the action. */
+ action = GTK_ACTION (radio_action);
+ gtk_action_group_add_action (action_group, action);
+ g_object_unref (radio_action);
+ }
+ g_list_free (list);
+
+ /* Use any action in the group; doesn't matter which. */
+ e_shell_content_set_filter_action (shell_content, radio_action);
+
+ ii = TASK_FILTER_UNMATCHED;
+ e_shell_content_add_filter_separator_after (shell_content, ii);
+
+ ii = TASK_FILTER_TASKS_WITH_ATTACHMENTS;
+ e_shell_content_add_filter_separator_after (shell_content, ii);
+}
diff --git a/calendar/module/e-task-shell-view-actions.h b/calendar/module/e-task-shell-view-actions.h
new file mode 100644
index 0000000000..d7db39bcc9
--- /dev/null
+++ b/calendar/module/e-task-shell-view-actions.h
@@ -0,0 +1,105 @@
+/*
+ * e-task-shell-view-actions.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_TASK_SHELL_VIEW_ACTIONS_H
+#define E_TASK_SHELL_VIEW_ACTIONS_H
+
+#include <shell/e-shell-window-actions.h>
+
+/* Task Actions */
+#define E_SHELL_WINDOW_ACTION_TASK_ASSIGN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-assign")
+#define E_SHELL_WINDOW_ACTION_TASK_CLIPBOARD_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-clipboard-copy")
+#define E_SHELL_WINDOW_ACTION_TASK_CLIPBOARD_CUT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-clipboard-cut")
+#define E_SHELL_WINDOW_ACTION_TASK_CLIPBOARD_PASTE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-clipboard-paste")
+#define E_SHELL_WINDOW_ACTION_TASK_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-delete")
+#define E_SHELL_WINDOW_ACTION_TASK_FORWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-forward")
+#define E_SHELL_WINDOW_ACTION_TASK_MARK_COMPLETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-mark-complete")
+#define E_SHELL_WINDOW_ACTION_TASK_MARK_INCOMPLETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-mark-incomplete")
+#define E_SHELL_WINDOW_ACTION_TASK_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-new")
+#define E_SHELL_WINDOW_ACTION_TASK_OPEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-open")
+#define E_SHELL_WINDOW_ACTION_TASK_OPEN_URL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-open-url")
+#define E_SHELL_WINDOW_ACTION_TASK_PREVIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-preview")
+#define E_SHELL_WINDOW_ACTION_TASK_PRINT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-print")
+#define E_SHELL_WINDOW_ACTION_TASK_PURGE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-purge")
+#define E_SHELL_WINDOW_ACTION_TASK_SAVE_AS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-save-as")
+
+/* Task List Actions */
+#define E_SHELL_WINDOW_ACTION_TASK_LIST_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-list-copy")
+#define E_SHELL_WINDOW_ACTION_TASK_LIST_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-list-delete")
+#define E_SHELL_WINDOW_ACTION_TASK_LIST_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-list-new")
+#define E_SHELL_WINDOW_ACTION_TASK_LIST_PRINT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-list-print")
+#define E_SHELL_WINDOW_ACTION_TASK_LIST_PRINT_PREVIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-list-print-preview")
+#define E_SHELL_WINDOW_ACTION_TASK_LIST_PROPERTIES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-list-properties")
+#define E_SHELL_WINDOW_ACTION_TASK_LIST_RENAME(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-list-rename")
+#define E_SHELL_WINDOW_ACTION_TASK_LIST_SELECT_ONE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-list-select-one")
+
+/* Task Query Actions */
+#define E_SHELL_WINDOW_ACTION_TASK_FILTER_ACTIVE_TASKS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-filter-active-tasks")
+#define E_SHELL_WINDOW_ACTION_TASK_FILTER_ANY_CATEGORY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-filter-any-category")
+#define E_SHELL_WINDOW_ACTION_TASK_FILTER_COMPLETED_TASKS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-filter-completed-tasks")
+#define E_SHELL_WINDOW_ACTION_TASK_FILTER_NEXT_7_DAYS_TASKS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-filter-next-7-days-tasks")
+#define E_SHELL_WINDOW_ACTION_TASK_FILTER_OVERDUE_TASKS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-filter-overdue-tasks")
+#define E_SHELL_WINDOW_ACTION_TASK_FILTER_TASKS_WITH_ATTACHMENTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-filter-tasks-with-attachments")
+#define E_SHELL_WINDOW_ACTION_TASK_FILTER_UNMATCHED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-filter-unmatched")
+#define E_SHELL_WINDOW_ACTION_TASK_SEARCH_ANY_FIELD_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-search-any-field-contains")
+#define E_SHELL_WINDOW_ACTION_TASK_SEARCH_DESCRIPTION_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-search-description-contains")
+#define E_SHELL_WINDOW_ACTION_TASK_SEARCH_SUMMARY_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "task-search-summary-contains")
+
+/* Action Groups */
+#define E_SHELL_WINDOW_ACTION_GROUP_TASKS(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "tasks")
+#define E_SHELL_WINDOW_ACTION_GROUP_TASKS_FILTER(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "tasks-filter")
+
+#endif /* E_TASK_SHELL_VIEW_ACTIONS_H */
diff --git a/calendar/module/e-task-shell-view-private.c b/calendar/module/e-task-shell-view-private.c
new file mode 100644
index 0000000000..d6fd8e35aa
--- /dev/null
+++ b/calendar/module/e-task-shell-view-private.c
@@ -0,0 +1,744 @@
+/*
+ * e-task-shell-view-private.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-task-shell-view-private.h"
+
+#include "widgets/menus/gal-view-factory-etable.h"
+
+static void
+task_shell_view_config_hide_completed_tasks_changed_cb (GConfClient *client,
+ guint id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ ETaskShellView *task_shell_view = user_data;
+ ETaskShellContent *task_shell_content;
+ ETaskShellSidebar *task_shell_sidebar;
+ ECalendarTable *task_table;
+ GList *clients;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
+ clients = e_task_shell_sidebar_get_clients (task_shell_sidebar);
+
+ e_calendar_table_process_completed_tasks (task_table, clients, TRUE);
+
+ /* Search query takes whether to show completed tasks into account,
+ * so if the preference has changed we need to update the query. */
+ e_task_shell_view_execute_search (task_shell_view);
+
+ g_list_free (clients);
+}
+
+static void
+task_shell_view_config_timezone_changed_cb (GConfClient *client,
+ guint id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ ETaskShellView *task_shell_view = user_data;
+
+ e_task_shell_view_update_timezone (task_shell_view);
+}
+
+static void
+task_shell_view_table_popup_event_cb (EShellView *shell_view,
+ GdkEventButton *event)
+{
+ const gchar *widget_path;
+
+ widget_path = "/task-popup";
+ e_shell_view_show_popup_menu (shell_view, widget_path, event);
+}
+
+static void
+task_shell_view_table_user_created_cb (ETaskShellView *task_shell_view,
+ ECalendarTable *task_table)
+{
+ ETaskShellSidebar *task_shell_sidebar;
+ ECalModel *model;
+ ECal *client;
+ ESource *source;
+
+ /* This is the "Click to Add" handler. */
+
+ model = e_calendar_table_get_model (task_table);
+ client = e_cal_model_get_default_client (model);
+ source = e_cal_get_source (client);
+
+ task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
+ e_task_shell_sidebar_add_source (task_shell_sidebar, source);
+
+ e_cal_model_add_client (model, client);
+}
+
+static void
+task_shell_view_selector_client_added_cb (ETaskShellView *task_shell_view,
+ ECal *client)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ECalModel *model;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ model = e_calendar_table_get_model (task_table);
+
+ e_cal_model_add_client (model, client);
+ e_task_shell_view_update_timezone (task_shell_view);
+}
+
+static void
+task_shell_view_selector_client_removed_cb (ETaskShellView *task_shell_view,
+ ECal *client)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ECalModel *model;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ model = e_calendar_table_get_model (task_table);
+
+ e_cal_model_remove_client (model, client);
+}
+
+static gboolean
+task_shell_view_selector_popup_event_cb (EShellView *shell_view,
+ ESource *primary_source,
+ GdkEventButton *event)
+{
+ const gchar *widget_path;
+
+ widget_path = "/task-list-popup";
+ e_shell_view_show_popup_menu (shell_view, widget_path, event);
+
+ return TRUE;
+}
+
+static gboolean
+task_shell_view_update_timeout_cb (ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ETaskShellSidebar *task_shell_sidebar;
+ ECalendarTable *task_table;
+ ECalModel *model;
+ GList *clients;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ model = e_calendar_table_get_model (task_table);
+
+ task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
+ clients = e_task_shell_sidebar_get_clients (task_shell_sidebar);
+
+ e_calendar_table_process_completed_tasks (task_table, clients, FALSE);
+ e_cal_model_tasks_update_due_tasks (E_CAL_MODEL_TASKS (model));
+
+ g_list_free (clients);
+
+ return TRUE;
+}
+
+static void
+task_shell_view_load_view_collection (EShellViewClass *shell_view_class)
+{
+ GalViewCollection *collection;
+ GalViewFactory *factory;
+ ETableSpecification *spec;
+ const gchar *base_dir;
+ gchar *filename;
+
+ collection = shell_view_class->view_collection;
+
+ base_dir = EVOLUTION_ETSPECDIR;
+ spec = e_table_specification_new ();
+ filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
+ if (!e_table_specification_load_from_file (spec, filename))
+ g_critical ("Unable to load ETable specification file "
+ "for tasks");
+ g_free (filename);
+
+ factory = gal_view_factory_etable_new (spec);
+ gal_view_collection_add_factory (collection, factory);
+ g_object_unref (factory);
+ g_object_unref (spec);
+
+ gal_view_collection_load (collection);
+}
+
+static void
+task_shell_view_notify_view_id_cb (ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ GalViewInstance *view_instance;
+ const gchar *view_id;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ view_instance =
+ e_task_shell_content_get_view_instance (task_shell_content);
+ view_id = e_shell_view_get_view_id (E_SHELL_VIEW (task_shell_view));
+
+ /* A NULL view ID implies we're in a custom view. But you can
+ * only get to a custom view via the "Define Views" dialog, which
+ * would have already modified the view instance appropriately.
+ * Furthermore, there's no way to refer to a custom view by ID
+ * anyway, since custom views have no IDs. */
+ if (view_id == NULL)
+ return;
+
+ gal_view_instance_set_current_view_id (view_instance, view_id);
+}
+
+void
+e_task_shell_view_private_init (ETaskShellView *task_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ if (!gal_view_collection_loaded (shell_view_class->view_collection))
+ task_shell_view_load_view_collection (shell_view_class);
+
+ g_signal_connect (
+ task_shell_view, "notify::view-id",
+ G_CALLBACK (task_shell_view_notify_view_id_cb), NULL);
+}
+
+void
+e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
+{
+ ETaskShellViewPrivate *priv = task_shell_view->priv;
+ ETaskShellContent *task_shell_content;
+ ETaskShellSidebar *task_shell_sidebar;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellWindow *shell_window;
+ ECalendarTable *task_table;
+ ECalModel *model;
+ ETable *table;
+ ESourceSelector *selector;
+ guint id;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ e_shell_window_add_action_group (shell_window, "tasks");
+ e_shell_window_add_action_group (shell_window, "tasks-filter");
+
+ /* Cache these to avoid lots of awkward casting. */
+ priv->task_shell_backend = g_object_ref (shell_backend);
+ priv->task_shell_content = g_object_ref (shell_content);
+ priv->task_shell_sidebar = g_object_ref (shell_sidebar);
+
+ task_shell_content = E_TASK_SHELL_CONTENT (shell_content);
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ model = e_calendar_table_get_model (task_table);
+ table = e_calendar_table_get_table (task_table);
+
+ task_shell_sidebar = E_TASK_SHELL_SIDEBAR (shell_sidebar);
+ selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
+
+ g_signal_connect_swapped (
+ task_table, "open-component",
+ G_CALLBACK (e_task_shell_view_open_task),
+ task_shell_view);
+
+ g_signal_connect_swapped (
+ task_table, "popup-event",
+ G_CALLBACK (task_shell_view_table_popup_event_cb),
+ task_shell_view);
+
+ g_signal_connect_swapped (
+ task_table, "status-message",
+ G_CALLBACK (e_task_shell_view_set_status_message),
+ task_shell_view);
+
+ g_signal_connect_swapped (
+ task_table, "user-created",
+ G_CALLBACK (task_shell_view_table_user_created_cb),
+ task_shell_view);
+
+ g_signal_connect_swapped (
+ model, "model-changed",
+ G_CALLBACK (e_task_shell_view_update_sidebar),
+ task_shell_view);
+
+ g_signal_connect_swapped (
+ model, "model-rows-deleted",
+ G_CALLBACK (e_task_shell_view_update_sidebar),
+ task_shell_view);
+
+ g_signal_connect_swapped (
+ model, "model-rows-inserted",
+ G_CALLBACK (e_task_shell_view_update_sidebar),
+ task_shell_view);
+
+ g_signal_connect_swapped (
+ table, "selection-change",
+ G_CALLBACK (e_task_shell_view_update_sidebar),
+ task_shell_view);
+
+ g_signal_connect_swapped (
+ task_shell_sidebar, "client-added",
+ G_CALLBACK (task_shell_view_selector_client_added_cb),
+ task_shell_view);
+
+ g_signal_connect_swapped (
+ task_shell_sidebar, "client-removed",
+ G_CALLBACK (task_shell_view_selector_client_removed_cb),
+ task_shell_view);
+
+ g_signal_connect_swapped (
+ task_shell_sidebar, "status-message",
+ G_CALLBACK (e_task_shell_view_set_status_message),
+ task_shell_view);
+
+ g_signal_connect_swapped (
+ selector, "popup-event",
+ G_CALLBACK (task_shell_view_selector_popup_event_cb),
+ task_shell_view);
+
+ g_signal_connect_swapped (
+ selector, "primary-selection-changed",
+ G_CALLBACK (e_shell_view_update_actions),
+ task_shell_view);
+
+ e_categories_register_change_listener (
+ G_CALLBACK (e_task_shell_view_update_search_filter),
+ task_shell_view);
+
+ task_shell_view_update_timeout_cb (task_shell_view);
+ priv->update_timeout = g_timeout_add_full (
+ G_PRIORITY_LOW, 60000, (GSourceFunc)
+ task_shell_view_update_timeout_cb,
+ task_shell_view, NULL);
+
+ /* Listen for configuration changes. */
+
+ /* Timezone */
+ id = calendar_config_add_notification_timezone (
+ task_shell_view_config_timezone_changed_cb, task_shell_view);
+ priv->notifications = g_list_prepend (
+ priv->notifications, GUINT_TO_POINTER (id));
+
+ /* Hide Completed Tasks (enable/units/value) */
+ id = calendar_config_add_notification_hide_completed_tasks (
+ task_shell_view_config_hide_completed_tasks_changed_cb,
+ task_shell_view);
+ priv->notifications = g_list_prepend (
+ priv->notifications, GUINT_TO_POINTER (id));
+ id = calendar_config_add_notification_hide_completed_tasks_units (
+ task_shell_view_config_hide_completed_tasks_changed_cb,
+ task_shell_view);
+ priv->notifications = g_list_prepend (
+ priv->notifications, GUINT_TO_POINTER (id));
+ id = calendar_config_add_notification_hide_completed_tasks_value (
+ task_shell_view_config_hide_completed_tasks_changed_cb,
+ task_shell_view);
+ priv->notifications = g_list_prepend (
+ priv->notifications, GUINT_TO_POINTER (id));
+
+ e_task_shell_view_actions_init (task_shell_view);
+ e_task_shell_view_update_sidebar (task_shell_view);
+ e_task_shell_view_update_search_filter (task_shell_view);
+ e_task_shell_view_update_timezone (task_shell_view);
+
+ e_task_shell_view_execute_search (task_shell_view);
+}
+
+void
+e_task_shell_view_private_dispose (ETaskShellView *task_shell_view)
+{
+ ETaskShellViewPrivate *priv = task_shell_view->priv;
+ GList *iter;
+
+ DISPOSE (priv->task_shell_backend);
+ DISPOSE (priv->task_shell_content);
+ DISPOSE (priv->task_shell_sidebar);
+
+ if (task_shell_view->priv->activity != NULL) {
+ /* XXX Activity is no cancellable. */
+ e_activity_complete (task_shell_view->priv->activity);
+ g_object_unref (task_shell_view->priv->activity);
+ task_shell_view->priv->activity = NULL;
+ }
+
+ if (priv->update_timeout > 0) {
+ g_source_remove (priv->update_timeout);
+ priv->update_timeout = 0;
+ }
+
+ for (iter = priv->notifications; iter != NULL; iter = iter->next) {
+ guint notification_id = GPOINTER_TO_UINT (iter->data);
+ calendar_config_remove_notification (notification_id);
+ }
+ g_list_free (priv->notifications);
+ priv->notifications = NULL;
+}
+
+void
+e_task_shell_view_private_finalize (ETaskShellView *task_shell_view)
+{
+ /* XXX Nothing to do? */
+}
+
+void
+e_task_shell_view_execute_search (ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellContent *shell_content;
+ GtkAction *action;
+ GString *string;
+ ECalComponentPreview *task_preview;
+ ECalendarTable *task_table;
+ ECalModel *model;
+ FilterRule *rule;
+ const gchar *format;
+ const gchar *text;
+ time_t start_range;
+ time_t end_range;
+ gchar *start, *end;
+ gchar *query;
+ gchar *temp;
+ gint value;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ text = e_shell_content_get_search_text (shell_content);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ action = ACTION (TASK_SEARCH_ANY_FIELD_CONTAINS);
+ value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
+
+ if (text == NULL || *text == '\0') {
+ text = "";
+ value = TASK_SEARCH_SUMMARY_CONTAINS;
+ }
+
+ switch (value) {
+ default:
+ text = "";
+ /* fall through */
+
+ case TASK_SEARCH_SUMMARY_CONTAINS:
+ format = "(contains? \"summary\" %s)";
+ break;
+
+ case TASK_SEARCH_DESCRIPTION_CONTAINS:
+ format = "(contains? \"description\" %s)";
+ break;
+
+ case TASK_SEARCH_ANY_FIELD_CONTAINS:
+ format = "(contains? \"any\" %s)";
+ break;
+ }
+
+ /* Build the query. */
+ string = g_string_new ("");
+ e_sexp_encode_string (string, text);
+ query = g_strdup_printf (format, string->str);
+ g_string_free (string, TRUE);
+
+ /* Apply selected filter. */
+ value = e_shell_content_get_filter_value (shell_content);
+ switch (value) {
+ case TASK_FILTER_ANY_CATEGORY:
+ break;
+
+ case TASK_FILTER_UNMATCHED:
+ temp = g_strdup_printf (
+ "(and (has-categories? #f) %s)", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case TASK_FILTER_NEXT_7_DAYS_TASKS:
+ start_range = time (NULL);
+ end_range = time_add_day (start_range, 7);
+ start = isodate_from_time_t (start_range);
+ end = isodate_from_time_t (end_range);
+
+ temp = g_strdup_printf (
+ "(and %s (due-in-time-range? "
+ "(make-time \"%s\") (make-time \"%s\")))",
+ query, start, end);
+ g_free (query);
+ query = temp;
+ break;
+
+ case TASK_FILTER_ACTIVE_TASKS:
+ start_range = time (NULL);
+ end_range = time_add_day (start_range, 365);
+ start = isodate_from_time_t (start_range);
+ end = isodate_from_time_t (end_range);
+
+ temp = g_strdup_printf (
+ "(and %s (due-in-time-range? "
+ "(make-time \"%s\") (make-time \"%s\")) "
+ "(not (is-completed?)))",
+ query, start, end);
+ g_free (query);
+ query = temp;
+ break;
+
+ case TASK_FILTER_OVERDUE_TASKS:
+ start_range = 0;
+ end_range = time (NULL);
+ start = isodate_from_time_t (start_range);
+ end = isodate_from_time_t (end_range);
+
+ temp = g_strdup_printf (
+ "(and %s (due-in-time-range? "
+ "(make-time \"%s\") (make-time \"%s\")) "
+ "(not (is-completed?)))",
+ query, start, end);
+ g_free (query);
+ query = temp;
+ break;
+
+ case TASK_FILTER_COMPLETED_TASKS:
+ temp = g_strdup_printf (
+ "(and (is-completed?) %s)", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case TASK_FILTER_TASKS_WITH_ATTACHMENTS:
+ temp = g_strdup_printf (
+ "(and (has-attachments?) %s)", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ default:
+ {
+ GList *categories;
+ const gchar *category_name;
+
+ categories = e_categories_get_list ();
+ category_name = g_list_nth_data (categories, value);
+ g_list_free (categories);
+
+ temp = g_strdup_printf (
+ "(and (has-categories? \"%s\") %s)",
+ category_name, query);
+ g_free (query);
+ query = temp;
+ break;
+ }
+ }
+
+ /* Honor the user's preference to hide completed tasks. */
+ temp = calendar_config_get_hide_completed_tasks_sexp (FALSE);
+ if (temp != NULL) {
+ gchar *temp2;
+
+ temp2 = g_strdup_printf ("(and %s %s)", temp, query);
+ g_free (query);
+ g_free (temp);
+ query = temp2;
+ }
+
+ /* XXX This is wrong. We need to programmatically construct a
+ * FilterRule, tell it to build code, and pass the resulting
+ * expression string to ECalModel. */
+ rule = filter_rule_new ();
+ e_shell_content_set_search_rule (shell_content, rule);
+ g_object_unref (rule);
+
+ /* Submit the query. */
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+ model = e_calendar_table_get_model (task_table);
+ e_cal_model_set_search_query (model, query);
+ g_free (query);
+
+ task_preview =
+ e_task_shell_content_get_task_preview (task_shell_content);
+ e_cal_component_preview_clear (task_preview);
+}
+
+void
+e_task_shell_view_open_task (ETaskShellView *task_shell_view,
+ ECalModelComponent *comp_data)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+ ECalComponent *comp;
+ icalcomponent *clone;
+ icalproperty *prop;
+ const gchar *uid;
+
+ g_return_if_fail (E_IS_TASK_SHELL_VIEW (task_shell_view));
+ g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data));
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ uid = icalcomponent_get_uid (comp_data->icalcomp);
+ editor = comp_editor_find_instance (uid);
+
+ if (editor != NULL)
+ goto exit;
+
+ comp = e_cal_component_new ();
+ clone = icalcomponent_new_clone (comp_data->icalcomp);
+ e_cal_component_set_icalcomponent (comp, clone);
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
+ if (prop != NULL)
+ flags |= COMP_EDITOR_IS_ASSIGNED;
+
+ if (itip_organizer_is_user (comp, comp_data->client))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ if (!e_cal_component_has_attendees (comp))
+ flags |= COMP_EDITOR_USER_ORG;
+
+ editor = task_editor_new (comp_data->client, shell, flags);
+ comp_editor_edit_comp (editor, comp);
+
+ g_object_ref (comp);
+
+ if (flags & COMP_EDITOR_IS_ASSIGNED)
+ task_editor_show_assignment (TASK_EDITOR (editor));
+
+exit:
+ gtk_window_present (GTK_WINDOW (editor));
+}
+
+void
+e_task_shell_view_set_status_message (ETaskShellView *task_shell_view,
+ const gchar *status_message,
+ gdouble percent)
+{
+ EActivity *activity;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+
+ g_return_if_fail (E_IS_TASK_SHELL_VIEW (task_shell_view));
+
+ activity = task_shell_view->priv->activity;
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ if (status_message == NULL || *status_message == '\0') {
+ if (activity != NULL) {
+ e_activity_complete (activity);
+ g_object_unref (activity);
+ activity = NULL;
+ }
+
+ } else if (activity == NULL) {
+ activity = e_activity_new (status_message);
+ e_activity_set_percent (activity, percent);
+ e_shell_backend_add_activity (shell_backend, activity);
+
+ } else {
+ e_activity_set_percent (activity, percent);
+ e_activity_set_primary_text (activity, status_message);
+ }
+
+ task_shell_view->priv->activity = activity;
+}
+
+void
+e_task_shell_view_update_sidebar (ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ EShellView *shell_view;
+ EShellSidebar *shell_sidebar;
+ ECalendarTable *task_table;
+ ECalModel *model;
+ ETable *table;
+ GString *string;
+ const gchar *format;
+ gint n_rows;
+ gint n_selected;
+
+ shell_view = E_SHELL_VIEW (task_shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ model = e_calendar_table_get_model (task_table);
+ table = e_calendar_table_get_table (task_table);
+
+ n_rows = e_table_model_row_count (E_TABLE_MODEL (model));
+ n_selected = e_table_selected_count (table);
+
+ string = g_string_sized_new (64);
+
+ format = ngettext ("%d task", "%d tasks", n_rows);
+ g_string_append_printf (string, format, n_rows);
+
+ if (n_selected > 0) {
+ format = _("%d selected");
+ g_string_append_len (string, ", ", 2);
+ g_string_append_printf (string, format, n_selected);
+ }
+
+ e_shell_sidebar_set_secondary_text (shell_sidebar, string->str);
+
+ g_string_free (string, TRUE);
+}
+
+void
+e_task_shell_view_update_timezone (ETaskShellView *task_shell_view)
+{
+ ETaskShellContent *task_shell_content;
+ ETaskShellSidebar *task_shell_sidebar;
+ ECalComponentPreview *task_preview;
+ icaltimezone *timezone;
+ GList *clients, *iter;
+
+ task_shell_content = task_shell_view->priv->task_shell_content;
+ task_preview = e_task_shell_content_get_task_preview (task_shell_content);
+
+ task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
+ clients = e_task_shell_sidebar_get_clients (task_shell_sidebar);
+
+ timezone = calendar_config_get_icaltimezone ();
+
+ for (iter = clients; iter != NULL; iter = iter->next) {
+ ECal *client = iter->data;
+
+ if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
+ e_cal_set_default_timezone (client, timezone, NULL);
+ }
+
+ e_cal_component_preview_set_default_timezone (task_preview, timezone);
+
+ g_list_free (clients);
+}
diff --git a/calendar/module/e-task-shell-view-private.h b/calendar/module/e-task-shell-view-private.h
new file mode 100644
index 0000000000..d3bb3cf086
--- /dev/null
+++ b/calendar/module/e-task-shell-view-private.h
@@ -0,0 +1,141 @@
+/*
+ * e-task-shell-view-private.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_TASK_SHELL_VIEW_PRIVATE_H
+#define E_TASK_SHELL_VIEW_PRIVATE_H
+
+#include "e-task-shell-view.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <libecal/e-cal-time-util.h>
+#include <libedataserver/e-categories.h>
+#include <libedataserver/e-sexp.h>
+
+#include "e-util/e-dialog-utils.h"
+#include "e-util/e-error.h"
+#include "e-util/e-util.h"
+#include "e-util/gconf-bridge.h"
+#include "widgets/misc/e-popup-action.h"
+
+#include "calendar/common/authentication.h"
+#include "calendar/gui/calendar-config.h"
+#include "calendar/gui/comp-util.h"
+#include "calendar/gui/e-cal-component-preview.h"
+#include "calendar/gui/e-cal-model-tasks.h"
+#include "calendar/gui/e-calendar-selector.h"
+#include "calendar/gui/print.h"
+#include "calendar/gui/dialogs/calendar-setup.h"
+#include "calendar/gui/dialogs/copy-source-dialog.h"
+#include "calendar/gui/dialogs/task-editor.h"
+
+#include "e-task-shell-backend.h"
+#include "e-task-shell-content.h"
+#include "e-task-shell-sidebar.h"
+#include "e-task-shell-view-actions.h"
+
+#define E_TASK_SHELL_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TASK_SHELL_VIEW, ETaskShellViewPrivate))
+
+/* Shorthand, requires a variable named "shell_window". */
+#define ACTION(name) \
+ (E_SHELL_WINDOW_ACTION_##name (shell_window))
+#define ACTION_GROUP(name) \
+ (E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window))
+
+/* For use in dispose() methods. */
+#define DISPOSE(obj) \
+ G_STMT_START { \
+ if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \
+ } G_STMT_END
+
+/* ETable Specifications */
+#define ETSPEC_FILENAME "e-calendar-table.etspec"
+
+G_BEGIN_DECLS
+
+/* Filter items are displayed in ascending order.
+ * Non-negative values are reserved for categories. */
+enum {
+ TASK_FILTER_ANY_CATEGORY = -7,
+ TASK_FILTER_UNMATCHED = -6,
+ TASK_FILTER_NEXT_7_DAYS_TASKS = -5,
+ TASK_FILTER_ACTIVE_TASKS = -4,
+ TASK_FILTER_OVERDUE_TASKS = -3,
+ TASK_FILTER_COMPLETED_TASKS = -2,
+ TASK_FILTER_TASKS_WITH_ATTACHMENTS = -1
+};
+
+/* Search items are displayed in ascending order. */
+enum {
+ TASK_SEARCH_SUMMARY_CONTAINS,
+ TASK_SEARCH_DESCRIPTION_CONTAINS,
+ TASK_SEARCH_ANY_FIELD_CONTAINS
+};
+
+struct _ETaskShellViewPrivate {
+
+ /* These are just for convenience. */
+ ETaskShellBackend *task_shell_backend;
+ ETaskShellContent *task_shell_content;
+ ETaskShellSidebar *task_shell_sidebar;
+
+ EActivity *activity;
+ guint update_timeout;
+
+ /* GConf notification IDs */
+ GList *notifications;
+};
+
+void e_task_shell_view_private_init
+ (ETaskShellView *task_shell_view,
+ EShellViewClass *shell_view_class);
+void e_task_shell_view_private_constructed
+ (ETaskShellView *task_shell_view);
+void e_task_shell_view_private_dispose
+ (ETaskShellView *task_shell_view);
+void e_task_shell_view_private_finalize
+ (ETaskShellView *task_shell_view);
+
+/* Private Utilities */
+
+void e_task_shell_view_actions_init
+ (ETaskShellView *task_shell_view);
+void e_task_shell_view_execute_search
+ (ETaskShellView *task_shell_view);
+void e_task_shell_view_open_task
+ (ETaskShellView *task_shell_view,
+ ECalModelComponent *comp_data);
+void e_task_shell_view_set_status_message
+ (ETaskShellView *task_shell_view,
+ const gchar *status_message,
+ gdouble percent);
+void e_task_shell_view_update_sidebar
+ (ETaskShellView *task_shell_view);
+void e_task_shell_view_update_search_filter
+ (ETaskShellView *task_shell_view);
+void e_task_shell_view_update_timezone
+ (ETaskShellView *task_shell_view);
+
+G_END_DECLS
+
+#endif /* E_TASK_SHELL_VIEW_PRIVATE_H */
diff --git a/calendar/module/e-task-shell-view.c b/calendar/module/e-task-shell-view.c
new file mode 100644
index 0000000000..ce1b53a43c
--- /dev/null
+++ b/calendar/module/e-task-shell-view.c
@@ -0,0 +1,255 @@
+/*
+ * e-task-shell-view.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-task-shell-view-private.h"
+
+static gpointer parent_class;
+static GType task_shell_view_type;
+
+static void
+task_shell_view_dispose (GObject *object)
+{
+ e_task_shell_view_private_dispose (E_TASK_SHELL_VIEW (object));
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+task_shell_view_finalize (GObject *object)
+{
+ e_task_shell_view_private_finalize (E_TASK_SHELL_VIEW (object));
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+task_shell_view_constructed (GObject *object)
+{
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ e_task_shell_view_private_constructed (E_TASK_SHELL_VIEW (object));
+}
+
+static void
+task_shell_view_update_actions (EShellView *shell_view)
+{
+ ETaskShellViewPrivate *priv;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellWindow *shell_window;
+ GtkAction *action;
+ const gchar *label;
+ gboolean sensitive;
+ guint32 state;
+
+ /* Be descriptive. */
+ gboolean any_tasks_selected;
+ gboolean has_primary_source;
+ gboolean multiple_tasks_selected;
+ gboolean primary_source_is_system;
+ gboolean selection_has_url;
+ gboolean selection_is_assignable;
+ gboolean single_task_selected;
+ gboolean some_tasks_complete;
+ gboolean some_tasks_incomplete;
+ gboolean sources_are_editable;
+
+ priv = E_TASK_SHELL_VIEW_GET_PRIVATE (shell_view);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ state = e_shell_content_check_state (shell_content);
+
+ single_task_selected =
+ (state & E_TASK_SHELL_CONTENT_SELECTION_SINGLE);
+ multiple_tasks_selected =
+ (state & E_TASK_SHELL_CONTENT_SELECTION_MULTIPLE);
+ selection_is_assignable =
+ (state & E_TASK_SHELL_CONTENT_SELECTION_CAN_ASSIGN);
+ sources_are_editable =
+ (state & E_TASK_SHELL_CONTENT_SELECTION_CAN_EDIT);
+ some_tasks_complete =
+ (state & E_TASK_SHELL_CONTENT_SELECTION_HAS_COMPLETE);
+ some_tasks_incomplete =
+ (state & E_TASK_SHELL_CONTENT_SELECTION_HAS_INCOMPLETE);
+ selection_has_url =
+ (state & E_TASK_SHELL_CONTENT_SELECTION_HAS_URL);
+
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ state = e_shell_sidebar_check_state (shell_sidebar);
+
+ has_primary_source =
+ (state & E_TASK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE);
+ primary_source_is_system =
+ (state & E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_SYSTEM);
+
+ any_tasks_selected =
+ (single_task_selected || multiple_tasks_selected);
+
+ action = ACTION (TASK_ASSIGN);
+ sensitive =
+ single_task_selected && sources_are_editable &&
+ selection_is_assignable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_CLIPBOARD_COPY);
+ sensitive = any_tasks_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_CLIPBOARD_CUT);
+ sensitive = any_tasks_selected && sources_are_editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_CLIPBOARD_PASTE);
+ sensitive = sources_are_editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_DELETE);
+ sensitive = any_tasks_selected && sources_are_editable;
+ gtk_action_set_sensitive (action, sensitive);
+ if (multiple_tasks_selected)
+ label = _("Delete Tasks");
+ else
+ label = _("Delete Task");
+ g_object_set (action, "label", label, NULL);
+
+ action = ACTION (TASK_FORWARD);
+ sensitive = single_task_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_LIST_COPY);
+ sensitive = has_primary_source;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_LIST_DELETE);
+ sensitive = has_primary_source && !primary_source_is_system;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_LIST_PROPERTIES);
+ sensitive = has_primary_source;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_LIST_RENAME);
+ sensitive = has_primary_source;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_MARK_COMPLETE);
+ sensitive =
+ any_tasks_selected &&
+ sources_are_editable &&
+ some_tasks_incomplete;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_MARK_INCOMPLETE);
+ sensitive =
+ any_tasks_selected &&
+ sources_are_editable &&
+ some_tasks_complete;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_OPEN);
+ sensitive = single_task_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_OPEN_URL);
+ sensitive = single_task_selected && selection_has_url;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_PRINT);
+ sensitive = single_task_selected;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_PURGE);
+ sensitive = sources_are_editable;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (TASK_SAVE_AS);
+ sensitive = single_task_selected;
+ gtk_action_set_sensitive (action, sensitive);
+}
+
+static void
+task_shell_view_class_init (ETaskShellViewClass *class,
+ GTypeModule *type_module)
+{
+ GObjectClass *object_class;
+ EShellViewClass *shell_view_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ETaskShellViewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = task_shell_view_dispose;
+ object_class->finalize = task_shell_view_finalize;
+ object_class->constructed = task_shell_view_constructed;
+
+ shell_view_class = E_SHELL_VIEW_CLASS (class);
+ shell_view_class->label = _("Tasks");
+ shell_view_class->icon_name = "evolution-tasks";
+ shell_view_class->ui_definition = "evolution-tasks.ui";
+ shell_view_class->ui_manager_id = "org.gnome.evolution.tasks";
+ shell_view_class->search_options = "/task-search-options";
+ shell_view_class->search_rules = "tasktypes.xml";
+ shell_view_class->new_shell_content = e_task_shell_content_new;
+ shell_view_class->new_shell_sidebar = e_task_shell_sidebar_new;
+ shell_view_class->update_actions = task_shell_view_update_actions;
+}
+
+static void
+task_shell_view_init (ETaskShellView *task_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ task_shell_view->priv =
+ E_TASK_SHELL_VIEW_GET_PRIVATE (task_shell_view);
+
+ e_task_shell_view_private_init (task_shell_view, shell_view_class);
+}
+
+GType
+e_task_shell_view_get_type (void)
+{
+ return task_shell_view_type;
+}
+
+void
+e_task_shell_view_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (ETaskShellViewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) task_shell_view_class_init,
+ (GClassFinalizeFunc) NULL,
+ type_module,
+ sizeof (ETaskShellView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) task_shell_view_init,
+ NULL /* value_table */
+ };
+
+ task_shell_view_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_VIEW,
+ "ETaskShellView", &type_info, 0);
+}
diff --git a/calendar/module/e-task-shell-view.h b/calendar/module/e-task-shell-view.h
new file mode 100644
index 0000000000..8478e53cc2
--- /dev/null
+++ b/calendar/module/e-task-shell-view.h
@@ -0,0 +1,67 @@
+/*
+ * e-task-shell-view.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_TASK_SHELL_VIEW_H
+#define E_TASK_SHELL_VIEW_H
+
+#include <shell/e-shell-view.h>
+#include <libedataserver/e-source-list.h>
+
+/* Standard GObject macros */
+#define E_TYPE_TASK_SHELL_VIEW \
+ (e_task_shell_view_get_type ())
+#define E_TASK_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_TASK_SHELL_VIEW, ETaskShellView))
+#define E_TASK_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_TASK_SHELL_VIEW, ETaskShellViewClass))
+#define E_IS_TASK_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_TASK_SHELL_VIEW))
+#define E_IS_TASK_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_TASK_SHELL_VIEW))
+#define E_TASK_SHELL_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_TASK_SHELL_VIEW, ETaskShellViewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ETaskShellView ETaskShellView;
+typedef struct _ETaskShellViewClass ETaskShellViewClass;
+typedef struct _ETaskShellViewPrivate ETaskShellViewPrivate;
+
+struct _ETaskShellView {
+ EShellView parent;
+ ETaskShellViewPrivate *priv;
+};
+
+struct _ETaskShellViewClass {
+ EShellViewClass parent_class;
+};
+
+GType e_task_shell_view_get_type (void);
+void e_task_shell_view_register_type (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_TASK_SHELL_VIEW_H */
diff --git a/calendar/module/evolution-module-calendar.c b/calendar/module/evolution-module-calendar.c
new file mode 100644
index 0000000000..63bf98ead9
--- /dev/null
+++ b/calendar/module/evolution-module-calendar.c
@@ -0,0 +1,65 @@
+/*
+ * evolution-module-calendar.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-cal-shell-backend.h"
+#include "e-cal-shell-content.h"
+#include "e-cal-shell-sidebar.h"
+#include "e-cal-shell-view.h"
+
+#include "e-memo-shell-backend.h"
+#include "e-memo-shell-content.h"
+#include "e-memo-shell-sidebar.h"
+#include "e-memo-shell-view.h"
+
+#include "e-task-shell-backend.h"
+#include "e-task-shell-content.h"
+#include "e-task-shell-sidebar.h"
+#include "e-task-shell-view.h"
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ /* Register dynamically loaded types. */
+
+ e_cal_shell_backend_register_type (type_module);
+ e_cal_shell_content_register_type (type_module);
+ e_cal_shell_sidebar_register_type (type_module);
+ e_cal_shell_view_register_type (type_module);
+
+ e_memo_shell_backend_register_type (type_module);
+ e_memo_shell_content_register_type (type_module);
+ e_memo_shell_sidebar_register_type (type_module);
+ e_memo_shell_view_register_type (type_module);
+
+ e_task_shell_backend_register_type (type_module);
+ e_task_shell_content_register_type (type_module);
+ e_task_shell_sidebar_register_type (type_module);
+ e_task_shell_view_register_type (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}
diff --git a/composer/Makefile.am b/composer/Makefile.am
index 97debe59d0..12ad680bcf 100644
--- a/composer/Makefile.am
+++ b/composer/Makefile.am
@@ -38,8 +38,6 @@ INCLUDES = \
$(EVOLUTION_MAIL_CFLAGS)
libcomposer_la_SOURCES = \
- $(IDL_GENERATED) \
- $(HTML_EDITOR_GENERATED) \
$(libcomposerinclude_HEADERS) \
e-composer-actions.c \
e-composer-autosave.c \
@@ -52,6 +50,9 @@ libcomposer_la_SOURCES = \
e-composer-text-header.c \
e-msg-composer.c
+libcomposer_la_LIBADD = \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/em-format/libemformat.la
uidir = $(evolutionuidir)
ui_DATA = evolution-composer.ui
@@ -61,7 +62,7 @@ EXTRA_DIST = \
mail-composer.error.xml \
ChangeLog.pre-1-4
-BUILT_SOURCES = $(IDL_GENERATED) $(HTML_EDITOR_GENERATED) $(error_DATA)
+BUILT_SOURCES = $(error_DATA)
CLEANFILES = $(BUILT_SOURCES)
dist-hook:
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c
index 3b40d270f0..1ef7e610ad 100644
--- a/composer/e-composer-actions.c
+++ b/composer/e-composer-actions.c
@@ -21,9 +21,6 @@
#include <errno.h>
#include <fcntl.h>
#include <e-util/e-error.h>
-#include <mail/em-event.h>
-#include <mail/em-format-html-print.h>
-#include <mail/em-composer-utils.h>
#include "misc/e-charset-picker.h"
@@ -50,7 +47,7 @@ action_charset_cb (GtkRadioAction *action,
if (action != current)
return;
- charset = gtk_action_get_name (GTK_ACTION (current));
+ charset = g_object_get_data (G_OBJECT (action), "charset");
g_free (composer->priv->charset);
composer->priv->charset = g_strdup (charset);
@@ -128,15 +125,9 @@ action_print_cb (GtkAction *action,
EMsgComposer *composer)
{
GtkPrintOperationAction print_action;
- CamelMimeMessage *message;
- EMFormatHTMLPrint *efhp;
print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
- message = e_msg_composer_get_message (composer, 1);
-
- efhp = em_format_html_print_new (NULL, print_action);
- em_format_html_print_raw_message (efhp, message);
- g_object_unref (efhp);
+ e_msg_composer_print (composer, print_action);
}
static void
@@ -144,15 +135,9 @@ action_print_preview_cb (GtkAction *action,
EMsgComposer *composer)
{
GtkPrintOperationAction print_action;
- CamelMimeMessage *message;
- EMFormatHTMLPrint *efhp;
print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
- message = e_msg_composer_get_message_print (composer, 1);
-
- efhp = em_format_html_print_new (NULL, print_action);
- em_format_html_print_raw_message (efhp, message);
- g_object_unref (efhp);
+ e_msg_composer_print (composer, print_action);
}
static void
@@ -263,6 +248,8 @@ static void
action_send_options_cb (GtkAction *action,
EMsgComposer *composer)
{
+ /* FIXME: KILL-BONOBO - should this be here when -no-undefined removed? */
+ /*
EMEvent *event = em_event_peek ();
EMEventTargetComposer *target;
@@ -274,6 +261,7 @@ action_send_options_cb (GtkAction *action,
(EEvent *) event,
"composer.selectsendoption",
(EEventTarget *) target);
+ */
if (!composer->priv->send_invoked)
e_error_run (
@@ -283,9 +271,12 @@ action_send_options_cb (GtkAction *action,
static void
action_new_message_cb (GtkAction *action,
- EMsgComposer *composer)
+ EMsgComposer *composer)
{
- em_utils_compose_new_message (NULL);
+ EMsgComposer *new_composer;
+
+ new_composer = e_msg_composer_new ();
+ gtk_widget_show (GTK_WIDGET (new_composer));
}
static void
@@ -508,7 +499,7 @@ e_composer_actions_init (EMsgComposer *composer)
gtk_action_group_set_translation_domain (
action_group, GETTEXT_PACKAGE);
e_charset_add_radio_actions (
- action_group, composer->priv->charset,
+ action_group, "charset-", composer->priv->charset,
G_CALLBACK (action_charset_cb), composer);
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c
index f25c3b722c..d883d8ecb2 100644
--- a/composer/e-composer-header-table.c
+++ b/composer/e-composer-header-table.c
@@ -514,7 +514,6 @@ composer_header_table_constructor (GType type,
if (composer_lite)
gtk_widget_show_all ((GtkWidget *)priv->actions_container);
-
ii = E_COMPOSER_HEADER_FROM;
/* Leave room in the "From" row for signature stuff. */
diff --git a/composer/e-composer-header.c b/composer/e-composer-header.c
index 7b7cb9bcf2..63894f43c1 100644
--- a/composer/e-composer-header.c
+++ b/composer/e-composer-header.c
@@ -326,7 +326,8 @@ composer_header_class_init (EComposerHeaderClass *class)
"changed",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
+ G_STRUCT_OFFSET (EComposerHeaderClass, changed),
+ NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -334,7 +335,8 @@ composer_header_class_init (EComposerHeaderClass *class)
"clicked",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
+ G_STRUCT_OFFSET (EComposerHeaderClass, clicked),
+ NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
diff --git a/composer/e-composer-header.h b/composer/e-composer-header.h
index eb339d647c..c136e996a9 100644
--- a/composer/e-composer-header.h
+++ b/composer/e-composer-header.h
@@ -28,7 +28,7 @@
((obj), E_TYPE_COMPOSER_HEADER, EComposerHeader))
#define E_COMPOSER_HEADER_CLASS(cls) \
(G_TYPE_CHECK_CLASS_CAST \
- ((obj), E_TYPE_COMPOSER_HEADER, EComposerHeaderClass))
+ ((cls), E_TYPE_COMPOSER_HEADER, EComposerHeaderClass))
#define E_IS_COMPOSER_HEADER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE \
((obj), E_TYPE_COMPOSER_HEADER))
@@ -55,6 +55,10 @@ struct _EComposerHeader {
struct _EComposerHeaderClass {
GObjectClass parent_class;
+
+ /* Signals */
+ void (*changed) (EComposerHeader *header);
+ void (*clicked) (EComposerHeader *header);
};
GType e_composer_header_get_type (void);
diff --git a/composer/e-composer-name-header.c b/composer/e-composer-name-header.c
index bfc9441fb7..7184bbec89 100644
--- a/composer/e-composer-name-header.c
+++ b/composer/e-composer-name-header.c
@@ -47,18 +47,6 @@ struct _EComposerNameHeaderPrivate {
static gpointer parent_class;
static void
-composer_name_header_clicked_cb (EComposerNameHeader *header)
-{
- ENameSelectorDialog *dialog;
-
- dialog = e_name_selector_peek_dialog (header->priv->name_selector);
- e_name_selector_dialog_set_destination_index (
- dialog, header->priv->destination_index);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_hide (GTK_WIDGET (dialog));
-}
-
-static void
composer_name_header_entry_changed_cb (ENameSelectorEntry *entry,
EComposerNameHeader *header)
{
@@ -132,10 +120,6 @@ composer_name_header_constructor (GType type,
NULL);
E_COMPOSER_HEADER (object)->input_widget = g_object_ref_sink (entry);
- g_signal_connect (
- object, "clicked",
- G_CALLBACK (composer_name_header_clicked_cb), NULL);
-
return object;
}
@@ -194,9 +178,25 @@ composer_name_header_dispose (GObject *object)
}
static void
+composer_name_header_clicked (EComposerHeader *header)
+{
+ EComposerNameHeaderPrivate *priv;
+ ENameSelectorDialog *dialog;
+
+ priv = E_COMPOSER_NAME_HEADER_GET_PRIVATE (header);
+
+ dialog = e_name_selector_peek_dialog (priv->name_selector);
+ e_name_selector_dialog_set_destination_index (
+ dialog, priv->destination_index);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_hide (GTK_WIDGET (dialog));
+}
+
+static void
composer_name_header_class_init (EComposerNameHeaderClass *class)
{
GObjectClass *object_class;
+ EComposerHeaderClass *header_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EComposerNameHeaderPrivate));
@@ -207,6 +207,9 @@ composer_name_header_class_init (EComposerNameHeaderClass *class)
object_class->get_property = composer_name_header_get_property;
object_class->dispose = composer_name_header_dispose;
+ header_class = E_COMPOSER_HEADER_CLASS (class);
+ header_class->clicked = composer_name_header_clicked;
+
g_object_class_install_property (
object_class,
PROP_NAME_SELECTOR,
diff --git a/composer/e-composer-post-header.c b/composer/e-composer-post-header.c
index 59d81b80ac..cb297fe375 100644
--- a/composer/e-composer-post-header.c
+++ b/composer/e-composer-post-header.c
@@ -22,9 +22,7 @@
#include <string.h>
#include <glib/gi18n.h>
-
-#include "mail/em-folder-selector.h"
-#include "mail/em-folder-tree.h"
+#include <camel/camel-url.h>
#define E_COMPOSER_POST_HEADER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -43,10 +41,6 @@ struct _EComposerPostHeaderPrivate {
static gpointer parent_class;
-/* Forward Declarations (to avoid pulling in Bonobo stuff) */
-struct _MailComponent *mail_component_peek (void);
-struct _EMFolderTreeModel *mail_component_peek_tree_model (struct _MailComponent *component);
-
static gchar *
composer_post_header_folder_name_to_string (EComposerPostHeader *header,
const gchar *url)
@@ -106,56 +100,6 @@ composer_post_header_split_csv (const gchar *csv)
return g_list_reverse (list);
}
-static void
-composer_post_header_changed_cb (EComposerPostHeader *header)
-{
- header->priv->custom = TRUE;
-}
-
-static void
-composer_post_header_clicked_cb (EComposerPostHeader *header)
-{
- EMFolderTreeModel *model;
- GtkWidget *folder_tree;
- GtkWidget *dialog;
- GList *list;
-
- model = mail_component_peek_tree_model (mail_component_peek ());
- folder_tree = em_folder_tree_new_with_model (model);
-
- em_folder_tree_set_multiselect (
- EM_FOLDER_TREE (folder_tree), TRUE);
- em_folder_tree_set_excluded (
- EM_FOLDER_TREE (folder_tree),
- EMFT_EXCLUDE_NOSELECT |
- EMFT_EXCLUDE_VIRTUAL |
- EMFT_EXCLUDE_VTRASH);
-
- dialog = em_folder_selector_new (
- EM_FOLDER_TREE (folder_tree),
- EM_FOLDER_SELECTOR_CAN_CREATE,
- _("Posting destination"),
- _("Choose folders to post the message to."),
- NULL);
-
- list = e_composer_post_header_get_folders (header);
- em_folder_selector_set_selected_list (
- EM_FOLDER_SELECTOR (dialog), list);
- g_list_foreach (list, (GFunc) g_free, NULL);
- g_list_free (list);
-
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
- list = em_folder_selector_get_selected_uris (
- EM_FOLDER_SELECTOR (dialog));
- e_composer_post_header_set_folders (header, list);
- header->priv->custom = FALSE;
- g_list_foreach (list, (GFunc) g_free, NULL);
- g_list_free (list);
- }
-
- gtk_widget_destroy (dialog);
-}
-
static GObject *
composer_post_header_constructor (GType type,
guint n_construct_properties,
@@ -171,14 +115,6 @@ composer_post_header_constructor (GType type,
E_COMPOSER_HEADER (object),
_("Click here to select folders to post to"));
- g_signal_connect (
- object, "changed",
- G_CALLBACK (composer_post_header_changed_cb), NULL);
-
- g_signal_connect (
- object, "clicked",
- G_CALLBACK (composer_post_header_clicked_cb), NULL);
-
return object;
}
@@ -246,9 +182,30 @@ composer_post_header_finalize (GObject *object)
}
static void
+composer_post_header_changed (EComposerHeader *header)
+{
+ EComposerPostHeaderPrivate *priv;
+
+ priv = E_COMPOSER_POST_HEADER_GET_PRIVATE (header);
+
+ priv->custom = TRUE;
+}
+
+static void
+composer_post_header_clicked (EComposerHeader *header)
+{
+ EComposerPostHeaderPrivate *priv;
+
+ priv = E_COMPOSER_POST_HEADER_GET_PRIVATE (header);
+
+ priv->custom = FALSE;
+}
+
+static void
composer_post_header_class_init (EComposerPostHeaderClass *class)
{
GObjectClass *object_class;
+ EComposerHeaderClass *header_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EComposerPostHeaderPrivate));
@@ -260,6 +217,10 @@ composer_post_header_class_init (EComposerPostHeaderClass *class)
object_class->dispose = composer_post_header_dispose;
object_class->finalize = composer_post_header_finalize;
+ header_class = E_COMPOSER_HEADER_CLASS (class);
+ header_class->changed = composer_post_header_changed;
+ header_class->clicked = composer_post_header_clicked;
+
g_object_class_install_property (
object_class,
PROP_ACCOUNT,
diff --git a/composer/e-composer-post-header.h b/composer/e-composer-post-header.h
index 40dc5a8d58..c38bfe2d17 100644
--- a/composer/e-composer-post-header.h
+++ b/composer/e-composer-post-header.h
@@ -46,6 +46,8 @@
G_BEGIN_DECLS
+/* Avoid including files from the Mail module. */
+
typedef struct _EComposerPostHeader EComposerPostHeader;
typedef struct _EComposerPostHeaderClass EComposerPostHeaderClass;
typedef struct _EComposerPostHeaderPrivate EComposerPostHeaderPrivate;
@@ -60,7 +62,8 @@ struct _EComposerPostHeaderClass {
};
GType e_composer_post_header_get_type (void);
-EComposerHeader * e_composer_post_header_new (const gchar *label);
+EComposerHeader *
+ e_composer_post_header_new (const gchar *label);
EAccount * e_composer_post_header_get_account
(EComposerPostHeader *header);
void e_composer_post_header_set_account
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 2a2cea6a4c..d4ec9ddc69 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -27,10 +27,12 @@ composer_setup_charset_menu (EMsgComposer *composer)
guint merge_id;
ui_manager = gtkhtml_editor_get_ui_manager (GTKHTML_EDITOR (composer));
- list = gtk_action_group_list_actions (composer->priv->charset_actions);
path = "/main-menu/edit-menu/pre-spell-check/charset-menu";
merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ list = gtk_action_group_list_actions (composer->priv->charset_actions);
+ list = g_list_sort (list, (GCompareFunc) e_action_compare_by_label);
+
while (list != NULL) {
GtkAction *action = list->data;
@@ -85,8 +87,8 @@ e_composer_private_init (EMsgComposer *composer)
GtkhtmlEditor *editor;
GtkUIManager *ui_manager;
- GtkWidget *widget;
GtkWidget *container;
+ GtkWidget *widget;
GtkWidget *send_widget;
GtkWidget *exp_box;
const gchar *path;
@@ -101,7 +103,7 @@ e_composer_private_init (EMsgComposer *composer)
widget = gtkhtml_editor_get_managed_widget (editor, "/main-menu");
gtk_widget_hide (widget);
widget = gtkhtml_editor_get_managed_widget (editor, "/main-toolbar");
- gtk_toolbar_set_style ((GtkToolbar *)widget, GTK_TOOLBAR_BOTH_HORIZ);
+ gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ);
gtk_widget_hide (widget);
}
@@ -159,7 +161,6 @@ e_composer_private_init (EMsgComposer *composer)
gtk_container_remove((GtkContainer *)send_widget, gtk_bin_get_child ((GtkBin *)send_widget));
gtk_container_add((GtkContainer *)send_widget, tmp);
gtk_button_set_relief ((GtkButton *)send_widget, GTK_RELIEF_NORMAL);
-
path = "/main-toolbar/pre-main-toolbar/save-draft";
send_widget = gtk_ui_manager_get_widget (ui_manager, path);
tmp = gtk_hbox_new (FALSE, 0);
@@ -306,6 +307,11 @@ e_composer_private_dispose (EMsgComposer *composer)
composer->priv->header_table = NULL;
}
+ if (composer->priv->attachment_paned != NULL) {
+ g_object_unref (composer->priv->attachment_paned);
+ composer->priv->attachment_paned = NULL;
+ }
+
if (composer->priv->charset_actions != NULL) {
g_object_unref (composer->priv->charset_actions);
composer->priv->charset_actions = NULL;
diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h
index 49d9ae6d74..82019b44ad 100644
--- a/composer/e-composer-private.h
+++ b/composer/e-composer-private.h
@@ -29,6 +29,7 @@
#include "e-composer-autosave.h"
#include "e-composer-header-table.h"
#include "e-util/e-binding.h"
+#include "e-util/e-util.h"
#include "e-util/gconf-bridge.h"
#include "widgets/misc/e-attachment-paned.h"
#include "widgets/misc/e-attachment-store.h"
@@ -104,7 +105,6 @@ struct _EMsgComposerPrivate {
gchar *mime_type, *mime_body, *charset;
- guint32 attachment_bar_visible : 1;
guint32 is_alternative : 1;
guint32 autosaved : 1;
guint32 mode_post : 1;
@@ -113,8 +113,6 @@ struct _EMsgComposerPrivate {
CamelMimeMessage *redirect;
- guint notify_id;
-
gboolean send_invoked;
};
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 946bff28c1..98f2c31f86 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -23,17 +23,6 @@
*
*/
-/*
-
- TODO
-
- - Somehow users should be able to see if any file (s) are attached even when
- the attachment bar is not shown.
-
- Should use EventSources to keep track of global changes made to configuration
- values. Right now it ignores the problem olympically. Miguel.
-*/
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -61,48 +50,39 @@
#include "e-util/e-dialog-utils.h"
#include "misc/e-charset-picker.h"
#include "e-util/e-error.h"
+#include "e-util/e-mktemp.h"
#include "e-util/e-plugin-ui.h"
#include "e-util/e-util-private.h"
-#include "e-util/e-util.h"
-#include "e-util/e-mktemp.h"
-#include <mail/em-event.h>
+#include "e-util/e-account-utils.h"
+#include "e-util/e-signature-utils.h"
#include "e-signature-combo-box.h"
+#include "shell/e-shell.h"
+#include "em-format/em-format.h"
+#include "em-format/em-format-quote.h"
-#include <camel/camel-session.h>
#include <camel/camel-charset-map.h>
+#include <camel/camel-cipher-context.h>
+#include <camel/camel-folder.h>
+#include <camel/camel-gpg-context.h>
#include <camel/camel-iconv.h>
-#include <camel/camel-stream-filter.h>
#include <camel/camel-mime-filter-charset.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-stream-fs.h>
#include <camel/camel-mime-filter-tohtml.h>
-#include <camel/camel-multipart-signed.h>
#include <camel/camel-multipart-encrypted.h>
+#include <camel/camel-multipart-signed.h>
+#include <camel/camel-stream-filter.h>
+#include <camel/camel-stream-fs.h>
+#include <camel/camel-stream-mem.h>
#include <camel/camel-string-utils.h>
-#include <camel/camel-cipher-context.h>
#if defined (HAVE_NSS)
#include <camel/camel-smime-context.h>
#endif
-#include "mail/em-utils.h"
-#include "mail/em-composer-utils.h"
-#include "mail/mail-config.h"
-#include "mail/mail-crypto.h"
-#include "mail/mail-tools.h"
-#include "mail/mail-ops.h"
-#include "mail/mail-mt.h"
-#include "mail/mail-session.h"
-#include "mail/em-popup.h"
-#include "mail/em-menu.h"
-
#include "e-msg-composer.h"
#include "e-attachment.h"
#include "e-composer-autosave.h"
#include "e-composer-private.h"
#include "e-composer-header-table.h"
-#include "evolution-shell-component-utils.h"
-
#ifdef HAVE_XFREE
#include <X11/XF86keysym.h>
#endif
@@ -116,6 +96,7 @@
enum {
SEND,
SAVE_DRAFT,
+ PRINT,
LAST_SIGNAL
};
@@ -142,6 +123,104 @@ static void handle_multipart_alternative (EMsgComposer *composer, CamelMultipart
static void handle_multipart_encrypted (EMsgComposer *composer, CamelMimePart *multipart, gint depth);
static void handle_multipart_signed (EMsgComposer *composer, CamelMultipart *multipart, gint depth);
+/**
+ * emcu_part_to_html:
+ * @part:
+ *
+ * Converts a mime part's contents into html text. If @credits is given,
+ * then it will be used as an attribution string, and the
+ * content will be cited. Otherwise no citation or attribution
+ * will be performed.
+ *
+ * Return Value: The part in displayable html format.
+ **/
+static char *
+emcu_part_to_html (CamelMimePart *part, ssize_t *len, EMFormat *source)
+{
+ EMFormatQuote *emfq;
+ CamelStreamMem *mem;
+ GByteArray *buf;
+ char *text;
+
+ buf = g_byte_array_new ();
+ mem = (CamelStreamMem *) camel_stream_mem_new ();
+ camel_stream_mem_set_byte_array (mem, buf);
+
+ emfq = em_format_quote_new(NULL, (CamelStream *)mem, 0);
+ ((EMFormat *) emfq)->composer = TRUE;
+ if (source) {
+ /* copy over things we can, other things are internal, perhaps need different api than 'clone' */
+ if (source->default_charset)
+ em_format_set_default_charset((EMFormat *)emfq, source->default_charset);
+ if (source->charset)
+ em_format_set_default_charset((EMFormat *)emfq, source->charset);
+ }
+ em_format_part((EMFormat *) emfq, (CamelStream *)mem, part);
+ g_object_unref(emfq);
+
+ camel_stream_write((CamelStream *) mem, "", 1);
+ camel_object_unref(mem);
+
+ text = (char *)buf->data;
+ if (len)
+ *len = buf->len-1;
+ g_byte_array_free (buf, FALSE);
+
+ return text;
+}
+
+/* copy of em_utils_prompt_user from mailer */
+static gboolean
+emcu_prompt_user (GtkWindow *parent, const char *promptkey, const char *tag, const char *arg0, ...)
+{
+ GtkWidget *mbox, *check = NULL;
+ va_list ap;
+ int button;
+ GConfClient *gconf = gconf_client_get_default ();
+
+ if (promptkey
+ && !gconf_client_get_bool(gconf, promptkey, NULL)) {
+ g_object_unref (gconf);
+ return TRUE;
+ }
+
+ va_start(ap, arg0);
+ mbox = e_error_newv(parent, tag, arg0, ap);
+ va_end(ap);
+
+ if (promptkey) {
+ check = gtk_check_button_new_with_mnemonic (_("_Do not show this message again."));
+ gtk_container_set_border_width((GtkContainer *)check, 12);
+ gtk_box_pack_start ((GtkBox *)((GtkDialog *) mbox)->vbox, check, TRUE, TRUE, 0);
+ gtk_widget_show (check);
+ }
+
+ button = gtk_dialog_run ((GtkDialog *) mbox);
+ if (promptkey)
+ gconf_client_set_bool(gconf, promptkey, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check)), NULL);
+
+ gtk_widget_destroy(mbox);
+ g_object_unref (gconf);
+
+ return button == GTK_RESPONSE_YES;
+}
+
+/* copy of mail_tool_remove_xevolution_headers */
+static struct _camel_header_raw *
+emcu_remove_xevolution_headers (CamelMimeMessage *message)
+{
+ struct _camel_header_raw *scan, *list = NULL;
+
+ for (scan = ((CamelMimePart *)message)->headers;scan;scan=scan->next)
+ if (!strncmp(scan->name, "X-Evolution", 11))
+ camel_header_raw_append(&list, scan->name, scan->value, scan->offset);
+
+ for (scan=list;scan;scan=scan->next)
+ camel_medium_remove_header((CamelMedium *)message, scan->name);
+
+ return list;
+}
+
static EDestination**
destination_list_to_vector_sized (GList *list, gint n)
{
@@ -476,6 +555,7 @@ build_message (EMsgComposer *composer,
CamelMultipart *body = NULL;
CamelContentType *type;
CamelMimeMessage *new;
+ CamelSession *session;
CamelStream *stream;
CamelMimePart *part;
CamelException ex;
@@ -495,6 +575,7 @@ build_message (EMsgComposer *composer,
account = e_composer_header_table_get_account (table);
view = e_msg_composer_get_attachment_view (composer);
store = e_attachment_view_get_store (view);
+ session = e_msg_composer_get_session (composer);
/* evil kludgy hack for Redirect */
if (p->redirect) {
@@ -746,8 +827,14 @@ build_message (EMsgComposer *composer,
if (pgp_sign) {
CamelMimePart *npart = camel_mime_part_new ();
- cipher = mail_crypto_get_pgp_cipher_context (account);
- camel_cipher_sign (cipher, pgp_userid, CAMEL_CIPHER_HASH_SHA1, part, npart, &ex);
+ cipher = camel_gpg_context_new (session);
+ if (account != NULL)
+ camel_gpg_context_set_always_trust (
+ CAMEL_GPG_CONTEXT (cipher),
+ account->pgp_always_trust);
+ camel_cipher_sign (
+ cipher, pgp_userid, CAMEL_CIPHER_HASH_SHA1,
+ part, npart, &ex);
camel_object_unref (cipher);
if (camel_exception_is_set (&ex)) {
@@ -766,8 +853,14 @@ build_message (EMsgComposer *composer,
if (account && account->pgp_encrypt_to_self && pgp_userid)
g_ptr_array_add (recipients, g_strdup (pgp_userid));
- cipher = mail_crypto_get_pgp_cipher_context (account);
- camel_cipher_encrypt (cipher, pgp_userid, recipients, part, npart, &ex);
+ cipher = camel_gpg_context_new (session);
+ if (account != NULL)
+ camel_gpg_context_set_always_trust (
+ CAMEL_GPG_CONTEXT (cipher),
+ account->pgp_always_trust);
+ camel_cipher_encrypt (
+ cipher, pgp_userid, recipients,
+ part, npart, &ex);
camel_object_unref (cipher);
if (account && account->pgp_encrypt_to_self && pgp_userid)
@@ -841,6 +934,7 @@ build_message (EMsgComposer *composer,
}
if (smime_encrypt) {
+
/* check to see if we should encrypt to self, NB removed after use */
if (account->smime_encrypt_to_self)
g_ptr_array_add (recipients, g_strdup (account->smime_encrypt_key));
@@ -920,103 +1014,6 @@ skip_content:
/* Signatures */
static gchar *
-get_file_content (EMsgComposer *composer,
- const gchar *filename,
- gboolean want_html,
- guint flags,
- gboolean warn)
-{
- CamelStreamFilter *filtered_stream;
- CamelStreamMem *memstream;
- CamelMimeFilter *html, *charenc;
- CamelStream *stream;
- GByteArray *buffer;
- gchar *charset;
- gchar *content;
- gint fd;
-
- fd = g_open (filename, O_RDONLY, 0);
- if (fd == -1) {
- if (warn)
- e_error_run ((GtkWindow *)composer, "mail-composer:no-sig-file",
- filename, g_strerror (errno), NULL);
- return g_strdup ("");
- }
-
- stream = camel_stream_fs_new_with_fd (fd);
-
- if (want_html) {
- filtered_stream = camel_stream_filter_new_with_stream (stream);
- camel_object_unref (stream);
-
- html = camel_mime_filter_tohtml_new (flags, 0);
- camel_stream_filter_add (filtered_stream, html);
- camel_object_unref (html);
-
- stream = (CamelStream *) filtered_stream;
- }
-
- memstream = (CamelStreamMem *) camel_stream_mem_new ();
- buffer = g_byte_array_new ();
- camel_stream_mem_set_byte_array (memstream, buffer);
-
- camel_stream_write_to_stream (stream, (CamelStream *) memstream);
- camel_object_unref (stream);
-
- /* The newer signature UI saves signatures in UTF-8, but we still need to check that
- the signature is valid UTF-8 because it is possible that the user imported a
- signature file that is in his/her locale charset. If it's not in UTF-8 and not in
- the charset the composer is in (or their default mail charset) then
- there's nothing we can do. */
- if (buffer->len && !g_utf8_validate ((const gchar *)buffer->data, buffer->len, NULL)) {
- stream = (CamelStream *) memstream;
- memstream = (CamelStreamMem *) camel_stream_mem_new ();
- camel_stream_mem_set_byte_array (memstream, g_byte_array_new ());
-
- filtered_stream = camel_stream_filter_new_with_stream (stream);
- camel_object_unref (stream);
-
- charset = composer && composer->priv->charset ? composer->priv->charset : NULL;
- charset = charset ? g_strdup (charset) : e_composer_get_default_charset ();
- if ((charenc = (CamelMimeFilter *) camel_mime_filter_charset_new_convert (charset, "UTF-8"))) {
- camel_stream_filter_add (filtered_stream, charenc);
- camel_object_unref (charenc);
- }
-
- g_free (charset);
-
- camel_stream_write_to_stream ((CamelStream *) filtered_stream, (CamelStream *) memstream);
- camel_object_unref (filtered_stream);
- g_byte_array_free (buffer, TRUE);
-
- buffer = memstream->buffer;
- }
-
- camel_object_unref (memstream);
-
- g_byte_array_append (buffer, (const guint8 *)"", 1);
- content = (char*)buffer->data;
- g_byte_array_free (buffer, FALSE);
-
- return content;
-}
-
-gchar *
-e_msg_composer_get_sig_file_content (const gchar *sigfile, gboolean in_html)
-{
- if (!sigfile || !*sigfile) {
- return NULL;
- }
-
- return get_file_content (NULL, sigfile, !in_html,
- CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT |
- CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
- CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES |
- CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES,
- FALSE);
-}
-
-static gchar *
encode_signature_name (const gchar *name)
{
const gchar *s;
@@ -1106,34 +1103,6 @@ decode_signature_name (const gchar *name)
return dname;
}
-static gboolean
-add_signature_delim (void)
-{
- gboolean res;
- GConfClient *client = gconf_client_get_default ();
-
- res = !gconf_client_get_bool (client, COMPOSER_GCONF_NO_SIGNATURE_DELIM_KEY, NULL);
-
- g_object_unref (client);
-
- return res;
-}
-
-static gboolean
-is_top_signature (void)
-{
- GConfClient *gconf;
- gboolean res = FALSE;
-
- gconf = gconf_client_get_default ();
-
- res = gconf_client_get_bool (gconf, COMPOSER_GCONF_TOP_SIGNATURE_KEY, NULL);
-
- g_object_unref (gconf);
-
- return res;
-}
-
#define CONVERT_SPACES CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES
#define NO_SIGNATURE_TEXT \
"<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature\" value=\"1\">-->" \
@@ -1145,7 +1114,7 @@ get_signature_html (EMsgComposer *composer)
EComposerHeaderTable *table;
gchar *text = NULL, *html = NULL;
ESignature *signature;
- gboolean format_html, add_delim;
+ gboolean format_html;
table = e_msg_composer_get_header_table (composer);
signature = e_composer_header_table_get_signature (table);
@@ -1153,19 +1122,18 @@ get_signature_html (EMsgComposer *composer)
if (!signature)
return NULL;
- add_delim = add_signature_delim ();
-
if (!signature->autogen) {
if (!signature->filename)
return NULL;
format_html = signature->html;
- if (signature->script) {
- text = mail_config_signature_run_script (signature->filename);
- } else {
- text = e_msg_composer_get_sig_file_content (signature->filename, format_html);
- }
+ if (signature->script)
+ text = e_run_signature_script (
+ signature->filename);
+ else
+ text = e_read_signature_file (
+ signature, TRUE, NULL);
} else {
EAccount *account;
EAccountIdentity *id;
@@ -1182,8 +1150,7 @@ get_signature_html (EMsgComposer *composer)
name = id->name ? camel_text_to_html (id->name, CONVERT_SPACES, 0) : NULL;
organization = id->organization ? camel_text_to_html (id->organization, CONVERT_SPACES, 0) : NULL;
- text = g_strdup_printf ("%s%s%s%s%s%s%s%s%s",
- add_delim ? "-- <BR>" : "",
+ text = g_strdup_printf ("-- <BR>%s%s%s%s%s%s%s%s",
name ? name : "",
(address && *address) ? " &lt;<A HREF=\"mailto:" : "",
address ? address : "",
@@ -1213,13 +1180,12 @@ get_signature_html (EMsgComposer *composer)
"<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature_name\" value=\"uid:%s\">-->"
"<TABLE WIDTH=\"100%%\" CELLSPACING=\"0\" CELLPADDING=\"0\"><TR><TD><BR>"
"%s%s%s%s"
- "%s</TD></TR></TABLE>",
+ "</TD></TR></TABLE>",
encoded_uid ? encoded_uid : "",
format_html ? "" : "<PRE>\n",
- format_html || !add_delim || (!strncmp ("-- \n", text, 4) || strstr (text, "\n-- \n")) ? "" : "-- \n",
+ format_html || (!strncmp ("-- \n", text, 4) || strstr (text, "\n-- \n")) ? "" : "-- \n",
text,
- format_html ? "" : "</PRE>\n",
- is_top_signature () ? "<BR>" : "");
+ format_html ? "" : "</PRE>\n");
g_free (text);
g_free (encoded_uid);
text = html;
@@ -1233,11 +1199,17 @@ set_editor_text (EMsgComposer *composer,
const gchar *text,
gboolean set_signature)
{
- gchar *body = NULL;
+ EShell *shell;
+ EShellSettings *shell_settings;
+ gboolean reply_signature_on_top;
+ gchar *body = NULL, *html = NULL;
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
g_return_if_fail (text != NULL);
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
/*
Keeping Signatures in the beginning of composer
@@ -1252,9 +1224,30 @@ set_editor_text (EMsgComposer *composer,
*/
- if (is_top_signature ()) {
- /* put marker to the top */
- body = g_strdup_printf ("<BR>" NO_SIGNATURE_TEXT "%s", text);
+ reply_signature_on_top = e_shell_settings_get_boolean (
+ shell_settings, "composer-top-signature");
+
+ if (set_signature && reply_signature_on_top) {
+ gchar *tmp = NULL;
+ tmp = get_signature_html (composer);
+ if (tmp) {
+ /* Minimizing the damage. Make it just a part of the body instead of a signature */
+ html = strstr (tmp, "-- \n");
+ if (html) {
+ /* That two consecutive - symbols followed by a space */
+ *(html+1) = ' ';
+ body = g_strdup_printf ("</br>%s</br>%s", tmp, text);
+ } else {
+ /* HTML Signature. Make it as part of body */
+ body = g_strdup_printf ("</br>%s</br>%s", tmp, text);
+ }
+ g_free (tmp);
+ } else {
+ /* No signature set */
+ body = g_strdup_printf ("<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature\" value=\"1\">-->"
+ "<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature_name\" value=\"uid:Noname\">-->"
+ "<TABLE WIDTH=\"100%%\" CELLSPACING=\"0\" CELLPADDING=\"0\"><TR><TD> </TD></TR></TABLE>%s", text);
+ }
} else {
/* no marker => to the bottom */
body = g_strdup_printf ("%s<BR>", text);
@@ -1291,14 +1284,6 @@ autosave_load_draft (const gchar *filename)
if (e_composer_autosave_snapshot (composer))
g_unlink (filename);
- g_signal_connect (
- composer, "send",
- G_CALLBACK (em_utils_composer_send_cb), NULL);
-
- g_signal_connect (
- composer, "save-draft",
- G_CALLBACK (em_utils_composer_save_draft_cb), NULL);
-
gtk_widget_show (GTK_WIDGET (composer));
}
@@ -1366,7 +1351,7 @@ msg_composer_account_changed_cb (EMsgComposer *composer)
gtk_toggle_action_set_active (action, active);
uid = account->id->sig_uid;
- signature = uid ? mail_config_get_signature_by_uid (uid) : NULL;
+ signature = uid ? e_get_signature_by_uid (uid) : NULL;
e_composer_header_table_set_signature (table, signature);
/* XXX This should be done more generically. The composer
@@ -1420,53 +1405,6 @@ msg_composer_account_list_changed_cb (EMsgComposer *composer)
g_object_unref (iterator);
}
-static void
-msg_composer_update_preferences (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EMsgComposer *composer)
-{
- GtkhtmlEditor *editor;
- gboolean enable;
- GError *error = NULL;
-
- editor = GTKHTML_EDITOR (composer);
-
- if (entry) {
- if (strcmp(gconf_entry_get_key(entry), COMPOSER_GCONF_INLINE_SPELLING_KEY) != 0 &&
- strcmp(gconf_entry_get_key(entry), COMPOSER_GCONF_MAGIC_LINKS_KEY) != 0 &&
- strcmp(gconf_entry_get_key(entry), COMPOSER_GCONF_MAGIC_SMILEYS_KEY) != 0)
- return;
- }
-
- enable = gconf_client_get_bool (
- client, COMPOSER_GCONF_INLINE_SPELLING_KEY, &error);
- if (error == NULL)
- gtkhtml_editor_set_inline_spelling (editor, enable);
- else {
- g_warning ("%s", error->message);
- g_clear_error (&error);
- }
-
- enable = gconf_client_get_bool (
- client, COMPOSER_GCONF_MAGIC_LINKS_KEY, &error);
- if (error == NULL)
- gtkhtml_editor_set_magic_links (editor, enable);
- else {
- g_warning ("%s", error->message);
- g_clear_error (&error);
- }
-
- enable = gconf_client_get_bool (
- client, COMPOSER_GCONF_MAGIC_SMILEYS_KEY, &error);
- if (error == NULL)
- gtkhtml_editor_set_magic_smileys (editor, enable);
- else {
- g_warning ("%s", error->message);
- g_clear_error (&error);
- }
-}
-
struct _drop_data {
EMsgComposer *composer;
@@ -1477,10 +1415,6 @@ struct _drop_data {
guint32 action;
guint info;
guint time;
-
- unsigned int move:1;
- unsigned int moved:1;
- unsigned int aborted:1;
};
static void
@@ -1497,11 +1431,11 @@ msg_composer_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
+ EShell *shell;
+ EShellSettings *shell_settings;
GObject *object;
EMsgComposer *composer;
GtkToggleAction *action;
- GList *spell_languages;
- GConfClient *client;
GArray *array;
gboolean active;
guint binding_id;
@@ -1511,9 +1445,11 @@ msg_composer_constructor (GType type,
type, n_construct_properties, construct_properties);
composer = E_MSG_COMPOSER (object);
- client = gconf_client_get_default ();
array = composer->priv->gconf_bridge_binding_ids;
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
/* Restore Persistent State */
binding_id = gconf_bridge_bind_property (
@@ -1530,29 +1466,16 @@ msg_composer_constructor (GType type,
/* Honor User Preferences */
- active = gconf_client_get_bool (
- client, COMPOSER_GCONF_SEND_HTML_KEY, NULL);
+ active = e_shell_settings_get_boolean (
+ shell_settings, "composer-format-html");
gtkhtml_editor_set_html_mode (GTKHTML_EDITOR (composer), active);
action = GTK_TOGGLE_ACTION (ACTION (REQUEST_READ_RECEIPT));
- active = gconf_client_get_bool (
- client, COMPOSER_GCONF_REQUEST_RECEIPT_KEY, NULL);
+ active = e_shell_settings_get_boolean (
+ shell_settings, "composer-request-receipt");
gtk_toggle_action_set_active (action, active);
- spell_languages = e_load_spell_languages ();
- gtkhtml_editor_set_spell_languages (
- GTKHTML_EDITOR (composer), spell_languages);
- g_list_free (spell_languages);
-
- gconf_client_add_dir (
- client, COMPOSER_GCONF_PREFIX,
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- composer->priv->notify_id = gconf_client_notify_add (
- client, COMPOSER_GCONF_PREFIX, (GConfClientNotifyFunc)
- msg_composer_update_preferences, composer, NULL, NULL);
- msg_composer_update_preferences (client, 0, NULL, composer);
-
- g_object_unref (client);
+ e_shell_watch_window (shell, GTK_WINDOW (object));
return object;
}
@@ -1599,15 +1522,6 @@ msg_composer_destroy (GtkObject *object)
composer->priv->address_dialog = NULL;
}
- if (composer->priv->notify_id) {
- GConfClient *client;
-
- client = gconf_client_get_default ();
- gconf_client_notify_remove (client, composer->priv->notify_id);
- composer->priv->notify_id = 0;
- g_object_unref (client);
- }
-
/* Chain up to parent's destroy() method. */
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@@ -1815,7 +1729,7 @@ msg_composer_paste_clipboard (GtkhtmlEditor *editor)
clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_CLIPBOARD);
/* Assume the clipboard has an image. The return
- * value will be NULL we we assumed wrong. */
+ * value will be NULL if we assumed wrong. */
pixbuf = gtk_clipboard_wait_for_image (clipboard);
if (!GDK_IS_PIXBUF (pixbuf))
goto chainup;
@@ -2126,7 +2040,7 @@ msg_composer_class_init (EMsgComposerClass *class)
signals[SEND] = g_signal_new (
"send",
- E_TYPE_MSG_COMPOSER,
+ G_OBJECT_CLASS_TYPE (class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
@@ -2134,11 +2048,20 @@ msg_composer_class_init (EMsgComposerClass *class)
signals[SAVE_DRAFT] = g_signal_new (
"save-draft",
- E_TYPE_MSG_COMPOSER,
+ G_OBJECT_CLASS_TYPE (class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+
+ signals[PRINT] = g_signal_new (
+ "print",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__ENUM,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_PRINT_OPERATION_ACTION);
}
static void
@@ -2153,6 +2076,7 @@ msg_composer_init (EMsgComposer *composer)
GtkUIManager *ui_manager;
GtkhtmlEditor *editor;
GtkHTML *html;
+ const gchar *id;
gint n_targets;
composer->lite = composer_lite;
@@ -2190,9 +2114,9 @@ msg_composer_init (EMsgComposer *composer)
/* Configure Headers */
e_composer_header_table_set_account_list (
- table, mail_config_get_accounts ());
+ table, e_get_account_list ());
e_composer_header_table_set_signature_list (
- table, mail_config_get_signatures ());
+ table, e_get_signature_list ());
g_signal_connect_swapped (
table, "notify::account",
@@ -2242,8 +2166,9 @@ msg_composer_init (EMsgComposer *composer)
/* Initialization may have tripped the "changed" state. */
gtkhtml_editor_set_changed (editor, FALSE);
- e_plugin_ui_register_manager (
- "org.gnome.evolution.composer", ui_manager, composer);
+ id = "org.gnome.evolution.composer";
+ e_plugin_ui_register_manager (ui_manager, id, composer);
+ e_plugin_ui_enable_manager (ui_manager, id);
}
GType
@@ -2287,7 +2212,6 @@ e_msg_composer_new (void)
return g_object_new (E_TYPE_MSG_COMPOSER, NULL);
}
-
void
e_msg_composer_set_lite (void)
{
@@ -2487,7 +2411,7 @@ handle_multipart_signed (EMsgComposer *composer,
gchar *html;
gssize length;
- html = em_utils_part_to_html (mime_part, &length, NULL);
+ html = emcu_part_to_html (mime_part, &length, NULL);
e_msg_composer_set_pending_body (composer, html, length);
} else {
e_msg_composer_attach (composer, mime_part);
@@ -2503,6 +2427,7 @@ handle_multipart_encrypted (EMsgComposer *composer,
CamelCipherContext *cipher;
CamelDataWrapper *content;
CamelMimePart *mime_part;
+ CamelSession *session;
CamelException ex;
CamelCipherValidity *valid;
GtkToggleAction *action;
@@ -2512,7 +2437,8 @@ handle_multipart_encrypted (EMsgComposer *composer,
gtk_toggle_action_set_active (action, TRUE);
camel_exception_init (&ex);
- cipher = mail_crypto_get_pgp_cipher_context (NULL);
+ session = e_msg_composer_get_session (composer);
+ cipher = camel_gpg_context_new (session);
mime_part = camel_mime_part_new ();
valid = camel_cipher_decrypt (cipher, multipart, mime_part, &ex);
camel_object_unref (cipher);
@@ -2550,7 +2476,7 @@ handle_multipart_encrypted (EMsgComposer *composer,
gchar *html;
gssize length;
- html = em_utils_part_to_html (mime_part, &length, NULL);
+ html = emcu_part_to_html (mime_part, &length, NULL);
e_msg_composer_set_pending_body (composer, html, length);
} else {
e_msg_composer_attach (composer, mime_part);
@@ -2616,7 +2542,7 @@ handle_multipart_alternative (EMsgComposer *composer,
gchar *html;
gssize length;
- html = em_utils_part_to_html (text_part, &length, NULL);
+ html = emcu_part_to_html (text_part, &length, NULL);
e_msg_composer_set_pending_body (composer, html, length);
}
}
@@ -2666,7 +2592,7 @@ handle_multipart (EMsgComposer *composer,
/* Since the first part is not multipart/alternative,
* this must be the body. */
- html = em_utils_part_to_html (mime_part, &length, NULL);
+ html = emcu_part_to_html (mime_part, &length, NULL);
e_msg_composer_set_pending_body (composer, html, length);
} else if (camel_mime_part_get_content_id (mime_part) ||
camel_mime_part_get_content_location (mime_part)) {
@@ -2697,11 +2623,11 @@ set_signature_gui (EMsgComposer *composer)
data = gtkhtml_editor_get_paragraph_data (editor, "signature_name");
if (g_str_has_prefix (data, "uid:")) {
decoded = decode_signature_name (data + 4);
- signature = mail_config_get_signature_by_uid (decoded);
+ signature = e_get_signature_by_uid (decoded);
g_free (decoded);
} else if (g_str_has_prefix (data, "name:")) {
decoded = decode_signature_name (data + 5);
- signature = mail_config_get_signature_by_name (decoded);
+ signature = e_get_signature_by_name (decoded);
g_free (decoded);
}
@@ -2758,10 +2684,12 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
account_name = g_strdup (account_name);
g_strstrip (account_name);
- if ((account = mail_config_get_account_by_uid (account_name)) == NULL)
- /* 'old' setting */
- account = mail_config_get_account_by_name (account_name);
- if (account) {
+ account = e_get_account_by_uid (account_name);
+ if (account == NULL)
+ /* XXX Backwards compatibility */
+ account = e_get_account_by_name (account_name);
+
+ if (account != NULL) {
g_free (account_name);
account_name = g_strdup (account->name);
}
@@ -2926,7 +2854,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
}
/* Remove any other X-Evolution-* headers that may have been set */
- xev = mail_tool_remove_xevolution_headers (message);
+ xev = emcu_remove_xevolution_headers (message);
camel_header_raw_clear (&xev);
/* Check for receipt request */
@@ -2982,7 +2910,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
gchar *html;
gssize length;
- html = em_utils_part_to_html ((CamelMimePart *)message, &length, NULL);
+ html = emcu_part_to_html ((CamelMimePart *)message, &length, NULL);
e_msg_composer_set_pending_body (composer, html, length);
}
@@ -3055,6 +2983,35 @@ e_msg_composer_new_redirect (CamelMimeMessage *message,
}
/**
+ * e_msg_composer_get_session:
+ * @composer: an #EMsgComposer
+ *
+ * Returns the mail module's global #CamelSession instance. Calling
+ * this function will load the mail module if it isn't already loaded.
+ *
+ * Returns: the mail module's #CamelSession
+ **/
+CamelSession *
+e_msg_composer_get_session (EMsgComposer *composer)
+{
+ EShell *shell;
+ EShellSettings *shell_settings;
+ CamelSession *session;
+
+ /* FIXME EMsgComposer should own a reference to EShell. */
+
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ session = e_shell_settings_get_pointer (shell_settings, "mail-session");
+ g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
+
+ return session;
+}
+
+/**
* e_msg_composer_send:
* @composer: an #EMsgComposer
*
@@ -3090,6 +3047,22 @@ e_msg_composer_save_draft (EMsgComposer *composer)
e_composer_autosave_set_saved (composer, FALSE);
}
+/**
+ * e_msg_composer_print:
+ * @composer: an #EMsgComposer
+ * @action: the print action to start
+ *
+ * Print the message in @composer.
+ **/
+void
+e_msg_composer_print (EMsgComposer *composer,
+ GtkPrintOperationAction action)
+{
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+ g_signal_emit (composer, signals[PRINT], 0, action);
+}
+
static GList *
add_recipients (GList *list, const gchar *recips)
{
@@ -3576,7 +3549,7 @@ e_msg_composer_get_message (EMsgComposer *composer,
store = e_attachment_view_get_store (view);
if (e_attachment_store_get_num_loading (store) > 0) {
- if (!em_utils_prompt_user (GTK_WINDOW (composer), NULL,
+ if (!emcu_prompt_user (GTK_WINDOW (composer), NULL,
"mail-composer:ask-send-message-pending-download", NULL)) {
return NULL;
}
@@ -3753,7 +3726,6 @@ e_msg_composer_show_sig_file (EMsgComposer *composer)
GtkhtmlEditor *editor;
GtkHTML *html;
gchar *html_text;
- gboolean top_signature;
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
@@ -3780,8 +3752,6 @@ e_msg_composer_show_sig_file (EMsgComposer *composer)
}
gtkhtml_editor_run_command (editor, "unblock-selection");
- top_signature = is_top_signature ();
-
html_text = get_signature_html (composer);
if (html_text) {
gtkhtml_editor_run_command (editor, "insert-paragraph");
@@ -3795,10 +3765,6 @@ e_msg_composer_show_sig_file (EMsgComposer *composer)
gtkhtml_editor_run_command (editor, "style-normal");
gtkhtml_editor_insert_html (editor, html_text);
g_free (html_text);
- } else if (top_signature) {
- /* insert paragraph after the signature ClueFlow things */
- gtkhtml_editor_run_command (editor, "cursor-forward");
- gtkhtml_editor_run_command (editor, "insert-paragraph");
}
gtkhtml_editor_undo_end (editor);
@@ -3940,17 +3906,8 @@ e_msg_composer_load_from_file (const gchar *filename)
camel_object_unref (stream);
composer = e_msg_composer_new_with_message (msg);
- if (composer != NULL) {
- g_signal_connect (
- composer, "send",
- G_CALLBACK (em_utils_composer_send_cb), NULL);
-
- g_signal_connect (
- composer, "save-draft",
- G_CALLBACK (em_utils_composer_save_draft_cb), NULL);
-
+ if (composer != NULL)
gtk_widget_show (GTK_WIDGET (composer));
- }
return composer;
}
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index b9985f7f44..1a8f4676e7 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -25,6 +25,7 @@
#include <camel/camel-internet-address.h>
#include <camel/camel-mime-message.h>
+#include <camel/camel-session.h>
#include <libedataserver/e-account.h>
#include <libebook/e-destination.h>
#include <gtkhtml-editor.h>
@@ -67,21 +68,21 @@ struct _EMsgComposerClass {
GtkhtmlEditorClass parent_class;
};
-struct _EAttachmentBar;
-
GType e_msg_composer_get_type (void);
EMsgComposer * e_msg_composer_new (void);
-EMsgComposer * e_msg_composer_lite_new (void);
-
+void e_msg_composer_set_lite (void);
+gboolean e_msg_composer_get_lite (void);
+EMsgComposer * e_msg_composer_lite_new (void);
EMsgComposer * e_msg_composer_new_with_message (CamelMimeMessage *msg);
EMsgComposer * e_msg_composer_new_from_url (const gchar *url);
EMsgComposer * e_msg_composer_new_redirect (CamelMimeMessage *message,
const gchar *resent_from);
-void e_msg_composer_set_lite (void);
-gboolean e_msg_composer_get_lite (void);
+CamelSession * e_msg_composer_get_session (EMsgComposer *composer);
void e_msg_composer_send (EMsgComposer *composer);
void e_msg_composer_save_draft (EMsgComposer *composer);
+void e_msg_composer_print (EMsgComposer *composer,
+ GtkPrintOperationAction action);
void e_msg_composer_set_alternative (EMsgComposer *composer,
gboolean alt);
@@ -129,9 +130,6 @@ void e_msg_composer_set_enable_autosave
(EMsgComposer *composer,
gboolean enabled);
-gchar * e_msg_composer_get_sig_file_content
- (const gchar *sigfile,
- gboolean in_html);
void e_msg_composer_add_message_attachments
(EMsgComposer *composer,
CamelMimeMessage *message,
diff --git a/configure.ac b/configure.ac
index 1a9f816843..6a4826cd49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,7 @@ m4_define([libgnomecanvas_minimum_version], [2.0.0]) # XXX Just a Guess
m4_define([libgnomeui_minimum_version], [2.0.0]) # XXX Just a Guess
m4_define([libxml_minimum_version], [2.0.0]) # XXX Just a Guess
m4_define([shared_mime_info_minimum_version], [0.22])
+m4_define([unique_minimum_version], [1.0]) # XXX Just a Guess
# Optional Packages
#
@@ -74,6 +75,7 @@ CFLAGS="$CFLAGS $WARNING_FLAGS"
# GNOME Documentation
GNOME_DOC_INIT
+GTK_DOC_CHECK(1.10)
# Gross hack to enable 'make dist' on automake 1.9+tar 1.14.
# The extra brackets are to foil regex-based scans.
m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
@@ -182,7 +184,7 @@ case "$host" in
HAL_REQUIREMENT=''
;;
*) os_win32=no
- NO_UNDEFINED=''
+ NO_UNDEFINED='-Wl,-no-undefined'
SOEXT='.so'
SA_JUNK_PLUGIN=sa-junk-plugin
BF_JUNK_PLUGIN=bogo-junk-plugin
@@ -196,6 +198,9 @@ AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
AC_SUBST(NO_UNDEFINED)
AC_SUBST(SOEXT)
+MATH_LIB="-lm"
+AC_SUBST(MATH_LIB)
+
if test "$os_win32" = "yes"; then
AC_CHECK_TOOL(WINDRES, windres, :)
else
@@ -217,7 +222,8 @@ PKG_CHECK_MODULES(GNOME_PLATFORM,
libgnomecanvas-2.0 >= libgnomecanvas_minimum_version
libgnomeui-2.0 >= libgnomeui_minimum_version
libxml-2.0 >= libxml_minimum_version
- shared-mime-info >= shared_mime_info_minimum_version])
+ shared-mime-info >= shared_mime_info_minimum_version
+ unique-1.0 >= unique_minimum_version])
AC_SUBST(GNOME_PLATFORM_CFLAGS)
AC_SUBST(GNOME_PLATFORM_LIBS)
@@ -231,9 +237,8 @@ PKG_CHECK_MODULES(EVOLUTION_DATA_SERVER,
libgdata-$EDS_PACKAGE >= eds_minimum_version
libgdata-google-$EDS_PACKAGE >= eds_minimum_version])
-
dnl ******************
-dnl User documentation
+dnl User Documentation
dnl ******************
AC_MSG_CHECKING([whether to build user documentation])
AC_ARG_WITH([help],
@@ -1130,7 +1135,7 @@ if test "x${enable_nss}" = "xyes" || test "x${enable_nss}" = "xstatic"; then
nsprlibs="$DL_LIB -lplc4 -lplds4 -lnspr4 $PTHREAD_LIB"
fi
- AC_CACHE_CHECK([for Mozilla nspr libraries], moz_nspr_libs,
+ AC_CACHE_CHECK([for Mozilla nspr libraries], ac_cv_moz_nspr_libs,
[
LIBS_save="$LIBS"
CFLAGS="$CFLAGS $MANUAL_NSPR_CFLAGS"
@@ -1143,12 +1148,12 @@ if test "x${enable_nss}" = "xyes" || test "x${enable_nss}" = "xstatic"; then
LDFLAGS="$LDFLAGS"
fi
- AC_TRY_LINK_FUNC(PR_Init, moz_nspr_libs="yes", moz_nspr_libs="no")
+ AC_TRY_LINK_FUNC(PR_Init, ac_cv_moz_nspr_libs="yes", ac_cv_moz_nspr_libs="no")
CFLAGS="$CFLAGS_save"
LDFLAGS="$LDFLAGS_save"
LIBS="$LIBS_save"
])
- if test "x$moz_nspr_libs" != "xno"; then
+ if test "x$ac_cv_moz_nspr_libs" != "xno"; then
have_nspr_libs="yes"
MANUAL_NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
else
@@ -1209,21 +1214,21 @@ if test "x${enable_nss}" = "xyes" || test "x${enable_nss}" = "xstatic"; then
nsslibs="-lssl3 -lsmime3 -lnss3 $SOFTOKN3_LIB"
fi
- AC_CACHE_CHECK([for Mozilla nss libraries], moz_nss_libs,
+ AC_CACHE_CHECK([for Mozilla nss libraries], ac_cv_moz_nss_libs,
[
LIBS_save="$LIBS"
LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
LIBS="$nsslibs $nsprlibs"
- AC_TRY_LINK_FUNC(NSS_Init, moz_nss_libs="yes", moz_nss_libs="no")
- if test "$moz_nss_libs" = no; then
+ AC_TRY_LINK_FUNC(NSS_Init, ac_cv_moz_nss_libs="yes", ac_cv_moz_nss_libs="no")
+ if test "$ac_cv_moz_nss_libs" = no; then
nsslibs="-lssl3 -lsmime3 -lnss3 $SOFTOKN3_LIB"
LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
- AC_TRY_LINK_FUNC(NSS_Init, moz_nss_libs="yes", moz_nss_libs="no")
+ AC_TRY_LINK_FUNC(NSS_Init, ac_cv_moz_nss_libs="yes", ac_cv_moz_nss_libs="no")
fi
LDFLAGS="$LDFLAGS_save"
LIBS="$LIBS_save"
])
- if test "$moz_nss_libs" != no; then
+ if test "$ac_cv_moz_nss_libs" != no; then
AC_DEFINE(HAVE_NSS)
AC_DEFINE(HAVE_SSL)
AC_DEFINE_UNQUOTED(MOZILLA_NSS_LIB_DIR,"$with_nss_libs", [Define to the full path of mozilla nss library])
@@ -1563,11 +1568,13 @@ EVO_SET_COMPILE_FLAGS(E_UTIL, libbonoboui-2.0 libglade-2.0 libgnomeui-2.0 libeda
AC_SUBST(E_UTIL_CFLAGS)
AC_SUBST(E_UTIL_LIBS)
+E_UTIL_LIBS="$E_UTIL_LIBS $MATH_LIB"
+
EVO_SET_COMPILE_FLAGS(TZDIALOG, libecal-$EDS_PACKAGE, $GNOME_PLATFORM_CFLAGS, $GNOME_PLATFORM_LIBS)
AC_SUBST(TZDIALOG_CFLAGS)
AC_SUBST(TZDIALOG_LIBS)
-EVO_SET_COMPILE_FLAGS(E_WIDGETS, libbonoboui-2.0 gio-2.0 gconf-2.0 gobject-2.0 libgnomeui-2.0 libglade-2.0 libedataserverui-$EDS_PACKAGE libedataserver-$EDS_PACKAGE)
+EVO_SET_COMPILE_FLAGS(E_WIDGETS, libbonoboui-2.0 gio-2.0 gconf-2.0 gobject-2.0 libgnomeui-2.0 libglade-2.0 libedataserverui-$EDS_PACKAGE libedataserver-$EDS_PACKAGE gtkhtml-editor)
AC_SUBST(E_WIDGETS_CFLAGS)
AC_SUBST(E_WIDGETS_LIBS)
@@ -1595,14 +1602,14 @@ fi
AM_CONDITIONAL(NM_SUPPORT, test x$NM_SUPPORT = xyes)
-EVO_SET_COMPILE_FLAGS(SHELL, libgnomeui-2.0 libbonoboui-2.0 libglade-2.0 gio-2.0 gconf-2.0 gobject-2.0 libgtkhtml-$GTKHTML_PACKAGE $NM_SUPPORT_PACKAGES)
+EVO_SET_COMPILE_FLAGS(SHELL, libgnomeui-2.0 libbonoboui-2.0 libglade-2.0 gio-2.0 gconf-2.0 gobject-2.0 libgtkhtml-$GTKHTML_PACKAGE $NM_SUPPORT_PACKAGES unique-1.0 libedataserverui-$EDS_PACKAGE)
AC_SUBST(SHELL_CFLAGS)
AC_SUBST(SHELL_LIBS)
dnl --- evolution-addressbook flags
-EVOLUTION_ADDRESSBOOK_DEPS="libbonoboui-2.0 libglade-2.0 libgnomeui-2.0 gio-2.0 gconf-2.0 gobject-2.0 libgtkhtml-$GTKHTML_PACKAGE libebook-$EDS_PACKAGE libedataserverui-$EDS_PACKAGE camel-$EDS_PACKAGE gtkhtml-editor"
+EVOLUTION_ADDRESSBOOK_DEPS="libbonoboui-2.0 libglade-2.0 libgnomeui-2.0 gio-2.0 gconf-2.0 gobject-2.0 libgtkhtml-$GTKHTML_PACKAGE libebook-$EDS_PACKAGE libedataserverui-$EDS_PACKAGE camel-$EDS_PACKAGE gtkhtml-editor unique-1.0"
EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK, $EVOLUTION_ADDRESSBOOK_DEPS)
AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
@@ -1631,7 +1638,7 @@ EVO_SET_COMPILE_FLAGS(LIBSOUP, libsoup-2.4 >= 2.3.0)
AC_SUBST(LIBSOUP_CFLAGS)
AC_SUBST(LIBSOUP_LIBS)
-EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, libgnomeui-2.0 libbonoboui-2.0 libglade-2.0 gio-2.0 gconf-2.0 gobject-2.0 libgtkhtml-$GTKHTML_PACKAGE libebook-$EDS_PACKAGE libecal-$EDS_PACKAGE libedataserverui-$EDS_PACKAGE libebackend-$EDS_PACKAGE $HAL_REQUIREMENT $libnotify gtkhtml-editor libgdata-$EDS_PACKAGE libgdata-google-$EDS_PACKAGE)
+EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, libgnomeui-2.0 libbonoboui-2.0 libglade-2.0 gio-2.0 gconf-2.0 gobject-2.0 libgtkhtml-$GTKHTML_PACKAGE libebook-$EDS_PACKAGE libecal-$EDS_PACKAGE libedataserverui-$EDS_PACKAGE libebackend-$EDS_PACKAGE $HAL_REQUIREMENT $libnotify gtkhtml-editor libgdata-$EDS_PACKAGE libgdata-google-$EDS_PACKAGE unique-1.0)
AC_SUBST(EVOLUTION_CALENDAR_CFLAGS)
AC_SUBST(EVOLUTION_CALENDAR_LIBS)
@@ -1643,7 +1650,7 @@ fi
dnl --- evolution-mail flags
-EVO_SET_COMPILE_FLAGS(EVOLUTION_MAIL, camel-provider-$EDS_PACKAGE libgnomeui-2.0 libbonoboui-2.0 libglade-2.0 gio-2.0 gconf-2.0 gobject-2.0 libgtkhtml-$GTKHTML_PACKAGE gtkhtml-editor bonobo-activation-2.0 $mozilla_nss libebook-$EDS_PACKAGE libedataserverui-$EDS_PACKAGE)
+EVO_SET_COMPILE_FLAGS(EVOLUTION_MAIL, camel-provider-$EDS_PACKAGE libgnomeui-2.0 libbonoboui-2.0 libglade-2.0 gio-2.0 gconf-2.0 gobject-2.0 libgtkhtml-$GTKHTML_PACKAGE gtkhtml-editor bonobo-activation-2.0 $mozilla_nss libebook-$EDS_PACKAGE libedataserverui-$EDS_PACKAGE unique-1.0)
AC_SUBST(EVOLUTION_MAIL_CFLAGS)
AC_SUBST(EVOLUTION_MAIL_LIBS)
@@ -1666,7 +1673,7 @@ fi
dnl --- evolution-test flags
-EVO_SET_COMPILE_FLAGS(EVOLUTION_TEST, libgnomeui-2.0 libbonoboui-2.0)
+EVO_SET_COMPILE_FLAGS(EVOLUTION_TEST, gtk+-2.0 gconf-2.0 libxml-2.0 unique-1.0)
AC_SUBST(EVOLUTION_TEST_CFLAGS)
AC_SUBST(EVOLUTION_TEST_LIBS)
@@ -1693,6 +1700,9 @@ AC_SUBST(privincludedir)
componentdir="$privlibdir/components"
AC_SUBST(componentdir)
+moduledir="$privlibdir/modules"
+AC_SUBST(moduledir)
+
idldir='${datadir}'/idl/evolution-$BASE_VERSION
AC_SUBST(idldir)
@@ -1792,12 +1802,12 @@ AC_ARG_ENABLE([plugins],
[enable_plugins="$enableval"],[enable_plugins=all])
dnl Add any new plugins here
-plugins_base_always="calendar-file calendar-http $CALENDAR_WEATHER itip-formatter plugin-manager default-source addressbook-file startup-wizard mark-all-read groupwise-features groupwise-account-setup mail-account-disable publish-calendar caldav imap-features google-account-setup webdav-account-setup"
+plugins_base_always="calendar-file calendar-http $CALENDAR_WEATHER itip-formatter plugin-manager default-source addressbook-file startup-wizard mark-all-read groupwise-features groupwise-account-setup publish-calendar caldav imap-features google-account-setup webdav-account-setup"
plugins_base="$plugins_base_always $SA_JUNK_PLUGIN $BF_JUNK_PLUGIN $EXCHANGE_PLUGIN $MONO_PLUGIN "
all_plugins_base="$plugins_base_always sa-junk-plugin bogo-junk-plugin exchange-operations mono"
-plugins_standard_always="bbdb subject-thread save-calendar select-one-source copy-tool mail-to-task audio-inline mailing-list-actions default-mailer prefer-plain mail-notification attachment-reminder backup-restore email-custom-header templates pst-import vcard-inline"
+plugins_standard_always="bbdb subject-thread save-calendar copy-tool mail-to-task audio-inline mailing-list-actions default-mailer prefer-plain mail-notification attachment-reminder face backup-restore email-custom-header templates pst-import vcard-inline"
plugins_standard="$plugins_standard_always"
all_plugins_standard="$plugins_standard"
@@ -1806,6 +1816,31 @@ plugins_experimental_always="face folder-unsubscribe external-editor hula-accoun
plugins_experimental="$plugins_experimental_always $IPOD_SYNC $TNEF_ATTACHMENTS $PYTHON_PLUGIN"
all_plugins_experimental="$plugins_experimental_always ipod-sync tnef-attachments"
+dnl Temporary KILL-BONOBO hack
+enable_plugins="attachment-reminder addressbook-file audio-inline bbdb bogo-junk-plugin caldav calendar-file calendar-http copy-tool default-source external-editor google-account-setup hula-account-setup imap-features mail-notification mark-all-read plugin-manager profiler sa-junk-plugin save-calendar subject-thread $TNEF_ATTACHMENTS vcard-inline webdav-account-setup"
+
+dnl PLUGINS NOT BUILDING YET
+dnl ------------------------
+dnl backup-restore
+dnl calendar-weather
+dnl default-mailer
+dnl email-custom-header
+dnl exchange-operations
+dnl face
+dnl folder-unsubscribe
+dnl groupwise-features
+dnl ipod-sync
+dnl itip-formatter
+dnl mailing-list-actions
+dnl mail-to-task
+dnl mono
+dnl prefer-plain
+dnl pst-import
+dnl publish-calendar
+dnl python
+dnl startup-wizard
+dnl templates
+
case x"$enable_plugins" in
xno)
plugins_enabled=""
@@ -1986,11 +2021,6 @@ AC_OUTPUT([ po/Makefile.in
Makefile
win32/Makefile
a11y/Makefile
-a11y/addressbook/Makefile
-a11y/calendar/Makefile
-a11y/widgets/Makefile
-a11y/e-table/Makefile
-a11y/e-text/Makefile
addressbook/Makefile
addressbook/conduit/Makefile
addressbook/gui/Makefile
@@ -2018,7 +2048,11 @@ data/cde_app_root/dt/appconfig/types/Makefile
data/cde_app_root/dt/appconfig/types/C/Makefile
data/cde_app_root/dt/appconfig/types/C/Ximian.dt
data/icons/Makefile
+doc/Makefile
+doc/reference/Makefile
+doc/reference/shell/Makefile
e-util/Makefile
+em-format/Makefile
filter/Makefile
help/Makefile
help/quickref/Makefile
@@ -2063,6 +2097,7 @@ calendar/conduits/memo/Makefile
calendar/gui/Makefile
calendar/gui/alarm-notify/Makefile
calendar/gui/dialogs/Makefile
+calendar/module/Makefile
composer/Makefile
mail/Makefile
mail/default/Makefile
@@ -2086,7 +2121,6 @@ mail/default/sr/Makefile
mail/default/sr@latin/Makefile
mail/default/sv/Makefile
mail/default/hu/Makefile
-mail/importers/Makefile
plugins/Makefile
plugins/addressbook-file/Makefile
plugins/attachment-reminder/Makefile
@@ -2113,7 +2147,6 @@ plugins/hula-account-setup/Makefile
plugins/imap-features/Makefile
plugins/ipod-sync/Makefile
plugins/itip-formatter/Makefile
-plugins/mail-account-disable/Makefile
plugins/mail-notification/Makefile
plugins/mail-to-task/Makefile
plugins/mailing-list-actions/Makefile
@@ -2127,7 +2160,6 @@ plugins/publish-calendar/Makefile
plugins/python/Makefile
plugins/sa-junk-plugin/Makefile
plugins/save-calendar/Makefile
-plugins/select-one-source/Makefile
plugins/startup-wizard/Makefile
plugins/subject-thread/Makefile
plugins/templates/Makefile
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 486263dbd4..d2ac0cf244 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = reference
+
EXTRA_DIST = ChangeLog.pre-1-4
-include $(top_srcdir)/git.mk
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
new file mode 100644
index 0000000000..d7c539dc98
--- /dev/null
+++ b/doc/reference/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = shell
diff --git a/doc/reference/shell/.gitignore b/doc/reference/shell/.gitignore
new file mode 100644
index 0000000000..45c18bb715
--- /dev/null
+++ b/doc/reference/shell/.gitignore
@@ -0,0 +1,15 @@
+*-decl-list.txt
+*-decl.txt
+*-unused.txt
+*-undocumented.txt
+*-undeclared.txt
+*.args
+*.hierarchy
+*.interfaces
+*.prerequisites
+*.signals
+*.stamp
+html
+xml
+*.bak
+version.xml
diff --git a/doc/reference/shell/Makefile.am b/doc/reference/shell/Makefile.am
new file mode 100644
index 0000000000..69d047b6d3
--- /dev/null
+++ b/doc/reference/shell/Makefile.am
@@ -0,0 +1,151 @@
+## Process this file with automake to produce Makefile.in
+
+# We require automake 1.6 at least.
+AUTOMAKE_OPTIONS = 1.6
+
+# The name of the module, e.g. 'glib'.
+DOC_MODULE=eshell
+
+# The top-level SGML file. You can change this if you want to.
+DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
+
+# The directory containing the source code. Relative to $(srcdir).
+# gtk-doc will search all .c & .h files beneath here for inline comments
+# documenting the functions and macros.
+# e.g. DOC_SOURCE_DIR=../../../gtk
+DOC_SOURCE_DIR=../../../shell
+
+# Extra options to pass to gtkdoc-scangobj. Not normally needed.
+SCANGOBJ_OPTIONS=
+
+# Extra options to supply to gtkdoc-scan.
+# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
+SCAN_OPTIONS=
+
+# Extra options to supply to gtkdoc-mkdb.
+# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
+MKDB_OPTIONS=--sgml-mode --output-format=xml
+
+# Extra options to supply to gtkdoc-mktmpl
+# e.g. MKTMPL_OPTIONS=--only-section-tmpl
+MKTMPL_OPTIONS=
+
+# Extra options to supply to gtkdoc-fixref. Not normally needed.
+# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
+FIXXREF_OPTIONS=
+
+# Used for dependencies. The docs will be rebuilt if any of these change.
+# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
+# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
+HFILE_GLOB=$(top_srcdir)/shell/*.h
+CFILE_GLOB=$(top_srcdir)/shell/*.c
+
+# Header files to ignore when scanning.
+# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
+IGNORE_HFILES=e-shell-window-private.h
+
+# Images to copy into HTML directory.
+# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
+HTML_IMAGES=
+
+# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
+# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
+content_files=
+
+# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
+# These files must be listed here *and* in content_files
+# e.g. expand_content_files=running.sgml
+expand_content_files=
+
+# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
+# Only needed if you are using gtkdoc-scangobj to dynamically query widget
+# signals and properties.
+# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
+# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
+INCLUDES= \
+ -I$(top_srcdir) \
+ -I$(SHELL_CFLAGS)
+GTKDOC_LIBS= \
+ $(top_builddir)/shell/.libs/e-shell.o \
+ $(top_builddir)/shell/.libs/e-shell-backend.o \
+ $(top_builddir)/shell/.libs/e-shell-content.o \
+ $(top_builddir)/shell/.libs/e-shell-importer.o \
+ $(top_builddir)/shell/.libs/e-shell-migrate.o \
+ $(top_builddir)/shell/.libs/e-shell-nm.o \
+ $(top_builddir)/shell/.libs/e-shell-settings.o \
+ $(top_builddir)/shell/.libs/e-shell-sidebar.o \
+ $(top_builddir)/shell/.libs/e-shell-switcher.o \
+ $(top_builddir)/shell/.libs/e-shell-taskbar.o \
+ $(top_builddir)/shell/.libs/e-shell-view.o \
+ $(top_builddir)/shell/.libs/e-shell-window-actions.o \
+ $(top_builddir)/shell/.libs/e-shell-window-private.o \
+ $(top_builddir)/shell/.libs/e-shell-window.o \
+ $(top_builddir)/shell/.libs/es-event.o \
+ $(top_builddir)/e-util/.libs/e-bconf-map.o \
+ $(top_builddir)/e-util/.libs/e-binding.o \
+ $(top_builddir)/e-util/.libs/e-dialog-utils.o \
+ $(top_builddir)/e-util/.libs/e-error.o \
+ $(top_builddir)/e-util/.libs/e-event.o \
+ $(top_builddir)/e-util/.libs/e-fsutils.o \
+ $(top_builddir)/e-util/.libs/e-icon-factory.o \
+ $(top_builddir)/e-util/.libs/e-import.o \
+ $(top_builddir)/e-util/.libs/e-logger.o \
+ $(top_builddir)/e-util/.libs/e-marshal.o \
+ $(top_builddir)/e-util/.libs/e-mktemp.o \
+ $(top_builddir)/e-util/.libs/e-module.o \
+ $(top_builddir)/e-util/.libs/e-plugin.o \
+ $(top_builddir)/e-util/.libs/e-plugin-ui.o \
+ $(top_builddir)/e-util/.libs/e-popup.o \
+ $(top_builddir)/e-util/.libs/e-print.o \
+ $(top_builddir)/e-util/.libs/e-unicode.o \
+ $(top_builddir)/e-util/.libs/e-util.o \
+ $(top_builddir)/e-util/.libs/e-xml-utils.o \
+ $(top_builddir)/e-util/.libs/gconf-bridge.o \
+ $(top_builddir)/filter/.libs/filter-code.o \
+ $(top_builddir)/filter/.libs/filter-colour.o \
+ $(top_builddir)/filter/.libs/filter-datespec.o \
+ $(top_builddir)/filter/.libs/filter-element.o \
+ $(top_builddir)/filter/.libs/filter-file.o \
+ $(top_builddir)/filter/.libs/filter-input.o \
+ $(top_builddir)/filter/.libs/filter-int.o \
+ $(top_builddir)/filter/.libs/filter-option.o \
+ $(top_builddir)/filter/.libs/filter-part.o \
+ $(top_builddir)/filter/.libs/filter-rule.o \
+ $(top_builddir)/filter/.libs/rule-context.o \
+ $(top_builddir)/filter/.libs/rule-editor.o \
+ $(top_builddir)/widgets/menus/.libs/gal-define-views-dialog.o \
+ $(top_builddir)/widgets/menus/.libs/gal-view-collection.o \
+ $(top_builddir)/widgets/menus/.libs/gal-view-factory.o \
+ $(top_builddir)/widgets/menus/.libs/gal-view-instance.o \
+ $(top_builddir)/widgets/menus/.libs/gal-view-instance-save-as-dialog.o \
+ $(top_builddir)/widgets/menus/.libs/gal-view-new-dialog.o \
+ $(top_builddir)/widgets/menus/.libs/gal-view.o \
+ $(top_builddir)/widgets/misc/.libs/e-action-combo-box.o \
+ $(top_builddir)/widgets/misc/.libs/e-activity.o \
+ $(top_builddir)/widgets/misc/.libs/e-activity-proxy.o \
+ $(top_builddir)/widgets/misc/.libs/e-icon-entry.o \
+ $(top_builddir)/widgets/misc/.libs/e-gui-utils.o \
+ $(top_builddir)/widgets/misc/.libs/e-menu-tool-button.o \
+ $(top_builddir)/widgets/misc/.libs/e-online-button.o \
+ $(top_builddir)/widgets/misc/.libs/e-popup-menu.o \
+ $(top_builddir)/widgets/misc/.libs/e-preferences-window.o \
+ $(top_builddir)/widgets/misc/.libs/e-spinner.o \
+ -ledataserver-1.2 \
+ -ledataserverui-1.2 \
+ $(SHELL_LIBS)
+
+# This includes the standard gtk-doc make rules, copied by gtkdocize.
+include $(top_srcdir)/gtk-doc.make
+
+# Other files to distribute
+# e.g. EXTRA_DIST += version.xml.in
+EXTRA_DIST +=
+
+# Files not to distribute
+# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
+# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
+#DISTCLEANFILES +=
+
+# Comment this out if you want your docs-status tested during 'make check'
+#TESTS = $(GTKDOC_CHECK)
+
diff --git a/doc/reference/shell/eshell-docs.sgml b/doc/reference/shell/eshell-docs.sgml
new file mode 100644
index 0000000000..3d7bdcd36e
--- /dev/null
+++ b/doc/reference/shell/eshell-docs.sgml
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
+ <bookinfo>
+ <title>Evolution Shell Reference Manual</title>
+ <releaseinfo>
+ The latest version of this documentation can be found on-line at
+ <ulink role="online-location"
+url="http://mbarnes.fedorapeople.org/docs/eshell/">http://mbarnes.fedorapeople.org/docs/eshell/</ulink>.
+ </releaseinfo>
+ </bookinfo>
+
+ <chapter>
+ <title>The Shell</title>
+ <xi:include href="xml/e-shell.xml"/>
+ <xi:include href="xml/e-shell-backend.xml"/>
+ <xi:include href="xml/e-shell-window.xml"/>
+ <xi:include href="xml/e-shell-view.xml"/>
+ <xi:include href="xml/e-shell-content.xml"/>
+ <xi:include href="xml/e-shell-sidebar.xml"/>
+ <xi:include href="xml/e-shell-taskbar.xml"/>
+ <xi:include href="xml/e-shell-settings.xml"/>
+ <xi:include href="xml/e-shell-switcher.xml"/>
+ <xi:include href="xml/e-shell-importer.xml"/>
+ </chapter>
+
+ <chapter>
+ <title>Actions</title>
+ <xi:include href="xml/shell-actions.xml"/>
+ <xi:include href="xml/action-groups.xml"/>
+ </chapter>
+
+ <chapter>
+ <title>Object Hierarchy</title>
+ <xi:include href="xml/tree_index.sgml"/>
+ </chapter>
+
+ <index>
+ <title>Index</title>
+ </index>
+
+</book>
diff --git a/doc/reference/shell/eshell-overrides.txt b/doc/reference/shell/eshell-overrides.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/doc/reference/shell/eshell-overrides.txt
diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt
new file mode 100644
index 0000000000..c635f1c6bc
--- /dev/null
+++ b/doc/reference/shell/eshell-sections.txt
@@ -0,0 +1,344 @@
+<SECTION>
+<FILE>e-shell</FILE>
+<TITLE>EShell</TITLE>
+EShell
+e_shell_get_default
+e_shell_get_shell_backends
+e_shell_get_canonical_name
+e_shell_get_backend_by_name
+e_shell_get_backend_by_scheme
+e_shell_get_shell_settings
+e_shell_get_gconf_client
+e_shell_create_shell_window
+e_shell_handle_uris
+e_shell_watch_window
+e_shell_get_watched_windows
+e_shell_send_receive
+e_shell_get_network_available
+e_shell_set_network_available
+e_shell_get_online
+e_shell_set_online
+e_shell_get_preferences_window
+e_shell_event
+e_shell_is_busy
+e_shell_do_quit
+e_shell_quit
+E_SHELL_MIGRATE_ERROR
+e_shell_migrate_attempt
+<SUBSECTION Standard>
+E_SHELL
+E_IS_SHELL
+E_TYPE_SHELL
+E_SHELL_CLASS
+E_IS_SHELL_CLASS
+E_SHELL_GET_CLASS
+EShellClass
+e_shell_get_type
+<SUBSECTION Private>
+EShellPrivate
+e_shell_migrate_error_quark
+</SECTION>
+
+<SECTION>
+<FILE>e-shell-backend</FILE>
+<TITLE>EShellBackend</TITLE>
+EShellBackend
+e_shell_backend_compare
+e_shell_backend_get_config_dir
+e_shell_backend_get_data_dir
+e_shell_backend_get_filename
+e_shell_backend_get_shell
+e_shell_backend_add_activity
+e_shell_backend_start
+e_shell_backend_is_busy
+e_shell_backend_shutdown
+e_shell_backend_migrate
+<SUBSECTION Standard>
+E_SHELL_BACKEND
+E_IS_SHELL_BACKEND
+E_TYPE_SHELL_BACKEND
+E_SHELL_BACKEND_CLASS
+E_IS_SHELL_BACKEND_CLASS
+E_SHELL_BACKEND_GET_CLASS
+EShellBackendClass
+e_shell_backend_get_type
+<SUBSECTION Private>
+EShellBackendPrivate
+</SECTION>
+
+<SECTION>
+<FILE>e-shell-content</FILE>
+<TITLE>EShellContent</TITLE>
+EShellContent
+e_shell_content_new
+e_shell_content_check_state
+e_shell_content_get_shell_view
+e_shell_content_get_filter_action
+e_shell_content_set_filter_action
+e_shell_content_get_filter_value
+e_shell_content_set_filter_value
+e_shell_content_get_filter_visible
+e_shell_content_set_filter_visible
+e_shell_content_add_filter_separator_before
+e_shell_content_add_filter_separator_after
+e_shell_content_get_search_context
+e_shell_content_get_search_rule
+e_shell_content_set_search_rule
+e_shell_content_get_search_text
+e_shell_content_set_search_text
+e_shell_content_get_search_visible
+e_shell_content_set_search_visible
+e_shell_content_get_scope_action
+e_shell_content_set_scope_action
+e_shell_content_get_scope_value
+e_shell_content_set_scope_value
+e_shell_content_get_scope_visible
+e_shell_content_set_scope_visible
+e_shell_content_get_view_id
+e_shell_content_set_view_id
+e_shell_content_run_advanced_search_dialog
+e_shell_content_run_edit_searches_dialog
+e_shell_content_run_save_search_dialog
+<SUBSECTION Standard>
+E_SHELL_CONTENT
+E_IS_SHELL_CONTENT
+E_TYPE_SHELL_CONTENT
+E_SHELL_CONTENT_CLASS
+E_IS_SHELL_CONTENT_CLASS
+E_SHELL_CONTENT_GET_CLASS
+EShellContentClass
+e_shell_content_get_type
+<SUBSECTION Private>
+EShellContentPrivate
+</SECTION>
+
+<SECTION>
+<FILE>e-shell-settings</FILE>
+<TITLE>EShellSettings</TITLE>
+EShellSettings
+e_shell_settings_install_property
+e_shell_settings_bind_to_gconf
+e_shell_settings_enable_debug
+e_shell_settings_get_boolean
+e_shell_settings_set_boolean
+e_shell_settings_get_int
+e_shell_settings_set_int
+e_shell_settings_get_string
+e_shell_settings_set_string
+e_shell_settings_get_object
+e_shell_settings_set_object
+e_shell_settings_get_pointer
+e_shell_settings_set_pointer
+<SUBSECTION Standard>
+E_SHELL_SETTINGS
+E_IS_SHELL_SETTINGS
+E_TYPE_SHELL_SETTINGS
+E_SHELL_SETTINGS_CLASS
+E_IS_SHELL_SETTINGS_CLASS
+E_SHELL_SETTINGS_GET_CLASS
+EShellSettingsClass
+e_shell_settings_get_type
+<SUBSECTION Private>
+EShellSettingsPrivate
+</SECTION>
+
+<SECTION>
+<FILE>e-shell-sidebar</FILE>
+<TITLE>EShellSidebar</TITLE>
+EShellSidebar
+e_shell_sidebar_new
+e_shell_sidebar_check_state
+e_shell_sidebar_get_shell_view
+e_shell_sidebar_get_icon_name
+e_shell_sidebar_set_icon_name
+e_shell_sidebar_get_primary_text
+e_shell_sidebar_set_primary_text
+e_shell_sidebar_get_secondary_text
+e_shell_sidebar_set_secondary_text
+<SUBSECTION Standard>
+E_SHELL_SIDEBAR
+E_IS_SHELL_SIDEBAR
+E_TYPE_SHELL_SIDEBAR
+E_SHELL_SIDEBAR_CLASS
+E_IS_SHELL_SIDEBAR_CLASS
+E_SHELL_SIDEBAR_GET_CLASS
+EShellSidebarClass
+e_shell_sidebar_get_type
+<SUBSECTION Private>
+EShellSidebarPrivate
+</SECTION>
+
+<SECTION>
+<FILE>e-shell-switcher</FILE>
+<TITLE>EShellSwitcher</TITLE>
+EShellSwitcher
+e_shell_switcher_new
+e_shell_switcher_add_action
+e_shell_switcher_get_style
+e_shell_switcher_set_style
+e_shell_switcher_unset_style
+e_shell_switcher_get_visible
+e_shell_switcher_set_visible
+<SUBSECTION Standard>
+E_SHELL_SWITCHER
+E_IS_SHELL_SWITCHER
+E_TYPE_SHELL_SWITCHER
+E_SHELL_SWITCHER_CLASS
+E_IS_SHELL_SWITCHER_CLASS
+E_SHELL_SWITCHER_GET_CLASS
+EShellSwitcherClass
+e_shell_switcher_get_type
+<SUBSECTION Private>
+EShellSwitcherPrivate
+E_SHELL_SWITCHER_DEFAULT_TOOLBAR_STYLE
+</SECTION>
+
+<SECTION>
+<FILE>e-shell-taskbar</FILE>
+<TITLE>EShellTaskbar</TITLE>
+EShellTaskbar
+e_shell_taskbar_new
+e_shell_taskbar_get_shell_view
+e_shell_taskbar_get_message
+e_shell_taskbar_set_message
+e_shell_taskbar_unset_message
+<SUBSECTION Standard>
+E_SHELL_TASKBAR
+E_IS_SHELL_TASKBAR
+E_TYPE_SHELL_TASKBAR
+E_SHELL_TASKBAR_CLASS
+E_IS_SHELL_TASKBAR_CLASS
+E_SHELL_TASKBAR_GET_CLASS
+EShellTaskbarClass
+e_shell_taskbar_get_type
+<SUBSECTION Private>
+EShellTaskbarPrivate
+</SECTION>
+
+<SECTION>
+<FILE>e-shell-view</FILE>
+<TITLE>EShellView</TITLE>
+EShellView
+EShellViewClass
+e_shell_view_get_name
+e_shell_view_get_action
+e_shell_view_get_title
+e_shell_view_set_title
+e_shell_view_get_view_id
+e_shell_view_set_view_id
+e_shell_view_is_active
+e_shell_view_get_page_num
+e_shell_view_set_page_num
+e_shell_view_get_size_group
+e_shell_view_get_shell_backend
+e_shell_view_get_shell_content
+e_shell_view_get_shell_sidebar
+e_shell_view_get_shell_taskbar
+e_shell_view_get_shell_window
+e_shell_view_update_actions
+e_shell_view_show_popup_menu
+e_shell_view_new_view_instance
+<SUBSECTION Standard>
+E_SHELL_VIEW
+E_IS_SHELL_VIEW
+E_TYPE_SHELL_VIEW
+E_SHELL_VIEW_CLASS
+E_IS_SHELL_VIEW_CLASS
+E_SHELL_VIEW_GET_CLASS
+e_shell_view_get_type
+<SUBSECTION Private>
+EShellViewPrivate
+</SECTION>
+
+<SECTION>
+<FILE>e-shell-window</FILE>
+<TITLE>EShellWindow</TITLE>
+EShellWindow
+e_shell_window_new
+e_shell_window_get_shell
+e_shell_window_get_shell_view
+e_shell_window_get_shell_view_action
+e_shell_window_get_ui_manager
+e_shell_window_get_action
+e_shell_window_get_action_group
+e_shell_window_get_managed_widget
+e_shell_window_get_active_view
+e_shell_window_set_active_view
+e_shell_window_get_safe_mode
+e_shell_window_set_safe_mode
+e_shell_window_add_action_group
+e_shell_window_register_new_item_actions
+e_shell_window_register_new_source_actions
+<SUBSECTION Standard>
+E_SHELL_WINDOW
+E_IS_SHELL_WINDOW
+E_TYPE_SHELL_WINDOW
+E_SHELL_WINDOW_CLASS
+E_IS_SHELL_WINDOW_CLASS
+E_SHELL_WINDOW_GET_CLASS
+EShellWindowClass
+e_shell_window_get_type
+<SUBSECTION Private>
+EShellWindowPrivate
+E_SHELL_WINDOW_ACTION
+E_SHELL_WINDOW_ACTION_GROUP
+</SECTION>
+
+<SECTION>
+<FILE>e-shell-importer</FILE>
+e_shell_importer_start_import
+</SECTION>
+
+<SECTION>
+<FILE>shell-actions</FILE>
+<TITLE>Shell Actions</TITLE>
+E_SHELL_WINDOW_ACTION_ABOUT
+E_SHELL_WINDOW_ACTION_CLOSE
+E_SHELL_WINDOW_ACTION_CONTENTS
+E_SHELL_WINDOW_ACTION_FAQ
+E_SHELL_WINDOW_ACTION_FORGET_PASSWORDS
+E_SHELL_WINDOW_ACTION_GAL_CUSTOM_VIEW
+E_SHELL_WINDOW_ACTION_GAL_DEFINE_VIEWS
+E_SHELL_WINDOW_ACTION_GAL_SAVE_CUSTOM_VIEW
+E_SHELL_WINDOW_ACTION_IMPORT
+E_SHELL_WINDOW_ACTION_NEW_WINDOW
+E_SHELL_WINDOW_ACTION_PAGE_SETUP
+E_SHELL_WINDOW_ACTION_PREFERENCES
+E_SHELL_WINDOW_ACTION_QUICK_REFERENCE
+E_SHELL_WINDOW_ACTION_QUIT
+E_SHELL_WINDOW_ACTION_SEARCH_ADVANCED
+E_SHELL_WINDOW_ACTION_SEARCH_CLEAR
+E_SHELL_WINDOW_ACTION_SEARCH_EDIT
+E_SHELL_WINDOW_ACTION_SEARCH_EXECUTE
+E_SHELL_WINDOW_ACTION_SEARCH_OPTIONS
+E_SHELL_WINDOW_ACTION_SEARCH_SAVE
+E_SHELL_WINDOW_ACTION_SEND_RECEIVE
+E_SHELL_WINDOW_ACTION_SHOW_SIDEBAR
+E_SHELL_WINDOW_ACTION_SHOW_STATUSBAR
+E_SHELL_WINDOW_ACTION_SHOW_SWITCHER
+E_SHELL_WINDOW_ACTION_SHOW_TOOLBAR
+E_SHELL_WINDOW_ACTION_SUBMIT_BUG
+E_SHELL_WINDOW_ACTION_SWITCHER_INITIAL
+E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_BOTH
+E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_ICONS
+E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_TEXT
+E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_USER
+E_SHELL_WINDOW_ACTION_SYNC_OPTIONS
+E_SHELL_WINDOW_ACTION_WORK_OFFLINE
+E_SHELL_WINDOW_ACTION_WORK_ONLINE
+</SECTION>
+
+<SECTION>
+<FILE>action-groups</FILE>
+<TITLE>Action Groups</TITLE>
+E_SHELL_WINDOW_ACTION_GROUP_SHELL
+E_SHELL_WINDOW_ACTION_GROUP_SWITCHER
+E_SHELL_WINDOW_ACTION_GROUP_NEW_ITEM
+E_SHELL_WINDOW_ACTION_GROUP_NEW_SOURCE
+E_SHELL_WINDOW_ACTION_GROUP_CUSTOM_RULES
+E_SHELL_WINDOW_ACTION_GROUP_GAL_VIEW
+E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_APPLICATION_HANDLERS
+E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINTING
+E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINT_SETUP
+E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_SAVE_TO_DISK
+</SECTION>
diff --git a/doc/reference/shell/eshell.types b/doc/reference/shell/eshell.types
new file mode 100644
index 0000000000..7ad399f7c9
--- /dev/null
+++ b/doc/reference/shell/eshell.types
@@ -0,0 +1,8 @@
+e_shell_get_type
+e_shell_backend_get_type
+e_shell_content_get_type
+e_shell_sidebar_get_type
+e_shell_switcher_get_type
+e_shell_taskbar_get_type
+e_shell_view_get_type
+e_shell_window_get_type
diff --git a/doc/reference/shell/tmpl/Evolution-DataServer.sgml b/doc/reference/shell/tmpl/Evolution-DataServer.sgml
new file mode 100644
index 0000000000..181b45f301
--- /dev/null
+++ b/doc/reference/shell/tmpl/Evolution-DataServer.sgml
@@ -0,0 +1,1139 @@
+<!-- ##### SECTION Title ##### -->
+Evolution-DataServer
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO ORBIT_IDL_SERIAL ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO ORBIT_DECL_GNOME_Evolution_DataServer_Config ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Config__freekids ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### TYPEDEF GNOME_Evolution_DataServer_Config ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### VARIABLE GNOME_Evolution_DataServer_Config__classid ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_0 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_1 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_2 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_3 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_4 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_5 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_6 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_7 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_8 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_9 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_10 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_11 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_12 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_13 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_14 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_15 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_16 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_17 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_18 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_19 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_GNOME_Evolution_DataServer_Config ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO ORBIT_DECL_GNOME_Evolution_DataServer_InterfaceCheck ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_InterfaceCheck__freekids ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### TYPEDEF GNOME_Evolution_DataServer_InterfaceCheck ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### VARIABLE GNOME_Evolution_DataServer_InterfaceCheck__classid ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_0 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_1 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_2 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_3 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_4 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_5 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_6 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_7 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_8 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_9 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_10 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_11 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_12 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_13 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_14 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_15 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_16 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_17 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_18 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_19 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_GNOME_Evolution_DataServer_InterfaceCheck ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO ORBIT_DECL_GNOME_Evolution_DataServer_Logging ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging__freekids ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### TYPEDEF GNOME_Evolution_DataServer_Logging ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### VARIABLE GNOME_Evolution_DataServer_Logging__classid ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_0 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_1 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_2 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_3 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_4 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_5 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_6 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_7 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_8 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_9 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_10 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_11 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_12 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_13 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_14 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_15 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_16 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_17 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_18 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_19 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_GNOME_Evolution_DataServer_Logging ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### ENUM GNOME_Evolution_DataServer_Logging_Level ##### -->
+<para>
+
+</para>
+
+@GNOME_Evolution_DataServer_Logging_Error:
+@GNOME_Evolution_DataServer_Logging_Critical:
+@GNOME_Evolution_DataServer_Logging_Warning:
+@GNOME_Evolution_DataServer_Logging_Message:
+@GNOME_Evolution_DataServer_Logging_Info:
+@GNOME_Evolution_DataServer_Logging_Debug:
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_0 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_1 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_2 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_3 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_4 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_5 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_6 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_7 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_8 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_9 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_10 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_11 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_12 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_13 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_14 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_15 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_16 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_17 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_18 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_19 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_GNOME_Evolution_DataServer_Logging_Level ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### TYPEDEF GNOME_Evolution_DataServer_Logging_LogEvent ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_0 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_1 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_2 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_3 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_4 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_5 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_6 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_7 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_8 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_9 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_10 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_11 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_12 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_13 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_14 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_15 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_16 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_17 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_18 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_19 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO TC_GNOME_Evolution_DataServer_Logging_LogEvent ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_LogEvent__alloc ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_LogEvent__freekids ##### -->
+<para>
+
+</para>
+
+@m:
+@d:
+
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_Config__epv ##### -->
+<para>
+
+</para>
+
+@_private:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_Config__vepv ##### -->
+<para>
+
+</para>
+
+@_base_epv:
+@GNOME_Evolution_DataServer_Config_epv:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_Config ##### -->
+<para>
+
+</para>
+
+@_private:
+@vepv:
+
+<!-- ##### FUNCTION POA_GNOME_Evolution_DataServer_Config__init ##### -->
+<para>
+
+</para>
+
+@servant:
+@ev:
+
+
+<!-- ##### FUNCTION POA_GNOME_Evolution_DataServer_Config__fini ##### -->
+<para>
+
+</para>
+
+@servant:
+@ev:
+
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_InterfaceCheck__epv ##### -->
+<para>
+
+</para>
+
+@_private:
+@_get_interfaceVersion:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_InterfaceCheck__vepv ##### -->
+<para>
+
+</para>
+
+@_base_epv:
+@Bonobo_Unknown_epv:
+@GNOME_Evolution_DataServer_InterfaceCheck_epv:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_InterfaceCheck ##### -->
+<para>
+
+</para>
+
+@_private:
+@vepv:
+
+<!-- ##### FUNCTION POA_GNOME_Evolution_DataServer_InterfaceCheck__init ##### -->
+<para>
+
+</para>
+
+@servant:
+@ev:
+
+
+<!-- ##### FUNCTION POA_GNOME_Evolution_DataServer_InterfaceCheck__fini ##### -->
+<para>
+
+</para>
+
+@servant:
+@ev:
+
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_Logging__epv ##### -->
+<para>
+
+</para>
+
+@_private:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_Logging__vepv ##### -->
+<para>
+
+</para>
+
+@_base_epv:
+@Bonobo_Unknown_epv:
+@Bonobo_EventSource_epv:
+@GNOME_Evolution_DataServer_Logging_epv:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_Logging ##### -->
+<para>
+
+</para>
+
+@_private:
+@vepv:
+
+<!-- ##### FUNCTION POA_GNOME_Evolution_DataServer_Logging__init ##### -->
+<para>
+
+</para>
+
+@servant:
+@ev:
+
+
+<!-- ##### FUNCTION POA_GNOME_Evolution_DataServer_Logging__fini ##### -->
+<para>
+
+</para>
+
+@servant:
+@ev:
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_InterfaceCheck_ref ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_InterfaceCheck_unref ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_InterfaceCheck_queryInterface ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### FUNCTION GNOME_Evolution_DataServer_InterfaceCheck__get_interfaceVersion ##### -->
+<para>
+
+</para>
+
+@_obj:
+@ev:
+@Returns:
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_ref ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_unref ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_queryInterface ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_addListener ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_addListenerWithMask ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_removeListener ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_unImplemented ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_unImplemented2 ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Config_IMETHODS_LEN ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Config__imethods ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_InterfaceCheck_IMETHODS_LEN ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_IMETHODS_LEN ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging__imethods ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### ENUM GNOME_Evolution_DataServer_InterfaceCheck__imethods_index ##### -->
+<para>
+
+</para>
+
+@GNOME_Evolution_DataServer_InterfaceCheck__get_interfaceVersion__imethods_index:
+
+<!-- ##### MACRO ORBIT_IMETHODS_INDEX ##### -->
+<para>
+
+</para>
+
+@m:
+
+
diff --git a/doc/reference/shell/tmpl/action-groups.sgml b/doc/reference/shell/tmpl/action-groups.sgml
new file mode 100644
index 0000000000..5fe62d7ebb
--- /dev/null
+++ b/doc/reference/shell/tmpl/action-groups.sgml
@@ -0,0 +1,99 @@
+<!-- ##### SECTION Title ##### -->
+Action Groups
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_SHELL ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_SWITCHER ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_NEW_ITEM ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_NEW_SOURCE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_CUSTOM_RULES ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_GAL_VIEW ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_APPLICATION_HANDLERS ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINTING ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINT_SETUP ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_SAVE_TO_DISK ##### -->
+<para>
+
+</para>
+
+@window:
+
+
diff --git a/doc/reference/shell/tmpl/e-activity-handler.sgml b/doc/reference/shell/tmpl/e-activity-handler.sgml
new file mode 100644
index 0000000000..09d417213d
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-activity-handler.sgml
@@ -0,0 +1,19 @@
+<!-- ##### SECTION Title ##### -->
+EActivityHandler
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
diff --git a/doc/reference/shell/tmpl/e-config-upgrade.sgml b/doc/reference/shell/tmpl/e-config-upgrade.sgml
new file mode 100644
index 0000000000..0ef774b3dd
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-config-upgrade.sgml
@@ -0,0 +1,32 @@
+<!-- ##### SECTION Title ##### -->
+e-config-upgrade
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION e_config_upgrade ##### -->
+<para>
+
+</para>
+
+@major:
+@minor:
+@revision:
+@Returns:
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-common.sgml b/doc/reference/shell/tmpl/e-shell-common.sgml
new file mode 100644
index 0000000000..1932480643
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-common.sgml
@@ -0,0 +1,21 @@
+<!-- ##### SECTION Title ##### -->
+e-shell-common
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-constants.sgml b/doc/reference/shell/tmpl/e-shell-constants.sgml
new file mode 100644
index 0000000000..74b95024a8
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-constants.sgml
@@ -0,0 +1,140 @@
+<!-- ##### SECTION Title ##### -->
+e-shell-constants
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO E_SHELL_URI_PREFIX ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_SHELL_URI_PREFIX_LEN ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_SHELL_DEFAULTURI_PREFIX ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_SHELL_DEFAULTURI_PREFIX_LEN ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_SHELL_MINI_ICON_SUFFIX ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_SHELL_MINI_ICON_SUFFIX_LEN ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_SHELL_ICON_SIZE ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_SHELL_MINI_ICON_SIZE ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_PATH_SEPARATOR ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_PATH_SEPARATOR_S ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_LOCAL_STORAGE_NAME ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_SUMMARY_STORAGE_NAME ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_SUMMARY_URI ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_LOCAL_INBOX_URI ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_LOCAL_CONTACTS_URI ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_LOCAL_CALENDAR_URI ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO E_LOCAL_TASKS_URI ##### -->
+<para>
+
+</para>
+
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-content.sgml b/doc/reference/shell/tmpl/e-shell-content.sgml
new file mode 100644
index 0000000000..e89f928c7c
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-content.sgml
@@ -0,0 +1,338 @@
+<!-- ##### SECTION Title ##### -->
+EShellContent
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EShellContent ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG EShellContent:filter-action ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellContent:filter-value ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellContent:filter-visible ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellContent:scope-action ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellContent:scope-value ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellContent:scope-visible ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellContent:search-context ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellContent:search-rule ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellContent:search-text ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellContent:search-visible ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellContent:shell-view ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION e_shell_content_new ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_check_state ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_get_shell_view ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_get_filter_action ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_set_filter_action ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@filter_action:
+
+
+<!-- ##### FUNCTION e_shell_content_get_filter_value ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_set_filter_value ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@filter_value:
+
+
+<!-- ##### FUNCTION e_shell_content_get_filter_visible ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_set_filter_visible ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@filter_visible:
+
+
+<!-- ##### FUNCTION e_shell_content_add_filter_separator_before ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@action_value:
+
+
+<!-- ##### FUNCTION e_shell_content_add_filter_separator_after ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@action_value:
+
+
+<!-- ##### FUNCTION e_shell_content_get_search_context ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_get_search_rule ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_set_search_rule ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@search_rule:
+
+
+<!-- ##### FUNCTION e_shell_content_get_search_text ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_set_search_text ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@search_text:
+
+
+<!-- ##### FUNCTION e_shell_content_get_search_visible ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_set_search_visible ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@search_visible:
+
+
+<!-- ##### FUNCTION e_shell_content_get_scope_action ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_set_scope_action ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@scope_action:
+
+
+<!-- ##### FUNCTION e_shell_content_get_scope_value ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_set_scope_value ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@scope_value:
+
+
+<!-- ##### FUNCTION e_shell_content_get_scope_visible ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_set_scope_visible ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@scope_visible:
+
+
+<!-- ##### FUNCTION e_shell_content_get_view_id ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_content_set_view_id ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@view_id:
+
+
+<!-- ##### FUNCTION e_shell_content_run_advanced_search_dialog ##### -->
+<para>
+
+</para>
+
+@shell_content:
+
+
+<!-- ##### FUNCTION e_shell_content_run_edit_searches_dialog ##### -->
+<para>
+
+</para>
+
+@shell_content:
+
+
+<!-- ##### FUNCTION e_shell_content_run_save_search_dialog ##### -->
+<para>
+
+</para>
+
+@shell_content:
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-importer.sgml b/doc/reference/shell/tmpl/e-shell-importer.sgml
new file mode 100644
index 0000000000..0b3aa44506
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-importer.sgml
@@ -0,0 +1,27 @@
+<!-- ##### SECTION Title ##### -->
+e-shell-importer
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION e_shell_importer_start_import ##### -->
+<para>
+
+</para>
+
+@shell_window:
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-marshal.sgml b/doc/reference/shell/tmpl/e-shell-marshal.sgml
new file mode 100644
index 0000000000..27f0c92196
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-marshal.sgml
@@ -0,0 +1,41 @@
+<!-- ##### SECTION Title ##### -->
+e-shell-marshal
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION e_shell_marshal_BOOLEAN__STRING ##### -->
+<para>
+
+</para>
+
+@closure:
+@return_value:
+@n_param_values:
+@param_values:
+@invocation_hint:
+@marshal_data:
+
+
+<!-- ##### MACRO e_shell_marshal_BOOL__STRING ##### -->
+<para>
+
+</para>
+
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-module.sgml b/doc/reference/shell/tmpl/e-shell-module.sgml
new file mode 100644
index 0000000000..f74773c9da
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-module.sgml
@@ -0,0 +1,180 @@
+<!-- ##### SECTION Title ##### -->
+EShellModule
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EShellModule ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SIGNAL EShellModule::activity-added ##### -->
+<para>
+
+</para>
+
+@eshellmodule: the object which received the signal.
+@arg1:
+
+<!-- ##### ARG EShellModule:filename ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellModule:shell ##### -->
+<para>
+
+</para>
+
+<!-- ##### STRUCT EShellModuleInfo ##### -->
+<para>
+
+</para>
+
+@name:
+@aliases:
+@schemes:
+@sort_order:
+@start:
+@is_busy:
+@shutdown:
+@migrate:
+
+<!-- ##### FUNCTION e_shell_module_new ##### -->
+<para>
+
+</para>
+
+@shell:
+@filename:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_module_compare ##### -->
+<para>
+
+</para>
+
+@shell_module_a:
+@shell_module_b:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_module_get_config_dir ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_module_get_data_dir ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_module_get_filename ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_module_get_shell ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_module_get_shell_view_type ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_module_add_activity ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@activity:
+
+
+<!-- ##### FUNCTION e_shell_module_start ##### -->
+<para>
+
+</para>
+
+@shell_module:
+
+
+<!-- ##### FUNCTION e_shell_module_is_busy ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_module_shutdown ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_module_migrate ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@major:
+@minor:
+@micro:
+@error:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_module_set_info ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@info:
+@shell_view_type:
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-sidebar.sgml b/doc/reference/shell/tmpl/e-shell-sidebar.sgml
new file mode 100644
index 0000000000..45a55b127b
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-sidebar.sgml
@@ -0,0 +1,126 @@
+<!-- ##### SECTION Title ##### -->
+EShellSidebar
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EShellSidebar ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG EShellSidebar:icon-name ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellSidebar:primary-text ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellSidebar:secondary-text ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellSidebar:shell-view ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION e_shell_sidebar_new ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_sidebar_check_state ##### -->
+<para>
+
+</para>
+
+@shell_sidebar:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_sidebar_get_shell_view ##### -->
+<para>
+
+</para>
+
+@shell_sidebar:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_sidebar_get_icon_name ##### -->
+<para>
+
+</para>
+
+@shell_sidebar:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_sidebar_set_icon_name ##### -->
+<para>
+
+</para>
+
+@shell_sidebar:
+@icon_name:
+
+
+<!-- ##### FUNCTION e_shell_sidebar_get_primary_text ##### -->
+<para>
+
+</para>
+
+@shell_sidebar:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_sidebar_set_primary_text ##### -->
+<para>
+
+</para>
+
+@shell_sidebar:
+@primary_text:
+
+
+<!-- ##### FUNCTION e_shell_sidebar_get_secondary_text ##### -->
+<para>
+
+</para>
+
+@shell_sidebar:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_sidebar_set_secondary_text ##### -->
+<para>
+
+</para>
+
+@shell_sidebar:
+@secondary_text:
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-switcher.sgml b/doc/reference/shell/tmpl/e-shell-switcher.sgml
new file mode 100644
index 0000000000..f656b65988
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-switcher.sgml
@@ -0,0 +1,104 @@
+<!-- ##### SECTION Title ##### -->
+EShellSwitcher
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EShellSwitcher ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SIGNAL EShellSwitcher::style-changed ##### -->
+<para>
+
+</para>
+
+@eshellswitcher: the object which received the signal.
+@arg1:
+
+<!-- ##### ARG EShellSwitcher:toolbar-style ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellSwitcher:toolbar-visible ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION e_shell_switcher_new ##### -->
+<para>
+
+</para>
+
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_switcher_add_action ##### -->
+<para>
+
+</para>
+
+@switcher:
+@action:
+
+
+<!-- ##### FUNCTION e_shell_switcher_get_style ##### -->
+<para>
+
+</para>
+
+@switcher:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_switcher_set_style ##### -->
+<para>
+
+</para>
+
+@switcher:
+@style:
+
+
+<!-- ##### FUNCTION e_shell_switcher_unset_style ##### -->
+<para>
+
+</para>
+
+@switcher:
+
+
+<!-- ##### FUNCTION e_shell_switcher_get_visible ##### -->
+<para>
+
+</para>
+
+@switcher:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_switcher_set_visible ##### -->
+<para>
+
+</para>
+
+@switcher:
+@visible:
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-taskbar.sgml b/doc/reference/shell/tmpl/e-shell-taskbar.sgml
new file mode 100644
index 0000000000..6aa90f1c72
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-taskbar.sgml
@@ -0,0 +1,79 @@
+<!-- ##### SECTION Title ##### -->
+EShellTaskbar
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EShellTaskbar ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG EShellTaskbar:message ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellTaskbar:shell-view ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION e_shell_taskbar_new ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_taskbar_get_shell_view ##### -->
+<para>
+
+</para>
+
+@shell_taskbar:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_taskbar_get_message ##### -->
+<para>
+
+</para>
+
+@shell_taskbar:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_taskbar_set_message ##### -->
+<para>
+
+</para>
+
+@shell_taskbar:
+@message:
+
+
+<!-- ##### FUNCTION e_shell_taskbar_unset_message ##### -->
+<para>
+
+</para>
+
+@shell_taskbar:
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-view.sgml b/doc/reference/shell/tmpl/e-shell-view.sgml
new file mode 100644
index 0000000000..15c6097c4f
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-view.sgml
@@ -0,0 +1,267 @@
+<!-- ##### SECTION Title ##### -->
+EShellView
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EShellView ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SIGNAL EShellView::toggled ##### -->
+<para>
+
+</para>
+
+@eshellview: the object which received the signal.
+
+<!-- ##### SIGNAL EShellView::update-actions ##### -->
+<para>
+
+</para>
+
+@eshellview: the object which received the signal.
+
+<!-- ##### ARG EShellView:action ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellView:page-num ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellView:shell-backend ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellView:shell-content ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellView:shell-sidebar ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellView:shell-taskbar ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellView:shell-window ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellView:title ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellView:view-id ##### -->
+<para>
+
+</para>
+
+<!-- ##### STRUCT EShellViewClass ##### -->
+<para>
+
+</para>
+
+@parent_class:
+@label:
+@icon_name:
+@ui_definition:
+@ui_manager_id:
+@search_options:
+@search_rules:
+@view_collection:
+@shell_backend:
+@new_shell_content:
+@new_shell_sidebar:
+@new_shell_taskbar:
+@toggled:
+@update_actions:
+
+<!-- ##### FUNCTION e_shell_view_get_name ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_view_get_action ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_view_get_title ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_view_set_title ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@title:
+
+
+<!-- ##### FUNCTION e_shell_view_get_view_id ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_view_set_view_id ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@view_id:
+
+
+<!-- ##### FUNCTION e_shell_view_is_active ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_view_get_page_num ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_view_set_page_num ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@page_num:
+
+
+<!-- ##### FUNCTION e_shell_view_get_size_group ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_view_get_shell_backend ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_view_get_shell_content ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_view_get_shell_sidebar ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_view_get_shell_taskbar ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_view_get_shell_window ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_view_update_actions ##### -->
+<para>
+
+</para>
+
+@shell_view:
+
+
+<!-- ##### FUNCTION e_shell_view_show_popup_menu ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@widget_path:
+@event:
+
+
+<!-- ##### FUNCTION e_shell_view_new_view_instance ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@instance_id:
+@Returns:
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-window-actions.sgml b/doc/reference/shell/tmpl/e-shell-window-actions.sgml
new file mode 100644
index 0000000000..48e6f44203
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-window-actions.sgml
@@ -0,0 +1,309 @@
+<!-- ##### SECTION Title ##### -->
+Global Actions
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION ##### -->
+<para>
+
+</para>
+
+@window:
+@name:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP ##### -->
+<para>
+
+</para>
+
+@window:
+@name:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_ABOUT ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_CLOSE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_FAQ ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_FORGET_PASSWORDS ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GAL_CUSTOM_VIEW ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GAL_DEFINE_VIEWS ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GAL_SAVE_CUSTOM_VIEW ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GAL_VIEW_MENU ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_IMPORT ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_NEW_WINDOW ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_PAGE_SETUP ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_PREFERENCES ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_QUICK_REFERENCE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_QUIT ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEARCH_ADVANCED ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEARCH_CLEAR ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEARCH_EDIT ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEARCH_EXECUTE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEARCH_SAVE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEND_RECEIVE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SHOW_SIDEBAR ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SHOW_STATUSBAR ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SHOW_SWITCHER ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SHOW_TOOLBAR ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SUBMIT_BUG ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_ICONS ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SYNC_OPTIONS ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_WORK_OFFLINE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_WORK_ONLINE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_GAL_VIEW ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_NEW_ITEM ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_NEW_SOURCE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_SHELL ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_SHELL_VIEW ##### -->
+<para>
+
+</para>
+
+@window:
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-window-private.sgml b/doc/reference/shell/tmpl/e-shell-window-private.sgml
new file mode 100644
index 0000000000..6c1c6d0e72
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-window-private.sgml
@@ -0,0 +1,25 @@
+<!-- ##### SECTION Title ##### -->
+e-shell-window-private
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EShellWindowPrivate ##### -->
+<para>
+
+</para>
+
+
diff --git a/doc/reference/shell/tmpl/e-shell-window.sgml b/doc/reference/shell/tmpl/e-shell-window.sgml
new file mode 100644
index 0000000000..9571632bae
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell-window.sgml
@@ -0,0 +1,190 @@
+<!-- ##### SECTION Title ##### -->
+EShellWindow
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EShellWindow ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG EShellWindow:active-view ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellWindow:safe-mode ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellWindow:shell ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShellWindow:ui-manager ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION e_shell_window_new ##### -->
+<para>
+
+</para>
+
+@shell:
+@safe_mode:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_window_get_shell ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_window_get_shell_view ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@view_name:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_window_get_shell_view_action ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@view_name:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_window_get_ui_manager ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_window_get_action ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@action_name:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_window_get_action_group ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@group_name:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_window_get_managed_widget ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@widget_path:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_window_get_active_view ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_window_set_active_view ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@view_name:
+
+
+<!-- ##### FUNCTION e_shell_window_get_safe_mode ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_window_set_safe_mode ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@safe_mode:
+
+
+<!-- ##### FUNCTION e_shell_window_add_action_group ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@group_name:
+
+
+<!-- ##### FUNCTION e_shell_window_register_new_item_actions ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@backend_name:
+@entries:
+@n_entries:
+
+
+<!-- ##### FUNCTION e_shell_window_register_new_source_actions ##### -->
+<para>
+
+</para>
+
+@shell_window:
+@backend_name:
+@entries:
+@n_entries:
+
+
diff --git a/doc/reference/shell/tmpl/e-shell.sgml b/doc/reference/shell/tmpl/e-shell.sgml
new file mode 100644
index 0000000000..f1c5acec53
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-shell.sgml
@@ -0,0 +1,306 @@
+<!-- ##### SECTION Title ##### -->
+EShell
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EShell ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SIGNAL EShell::event ##### -->
+<para>
+
+</para>
+
+@eshell: the object which received the signal.
+@Param2:
+
+<!-- ##### SIGNAL EShell::handle-uri ##### -->
+<para>
+
+</para>
+
+@eshell: the object which received the signal.
+@arg1:
+@Returns:
+
+<!-- ##### SIGNAL EShell::prepare-for-offline ##### -->
+<para>
+
+</para>
+
+@eshell: the object which received the signal.
+@arg1:
+
+<!-- ##### SIGNAL EShell::prepare-for-online ##### -->
+<para>
+
+</para>
+
+@eshell: the object which received the signal.
+@arg1:
+
+<!-- ##### SIGNAL EShell::send-receive ##### -->
+<para>
+
+</para>
+
+@eshell: the object which received the signal.
+@arg1:
+
+<!-- ##### SIGNAL EShell::window-created ##### -->
+<para>
+
+</para>
+
+@eshell: the object which received the signal.
+@arg1:
+
+<!-- ##### SIGNAL EShell::window-destroyed ##### -->
+<para>
+
+</para>
+
+@eshell: the object which received the signal.
+
+<!-- ##### ARG EShell:network-available ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShell:online ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG EShell:shell-settings ##### -->
+<para>
+
+</para>
+
+<!-- ##### FUNCTION e_shell_get_default ##### -->
+<para>
+
+</para>
+
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_get_shell_backends ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_get_canonical_name ##### -->
+<para>
+
+</para>
+
+@shell:
+@name:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_get_backend_by_name ##### -->
+<para>
+
+</para>
+
+@shell:
+@name:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_get_backend_by_scheme ##### -->
+<para>
+
+</para>
+
+@shell:
+@scheme:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_get_shell_settings ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_get_gconf_client ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_create_shell_window ##### -->
+<para>
+
+</para>
+
+@shell:
+@view_name:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_handle_uris ##### -->
+<para>
+
+</para>
+
+@shell:
+@uris:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_watch_window ##### -->
+<para>
+
+</para>
+
+@shell:
+@window:
+
+
+<!-- ##### FUNCTION e_shell_get_watched_windows ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_send_receive ##### -->
+<para>
+
+</para>
+
+@shell:
+@parent:
+
+
+<!-- ##### FUNCTION e_shell_get_network_available ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_set_network_available ##### -->
+<para>
+
+</para>
+
+@shell:
+@network_available:
+
+
+<!-- ##### FUNCTION e_shell_get_online ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_set_online ##### -->
+<para>
+
+</para>
+
+@shell:
+@online:
+
+
+<!-- ##### FUNCTION e_shell_get_preferences_window ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_event ##### -->
+<para>
+
+</para>
+
+@shell:
+@event_name:
+@event_data:
+
+
+<!-- ##### FUNCTION e_shell_is_busy ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_do_quit ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+
+<!-- ##### FUNCTION e_shell_quit ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+
+<!-- ##### MACRO E_SHELL_MIGRATE_ERROR ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### FUNCTION e_shell_migrate_attempt ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+
diff --git a/doc/reference/shell/tmpl/e-test-shell-view.sgml b/doc/reference/shell/tmpl/e-test-shell-view.sgml
new file mode 100644
index 0000000000..2c9c912c20
--- /dev/null
+++ b/doc/reference/shell/tmpl/e-test-shell-view.sgml
@@ -0,0 +1,41 @@
+<!-- ##### SECTION Title ##### -->
+ETestShellView
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### VARIABLE e_test_shell_view_type ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### STRUCT ETestShellViewPrivate ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### STRUCT ETestShellView ##### -->
+<para>
+
+</para>
+
+@parent:
+@priv:
+
diff --git a/doc/reference/shell/tmpl/es-event.sgml b/doc/reference/shell/tmpl/es-event.sgml
new file mode 100644
index 0000000000..8821e92ad5
--- /dev/null
+++ b/doc/reference/shell/tmpl/es-event.sgml
@@ -0,0 +1,147 @@
+<!-- ##### SECTION Title ##### -->
+ESEventHook
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### ENUM es_event_target_t ##### -->
+<para>
+
+</para>
+
+@ES_EVENT_TARGET_STATE:
+@ES_EVENT_TARGET_UPGRADE:
+@ES_EVENT_TARGET_SHELL:
+@ES_EVENT_TARGET_COMPONENT:
+
+<!-- ##### STRUCT ESEventTargetState ##### -->
+<para>
+
+</para>
+
+@target:
+@state:
+
+<!-- ##### STRUCT ESEventTargetUpgrade ##### -->
+<para>
+
+</para>
+
+@target:
+@major:
+@minor:
+@revision:
+
+<!-- ##### STRUCT ESEventTargetShell ##### -->
+<para>
+
+</para>
+
+@target:
+
+<!-- ##### STRUCT ESEventTargetComponent ##### -->
+<para>
+
+</para>
+
+@target:
+@id:
+
+<!-- ##### TYPEDEF ESEventItem ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### STRUCT ESEvent ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION es_event_get_type ##### -->
+<para>
+
+</para>
+
+@Returns:
+
+
+<!-- ##### FUNCTION es_event_peek ##### -->
+<para>
+
+</para>
+
+@Returns:
+
+
+<!-- ##### FUNCTION es_event_target_new ##### -->
+<para>
+
+</para>
+
+@eme:
+@Returns:
+
+
+<!-- ##### FUNCTION es_event_target_new_state ##### -->
+<para>
+
+</para>
+
+@emp:
+@state:
+@Returns:
+
+
+<!-- ##### FUNCTION es_event_target_new_upgrade ##### -->
+<para>
+
+</para>
+
+@emp:
+@major:
+@minor:
+@revision:
+@Returns:
+
+
+<!-- ##### FUNCTION es_event_target_new_component ##### -->
+<para>
+
+</para>
+
+@eme:
+@id:
+@Returns:
+
+
+<!-- ##### STRUCT ESEventHook ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION es_event_hook_get_type ##### -->
+<para>
+
+</para>
+
+@Returns:
+
+
diff --git a/doc/reference/shell/tmpl/eshell-unused.sgml b/doc/reference/shell/tmpl/eshell-unused.sgml
new file mode 100644
index 0000000000..72168ee8e2
--- /dev/null
+++ b/doc/reference/shell/tmpl/eshell-unused.sgml
@@ -0,0 +1,2319 @@
+<!-- ##### SECTION ./tmpl/Evolution-DataServer.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/Evolution-DataServer.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/Evolution-DataServer.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/Evolution-DataServer.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/Evolution-DataServer.sgml:Title ##### -->
+Evolution-DataServer
+
+
+<!-- ##### SECTION ./tmpl/e-activity-handler.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-activity-handler.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-activity-handler.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-activity-handler.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-activity-handler.sgml:Title ##### -->
+EActivityHandler
+
+
+<!-- ##### SECTION ./tmpl/e-config-upgrade.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-config-upgrade.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-config-upgrade.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-config-upgrade.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-config-upgrade.sgml:Title ##### -->
+e-config-upgrade
+
+
+<!-- ##### SECTION ./tmpl/e-shell-common.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-common.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-common.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-common.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-common.sgml:Title ##### -->
+e-shell-common
+
+
+<!-- ##### SECTION ./tmpl/e-shell-constants.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-constants.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-constants.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-constants.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-constants.sgml:Title ##### -->
+e-shell-constants
+
+
+<!-- ##### SECTION ./tmpl/e-shell-marshal.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-marshal.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-marshal.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-marshal.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-marshal.sgml:Title ##### -->
+e-shell-marshal
+
+
+<!-- ##### SECTION ./tmpl/e-shell-migrate.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-migrate.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-migrate.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-migrate.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-migrate.sgml:Title ##### -->
+Migration
+
+
+<!-- ##### SECTION ./tmpl/e-shell-module.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-module.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-module.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-module.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-module.sgml:Title ##### -->
+EShellModule
+
+
+<!-- ##### SECTION ./tmpl/e-shell-window-actions.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-window-actions.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-window-actions.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-window-actions.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-window-actions.sgml:Title ##### -->
+Global Actions
+
+
+<!-- ##### SECTION ./tmpl/e-shell-window-private.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-window-private.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-shell-window-private.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-window-private.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-shell-window-private.sgml:Title ##### -->
+e-shell-window-private
+
+
+<!-- ##### SECTION ./tmpl/e-test-shell-view.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-test-shell-view.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/e-test-shell-view.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-test-shell-view.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/e-test-shell-view.sgml:Title ##### -->
+ETestShellView
+
+
+<!-- ##### SECTION ./tmpl/es-event.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/es-event.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/es-event.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/es-event.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/es-event.sgml:Title ##### -->
+ESEventHook
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer-client.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer-client.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer-client.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer-client.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer-client.sgml:Title ##### -->
+EvolutionImporterClient
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer-listener.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer-listener.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer-listener.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer-listener.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer-listener.sgml:Title ##### -->
+EvolutionImporterListener
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/evolution-importer.sgml:Title ##### -->
+EvolutionImporter
+
+
+<!-- ##### SECTION ./tmpl/evolution-intelligent-importer.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/evolution-intelligent-importer.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/evolution-intelligent-importer.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/evolution-intelligent-importer.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/evolution-intelligent-importer.sgml:Title ##### -->
+EvolutionIntelligentImporter
+
+
+<!-- ##### SECTION ./tmpl/intelligent.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/intelligent.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/intelligent.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/intelligent.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/intelligent.sgml:Title ##### -->
+intelligent
+
+
+<!-- ##### STRUCT ESEvent ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### STRUCT ESEventHook ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### TYPEDEF ESEventItem ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### STRUCT ESEventTargetComponent ##### -->
+<para>
+
+</para>
+
+@target:
+@id:
+
+<!-- ##### STRUCT ESEventTargetShell ##### -->
+<para>
+
+</para>
+
+@target:
+
+<!-- ##### STRUCT ESEventTargetState ##### -->
+<para>
+
+</para>
+
+@target:
+@state:
+
+<!-- ##### STRUCT ESEventTargetUpgrade ##### -->
+<para>
+
+</para>
+
+@target:
+@major:
+@minor:
+@revision:
+
+<!-- ##### ARG EShell:online-mode ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG EShell:settings ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG EShellContent:search-value ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ENUM EShellLineStatus ##### -->
+<para>
+
+</para>
+
+@E_SHELL_LINE_STATUS_ONLINE:
+@E_SHELL_LINE_STATUS_GOING_OFFLINE:
+@E_SHELL_LINE_STATUS_OFFLINE:
+@E_SHELL_LINE_STATUS_FORCED_OFFLINE:
+
+<!-- ##### STRUCT EShellModule ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SIGNAL EShellModule::activity-added ##### -->
+<para>
+
+</para>
+
+@eshellmodule: the object which received the signal.
+@arg1:
+
+<!-- ##### ARG EShellModule:filename ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ARG EShellModule:shell ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### STRUCT EShellModuleInfo ##### -->
+<para>
+
+</para>
+
+@name:
+@aliases:
+@schemes:
+@sort_order:
+@start:
+@is_busy:
+@shutdown:
+@migrate:
+
+<!-- ##### ARG EShellView:shell-module ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### STRUCT EShellWindowPrivate ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### STRUCT ETestShellView ##### -->
+<para>
+
+</para>
+
+@parent:
+@priv:
+
+<!-- ##### STRUCT ETestShellViewPrivate ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_LOCAL_CALENDAR_URI ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_LOCAL_CONTACTS_URI ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_LOCAL_INBOX_URI ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_LOCAL_STORAGE_NAME ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_LOCAL_TASKS_URI ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_PATH_SEPARATOR ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_PATH_SEPARATOR_S ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_SHELL_DEFAULTURI_PREFIX ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_SHELL_DEFAULTURI_PREFIX_LEN ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_SHELL_ICON_SIZE ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_SHELL_MINI_ICON_SIZE ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_SHELL_MINI_ICON_SUFFIX ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_SHELL_MINI_ICON_SUFFIX_LEN ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_SHELL_UPGRADE_ERROR ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_SHELL_URI_PREFIX ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_SHELL_URI_PREFIX_LEN ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION ##### -->
+<para>
+
+</para>
+
+@window:
+@name:
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GAL_VIEW_MENU ##### -->
+<para>
+
+</para>
+
+@window:
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP ##### -->
+<para>
+
+</para>
+
+@window:
+@name:
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GROUP_SHELL_VIEW ##### -->
+<para>
+
+</para>
+
+@window:
+
+<!-- ##### MACRO E_SUMMARY_STORAGE_NAME ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO E_SUMMARY_URI ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### STRUCT EvolutionImporter ##### -->
+<para>
+
+</para>
+
+@parent:
+@priv:
+
+<!-- ##### STRUCT EvolutionImporterClient ##### -->
+<para>
+
+</para>
+
+@parent_type:
+@objref:
+
+<!-- ##### USER_FUNCTION EvolutionImporterCreateControlFn ##### -->
+<para>
+
+</para>
+
+@importer:
+@control:
+@closure:
+
+<!-- ##### USER_FUNCTION EvolutionImporterGetErrorFn ##### -->
+<para>
+
+</para>
+
+@importer:
+@closure:
+@Returns:
+
+<!-- ##### STRUCT EvolutionImporterListener ##### -->
+<para>
+
+</para>
+
+@parent:
+@priv:
+
+<!-- ##### USER_FUNCTION EvolutionImporterListenerCallback ##### -->
+<para>
+
+</para>
+
+@listener:
+@result:
+@more_items:
+@closure:
+
+<!-- ##### STRUCT EvolutionImporterListenerPrivate ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### USER_FUNCTION EvolutionImporterLoadFileFn ##### -->
+<para>
+
+</para>
+
+@importer:
+@filename:
+@closure:
+@Returns:
+
+<!-- ##### STRUCT EvolutionImporterPrivate ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### USER_FUNCTION EvolutionImporterProcessItemFn ##### -->
+<para>
+
+</para>
+
+@importer:
+@listener:
+@closure:
+@ev:
+
+<!-- ##### ENUM EvolutionImporterResult ##### -->
+<para>
+
+</para>
+
+@EVOLUTION_IMPORTER_OK:
+@EVOLUTION_IMPORTER_UNSUPPORTED_OPERATION:
+@EVOLUTION_IMPORTER_INTERRUPTED:
+@EVOLUTION_IMPORTER_BUSY:
+@EVOLUTION_IMPORTER_NOT_READY:
+@EVOLUTION_IMPORTER_UNKNOWN_DATA:
+@EVOLUTION_IMPORTER_BAD_DATA:
+@EVOLUTION_IMPORTER_BAD_FILE:
+@EVOLUTION_IMPORTER_UNKNOWN_ERROR:
+
+<!-- ##### USER_FUNCTION EvolutionImporterSupportFormatFn ##### -->
+<para>
+
+</para>
+
+@importer:
+@filename:
+@closure:
+@Returns:
+
+<!-- ##### STRUCT EvolutionIntelligentImporter ##### -->
+<para>
+
+</para>
+
+@parent:
+@priv:
+
+<!-- ##### USER_FUNCTION EvolutionIntelligentImporterCanImportFn ##### -->
+<para>
+
+</para>
+
+@ii:
+@closure:
+@Returns:
+
+<!-- ##### USER_FUNCTION EvolutionIntelligentImporterImportDataFn ##### -->
+<para>
+
+</para>
+
+@ii:
+@closure:
+
+<!-- ##### STRUCT EvolutionIntelligentImporterPrivate ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### TYPEDEF GNOME_Evolution_DataServer_Config ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Config_IMETHODS_LEN ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### VARIABLE GNOME_Evolution_DataServer_Config__classid ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Config__freekids ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Config__imethods ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### TYPEDEF GNOME_Evolution_DataServer_InterfaceCheck ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_InterfaceCheck_IMETHODS_LEN ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### VARIABLE GNOME_Evolution_DataServer_InterfaceCheck__classid ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_InterfaceCheck__freekids ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION GNOME_Evolution_DataServer_InterfaceCheck__get_interfaceVersion ##### -->
+<para>
+
+</para>
+
+@_obj:
+@ev:
+@Returns:
+
+<!-- ##### ENUM GNOME_Evolution_DataServer_InterfaceCheck__imethods_index ##### -->
+<para>
+
+</para>
+
+@GNOME_Evolution_DataServer_InterfaceCheck__get_interfaceVersion__imethods_index:
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_InterfaceCheck_queryInterface ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_InterfaceCheck_ref ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_InterfaceCheck_unref ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### TYPEDEF GNOME_Evolution_DataServer_Logging ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_IMETHODS_LEN ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### ENUM GNOME_Evolution_DataServer_Logging_Level ##### -->
+<para>
+
+</para>
+
+@GNOME_Evolution_DataServer_Logging_Error:
+@GNOME_Evolution_DataServer_Logging_Critical:
+@GNOME_Evolution_DataServer_Logging_Warning:
+@GNOME_Evolution_DataServer_Logging_Message:
+@GNOME_Evolution_DataServer_Logging_Info:
+@GNOME_Evolution_DataServer_Logging_Debug:
+
+<!-- ##### TYPEDEF GNOME_Evolution_DataServer_Logging_LogEvent ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_LogEvent__alloc ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_LogEvent__freekids ##### -->
+<para>
+
+</para>
+
+@m:
+@d:
+
+<!-- ##### VARIABLE GNOME_Evolution_DataServer_Logging__classid ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging__freekids ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging__imethods ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_addListener ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_addListenerWithMask ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_queryInterface ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_ref ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_removeListener ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_unImplemented ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_unImplemented2 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GNOME_Evolution_DataServer_Logging_unref ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO ORBIT_DECL_GNOME_Evolution_DataServer_Config ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO ORBIT_DECL_GNOME_Evolution_DataServer_InterfaceCheck ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO ORBIT_DECL_GNOME_Evolution_DataServer_Logging ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO ORBIT_IDL_SERIAL ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO ORBIT_IMETHODS_INDEX ##### -->
+<para>
+
+</para>
+
+@m:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_Config ##### -->
+<para>
+
+</para>
+
+@_private:
+@vepv:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_Config__epv ##### -->
+<para>
+
+</para>
+
+@_private:
+
+<!-- ##### FUNCTION POA_GNOME_Evolution_DataServer_Config__fini ##### -->
+<para>
+
+</para>
+
+@servant:
+@ev:
+
+<!-- ##### FUNCTION POA_GNOME_Evolution_DataServer_Config__init ##### -->
+<para>
+
+</para>
+
+@servant:
+@ev:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_Config__vepv ##### -->
+<para>
+
+</para>
+
+@_base_epv:
+@GNOME_Evolution_DataServer_Config_epv:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_InterfaceCheck ##### -->
+<para>
+
+</para>
+
+@_private:
+@vepv:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_InterfaceCheck__epv ##### -->
+<para>
+
+</para>
+
+@_private:
+@_get_interfaceVersion:
+
+<!-- ##### FUNCTION POA_GNOME_Evolution_DataServer_InterfaceCheck__fini ##### -->
+<para>
+
+</para>
+
+@servant:
+@ev:
+
+<!-- ##### FUNCTION POA_GNOME_Evolution_DataServer_InterfaceCheck__init ##### -->
+<para>
+
+</para>
+
+@servant:
+@ev:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_InterfaceCheck__vepv ##### -->
+<para>
+
+</para>
+
+@_base_epv:
+@Bonobo_Unknown_epv:
+@GNOME_Evolution_DataServer_InterfaceCheck_epv:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_Logging ##### -->
+<para>
+
+</para>
+
+@_private:
+@vepv:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_Logging__epv ##### -->
+<para>
+
+</para>
+
+@_private:
+
+<!-- ##### FUNCTION POA_GNOME_Evolution_DataServer_Logging__fini ##### -->
+<para>
+
+</para>
+
+@servant:
+@ev:
+
+<!-- ##### FUNCTION POA_GNOME_Evolution_DataServer_Logging__init ##### -->
+<para>
+
+</para>
+
+@servant:
+@ev:
+
+<!-- ##### STRUCT POA_GNOME_Evolution_DataServer_Logging__vepv ##### -->
+<para>
+
+</para>
+
+@_base_epv:
+@Bonobo_Unknown_epv:
+@Bonobo_EventSource_epv:
+@GNOME_Evolution_DataServer_Logging_epv:
+
+<!-- ##### MACRO TC_GNOME_Evolution_DataServer_Config ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_GNOME_Evolution_DataServer_InterfaceCheck ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_GNOME_Evolution_DataServer_Logging ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_GNOME_Evolution_DataServer_Logging_Level ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_GNOME_Evolution_DataServer_Logging_LogEvent ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_0 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_1 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_10 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_11 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_12 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_13 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_14 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_15 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_16 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_17 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_18 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_19 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_2 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_3 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_4 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_5 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_6 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_7 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_8 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Config_9 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_0 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_1 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_10 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_11 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_12 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_13 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_14 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_15 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_16 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_17 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_18 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_19 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_2 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_3 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_4 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_5 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_6 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_7 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_8 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_InterfaceCheck_9 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_0 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_1 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_10 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_11 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_12 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_13 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_14 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_15 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_16 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_17 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_18 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_19 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_2 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_3 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_4 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_5 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_6 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_7 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_8 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_9 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_0 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_1 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_10 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_11 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_12 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_13 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_14 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_15 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_16 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_17 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_18 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_19 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_2 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_3 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_4 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_5 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_6 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_7 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_8 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_Level_9 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_0 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_1 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_10 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_11 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_12 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_13 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_14 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_15 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_16 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_17 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_18 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_19 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_2 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_3 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_4 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_5 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_6 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_7 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_8 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO TC_IMPL_TC_GNOME_Evolution_DataServer_Logging_LogEvent_9 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION e_config_upgrade ##### -->
+<para>
+
+</para>
+
+@major:
+@minor:
+@revision:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_content_get_context ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_content_get_search_value ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_content_set_context ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@context:
+
+<!-- ##### FUNCTION e_shell_content_set_search_value ##### -->
+<para>
+
+</para>
+
+@shell_content:
+@search_value:
+
+<!-- ##### FUNCTION e_shell_create_window ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_get_focused_window ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_get_line_status ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_get_module_by_name ##### -->
+<para>
+
+</para>
+
+@shell:
+@name:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_get_module_by_scheme ##### -->
+<para>
+
+</para>
+
+@shell:
+@scheme:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_get_online_mode ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_get_settings ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_get_shell_modules ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_get_shell_windows ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_handle_uri ##### -->
+<para>
+
+</para>
+
+@shell:
+@uri:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_list_modules ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_list_shell_modules ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_list_shell_windows ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_marshal_BOOLEAN__STRING ##### -->
+<para>
+
+</para>
+
+@closure:
+@return_value:
+@n_param_values:
+@param_values:
+@invocation_hint:
+@marshal_data:
+
+<!-- ##### MACRO e_shell_marshal_BOOL__STRING ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION e_shell_migrate_error_quark ##### -->
+<para>
+
+</para>
+
+@Returns:
+
+<!-- ##### FUNCTION e_shell_module_add_activity ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@activity:
+
+<!-- ##### FUNCTION e_shell_module_compare ##### -->
+<para>
+
+</para>
+
+@shell_module_a:
+@shell_module_b:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_module_get_config_dir ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_module_get_data_dir ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_module_get_filename ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_module_get_shell ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_module_get_shell_view_type ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_module_is_busy ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_module_migrate ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@major:
+@minor:
+@micro:
+@error:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_module_new ##### -->
+<para>
+
+</para>
+
+@shell:
+@filename:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_module_set_info ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@info:
+@shell_view_type:
+
+<!-- ##### FUNCTION e_shell_module_shutdown ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_module_start ##### -->
+<para>
+
+</para>
+
+@shell_module:
+
+<!-- ##### FUNCTION e_shell_module_upgrade ##### -->
+<para>
+
+</para>
+
+@shell_module:
+@major:
+@minor:
+@micro:
+@error:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_new ##### -->
+<para>
+
+</para>
+
+@online:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_set_line_status ##### -->
+<para>
+
+</para>
+
+@shell:
+@status:
+
+<!-- ##### FUNCTION e_shell_set_online_mode ##### -->
+<para>
+
+</para>
+
+@shell:
+@online_mode:
+
+<!-- ##### FUNCTION e_shell_upgrade_attempt ##### -->
+<para>
+
+</para>
+
+@shell:
+@Returns:
+
+<!-- ##### FUNCTION e_shell_view_get_shell_module ##### -->
+<para>
+
+</para>
+
+@shell_view:
+@Returns:
+
+<!-- ##### VARIABLE e_test_shell_view_type ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION es_event_get_type ##### -->
+<para>
+
+</para>
+
+@Returns:
+
+<!-- ##### FUNCTION es_event_hook_get_type ##### -->
+<para>
+
+</para>
+
+@Returns:
+
+<!-- ##### FUNCTION es_event_peek ##### -->
+<para>
+
+</para>
+
+@Returns:
+
+<!-- ##### FUNCTION es_event_target_new ##### -->
+<para>
+
+</para>
+
+@eme:
+@Returns:
+
+<!-- ##### FUNCTION es_event_target_new_component ##### -->
+<para>
+
+</para>
+
+@eme:
+@id:
+@Returns:
+
+<!-- ##### FUNCTION es_event_target_new_state ##### -->
+<para>
+
+</para>
+
+@emp:
+@state:
+@Returns:
+
+<!-- ##### FUNCTION es_event_target_new_upgrade ##### -->
+<para>
+
+</para>
+
+@emp:
+@major:
+@minor:
+@revision:
+@Returns:
+
+<!-- ##### ENUM es_event_target_t ##### -->
+<para>
+
+</para>
+
+@ES_EVENT_TARGET_STATE:
+@ES_EVENT_TARGET_UPGRADE:
+@ES_EVENT_TARGET_SHELL:
+@ES_EVENT_TARGET_COMPONENT:
+
+<!-- ##### FUNCTION evolution_importer_client_create_control ##### -->
+<para>
+
+</para>
+
+@client:
+@Returns:
+
+<!-- ##### FUNCTION evolution_importer_client_get_error ##### -->
+<para>
+
+</para>
+
+@client:
+@Returns:
+
+<!-- ##### FUNCTION evolution_importer_client_load_file ##### -->
+<para>
+
+</para>
+
+@client:
+@filename:
+@Returns:
+
+<!-- ##### FUNCTION evolution_importer_client_new ##### -->
+<para>
+
+</para>
+
+@objref:
+@Returns:
+
+<!-- ##### FUNCTION evolution_importer_client_new_from_id ##### -->
+<para>
+
+</para>
+
+@id:
+@Returns:
+
+<!-- ##### FUNCTION evolution_importer_client_process_item ##### -->
+<para>
+
+</para>
+
+@client:
+@listener:
+
+<!-- ##### FUNCTION evolution_importer_client_support_format ##### -->
+<para>
+
+</para>
+
+@client:
+@filename:
+@Returns:
+
+<!-- ##### FUNCTION evolution_importer_listener_new ##### -->
+<para>
+
+</para>
+
+@callback:
+@closure:
+@Returns:
+
+<!-- ##### FUNCTION evolution_importer_new ##### -->
+<para>
+
+</para>
+
+@create_control_fn:
+@support_format_fn:
+@load_file_fn:
+@process_item_fn:
+@get_error_fn:
+@closure:
+@Returns:
+
+<!-- ##### FUNCTION evolution_intelligent_importer_new ##### -->
+<para>
+
+</para>
+
+@can_import_fn:
+@import_data_fn:
+@importername:
+@message:
+@closure:
+@Returns:
+
+<!-- ##### FUNCTION intelligent_importer_init ##### -->
+<para>
+
+</para>
+
+
diff --git a/doc/reference/shell/tmpl/evolution-importer-client.sgml b/doc/reference/shell/tmpl/evolution-importer-client.sgml
new file mode 100644
index 0000000000..db2acb621a
--- /dev/null
+++ b/doc/reference/shell/tmpl/evolution-importer-client.sgml
@@ -0,0 +1,94 @@
+<!-- ##### SECTION Title ##### -->
+EvolutionImporterClient
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EvolutionImporterClient ##### -->
+<para>
+
+</para>
+
+@parent_type:
+@objref:
+
+<!-- ##### FUNCTION evolution_importer_client_new ##### -->
+<para>
+
+</para>
+
+@objref:
+@Returns:
+
+
+<!-- ##### FUNCTION evolution_importer_client_new_from_id ##### -->
+<para>
+
+</para>
+
+@id:
+@Returns:
+
+
+<!-- ##### FUNCTION evolution_importer_client_create_control ##### -->
+<para>
+
+</para>
+
+@client:
+@Returns:
+
+
+<!-- ##### FUNCTION evolution_importer_client_support_format ##### -->
+<para>
+
+</para>
+
+@client:
+@filename:
+@Returns:
+
+
+<!-- ##### FUNCTION evolution_importer_client_load_file ##### -->
+<para>
+
+</para>
+
+@client:
+@filename:
+@Returns:
+
+
+<!-- ##### FUNCTION evolution_importer_client_process_item ##### -->
+<para>
+
+</para>
+
+@client:
+@listener:
+
+
+<!-- ##### FUNCTION evolution_importer_client_get_error ##### -->
+<para>
+
+</para>
+
+@client:
+@Returns:
+
+
diff --git a/doc/reference/shell/tmpl/evolution-importer-listener.sgml b/doc/reference/shell/tmpl/evolution-importer-listener.sgml
new file mode 100644
index 0000000000..7b0b3ab488
--- /dev/null
+++ b/doc/reference/shell/tmpl/evolution-importer-listener.sgml
@@ -0,0 +1,56 @@
+<!-- ##### SECTION Title ##### -->
+EvolutionImporterListener
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EvolutionImporterListenerPrivate ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### USER_FUNCTION EvolutionImporterListenerCallback ##### -->
+<para>
+
+</para>
+
+@listener:
+@result:
+@more_items:
+@closure:
+
+
+<!-- ##### STRUCT EvolutionImporterListener ##### -->
+<para>
+
+</para>
+
+@parent:
+@priv:
+
+<!-- ##### FUNCTION evolution_importer_listener_new ##### -->
+<para>
+
+</para>
+
+@callback:
+@closure:
+@Returns:
+
+
diff --git a/doc/reference/shell/tmpl/evolution-importer.sgml b/doc/reference/shell/tmpl/evolution-importer.sgml
new file mode 100644
index 0000000000..c092138c60
--- /dev/null
+++ b/doc/reference/shell/tmpl/evolution-importer.sgml
@@ -0,0 +1,117 @@
+<!-- ##### SECTION Title ##### -->
+EvolutionImporter
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EvolutionImporterPrivate ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### USER_FUNCTION EvolutionImporterCreateControlFn ##### -->
+<para>
+
+</para>
+
+@importer:
+@control:
+@closure:
+
+
+<!-- ##### USER_FUNCTION EvolutionImporterSupportFormatFn ##### -->
+<para>
+
+</para>
+
+@importer:
+@filename:
+@closure:
+@Returns:
+
+
+<!-- ##### USER_FUNCTION EvolutionImporterLoadFileFn ##### -->
+<para>
+
+</para>
+
+@importer:
+@filename:
+@closure:
+@Returns:
+
+
+<!-- ##### USER_FUNCTION EvolutionImporterProcessItemFn ##### -->
+<para>
+
+</para>
+
+@importer:
+@listener:
+@closure:
+@ev:
+
+
+<!-- ##### USER_FUNCTION EvolutionImporterGetErrorFn ##### -->
+<para>
+
+</para>
+
+@importer:
+@closure:
+@Returns:
+
+
+<!-- ##### ENUM EvolutionImporterResult ##### -->
+<para>
+
+</para>
+
+@EVOLUTION_IMPORTER_OK:
+@EVOLUTION_IMPORTER_UNSUPPORTED_OPERATION:
+@EVOLUTION_IMPORTER_INTERRUPTED:
+@EVOLUTION_IMPORTER_BUSY:
+@EVOLUTION_IMPORTER_NOT_READY:
+@EVOLUTION_IMPORTER_UNKNOWN_DATA:
+@EVOLUTION_IMPORTER_BAD_DATA:
+@EVOLUTION_IMPORTER_BAD_FILE:
+@EVOLUTION_IMPORTER_UNKNOWN_ERROR:
+
+<!-- ##### STRUCT EvolutionImporter ##### -->
+<para>
+
+</para>
+
+@parent:
+@priv:
+
+<!-- ##### FUNCTION evolution_importer_new ##### -->
+<para>
+
+</para>
+
+@create_control_fn:
+@support_format_fn:
+@load_file_fn:
+@process_item_fn:
+@get_error_fn:
+@closure:
+@Returns:
+
+
diff --git a/doc/reference/shell/tmpl/evolution-intelligent-importer.sgml b/doc/reference/shell/tmpl/evolution-intelligent-importer.sgml
new file mode 100644
index 0000000000..4dfdb70203
--- /dev/null
+++ b/doc/reference/shell/tmpl/evolution-intelligent-importer.sgml
@@ -0,0 +1,67 @@
+<!-- ##### SECTION Title ##### -->
+EvolutionIntelligentImporter
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT EvolutionIntelligentImporterPrivate ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### USER_FUNCTION EvolutionIntelligentImporterCanImportFn ##### -->
+<para>
+
+</para>
+
+@ii:
+@closure:
+@Returns:
+
+
+<!-- ##### USER_FUNCTION EvolutionIntelligentImporterImportDataFn ##### -->
+<para>
+
+</para>
+
+@ii:
+@closure:
+
+
+<!-- ##### STRUCT EvolutionIntelligentImporter ##### -->
+<para>
+
+</para>
+
+@parent:
+@priv:
+
+<!-- ##### FUNCTION evolution_intelligent_importer_new ##### -->
+<para>
+
+</para>
+
+@can_import_fn:
+@import_data_fn:
+@importername:
+@message:
+@closure:
+@Returns:
+
+
diff --git a/doc/reference/shell/tmpl/intelligent.sgml b/doc/reference/shell/tmpl/intelligent.sgml
new file mode 100644
index 0000000000..1c50af5c7b
--- /dev/null
+++ b/doc/reference/shell/tmpl/intelligent.sgml
@@ -0,0 +1,26 @@
+<!-- ##### SECTION Title ##### -->
+intelligent
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION intelligent_importer_init ##### -->
+<para>
+
+</para>
+
+
+
diff --git a/doc/reference/shell/tmpl/shell-actions.sgml b/doc/reference/shell/tmpl/shell-actions.sgml
new file mode 100644
index 0000000000..60001d61bb
--- /dev/null
+++ b/doc/reference/shell/tmpl/shell-actions.sgml
@@ -0,0 +1,291 @@
+<!-- ##### SECTION Title ##### -->
+Shell Actions
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_ABOUT ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_CLOSE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_CONTENTS ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_FAQ ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_FORGET_PASSWORDS ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GAL_CUSTOM_VIEW ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GAL_DEFINE_VIEWS ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_GAL_SAVE_CUSTOM_VIEW ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_IMPORT ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_NEW_WINDOW ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_PAGE_SETUP ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_PREFERENCES ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_QUICK_REFERENCE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_QUIT ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEARCH_ADVANCED ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEARCH_CLEAR ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEARCH_EDIT ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEARCH_EXECUTE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEARCH_OPTIONS ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEARCH_SAVE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SEND_RECEIVE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SHOW_SIDEBAR ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SHOW_STATUSBAR ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SHOW_SWITCHER ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SHOW_TOOLBAR ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SUBMIT_BUG ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SWITCHER_INITIAL ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_BOTH ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_ICONS ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_TEXT ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_USER ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_SYNC_OPTIONS ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_WORK_OFFLINE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
+<!-- ##### MACRO E_SHELL_WINDOW_ACTION_WORK_ONLINE ##### -->
+<para>
+
+</para>
+
+@window:
+
+
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 367a9c79d7..934c20b593 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -4,7 +4,6 @@ ecpsdir = $(privdatadir)/ecps
ruledir = $(privdatadir)
if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = $(top_builddir)/win32/libemiscwidgets.la
PLATFORM_SOURCES = e-win32-reloc.c
endif
@@ -34,18 +33,18 @@ INCLUDES = \
-DSEARCH_RULE_DIR=\"$(ruledir)\" \
-DG_LOG_DOMAIN=\"e-utils\" \
$(GNOME_PILOT_CFLAGS) \
- $(ICONV_CFLAGS) \
+ $(ICONV_CFLAGS) \
$(E_UTIL_CFLAGS)
privsolib_LTLIBRARIES = libeutil.la libeconduit.la
eutilinclude_HEADERS = \
+ e-account-utils.h \
e-bconf-map.h \
e-binding.h \
e-categories-config.h \
e-config.h \
e-config-listener.h \
- e-corba-utils.h \
e-cursor.h \
e-dialog-utils.h \
e-dialog-widgets.h \
@@ -57,10 +56,11 @@ eutilinclude_HEADERS = \
e-icon-factory.h \
e-import.h \
e-logger.h \
- e-non-intrusive-error-dialog.h \
e-marshal.h \
e-menu.h \
e-mktemp.h \
+ e-module.h \
+ e-non-intrusive-error-dialog.h \
e-print.h \
e-plugin.h \
e-plugin-ui.h \
@@ -69,6 +69,7 @@ eutilinclude_HEADERS = \
e-request.h \
e-signature.h \
e-signature-list.h \
+ e-signature-utils.h \
e-bit-array.h \
e-sorter.h \
e-sorter-array.h \
@@ -76,17 +77,17 @@ eutilinclude_HEADERS = \
e-text-event-processor-types.h \
e-text-event-processor.h \
e-util.h \
- e-util-labels.h \
+ e-unicode.h \
e-xml-utils.h
libeutil_la_SOURCES = \
$(eutilinclude_HEADERS) \
+ e-account-utils.c \
e-bconf-map.c \
e-binding.c \
e-categories-config.c \
- e-config.c \
e-config-listener.c \
- e-corba-utils.c \
+ e-config.c \
e-cursor.c \
e-dialog-utils.c \
e-dialog-widgets.c \
@@ -98,25 +99,27 @@ libeutil_la_SOURCES = \
e-icon-factory.c \
e-import.c \
e-logger.c \
- e-non-intrusive-error-dialog.c \
e-marshal.c \
e-menu.c \
e-mktemp.c \
- e-plugin.c \
+ e-module.c \
+ e-non-intrusive-error-dialog.c \
e-plugin-ui.c \
+ e-plugin.c \
e-popup.c \
e-print.c \
e-profile-event.c \
e-request.c \
e-signature.c \
e-signature-list.c \
+ e-signature-utils.c \
e-bit-array.c \
e-sorter.c \
e-sorter-array.c \
e-text-event-processor-emacs-like.c \
e-text-event-processor.c \
e-util.c \
- e-util-labels.c \
+ e-unicode.c \
e-util-private.h \
e-xml-utils.c \
gconf-bridge.c \
@@ -129,7 +132,6 @@ MARSHAL_GENERATED = e-marshal.c e-marshal.h
libeutil_la_LDFLAGS = $(NO_UNDEFINED)
libeutil_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
$(ICONV_LIBS) \
$(E_UTIL_LIBS) \
$(GNOME_PILOT_LIBS) \
diff --git a/e-util/e-account-utils.c b/e-util/e-account-utils.c
new file mode 100644
index 0000000000..5fdffd8be2
--- /dev/null
+++ b/e-util/e-account-utils.c
@@ -0,0 +1,96 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ */
+
+#include "e-account-utils.h"
+
+#include <gconf/gconf-client.h>
+
+static EAccountList *global_account_list;
+
+EAccountList *
+e_get_account_list (void)
+{
+ if (G_UNLIKELY (global_account_list == NULL)) {
+ GConfClient *client;
+
+ client = gconf_client_get_default ();
+ global_account_list = e_account_list_new (client);
+ g_object_unref (client);
+ }
+
+ g_return_val_if_fail (global_account_list != NULL, NULL);
+
+ return global_account_list;
+}
+
+EAccount *
+e_get_default_account (void)
+{
+ EAccountList *account_list;
+ const EAccount *account;
+
+ account_list = e_get_account_list ();
+ account = e_account_list_get_default (account_list);
+
+ /* XXX EAccountList misuses const. */
+ return (EAccount *) account;
+}
+
+void
+e_set_default_account (EAccount *account)
+{
+ EAccountList *account_list;
+
+ g_return_if_fail (E_IS_ACCOUNT (account));
+
+ account_list = e_get_account_list ();
+ e_account_list_set_default (account_list, account);
+}
+
+EAccount *
+e_get_account_by_name (const gchar *name)
+{
+ EAccountList *account_list;
+ const EAccount *account;
+ e_account_find_t find;
+
+ g_return_val_if_fail (name != NULL, NULL);
+
+ find = E_ACCOUNT_FIND_NAME;
+ account_list = e_get_account_list ();
+ account = e_account_list_find (account_list, find, name);
+
+ /* XXX EAccountList misuses const. */
+ return (EAccount *) account;
+}
+
+EAccount *
+e_get_account_by_uid (const gchar *uid)
+{
+ EAccountList *account_list;
+ const EAccount *account;
+ e_account_find_t find;
+
+ g_return_val_if_fail (uid != NULL, NULL);
+
+ find = E_ACCOUNT_FIND_UID;
+ account_list = e_get_account_list ();
+ account = e_account_list_find (account_list, find, uid);
+
+ /* XXX EAccountList misuses const. */
+ return (EAccount *) account;
+}
diff --git a/widgets/table/e-table-tree.h b/e-util/e-account-utils.h
index 864359bf33..f2ae8fc5dc 100644
--- a/widgets/table/e-table-tree.h
+++ b/e-util/e-account-utils.h
@@ -1,5 +1,4 @@
/*
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,36 +12,24 @@
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
*/
-#ifndef _E_TABLE_TREE_H_
-#define _E_TABLE_TREE_H_
+#ifndef E_ACCOUNT_UTILS_H
+#define E_ACCOUNT_UTILS_H
-#include <table/e-table-model.h>
+#include <glib.h>
+#include <libedataserver/e-account.h>
+#include <libedataserver/e-account-list.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);
+EAccountList * e_get_account_list (void);
+EAccount * e_get_default_account (void);
+void e_set_default_account (EAccount *account);
+EAccount * e_get_account_by_name (const gchar *name);
+EAccount * e_get_account_by_uid (const gchar *uid);
G_END_DECLS
-#endif /* _E_TABLE_TREE_H_ */
+#endif /* E_ACCOUNT_UTILS_H */
diff --git a/e-util/e-corba-utils.h b/e-util/e-corba-utils.h
deleted file mode 100644
index b6da7240e7..0000000000
--- a/e-util/e-corba-utils.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef E_CORBA_UTILS_H
-#define E_CORBA_UTILS_H
-
-#include <orbit/orbit.h>
-
-const CORBA_char *e_safe_corba_string (const char *s);
-CORBA_char *e_safe_corba_string_dup (const char *s);
-
-#endif
diff --git a/e-util/e-dialog-utils.c b/e-util/e-dialog-utils.c
index 978033541a..32a16a3b5b 100644
--- a/e-util/e-dialog-utils.c
+++ b/e-util/e-dialog-utils.c
@@ -344,29 +344,29 @@ e_file_dialog_save_folder (const char *title)
* no signals connected and is not shown.
**/
GtkWidget *
-e_file_get_save_filesel (GtkWidget *parent, const char *title, const char *name, GtkFileChooserAction action)
+e_file_get_save_filesel (GtkWindow *parent, const char *title, const char *name, GtkFileChooserAction action)
{
GtkWidget *filesel;
char *uri;
- filesel = gtk_file_chooser_dialog_new (title,
- NULL,
- action,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- (action == GTK_FILE_CHOOSER_ACTION_OPEN) ? GTK_STOCK_OPEN:GTK_STOCK_SAVE, GTK_RESPONSE_OK,
- NULL);
+ g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
+
+ filesel = gtk_file_chooser_dialog_new (
+ title, parent, action,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ (action == GTK_FILE_CHOOSER_ACTION_OPEN) ?
+ GTK_STOCK_OPEN : GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL);
gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filesel), FALSE);
- if (parent)
- e_dialog_set_transient_for((GtkWindow *)filesel, parent);
-
- uri = e_file_get_save_path();
+ uri = e_file_get_save_path ();
- gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (filesel), uri);
+ gtk_file_chooser_set_current_folder_uri (
+ GTK_FILE_CHOOSER (filesel), uri);
if (name && name[0])
- gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filesel), name);
+ gtk_file_chooser_set_current_name (
+ GTK_FILE_CHOOSER (filesel), name);
g_free (uri);
diff --git a/e-util/e-dialog-utils.h b/e-util/e-dialog-utils.h
index 6b9956ddf9..6f25293f10 100644
--- a/e-util/e-dialog-utils.h
+++ b/e-util/e-dialog-utils.h
@@ -43,7 +43,7 @@ char *e_file_dialog_save (const char *title, const char *fname)
char *e_file_dialog_save_folder (const char *title);
-GtkWidget * e_file_get_save_filesel (GtkWidget *parent, const char *title, const char *name, GtkFileChooserAction action);
+GtkWidget * e_file_get_save_filesel (GtkWindow *parent, const char *title, const char *name, GtkFileChooserAction action);
gboolean e_file_can_save(GtkWindow *parent, const char *uri);
gboolean e_file_check_local(const char *name);
diff --git a/e-util/e-logger.c b/e-util/e-logger.c
index 19326d2d67..6c391efb3b 100644
--- a/e-util/e-logger.c
+++ b/e-util/e-logger.c
@@ -43,7 +43,7 @@
((obj), E_TYPE_LOGGER, ELoggerPrivate))
struct _ELoggerPrivate {
- gchar *component;
+ gchar *name;
gchar *logfile;
FILE *fp;
@@ -52,13 +52,13 @@ struct _ELoggerPrivate {
enum {
PROP_0,
- PROP_COMPONENT
+ PROP_NAME
};
static gpointer parent_class;
static gboolean
-flush_logfile (ELogger *logger)
+logger_flush (ELogger *logger)
{
if (logger->priv->fp)
fflush (logger->priv->fp);
@@ -68,16 +68,26 @@ flush_logfile (ELogger *logger)
}
static void
-logger_set_component (ELogger *logger,
- const gchar *component)
+logger_set_dirty (ELogger *logger)
+{
+ if (logger->priv->timer)
+ return;
+
+ logger->priv->timer = g_timeout_add (
+ TIMEOUT_INTERVAL, (GSourceFunc) logger_flush, logger);
+}
+
+static void
+logger_set_name (ELogger *logger,
+ const gchar *name)
{
gchar *temp;
- g_return_if_fail (logger->priv->component == NULL);
+ g_return_if_fail (logger->priv->name == NULL);
- temp = g_strdup_printf ("%s.log.XXXXXX", component);
+ temp = g_strdup_printf ("%s.log.XXXXXX", name);
- logger->priv->component = g_strdup (component);
+ logger->priv->name = g_strdup (name);
logger->priv->logfile = e_mktemp (temp);
logger->priv->fp = g_fopen (logger->priv->logfile, "w");
logger->priv->timer = 0;
@@ -95,8 +105,8 @@ logger_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_COMPONENT:
- logger_set_component (
+ case PROP_NAME:
+ logger_set_name (
E_LOGGER (object),
g_value_get_string (value));
return;
@@ -112,9 +122,9 @@ logger_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_COMPONENT:
+ case PROP_NAME:
g_value_set_string (
- value, e_logger_get_component (
+ value, e_logger_get_name (
E_LOGGER (object)));
return;
}
@@ -129,11 +139,11 @@ logger_finalize (GObject *object)
if (logger->priv->timer)
g_source_remove (logger->priv->timer);
- flush_logfile (logger);
+ logger_flush (logger);
if (logger->priv->fp)
fclose (logger->priv->fp);
- g_free (logger->priv->component);
+ g_free (logger->priv->name);
g_free (logger->priv->logfile);
/* Chain up to parent's finalize() method. */
@@ -155,11 +165,11 @@ logger_class_init (ELoggerClass *class)
g_object_class_install_property (
object_class,
- PROP_COMPONENT,
+ PROP_NAME,
g_param_spec_string (
- "component",
- _("Component"),
- _("Name of the component being logged"),
+ "name",
+ _("Name"),
+ _("Name of the logger"),
"anonymous",
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
@@ -198,34 +208,24 @@ e_logger_get_type (void)
}
ELogger *
-e_logger_create (const gchar *component)
+e_logger_new (const gchar *name)
{
- g_return_val_if_fail (component != NULL, NULL);
+ g_return_val_if_fail (name != NULL, NULL);
- return g_object_new (E_TYPE_LOGGER, "component", component, NULL);
+ return g_object_new (E_TYPE_LOGGER, "name", name, NULL);
}
const gchar *
-e_logger_get_component (ELogger *logger)
+e_logger_get_name (ELogger *logger)
{
g_return_val_if_fail (E_IS_LOGGER (logger), NULL);
- return logger->priv->component;
-}
-
-static void
-set_dirty (ELogger *logger)
-{
- if (logger->priv->timer)
- return;
-
- logger->priv->timer = g_timeout_add_seconds (
- TIMEOUT_INTERVAL, (GSourceFunc) flush_logfile, logger);
+ return logger->priv->name;
}
void
e_logger_log (ELogger *logger,
- gint level,
+ ELogLevel level,
gchar *primary,
gchar *secondary)
{
@@ -240,13 +240,13 @@ e_logger_log (ELogger *logger,
fprintf (logger->priv->fp, "%d:%ld:%s\n", level, t, primary);
fprintf (logger->priv->fp, "%d:%ld:%s\n", level, t, secondary);
- set_dirty (logger);
+ logger_set_dirty (logger);
}
void
e_logger_get_logs (ELogger *logger,
ELogFunction func,
- gpointer data)
+ gpointer user_data)
{
FILE *fp;
gchar buf[250];
@@ -288,11 +288,11 @@ e_logger_get_logs (ELogger *logger,
g_string_append (str, tmp);
}
- func (str->str, data);
+ func (str->str, user_data);
g_string_free (str, TRUE);
} else
- func (tmp, data);
+ func (tmp, user_data);
}
fclose (fp);
diff --git a/e-util/e-logger.h b/e-util/e-logger.h
index b3bd4f8919..efb5cd47f1 100644
--- a/e-util/e-logger.h
+++ b/e-util/e-logger.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef __E_LOGGER_H__
-#define __E_LOGGER_H__
+#ifndef E_LOGGER_H
+#define E_LOGGER_H
#include <glib-object.h>
@@ -52,34 +52,32 @@ typedef struct _ELoggerPrivate ELoggerPrivate;
typedef void (*ELogFunction) (gchar *line, gpointer data);
-enum e_log_level_t {
+typedef enum {
E_LOG_ERROR,
- E_LOG_WARNINGS,
+ E_LOG_WARNING,
E_LOG_DEBUG
-};
+} ELogLevel;
-/* The object */
struct _ELogger {
GObject parent;
-
- struct _ELoggerPrivate *priv;
+ ELoggerPrivate *priv;
};
struct _ELoggerClass {
- GObjectClass popup_class;
+ GObjectClass parent_class;
};
GType e_logger_get_type (void);
-ELogger * e_logger_create (const gchar *component);
-const gchar * e_logger_get_component (ELogger *logger);
+ELogger * e_logger_new (const gchar *name);
+const gchar * e_logger_get_name (ELogger *logger);
void e_logger_log (ELogger *logger,
- gint level,
+ ELogLevel level,
gchar *primary,
gchar *secondary);
void e_logger_get_logs (ELogger *logger,
ELogFunction func,
- gpointer data);
+ gpointer user_data);
G_END_DECLS
-#endif /* __E_LOGGER_H__ */
+#endif /* E_LOGGER_H */
diff --git a/e-util/e-marshal.list b/e-util/e-marshal.list
index 366602491b..d6a3f0cb55 100644
--- a/e-util/e-marshal.list
+++ b/e-util/e-marshal.list
@@ -66,3 +66,5 @@ NONE:STRING,STRING,STRING
NONE:STRING,STRING,UINT
OBJECT:OBJECT,DOUBLE,DOUBLE,BOOLEAN
POINTER:NONE
+STRING:NONE
+
diff --git a/e-util/e-module.c b/e-util/e-module.c
new file mode 100644
index 0000000000..3919841910
--- /dev/null
+++ b/e-util/e-module.c
@@ -0,0 +1,318 @@
+/*
+ * e-module.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-module.h"
+
+#include <glib/gi18n.h>
+
+/* This is the symbol we call when loading a module. */
+#define LOAD_SYMBOL "e_module_load"
+
+/* This is the symbol we call when unloading a module. */
+#define UNLOAD_SYMBOL "e_module_unload"
+
+#define E_MODULE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MODULE, EModulePrivate))
+
+struct _EModulePrivate {
+ GModule *module;
+ gchar *filename;
+
+ void (*load) (GTypeModule *type_module);
+ void (*unload) (GTypeModule *type_module);
+};
+
+enum {
+ PROP_0,
+ PROP_FILENAME
+};
+
+static gpointer parent_class;
+
+static void
+module_set_filename (EModule *module,
+ const gchar *filename)
+{
+ g_return_if_fail (module->priv->filename == NULL);
+
+ module->priv->filename = g_strdup (filename);
+}
+
+static void
+module_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_FILENAME:
+ module_set_filename (
+ E_MODULE (object),
+ g_value_get_string (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+module_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_FILENAME:
+ g_value_set_string (
+ value, e_module_get_filename (
+ E_MODULE (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+module_finalize (GObject *object)
+{
+ EModulePrivate *priv;
+
+ priv = E_MODULE_GET_PRIVATE (object);
+
+ g_free (priv->filename);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gboolean
+module_load (GTypeModule *type_module)
+{
+ EModulePrivate *priv;
+ gpointer symbol;
+
+ priv = E_MODULE_GET_PRIVATE (type_module);
+
+ g_return_val_if_fail (priv->filename != NULL, FALSE);
+ priv->module = g_module_open (priv->filename, 0);
+
+ if (priv->module == NULL)
+ goto fail;
+
+ if (!g_module_symbol (priv->module, LOAD_SYMBOL, &symbol))
+ goto fail;
+
+ priv->load = symbol;
+
+ if (!g_module_symbol (priv->module, UNLOAD_SYMBOL, &symbol))
+ goto fail;
+
+ priv->unload = symbol;
+
+ priv->load (type_module);
+
+ return TRUE;
+
+fail:
+ g_warning ("%s", g_module_error ());
+
+ if (priv->module != NULL)
+ g_module_close (priv->module);
+
+ return FALSE;
+}
+
+static void
+module_unload (GTypeModule *type_module)
+{
+ EModulePrivate *priv;
+
+ priv = E_MODULE_GET_PRIVATE (type_module);
+
+ priv->unload (type_module);
+
+ g_module_close (priv->module);
+ priv->module = NULL;
+
+ priv->load = NULL;
+ priv->unload = NULL;
+}
+
+static void
+module_class_init (EModuleClass *class)
+{
+ GObjectClass *object_class;
+ GTypeModuleClass *type_module_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EModulePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = module_set_property;
+ object_class->get_property = module_get_property;
+ object_class->finalize = module_finalize;
+
+ type_module_class = G_TYPE_MODULE_CLASS (class);
+ type_module_class->load = module_load;
+ type_module_class->unload = module_unload;
+
+ /**
+ * EModule:filename
+ *
+ * The filename of the module.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_FILENAME,
+ g_param_spec_string (
+ "filename",
+ _("Filename"),
+ _("The filename of the module"),
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+module_init (EModule *module)
+{
+ module->priv = E_MODULE_GET_PRIVATE (module);
+}
+
+GType
+e_module_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (EModuleClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) module_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EModule),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) module_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ G_TYPE_TYPE_MODULE, "EModule", &type_info, 0);
+ }
+
+ return type;
+}
+
+/**
+ * e_module_new:
+ * @filename: filename of the shared library module
+ *
+ * Creates a new #EModule that will load the specific shared library
+ * when in use.
+ *
+ * Returns: a new #EModule for @filename
+ **/
+EModule *
+e_module_new (const gchar *filename)
+{
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ return g_object_new (E_TYPE_MODULE, "filename", filename, NULL);
+}
+
+/**
+ * e_module_get_filename:
+ * @module: an #EModule
+ *
+ * Returns the filename of the shared library for @module. The
+ * string is owned by @module and should not be modified or freed.
+ *
+ * Returns: the filename for @module
+ **/
+const gchar *
+e_module_get_filename (EModule *module)
+{
+ g_return_val_if_fail (E_IS_MODULE (module), NULL);
+
+ return module->priv->filename;
+}
+
+/**
+ * e_module_load_all_in_directory:
+ * @dirname: pathname for a directory containing modules to load
+ *
+ * Loads all the modules in the specified directory into memory. If
+ * you want to unload them (enabling on-demand loading) you must call
+ * g_type_module_unuse() on all the modules. Free the returned list
+ * with g_list_free().
+ *
+ * Returns: a list of #EModules loaded from @dirname
+ **/
+GList *
+e_module_load_all_in_directory (const gchar *dirname)
+{
+ GDir *dir;
+ const gchar *basename;
+ GList *loaded_modules = NULL;
+ GError *error = NULL;
+
+ g_return_val_if_fail (dirname != NULL, NULL);
+
+ if (!g_module_supported ())
+ return NULL;
+
+ dir = g_dir_open (dirname, 0, &error);
+ if (dir == NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ return NULL;
+ }
+
+ while ((basename = g_dir_read_name (dir)) != NULL) {
+ EModule *module;
+ gchar *filename;
+
+ if (!g_str_has_suffix (basename, "." G_MODULE_SUFFIX))
+ continue;
+
+ filename = g_build_filename (dirname, basename, NULL);
+
+ module = e_module_new (filename);
+
+ if (!g_type_module_use (G_TYPE_MODULE (module))) {
+ g_printerr ("Failed to load module: %s\n", filename);
+ g_object_unref (module);
+ g_free (filename);
+ continue;
+ }
+
+ g_free (filename);
+
+ loaded_modules = g_list_prepend (loaded_modules, module);
+ }
+
+ g_dir_close (dir);
+
+ return loaded_modules;
+}
diff --git a/e-util/e-module.h b/e-util/e-module.h
new file mode 100644
index 0000000000..a8120563d3
--- /dev/null
+++ b/e-util/e-module.h
@@ -0,0 +1,81 @@
+/*
+ * e-module.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+/**
+ * SECTION: e-module
+ * @short_description: generic module loader
+ * @include: e-util/e-module.h
+ **/
+
+#ifndef E_MODULE_H
+#define E_MODULE_H
+
+#include <gmodule.h>
+#include <glib-object.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MODULE \
+ (e_module_get_type ())
+#define E_MODULE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MODULE, EModule))
+#define E_MODULE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MODULE, EModuleClass))
+#define E_IS_MODULE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MODULE))
+#define E_IS_MODULE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MODULE))
+#define E_MODULE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MODULE, EModuleClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EModule EModule;
+typedef struct _EModuleClass EModuleClass;
+typedef struct _EModulePrivate EModulePrivate;
+
+/**
+ * EModule:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
+struct _EModule {
+ GTypeModule parent;
+ EModulePrivate *priv;
+};
+
+struct _EModuleClass {
+ GTypeModuleClass parent_class;
+};
+
+GType e_module_get_type (void);
+EModule * e_module_new (const gchar *filename);
+const gchar * e_module_get_filename (EModule *module);
+GList * e_module_load_all_in_directory (const gchar *dirname);
+
+G_END_DECLS
+
+#endif /* E_MODULE_H */
diff --git a/e-util/e-non-intrusive-error-dialog.c b/e-util/e-non-intrusive-error-dialog.c
index bb24a2360e..930cd4b814 100644
--- a/e-util/e-non-intrusive-error-dialog.c
+++ b/e-util/e-non-intrusive-error-dialog.c
@@ -305,4 +305,3 @@ eni_show_logger(ELogger *logger, GtkWidget *top,const char *error_timeout_path,
gtk_widget_show_all (window);
}
-
diff --git a/e-util/e-non-intrusive-error-dialog.h b/e-util/e-non-intrusive-error-dialog.h
index 827e17f868..f772a7b6f8 100644
--- a/e-util/e-non-intrusive-error-dialog.h
+++ b/e-util/e-non-intrusive-error-dialog.h
@@ -38,7 +38,7 @@ struct _log_data {
GdkPixbuf *pbuf;
} ldata [] = {
{ E_LOG_ERROR, N_("Error"), N_("Errors"), GTK_STOCK_DIALOG_ERROR },
- { E_LOG_WARNINGS, N_("Warning"), N_("Warnings and Errors"), GTK_STOCK_DIALOG_WARNING },
+ { E_LOG_WARNING, N_("Warning"), N_("Warnings and Errors"), GTK_STOCK_DIALOG_WARNING },
{ E_LOG_DEBUG, N_("Debug"), N_("Error, Warnings and Debug messages"), GTK_STOCK_DIALOG_INFO }
};
diff --git a/e-util/e-plugin-ui.c b/e-util/e-plugin-ui.c
index 840dd67a0e..2331af0f63 100644
--- a/e-util/e-plugin-ui.c
+++ b/e-util/e-plugin-ui.c
@@ -25,7 +25,6 @@
#define E_PLUGIN_UI_INIT_FUNC "e_plugin_ui_init"
#define E_PLUGIN_UI_HOOK_CLASS_ID "org.gnome.evolution.ui:1.0"
-#define E_PLUGIN_UI_MANAGER_ID_KEY "e-plugin-ui-manager-id"
struct _EPluginUIHookPrivate {
@@ -33,9 +32,11 @@ struct _EPluginUIHookPrivate {
*
* For example:
*
- * <ui-manager id="org.gnome.evolution.sample">
- * ... UI definition ...
- * </ui-manager>
+ * <hook class="org.gnome.evolution.ui:1.0">
+ * <ui-manager id="org.gnome.evolution.sample">
+ * ... UI definition ...
+ * </ui-manager>
+ * </hook>
*
* Results in:
*
@@ -49,197 +50,310 @@ struct _EPluginUIHookPrivate {
* optional.
*/
GHashTable *ui_definitions;
+
+ /* The registry is the heart of EPluginUI. It tracks GtkUIManager
+ * instances, GtkUIManager IDs, and UI merge IDs as a hash table of
+ * hash tables:
+ *
+ * GtkUIManager instance -> GtkUIManager ID -> UI Merge ID
+ *
+ * A GtkUIManager instance and ID form a unique key for looking up
+ * UI merge IDs. The reason both are needed is because the same
+ * GtkUIManager instance and be registered under multiple IDs.
+ *
+ * This is done primarily to support shell views, which share a
+ * common GtkUIManager instance for a particular shell window.
+ * Each shell view registers the same GtkUIManager instance under
+ * a unique ID:
+ *
+ * "org.gnome.evolution.mail" }
+ * "org.gnome.evolution.contacts" } aliases for a common
+ * "org.gnome.evolution.calendar" } GtkUIManager instance
+ * "org.gnome.evolution.memos" }
+ * "org.gnome.evolution.tasks" }
+ *
+ * Note: The shell window also registers the same GtkUIManager
+ * instance as "org.gnome.evolution.shell".
+ *
+ * This way, plugins that extend a shell view's UI will follow the
+ * merging and unmerging of the shell view automatically.
+ *
+ * The presence or absence of GtkUIManager IDs in the registry is
+ * significant. Presence of a (instance, ID) pair indicates that
+ * UI manager is active, absence indicates inactive. Furthermore,
+ * a non-zero merge ID for an active UI manager indicates the
+ * plugin is enabled. Zero indicates disabled.
+ *
+ * Here's a quick scenario to illustrate:
+ *
+ * Suppose we have a plugin that extends the mail shell view UI.
+ * Its EPlugin definition file has this section:
+ *
+ * <hook class="org.gnome.evolution.ui:1.0">
+ * <ui-manager id="org.gnome.evolution.mail">
+ * ... UI definition ...
+ * </ui-manager>
+ * </hook>
+ *
+ * The plugin is enabled and the active shell view is "mail".
+ * Let "ManagerA" denote the common GtkUIManager instance for
+ * this shell window. Here's what happens to the registry as
+ * the user performs various actions;
+ *
+ * - Initial State Merge ID
+ * V
+ * { "ManagerA", { "org.gnome.evolution.mail", 3 } }
+ *
+ * - User Disables the Plugin
+ *
+ * { "ManagerA", { "org.gnome.evolution.mail", 0 } }
+ *
+ * - User Enables the Plugin
+ *
+ * { "ManagerA", { "org.gnome.evolution.mail", 4 } }
+ *
+ * - User Switches to Calendar View
+ *
+ * { "ManagerA", { } }
+ *
+ * - User Disables the Plugin
+ *
+ * { "ManagerA", { } }
+ *
+ * - User Switches to Mail View
+ *
+ * { "ManagerA", { "org.gnome.evolution.mail", 0 } }
+ *
+ * - User Enables the Plugin
+ *
+ * { "ManagerA", { "org.gnome.evolution.mail", 5 } }
+ */
+ GHashTable *registry;
};
-/* The registry is a hash table of hash tables. It maps
- *
- * EPluginUIHook instance --> GtkUIManager instance --> UI merge id
- *
- * GtkUIManager instances are automatically removed when finalized.
- */
-static GHashTable *registry;
static gpointer parent_class;
static void
-plugin_ui_registry_remove (EPluginUIHook *hook,
- GtkUIManager *ui_manager)
+plugin_ui_hook_unregister_manager (EPluginUIHook *hook,
+ GtkUIManager *ui_manager)
{
- GHashTable *hash_table;
+ GHashTable *registry;
/* Note: Manager may already be finalized. */
-
- hash_table = g_hash_table_lookup (registry, hook);
- g_return_if_fail (hash_table != NULL);
-
- g_hash_table_remove (hash_table, ui_manager);
- if (g_hash_table_size (hash_table) == 0)
- g_hash_table_remove (registry, hook);
+ registry = hook->priv->registry;
+ g_hash_table_remove (registry, ui_manager);
}
static void
-plugin_ui_registry_insert (EPluginUIHook *hook,
- GtkUIManager *ui_manager,
- guint merge_id)
+plugin_ui_hook_register_manager (EPluginUIHook *hook,
+ GtkUIManager *ui_manager,
+ gpointer user_data)
{
+ EPlugin *plugin;
+ EPluginUIInitFunc func;
+ GHashTable *registry;
GHashTable *hash_table;
- hash_table = g_hash_table_lookup (registry, hook);
- if (hash_table == NULL) {
- hash_table = g_hash_table_new (g_direct_hash, g_direct_equal);
- g_hash_table_insert (registry, hook, hash_table);
- }
+ plugin = ((EPluginHook *) hook)->plugin;
+ func = e_plugin_get_symbol (plugin, E_PLUGIN_UI_INIT_FUNC);
+
+ /* Pass the manager and user_data to the plugin's e_plugin_ui_init()
+ * function (if it defined one). The plugin should install whatever
+ * GtkActions and GtkActionGroups are neccessary to implement the
+ * action names in its UI definition. */
+ if (func != NULL && !func (ui_manager, user_data))
+ return;
g_object_weak_ref (
G_OBJECT (ui_manager), (GWeakNotify)
- plugin_ui_registry_remove, hook);
+ plugin_ui_hook_unregister_manager, hook);
- g_hash_table_insert (
- hash_table, ui_manager, GUINT_TO_POINTER (merge_id));
+ registry = hook->priv->registry;
+ hash_table = g_hash_table_lookup (registry, ui_manager);
+
+ if (hash_table == NULL) {
+ hash_table = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) NULL);
+ g_hash_table_insert (registry, ui_manager, hash_table);
+ }
}
-/* Helper for plugin_ui_hook_merge_ui() */
-static void
-plugin_ui_hook_merge_foreach (GtkUIManager *ui_manager,
- const gchar *ui_definition,
- GHashTable *hash_table)
+static guint
+plugin_ui_hook_merge_ui (EPluginUIHook *hook,
+ GtkUIManager *ui_manager,
+ const gchar *id)
{
+ GHashTable *hash_table;
+ const gchar *ui_definition;
guint merge_id;
GError *error = NULL;
- /* Merge the UI definition into the manager. */
+ hash_table = hook->priv->ui_definitions;
+ ui_definition = g_hash_table_lookup (hash_table, id);
+ g_return_val_if_fail (ui_definition != NULL, 0);
+
merge_id = gtk_ui_manager_add_ui_from_string (
ui_manager, ui_definition, -1, &error);
- gtk_ui_manager_ensure_update (ui_manager);
+
if (error != NULL) {
g_warning ("%s", error->message);
g_error_free (error);
}
- /* Merge ID will be 0 on error, which is what we want. */
- g_hash_table_insert (
- hash_table, ui_manager, GUINT_TO_POINTER (merge_id));
+ return merge_id;
}
static void
-plugin_ui_hook_merge_ui (EPluginUIHook *hook)
+plugin_ui_enable_manager (EPluginUIHook *hook,
+ GtkUIManager *ui_manager,
+ const gchar *id)
{
- GHashTable *old_merge_ids;
- GHashTable *new_merge_ids;
- GHashTable *intermediate;
+ GHashTable *hash_table;
+ GHashTable *ui_definitions;
GList *keys;
- old_merge_ids = g_hash_table_lookup (registry, hook);
- if (old_merge_ids == NULL)
- return;
+ hash_table = hook->priv->registry;
+ hash_table = g_hash_table_lookup (hash_table, ui_manager);
- /* The GtkUIManager instances and UI definitions live in separate
- * tables, so we need to build an intermediate table that we can
- * easily iterate over. */
- keys = g_hash_table_get_keys (old_merge_ids);
- intermediate = g_hash_table_new (g_direct_hash, g_direct_equal);
+ if (hash_table == NULL)
+ return;
- while (keys != NULL) {
- GtkUIManager *ui_manager = keys->data;
- gchar *ui_definition;
+ if (id != NULL)
+ keys = g_list_prepend (NULL, (gpointer) id);
+ else
+ keys = g_hash_table_get_keys (hash_table);
- ui_definition = g_hash_table_lookup (
- hook->priv->ui_definitions,
- e_plugin_ui_get_manager_id (ui_manager));
+ ui_definitions = hook->priv->ui_definitions;
- g_hash_table_insert (intermediate, ui_manager, ui_definition);
+ while (keys != NULL) {
+ guint merge_id;
+ gpointer data;
+ id = keys->data;
keys = g_list_delete_link (keys, keys);
- }
- new_merge_ids = g_hash_table_new (g_direct_hash, g_direct_equal);
+ if (g_hash_table_lookup (ui_definitions, id) == NULL)
+ continue;
+
+ data = g_hash_table_lookup (hash_table, id);
+ merge_id = GPOINTER_TO_UINT (data);
- g_hash_table_foreach (
- intermediate, (GHFunc)
- plugin_ui_hook_merge_foreach, new_merge_ids);
+ if (merge_id > 0)
+ continue;
- g_hash_table_insert (registry, hook, new_merge_ids);
+ if (((EPluginHook *) hook)->plugin->enabled)
+ merge_id = plugin_ui_hook_merge_ui (
+ hook, ui_manager, id);
- g_hash_table_destroy (intermediate);
+ /* Merge ID will be 0 on error, which is what we want. */
+ data = GUINT_TO_POINTER (merge_id);
+ g_hash_table_insert (hash_table, g_strdup (id), data);
+ }
}
-/* Helper for plugin_ui_hook_unmerge_ui() */
static void
-plugin_ui_hook_unmerge_foreach (GtkUIManager *ui_manager,
- gpointer value,
- GHashTable *hash_table)
+plugin_ui_disable_manager (EPluginUIHook *hook,
+ GtkUIManager *ui_manager,
+ const gchar *id,
+ gboolean remove)
{
- guint merge_id;
+ GHashTable *hash_table;
+ GHashTable *ui_definitions;
+ GList *keys;
+
+ hash_table = hook->priv->registry;
+ hash_table = g_hash_table_lookup (hash_table, ui_manager);
+
+ if (hash_table == NULL)
+ return;
+
+ if (id != NULL)
+ keys = g_list_prepend (NULL, (gpointer) id);
+ else
+ keys = g_hash_table_get_keys (hash_table);
+
+ ui_definitions = hook->priv->ui_definitions;
+
+ while (keys != NULL) {
+ guint merge_id;
+ gpointer data;
- merge_id = GPOINTER_TO_UINT (value);
- gtk_ui_manager_remove_ui (ui_manager, merge_id);
+ id = keys->data;
+ keys = g_list_delete_link (keys, keys);
+
+ if (g_hash_table_lookup (ui_definitions, id) == NULL)
+ continue;
- g_hash_table_insert (hash_table, ui_manager, GUINT_TO_POINTER (0));
+ data = g_hash_table_lookup (hash_table, id);
+ merge_id = GPOINTER_TO_UINT (data);
+
+ /* Merge ID could be 0 if the plugin is disabled. */
+ if (merge_id > 0)
+ gtk_ui_manager_remove_ui (ui_manager, merge_id);
+
+ if (remove)
+ g_hash_table_remove (hash_table, id);
+ else
+ g_hash_table_insert (hash_table, g_strdup (id), NULL);
+ }
}
static void
-plugin_ui_hook_unmerge_ui (EPluginUIHook *hook)
+plugin_ui_enable_hook (EPluginUIHook *hook)
{
- GHashTable *old_merge_ids;
- GHashTable *new_merge_ids;
-
- old_merge_ids = g_hash_table_lookup (registry, hook);
- if (old_merge_ids == NULL)
- return;
+ GHashTable *hash_table;
+ GHashTableIter iter;
+ gpointer key;
- new_merge_ids = g_hash_table_new (g_direct_hash, g_direct_equal);
+ /* Enable all GtkUIManagers for this hook. */
- g_hash_table_foreach (
- old_merge_ids, (GHFunc)
- plugin_ui_hook_unmerge_foreach, new_merge_ids);
+ hash_table = hook->priv->registry;
+ g_hash_table_iter_init (&iter, hash_table);
- g_hash_table_insert (registry, hook, new_merge_ids);
+ while (g_hash_table_iter_next (&iter, &key, NULL)) {
+ GtkUIManager *ui_manager = key;
+ plugin_ui_enable_manager (hook, ui_manager, NULL);
+ }
}
static void
-plugin_ui_hook_register_manager (EPluginUIHook *hook,
- GtkUIManager *ui_manager,
- const gchar *ui_definition,
- gpointer user_data)
+plugin_ui_disable_hook (EPluginUIHook *hook)
{
- EPlugin *plugin;
- EPluginUIInitFunc func;
- guint merge_id = 0;
+ GHashTable *hash_table;
+ GHashTableIter iter;
+ gpointer key;
- plugin = ((EPluginHook *) hook)->plugin;
- func = e_plugin_get_symbol (plugin, E_PLUGIN_UI_INIT_FUNC);
+ /* Disable all GtkUIManagers for this hook. */
- /* Pass the manager and user_data to the plugin's e_plugin_ui_init()
- * function (if it defined one). The plugin should install whatever
- * GtkActions and GtkActionGroups are neccessary to implement the
- * action names in its UI definition. */
- if (func != NULL && !func (ui_manager, user_data))
- return;
+ hash_table = hook->priv->registry;
+ g_hash_table_iter_init (&iter, hash_table);
- if (plugin->enabled) {
- GError *error = NULL;
-
- /* Merge the UI definition into the manager. */
- merge_id = gtk_ui_manager_add_ui_from_string (
- ui_manager, ui_definition, -1, &error);
- gtk_ui_manager_ensure_update (ui_manager);
- if (error != NULL) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
+ while (g_hash_table_iter_next (&iter, &key, NULL)) {
+ GtkUIManager *ui_manager = key;
+ plugin_ui_disable_manager (hook, ui_manager, NULL, FALSE);
}
-
- /* Save merge ID's for later use. */
- plugin_ui_registry_insert (hook, ui_manager, merge_id);
}
static void
plugin_ui_hook_finalize (GObject *object)
{
EPluginUIHookPrivate *priv;
+ GHashTableIter iter;
+ gpointer ui_manager;
priv = E_PLUGIN_UI_HOOK_GET_PRIVATE (object);
+ /* Remove weak reference callbacks to GtkUIManagers. */
+ g_hash_table_iter_init (&iter, priv->registry);
+ while (g_hash_table_iter_next (&iter, &ui_manager, NULL))
+ g_object_weak_unref (
+ G_OBJECT (ui_manager), (GWeakNotify)
+ plugin_ui_hook_unregister_manager, object);
+
g_hash_table_destroy (priv->ui_definitions);
+ g_hash_table_destroy (priv->registry);
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
@@ -300,9 +414,9 @@ plugin_ui_hook_enable (EPluginHook *hook,
gint state)
{
if (state)
- plugin_ui_hook_merge_ui (E_PLUGIN_UI_HOOK (hook));
+ plugin_ui_enable_hook (E_PLUGIN_UI_HOOK (hook));
else
- plugin_ui_hook_unmerge_ui (E_PLUGIN_UI_HOOK (hook));
+ plugin_ui_disable_hook (E_PLUGIN_UI_HOOK (hook));
}
static void
@@ -321,25 +435,24 @@ plugin_ui_hook_class_init (EPluginUIHookClass *class)
plugin_hook_class->id = E_PLUGIN_UI_HOOK_CLASS_ID;
plugin_hook_class->construct = plugin_ui_hook_construct;
plugin_hook_class->enable = plugin_ui_hook_enable;
-
- registry = g_hash_table_new_full (
- g_direct_hash, g_direct_equal,
- (GDestroyNotify) NULL,
- (GDestroyNotify) g_hash_table_destroy);
}
static void
plugin_ui_hook_init (EPluginUIHook *hook)
{
GHashTable *ui_definitions;
+ GHashTable *registry;
ui_definitions = g_hash_table_new_full (
g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) g_free);
+ registry = g_hash_table_new (g_direct_hash, g_direct_equal);
+
hook->priv = E_PLUGIN_UI_HOOK_GET_PRIVATE (hook);
hook->priv->ui_definitions = ui_definitions;
+ hook->priv->registry = registry;
}
GType
@@ -369,17 +482,14 @@ e_plugin_ui_hook_get_type (void)
}
void
-e_plugin_ui_register_manager (const gchar *id,
- GtkUIManager *ui_manager,
+e_plugin_ui_register_manager (GtkUIManager *ui_manager,
+ const gchar *id,
gpointer user_data)
{
- const gchar *key = E_PLUGIN_UI_MANAGER_ID_KEY;
GSList *plugin_list;
- g_return_if_fail (id != NULL);
g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager));
-
- g_object_set_data (G_OBJECT (ui_manager), key, (gpointer) id);
+ g_return_if_fail (id != NULL);
/* Loop over all installed plugins. */
plugin_list = e_plugin_list_plugins ();
@@ -387,36 +497,84 @@ e_plugin_ui_register_manager (const gchar *id,
EPlugin *plugin = plugin_list->data;
GSList *iter;
+ plugin_list = g_slist_next (plugin_list);
+
/* Look for hooks of type EPluginUIHook. */
for (iter = plugin->hooks; iter != NULL; iter = iter->next) {
EPluginUIHook *hook = iter->data;
- const gchar *ui_definition;
+ GHashTable *hash_table;
if (!E_IS_PLUGIN_UI_HOOK (hook))
continue;
+ hash_table = hook->priv->ui_definitions;
+
/* Check if the hook has a UI definition
* for the GtkUIManager being registered. */
- ui_definition = g_hash_table_lookup (
- hook->priv->ui_definitions, id);
- if (ui_definition == NULL)
+ if (g_hash_table_lookup (hash_table, id) == NULL)
continue;
/* Register the manager with the hook. */
plugin_ui_hook_register_manager (
- hook, ui_manager, ui_definition, user_data);
+ hook, ui_manager, user_data);
}
+ }
+}
+
+void
+e_plugin_ui_enable_manager (GtkUIManager *ui_manager,
+ const gchar *id)
+{
+ GSList *plugin_list;
+
+ g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager));
+ g_return_if_fail (id != NULL);
+
+ /* Loop over all installed plugins. */
+ plugin_list = e_plugin_list_plugins ();
+ while (plugin_list != NULL) {
+ EPlugin *plugin = plugin_list->data;
+ GSList *iter;
plugin_list = g_slist_next (plugin_list);
+
+ /* Look for hooks of type EPluginUIHook. */
+ for (iter = plugin->hooks; iter != NULL; iter = iter->next) {
+ EPluginUIHook *hook = iter->data;
+
+ if (!E_IS_PLUGIN_UI_HOOK (hook))
+ continue;
+
+ plugin_ui_enable_manager (hook, ui_manager, id);
+ }
}
}
-const gchar *
-e_plugin_ui_get_manager_id (GtkUIManager *ui_manager)
+void
+e_plugin_ui_disable_manager (GtkUIManager *ui_manager,
+ const gchar *id)
{
- const gchar *key = E_PLUGIN_UI_MANAGER_ID_KEY;
+ GSList *plugin_list;
+
+ g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager));
+ g_return_if_fail (id != NULL);
+
+ /* Loop over all installed plugins. */
+ plugin_list = e_plugin_list_plugins ();
+ while (plugin_list != NULL) {
+ EPlugin *plugin = plugin_list->data;
+ GSList *iter;
- g_return_val_if_fail (GTK_IS_UI_MANAGER (ui_manager), NULL);
+ plugin_list = g_slist_next (plugin_list);
+
+ /* Look for hooks of type EPluginUIHook. */
+ for (iter = plugin->hooks; iter != NULL; iter = iter->next) {
+ EPluginUIHook *hook = iter->data;
- return g_object_get_data (G_OBJECT (ui_manager), key);
+ if (!E_IS_PLUGIN_UI_HOOK (hook))
+ continue;
+
+ plugin_ui_disable_manager (hook, ui_manager, id, TRUE);
+ }
+ }
}
diff --git a/e-util/e-plugin-ui.h b/e-util/e-plugin-ui.h
index cdefda5617..c9bddafb64 100644
--- a/e-util/e-plugin-ui.h
+++ b/e-util/e-plugin-ui.h
@@ -62,10 +62,13 @@ typedef gboolean (*EPluginUIInitFunc) (GtkUIManager *ui_manager,
GType e_plugin_ui_hook_get_type (void);
-void e_plugin_ui_register_manager (const gchar *id,
- GtkUIManager *ui_manager,
+void e_plugin_ui_register_manager (GtkUIManager *ui_manager,
+ const gchar *id,
gpointer user_data);
-const gchar * e_plugin_ui_get_manager_id (GtkUIManager *ui_manager);
+void e_plugin_ui_enable_manager (GtkUIManager *ui_manager,
+ const gchar *id);
+void e_plugin_ui_disable_manager (GtkUIManager *ui_manager,
+ const gchar *id);
G_END_DECLS
diff --git a/e-util/e-signature-utils.c b/e-util/e-signature-utils.c
new file mode 100644
index 0000000000..1321fc59e1
--- /dev/null
+++ b/e-util/e-signature-utils.c
@@ -0,0 +1,347 @@
+/*
+ * e-signature-utils.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ */
+
+#include "e-signature-utils.h"
+
+#include <errno.h>
+#include <glib/gstdio.h>
+#include <gconf/gconf-client.h>
+#include <camel/camel-stream.h>
+#include <camel/camel-stream-fs.h>
+#include <camel/camel-stream-mem.h>
+#include <camel/camel-stream-filter.h>
+#include <camel/camel-mime-filter-charset.h>
+#include <camel/camel-mime-filter-tohtml.h>
+
+#ifndef G_OS_WIN32
+#include <sys/wait.h>
+#endif
+
+#include "e-util/e-util.h"
+
+static ESignatureList *global_signature_list;
+
+ESignatureList *
+e_get_signature_list (void)
+{
+ if (G_UNLIKELY (global_signature_list == NULL)) {
+ GConfClient *client;
+
+ client = gconf_client_get_default ();
+ global_signature_list = e_signature_list_new (client);
+ g_object_unref (client);
+ }
+
+ g_return_val_if_fail (global_signature_list != NULL, NULL);
+
+ return global_signature_list;
+}
+
+ESignature *
+e_get_signature_by_name (const gchar *name)
+{
+ ESignatureList *signature_list;
+ const ESignature *signature;
+ e_signature_find_t find;
+
+ g_return_val_if_fail (name != NULL, NULL);
+
+ find = E_SIGNATURE_FIND_NAME;
+ signature_list = e_get_signature_list ();
+ signature = e_signature_list_find (signature_list, find, name);
+
+ /* XXX ESignatureList misuses const. */
+ return (ESignature *) signature;
+}
+
+ESignature *
+e_get_signature_by_uid (const gchar *uid)
+{
+ ESignatureList *signature_list;
+ const ESignature *signature;
+ e_signature_find_t find;
+
+ g_return_val_if_fail (uid != NULL, NULL);
+
+ find = E_SIGNATURE_FIND_UID;
+ signature_list = e_get_signature_list ();
+ signature = e_signature_list_find (signature_list, find, uid);
+
+ /* XXX ESignatureList misuses const. */
+ return (ESignature *) signature;
+}
+
+gchar *
+e_create_signature_file (GError **error)
+{
+ const gchar *data_dir;
+ gchar basename[32];
+ gchar *filename;
+ gchar *pathname;
+ gint32 ii;
+
+ data_dir = e_get_user_data_dir ();
+ pathname = g_build_filename (data_dir, "signatures", NULL);
+ filename = NULL;
+
+ if (g_mkdir_with_parents (pathname, 0700) < 0) {
+ g_set_error (
+ error, G_FILE_ERROR,
+ g_file_error_from_errno (errno),
+ "%s: %s", pathname, g_strerror (errno));
+ g_free (pathname);
+ return NULL;
+ }
+
+ for (ii = 0; ii < G_MAXINT32; ii++) {
+
+ g_snprintf (
+ basename, sizeof (basename),
+ "signature-%" G_GINT32_FORMAT, ii);
+
+ g_free (filename);
+ filename = g_build_filename (pathname, basename, NULL);
+
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ gint fd;
+
+ fd = g_creat (filename, 0600);
+ if (fd >= 0) {
+ close (fd);
+ break;
+ }
+
+ /* If we failed once we're probably going
+ * to continue failing, so just give up. */
+ g_set_error (
+ error, G_FILE_ERROR,
+ g_file_error_from_errno (errno),
+ "%s: %s", filename, g_strerror (errno));
+ g_free (filename);
+ filename = NULL;
+ break;
+ }
+ }
+
+ /* If there are actually G_MAXINT32 signature files, the
+ * most recent signature file we be overwritten. Sorry. */
+
+ return filename;
+}
+
+gchar *
+e_read_signature_file (ESignature *signature,
+ gboolean convert_to_html,
+ GError **error)
+{
+ CamelStream *input_stream;
+ CamelStream *output_stream;
+ GByteArray *buffer;
+ gchar *content;
+ gsize length;
+ gint fd;
+
+ g_return_val_if_fail (E_IS_SIGNATURE (signature), NULL);
+
+ fd = g_open (signature->filename, O_RDONLY, 0);
+ if (fd < 0) {
+ g_set_error (
+ error, G_FILE_ERROR,
+ g_file_error_from_errno (errno),
+ "%s: %s", signature->filename,
+ g_strerror (errno));
+ return NULL;
+ }
+
+ input_stream = camel_stream_fs_new_with_fd (fd);
+
+ if (!signature->html && convert_to_html) {
+ CamelStreamFilter *filtered_stream;
+ CamelMimeFilter *filter;
+ gint32 flags;
+
+ filtered_stream =
+ camel_stream_filter_new_with_stream (input_stream);
+ camel_object_unref (input_stream);
+
+ flags =
+ CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES;
+ filter = camel_mime_filter_tohtml_new (flags, 0);
+ camel_stream_filter_add (filtered_stream, filter);
+ camel_object_unref (filter);
+
+ input_stream = (CamelStream *) filtered_stream;
+ }
+
+ buffer = g_byte_array_new ();
+ output_stream = camel_stream_mem_new ();
+ camel_stream_mem_set_byte_array (
+ CAMEL_STREAM_MEM (output_stream), buffer);
+ camel_stream_write_to_stream (input_stream, output_stream);
+ camel_object_unref (output_stream);
+ camel_object_unref (input_stream);
+
+ /* Make sure the buffer is nul-terminated. */
+ length = (gsize) buffer->len;
+ g_byte_array_append (buffer, (guint8 *) "", 1);
+ content = (gchar *) g_byte_array_free (buffer, FALSE);
+
+ /* Signatures are saved as UTF-8, but we still need to check that
+ * the signature is valid UTF-8 because the user may be opening
+ * a signature file that is in his/her locale character set. If
+ * it's not in UTF-8 then try converting from the current locale. */
+ if (!g_utf8_validate (content, length, NULL)) {
+ gchar *utf8;
+
+ utf8 = g_locale_to_utf8 (content, length, NULL, NULL, error);
+ g_free (content);
+ content = utf8;
+ }
+
+ return content;
+}
+
+gchar *
+e_run_signature_script (const gchar *filename)
+{
+ /* FIXME Make this cross-platform, prefer GLib functions over
+ * POSIX, and report errors via GError instead of dumping
+ * messages to the terminal where users won't see them. */
+
+#ifndef G_OS_WIN32
+ gint in_fds[2];
+ pid_t pid;
+
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ if (pipe (in_fds) == -1) {
+ g_warning (
+ "Failed to create pipe to '%s': %s",
+ filename, g_strerror (errno));
+ return NULL;
+ }
+
+ pid = fork ();
+
+ /* Child Process */
+ if (pid == 0) {
+ gint maxfd, ii;
+
+ close (in_fds[0]);
+ if (dup2 (in_fds[1], STDOUT_FILENO) < 0)
+ _exit (255);
+ close (in_fds[1]);
+
+ setsid ();
+
+ maxfd = sysconf (_SC_OPEN_MAX);
+ for (ii = 3; ii < maxfd; ii++) {
+ if (ii == STDIN_FILENO)
+ continue;
+ if (ii == STDOUT_FILENO)
+ continue;
+ if (ii == STDERR_FILENO)
+ continue;
+ fcntl (ii, F_SETFD, FD_CLOEXEC);
+ }
+
+ execlp ("/bin/sh", "/bin/sh", "-c", filename, NULL);
+
+ g_warning (
+ "Could not execute '%s': %s",
+ filename, g_strerror (errno));
+
+ _exit (255);
+
+ /* Parent Process */
+ } else if (pid > 0) {
+ CamelStream *output_stream;
+ CamelStream *input_stream;
+ GByteArray *buffer;
+ gchar *content;
+ gsize length;
+ gint result;
+ gint status;
+
+ close (in_fds[1]);
+
+ buffer = g_byte_array_new ();
+ output_stream = camel_stream_mem_new ();
+ camel_stream_mem_set_byte_array (
+ CAMEL_STREAM_MEM (output_stream), buffer);
+
+ input_stream = camel_stream_fs_new_with_fd (in_fds[0]);
+ camel_stream_write_to_stream (input_stream, output_stream);
+ camel_object_unref (input_stream);
+
+ camel_object_unref (output_stream);
+
+ /* Make sure the buffer is nul-terminated. */
+ length = (gsize) buffer->len;
+ g_byte_array_append (buffer, (guchar *) "", 1);
+ content = (gchar *) g_byte_array_free (buffer, FALSE);
+
+ /* Signature scripts are supposed to generate UTF-8 content,
+ * but because users are known to never read the manual, we
+ * try to do our best if the content isn't valid UTF-8 by
+ * assuming that the content is in the user's locale
+ * character set. */
+ if (!g_utf8_validate (content, length, NULL)) {
+ gchar *utf8;
+
+ /* XXX Should pass a GError here. */
+ utf8 = g_locale_to_utf8 (
+ content, length, NULL, NULL, NULL);
+ g_free (content);
+ content = utf8;
+ }
+
+ /* Wait for the script process to terminate. */
+ result = waitpid (pid, &status, 0);
+
+ if (result == -1 && errno == EINTR) {
+ /* Child process is hanging... */
+ kill (pid, SIGTERM);
+ sleep (1);
+ result = waitpid (pid, &status, WNOHANG);
+ if (result == 0) {
+ /* ...still hanging, set phasers to KILL. */
+ kill (pid, SIGKILL);
+ sleep (1);
+ result = waitpid (pid, &status, WNOHANG);
+ }
+ }
+
+ return content;
+
+ /* Forking Failed */
+ } else {
+ g_warning (
+ "Failed to create child process '%s': %s",
+ filename, g_strerror (errno));
+ close (in_fds[0]);
+ close (in_fds[1]);
+ }
+#endif
+
+ return NULL;
+}
diff --git a/mail/mail-config-factory.h b/e-util/e-signature-utils.h
index 430058364e..56f8564131 100644
--- a/mail/mail-config-factory.h
+++ b/e-util/e-signature-utils.h
@@ -1,4 +1,6 @@
/*
+ * e-signature-utils.h
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -12,33 +14,27 @@
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
- *
- * Authors:
- * Jeffrey Stedfast <fejj@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
*/
-#ifndef __MAIL_CONFIG_FACTORY_H__
-#define __MAIL_CONFIG_FACTORY_H__
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#include <bonobo/bonobo-generic-factory.h>
-#include "evolution-config-control.h"
+#ifndef E_SIGNATURE_UTILS_H
+#define E_SIGNATURE_UTILS_H
-#include <shell/Evolution.h>
+#include <gtk/gtk.h>
+#include <e-util/e-signature.h>
+#include <e-util/e-signature-list.h>
-gboolean mail_config_register_factory (GNOME_Evolution_Shell shell);
+G_BEGIN_DECLS
-BonoboObject *mail_config_control_factory_cb (BonoboGenericFactory *factory, const char *component_id, void *user_data);
+ESignatureList *e_get_signature_list (void);
+ESignature * e_get_signature_by_name (const gchar *name);
+ESignature * e_get_signature_by_uid (const gchar *uid);
+gchar * e_create_signature_file (GError **error);
+gchar * e_read_signature_file (ESignature *signature,
+ gboolean convert_to_html,
+ GError **error);
+gchar * e_run_signature_script (const gchar *filename);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
-#endif /* __MAIL_CONFIG_FACTORY_H__ */
+#endif /* E_SIGNATURE_UTILS_H */
diff --git a/widgets/misc/e-unicode.c b/e-util/e-unicode.c
index 2769001120..2769001120 100644
--- a/widgets/misc/e-unicode.c
+++ b/e-util/e-unicode.c
diff --git a/widgets/misc/e-unicode.h b/e-util/e-unicode.h
index 77d1a351cb..77d1a351cb 100644
--- a/widgets/misc/e-unicode.h
+++ b/e-util/e-unicode.h
diff --git a/e-util/e-util-labels.c b/e-util/e-util-labels.c
deleted file mode 100644
index ba1d0113a0..0000000000
--- a/e-util/e-util-labels.c
+++ /dev/null
@@ -1,592 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-#include <stdio.h>
-#include <string.h>
-
-#include <gconf/gconf-client.h>
-
-#include <camel/camel-utf8.h>
-
-#include "e-util.h"
-#include "e-util-labels.h"
-#include "e-dialog-utils.h"
-#include "filter/filter-option.h"
-
-typedef struct {
- const gchar *tag;
- const gchar *name;
- const gchar *colour;
-} DefaultLabel;
-
-/* Note, the first element of each DefaultLabel must NOT be translated */
-DefaultLabel label_defaults[] = {
- { "$Labelimportant", N_("I_mportant"), "#EF2929" }, /* red */
- { "$Labelwork", N_("_Work"), "#F57900" }, /* orange */
- { "$Labelpersonal", N_("_Personal"), "#4E9A06" }, /* green */
- { "$Labeltodo", N_("_To Do"), "#3465A4" }, /* blue */
- { "$Labellater", N_("_Later"), "#75507B" } /* purple */
-};
-
-/**
- * e_util_labels_parse
- * Reads the setup from client and parses it to list of EUtilLabel objects.
- *
- * @param client The config client to be used for reading setup.
- * Can be NULL, in that case it will use the default client.
- * @return Newly allocated list of labels, should be freed with @ref e_util_labels_free.
- **/
-GSList *
-e_util_labels_parse (GConfClient *client)
-{
- GSList *labels, *list, *head;
- EUtilLabel *label;
- char *buf;
- int num = 0;
- gboolean unref_client = client == NULL;
-
- labels = NULL;
-
- if (!client)
- client = gconf_client_get_default ();
-
- head = gconf_client_get_list (client, E_UTIL_LABELS_GCONF_KEY, GCONF_VALUE_STRING, NULL);
-
- for (list = head; list; list = list->next) {
- char *color, *name, *tag;
- name = buf = list->data;
- color = strrchr (buf, ':');
- if (color == NULL) {
- g_free (buf);
- continue;
- }
-
- *color++ = '\0';
- tag = strchr (color, '|');
- if (tag)
- *tag++ = '\0';
-
- label = g_new (EUtilLabel, 1);
-
- /* Needed for Backward Compatibility */
- if (num < G_N_ELEMENTS (label_defaults)) {
- label->name = g_strdup ((buf && *buf) ? buf : _(label_defaults[num].name));
- label->tag = g_strdup (label_defaults[num].tag);
- num++;
- } else if (!tag) {
- g_free (buf);
- g_free (label);
- continue;
- } else {
- label->name = g_strdup (name);
- label->tag = g_strdup (tag);
- }
-
- label->colour = g_strdup (color);
- labels = g_slist_prepend (labels, label);
-
- g_free (buf);
- }
-
- if (head)
- g_slist_free (head);
-
- while (num < G_N_ELEMENTS (label_defaults)) {
- /* complete the list with defaults */
- label = g_new (EUtilLabel, 1);
- label->tag = g_strdup (label_defaults[num].tag);
- label->name = g_strdup (_(label_defaults[num].name));
- label->colour = g_strdup (label_defaults[num].colour);
-
- labels = g_slist_prepend (labels, label);
-
- num++;
- }
-
- if (unref_client)
- g_object_unref (client);
-
- return g_slist_reverse (labels);
-}
-
-static void
-free_label_struct (EUtilLabel *label)
-{
- if (!label)
- return;
-
- g_free (label->tag);
- g_free (label->name);
- g_free (label->colour);
- g_free (label);
-}
-
-/**
- * e_util_labels_free
- * Frees memory previously allocated by @ref e_util_labels_parse
- *
- * @param labels Labels list, previously allocated by @ref e_util_labels_parse
- * It is safe to call with NULL.
- **/
-void
-e_util_labels_free (GSList *labels)
-{
- if (!labels)
- return;
-
- g_slist_foreach (labels, (GFunc)free_label_struct, NULL);
- g_slist_free (labels);
-}
-
-/* stores the actual cache to gconf */
-static gboolean
-flush_labels_cache (GSList *labels, gboolean free_labels)
-{
- GSList *l, *text_labels;
- GConfClient *client;
-
- if (!labels)
- return FALSE;
-
- text_labels = NULL;
-
- for (l = labels; l; l = l->next) {
- EUtilLabel *label = l->data;
-
- if (label && label->tag && label->name && label->colour)
- text_labels = g_slist_prepend (text_labels, g_strdup_printf ("%s:%s|%s", label->name, label->colour, label->tag));
- }
-
- if (!text_labels) {
- if (free_labels)
- e_util_labels_free (labels);
-
- return FALSE;
- }
-
- text_labels = g_slist_reverse (text_labels);
-
- client = gconf_client_get_default ();
- gconf_client_set_list (client, E_UTIL_LABELS_GCONF_KEY, GCONF_VALUE_STRING, text_labels, NULL);
- g_object_unref (client);
-
- g_slist_foreach (text_labels, (GFunc)g_free, NULL);
- g_slist_free (text_labels);
-
- if (free_labels)
- e_util_labels_free (labels);
-
- /* not true if gconf failed to write; who cares */
- return TRUE;
-}
-
-/**
- * find_label
- *
- * Looks for label in labels cache by tag and returns actual pointer to cache.
- * @param labels The cache of labels; comes from @ref e_util_labels_parse
- * @param tag Tag of label you are looking for.
- * @return Pointer to cache data if label with such tag exists or NULL. Do not free it!
- **/
-static EUtilLabel *
-find_label (GSList *labels, const char *tag)
-{
- GSList *l;
-
- g_return_val_if_fail (tag != NULL, NULL);
-
- for (l = labels; l; l = l->next) {
- EUtilLabel *label = l->data;
-
- if (label && label->tag && !strcmp (tag, label->tag))
- return label;
- }
-
- return NULL;
-}
-
-
-static char *
-tag_from_name (const char *name)
-{
- /* this does thunderbird, just do not ask */
- char *s1, *s2, *p;
- const char *bads = " ()/{%*<>\\\"";
-
- if (!name || !*name)
- return NULL;
-
- s1 = g_strdup (name);
- for (p = s1; p && *p; p++) {
- if (strchr (bads, *p))
- *p = '_';
- }
-
- s2 = camel_utf8_utf7 (s1);
- g_free (s1);
-
- s1 = g_ascii_strdown (s2, -1);
- g_free (s2);
-
- return s1;
-}
-
-/**
- * e_util_labels_add
- * Creates new label at the end of actual list of labels.
- *
- * @param name User readable name of this label. Should not be NULL.
- * @param color Color assigned to this label. Should not be NULL.
- * @return If succeeded then new label tag, NULL otherwise.
- * Returned pointer should be freed with g_free.
- * It will return NULL when the tag will be same as already existed.
- * Tag name is generated in similar way as in Thunderbird.
- **/
-char *
-e_util_labels_add (const char *name, const GdkColor *color)
-{
- EUtilLabel *label;
- GSList *labels;
- char *tag;
-
- g_return_val_if_fail (name != NULL, NULL);
- g_return_val_if_fail (color != NULL, NULL);
-
- labels = e_util_labels_parse (NULL);
- tag = tag_from_name (name);
-
- if (!tag || find_label (labels, tag) != NULL) {
- g_free (tag);
- e_util_labels_free (labels);
- return NULL;
- }
-
- label = g_new0 (EUtilLabel, 1);
- label->tag = g_strdup (tag);
- label->name = g_strdup (name);
- label->colour = gdk_color_to_string (color);
-
- labels = g_slist_append (labels, label);
-
- flush_labels_cache (labels, TRUE);
-
- return tag;
-}
-
-/**
- * e_util_labels_add_with_dlg
- * This will open a dialog to add or edit label.
- *
- * @param parent Parent widget for the dialog.
- * @param tag A tag for existing label to edit or NULL to add new label.
- * @return Tag for newly added label or NULL, if something failed.
- * Returned value should be freed with g_free.
- **/
-char *
-e_util_labels_add_with_dlg (GtkWindow *parent, const char *tag)
-{
- GtkWidget *table, *dialog, *l, *e, *c;
- const char *name;
- GdkColor color;
- gboolean is_edit = FALSE;
- char *new_tag = NULL;
- GSList *labels;
-
- table = gtk_table_new (2, 2, FALSE);
-
- labels = e_util_labels_parse (NULL);
- name = tag ? e_util_labels_get_name (labels, tag) : NULL;
-
- l = gtk_label_new_with_mnemonic (_("Label _Name:"));
- e = gtk_entry_new ();
- c = gtk_color_button_new ();
-
- if (!tag || !e_util_labels_get_color (labels, tag, &color))
- memset (&color, 0xCD, sizeof (GdkColor));
- else
- is_edit = TRUE;
-
- if (name)
- gtk_entry_set_text (GTK_ENTRY (e), name);
-
- gtk_entry_set_activates_default (GTK_ENTRY (e), TRUE);
- gtk_label_set_mnemonic_widget (GTK_LABEL (l), e);
- gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.0);
- gtk_color_button_set_color (GTK_COLOR_BUTTON (c), &color);
-
- gtk_table_attach (GTK_TABLE (table), l, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (table), e, 0, 1, 1, 2, 0, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (table), c, 1, 2, 1, 2, 0, 0, 0, 0);
- gtk_container_set_border_width (GTK_CONTAINER (table), 10);
- gtk_widget_show_all (table);
-
- dialog = gtk_dialog_new_with_buttons (is_edit ? _("Edit Label") : _("Add Label"),
- parent,
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
- GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
- NULL);
-
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table, TRUE, TRUE, 0);
-
- while (!new_tag) {
- const char *error = NULL;
-
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
- name = gtk_entry_get_text (GTK_ENTRY (e));
- gtk_color_button_get_color (GTK_COLOR_BUTTON (c), &color);
-
- if (!name || !*name)
- error = _("Label name cannot be empty.");
- else if (is_edit) {
- e_util_labels_set_data (tag, name, &color);
- break;
- } else if (!(new_tag = e_util_labels_add (name, &color)))
- error = _("A label having the same tag already exists on the server. Please rename your label.");
- else
- break;
- } else
- break;
-
- if (error)
- e_notice (parent, GTK_MESSAGE_ERROR, error);
- }
-
- gtk_widget_destroy (dialog);
- e_util_labels_free (labels);
-
- return new_tag;
-}
-
-/**
- * e_util_labels_remove
- *
- * @param tag Tag of the label to remove.
- * @return Whether was removed.
- **/
-gboolean
-e_util_labels_remove (const char *tag)
-{
- EUtilLabel *label;
- GSList *labels;
-
- g_return_val_if_fail (tag != NULL, FALSE);
-
- labels = e_util_labels_parse (NULL);
- label = find_label (labels, tag);
-
- if (!label) {
- e_util_labels_free (labels);
- return FALSE;
- }
-
- labels = g_slist_remove (labels, label);
-
- free_label_struct (label);
-
- return flush_labels_cache (labels, TRUE);
-}
-
-/**
- * e_util_labels_set_data
- *
- * @param tag Tag of the label of our interest.
- * @param name New name for the label.
- * @param color New color for the label.
- * @return Whether successfully saved.
- **/
-gboolean
-e_util_labels_set_data (const char *tag, const char *name, const GdkColor *color)
-{
- EUtilLabel *label;
- GSList *labels;
-
- g_return_val_if_fail (tag != NULL, FALSE);
- g_return_val_if_fail (name != NULL, FALSE);
- g_return_val_if_fail (color != NULL, FALSE);
-
- labels = e_util_labels_parse (NULL);
- label = find_label (labels, tag);
-
- if (!label) {
- e_util_labels_free (labels);
- return FALSE;
- }
-
- g_free (label->name);
- label->name = g_strdup (name);
-
- g_free (label->colour);
- label->colour = gdk_color_to_string (color);
-
- return flush_labels_cache (labels, TRUE);
-}
-
-/**
- * e_util_labels_is_system
- *
- * @return Whether the tag is one of default/system labels or not.
- **/
-gboolean
-e_util_labels_is_system (const char *tag)
-{
- int i;
-
- if (!tag)
- return FALSE;
-
- for (i = 0; i < G_N_ELEMENTS (label_defaults); i++) {
- if (strcmp (tag, label_defaults[i].tag) == 0)
- return TRUE;
- }
-
- return FALSE;
-}
-
-/**
- * e_util_labels_get_new_tag
- *
- * @param old_tag Tag of the label from old version of Evolution.
- * @return New tag name equivalent with the old tag, or NULL if no such name existed before.
- **/
-const char *
-e_util_labels_get_new_tag (const char *old_tag)
-{
- int i;
-
- if (!old_tag)
- return NULL;
-
- for (i = 0; i < G_N_ELEMENTS (label_defaults); i++) {
- /* default labels have same name as those old, only with prefix "$Label" */
- if (!strcmp (old_tag, label_defaults[i].tag + 6))
- return label_defaults[i].tag;
- }
-
- return NULL;
-}
-
-/**
- * e_util_labels_get_name
- *
- * @param labels Cache of labels from call of @ref e_util_labels_parse.
- * The returned pointer will be taken from this list, so it's alive as long as the list.
- * @param tag Tag of the label of our interest.
- * @return Name of the label with that tag or NULL, if no such label exists.
- **/
-const char *
-e_util_labels_get_name (GSList *labels, const char *tag)
-{
- EUtilLabel *label;
-
- g_return_val_if_fail (tag != NULL, NULL);
-
- label = find_label (labels, tag);
- if (!label)
- return NULL;
-
- return label->name;
-}
-
-/**
- * e_util_labels_get_color
- *
- * @param labels Cache of labels from call of @ref e_util_labels_parse.
- * @param tag Tag of the label of our interest.
- * @param color [out] Actual color of the label with that tag, or unchanged if failed.
- * @return Whether found such label and color has been set.
- **/
-gboolean
-e_util_labels_get_color (GSList *labels, const char *tag, GdkColor *color)
-{
- EUtilLabel *label;
-
- g_return_val_if_fail (tag != NULL, FALSE);
- g_return_val_if_fail (color != NULL, FALSE);
-
- label = find_label (labels, tag);
- if (!label)
- return FALSE;
-
- return gdk_color_parse (label->colour, color);
-}
-
-/**
- * e_util_labels_get_color_str
- *
- * @param labels Cache of labels from call of @ref e_util_labels_parse.
- * The returned pointer will be taken from this list, so it's alive as long as the list.
- * @param tag Tag of the label of our interest.
- * @return String representation of that label, or NULL, is no such label exists.
- **/
-const char *
-e_util_labels_get_color_str (GSList *labels, const char *tag)
-{
- EUtilLabel *label;
-
- g_return_val_if_fail (tag != NULL, FALSE);
-
- label = find_label (labels, tag);
- if (!label)
- return FALSE;
-
- return label->colour;
-}
-
-/**
- * e_util_labels_get_filter_options:
- * Returns list of newly allocated struct _filter_option-s, to be used in filters.
- **/
-GSList *
-e_util_labels_get_filter_options (void)
-{
- GSList *known = e_util_labels_parse (NULL), *l;
- GSList *res = NULL;
-
- for (l = known; l; l = l->next) {
- EUtilLabel *label = l->data;
- const char *tag;
- struct _filter_option *fo;
-
- if (!label)
- continue;
-
- tag = label->tag;
-
- if (tag && strncmp (tag, "$Label", 6) == 0)
- tag += 6;
-
- fo = g_new0 (struct _filter_option, 1);
- fo->title = e_str_without_underscores (label->name);
- fo->value = g_strdup (tag);
-
- res = g_slist_prepend (res, fo);
- }
-
- e_util_labels_free (known);
-
- return g_slist_reverse (res);
-}
diff --git a/e-util/e-util-labels.h b/e-util/e-util-labels.h
deleted file mode 100644
index 725f740d89..0000000000
--- a/e-util/e-util-labels.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_UTIL_LABELS_H
-#define _E_UTIL_LABELS_H
-
-#include <gtk/gtk.h>
-
-struct _GtkWindow;
-struct _GConfClient;
-
-typedef struct {
- gchar *tag;
- gchar *name;
- gchar *colour;
-} EUtilLabel;
-
-#define E_UTIL_LABELS_GCONF_KEY "/apps/evolution/mail/labels"
-
-GSList * e_util_labels_parse (struct _GConfClient *client);
-void e_util_labels_free (GSList *labels);
-
-char * e_util_labels_add (const char *name, const GdkColor *color);
-char * e_util_labels_add_with_dlg (struct _GtkWindow *parent, const char *tag);
-gboolean e_util_labels_remove (const char *tag);
-gboolean e_util_labels_set_data (const char *tag, const char *name, const GdkColor *color);
-
-gboolean e_util_labels_is_system (const char *tag);
-const char *e_util_labels_get_new_tag (const char *old_tag);
-
-const char *e_util_labels_get_name (GSList *labels, const char *tag);
-gboolean e_util_labels_get_color (GSList *labels, const char *tag, GdkColor *color);
-const char *e_util_labels_get_color_str (GSList *labels, const char *tag);
-
-GSList * e_util_labels_get_filter_options (void);
-
-#endif /* _E_UTIL_LABELS_H */
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 533dc2d740..86589858af 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -521,6 +521,30 @@ e_write_file_uri (const gchar *filename, const gchar *data)
return res;
}
+/**
+ * e_color_to_value:
+ * color: a #GdkColor
+ *
+ * Converts a #GdkColor to a 24-bit RGB color value.
+ *
+ * Returns: a 24-bit color value
+ **/
+guint32
+e_color_to_value (GdkColor *color)
+{
+ guint16 red;
+ guint16 green;
+ guint16 blue;
+
+ g_return_val_if_fail (color != NULL, 0);
+
+ red = color->red >> 8;
+ green = color->green >> 8;
+ blue = color->blue >> 8;
+
+ return (guint32) (((red << 16) | (green << 8) | blue) & 0xffffff);
+}
+
static gint
epow10 (gint number)
{
@@ -1495,7 +1519,7 @@ e_util_get_category_filter_options (void)
clist = e_categories_get_list ();
for (l = clist; l; l = l->next) {
- const char *cname = l->data;
+ const gchar *cname = l->data;
struct _filter_option *fo = g_new0 (struct _filter_option, 1);
fo->title = g_strdup (cname);
diff --git a/e-util/e-util.h b/e-util/e-util.h
index e5126213f3..940cfc470f 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -69,6 +69,7 @@ gint e_int_compare (gconstpointer x,
gconstpointer y);
gboolean e_write_file_uri (const gchar *filename,
const gchar *data);
+guint32 e_color_to_value (GdkColor *color);
/* This only makes a filename safe for usage as a filename.
* It still may have shell meta-characters in it. */
@@ -129,7 +130,8 @@ gboolean e_file_lock_create (void);
void e_file_lock_destroy (void);
gboolean e_file_lock_exists (void);
-gchar * e_util_guess_mime_type (const gchar *filename, gboolean localfile);
+gchar * e_util_guess_mime_type (const gchar *filename,
+ gboolean localfile);
gchar * e_util_filename_to_uri (const gchar *filename);
gchar * e_util_uri_to_filename (const gchar *uri);
@@ -138,8 +140,8 @@ gboolean e_util_read_file (const gchar *filename,
gchar **buffer,
gsize *read,
GError **error);
-
-GSList *e_util_get_category_filter_options (void);
+GSList * e_util_get_category_filter_options
+ (void);
/* Camel uses its own object system, so we have to box
* CamelObjects to safely use them as GObject properties. */
diff --git a/e-util/gconf-bridge.c b/e-util/gconf-bridge.c
index 1b844977f9..5a3693730f 100644
--- a/e-util/gconf-bridge.c
+++ b/e-util/gconf-bridge.c
@@ -1077,17 +1077,17 @@ gconf_bridge_bind_string_list_store (GConfBridge *bridge,
(list_store_binding_store_changed_cb),
binding);
binding->row_changed_id =
- g_signal_connect_swapped (list_store, "row-inserted",
+ g_signal_connect_swapped (list_store, "row-changed",
G_CALLBACK
(list_store_binding_store_changed_cb),
binding);
binding->row_deleted_id =
- g_signal_connect_swapped (list_store, "row-inserted",
+ g_signal_connect_swapped (list_store, "row-deleted",
G_CALLBACK
(list_store_binding_store_changed_cb),
binding);
binding->rows_reordered_id =
- g_signal_connect_swapped (list_store, "row-inserted",
+ g_signal_connect_swapped (list_store, "rows-reordered",
G_CALLBACK
(list_store_binding_store_changed_cb),
binding);
diff --git a/em-format/Makefile.am b/em-format/Makefile.am
new file mode 100644
index 0000000000..e5d0fca3b6
--- /dev/null
+++ b/em-format/Makefile.am
@@ -0,0 +1,22 @@
+INCLUDES = \
+ -I$(top_srcdir) \
+ $(EVOLUTION_MAIL_CFLAGS)
+
+noinst_LTLIBRARIES = libemformat.la
+
+libemformat_la_SOURCES = \
+ em-format.h \
+ em-format.c \
+ em-format-quote.h \
+ em-format-quote.c \
+ em-stripsig-filter.c \
+ em-stripsig-filter.h
+
+libemformat_la_LDFLAGS = -avoid-version $(NO_UNDEFINED)
+
+libemformat_la_LIBADD = \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/shell/libeshell.la \
+ $(EVOLUTION_MAIL_LIBS)
+
+-include $(top_srcdir)/git.mk
diff --git a/mail/em-format-quote.c b/em-format/em-format-quote.c
index 85249a293c..7918b94d88 100644
--- a/mail/em-format-quote.c
+++ b/em-format/em-format-quote.c
@@ -28,7 +28,6 @@
#include <string.h>
#include <camel/camel-iconv.h>
-#include <camel/camel-stream.h>
#include <camel/camel-stream-filter.h>
#include <camel/camel-mime-filter-tohtml.h>
#include <camel/camel-mime-filter-enriched.h>
@@ -41,7 +40,6 @@
#include "em-stripsig-filter.h"
#include "em-format-quote.h"
-#include "mail-config.h"
struct _EMFormatQuotePrivate {
int dummy;
@@ -55,82 +53,94 @@ static void emfq_format_attachment(EMFormat *, CamelStream *, CamelMimePart *, c
static void emfq_builtin_init(EMFormatQuoteClass *efhc);
-static EMFormatClass *emfq_parent;
+static gpointer parent_class;
static void
emfq_init(GObject *o)
{
EMFormatQuote *emfq =(EMFormatQuote *) o;
- emfq->priv = g_malloc0(sizeof(*emfq->priv));
-
/* we want to convert url's etc */
emfq->text_html_flags = CAMEL_MIME_FILTER_TOHTML_PRE | CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS
| CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
}
static void
-emfq_finalise(GObject *o)
+emfq_finalize (GObject *object)
{
- EMFormatQuote *emfq =(EMFormatQuote *) o;
+ EMFormatQuote *emfq =(EMFormatQuote *) object;
if (emfq->stream)
camel_object_unref(emfq->stream);
g_free(emfq->credits);
- g_free(emfq->priv);
- ((GObjectClass *) emfq_parent)->finalize(o);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-emfq_base_init(EMFormatQuoteClass *emfqklass)
+emfq_base_init(EMFormatQuoteClass *emfqclass)
{
- emfq_builtin_init(emfqklass);
+ emfq_builtin_init(emfqclass);
}
static void
-emfq_class_init(GObjectClass *klass)
+emfq_class_init (EMFormatQuoteClass *class)
{
- ((EMFormatClass *) klass)->format_clone = emfq_format_clone;
- ((EMFormatClass *) klass)->format_error = emfq_format_error;
- ((EMFormatClass *) klass)->format_source = emfq_format_source;
- ((EMFormatClass *) klass)->format_attachment = emfq_format_attachment;
+ GObjectClass *object_class;
+ EMFormatClass *format_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMFormatQuotePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = emfq_finalize;
- klass->finalize = emfq_finalise;
+ format_class = EM_FORMAT_CLASS (class);
+ format_class->format_clone = emfq_format_clone;
+ format_class->format_error = emfq_format_error;
+ format_class->format_source = emfq_format_source;
+ format_class->format_attachment = emfq_format_attachment;
}
GType
-em_format_quote_get_type(void)
+em_format_quote_get_type (void)
{
static GType type = 0;
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(EMFormatQuoteClass),
- (GBaseInitFunc)emfq_base_init, NULL,
- (GClassInitFunc)emfq_class_init,
- NULL, NULL,
- sizeof(EMFormatQuote), 0,
- (GInstanceInitFunc) emfq_init
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMFormatQuoteClass),
+ (GBaseInitFunc) emfq_base_init,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) emfq_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMFormatQuote),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) emfq_init,
+ NULL /* value_table */
};
- emfq_parent = g_type_class_ref(em_format_get_type());
- type = g_type_register_static(em_format_get_type(), "EMFormatQuote", &info, 0);
+ type = g_type_register_static (
+ EM_TYPE_FORMAT, "EMFormatQuote", &type_info, 0);
}
return type;
}
EMFormatQuote *
-em_format_quote_new(const char *credits, CamelStream *stream, guint32 flags)
+em_format_quote_new (const gchar *credits,
+ CamelStream *stream,
+ guint32 flags)
{
EMFormatQuote *emfq;
- emfq = (EMFormatQuote *)g_object_new(em_format_quote_get_type(), NULL);
+ emfq = g_object_new (EM_TYPE_FORMAT_QUOTE, NULL);
- emfq->credits = g_strdup(credits);
+ emfq->credits = g_strdup (credits);
emfq->stream = stream;
- camel_object_ref(stream);
+ camel_object_ref (stream);
emfq->flags = flags;
return emfq;
@@ -147,12 +157,16 @@ emfq_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMime
{
EMFormatQuote *emfq = (EMFormatQuote *) emf;
const EMFormatHandler *handle;
+ GConfClient *gconf;
- ((EMFormatClass *)emfq_parent)->format_clone(emf, folder, uid, msg, src);
+ /* Chain up to parent's format_clone() method. */
+ EM_FORMAT_CLASS (parent_class)->format_clone (emf, folder, uid, msg, src);
+ gconf = gconf_client_get_default ();
camel_stream_reset(emfq->stream);
- if (gconf_client_get_bool(mail_config_get_gconf_client(), "/apps/evolution/mail/composer/top_signature", NULL))
+ if (gconf_client_get_bool(gconf, "/apps/evolution/mail/composer/top_signature", NULL))
emfq_format_empty_line(emf, emfq->stream, (CamelMimePart *)msg, NULL);
+ g_object_unref (gconf);
handle = em_format_find_handler(emf, "x-evolution/message/prefix");
if (handle)
handle->handler(emf, emfq->stream, (CamelMimePart *)msg, handle);
diff --git a/mail/em-format-quote.h b/em-format/em-format-quote.h
index 86d277b26e..8aca4b8e3f 100644
--- a/mail/em-format-quote.h
+++ b/em-format/em-format-quote.h
@@ -24,7 +24,7 @@
#define EM_FORMAT_QUOTE_H
#include <camel/camel-stream.h>
-#include "mail/em-format.h"
+#include "em-format.h"
/* Standard GObject macros */
#define EM_TYPE_FORMAT_QUOTE \
diff --git a/mail/em-format.c b/em-format/em-format.c
index 3aa20b2b3e..c2669e7c5b 100644
--- a/mail/em-format.c
+++ b/em-format/em-format.c
@@ -32,7 +32,6 @@
#include <gio/gio.h>
#include <libedataserver/e-msgport.h>
-#include <camel/camel-url.h>
#include <camel/camel-stream.h>
#include <camel/camel-stream-mem.h>
#include <camel/camel-multipart.h>
@@ -51,8 +50,9 @@
#include <camel/camel-mime-filter-pgp.h>
#include "em-format.h"
-#include "em-utils.h"
-#include "mail-config.h"
+#include "e-util/e-util.h"
+#include "shell/e-shell.h"
+#include "shell/e-shell-settings.h"
#define d(x)
@@ -62,8 +62,8 @@
This is still kind of yucky, we should maintian a full tree of all this data,
along with/as part of the puri tree */
struct _EMFormatCache {
- struct _CamelCipherValidity *valid; /* validity copy */
- struct _CamelMimePart *secured; /* encrypted subpart */
+ CamelCipherValidity *valid; /* validity copy */
+ CamelMimePart *secured; /* encrypted subpart */
unsigned int state:2; /* inline state */
@@ -85,10 +85,8 @@ enum {
EMF_LAST_SIGNAL
};
-extern CamelSession *session;
-
-static guint emf_signals[EMF_LAST_SIGNAL];
-static GObjectClass *emf_parent;
+static gpointer parent_class;
+static guint signals[EMF_LAST_SIGNAL];
static void
emf_free_cache(struct _EMFormatCache *efc)
@@ -113,32 +111,14 @@ emf_insert_cache(EMFormat *emf, const char *partid)
}
static void
-emf_init(GObject *o)
-{
- EMFormat *emf = (EMFormat *)o;
-
- emf->inline_table = g_hash_table_new_full (
- g_str_hash, g_str_equal,
- (GDestroyNotify) NULL,
- (GDestroyNotify) emf_free_cache);
- emf->composer = FALSE;
- emf->print = FALSE;
- emf->show_photo = TRUE;
- emf->photo_local = TRUE;
- e_dlist_init(&emf->header_list);
- em_format_default_headers(emf);
- emf->part_id = g_string_new("");
-}
-
-static void
-emf_finalise(GObject *o)
+emf_finalize (GObject *object)
{
- EMFormat *emf = (EMFormat *)o;
+ EMFormat *emf = EM_FORMAT (object);
if (emf->session)
- camel_object_unref(emf->session);
+ camel_object_unref (emf->session);
- g_hash_table_destroy(emf->inline_table);
+ g_hash_table_destroy (emf->inline_table);
em_format_clear_headers(emf);
camel_cipher_validity_free(emf->valid);
@@ -148,54 +128,91 @@ emf_finalise(GObject *o)
/* FIXME: check pending jobs */
- ((GObjectClass *)emf_parent)->finalize(o);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+emf_base_init (EMFormatClass *class)
+{
+ class->type_handlers = g_hash_table_new (g_str_hash, g_str_equal);
+ emf_builtin_init (class);
}
static void
-emf_base_init(EMFormatClass *emfklass)
+emf_class_init (EMFormatClass *class)
{
- emfklass->type_handlers = g_hash_table_new(g_str_hash, g_str_equal);
- emf_builtin_init(emfklass);
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = emf_finalize;
+
+ class->find_handler = emf_find_handler;
+ class->format_clone = emf_format_clone;
+ class->format_secure = emf_format_secure;
+ class->busy = emf_busy;
+
+ signals[EMF_COMPLETE] = g_signal_new (
+ "complete",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EMFormatClass, complete),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ class->type_handlers = g_hash_table_new (g_str_hash, g_str_equal);
+ emf_builtin_init (class);
}
static void
-emf_class_init(GObjectClass *klass)
+emf_init (EMFormat *emf)
{
- ((EMFormatClass *)klass)->type_handlers = g_hash_table_new(g_str_hash, g_str_equal);
- emf_builtin_init((EMFormatClass *)klass);
-
- klass->finalize = emf_finalise;
- ((EMFormatClass *)klass)->find_handler = emf_find_handler;
- ((EMFormatClass *)klass)->format_clone = emf_format_clone;
- ((EMFormatClass *)klass)->format_secure = emf_format_secure;
- ((EMFormatClass *)klass)->busy = emf_busy;
-
- emf_signals[EMF_COMPLETE] =
- g_signal_new("complete",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMFormatClass, complete),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ EShell *shell;
+ EShellSettings *shell_settings;
+
+ emf->inline_table = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) NULL,
+ (GDestroyNotify) emf_free_cache);
+ emf->composer = FALSE;
+ emf->print = FALSE;
+ e_dlist_init(&emf->header_list);
+ em_format_default_headers(emf);
+ emf->part_id = g_string_new("");
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ emf->session = e_shell_settings_get_pointer (shell_settings, "mail-session");
+ g_return_if_fail (emf->session != NULL);
+
+ camel_object_ref (emf->session);
}
GType
-em_format_get_type(void)
+em_format_get_type (void)
{
static GType type = 0;
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(EMFormatClass),
- (GBaseInitFunc)emf_base_init, NULL,
- (GClassInitFunc)emf_class_init,
- NULL, NULL,
- sizeof(EMFormat), 0,
- (GInstanceInitFunc)emf_init
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMFormatClass),
+ (GBaseInitFunc) emf_base_init,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) emf_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMFormat),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) emf_init,
+ NULL /* value_table */
};
- emf_parent = g_type_class_ref(G_TYPE_OBJECT);
- type = g_type_register_static(G_TYPE_OBJECT, "EMFormat", &info, 0);
+
+ type = g_type_register_static (
+ G_TYPE_OBJECT, "EMFormat", &type_info, 0);
}
return type;
@@ -257,6 +274,7 @@ em_format_merge_handler(EMFormat *new, EMFormat *old)
g_hash_table_foreach (oldc->type_handlers, merge_missing, &fclasses);
}
+
/**
* em_format_class_remove_handler:
* @emfc:
@@ -287,6 +305,20 @@ em_format_class_remove_handler(EMFormatClass *emfc, EMFormatHandler *info)
}
}
+const EMFormatHandler *
+em_format_find_handler (EMFormat *emf,
+ const gchar *mime_type)
+{
+ EMFormatClass *class;
+
+ g_return_val_if_fail (EM_IS_FORMAT (emf), NULL);
+ g_return_val_if_fail (mime_type != NULL, NULL);
+
+ class = EM_FORMAT_GET_CLASS (emf);
+ g_return_val_if_fail (class->find_handler != NULL, NULL);
+ return class->find_handler (emf, mime_type);
+}
+
/**
* em_format_find_handler:
* @emf:
@@ -613,7 +645,7 @@ em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const
if (mime_type != NULL) {
if (g_ascii_strcasecmp(mime_type, "application/octet-stream") == 0) {
- emf->snoop_mime_type = mime_type = em_utils_snoop_type(part);
+ emf->snoop_mime_type = mime_type = em_format_snoop_type(part);
if (mime_type == NULL)
mime_type = "application/octet-stream";
}
@@ -760,10 +792,10 @@ emf_busy(EMFormat *emf)
/**
* em_format_format_clone:
- * @emf: Mail formatter.
- * @folder: Camel Folder.
- * @uid: Uid of message.
- * @msg: Camel Message.
+ * @emf: an #EMFormat
+ * @folder: a #CamelFolder or %NULL
+ * @uid: Message UID or %NULL
+ * @msg: a #CamelMimeMessage or %NULL
* @emfsource: Used as a basis for user-altered layout, e.g. inline viewed
* attachments.
*
@@ -813,25 +845,6 @@ em_format_redraw (EMFormat *emf)
}
/**
- * em_format_set_session:
- * @emf:
- * @s:
- *
- * Set the CamelSession to be used for signature verification and decryption
- * purposes. If this is not set, then signatures cannot be verified or
- * encrypted messages viewed.
- **/
-void
-em_format_set_session(EMFormat *emf, struct _CamelSession *s)
-{
- if (s)
- camel_object_ref(s);
- if (emf->session)
- camel_object_unref(emf->session);
- emf->session = s;
-}
-
-/**
* em_format_set_mode:
* @emf:
* @type:
@@ -1068,28 +1081,101 @@ void em_format_set_inline(EMFormat *emf, const char *partid, int state)
em_format_redraw(emf);
}
-void em_format_format_error(EMFormat *emf, CamelStream *stream, const char *fmt, ...)
+void
+em_format_format_attachment (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *mime_part,
+ const gchar *mime_type,
+ const struct _EMFormatHandler *info)
+{
+ EMFormatClass *class;
+
+ g_return_if_fail (EM_IS_FORMAT (emf));
+ g_return_if_fail (CAMEL_IS_STREAM (stream));
+ g_return_if_fail (CAMEL_IS_MIME_PART (mime_part));
+ g_return_if_fail (mime_type != NULL);
+ g_return_if_fail (info != NULL);
+
+ class = EM_FORMAT_GET_CLASS (emf);
+ g_return_if_fail (class->format_attachment != NULL);
+ class->format_attachment (emf, stream, mime_part, mime_type, info);
+}
+
+void
+em_format_format_error (EMFormat *emf,
+ CamelStream *stream,
+ const gchar *format,
+ ...)
{
+ EMFormatClass *class;
+ gchar *errmsg;
va_list ap;
- char *txt;
- va_start(ap, fmt);
- txt = g_strdup_vprintf(fmt, ap);
- ((EMFormatClass *)G_OBJECT_GET_CLASS(emf))->format_error((emf), (stream), (txt));
- g_free(txt);
+ g_return_if_fail (EM_IS_FORMAT (emf));
+ g_return_if_fail (CAMEL_IS_STREAM (stream));
+ g_return_if_fail (format != NULL);
+
+ class = EM_FORMAT_GET_CLASS (emf);
+ g_return_if_fail (class->format_error != NULL);
+
+ va_start (ap, format);
+ errmsg = g_strdup_vprintf (format, ap);
+ class->format_error (emf, stream, errmsg);
+ g_free (errmsg);
+ va_end (ap);
}
void
-em_format_format_secure(EMFormat *emf, struct _CamelStream *stream, struct _CamelMimePart *part, struct _CamelCipherValidity *valid)
+em_format_format_secure (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *mime_part,
+ CamelCipherValidity *valid)
{
- ((EMFormatClass *)G_OBJECT_GET_CLASS(emf))->format_secure(emf, stream, part, valid);
+ EMFormatClass *class;
+
+ g_return_if_fail (EM_IS_FORMAT (emf));
+ g_return_if_fail (CAMEL_IS_STREAM (stream));
+ g_return_if_fail (CAMEL_IS_MIME_PART (mime_part));
+ g_return_if_fail (valid != NULL);
+
+ class = EM_FORMAT_GET_CLASS (emf);
+ g_return_if_fail (class->format_secure != NULL);
+ class->format_secure (emf, stream, mime_part, valid);
if (emf->valid_parent == NULL && emf->valid != NULL) {
- camel_cipher_validity_free(emf->valid);
+ camel_cipher_validity_free (emf->valid);
emf->valid = NULL;
}
}
+void
+em_format_format_source (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *mime_part)
+{
+ EMFormatClass *class;
+
+ g_return_if_fail (EM_IS_FORMAT (emf));
+ g_return_if_fail (CAMEL_IS_STREAM (stream));
+ g_return_if_fail (CAMEL_IS_MIME_PART (mime_part));
+
+ class = EM_FORMAT_GET_CLASS (emf);
+ g_return_if_fail (class->format_source != NULL);
+ class->format_source (emf, stream, mime_part);
+}
+
+gboolean
+em_format_busy (EMFormat *emf)
+{
+ EMFormatClass *class;
+
+ g_return_val_if_fail (EM_IS_FORMAT (emf), FALSE);
+
+ class = EM_FORMAT_GET_CLASS (emf);
+ g_return_val_if_fail (class->busy != NULL, FALSE);
+ return class->busy (emf);
+}
+
/* should this be virtual? */
void
em_format_format_content(EMFormat *emf, CamelStream *stream, CamelMimePart *part)
@@ -1120,6 +1206,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
CamelStream *mem_stream = NULL;
size_t size;
size_t max;
+ GConfClient *gconf;
if (emf->charset) {
charset = emf->charset;
@@ -1157,7 +1244,16 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
camel_object_unref(filter);
}
- max = mail_config_get_message_limit();
+ max = -1;
+
+ gconf = gconf_client_get_default ();
+ if (gconf_client_get_bool (gconf, "/apps/evolution/mail/display/force_message_limit", NULL)) {
+ max = gconf_client_get_int (gconf, "/apps/evolution/mail/display/message_text_part_limit", NULL);
+ if (max == 0)
+ max = -1;
+ }
+ g_object_unref (gconf);
+
size = camel_data_wrapper_decode_to_stream(emf->mode == EM_FORMAT_SOURCE ? (CamelDataWrapper *)dw: camel_medium_get_content_object((CamelMedium *)dw), (CamelStream *)filter_stream);
camel_stream_flush((CamelStream *)filter_stream);
camel_object_unref(filter_stream);
@@ -1228,7 +1324,7 @@ emf_application_xpkcs7mime(EMFormat *emf, CamelStream *stream, CamelMimePart *pa
ex = camel_exception_new();
- context = camel_smime_context_new(session);
+ context = camel_smime_context_new(emf->session);
opart = camel_mime_part_new();
valid = camel_cipher_decrypt(context, part, opart, ex);
@@ -1402,7 +1498,7 @@ emf_multipart_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *part,
em_format_format_secure(emf, stream, opart, valid);
}
- /* TODO: Make sure when we finalise this part, it is zero'd out */
+ /* TODO: Make sure when we finalize this part, it is zero'd out */
camel_object_unref(opart);
camel_object_unref(context);
camel_exception_free(ex);
@@ -1715,7 +1811,7 @@ emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart
/* this ensures to show the 'opart' as inlined, if possible */
if (mime_type && g_ascii_strcasecmp (mime_type, "application/octet-stream") == 0) {
- const char *snoop = em_utils_snoop_type (opart);
+ const char *snoop = em_format_snoop_type (opart);
if (snoop)
camel_data_wrapper_set_mime_type (dw, snoop);
@@ -1759,10 +1855,92 @@ static EMFormatHandler type_builtin_table[] = {
};
static void
-emf_builtin_init(EMFormatClass *klass)
+emf_builtin_init(EMFormatClass *class)
{
int i;
for (i=0;i<sizeof(type_builtin_table)/sizeof(type_builtin_table[0]);i++)
- g_hash_table_insert(klass->type_handlers, (gpointer) type_builtin_table[i].mime_type, &type_builtin_table[i]);
+ g_hash_table_insert(class->type_handlers, type_builtin_table[i].mime_type, &type_builtin_table[i]);
+}
+
+/**
+ * em_format_snoop_type:
+ * @part:
+ *
+ * Tries to snoop the mime type of a part.
+ *
+ * Return value: NULL if unknown (more likely application/octet-stream).
+ **/
+const char *
+em_format_snoop_type (CamelMimePart *part)
+{
+ /* cache is here only to be able still return const char * */
+ static GHashTable *types_cache = NULL;
+
+ const char *filename;
+ char *name_type = NULL, *magic_type = NULL, *res, *tmp;
+ CamelDataWrapper *dw;
+
+ filename = camel_mime_part_get_filename (part);
+ if (filename != NULL)
+ name_type = e_util_guess_mime_type (filename, FALSE);
+
+ dw = camel_medium_get_content_object((CamelMedium *)part);
+ if (!camel_data_wrapper_is_offline(dw)) {
+ CamelStreamMem *mem = (CamelStreamMem *)camel_stream_mem_new();
+
+ if (camel_data_wrapper_decode_to_stream(dw, (CamelStream *)mem) > 0) {
+ char *ct = g_content_type_guess (filename, mem->buffer->data, mem->buffer->len, NULL);
+
+ if (ct)
+ magic_type = g_content_type_get_mime_type (ct);
+
+ g_free (ct);
+ }
+ camel_object_unref(mem);
+ }
+
+ d(printf("snooped part, magic_type '%s' name_type '%s'\n", magic_type, name_type));
+
+ /* If gvfs doesn't recognize the data by magic, but it
+ * contains English words, it will call it text/plain. If the
+ * filename-based check came up with something different, use
+ * that instead and if it returns "application/octet-stream"
+ * try to do better with the filename check.
+ */
+
+ if (magic_type) {
+ if (name_type
+ && (!strcmp(magic_type, "text/plain")
+ || !strcmp(magic_type, "application/octet-stream")))
+ res = name_type;
+ else
+ res = magic_type;
+ } else
+ res = name_type;
+
+
+ if (res != name_type)
+ g_free (name_type);
+
+ if (res != magic_type)
+ g_free (magic_type);
+
+ if (!types_cache)
+ types_cache = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) NULL);
+
+ if (res) {
+ tmp = g_hash_table_lookup (types_cache, res);
+ if (tmp) {
+ g_free (res);
+ res = tmp;
+ } else {
+ g_hash_table_insert (types_cache, res, res);
+ }
+ }
+
+ return res;
+
+ /* We used to load parts to check their type, we dont anymore,
+ see bug #11778 for some discussion */
}
diff --git a/mail/em-format.h b/em-format/em-format.h
index e2363c2b8e..a9d9356778 100644
--- a/mail/em-format.h
+++ b/em-format/em-format.h
@@ -249,8 +249,6 @@ struct _EMFormat {
char *default_charset; /* charset fallback */
gboolean composer; /* Formatting from composer ?*/
gboolean print;
- gboolean show_photo; /* Want to show the photo of the sender ?*/
- gboolean photo_local; /* Photos only from local addressbooks */
};
struct _EMFormatClass {
@@ -286,63 +284,119 @@ struct _EMFormatClass {
void (*complete)(EMFormat *);
};
-/* helper entry point */
-void em_format_set_session(EMFormat *emf, CamelSession *s);
+void em_format_set_mode (EMFormat *emf,
+ em_format_mode_t type);
+void em_format_set_charset (EMFormat *emf,
+ const char *charset);
+void em_format_set_default_charset (EMFormat *emf,
+ const char *charset);
-void em_format_set_mode(EMFormat *emf, em_format_mode_t type);
-void em_format_set_charset(EMFormat *emf, const char *charset);
-void em_format_set_default_charset(EMFormat *emf, const char *charset);
+/* also indicates to show all headers */
+void em_format_clear_headers (EMFormat *emf);
-void em_format_clear_headers(EMFormat *emf); /* also indicates to show all headers */
-void em_format_default_headers(EMFormat *emf);
-void em_format_add_header(EMFormat *emf, const char *name, guint32 flags);
+void em_format_default_headers (EMFormat *emf);
+void em_format_add_header (EMFormat *emf,
+ const gchar *name,
+ guint32 flags);
/* FIXME: Need a 'clone' api to copy details about the current view (inlines etc)
Or maybe it should live with sub-classes? */
-int em_format_is_attachment(EMFormat *emf, CamelMimePart *part);
+int em_format_is_attachment (EMFormat *emf,
+ CamelMimePart *part);
-int em_format_is_inline(EMFormat *emf, const char *partid, CamelMimePart *part, const EMFormatHandler *handle);
-void em_format_set_inline(EMFormat *emf, const char *partid, int state);
+int em_format_is_inline (EMFormat *emf,
+ const char *partid,
+ CamelMimePart *part,
+ const EMFormatHandler *handle);
+void em_format_set_inline (EMFormat *emf,
+ const char *partid,
+ int state);
-char *em_format_describe_part(CamelMimePart *part, const char *mimetype);
+char * em_format_describe_part (CamelMimePart *part,
+ const char *mime_type);
/* for implementers */
-GType em_format_get_type(void);
-
-void em_format_class_add_handler(EMFormatClass *emfc, EMFormatHandler *info);
-void em_format_class_remove_handler(EMFormatClass *emfc, EMFormatHandler *info);
-#define em_format_find_handler(emf, type) ((EMFormatClass *)G_OBJECT_GET_CLASS(emf))->find_handler((emf), (type))
-const EMFormatHandler *em_format_fallback_handler(EMFormat *emf, const char *mime_type);
+GType em_format_get_type (void);
+
+void em_format_class_add_handler (EMFormatClass *emfc,
+ EMFormatHandler *info);
+void em_format_class_remove_handler (EMFormatClass *emfc,
+ EMFormatHandler *info);
+const EMFormatHandler *
+ em_format_find_handler (EMFormat *emf,
+ const gchar *mime_type);
+const EMFormatHandler *
+ em_format_fallback_handler (EMFormat *emf,
+ const gchar *mime_type);
/* puri is short for pending uri ... really */
-EMFormatPURI *em_format_add_puri(EMFormat *emf, size_t size, const char *uri, CamelMimePart *part, EMFormatPURIFunc func);
-EMFormatPURI *em_format_find_visible_puri(EMFormat *emf, const char *uri);
-EMFormatPURI *em_format_find_puri(EMFormat *emf, const char *uri);
-void em_format_clear_puri_tree(EMFormat *emf);
-void em_format_push_level(EMFormat *emf);
-void em_format_pull_level(EMFormat *emf);
+EMFormatPURI * em_format_add_puri (EMFormat *emf,
+ size_t size,
+ const char *uri,
+ CamelMimePart *part,
+ EMFormatPURIFunc func);
+EMFormatPURI * em_format_find_visible_puri (EMFormat *emf,
+ const char *uri);
+EMFormatPURI * em_format_find_puri (EMFormat *emf,
+ const char *uri);
+void em_format_clear_puri_tree (EMFormat *emf);
+void em_format_push_level (EMFormat *emf);
+void em_format_pull_level (EMFormat *emf);
/* clones inline state/view and format, or use to redraw */
-void em_format_format_clone (EMFormat *emf, CamelFolder *folder, const gchar *uid, CamelMimeMessage *message, EMFormat *source);
-/* formats a new message */
-void em_format_format(EMFormat *emf, CamelFolder *folder, const gchar *uid, CamelMimeMessage *message);
-void em_format_redraw(EMFormat *emf);
-void em_format_format_error(EMFormat *emf, CamelStream *stream, const char *fmt, ...);
-#define em_format_format_attachment(emf, stream, msg, type, info) ((EMFormatClass *)G_OBJECT_GET_CLASS(emf))->format_attachment((emf), (stream), (msg), (type), (info))
-#define em_format_format_source(emf, stream, msg) ((EMFormatClass *)G_OBJECT_GET_CLASS(emf))->format_source((emf), (stream), (msg))
-void em_format_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid);
+void em_format_format_clone (EMFormat *emf,
+ CamelFolder *folder,
+ const gchar *uid,
+ CamelMimeMessage *message,
+ EMFormat *source);
-#define em_format_busy(emf) ((EMFormatClass *)G_OBJECT_GET_CLASS(emf))->busy((emf))
+/* formats a new message */
+void em_format_format (EMFormat *emf,
+ CamelFolder *folder,
+ const gchar *uid,
+ CamelMimeMessage *message);
+void em_format_redraw (EMFormat *emf);
+void em_format_format_attachment (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *mime_part,
+ const gchar *mime_type,
+ const struct _EMFormatHandler *info);
+void em_format_format_error (EMFormat *emf,
+ CamelStream *stream,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (3, 4);
+void em_format_format_secure (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *mime_part,
+ CamelCipherValidity *valid);
+void em_format_format_source (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *mime_part);
+
+gboolean em_format_busy (EMFormat *emf);
/* raw content only */
-void em_format_format_content(EMFormat *emf, CamelStream *stream, CamelMimePart *part);
-/* raw content text parts - should this just be checked/done by above? */
-void em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *part);
+void em_format_format_content (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *part);
-void em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const char *mime_type);
-void em_format_part(EMFormat *emf, CamelStream *stream, CamelMimePart *part);
-void em_format_merge_handler(EMFormat *new, EMFormat *old);
+/* raw content text parts - should this just be checked/done by above? */
+void em_format_format_text (EMFormat *emf,
+ CamelStream *stream,
+ CamelDataWrapper *part);
+
+void em_format_part_as (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *part,
+ const gchar *mime_type);
+void em_format_part (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *part);
+void em_format_merge_handler (EMFormat *new,
+ EMFormat *old);
+
+const char * em_format_snoop_type (CamelMimePart *part);
G_END_DECLS
diff --git a/mail/em-stripsig-filter.c b/em-format/em-stripsig-filter.c
index 1600eeaed0..1600eeaed0 100644
--- a/mail/em-stripsig-filter.c
+++ b/em-format/em-stripsig-filter.c
diff --git a/mail/em-stripsig-filter.h b/em-format/em-stripsig-filter.h
index 761d46691f..761d46691f 100644
--- a/mail/em-stripsig-filter.h
+++ b/em-format/em-stripsig-filter.h
diff --git a/evolution-shell.pc.in b/evolution-shell.pc.in
index fb72dfebab..60a122c923 100644
--- a/evolution-shell.pc.in
+++ b/evolution-shell.pc.in
@@ -11,6 +11,7 @@ privlibexecdir=@privlibexecdir@
privincludedir=@privincludedir@
idldir=@idldir@
componentdir=@componentdir@
+moduledir=@moduledir@
evolutionuidir=@evolutionuidir@
imagesdir=@imagesdir@
@@ -21,6 +22,6 @@ IDL_INCLUDES=-I ${idldir} @IDL_INCLUDES@
Name: evolution-shell
Description: libraries needed for Evolution shell components
Version: @VERSION@
-Requires: libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 >= @BONOBOUI_REQUIRED@
+Requires: libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 >= @BONOBOUI_REQUIRED@ unique-1.0
Libs: -L${privlibdir} -leshell -Wl,-R${privlibdir}
Cflags: -I${privincludedir}
diff --git a/filter/Makefile.am b/filter/Makefile.am
index b58b4b2db6..43e5bcd73b 100644
--- a/filter/Makefile.am
+++ b/filter/Makefile.am
@@ -4,7 +4,6 @@ glade_DATA = filter.glade
INCLUDES = \
-I $(top_srcdir) \
-I $(top_srcdir)/e-util \
- -I $(top_srcdir)/widgets/misc \
-DEVOLUTION_GLADEDIR=\"$(gladedir)\" \
-DG_LOG_DOMAIN=\"filter\" \
$(LIBFILTER_CFLAGS)
diff --git a/mail/Makefile.am b/mail/Makefile.am
index e1b0da9475..25441641dc 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = default importers
+SUBDIRS = default
mailincludedir = $(privincludedir)/mail
@@ -6,6 +6,7 @@ INCLUDES = \
-I$(top_srcdir)/widgets \
-I$(top_srcdir)/widgets/misc \
-I$(top_srcdir) \
+ -I$(top_srcdir)/em-format \
-I$(top_srcdir)/mail \
-I$(top_srcdir)/composer \
-I$(top_builddir)/composer \
@@ -30,237 +31,186 @@ INCLUDES = \
-DPREFIX=\""$(prefix)"\" \
-DG_LOG_DOMAIN=\"evolution-mail\"
-component_LTLIBRARIES = libevolution-mail-shared.la \
- libevolution-mail.la
+module_LTLIBRARIES = \
+ libevolution-module-mail.la
+
+libevolution_module_mail_la_SOURCES = \
+ evolution-module-mail.c \
+ e-attachment-handler-mail.c \
+ e-attachment-handler-mail.h \
+ e-mail-attachment-bar.c \
+ e-mail-attachment-bar.h \
+ e-mail-browser.c \
+ e-mail-browser.h \
+ e-mail-display.c \
+ e-mail-display.h \
+ e-mail-label-dialog.c \
+ e-mail-label-dialog.h \
+ e-mail-label-list-store.c \
+ e-mail-label-list-store.h \
+ e-mail-label-manager.c \
+ e-mail-label-manager.h \
+ e-mail-label-tree-view.c \
+ e-mail-label-tree-view.h \
+ e-mail-reader.c \
+ e-mail-reader.h \
+ e-mail-reader-utils.c \
+ e-mail-reader-utils.h \
+ e-mail-search-bar.c \
+ e-mail-search-bar.h \
+ e-mail-shell-backend.c \
+ e-mail-shell-backend.h \
+ e-mail-shell-content.c \
+ e-mail-shell-content.h \
+ e-mail-shell-migrate.c \
+ e-mail-shell-migrate.h \
+ e-mail-shell-settings.c \
+ e-mail-shell-settings.h \
+ e-mail-shell-sidebar.c \
+ e-mail-shell-sidebar.h \
+ e-mail-shell-view.c \
+ e-mail-shell-view.h \
+ e-mail-shell-view-actions.c \
+ e-mail-shell-view-actions.h \
+ e-mail-shell-view-private.c \
+ e-mail-shell-view-private.h \
+ e-searching-tokenizer.c \
+ e-searching-tokenizer.h \
+ em-account-editor.c \
+ em-account-editor.h \
+ em-account-prefs.c \
+ em-account-prefs.h \
+ em-composer-prefs.c \
+ em-composer-prefs.h \
+ em-composer-utils.c \
+ em-composer-utils.h \
+ em-config.c \
+ em-config.h \
+ em-event.c \
+ em-event.h \
+ em-filter-context.c \
+ em-filter-context.h \
+ em-filter-editor.c \
+ em-filter-editor.h \
+ em-filter-folder-element.c \
+ em-filter-folder-element.h \
+ em-filter-rule.c \
+ em-filter-rule.h \
+ em-filter-source-element.c \
+ em-filter-source-element.h \
+ em-folder-properties.c \
+ em-folder-properties.h \
+ em-folder-selection.c \
+ em-folder-selection.h \
+ em-folder-selector.c \
+ em-folder-selector.h \
+ em-folder-selection-button.c \
+ em-folder-selection-button.h \
+ em-folder-tree.c \
+ em-folder-tree.h \
+ em-folder-tree-model.c \
+ em-folder-tree-model.h \
+ em-folder-utils.c \
+ em-folder-utils.h \
+ em-format-hook.c \
+ em-format-hook.h \
+ em-format-html.c \
+ em-format-html.h \
+ em-format-html-display.c \
+ em-format-html-display.h \
+ em-format-html-print.c \
+ em-format-html-print.h \
+ em-html-stream.c \
+ em-html-stream.h \
+ em-icon-stream.c \
+ em-icon-stream.h \
+ em-inline-filter.c \
+ em-inline-filter.h \
+ em-junk-hook.c \
+ em-junk-hook.h \
+ em-mailer-prefs.c \
+ em-mailer-prefs.h \
+ em-menu.c \
+ em-menu.h \
+ em-network-prefs.c \
+ em-network-prefs.h \
+ em-popup.c \
+ em-popup.h \
+ em-search-context.c \
+ em-search-context.h \
+ em-subscribe-editor.c \
+ em-subscribe-editor.h \
+ em-sync-stream.c \
+ em-sync-stream.h \
+ em-utils.c \
+ em-utils.h \
+ em-vfolder-context.c \
+ em-vfolder-context.h \
+ em-vfolder-editor.c \
+ em-vfolder-editor.h \
+ em-vfolder-rule.c \
+ em-vfolder-rule.h \
+ mail-autofilter.c \
+ mail-autofilter.h \
+ mail-config.c \
+ mail-config.h \
+ mail-folder-cache.c \
+ mail-folder-cache.h \
+ mail-mt.c \
+ mail-mt.h \
+ mail-ops.c \
+ mail-ops.h \
+ mail-send-recv.c \
+ mail-send-recv.h \
+ mail-session.c \
+ mail-session.h \
+ mail-tools.c \
+ mail-tools.h \
+ mail-vfolder.c \
+ mail-vfolder.h \
+ message-list.c \
+ message-list.h \
+ message-tag-editor.c \
+ message-tag-editor.h \
+ message-tag-followup.c \
+ message-tag-followup.h \
+ importers/mail-importer.c \
+ importers/mail-importer.h \
+ importers/elm-importer.c \
+ importers/pine-importer.c \
+ importers/evolution-mbox-importer.c
-
-# Mail.idl
-MAIL_IDL = Evolution-Mail.idl
-MAIL_IDL_GENERATED_H = \
- Evolution-Mail.h
-MAIL_IDL_GENERATED_C = \
- Evolution-Mail-common.c \
- Evolution-Mail-skels.c \
- Evolution-Mail-stubs.c
-MAIL_IDL_GENERATED = $(MAIL_IDL_GENERATED_C) $(MAIL_IDL_GENERATED_H)
-
-$(MAIL_IDL_GENERATED_H): $(MAIL_IDL)
- $(ORBIT_IDL) -I $(top_srcdir) -I $(datadir)/idl $(IDL_INCLUDES) $^
-$(MAIL_IDL_GENERATED_C): $(MAIL_IDL_GENERATED_H)
-
-# IDL install
-
-idl_DATA = $(MAIL_IDL)
-
-# plugin mail api
-mailinclude_HEADERS = \
- $(MAIL_IDL_GENERATED_H) \
- e-mail-attachment-bar.h \
- e-searching-tokenizer.h \
- em-account-editor.h \
- e-mail-search-bar.h \
- em-composer-utils.h \
- em-config.h \
- em-event.h \
- em-filter-context.h \
- em-filter-editor.h \
- em-filter-folder-element.h \
- em-filter-rule.h \
- em-filter-source-element.h \
- em-folder-browser.h \
- em-folder-tree-model.h \
- em-folder-tree.h \
- em-folder-utils.h \
- em-folder-view.h \
- em-format-hook.h \
- em-format-html-display.h \
- em-format-html-print.h \
- em-format-html.h \
- em-format-quote.h \
- em-format.h \
- em-html-stream.h \
- em-icon-stream.h \
- em-inline-filter.h \
- em-junk-hook.h \
- em-menu.h \
- em-message-browser.h \
- em-popup.h \
- em-search-context.h \
- em-stripsig-filter.h \
- em-sync-stream.h \
- em-utils.h \
- mail-autofilter.h \
- mail-component.h \
- mail-config.h \
- mail-folder-cache.h \
- mail-mt.h \
- mail-ops.h \
- mail-send-recv.h \
- mail-session.h \
- mail-tools.h \
- message-list.h \
- mail-vfolder.h
-
-# libevolution-mail
-
-libevolution_mail_la_SOURCES = \
- $(MAIL_IDL_GENERATED) \
- $(mailinclude_HEADERS) \
- e-attachment-handler-mail.c \
- e-attachment-handler-mail.h \
- e-mail-attachment-bar.c \
- e-mail-search-bar.c \
- e-searching-tokenizer.c \
- em-account-prefs.c \
- em-account-prefs.h \
- em-composer-prefs.c \
- em-composer-prefs.h \
- em-folder-browser.c \
- em-folder-view.c \
- em-format-hook.c \
- em-format-html-display.c \
- em-format-html-print.c \
- em-format-html.c \
- em-html-stream.c \
- em-junk-hook.c \
- em-mailer-prefs.c \
- em-mailer-prefs.h \
- em-menu.c \
- em-message-browser.c \
- em-migrate.c \
- em-migrate.h \
- em-network-prefs.c \
- em-network-prefs.h \
- em-subscribe-editor.c \
- em-subscribe-editor.h \
- mail-component-factory.c \
- mail-component.c \
- mail-config-factory.c \
- mail-config-factory.h \
- mail-signature-editor.c \
- mail-signature-editor.h \
- mail-types.h \
- message-list.c
if ENABLE_SMIME
-SMIME_LIBS = \
+SMIME_LIBS = \
$(top_builddir)/smime/lib/libessmime.la \
$(top_builddir)/smime/gui/libevolution-smime.la
endif
-
-libevolution_mail_la_LIBADD = \
- $(top_builddir)/mail/libevolution-mail-shared.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/shell/libeshell.la \
- $(top_builddir)/widgets/table/libetable.la \
- $(top_builddir)/widgets/text/libetext.la \
- $(top_builddir)/widgets/misc/libemiscwidgets.la \
- $(top_builddir)/widgets/misc/libefilterbar.la \
- $(top_builddir)/filter/libfilter.la \
- $(top_builddir)/widgets/menus/libmenus.la \
- $(top_builddir)/addressbook/util/libeabutil.la \
+libevolution_module_mail_la_LIBADD = \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/shell/libeshell.la \
+ $(top_builddir)/composer/libcomposer.la \
+ $(top_builddir)/widgets/table/libetable.la \
+ $(top_builddir)/widgets/text/libetext.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
$(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \
$(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \
- $(top_builddir)/mail/importers/libevolution-mail-importers.la \
- $(SMIME_LIBS) \
- $(EVOLUTION_MAIL_LIBS) \
- $(GTKHTML_LIBS) \
- $(REGEX_LIBS) \
- $(THREADS_LIBS)
-
-libevolution_mail_la_LDFLAGS = \
+ $(SMIME_LIBS)
+
+#libevolution_mail_la_LIBADD = \
+# $(top_builddir)/widgets/misc/libefilterbar.la \
+# $(top_builddir)/filter/libfilter.la \
+# $(top_builddir)/widgets/menus/libmenus.la \
+# $(top_builddir)/addressbook/util/libeabutil.la \
+# $(EVOLUTION_MAIL_LIBS) \
+# $(GTKHTML_LIBS) \
+# $(REGEX_LIBS) \
+# $(THREADS_LIBS)
+
+libevolution_module_mail_la_LDFLAGS = \
-avoid-version -module $(NO_UNDEFINED)
-libevolution_mail_la_DEPENDENCIES = em-filter-i18n.h
-
-# .server files
-
-libevolution_mail_shared_la_SOURCES = \
- em-account-editor.c \
- em-account-editor.h \
- em-event.c \
- em-config.c \
- em-composer-utils.c \
- em-composer-utils.h \
- em-filter-context.c \
- em-filter-context.h \
- em-filter-editor.c \
- em-filter-editor.h \
- em-filter-folder-element.c \
- em-filter-folder-element.h \
- em-filter-rule.c \
- em-filter-rule.h \
- em-filter-source-element.c \
- em-filter-source-element.h \
- em-folder-tree-model.c \
- em-folder-tree.c \
- em-folder-properties.c \
- em-folder-properties.h \
- em-folder-selection-button.c \
- em-folder-selection-button.h \
- em-folder-selection.c \
- em-folder-selection.h \
- em-folder-selector.c \
- em-folder-selector.h \
- em-folder-utils.c \
- em-format-quote.c \
- em-format.c \
- em-icon-stream.c \
- em-inline-filter.c \
- em-popup.c \
- em-search-context.c \
- em-search-context.h \
- em-stripsig-filter.c \
- em-sync-stream.c \
- em-utils.c \
- em-vfolder-context.c \
- em-vfolder-context.h \
- em-vfolder-editor.c \
- em-vfolder-editor.h \
- em-vfolder-rule.c \
- em-vfolder-rule.h \
- mail-autofilter.c \
- mail-config.c \
- mail-crypto.c \
- mail-crypto.h \
- mail-folder-cache.c \
- mail-folder-cache.h \
- mail-ops.c \
- mail-mt.c \
- mail-send-recv.c \
- mail-send-recv.h \
- mail-session.c \
- mail-tools.c \
- mail-vfolder.c \
- message-tag-editor.c \
- message-tag-editor.h \
- message-tag-followup.c \
- message-tag-followup.h
-
-
-
-
-
-
-libevolution_mail_shared_la_LIBADD = \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/widgets/misc/libemiscwidgets.la \
- $(top_builddir)/composer/libcomposer.la \
- $(top_builddir)/filter/libfilter.la \
- $(top_builddir)/widgets/menus/libmenus.la \
- $(SMIME_LIBS) \
- $(THREADS_LIBS)
-
-libevolution_mail_shared_la_LDFLAGS = \
- -avoid-version -module $(NO_UNDEFINED)
-
-
-
-server_in_files = GNOME_Evolution_Mail.server.in.in
-server_DATA = $(server_in_files:.server.in.in=.server)
-
-@EVO_SERVER_RULE@
-@INTLTOOL_SERVER_RULE@
+#libevolution_mail_la_DEPENDENCIES = em-filter-i18n.h
# Misc data to install
filterdir = $(privdatadir)
@@ -284,7 +234,6 @@ etspec_DATA = message-list.etspec
EXTRA_DIST = \
ChangeLog.pre-1-4 \
README.async \
- $(MAIL_IDL) \
mail.error.xml \
$(glade_DATA) \
$(schema_in_files) \
@@ -340,7 +289,7 @@ endif
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
-BUILT_SOURCES = $(MAIL_IDL_GENERATED) $(server_DATA) $(error_DATA)
+BUILT_SOURCES = $(error_DATA)
CLEANFILES = $(BUILT_SOURCES)
diff --git a/mail/e-mail-attachment-bar.c b/mail/e-mail-attachment-bar.c
index e3656e1223..fd53292610 100644
--- a/mail/e-mail-attachment-bar.c
+++ b/mail/e-mail-attachment-bar.c
@@ -98,6 +98,7 @@ mail_attachment_bar_update_status (EMailAttachmentBar *bar)
{
EAttachmentView *view;
EAttachmentStore *store;
+ GtkActivatable *activatable;
GtkExpander *expander;
GtkAction *action;
GtkLabel *label;
@@ -106,8 +107,6 @@ mail_attachment_bar_update_status (EMailAttachmentBar *bar)
gchar *display_size;
gchar *markup;
- GtkActivatable *activatable;
-
view = E_ATTACHMENT_VIEW (bar);
store = e_attachment_view_get_store (view);
expander = GTK_EXPANDER (bar->priv->expander);
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
new file mode 100644
index 0000000000..e4013c5004
--- /dev/null
+++ b/mail/e-mail-browser.c
@@ -0,0 +1,751 @@
+/*
+ * e-mail-browser.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-browser.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <camel/camel-folder.h>
+
+#include "e-util/e-util.h"
+#include "e-util/gconf-bridge.h"
+#include "shell/e-shell.h"
+
+#include "mail/e-mail-reader.h"
+#include "mail/e-mail-reader-utils.h"
+#include "mail/e-mail-search-bar.h"
+#include "mail/e-mail-shell-backend.h"
+#include "mail/em-folder-tree-model.h"
+#include "mail/em-format-html-display.h"
+#include "mail/message-list.h"
+
+#define E_MAIL_BROWSER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_BROWSER, EMailBrowserPrivate))
+
+#define MAIL_BROWSER_GCONF_PREFIX "/apps/evolution/mail/mail_browser"
+
+struct _EMailBrowserPrivate {
+ GtkUIManager *ui_manager;
+ EShellBackend *shell_backend;
+ GtkActionGroup *action_group;
+ EMFormatHTMLDisplay *html_display;
+
+ GtkWidget *main_menu;
+ GtkWidget *main_toolbar;
+ GtkWidget *message_list;
+ GtkWidget *search_bar;
+ GtkWidget *statusbar;
+
+ guint show_deleted : 1;
+};
+
+enum {
+ PROP_0,
+ PROP_SHELL_BACKEND,
+ PROP_SHOW_DELETED,
+ PROP_UI_MANAGER
+};
+
+static gpointer parent_class;
+
+/* This is too trivial to put in a file.
+ * It gets merged with the EMailReader UI. */
+static const gchar *ui =
+"<ui>"
+" <menubar name='main-menu'>"
+" <menu action='file-menu'>"
+" <placeholder name='file-actions'/>"
+" <placeholder name='print-actions'/>"
+" <separator/>"
+" <menuitem action='close'/>"
+" </menu>"
+" </menubar>"
+"</ui>";
+
+static void
+action_close_cb (GtkAction *action,
+ EMailBrowser *browser)
+{
+ e_mail_browser_close (browser);
+}
+
+static GtkActionEntry mail_browser_entries[] = {
+
+ { "close",
+ GTK_STOCK_CLOSE,
+ NULL,
+ NULL,
+ N_("Close this window"),
+ G_CALLBACK (action_close_cb) },
+
+ /*** Menus ***/
+
+ { "file-menu",
+ NULL,
+ N_("_File"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "edit-menu",
+ NULL,
+ N_("_Edit"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "view-menu",
+ NULL,
+ N_("_View"),
+ NULL,
+ NULL,
+ NULL }
+};
+
+static void
+mail_browser_menu_item_select_cb (EMailBrowser *browser,
+ GtkWidget *menu_item)
+{
+ GtkAction *action;
+ GtkStatusbar *statusbar;
+ gchar *tooltip = NULL;
+ guint context_id;
+ gpointer data;
+
+ action = g_object_get_data (G_OBJECT (menu_item), "action");
+ g_return_if_fail (GTK_IS_ACTION (action));
+
+ data = g_object_get_data (G_OBJECT (menu_item), "context-id");
+ context_id = GPOINTER_TO_UINT (data);
+
+ g_object_get (action, "tooltip", &tooltip, NULL);
+
+ if (tooltip == NULL)
+ return;
+
+ statusbar = GTK_STATUSBAR (browser->priv->statusbar);
+ gtk_statusbar_push (statusbar, context_id, tooltip);
+}
+
+static void
+mail_browser_menu_item_deselect_cb (EMailBrowser *browser,
+ GtkWidget *menu_item)
+{
+ GtkStatusbar *statusbar;
+ guint context_id;
+ gpointer data;
+
+ data = g_object_get_data (G_OBJECT (menu_item), "context-id");
+ context_id = GPOINTER_TO_UINT (data);
+
+ statusbar = GTK_STATUSBAR (browser->priv->statusbar);
+ gtk_statusbar_pop (statusbar, context_id);
+}
+
+static void
+mail_browser_connect_proxy_cb (EMailBrowser *browser,
+ GtkAction *action,
+ GtkWidget *proxy)
+{
+ GtkStatusbar *statusbar;
+ guint context_id;
+
+ if (!GTK_IS_MENU_ITEM (proxy))
+ return;
+
+ statusbar = GTK_STATUSBAR (browser->priv->statusbar);
+ context_id = gtk_statusbar_get_context_id (statusbar, G_STRFUNC);
+
+ g_object_set_data_full (
+ G_OBJECT (proxy),
+ "action", g_object_ref (action),
+ (GDestroyNotify) g_object_unref);
+
+ g_object_set_data (
+ G_OBJECT (proxy), "context-id",
+ GUINT_TO_POINTER (context_id));
+
+ g_signal_connect_swapped (
+ proxy, "select",
+ G_CALLBACK (mail_browser_menu_item_select_cb), browser);
+
+ g_signal_connect_swapped (
+ proxy, "deselect",
+ G_CALLBACK (mail_browser_menu_item_deselect_cb), browser);
+}
+
+static void
+mail_browser_message_selected_cb (EMailBrowser *browser,
+ const gchar *uid)
+{
+ EMFormatHTMLDisplay *html_display;
+ MessageList *message_list;
+ CamelMessageInfo *info;
+ EMailReader *reader;
+
+ if (uid == NULL)
+ return;
+
+ reader = E_MAIL_READER (browser);
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+ info = camel_folder_get_message_info (message_list->folder, uid);
+
+ if (info == NULL)
+ return;
+
+ gtk_window_set_title (
+ GTK_WINDOW (browser),
+ camel_message_info_subject (info));
+ gtk_widget_grab_focus (
+ GTK_WIDGET (((EMFormatHTML *) html_display)->html));
+
+ camel_folder_free_message_info (message_list->folder, info);
+}
+
+static void
+mail_browser_status_message_cb (EMailBrowser *browser,
+ const gchar *status_message)
+{
+ GtkStatusbar *statusbar;
+ guint context_id;
+
+ statusbar = GTK_STATUSBAR (browser->priv->statusbar);
+ context_id = gtk_statusbar_get_context_id (statusbar, G_STRFUNC);
+
+ /* Always pop first. This prevents messages from piling up. */
+ gtk_statusbar_pop (statusbar, context_id);
+
+ if (status_message != NULL && *status_message != '\0')
+ gtk_statusbar_push (statusbar, context_id, status_message);
+}
+
+static void
+mail_browser_set_shell_backend (EMailBrowser *browser,
+ EShellBackend *shell_backend)
+{
+ g_return_if_fail (browser->priv->shell_backend == NULL);
+
+ browser->priv->shell_backend = g_object_ref (shell_backend);
+}
+
+static void
+mail_browser_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHELL_BACKEND:
+ mail_browser_set_shell_backend (
+ E_MAIL_BROWSER (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SHOW_DELETED:
+ e_mail_browser_set_show_deleted (
+ E_MAIL_BROWSER (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_browser_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHELL_BACKEND:
+ g_value_set_object (
+ value, e_mail_reader_get_shell_backend (
+ E_MAIL_READER (object)));
+ return;
+
+ case PROP_SHOW_DELETED:
+ g_value_set_boolean (
+ value, e_mail_browser_get_show_deleted (
+ E_MAIL_BROWSER (object)));
+ return;
+
+ case PROP_UI_MANAGER:
+ g_value_set_object (
+ value, e_mail_browser_get_ui_manager (
+ E_MAIL_BROWSER (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_browser_dispose (GObject *object)
+{
+ EMailBrowserPrivate *priv;
+
+ priv = E_MAIL_BROWSER_GET_PRIVATE (object);
+
+ if (priv->ui_manager != NULL) {
+ g_object_unref (priv->ui_manager);
+ priv->ui_manager = NULL;
+ }
+
+ if (priv->shell_backend != NULL) {
+ g_object_unref (priv->shell_backend);
+ priv->shell_backend = NULL;
+ }
+
+ if (priv->action_group != NULL) {
+ g_object_unref (priv->action_group);
+ priv->action_group = NULL;
+ }
+
+ if (priv->html_display != NULL) {
+ g_object_unref (priv->html_display);
+ priv->html_display = NULL;
+ }
+
+ if (priv->main_menu != NULL) {
+ g_object_unref (priv->main_menu);
+ priv->main_menu = NULL;
+ }
+
+ if (priv->main_toolbar != NULL) {
+ g_object_unref (priv->main_toolbar);
+ priv->main_toolbar = NULL;
+ }
+
+ if (priv->message_list != NULL) {
+ g_object_unref (priv->message_list);
+ priv->message_list = NULL;
+ }
+
+ if (priv->search_bar != NULL) {
+ g_object_unref (priv->search_bar);
+ priv->search_bar = NULL;
+ }
+
+ if (priv->statusbar != NULL) {
+ g_object_unref (priv->statusbar);
+ priv->statusbar = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+mail_browser_constructed (GObject *object)
+{
+ EMFormatHTMLDisplay *html_display;
+ EMailBrowserPrivate *priv;
+ EMailReader *reader;
+ EShellBackend *shell_backend;
+ EShell *shell;
+ GConfBridge *bridge;
+ GtkAccelGroup *accel_group;
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+ GtkWidget *container;
+ GtkWidget *widget;
+ GtkHTML *html;
+ const gchar *domain;
+ const gchar *key;
+ guint merge_id;
+
+ priv = E_MAIL_BROWSER_GET_PRIVATE (object);
+
+ reader = E_MAIL_READER (object);
+ ui_manager = priv->ui_manager;
+ domain = GETTEXT_PACKAGE;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ shell_backend = e_mail_reader_get_shell_backend (reader);
+
+ shell = e_shell_backend_get_shell (shell_backend);
+ e_shell_watch_window (shell, GTK_WINDOW (object));
+
+ html = EM_FORMAT_HTML (html_display)->html;
+
+ /* The message list is a widget, but it is not shown in the browser.
+ * Unfortunately, the widget is inseparable from its model, and the
+ * model is all we need. */
+ priv->message_list = message_list_new (shell_backend);
+ g_object_ref_sink (priv->message_list);
+
+ g_signal_connect_swapped (
+ priv->message_list, "message-selected",
+ G_CALLBACK (mail_browser_message_selected_cb), object);
+
+ g_signal_connect_swapped (
+ html, "status-message",
+ G_CALLBACK (mail_browser_status_message_cb), object);
+
+ e_mail_reader_init (reader);
+
+ action_group = priv->action_group;
+ gtk_action_group_set_translation_domain (action_group, domain);
+ gtk_action_group_add_actions (
+ action_group, mail_browser_entries,
+ G_N_ELEMENTS (mail_browser_entries), object);
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+
+ e_load_ui_definition (ui_manager, E_MAIL_READER_UI_DEFINITION);
+ gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
+
+ merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ e_mail_reader_create_charset_menu (reader, ui_manager, merge_id);
+
+ accel_group = gtk_ui_manager_get_accel_group (ui_manager);
+ gtk_window_add_accel_group (GTK_WINDOW (object), accel_group);
+
+ g_signal_connect_swapped (
+ ui_manager, "connect-proxy",
+ G_CALLBACK (mail_browser_connect_proxy_cb), object);
+
+ /* Construct window widgets. */
+
+ widget = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (object), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ /* Create the status bar before connecting proxy widgets. */
+ widget = gtk_statusbar_new ();
+ gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ priv->statusbar = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = e_mail_search_bar_new (EM_FORMAT_HTML (html_display)->html);
+ gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ priv->search_bar = g_object_ref (widget);
+ gtk_widget_hide (widget);
+
+ g_signal_connect_swapped (
+ widget, "changed",
+ G_CALLBACK (em_format_redraw), html_display);
+
+ widget = gtk_ui_manager_get_widget (ui_manager, "/main-menu");
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ priv->main_menu = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_ui_manager_get_widget (ui_manager, "/main-toolbar");
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ priv->main_toolbar = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = GTK_WIDGET (EM_FORMAT_HTML (html_display)->html);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ gtk_widget_show (widget);
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (reader);
+ key = "/apps/evolution/mail/display/show_deleted";
+ gconf_bridge_bind_property (bridge, key, object, "show-deleted");
+}
+
+static gboolean
+mail_browser_key_press_event (GtkWidget *widget,
+ GdkEventKey *event)
+{
+ if (event->keyval == GDK_Escape) {
+ e_mail_browser_close (E_MAIL_BROWSER (widget));
+ return TRUE;
+ }
+
+ /* Chain up to parent's key_press_event() method. */
+ return GTK_WIDGET_CLASS (parent_class)->
+ key_press_event (widget, event);
+}
+
+static GtkActionGroup *
+mail_browser_get_action_group (EMailReader *reader)
+{
+ EMailBrowserPrivate *priv;
+
+ priv = E_MAIL_BROWSER_GET_PRIVATE (reader);
+
+ return priv->action_group;
+}
+
+static gboolean
+mail_browser_get_hide_deleted (EMailReader *reader)
+{
+ EMailBrowser *browser;
+
+ browser = E_MAIL_BROWSER (reader);
+
+ return !e_mail_browser_get_show_deleted (browser);
+}
+
+static EMFormatHTMLDisplay *
+mail_browser_get_html_display (EMailReader *reader)
+{
+ EMailBrowserPrivate *priv;
+
+ priv = E_MAIL_BROWSER_GET_PRIVATE (reader);
+
+ return priv->html_display;
+}
+
+static MessageList *
+mail_browser_get_message_list (EMailReader *reader)
+{
+ EMailBrowserPrivate *priv;
+
+ priv = E_MAIL_BROWSER_GET_PRIVATE (reader);
+
+ return MESSAGE_LIST (priv->message_list);
+}
+
+static EShellBackend *
+mail_browser_get_shell_backend (EMailReader *reader)
+{
+ EMailBrowserPrivate *priv;
+
+ priv = E_MAIL_BROWSER_GET_PRIVATE (reader);
+
+ return priv->shell_backend;
+}
+
+static GtkWindow *
+mail_browser_get_window (EMailReader *reader)
+{
+ return GTK_WINDOW (reader);
+}
+
+static void
+mail_browser_set_message (EMailReader *reader,
+ const gchar *uid,
+ gboolean mark_read)
+{
+ EMailReaderIface *iface;
+ MessageList *message_list;
+ CamelMessageInfo *info;
+ CamelFolder *folder;
+
+ /* Chain up to parent's set_message() method. */
+ iface = g_type_default_interface_peek (E_TYPE_MAIL_READER);
+ iface->set_message (reader, uid, mark_read);
+
+ if (uid == NULL) {
+ e_mail_browser_close (E_MAIL_BROWSER (reader));
+ return;
+ }
+
+ message_list = e_mail_reader_get_message_list (reader);
+
+ folder = message_list->folder;
+ info = camel_folder_get_message_info (folder, uid);
+
+ if (info != NULL) {
+ gtk_window_set_title (
+ GTK_WINDOW (reader),
+ camel_message_info_subject (info));
+ camel_folder_free_message_info (folder, info);
+ }
+
+ if (mark_read)
+ e_mail_reader_mark_as_read (reader, uid);
+}
+
+static void
+mail_browser_show_search_bar (EMailReader *reader)
+{
+ EMailBrowserPrivate *priv;
+
+ priv = E_MAIL_BROWSER_GET_PRIVATE (reader);
+
+ gtk_widget_show (priv->search_bar);
+}
+
+static void
+mail_browser_class_init (EMailBrowserClass *class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMailBrowserPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = mail_browser_set_property;
+ object_class->get_property = mail_browser_get_property;
+ object_class->dispose = mail_browser_dispose;
+ object_class->constructed = mail_browser_constructed;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->key_press_event = mail_browser_key_press_event;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_BACKEND,
+ g_param_spec_object (
+ "shell-backend",
+ _("Shell Module"),
+ _("The mail shell backend"),
+ E_TYPE_SHELL_BACKEND,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHOW_DELETED,
+ g_param_spec_boolean (
+ "show-deleted",
+ _("Show Deleted"),
+ _("Show deleted messages"),
+ FALSE,
+ G_PARAM_READWRITE));
+}
+
+static void
+mail_browser_iface_init (EMailReaderIface *iface)
+{
+ iface->get_action_group = mail_browser_get_action_group;
+ iface->get_hide_deleted = mail_browser_get_hide_deleted;
+ iface->get_html_display = mail_browser_get_html_display;
+ iface->get_message_list = mail_browser_get_message_list;
+ iface->get_shell_backend = mail_browser_get_shell_backend;
+ iface->get_window = mail_browser_get_window;
+ iface->set_message = mail_browser_set_message;
+ iface->show_search_bar = mail_browser_show_search_bar;
+}
+
+static void
+mail_browser_init (EMailBrowser *browser)
+{
+ GConfBridge *bridge;
+ const gchar *prefix;
+
+ browser->priv = E_MAIL_BROWSER_GET_PRIVATE (browser);
+
+ browser->priv->ui_manager = gtk_ui_manager_new ();
+ browser->priv->action_group = gtk_action_group_new ("mail-browser");
+ browser->priv->html_display = em_format_html_display_new ();
+
+ bridge = gconf_bridge_get ();
+ prefix = "/apps/evolution/mail/mail_browser";
+ gconf_bridge_bind_window_size (bridge, prefix, GTK_WINDOW (browser));
+
+ gtk_window_set_title (GTK_WINDOW (browser), _("Evolution"));
+}
+
+GType
+e_mail_browser_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMailBrowserClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_browser_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMailBrowser),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mail_browser_init,
+ NULL /* value_table */
+ };
+
+ static const GInterfaceInfo iface_info = {
+ (GInterfaceInitFunc) mail_browser_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL /* interface_data */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_WINDOW, "EMailBrowser", &type_info, 0);
+
+ g_type_add_interface_static (
+ type, E_TYPE_MAIL_READER, &iface_info);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_mail_browser_new (EMailShellBackend *mail_shell_backend)
+{
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
+
+ return g_object_new (
+ E_TYPE_MAIL_BROWSER,
+ "shell-backend", mail_shell_backend, NULL);
+}
+
+void
+e_mail_browser_close (EMailBrowser *browser)
+{
+ g_return_if_fail (E_IS_MAIL_BROWSER (browser));
+
+ gtk_widget_destroy (GTK_WIDGET (browser));
+}
+
+gboolean
+e_mail_browser_get_show_deleted (EMailBrowser *browser)
+{
+ g_return_val_if_fail (E_IS_MAIL_BROWSER (browser), FALSE);
+
+ return browser->priv->show_deleted;
+}
+
+void
+e_mail_browser_set_show_deleted (EMailBrowser *browser,
+ gboolean show_deleted)
+{
+ g_return_if_fail (E_IS_MAIL_BROWSER (browser));
+
+ browser->priv->show_deleted = show_deleted;
+
+ g_object_notify (G_OBJECT (browser), "show-deleted");
+}
+
+GtkUIManager *
+e_mail_browser_get_ui_manager (EMailBrowser *browser)
+{
+ g_return_val_if_fail (E_IS_MAIL_BROWSER (browser), NULL);
+
+ return browser->priv->ui_manager;
+}
diff --git a/mail/e-mail-browser.h b/mail/e-mail-browser.h
new file mode 100644
index 0000000000..2605b2e04c
--- /dev/null
+++ b/mail/e-mail-browser.h
@@ -0,0 +1,72 @@
+/*
+ * e-mail-browser.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_BROWSER_H
+#define E_MAIL_BROWSER_H
+
+#include <gtk/gtk.h>
+#include <mail/e-mail-shell-backend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_BROWSER \
+ (e_mail_browser_get_type ())
+#define E_MAIL_BROWSER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_BROWSER, EMailBrowser))
+#define E_MAIL_BROWSER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_BROWSER, EMailBrowserClass))
+#define E_IS_MAIL_BROWSER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_BROWSER))
+#define E_IS_MAIL_BROWSER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_BROWSER))
+#define E_MAIL_BROWSER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_BROWSER, EMailBrowserClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailBrowser EMailBrowser;
+typedef struct _EMailBrowserClass EMailBrowserClass;
+typedef struct _EMailBrowserPrivate EMailBrowserPrivate;
+
+struct _EMailBrowser {
+ GtkWindow parent;
+ EMailBrowserPrivate *priv;
+};
+
+struct _EMailBrowserClass {
+ GtkWindowClass parent_class;
+};
+
+GType e_mail_browser_get_type (void);
+GtkWidget * e_mail_browser_new (EMailShellBackend *mail_shell_backend);
+void e_mail_browser_close (EMailBrowser *browser);
+gboolean e_mail_browser_get_show_deleted (EMailBrowser *browser);
+void e_mail_browser_set_show_deleted (EMailBrowser *browser,
+ gboolean show_deleted);
+GtkUIManager * e_mail_browser_get_ui_manager (EMailBrowser *browser);
+
+G_END_DECLS
+
+#endif /* E_MAIL_BROWSER_H */
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
new file mode 100644
index 0000000000..95073305af
--- /dev/null
+++ b/mail/e-mail-display.c
@@ -0,0 +1,627 @@
+/*
+ * e-mail-display.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-display.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+
+#include "e-util/e-util.h"
+
+#define E_MAIL_DISPLAY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_DISPLAY, EMailDisplayPrivate))
+
+struct _EMailDisplayPrivate {
+ EMFormatHTML *formatter;
+};
+
+enum {
+ PROP_0,
+ PROP_ANIMATE,
+ PROP_CARET_MODE,
+ PROP_FORMATTER
+};
+
+enum {
+ POPUP_EVENT,
+ STATUS_MESSAGE,
+ LAST_SIGNAL
+};
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+
+static gboolean
+mail_display_emit_popup_event (EMailDisplay *display,
+ GdkEventButton *event,
+ const gchar *uri,
+ EMFormatPURI *puri)
+{
+ CamelMimePart *mime_part;
+ gboolean stop_handlers = FALSE;
+
+ mime_part = (puri != NULL) ? puri->part : NULL;
+
+ g_signal_emit (
+ display, signals[POPUP_EVENT], 0,
+ event, uri, mime_part, &stop_handlers);
+
+ return stop_handlers;
+}
+
+static void
+mail_display_emit_status_message (EMailDisplay *display,
+ const gchar *status_message)
+{
+ g_signal_emit (display, signals[STATUS_MESSAGE], 0, status_message);
+}
+
+static void
+mail_display_get_uri_puri (EMailDisplay *display,
+ GdkEventButton *event,
+ gchar **uri,
+ EMFormatPURI **puri)
+{
+ EMFormat *formatter;
+ GtkHTML *html;
+ gchar *text_uri;
+ gchar *image_uri;
+ gboolean is_cid;
+
+ html = GTK_HTML (display);
+ formatter = EM_FORMAT (display->priv->formatter);
+
+ if (event != NULL) {
+ text_uri = gtk_html_get_url_at (html, event->x, event->y);
+ image_uri = gtk_html_get_image_src_at (html, event->x, event->y);
+ } else {
+ text_uri = gtk_html_get_cursor_url (html);
+ image_uri = gtk_html_get_cursor_image_src (html);
+ }
+
+ is_cid = (image_uri != NULL) &&
+ (g_ascii_strncasecmp (image_uri, "cid:", 4) == 0);
+
+ if (image_uri != NULL) {
+ if (strstr (image_uri, "://") == NULL && !is_cid) {
+ gchar *temp;
+
+ temp = g_strconcat ("file://", image_uri, NULL);
+ g_free (image_uri);
+ temp = image_uri;
+ }
+ }
+
+ if (puri != NULL) {
+ if (text_uri != NULL)
+ *puri = em_format_find_puri (formatter, text_uri);
+
+ if (*puri == NULL && image_uri != NULL)
+ *puri = em_format_find_puri (formatter, image_uri);
+ }
+
+ if (uri != NULL) {
+ *uri = NULL;
+ if (is_cid) {
+ if (text_uri != NULL)
+ *uri = g_strdup_printf (
+ "%s\n%s", text_uri, image_uri);
+ else {
+ *uri = image_uri;
+ image_uri = NULL;
+ }
+ } else {
+ *uri = text_uri;
+ text_uri = NULL;
+ }
+ }
+
+ g_free (text_uri);
+ g_free (image_uri);
+}
+
+static void
+mail_display_update_formatter_colors (EMailDisplay *display)
+{
+ EMFormatHTMLColorType type;
+ EMFormatHTML *formatter;
+ GdkColor *color;
+ GtkStyle *style;
+ gint state;
+
+ state = GTK_WIDGET_STATE (display);
+ formatter = display->priv->formatter;
+
+ style = gtk_widget_get_style (GTK_WIDGET (display));
+ if (style == NULL)
+ return;
+
+ g_object_freeze_notify (G_OBJECT (formatter));
+
+ color = &style->bg[state];
+ type = EM_FORMAT_HTML_COLOR_BODY;
+ em_format_html_set_color (formatter, type, color);
+
+ color = &style->base[GTK_STATE_NORMAL];
+ type = EM_FORMAT_HTML_COLOR_CONTENT;
+ em_format_html_set_color (formatter, type, color);
+
+ color = &style->dark[state];
+ type = EM_FORMAT_HTML_COLOR_FRAME;
+ em_format_html_set_color (formatter, type, color);
+
+ color = &style->fg[state];
+ type = EM_FORMAT_HTML_COLOR_HEADER;
+ em_format_html_set_color (formatter, type, color);
+
+ color = &style->text[state];
+ type = EM_FORMAT_HTML_COLOR_TEXT;
+ em_format_html_set_color (formatter, type, color);
+
+ g_object_thaw_notify (G_OBJECT (formatter));
+}
+
+static void
+mail_display_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ANIMATE:
+ e_mail_display_set_animate (
+ E_MAIL_DISPLAY (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_CARET_MODE:
+ e_mail_display_set_caret_mode (
+ E_MAIL_DISPLAY (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_FORMATTER:
+ e_mail_display_set_formatter (
+ E_MAIL_DISPLAY (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_display_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ANIMATE:
+ g_value_set_boolean (
+ value, e_mail_display_get_animate (
+ E_MAIL_DISPLAY (object)));
+ return;
+
+ case PROP_CARET_MODE:
+ g_value_set_boolean (
+ value, e_mail_display_get_caret_mode (
+ E_MAIL_DISPLAY (object)));
+ return;
+
+ case PROP_FORMATTER:
+ g_value_set_object (
+ value, e_mail_display_get_formatter (
+ E_MAIL_DISPLAY (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_display_dispose (GObject *object)
+{
+ EMailDisplayPrivate *priv;
+
+ priv = E_MAIL_DISPLAY_GET_PRIVATE (object);
+
+ if (priv->formatter) {
+ g_object_unref (priv->formatter);
+ priv->formatter = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+mail_display_realize (GtkWidget *widget)
+{
+ /* Chain up to parent's realize() method. */
+ GTK_WIDGET_CLASS (parent_class)->realize (widget);
+
+ mail_display_update_formatter_colors (E_MAIL_DISPLAY (widget));
+}
+
+static void
+mail_display_style_set (GtkWidget *widget,
+ GtkStyle *previous_style)
+{
+ EMailDisplayPrivate *priv;
+
+ priv = E_MAIL_DISPLAY_GET_PRIVATE (widget);
+
+ /* Chain up to parent's style_set() method. */
+ GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
+
+ mail_display_update_formatter_colors (E_MAIL_DISPLAY (widget));
+ em_format_redraw (EM_FORMAT (priv->formatter));
+}
+
+static gboolean
+mail_display_button_press_event (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ if (event->button == 3) {
+ EMailDisplay *display;
+ EMFormatPURI *puri = NULL;
+ gboolean stop_handlers = TRUE;
+ gchar *uri = NULL;
+
+ display = E_MAIL_DISPLAY (widget);
+ mail_display_get_uri_puri (display, event, &uri, &puri);
+
+ if (uri == NULL || !g_str_has_prefix (uri, "##"))
+ stop_handlers = mail_display_emit_popup_event (
+ display, event, uri, puri);
+
+ g_free (uri);
+
+ if (stop_handlers)
+ return TRUE;
+ }
+
+ /* Chain up to parent's button_press_event() method. */
+ return GTK_WIDGET_CLASS (parent_class)->
+ button_press_event (widget, event);
+}
+
+static gboolean
+mail_display_scroll_event (GtkWidget *widget,
+ GdkEventScroll *event)
+{
+ if (event->state & GDK_CONTROL_MASK) {
+ switch (event->direction) {
+ case GDK_SCROLL_UP:
+ gtk_html_zoom_in (GTK_HTML (widget));
+ return TRUE;
+ case GDK_SCROLL_DOWN:
+ gtk_html_zoom_out (GTK_HTML (widget));
+ return TRUE;
+ default:
+ break;
+ }
+ }
+
+ return FALSE;
+}
+
+static void
+mail_display_link_clicked (GtkHTML *html,
+ const gchar *uri)
+{
+ EMailDisplayPrivate *priv;
+
+ priv = E_MAIL_DISPLAY_GET_PRIVATE (html);
+ g_return_if_fail (priv->formatter != NULL);
+
+ if (g_str_has_prefix (uri, "##")) {
+ guint32 flags;
+
+ flags = priv->formatter->header_wrap_flags;
+
+ if (strcmp (uri, "##TO##") == 0) {
+ if (!(flags & EM_FORMAT_HTML_HEADER_TO))
+ flags |= EM_FORMAT_HTML_HEADER_TO;
+ else
+ flags &= ~EM_FORMAT_HTML_HEADER_TO;
+ } else if (strcmp (uri, "##CC##") == 0) {
+ if (!(flags & EM_FORMAT_HTML_HEADER_CC))
+ flags |= EM_FORMAT_HTML_HEADER_CC;
+ else
+ flags |= EM_FORMAT_HTML_HEADER_CC;
+ } else if (strcmp (uri, "##BCC##") == 0) {
+ if (!(flags & EM_FORMAT_HTML_HEADER_BCC))
+ flags |= EM_FORMAT_HTML_HEADER_BCC;
+ else
+ flags |= EM_FORMAT_HTML_HEADER_BCC;
+ }
+
+ priv->formatter->header_wrap_flags = flags;
+ em_format_redraw (EM_FORMAT (priv->formatter));
+
+ } else if (*uri == '#')
+ gtk_html_jump_to_anchor (html, uri + 1);
+
+ else if (g_ascii_strncasecmp (uri, "thismessage:", 12) == 0)
+ /* ignore */ ;
+
+ else if (g_ascii_strncasecmp (uri, "cid:", 4) == 0)
+ /* ignore */ ;
+
+ else {
+ gpointer parent;
+
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (html));
+ parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
+ e_show_uri (parent, uri);
+ }
+}
+
+static void
+mail_display_on_url (GtkHTML *html,
+ const gchar *uri)
+{
+ EMailDisplay *display;
+ CamelInternetAddress *address;
+ CamelURL *curl;
+ const gchar *format = NULL;
+ gchar *message = NULL;
+ gchar *who;
+
+ display = E_MAIL_DISPLAY (html);
+
+ if (uri == NULL || *uri == '\0')
+ goto exit;
+
+ if (g_str_has_prefix (uri, "mailto:"))
+ format = _("Click to mail %s");
+ else if (g_str_has_prefix (uri, "callto:"))
+ format = _("Click to call %s");
+ else if (g_str_has_prefix (uri, "h323:"))
+ format = _("Click to call %s");
+ else if (g_str_has_prefix (uri, "sip:"))
+ format = _("Click to call %s");
+ else if (g_str_has_prefix (uri, "##"))
+ message = g_strdup (_("Click to hide/unhide addresses"));
+ else
+ message = g_strdup_printf (_("Click to open %s"), uri);
+
+ if (format == NULL)
+ goto exit;
+
+ curl = camel_url_new (uri, NULL);
+ address = camel_internet_address_new ();
+ camel_address_decode (CAMEL_ADDRESS (address), curl->path);
+ who = camel_address_format (CAMEL_ADDRESS (address));
+ camel_object_unref (address);
+ camel_url_free (curl);
+
+ if (who == NULL)
+ who = g_strdup (strchr (uri, ':') + 1);
+
+ message = g_strdup_printf (format, who);
+
+ g_free (who);
+
+exit:
+ mail_display_emit_status_message (display, message);
+
+ g_free (message);
+}
+
+static void
+mail_display_iframe_created (GtkHTML *html,
+ GtkHTML *iframe)
+{
+ g_signal_connect_swapped (
+ iframe, "button-press-event",
+ G_CALLBACK (mail_display_button_press_event), html);
+}
+
+static void
+mail_display_class_init (EMailDisplayClass *class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+ GtkHTMLClass *html_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMailDisplayPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = mail_display_set_property;
+ object_class->get_property = mail_display_get_property;
+ object_class->dispose = mail_display_dispose;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->realize = mail_display_realize;
+ widget_class->style_set = mail_display_style_set;
+ widget_class->button_press_event = mail_display_button_press_event;
+ widget_class->scroll_event = mail_display_scroll_event;
+
+ html_class = GTK_HTML_CLASS (class);
+ html_class->link_clicked = mail_display_link_clicked;
+ html_class->on_url = mail_display_on_url;
+ html_class->iframe_created = mail_display_iframe_created;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ANIMATE,
+ g_param_spec_boolean (
+ "animate",
+ "Animate Images",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CARET_MODE,
+ g_param_spec_boolean (
+ "caret-mode",
+ "Caret Mode",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FORMATTER,
+ g_param_spec_object (
+ "formatter",
+ "HTML Formatter",
+ NULL,
+ EM_TYPE_FORMAT_HTML,
+ G_PARAM_READWRITE));
+
+ signals[POPUP_EVENT] = g_signal_new (
+ "popup-event",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EMailDisplayClass, popup_event),
+ g_signal_accumulator_true_handled, NULL,
+ e_marshal_BOOLEAN__BOXED_POINTER_POINTER,
+ G_TYPE_BOOLEAN, 3,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ signals[STATUS_MESSAGE] = g_signal_new (
+ "status-message",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EMailDisplayClass, status_message),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
+}
+
+static void
+mail_display_init (EMailDisplay *display)
+{
+ display->priv = E_MAIL_DISPLAY_GET_PRIVATE (display);
+}
+
+GType
+e_mail_display_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMailDisplayClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_display_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMailDisplay),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mail_display_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_HTML, "EMailDisplay", &type_info, 0);
+ }
+
+ return type;
+}
+
+gboolean
+e_mail_display_get_animate (EMailDisplay *display)
+{
+ /* XXX This is just here to maintain symmetry
+ * with e_mail_display_set_animate(). */
+
+ g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), FALSE);
+
+ return gtk_html_get_animate (GTK_HTML (display));
+}
+
+void
+e_mail_display_set_animate (EMailDisplay *display,
+ gboolean animate)
+{
+ /* XXX GtkHTML does not utilize GObject properties as well
+ * as it could. This just wraps gtk_html_set_animate()
+ * so we can get a "notify::animate" signal. */
+
+ g_return_if_fail (E_IS_MAIL_DISPLAY (display));
+
+ gtk_html_set_animate (GTK_HTML (display), animate);
+
+ g_object_notify (G_OBJECT (display), "animate");
+}
+
+gboolean
+e_mail_display_get_caret_mode (EMailDisplay *display)
+{
+ /* XXX This is just here to maintain symmetry
+ * with e_mail_display_set_caret_mode(). */
+
+ g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), FALSE);
+
+ return gtk_html_get_caret_mode (GTK_HTML (display));
+}
+
+void
+e_mail_display_set_caret_mode (EMailDisplay *display,
+ gboolean caret_mode)
+{
+ /* XXX GtkHTML does not utilize GObject properties as well
+ * as it could. This just wraps gtk_html_set_caret_mode()
+ * so we can get a "notify::caret-mode" signal. */
+
+ g_return_if_fail (E_IS_MAIL_DISPLAY (display));
+
+ gtk_html_set_caret_mode (GTK_HTML (display), caret_mode);
+
+ g_object_notify (G_OBJECT (display), "caret-mode");
+}
+
+EMFormatHTML *
+e_mail_display_get_formatter (EMailDisplay *display)
+{
+ g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL);
+
+ return display->priv->formatter;
+}
+
+void
+e_mail_display_set_formatter (EMailDisplay *display,
+ EMFormatHTML *formatter)
+{
+ g_return_if_fail (E_IS_MAIL_DISPLAY (display));
+ g_return_if_fail (EM_IS_FORMAT_HTML (formatter));
+
+ if (display->priv->formatter != NULL)
+ g_object_unref (display->priv->formatter);
+
+ display->priv->formatter = g_object_ref (formatter);
+
+ g_object_notify (G_OBJECT (display), "formatter");
+}
diff --git a/mail/e-mail-display.h b/mail/e-mail-display.h
new file mode 100644
index 0000000000..815fd45f3e
--- /dev/null
+++ b/mail/e-mail-display.h
@@ -0,0 +1,83 @@
+/*
+ * e-mail-display.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_DISPLAY_H
+#define E_MAIL_DISPLAY_H
+
+#include <gtkhtml/gtkhtml.h>
+#include <mail/em-format-html.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_DISPLAY \
+ (e_mail_display_get_type ())
+#define E_MAIL_DISPLAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_DISPLAY, EMailDisplay))
+#define E_MAIL_DISPLAY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_DISPLAY, EMailDisplayClass))
+#define E_IS_MAIL_DISPLAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_DISPLAY))
+#define E_IS_MAIL_DISPLAY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_DISPLAY))
+#define E_MAIL_DISPLAY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_DISPLAY, EMailDisplayClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailDisplay EMailDisplay;
+typedef struct _EMailDisplayClass EMailDisplayClass;
+typedef struct _EMailDisplayPrivate EMailDisplayPrivate;
+
+struct _EMailDisplay {
+ GtkHTML parent;
+ EMailDisplayPrivate *priv;
+};
+
+struct _EMailDisplayClass {
+ GtkHTMLClass parent_class;
+
+ /* Signals */
+ gboolean (*popup_event) (EMailDisplay *display,
+ GdkEventButton *event,
+ const gchar *uri,
+ EMFormatPURI *puri);
+ void (*status_message) (EMailDisplay *display,
+ const gchar *status_message);
+};
+
+GType e_mail_display_get_type (void);
+gboolean e_mail_display_get_animate (EMailDisplay *display);
+void e_mail_display_set_animate (EMailDisplay *display,
+ gboolean animate);
+gboolean e_mail_display_get_caret_mode (EMailDisplay *display);
+void e_mail_display_set_caret_mode (EMailDisplay *display,
+ gboolean caret_mode);
+EMFormatHTML * e_mail_display_get_formatter (EMailDisplay *display);
+void e_mail_display_set_formatter (EMailDisplay *display,
+ EMFormatHTML *formatter);
+
+G_END_DECLS
+
+#endif /* E_MAIL_DISPLAY_H */
diff --git a/mail/e-mail-label-dialog.c b/mail/e-mail-label-dialog.c
new file mode 100644
index 0000000000..bebe0e69fb
--- /dev/null
+++ b/mail/e-mail-label-dialog.c
@@ -0,0 +1,323 @@
+/*
+ * e-mail-label-dialog.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-label-dialog.h"
+
+#include <glib/gi18n.h>
+
+#define E_MAIL_LABEL_DIALOG_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_LABEL_DIALOG, EMailLabelDialogPrivate))
+
+struct _EMailLabelDialogPrivate {
+ GtkWidget *entry;
+ GtkWidget *colorsel;
+};
+
+enum {
+ PROP_0,
+ PROP_LABEL_COLOR,
+ PROP_LABEL_NAME
+};
+
+static gpointer parent_class;
+
+static void
+mail_label_dialog_entry_changed_cb (EMailLabelDialog *dialog)
+{
+ const gchar *text;
+ gboolean sensitive;
+
+ text = gtk_entry_get_text (GTK_ENTRY (dialog->priv->entry));
+ sensitive = (text != NULL && *text != '\0');
+
+ gtk_dialog_set_response_sensitive (
+ GTK_DIALOG (dialog), GTK_RESPONSE_OK, sensitive);
+}
+
+static void
+mail_label_dialog_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_LABEL_COLOR:
+ e_mail_label_dialog_set_label_color (
+ E_MAIL_LABEL_DIALOG (object),
+ g_value_get_boxed (value));
+ return;
+
+ case PROP_LABEL_NAME:
+ e_mail_label_dialog_set_label_name (
+ E_MAIL_LABEL_DIALOG (object),
+ g_value_get_string (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_label_dialog_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GdkColor color;
+
+ switch (property_id) {
+ case PROP_LABEL_COLOR:
+ e_mail_label_dialog_get_label_color (
+ E_MAIL_LABEL_DIALOG (object), &color);
+ g_value_set_boxed (value, &color);
+ return;
+
+ case PROP_LABEL_NAME:
+ g_value_set_string (
+ value, e_mail_label_dialog_get_label_name (
+ E_MAIL_LABEL_DIALOG (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_label_dialog_dispose (GObject *object)
+{
+ EMailLabelDialogPrivate *priv;
+
+ priv = E_MAIL_LABEL_DIALOG_GET_PRIVATE (object);
+
+ if (priv->entry != NULL) {
+ g_object_unref (priv->entry);
+ priv->entry = NULL;
+ }
+
+ if (priv->colorsel != NULL) {
+ g_object_unref (priv->colorsel);
+ priv->colorsel = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+mail_label_dialog_constructed (GObject *object)
+{
+ GtkWidget *action_area;
+ GtkWidget *content_area;
+
+ /* XXX Override GTK's style property defaults for GtkDialog.
+ * Hopefully GTK+ 3.0 will fix the broken defaults. */
+
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (object));
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (object));
+
+ gtk_box_set_spacing (GTK_BOX (content_area), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (object), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (content_area), 0);
+}
+
+static void
+mail_label_dialog_class_init (EMailLabelDialogClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMailLabelDialogPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = mail_label_dialog_set_property;
+ object_class->get_property = mail_label_dialog_get_property;
+ object_class->dispose = mail_label_dialog_dispose;
+ object_class->constructed = mail_label_dialog_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_LABEL_COLOR,
+ g_param_spec_boxed (
+ "label-color",
+ "Label Color",
+ NULL,
+ GDK_TYPE_COLOR,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_LABEL_NAME,
+ g_param_spec_string (
+ "label-name",
+ "Label Name",
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+}
+
+static void
+mail_label_dialog_init (EMailLabelDialog *dialog)
+{
+ GtkWidget *content_area;
+ GtkWidget *container;
+ GtkWidget *widget;
+
+ dialog->priv = E_MAIL_LABEL_DIALOG_GET_PRIVATE (dialog);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+ gtk_dialog_add_button (
+ GTK_DIALOG (dialog),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+
+ gtk_dialog_add_button (
+ GTK_DIALOG (dialog),
+ GTK_STOCK_OK, GTK_RESPONSE_OK);
+
+ gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+ container = content_area;
+
+ widget = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_entry_new ();
+ gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
+ gtk_box_pack_end (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ dialog->priv->entry = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "changed",
+ G_CALLBACK (mail_label_dialog_entry_changed_cb), dialog);
+
+ mail_label_dialog_entry_changed_cb (dialog);
+
+ widget = gtk_label_new_with_mnemonic (_("_Label name:"));
+ gtk_label_set_mnemonic_widget (
+ GTK_LABEL (widget), dialog->priv->entry);
+ gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ container = content_area;
+
+ widget = gtk_color_selection_new ();
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ dialog->priv->colorsel = g_object_ref (widget);
+ gtk_widget_show (widget);
+}
+
+GType
+e_mail_label_dialog_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMailLabelDialogClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_label_dialog_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMailLabelDialog),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mail_label_dialog_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_DIALOG, "EMailLabelDialog", &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_mail_label_dialog_new (GtkWindow *parent)
+{
+ return g_object_new (
+ E_TYPE_MAIL_LABEL_DIALOG,
+ "transient-for", parent, NULL);
+}
+
+const gchar *
+e_mail_label_dialog_get_label_name (EMailLabelDialog *dialog)
+{
+ GtkEntry *entry;
+
+ g_return_val_if_fail (E_IS_MAIL_LABEL_DIALOG (dialog), NULL);
+
+ entry = GTK_ENTRY (dialog->priv->entry);
+
+ return gtk_entry_get_text (entry);
+}
+
+void
+e_mail_label_dialog_set_label_name (EMailLabelDialog *dialog,
+ const gchar *label_name)
+{
+ GtkEntry *entry;
+
+ g_return_if_fail (E_IS_MAIL_LABEL_DIALOG (dialog));
+
+ entry = GTK_ENTRY (dialog->priv->entry);
+
+ gtk_entry_set_text (entry, label_name);
+
+ g_object_notify (G_OBJECT (dialog), "label-name");
+}
+
+void
+e_mail_label_dialog_get_label_color (EMailLabelDialog *dialog,
+ GdkColor *label_color)
+{
+ GtkColorSelection *colorsel;
+
+ g_return_if_fail (E_IS_MAIL_LABEL_DIALOG (dialog));
+ g_return_if_fail (label_color != NULL);
+
+ colorsel = GTK_COLOR_SELECTION (dialog->priv->colorsel);
+
+ gtk_color_selection_get_current_color (colorsel, label_color);
+}
+
+void
+e_mail_label_dialog_set_label_color (EMailLabelDialog *dialog,
+ const GdkColor *label_color)
+{
+ GtkColorSelection *colorsel;
+
+ g_return_if_fail (E_IS_MAIL_LABEL_DIALOG (dialog));
+ g_return_if_fail (label_color != NULL);
+
+ colorsel = GTK_COLOR_SELECTION (dialog->priv->colorsel);
+
+ gtk_color_selection_set_current_color (colorsel, label_color);
+
+ g_object_notify (G_OBJECT (dialog), "label-color");
+}
diff --git a/mail/e-mail-label-dialog.h b/mail/e-mail-label-dialog.h
new file mode 100644
index 0000000000..17430c3607
--- /dev/null
+++ b/mail/e-mail-label-dialog.h
@@ -0,0 +1,77 @@
+/*
+ * e-mail-label-dialog.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_LABEL_DIALOG_H
+#define E_MAIL_LABEL_DIALOG_H
+
+#include <gtk/gtk.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_LABEL_DIALOG \
+ (e_mail_label_dialog_get_type ())
+#define E_MAIL_LABEL_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_LABEL_DIALOG, EMailLabelDialog))
+#define E_MAIL_LABEL_DIALOG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_LABEL_DIALOG, EMailLabelDialogClass))
+#define E_IS_MAIL_LABEL_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_LABEL_DIALOG))
+#define E_IS_MAIL_LABEL_DIALOG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_LABEL_DIALOG))
+#define E_MAIL_LABEL_DIALOG_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_LABEL_DIALOG, EMailLabelDialogClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailLabelDialog EMailLabelDialog;
+typedef struct _EMailLabelDialogClass EMailLabelDialogClass;
+typedef struct _EMailLabelDialogPrivate EMailLabelDialogPrivate;
+
+struct _EMailLabelDialog {
+ GtkDialog parent;
+ EMailLabelDialogPrivate *priv;
+};
+
+struct _EMailLabelDialogClass {
+ GtkDialogClass parent_class;
+};
+
+GType e_mail_label_dialog_get_type (void);
+GtkWidget * e_mail_label_dialog_new (GtkWindow *parent);
+const gchar * e_mail_label_dialog_get_label_name
+ (EMailLabelDialog *dialog);
+void e_mail_label_dialog_set_label_name
+ (EMailLabelDialog *dialog,
+ const gchar *label_name);
+void e_mail_label_dialog_get_label_color
+ (EMailLabelDialog *dialog,
+ GdkColor *label_color);
+void e_mail_label_dialog_set_label_color
+ (EMailLabelDialog *dialog,
+ const GdkColor *label_color);
+
+G_END_DECLS
+
+#endif /* E_MAIL_LABEL_DIALOG_H */
diff --git a/mail/e-mail-label-list-store.c b/mail/e-mail-label-list-store.c
new file mode 100644
index 0000000000..1cbe927cb6
--- /dev/null
+++ b/mail/e-mail-label-list-store.c
@@ -0,0 +1,513 @@
+/*
+ * e-mail-label-list-store.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-label-list-store.h"
+
+#include <glib/gi18n.h>
+#include <camel/camel-utf8.h>
+#include "e-util/gconf-bridge.h"
+
+#define E_MAIL_LABEL_LIST_STORE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_LABEL_LIST_STORE, EMailLabelListStorePrivate))
+
+struct _EMailLabelListStorePrivate {
+ GHashTable *tag_index;
+};
+
+static struct {
+ const gchar *label_name;
+ const gchar *label_color;
+ const gchar *label_tag;
+} label_defaults[] = {
+ { N_("I_mportant"), "#EF2929", "$Labelimportant" }, /* red */
+ { N_("_Work"), "#F57900", "$Labelwork" }, /* orange */
+ { N_("_Personal"), "#4E9A06", "$Labelpersonal" }, /* green */
+ { N_("_To Do"), "#3465A4", "$Labeltodo" }, /* blue */
+ { N_("_Later"), "#75507B", "$Labellater" } /* purple */
+};
+
+static gpointer parent_class;
+
+static gchar *
+mail_label_list_store_tag_from_name (const gchar *label_name)
+{
+ gchar *label_tag;
+ gchar *temp;
+
+ /* Thunderbird compatible */
+ temp = g_ascii_strdown (label_name, -1);
+ g_strdelimit (temp, " ()/{%*<>\\\"", '_');
+ label_tag = camel_utf8_utf7 (temp);
+ g_free (temp);
+
+ return label_tag;
+}
+
+static gchar *
+mail_label_list_store_encode_label (const gchar *label_name,
+ const gchar *label_color,
+ const gchar *label_tag)
+{
+ GString *string;
+
+ /* Encoded Form: <name> ':' <color> [ '|' <tag> ] */
+
+ string = g_string_new (label_name);
+ g_string_append_printf (string, ":%s", label_color);
+
+ if (label_tag != NULL)
+ g_string_append_printf (string, "|%s", label_tag);
+
+ return g_string_free (string, FALSE);
+}
+
+static void
+mail_label_list_store_ensure_defaults (EMailLabelListStore *store)
+{
+ gint ii;
+
+ for (ii = 0; ii < G_N_ELEMENTS (label_defaults); ii++) {
+ GtkTreeIter iter;
+ const gchar *label_name;
+ const gchar *label_color;
+ const gchar *label_tag;
+ gchar *encoded;
+
+ label_name = gettext (label_defaults[ii].label_name);
+ label_color = label_defaults[ii].label_color;
+ label_tag = label_defaults[ii].label_tag;
+
+ encoded = mail_label_list_store_encode_label (
+ label_name, label_color, label_tag);
+
+ if (e_mail_label_list_store_lookup (store, label_tag, &iter))
+ gtk_list_store_set (
+ GTK_LIST_STORE (store),
+ &iter, 0, encoded, -1);
+ else
+ gtk_list_store_insert_with_values (
+ GTK_LIST_STORE (store),
+ NULL, -1, 0, encoded, -1);
+
+ g_free (encoded);
+ }
+}
+
+static gchar *
+mail_label_list_store_get_stock_id (EMailLabelListStore *store,
+ const gchar *color_spec)
+{
+ EMailLabelListStoreClass *class;
+ GtkIconFactory *icon_factory;
+ GdkColor color;
+ gchar *stock_id;
+
+ class = E_MAIL_LABEL_LIST_STORE_GET_CLASS (store);
+ icon_factory = class->icon_factory;
+
+ if (!gdk_color_parse (color_spec, &color))
+ return NULL;
+
+ stock_id = g_strdup_printf ("evolution-label-%s", color_spec);
+
+ /* Themes need not be taken into account here.
+ * It's just a solid block of a user-chosen color. */
+ if (gtk_icon_factory_lookup (icon_factory, stock_id) == NULL) {
+ GtkIconSet *icon_set;
+ GdkPixbuf *pixbuf;
+ guint32 pixel;
+
+ pixel = ((color.red & 0xFF00) << 16) +
+ ((color.green & 0xFF00) << 8) +
+ (color.blue & 0xFF00);
+
+ pixbuf = gdk_pixbuf_new (
+ GDK_COLORSPACE_RGB, FALSE, 8, 16, 16);
+ gdk_pixbuf_fill (pixbuf, pixel);
+
+ icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
+ gtk_icon_factory_add (icon_factory, stock_id, icon_set);
+ gtk_icon_set_unref (icon_set);
+
+ g_object_unref (pixbuf);
+ }
+
+ return stock_id;
+}
+
+static void
+mail_label_list_store_finalize (GObject *object)
+{
+ EMailLabelListStorePrivate *priv;
+
+ priv = E_MAIL_LABEL_LIST_STORE_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->tag_index);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+mail_label_list_store_constructed (GObject *object)
+{
+ EMailLabelListStore *store;
+ GtkTreeModel *model;
+ GConfBridge *bridge;
+ const gchar *key;
+
+ model = GTK_TREE_MODEL (object);
+ store = E_MAIL_LABEL_LIST_STORE (object);
+
+ bridge = gconf_bridge_get ();
+ key = "/apps/evolution/mail/labels";
+ gconf_bridge_bind_string_list_store (
+ bridge, key, GTK_LIST_STORE (store));
+
+ mail_label_list_store_ensure_defaults (store);
+}
+
+static void
+mail_label_list_store_row_inserted (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter)
+{
+ EMailLabelListStore *store;
+ GtkTreeRowReference *reference;
+ GHashTable *tag_index;
+ gchar *tag;
+
+ store = E_MAIL_LABEL_LIST_STORE (model);
+
+ /* Hash table takes ownership of both tag and reference. */
+ tag_index = store->priv->tag_index;
+ tag = e_mail_label_list_store_get_tag (store, iter);
+ reference = gtk_tree_row_reference_new (model, path);
+ g_hash_table_insert (tag_index, tag, reference);
+
+ /* We don't need to do anything special for row deletion.
+ * The reference will automatically become invalid (that's
+ * why we're storing references and not iterators or paths),
+ * so garbage collection is not important. We'll do it
+ * lazily. */
+}
+
+static void
+mail_label_list_store_class_init (EMailLabelListStoreClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMailLabelListStorePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = mail_label_list_store_finalize;
+ object_class->constructed = mail_label_list_store_constructed;
+
+ class->icon_factory = gtk_icon_factory_new ();
+ gtk_icon_factory_add_default (class->icon_factory);
+}
+
+static void
+mail_label_list_store_init (EMailLabelListStore *store)
+{
+ GHashTable *tag_index;
+ GType type = G_TYPE_STRING;
+
+ tag_index = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) gtk_tree_row_reference_free);
+
+ store->priv = E_MAIL_LABEL_LIST_STORE_GET_PRIVATE (store);
+ store->priv->tag_index = tag_index;
+
+ /* XXX While it may seem awkward to cram the label name and color
+ * into a single string column, we do it for the benefit of
+ * letting GConfBridge keep the model in sync with GConf.
+ *
+ * XXX There's a valid argument to be made that this information
+ * doesn't belong in GConf in the first place. A key file
+ * under $(user_data_dir)/mail would work better. */
+ gtk_list_store_set_column_types (GTK_LIST_STORE (store), 1, &type);
+}
+
+static void
+mail_label_list_store_iface_init (GtkTreeModelIface *iface)
+{
+ iface->row_inserted = mail_label_list_store_row_inserted;
+}
+
+GType
+e_mail_label_list_store_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMailLabelListStoreClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_label_list_store_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMailLabelListStore),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mail_label_list_store_init,
+ NULL /* vaule_table */
+ };
+
+ static const GInterfaceInfo iface_info = {
+ (GInterfaceInitFunc) mail_label_list_store_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL /* interface_data */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_LIST_STORE, "EMailLabelListStore",
+ &type_info, 0);
+
+ g_type_add_interface_static (
+ type, GTK_TYPE_TREE_MODEL, &iface_info);
+ }
+
+ return type;
+}
+
+EMailLabelListStore *
+e_mail_label_list_store_new (void)
+{
+ return g_object_new (E_TYPE_MAIL_LABEL_LIST_STORE, NULL);
+}
+
+gchar *
+e_mail_label_list_store_get_name (EMailLabelListStore *store,
+ GtkTreeIter *iter)
+{
+ gchar *encoded;
+ gchar *result;
+ gchar **strv;
+
+ /* Encoded Form: <name> ':' <color> [ '|' <tag> ] */
+
+ g_return_val_if_fail (E_IS_MAIL_LABEL_LIST_STORE (store), NULL);
+ g_return_val_if_fail (iter != NULL, NULL);
+
+ gtk_tree_model_get (GTK_TREE_MODEL (store), iter, 0, &encoded, -1);
+
+ strv = g_strsplit_set (encoded, ":|", 3);
+
+ if (g_strv_length (strv) >= 2)
+ result = g_strdup (gettext (strv[0]));
+ else
+ result = NULL;
+
+ g_strfreev (strv);
+
+ return result;
+}
+
+gboolean
+e_mail_label_list_store_get_color (EMailLabelListStore *store,
+ GtkTreeIter *iter,
+ GdkColor *color)
+{
+ gchar *encoded;
+ gchar **strv;
+ gboolean valid;
+
+ /* Encoded Form: <name> ':' <color> [ '|' <tag> ] */
+
+ g_return_val_if_fail (E_IS_MAIL_LABEL_LIST_STORE (store), FALSE);
+ g_return_val_if_fail (iter != NULL, FALSE);
+ g_return_val_if_fail (color != NULL, FALSE);
+
+ gtk_tree_model_get (GTK_TREE_MODEL (store), iter, 0, &encoded, -1);
+
+ strv = g_strsplit_set (encoded, ":|", 3);
+
+ if (g_strv_length (strv) >= 2)
+ valid = gdk_color_parse (strv[1], color);
+ else
+ valid = FALSE;
+
+ g_strfreev (strv);
+
+ return valid;
+}
+
+gchar *
+e_mail_label_list_store_get_stock_id (EMailLabelListStore *store,
+ GtkTreeIter *iter)
+{
+ gchar *encoded;
+ gchar *result;
+ gchar **strv;
+
+ /* Encoded Form: <name> ':' <color> [ '|' <tag> ] */
+
+ g_return_val_if_fail (E_IS_MAIL_LABEL_LIST_STORE (store), NULL);
+ g_return_val_if_fail (iter != NULL, NULL);
+ gtk_tree_model_get (GTK_TREE_MODEL (store), iter, 0, &encoded, -1);
+
+ strv = g_strsplit_set (encoded, ":|", 3);
+
+ if (g_strv_length (strv) >= 2)
+ result = mail_label_list_store_get_stock_id (store, strv[1]);
+ else
+ result = NULL;
+
+ g_strfreev (strv);
+
+ return result;
+}
+
+gchar *
+e_mail_label_list_store_get_tag (EMailLabelListStore *store,
+ GtkTreeIter *iter)
+{
+ gchar *encoded;
+ gchar *result;
+ gchar **strv;
+
+ /* Encoded Form: <name> ':' <color> [ '|' <tag> ] */
+
+ g_return_val_if_fail (E_IS_MAIL_LABEL_LIST_STORE (store), NULL);
+ g_return_val_if_fail (iter != NULL, NULL);
+
+ gtk_tree_model_get (GTK_TREE_MODEL (store), iter, 0, &encoded, -1);
+
+ strv = g_strsplit_set (encoded, ":|", 3);
+
+ /* XXX I guess for historical reasons the default label tags have
+ * a "$Label" prefix, but the default list in GConf doesn't
+ * include tags. That's why the <tag> part is optional.
+ * So if we're missing the <tag> part, look it up in the
+ * hard-coded default list above.
+ *
+ * Not sure I got my facts straight here. Double check. */
+ if (g_strv_length (strv) >= 3)
+ result = g_strdup (strv[2]);
+ else {
+ gint ii;
+
+ result = NULL;
+
+ for (ii = 0; ii < G_N_ELEMENTS (label_defaults); ii++) {
+ const gchar *label_name;
+ const gchar *label_tag;
+
+ label_name = label_defaults[ii].label_name;
+ label_tag = label_defaults[ii].label_tag;
+
+ if (strcmp (strv[0], label_name) == 0) {
+ result = g_strdup (label_tag);
+ break;
+ }
+ }
+ }
+
+ g_strfreev (strv);
+
+ return result;
+}
+
+void
+e_mail_label_list_store_set (EMailLabelListStore *store,
+ GtkTreeIter *iter,
+ const gchar *name,
+ const GdkColor *color)
+{
+ gchar *encoded;
+ gchar *label_color;
+ gchar *label_tag = NULL;
+
+ g_return_if_fail (E_IS_MAIL_LABEL_LIST_STORE (store));
+ g_return_if_fail (name != NULL);
+ g_return_if_fail (color != NULL);
+
+ label_color = gdk_color_to_string (color);
+
+ if (iter != NULL)
+ label_tag = e_mail_label_list_store_get_tag (store, iter);
+ if (label_tag == NULL)
+ label_tag = mail_label_list_store_tag_from_name (name);
+
+ encoded = mail_label_list_store_encode_label (
+ name, label_color, label_tag);
+
+ /* We use gtk_list_store_insert_with_values() so the data is
+ * in place when the 'row-inserted' signal is emitted and our
+ * row_inserted() method executes. */
+ if (iter != NULL)
+ gtk_list_store_set (
+ GTK_LIST_STORE (store), iter, 0, encoded, -1);
+ else
+ gtk_list_store_insert_with_values (
+ GTK_LIST_STORE (store), NULL, -1, 0, encoded, -1);
+
+ g_free (label_color);
+ g_free (label_tag);
+ g_free (encoded);
+}
+
+gboolean
+e_mail_label_list_store_lookup (EMailLabelListStore *store,
+ const gchar *tag,
+ GtkTreeIter *iter)
+{
+ GtkTreeRowReference *reference;
+ GHashTable *tag_index;
+ GtkTreeModel *model;
+ GtkTreePath *path;
+
+ g_return_val_if_fail (E_IS_MAIL_LABEL_LIST_STORE (store), FALSE);
+ g_return_val_if_fail (tag != NULL, FALSE);
+ g_return_val_if_fail (iter != NULL, FALSE);
+
+ tag_index = store->priv->tag_index;
+ reference = g_hash_table_lookup (tag_index, tag);
+
+ if (reference == NULL)
+ return FALSE;
+
+ if (!gtk_tree_row_reference_valid (reference)) {
+ /* Garbage collect the dead reference. */
+ g_hash_table_remove (tag_index, tag);
+ return FALSE;
+ }
+
+ model = gtk_tree_row_reference_get_model (reference);
+ path = gtk_tree_row_reference_get_path (reference);
+ gtk_tree_model_get_iter (model, iter, path);
+ gtk_tree_path_free (path);
+
+ return TRUE;
+}
+
+gboolean
+e_mail_label_tag_is_default (const gchar *tag)
+{
+ g_return_val_if_fail (tag != NULL, FALSE);
+
+ return g_str_has_prefix (tag, "$Label");
+}
diff --git a/mail/e-mail-label-list-store.h b/mail/e-mail-label-list-store.h
new file mode 100644
index 0000000000..a9093eaa08
--- /dev/null
+++ b/mail/e-mail-label-list-store.h
@@ -0,0 +1,85 @@
+/*
+ * e-mail-label-list-store.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_LABEL_LIST_STORE_H
+#define E_MAIL_LABEL_LIST_STORE_H
+
+#include <gtk/gtk.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_LABEL_LIST_STORE \
+ (e_mail_label_list_store_get_type ())
+#define E_MAIL_LABEL_LIST_STORE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_LABEL_LIST_STORE, EMailLabelListStore))
+#define E_MAIL_LABEL_LIST_STORE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_LABEL_LIST_STORE, EMailLabelListStoreClass))
+#define E_IS_MAIL_LABEL_LIST_STORE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_LABEL_LIST_STORE))
+#define E_IS_MAIL_LABEL_LIST_STORE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_LABEL_LIST_STORE))
+#define E_MAIL_LABEL_LIST_STORE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_LABEL_LIST_STORE, EMailLabelListStoreClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailLabelListStore EMailLabelListStore;
+typedef struct _EMailLabelListStoreClass EMailLabelListStoreClass;
+typedef struct _EMailLabelListStorePrivate EMailLabelListStorePrivate;
+
+struct _EMailLabelListStore {
+ GtkListStore parent;
+ EMailLabelListStorePrivate *priv;
+};
+
+struct _EMailLabelListStoreClass {
+ GtkListStoreClass parent_class;
+ GtkIconFactory *icon_factory;
+};
+
+GType e_mail_label_list_store_get_type (void);
+EMailLabelListStore *
+ e_mail_label_list_store_new (void);
+gchar * e_mail_label_list_store_get_name (EMailLabelListStore *store,
+ GtkTreeIter *iter);
+gboolean e_mail_label_list_store_get_color (EMailLabelListStore *store,
+ GtkTreeIter *iter,
+ GdkColor *color);
+gchar * e_mail_label_list_store_get_stock_id (EMailLabelListStore *store,
+ GtkTreeIter *iter);
+gchar * e_mail_label_list_store_get_tag (EMailLabelListStore *store,
+ GtkTreeIter *iter);
+void e_mail_label_list_store_set (EMailLabelListStore *store,
+ GtkTreeIter *iter,
+ const gchar *name,
+ const GdkColor *color);
+gboolean e_mail_label_list_store_lookup (EMailLabelListStore *store,
+ const gchar *tag,
+ GtkTreeIter *iter);
+gboolean e_mail_label_tag_is_default (const gchar *tag);
+
+G_END_DECLS
+
+#endif /* E_MAIL_LABEL_LIST_STORE_H */
diff --git a/mail/e-mail-label-manager.c b/mail/e-mail-label-manager.c
new file mode 100644
index 0000000000..212a0507ad
--- /dev/null
+++ b/mail/e-mail-label-manager.c
@@ -0,0 +1,479 @@
+/*
+ * e-mail-label-manager.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-label-manager.h"
+
+#include <glib/gi18n.h>
+#include "e-mail-label-dialog.h"
+#include "e-mail-label-tree-view.h"
+
+#define E_MAIL_LABEL_MANAGER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_LABEL_MANAGER, EMailLabelManagerPrivate))
+
+struct _EMailLabelManagerPrivate {
+ GtkWidget *tree_view;
+ GtkWidget *add_button;
+ GtkWidget *edit_button;
+ GtkWidget *remove_button;
+};
+
+enum {
+ PROP_0,
+ PROP_LIST_STORE
+};
+
+enum {
+ ADD_LABEL,
+ EDIT_LABEL,
+ REMOVE_LABEL,
+ LAST_SIGNAL
+};
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+
+static void
+mail_label_manager_selection_changed_cb (EMailLabelManager *manager,
+ GtkTreeSelection *selection)
+{
+ GtkWidget *edit_button;
+ GtkWidget *remove_button;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ edit_button = manager->priv->edit_button;
+ remove_button = manager->priv->remove_button;
+
+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ EMailLabelListStore *store;
+ gboolean sensitive;
+ gchar *label_tag;
+
+ store = E_MAIL_LABEL_LIST_STORE (model);
+ label_tag = e_mail_label_list_store_get_tag (store, &iter);
+ sensitive = !e_mail_label_tag_is_default (label_tag);
+ g_free (label_tag);
+
+ /* Disallow removing default labels. */
+ gtk_widget_set_sensitive (edit_button, TRUE);
+ gtk_widget_set_sensitive (remove_button, sensitive);
+ } else {
+ gtk_widget_set_sensitive (edit_button, FALSE);
+ gtk_widget_set_sensitive (remove_button, FALSE);
+ }
+}
+
+static void
+mail_label_manager_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_LIST_STORE:
+ e_mail_label_manager_set_list_store (
+ E_MAIL_LABEL_MANAGER (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_label_manager_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_LIST_STORE:
+ g_value_set_object (
+ value, e_mail_label_manager_get_list_store (
+ E_MAIL_LABEL_MANAGER (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_label_manager_dispose (GObject *object)
+{
+ EMailLabelManagerPrivate *priv;
+
+ priv = E_MAIL_LABEL_MANAGER_GET_PRIVATE (object);
+
+ if (priv->tree_view != NULL) {
+ g_object_unref (priv->tree_view);
+ priv->tree_view = NULL;
+ }
+
+ if (priv->add_button != NULL) {
+ g_object_unref (priv->add_button);
+ priv->add_button = NULL;
+ }
+
+ if (priv->edit_button != NULL) {
+ g_object_unref (priv->edit_button);
+ priv->edit_button = NULL;
+ }
+
+ if (priv->remove_button != NULL) {
+ g_object_unref (priv->remove_button);
+ priv->remove_button = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+mail_label_manager_add_label (EMailLabelManager *manager)
+{
+ EMailLabelDialog *label_dialog;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkWidget *dialog;
+ gpointer parent;
+ GdkColor label_color;
+ const gchar *label_name;
+
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+ parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+ dialog = e_mail_label_dialog_new (parent);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Add Label"));
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+ goto exit;
+
+ label_dialog = E_MAIL_LABEL_DIALOG (dialog);
+ label_name = e_mail_label_dialog_get_label_name (label_dialog);
+ e_mail_label_dialog_get_label_color (label_dialog, &label_color);
+
+ tree_view = GTK_TREE_VIEW (manager->priv->tree_view);
+ model = gtk_tree_view_get_model (tree_view);
+
+ e_mail_label_list_store_set (
+ E_MAIL_LABEL_LIST_STORE (model),
+ NULL, label_name, &label_color);
+
+exit:
+ gtk_widget_destroy (dialog);
+}
+
+static void
+mail_label_manager_edit_label (EMailLabelManager *manager)
+{
+ EMailLabelDialog *label_dialog;
+ EMailLabelListStore *label_store;
+ GtkTreeSelection *selection;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkWidget *dialog;
+ GtkWidget *parent;
+ GdkColor label_color;
+ const gchar *new_name;
+ gchar *label_name;
+
+ tree_view = GTK_TREE_VIEW (manager->priv->tree_view);
+ selection = gtk_tree_view_get_selection (tree_view);
+
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return;
+
+ label_store = E_MAIL_LABEL_LIST_STORE (model);
+ label_name = e_mail_label_list_store_get_name (label_store, &iter);
+ e_mail_label_list_store_get_color (label_store, &iter, &label_color);
+
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+ dialog = e_mail_label_dialog_new (GTK_WINDOW (parent));
+ label_dialog = E_MAIL_LABEL_DIALOG (dialog);
+
+ e_mail_label_dialog_set_label_name (label_dialog, label_name);
+ e_mail_label_dialog_set_label_color (label_dialog, &label_color);
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Edit Label"));
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+ goto exit;
+
+ new_name = e_mail_label_dialog_get_label_name (label_dialog);
+ e_mail_label_dialog_get_label_color (label_dialog, &label_color);
+
+ e_mail_label_list_store_set (
+ label_store, &iter, new_name, &label_color);
+
+exit:
+ gtk_widget_destroy (dialog);
+
+ g_free (label_name);
+}
+
+static void
+mail_label_manager_remove_label (EMailLabelManager *manager)
+{
+ GtkTreeSelection *selection;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ tree_view = GTK_TREE_VIEW (manager->priv->tree_view);
+ selection = gtk_tree_view_get_selection (tree_view);
+
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return;
+
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+}
+
+static void
+mail_label_manager_class_init (EMailLabelManagerClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMailLabelManagerPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = mail_label_manager_set_property;
+ object_class->get_property = mail_label_manager_get_property;
+ object_class->dispose = mail_label_manager_dispose;
+
+ class->add_label = mail_label_manager_add_label;
+ class->edit_label = mail_label_manager_edit_label;
+ class->remove_label = mail_label_manager_remove_label;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_LIST_STORE,
+ g_param_spec_object (
+ "list-store",
+ "List Store",
+ NULL,
+ E_TYPE_MAIL_LABEL_LIST_STORE,
+ G_PARAM_READWRITE));
+
+ signals[ADD_LABEL] = g_signal_new (
+ "add-label",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EMailLabelManagerClass, add_label),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[EDIT_LABEL] = g_signal_new (
+ "edit-label",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EMailLabelManagerClass, edit_label),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[REMOVE_LABEL] = g_signal_new (
+ "remove-label",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EMailLabelManagerClass, remove_label),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void
+mail_label_manager_init (EMailLabelManager *manager)
+{
+ GtkTreeSelection *selection;
+ GtkWidget *container;
+ GtkWidget *widget;
+
+ manager->priv = E_MAIL_LABEL_MANAGER_GET_PRIVATE (manager);
+
+ gtk_table_resize (GTK_TABLE (manager), 2, 2);
+ gtk_table_set_col_spacings (GTK_TABLE (manager), 6);
+ gtk_table_set_row_spacings (GTK_TABLE (manager), 12);
+
+ container = GTK_WIDGET (manager);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_table_attach (
+ GTK_TABLE (container), widget, 0, 1, 0, 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = e_mail_label_tree_view_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ manager->priv->tree_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+
+ g_signal_connect_swapped (
+ selection, "changed",
+ G_CALLBACK (mail_label_manager_selection_changed_cb),
+ manager);
+
+ container = GTK_WIDGET (manager);
+
+ /* FIXME Clarify this. What menu? */
+ widget = gtk_label_new (
+ _("Note: Underscore in the label name is used\n"
+ "as mnemonic identifier in menu."));
+ gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_CENTER);
+ gtk_table_attach (
+ GTK_TABLE (container), widget,
+ 0, 1, 1, 2, 0, 0, 0, 0);
+ gtk_widget_show (widget);
+
+ widget = gtk_vbutton_box_new ();
+ gtk_button_box_set_layout (
+ GTK_BUTTON_BOX (widget), GTK_BUTTONBOX_START);
+ gtk_box_set_spacing (GTK_BOX (widget), 6);
+ gtk_table_attach (
+ GTK_TABLE (container), widget,
+ 1, 2, 0, 2, 0, GTK_FILL, 0, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_ADD);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ manager->priv->add_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (e_mail_label_manager_add_label), manager);
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_EDIT);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ manager->priv->edit_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (e_mail_label_manager_edit_label), manager);
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ manager->priv->remove_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (e_mail_label_manager_remove_label), manager);
+}
+
+GType
+e_mail_label_manager_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMailLabelManagerClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_label_manager_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMailLabelManager),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mail_label_manager_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_TABLE, "EMailLabelManager", &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_mail_label_manager_new (void)
+{
+ return g_object_new (E_TYPE_MAIL_LABEL_MANAGER, NULL);
+}
+
+void
+e_mail_label_manager_add_label (EMailLabelManager *manager)
+{
+ g_return_if_fail (E_IS_MAIL_LABEL_MANAGER (manager));
+
+ g_signal_emit (manager, signals[ADD_LABEL], 0);
+}
+
+void
+e_mail_label_manager_edit_label (EMailLabelManager *manager)
+{
+ g_return_if_fail (E_IS_MAIL_LABEL_MANAGER (manager));
+
+ g_signal_emit (manager, signals[EDIT_LABEL], 0);
+}
+
+void
+e_mail_label_manager_remove_label (EMailLabelManager *manager)
+{
+ g_return_if_fail (E_IS_MAIL_LABEL_MANAGER (manager));
+
+ g_signal_emit (manager, signals[REMOVE_LABEL], 0);
+}
+
+EMailLabelListStore *
+e_mail_label_manager_get_list_store (EMailLabelManager *manager)
+{
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+
+ g_return_val_if_fail (E_IS_MAIL_LABEL_MANAGER (manager), NULL);
+
+ tree_view = GTK_TREE_VIEW (manager->priv->tree_view);
+ model = gtk_tree_view_get_model (tree_view);
+
+ return E_MAIL_LABEL_LIST_STORE (model);
+}
+
+void
+e_mail_label_manager_set_list_store (EMailLabelManager *manager,
+ EMailLabelListStore *list_store)
+{
+ GtkTreeView *tree_view;
+
+ g_return_if_fail (E_IS_MAIL_LABEL_MANAGER (manager));
+ g_return_if_fail (E_IS_MAIL_LABEL_LIST_STORE (list_store));
+
+ tree_view = GTK_TREE_VIEW (manager->priv->tree_view);
+ gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (list_store));
+
+ g_object_notify (G_OBJECT (manager), "list-store");
+}
diff --git a/mail/e-mail-label-manager.h b/mail/e-mail-label-manager.h
new file mode 100644
index 0000000000..20d375efc0
--- /dev/null
+++ b/mail/e-mail-label-manager.h
@@ -0,0 +1,81 @@
+/*
+ * e-mail-label-manager.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_LABEL_MANAGER_H
+#define E_MAIL_LABEL_MANAGER_H
+
+#include <gtk/gtk.h>
+#include <mail/e-mail-label-list-store.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_LABEL_MANAGER \
+ (e_mail_label_manager_get_type ())
+#define E_MAIL_LABEL_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_LABEL_MANAGER, EMailLabelManager))
+#define E_MAIL_LABEL_MANAGER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_LABEL_MANAGER, EMailLabelManagerClass))
+#define E_IS_MAIL_LABEL_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_LABEL_MANAGER))
+#define E_IS_MAIL_LABEL_MANAGER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_LABEL_MANAGER))
+#define E_MAIL_LABEL_MANAGER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_LABEL_MANAGER, EMailLabelManagerClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailLabelManager EMailLabelManager;
+typedef struct _EMailLabelManagerClass EMailLabelManagerClass;
+typedef struct _EMailLabelManagerPrivate EMailLabelManagerPrivate;
+
+struct _EMailLabelManager {
+ GtkTable parent;
+ EMailLabelManagerPrivate *priv;
+};
+
+struct _EMailLabelManagerClass {
+ GtkTableClass parent_class;
+
+ void (*add_label) (EMailLabelManager *manager);
+ void (*edit_label) (EMailLabelManager *manager);
+ void (*remove_label) (EMailLabelManager *manager);
+};
+
+GType e_mail_label_manager_get_type (void);
+GtkWidget * e_mail_label_manager_new (void);
+void e_mail_label_manager_add_label (EMailLabelManager *manager);
+void e_mail_label_manager_edit_label (EMailLabelManager *manager);
+void e_mail_label_manager_remove_label
+ (EMailLabelManager *manager);
+EMailLabelListStore *
+ e_mail_label_manager_get_list_store
+ (EMailLabelManager *manager);
+void e_mail_label_manager_set_list_store
+ (EMailLabelManager *manager,
+ EMailLabelListStore *list_store);
+
+G_END_DECLS
+
+#endif /* E_MAIL_LABEL_MANAGER_H */
diff --git a/mail/e-mail-label-tree-view.c b/mail/e-mail-label-tree-view.c
new file mode 100644
index 0000000000..808d8d060a
--- /dev/null
+++ b/mail/e-mail-label-tree-view.c
@@ -0,0 +1,136 @@
+/*
+ * e-mail-label-tree-view.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-label-tree-view.h"
+
+#include <glib/gi18n.h>
+#include "e-mail-label-list-store.h"
+
+#define E_MAIL_LABEL_TREE_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_LABEL_TREE_VIEW, EMailLabelTreeViewPrivate))
+
+struct _EMailLabelTreeViewPrivate {
+ gint placeholder;
+};
+
+static gpointer parent_class;
+
+static void
+mail_label_tree_view_render_pixbuf (GtkTreeViewColumn *column,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ EMailLabelTreeView *tree_view)
+{
+ EMailLabelListStore *store;
+ gchar *stock_id;
+
+ store = E_MAIL_LABEL_LIST_STORE (model);
+ stock_id = e_mail_label_list_store_get_stock_id (store, iter);
+ g_object_set (renderer, "stock-id", stock_id, NULL);
+ g_free (stock_id);
+}
+
+static void
+mail_label_tree_view_render_text (GtkTreeViewColumn *column,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ EMailLabelTreeView *tree_view)
+{
+ EMailLabelListStore *store;
+ gchar *name;
+
+ store = E_MAIL_LABEL_LIST_STORE (model);
+ name = e_mail_label_list_store_get_name (store, iter);
+ g_object_set (renderer, "text", name, NULL);
+ g_free (name);
+}
+
+static void
+mail_label_tree_view_class_init (EMailLabelTreeViewClass *class)
+{
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMailLabelTreeViewPrivate));
+}
+
+static void
+mail_label_tree_view_init (EMailLabelTreeView *tree_view)
+{
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+
+ tree_view->priv = E_MAIL_LABEL_TREE_VIEW_GET_PRIVATE (tree_view);
+
+ column = gtk_tree_view_column_new ();
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_tree_view_column_set_title (column, _("Color"));
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
+
+ gtk_tree_view_column_set_cell_data_func (
+ column, renderer, (GtkTreeCellDataFunc)
+ mail_label_tree_view_render_pixbuf, tree_view, NULL);
+
+ column = gtk_tree_view_column_new ();
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_set_title (column, _("Name"));
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
+
+ gtk_tree_view_column_set_cell_data_func (
+ column, renderer, (GtkTreeCellDataFunc)
+ mail_label_tree_view_render_text, tree_view, NULL);
+}
+
+GType
+e_mail_label_tree_view_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMailLabelTreeViewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_label_tree_view_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMailLabelTreeView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mail_label_tree_view_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_TREE_VIEW, "EMailLabelTreeView",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_mail_label_tree_view_new (void)
+{
+ return g_object_new (E_TYPE_MAIL_LABEL_TREE_VIEW, NULL);
+}
diff --git a/mail/e-mail-label-tree-view.h b/mail/e-mail-label-tree-view.h
new file mode 100644
index 0000000000..0dd58f2152
--- /dev/null
+++ b/mail/e-mail-label-tree-view.h
@@ -0,0 +1,66 @@
+/*
+ * e-mail-label-tree-view.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_LABEL_TREE_VIEW_H
+#define E_MAIL_LABEL_TREE_VIEW_H
+
+#include <gtk/gtk.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_LABEL_TREE_VIEW \
+ (e_mail_label_tree_view_get_type ())
+#define E_MAIL_LABEL_TREE_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_LABEL_TREE_VIEW, EMailLabelTreeView))
+#define E_MAIL_LABEL_TREE_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_LABEL_TREE_VIEW, EMailLabelTreeViewClass))
+#define E_IS_MAIL_LABEL_TREE_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_LABEL_TREE_VIEW))
+#define E_IS_MAIL_LABEL_TREE_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_LABEL_TREE_VIEW))
+#define E_MAIL_LABEL_TREE_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_LABEL_TREE_VIEW, EMailLabelTreeViewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailLabelTreeView EMailLabelTreeView;
+typedef struct _EMailLabelTreeViewClass EMailLabelTreeViewClass;
+typedef struct _EMailLabelTreeViewPrivate EMailLabelTreeViewPrivate;
+
+struct _EMailLabelTreeView {
+ GtkTreeView parent;
+ EMailLabelTreeViewPrivate *priv;
+};
+
+struct _EMailLabelTreeViewClass {
+ GtkTreeViewClass parent_class;
+};
+
+GType e_mail_label_tree_view_get_type (void);
+GtkWidget * e_mail_label_tree_view_new (void);
+
+G_END_DECLS
+
+#endif /* E_MAIL_LABEL_TREE_VIEW_H */
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
new file mode 100644
index 0000000000..79144211c4
--- /dev/null
+++ b/mail/e-mail-reader-utils.c
@@ -0,0 +1,593 @@
+/*
+ * e-mail-reader-utils.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+/* Miscellaneous utility functions used by EMailReader actions. */
+
+#include "e-mail-reader-utils.h"
+
+#include <glib/gi18n.h>
+#include <gtkhtml/gtkhtml.h>
+#include <camel/camel-mime-message.h>
+#include <camel/camel-vee-folder.h>
+#include <camel/camel-vee-store.h>
+
+#include "e-util/e-error.h"
+#include "filter/filter-rule.h"
+
+#include "mail/e-mail-browser.h"
+#include "mail/em-composer-utils.h"
+#include "mail/em-format-html-print.h"
+#include "mail/em-utils.h"
+#include "mail/mail-autofilter.h"
+#include "mail/mail-ops.h"
+#include "mail/mail-tools.h"
+#include "mail/mail-vfolder.h"
+
+void
+e_mail_reader_activate (EMailReader *reader,
+ const gchar *action_name)
+{
+ GtkActionGroup *action_group;
+ GtkAction *action;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+ g_return_if_fail (action_name != NULL);
+
+ action_group = e_mail_reader_get_action_group (reader);
+ action = gtk_action_group_get_action (action_group, action_name);
+ g_return_if_fail (action != NULL);
+
+ gtk_action_activate (action);
+}
+
+gboolean
+e_mail_reader_confirm_delete (EMailReader *reader)
+{
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EShellSettings *shell_settings;
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWidget *check_button;
+ GtkWidget *content_area;
+ GtkWidget *dialog;
+ GtkWindow *window;
+ const gchar *label;
+ gboolean prompt_delete_in_vfolder;
+ gint response;
+
+ /* Remind users what deleting from a search folder does. */
+
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), FALSE);
+
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ shell_backend = e_mail_reader_get_shell_backend (reader);
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ folder = message_list->folder;
+
+ prompt_delete_in_vfolder = e_shell_settings_get_boolean (
+ shell_settings, "mail-prompt-delete-in-vfolder");
+
+ if (!CAMEL_IS_VEE_STORE (folder->parent_store))
+ return TRUE;
+
+ if (!prompt_delete_in_vfolder)
+ return TRUE;
+
+ dialog = e_error_new (
+ window, "mail:ask-delete-vfolder-msg",
+ folder->full_name, NULL);
+
+ /* XXX e-error should provide a widget layout and API suitable
+ * for packing additional widgets to the right of the alert
+ * icon. But for now, screw it. */
+
+ label = _("Do not ask me again");
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ check_button = gtk_check_button_new_with_label (label);
+ gtk_box_pack_start (
+ GTK_BOX (content_area), check_button, TRUE, TRUE, 6);
+
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ if (response == GTK_RESPONSE_OK)
+ e_shell_settings_set_boolean (
+ shell_settings,
+ "mail-prompt-delete-in-vfolder",
+ gtk_toggle_button_get_active (
+ GTK_TOGGLE_BUTTON (check_button)));
+
+ gtk_widget_destroy (dialog);
+
+ return (response == GTK_RESPONSE_OK);
+}
+
+void
+e_mail_reader_mark_as_read (EMailReader *reader,
+ const gchar *uid)
+{
+ EMFormatHTMLDisplay *html_display;
+ MessageList *message_list;
+ CamelFolder *folder;
+ guint32 mask, set;
+ guint32 flags;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+ g_return_if_fail (uid != NULL);
+
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ folder = message_list->folder;
+ flags = camel_folder_get_message_flags (folder, uid);
+
+ if (!(flags & CAMEL_MESSAGE_SEEN)) {
+ CamelMimeMessage *message;
+
+ message = ((EMFormat *) html_display)->message;
+ em_utils_handle_receipt (folder, uid, message);
+ }
+
+ mask = CAMEL_MESSAGE_SEEN;
+ set = CAMEL_MESSAGE_SEEN;
+ camel_folder_set_message_flags (folder, uid, mask, set);
+}
+
+guint
+e_mail_reader_mark_selected (EMailReader *reader,
+ guint32 mask,
+ guint32 set)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GPtrArray *uids;
+ guint ii;
+
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), 0);
+
+ message_list = e_mail_reader_get_message_list (reader);
+
+ folder = message_list->folder;
+ if (folder == NULL)
+ return 0;
+
+ camel_folder_freeze (folder);
+ uids = message_list_get_selected (message_list);
+
+ for (ii = 0; ii < uids->len; ii++)
+ camel_folder_set_message_flags (
+ folder, uids->pdata[ii], mask, set);
+
+ message_list_free_uids (message_list, uids);
+ camel_folder_thaw (folder);
+
+ return ii;
+}
+
+guint
+e_mail_reader_open_selected (EMailReader *reader)
+{
+ EMailShellBackend *mail_shell_backend;
+ EShellBackend *shell_backend;
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWindow *window;
+ GPtrArray *views;
+ GPtrArray *uids;
+ const gchar *folder_uri;
+ guint ii;
+
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), 0);
+
+ message_list = e_mail_reader_get_message_list (reader);
+ shell_backend = e_mail_reader_get_shell_backend (reader);
+ window = e_mail_reader_get_window (reader);
+
+ mail_shell_backend = E_MAIL_SHELL_BACKEND (shell_backend);
+
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
+ uids = message_list_get_selected (message_list);
+
+ if (uids->len >= 10) {
+ gchar *len_str;
+ gboolean proceed;
+
+ len_str = g_strdup_printf ("%d", uids->len);
+
+ proceed = em_utils_prompt_user (
+ window, "/apps/evolution/mail/prompts/open_many",
+ "mail:ask-open-many", len_str, NULL);
+
+ g_free (len_str);
+
+ if (!proceed) {
+ message_list_free_uids (message_list, uids);
+ return 0;
+ }
+ }
+
+ if (em_utils_folder_is_drafts (folder, folder_uri) ||
+ em_utils_folder_is_outbox (folder, folder_uri) ||
+ em_utils_folder_is_templates (folder, folder_uri)) {
+ em_utils_edit_messages (folder, uids, TRUE);
+ return uids->len;
+ }
+
+ views = g_ptr_array_new ();
+
+ /* For vfolders we need to edit the original, not the vfolder copy. */
+ for (ii = 0; ii < uids->len; ii++) {
+ const gchar *uid = uids->pdata[ii];
+ CamelFolder *real_folder;
+ CamelMessageInfo *info;
+ gchar *real_folder_uri;
+ gchar *real_uid;
+
+ if (!CAMEL_IS_VEE_FOLDER (folder)) {
+ g_ptr_array_add (views, g_strdup (uid));
+ continue;
+ }
+
+ info = camel_folder_get_message_info (folder, uid);
+ if (info == NULL)
+ continue;
+
+ real_folder = camel_vee_folder_get_location (
+ CAMEL_VEE_FOLDER (folder),
+ (CamelVeeMessageInfo *) info, &real_uid);
+ real_folder_uri = mail_tools_folder_to_url (real_folder);
+
+ if (em_utils_folder_is_drafts (real_folder, real_folder_uri) ||
+ em_utils_folder_is_outbox (real_folder, real_folder_uri)) {
+ GPtrArray *edits;
+
+ edits = g_ptr_array_new ();
+ g_ptr_array_add (edits, real_uid);
+ em_utils_edit_messages (real_folder, edits, TRUE);
+ } else {
+ g_free (real_uid);
+ g_ptr_array_add (views, g_strdup (uid));
+ }
+
+ g_free (real_folder_uri);
+ }
+
+ for (ii = 0; ii < views->len; ii++) {
+ const gchar *uid = views->pdata[ii];
+ GtkWidget *browser;
+
+ browser = e_mail_browser_new (mail_shell_backend);
+ e_mail_reader_set_folder (
+ E_MAIL_READER (browser), folder, folder_uri);
+ e_mail_reader_set_message (
+ E_MAIL_READER (browser), uid, FALSE);
+ gtk_widget_show (browser);
+ }
+
+ g_ptr_array_free (views, TRUE);
+
+ message_list_free_uids (message_list, uids);
+
+ return ii;
+}
+
+void
+e_mail_reader_print (EMailReader *reader,
+ GtkPrintOperationAction action)
+{
+ MessageList *message_list;
+ EMFormatHTMLDisplay *html_display;
+ EMFormatHTMLPrint *html_print;
+ CamelFolder *folder;
+ GPtrArray *uids;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ folder = message_list->folder;
+ g_return_if_fail (folder != NULL);
+
+ /* XXX Learn to handle len > 1. */
+ uids = message_list_get_selected (message_list);
+ if (uids->len != 1)
+ goto exit;
+
+ html_print = em_format_html_print_new (
+ (EMFormatHTML *) html_display, action);
+ em_format_merge_handler (
+ (EMFormat *) html_print,
+ (EMFormat *) html_display);
+ em_format_html_print_message (html_print, folder, uids->pdata[0]);
+ g_object_unref (html_print);
+
+exit:
+ message_list_free_uids (message_list, uids);
+}
+
+/* Helper for e_mail_reader_reply_to_message()
+ * XXX This function belongs in e-html-utils.c */
+static gboolean
+html_contains_nonwhitespace (const gchar *html,
+ gint len)
+{
+ const gchar *cp;
+ gunichar uc = 0;
+
+ if (html == NULL || len <= 0)
+ return FALSE;
+
+ cp = html;
+
+ while (cp != NULL && cp - html < len) {
+ uc = g_utf8_get_char (cp);
+ if (uc == 0)
+ break;
+
+ if (uc == '<') {
+ /* skip until next '>' */
+ uc = g_utf8_get_char (cp);
+ while (uc != 0 && uc != '>' && cp - html < len) {
+ cp = g_utf8_next_char (cp);
+ uc = g_utf8_get_char (cp);
+ }
+ if (uc == 0)
+ break;
+ } else if (uc == '&') {
+ /* sequence '&nbsp;' is a space */
+ if (g_ascii_strncasecmp (cp, "&nbsp;", 6) == 0)
+ cp = cp + 5;
+ else
+ break;
+ } else if (!g_unichar_isspace (uc))
+ break;
+
+ cp = g_utf8_next_char (cp);
+ }
+
+ return cp - html < len - 1 && uc != 0;
+}
+
+void
+e_mail_reader_reply_to_message (EMailReader *reader,
+ gint reply_mode)
+{
+ EMFormatHTMLDisplay *html_display;
+ MessageList *message_list;
+ CamelMimeMessage *new_message;
+ CamelMimeMessage *src_message;
+ CamelFolder *folder;
+ GtkWindow *window;
+ GtkHTML *html;
+ struct _camel_header_raw *header;
+ const gchar *uid;
+ gchar *selection = NULL;
+ gint length;
+
+ /* This handles quoting only selected text in the reply. If
+ * nothing is selected or only whitespace is selected, fall
+ * back to the normal em_utils_reply_to_message(). */
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+
+ html_display = e_mail_reader_get_html_display (reader);
+ html = ((EMFormatHTML *) html_display)->html;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ folder = message_list->folder;
+ uid = message_list->cursor_uid;
+ g_return_if_fail (uid != NULL);
+
+ if (!em_utils_check_user_can_send_mail (window))
+ return;
+
+ if (!gtk_html_command (html, "is-selection-active"))
+ goto whole_message;
+
+ selection = gtk_html_get_selection_html (html, &length);
+ if (selection == NULL || *selection == '\0')
+ goto whole_message;
+
+ if (!html_contains_nonwhitespace (selection, length))
+ goto whole_message;
+
+ src_message =
+ CAMEL_MIME_MESSAGE (((EMFormat *) html_display)->message);
+ new_message = camel_mime_message_new ();
+
+ /* Filter out "content-*" headers. */
+ header = CAMEL_MIME_PART (src_message)->headers;
+ while (header != NULL) {
+ if (g_ascii_strncasecmp (header->name, "content-", 8) != 0)
+ camel_medium_add_header (
+ CAMEL_MEDIUM (new_message),
+ header->name, header->value);
+ }
+
+ camel_mime_part_set_encoding (
+ CAMEL_MIME_PART (new_message),
+ CAMEL_TRANSFER_ENCODING_8BIT);
+
+ camel_mime_part_set_content (
+ CAMEL_MIME_PART (new_message),
+ selection, length, "text/html");
+
+ em_utils_reply_to_message (
+ folder, uid, new_message, reply_mode, NULL);
+
+ g_free (selection);
+
+ return;
+
+whole_message:
+ em_utils_reply_to_message (
+ folder, uid, NULL, reply_mode, (EMFormat *) html_display);
+}
+
+void
+e_mail_reader_select_next_message (EMailReader *reader,
+ gboolean or_else_previous)
+{
+ MessageList *message_list;
+ gboolean hide_deleted;
+ gboolean success;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+
+ hide_deleted = e_mail_reader_get_hide_deleted (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ success = message_list_select (
+ message_list, MESSAGE_LIST_SELECT_NEXT, 0, 0);
+
+ if (!success && (hide_deleted || or_else_previous))
+ message_list_select (
+ message_list, MESSAGE_LIST_SELECT_PREVIOUS, 0, 0);
+}
+
+/* Helper for e_mail_reader_create_filter_from_selected() */
+static void
+mail_reader_create_filter_cb (CamelFolder *folder,
+ const gchar *uid,
+ CamelMimeMessage *message,
+ gpointer user_data)
+{
+ struct {
+ const gchar *source;
+ gint type;
+ } *filter_data = user_data;
+
+ if (message != NULL)
+ filter_gui_add_from_message (
+ message, filter_data->source, filter_data->type);
+
+ g_free (filter_data);
+}
+
+void
+e_mail_reader_create_filter_from_selected (EMailReader *reader,
+ gint filter_type)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ const gchar *filter_source;
+ const gchar *folder_uri;
+ GPtrArray *uids;
+
+ struct {
+ const gchar *source;
+ gint type;
+ } *filter_data;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+
+ message_list = e_mail_reader_get_message_list (reader);
+
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
+
+ if (em_utils_folder_is_sent (folder, folder_uri))
+ filter_source = FILTER_SOURCE_OUTGOING;
+ else if (em_utils_folder_is_outbox (folder, folder_uri))
+ filter_source = FILTER_SOURCE_OUTGOING;
+ else
+ filter_source = FILTER_SOURCE_INCOMING;
+
+ uids = message_list_get_selected (message_list);
+
+ if (uids->len == 1) {
+ filter_data = g_malloc (sizeof (*filter_data));
+ filter_data->source = filter_source;
+ filter_data->type = filter_type;
+
+ mail_get_message (
+ folder, uids->pdata[0],
+ mail_reader_create_filter_cb,
+ filter_data, mail_msg_unordered_push);
+ }
+
+ em_utils_uids_free (uids);
+}
+
+/* Helper for e_mail_reader_create_vfolder_from_selected() */
+static void
+mail_reader_create_vfolder_cb (CamelFolder *folder,
+ const gchar *uid,
+ CamelMimeMessage *message,
+ gpointer user_data)
+{
+ struct {
+ gchar *uri;
+ gint type;
+ } *vfolder_data = user_data;
+
+ if (message != NULL)
+ vfolder_gui_add_from_message (
+ message, vfolder_data->type, vfolder_data->uri);
+
+ g_free (vfolder_data->uri);
+ g_free (vfolder_data);
+}
+
+void
+e_mail_reader_create_vfolder_from_selected (EMailReader *reader,
+ gint vfolder_type)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ const gchar *folder_uri;
+ GPtrArray *uids;
+
+ struct {
+ gchar *uri;
+ gint type;
+ } *vfolder_data;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+
+ message_list = e_mail_reader_get_message_list (reader);
+
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
+
+ uids = message_list_get_selected (message_list);
+
+ if (uids->len == 1) {
+ vfolder_data = g_malloc (sizeof (*vfolder_data));
+ vfolder_data->uri = g_strdup (folder_uri);
+ vfolder_data->type = vfolder_type;
+
+ mail_get_message (
+ folder, uids->pdata[0],
+ mail_reader_create_vfolder_cb,
+ vfolder_data, mail_msg_unordered_push);
+ }
+
+ em_utils_uids_free (uids);
+}
diff --git a/mail/e-mail-reader-utils.h b/mail/e-mail-reader-utils.h
new file mode 100644
index 0000000000..46c3ea7345
--- /dev/null
+++ b/mail/e-mail-reader-utils.h
@@ -0,0 +1,56 @@
+/*
+ * e-mail-reader-utils.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+/* Miscellaneous utility functions used by EMailReader actions. */
+
+#ifndef E_MAIL_READER_UTILS_H
+#define E_MAIL_READER_UTILS_H
+
+#include <mail/e-mail-reader.h>
+
+G_BEGIN_DECLS
+
+void e_mail_reader_activate (EMailReader *reader,
+ const gchar *action_name);
+gboolean e_mail_reader_confirm_delete (EMailReader *reader);
+void e_mail_reader_mark_as_read (EMailReader *reader,
+ const gchar *uid);
+guint e_mail_reader_mark_selected (EMailReader *reader,
+ guint32 mask,
+ guint32 set);
+guint e_mail_reader_open_selected (EMailReader *reader);
+void e_mail_reader_print (EMailReader *reader,
+ GtkPrintOperationAction action);
+void e_mail_reader_reply_to_message (EMailReader *reader,
+ gint reply_mode);
+void e_mail_reader_select_next_message
+ (EMailReader *reader,
+ gboolean or_else_previous);
+void e_mail_reader_create_filter_from_selected
+ (EMailReader *reader,
+ gint filter_type);
+void e_mail_reader_create_vfolder_from_selected
+ (EMailReader *reader,
+ gint filter_type);
+
+G_END_DECLS
+
+#endif /* E_MAIL_READER_UTILS_H */
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
new file mode 100644
index 0000000000..1cf9ff983e
--- /dev/null
+++ b/mail/e-mail-reader.c
@@ -0,0 +1,2738 @@
+/*
+ * e-mail-reader.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-reader.h"
+
+#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtkhtml/gtkhtml.h>
+#include <gtkhtml/gtkhtml-stream.h>
+
+#ifdef HAVE_XFREE
+#include <X11/XF86keysym.h>
+#endif
+
+#include "e-util/e-util.h"
+#include "e-util/e-binding.h"
+#include "e-util/gconf-bridge.h"
+#include "shell/e-shell.h"
+#include "widgets/misc/e-charset-picker.h"
+#include "widgets/misc/e-popup-action.h"
+
+#include "mail/e-mail-browser.h"
+#include "mail/e-mail-reader-utils.h"
+#include "mail/e-mail-shell-backend.h"
+#include "mail/em-composer-utils.h"
+#include "mail/em-event.h"
+#include "mail/em-folder-selector.h"
+#include "mail/em-folder-tree.h"
+#include "mail/em-utils.h"
+#include "mail/mail-autofilter.h"
+#include "mail/mail-config.h"
+#include "mail/mail-ops.h"
+
+enum {
+ CHANGED,
+ FOLDER_LOADED,
+ SHOW_SEARCH_BAR,
+ LAST_SIGNAL
+};
+
+/* Remembers the previously selected folder when transferring messages. */
+static gchar *default_xfer_messages_uri;
+
+static guint signals[LAST_SIGNAL];
+
+static void
+action_mail_add_sender_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ CamelMessageInfo *info;
+ CamelFolder *folder;
+ GtkWindow *window;
+ GPtrArray *uids;
+ const gchar *address;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ folder = message_list->folder;
+ uids = message_list_get_selected (message_list);
+
+ if (uids->len != 1)
+ goto exit;
+
+ info = camel_folder_get_message_info (folder, uids->pdata[0]);
+ if (info == NULL)
+ goto exit;
+
+ address = camel_message_info_from (info);
+ if (address == NULL || *address == '\0')
+ goto exit;
+
+ em_utils_add_address (window, address);
+
+exit:
+ em_utils_uids_free (uids);
+}
+
+static void
+action_mail_charset_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+ const gchar *charset;
+
+ if (action != current)
+ return;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ charset = g_object_get_data (G_OBJECT (action), "charset");
+
+ /* Charset for "Default" action will be NULL. */
+ em_format_set_charset (EM_FORMAT (html_display), charset);
+}
+
+static void
+action_mail_check_for_junk_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GPtrArray *uids;
+
+ message_list = e_mail_reader_get_message_list (reader);
+
+ folder = message_list->folder;
+ uids = message_list_get_selected (message_list);
+
+ mail_filter_junk (folder, uids);
+}
+
+static void
+action_mail_clipboard_copy_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+ GtkHTML *html;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ html = EM_FORMAT_HTML (html_display)->html;
+
+ gtk_html_copy (html);
+}
+
+static void
+action_mail_copy_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ EShellBackend *shell_backend;
+ MessageList *message_list;
+ EMFolderTreeModel *model;
+ CamelFolder *folder;
+ GtkWidget *folder_tree;
+ GtkWidget *dialog;
+ GPtrArray *selected;
+ const gchar *uri;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ shell_backend = e_mail_reader_get_shell_backend (reader);
+ model = e_mail_shell_backend_get_folder_tree_model (
+ E_MAIL_SHELL_BACKEND (shell_backend));
+
+ folder_tree = em_folder_tree_new_with_model (model);
+ selected = message_list_get_selected (message_list);
+
+ folder = message_list->folder;
+
+ em_folder_tree_set_excluded (
+ EM_FOLDER_TREE (folder_tree),
+ EMFT_EXCLUDE_NOSELECT | EMFT_EXCLUDE_VIRTUAL |
+ EMFT_EXCLUDE_VTRASH);
+
+ dialog = em_folder_selector_new (
+ EM_FOLDER_TREE (folder_tree),
+ EM_FOLDER_SELECTOR_CAN_CREATE,
+ _("Select Folder"), NULL, _("C_opy"));
+
+ if (default_xfer_messages_uri != NULL)
+ em_folder_selector_set_selected (
+ EM_FOLDER_SELECTOR (dialog),
+ default_xfer_messages_uri);
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+ goto exit;
+
+ uri = em_folder_selector_get_selected_uri (
+ EM_FOLDER_SELECTOR (dialog));
+
+ g_free (default_xfer_messages_uri);
+ default_xfer_messages_uri = g_strdup (uri);
+
+ if (uri != NULL) {
+ mail_transfer_messages (
+ folder, selected, FALSE, uri, 0, NULL, NULL);
+ selected = NULL;
+ }
+
+exit:
+ if (selected != NULL)
+ em_utils_uids_free (selected);
+
+ gtk_widget_destroy (dialog);
+}
+
+static void
+action_mail_delete_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ guint32 mask = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED;
+ guint32 set = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED;
+
+ if (!e_mail_reader_confirm_delete (reader))
+ return;
+
+ /* FIXME Verify all selected messages are deletable.
+ * But handle it by disabling this action. */
+
+ if (e_mail_reader_mark_selected (reader, mask, set) == 1)
+ e_mail_reader_select_next_message (reader, FALSE);
+}
+
+static void
+action_mail_filter_on_mailing_list_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_create_filter_from_selected (reader, AUTO_MLIST);
+}
+
+static void
+action_mail_filter_on_recipients_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_create_filter_from_selected (reader, AUTO_TO);
+}
+
+static void
+action_mail_filter_on_sender_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_create_filter_from_selected (reader, AUTO_FROM);
+}
+
+static void
+action_mail_filter_on_subject_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_create_filter_from_selected (reader, AUTO_SUBJECT);
+}
+
+static void
+action_mail_filters_apply_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GPtrArray *uids;
+
+ message_list = e_mail_reader_get_message_list (reader);
+
+ folder = message_list->folder;
+ uids = message_list_get_selected (message_list);
+
+ mail_filter_on_demand (folder, uids);
+}
+
+static void
+action_mail_find_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_show_search_bar (reader);
+}
+
+static void
+action_mail_flag_clear_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWindow *window;
+ GPtrArray *uids;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ folder = message_list->folder;
+ uids = message_list_get_selected (message_list);
+
+ em_utils_flag_for_followup_clear (window, folder, uids);
+
+ em_format_redraw (EM_FORMAT (html_display));
+}
+
+static void
+action_mail_flag_completed_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWindow *window;
+ GPtrArray *uids;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ folder = message_list->folder;
+ uids = message_list_get_selected (message_list);
+
+ em_utils_flag_for_followup_completed (window, folder, uids);
+
+ em_format_redraw (EM_FORMAT (html_display));
+}
+
+static void
+action_mail_flag_for_followup_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWindow *window;
+ GPtrArray *uids;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ folder = message_list->folder;
+ uids = message_list_get_selected (message_list);
+
+ em_utils_flag_for_followup (window, folder, uids);
+}
+
+static void
+action_mail_forward_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWindow *window;
+ GPtrArray *uids;
+ const gchar *folder_uri;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ if (!em_utils_check_user_can_send_mail (window))
+ return;
+
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
+ uids = message_list_get_selected (message_list);
+
+ em_utils_forward_messages (folder, uids, folder_uri);
+}
+
+static void
+action_mail_forward_attached_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWindow *window;
+ GPtrArray *uids;
+ const gchar *folder_uri;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ if (!em_utils_check_user_can_send_mail (window))
+ return;
+
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
+ uids = message_list_get_selected (message_list);
+
+ em_utils_forward_attached (folder, uids, folder_uri);
+}
+
+static void
+action_mail_forward_inline_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWindow *window;
+ GPtrArray *uids;
+ const gchar *folder_uri;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ if (!em_utils_check_user_can_send_mail (window))
+ return;
+
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
+ uids = message_list_get_selected (message_list);
+
+ em_utils_forward_inline (folder, uids, folder_uri);
+}
+
+static void
+action_mail_forward_quoted_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWindow *window;
+ GPtrArray *uids;
+ const gchar *folder_uri;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ if (!em_utils_check_user_can_send_mail (window))
+ return;
+
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
+ uids = message_list_get_selected (message_list);
+
+ em_utils_forward_quoted (folder, uids, folder_uri);
+}
+
+static void
+action_mail_load_images_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+
+ html_display = e_mail_reader_get_html_display (reader);
+
+ em_format_html_load_images (EM_FORMAT_HTML (html_display));
+}
+
+static void
+action_mail_mark_important_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ guint32 mask = CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_DELETED;
+ guint32 set = CAMEL_MESSAGE_FLAGGED;
+
+ e_mail_reader_mark_selected (reader, mask, set);
+}
+
+static void
+action_mail_mark_junk_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ guint32 mask = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_JUNK |
+ CAMEL_MESSAGE_NOTJUNK | CAMEL_MESSAGE_JUNK_LEARN;
+ guint32 set = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_JUNK |
+ CAMEL_MESSAGE_JUNK_LEARN;
+
+ if (e_mail_reader_mark_selected (reader, mask, set) == 1)
+ e_mail_reader_select_next_message (reader, TRUE);
+}
+
+static void
+action_mail_mark_notjunk_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ guint32 mask = CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_NOTJUNK |
+ CAMEL_MESSAGE_JUNK_LEARN;
+ guint32 set = CAMEL_MESSAGE_NOTJUNK | CAMEL_MESSAGE_JUNK_LEARN;
+
+ if (e_mail_reader_mark_selected (reader, mask, set) == 1)
+ e_mail_reader_select_next_message (reader, TRUE);
+}
+
+static void
+action_mail_mark_read_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ guint32 mask = CAMEL_MESSAGE_SEEN;
+ guint32 set = CAMEL_MESSAGE_SEEN;
+
+ e_mail_reader_mark_selected (reader, mask, set);
+}
+
+static void
+action_mail_mark_unimportant_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ guint32 mask = CAMEL_MESSAGE_FLAGGED;
+ guint32 set = 0;
+
+ e_mail_reader_mark_selected (reader, mask, set);
+}
+
+static void
+action_mail_mark_unread_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ guint32 mask = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED;
+ guint32 set = 0;
+
+ message_list = e_mail_reader_get_message_list (reader);
+
+ e_mail_reader_mark_selected (reader, mask, set);
+
+ if (message_list->seen_id != 0) {
+ g_source_remove (message_list->seen_id);
+ message_list->seen_id = 0;
+ }
+}
+
+static void
+action_mail_message_edit_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWindow *window;
+ GPtrArray *uids;
+
+ window = e_mail_reader_get_window (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ if (!em_utils_check_user_can_send_mail (window))
+ return;
+
+ folder = message_list->folder;
+ uids = message_list_get_selected (message_list);
+
+ em_utils_edit_messages (folder, uids, FALSE);
+}
+
+static void
+action_mail_message_new_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ GtkWindow *window;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ if (!em_utils_check_user_can_send_mail (window))
+ return;
+
+ em_utils_compose_new_message (message_list->folder_uri);
+}
+
+static void
+action_mail_message_open_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_open_selected (reader);
+}
+
+static void
+action_mail_move_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ EShellBackend *shell_backend;
+ MessageList *message_list;
+ EMFolderTreeModel *model;
+ CamelFolder *folder;
+ GtkWidget *folder_tree;
+ GtkWidget *dialog;
+ GPtrArray *selected;
+ const gchar *uri;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ shell_backend = e_mail_reader_get_shell_backend (reader);
+ model = e_mail_shell_backend_get_folder_tree_model (
+ E_MAIL_SHELL_BACKEND (shell_backend));
+
+ folder_tree = em_folder_tree_new_with_model (model);
+ selected = message_list_get_selected (message_list);
+
+ folder = message_list->folder;
+
+ em_folder_tree_set_excluded (
+ EM_FOLDER_TREE (folder_tree),
+ EMFT_EXCLUDE_NOSELECT | EMFT_EXCLUDE_VIRTUAL |
+ EMFT_EXCLUDE_VTRASH);
+
+ dialog = em_folder_selector_new (
+ EM_FOLDER_TREE (folder_tree),
+ EM_FOLDER_SELECTOR_CAN_CREATE,
+ _("Select Folder"), NULL, _("C_opy"));
+
+ if (default_xfer_messages_uri != NULL)
+ em_folder_selector_set_selected (
+ EM_FOLDER_SELECTOR (dialog),
+ default_xfer_messages_uri);
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+ goto exit;
+
+ uri = em_folder_selector_get_selected_uri (
+ EM_FOLDER_SELECTOR (dialog));
+
+ g_free (default_xfer_messages_uri);
+ default_xfer_messages_uri = g_strdup (uri);
+
+ if (uri != NULL) {
+ mail_transfer_messages (
+ folder, selected, TRUE, uri, 0, NULL, NULL);
+ selected = NULL;
+ }
+
+exit:
+ if (selected != NULL)
+ em_utils_uids_free (selected);
+
+ gtk_widget_destroy (dialog);
+}
+
+static void
+action_mail_next_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ MessageListSelectDirection direction;
+ guint32 flags, mask;
+
+ direction = MESSAGE_LIST_SELECT_NEXT;
+ flags = 0;
+ mask = 0;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ message_list_select (message_list, direction, flags, mask);
+}
+
+static void
+action_mail_next_important_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ MessageListSelectDirection direction;
+ guint32 flags, mask;
+
+ direction = MESSAGE_LIST_SELECT_NEXT | MESSAGE_LIST_SELECT_WRAP;
+ flags = CAMEL_MESSAGE_FLAGGED;
+ mask = CAMEL_MESSAGE_FLAGGED;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ message_list_select (message_list, direction, flags, mask);
+}
+
+static void
+action_mail_next_thread_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ message_list_select_next_thread (message_list);
+}
+
+static void
+action_mail_next_unread_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ MessageListSelectDirection direction;
+ guint32 flags, mask;
+
+ direction = MESSAGE_LIST_SELECT_NEXT | MESSAGE_LIST_SELECT_WRAP;
+ flags = 0;
+ mask = CAMEL_MESSAGE_SEEN;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ message_list_select (message_list, direction, flags, mask);
+}
+
+static void
+action_mail_previous_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ MessageListSelectDirection direction;
+ guint32 flags, mask;
+
+ direction = MESSAGE_LIST_SELECT_PREVIOUS;
+ flags = 0;
+ mask = 0;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ message_list_select (message_list, direction, flags, mask);
+}
+
+static void
+action_mail_previous_important_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ MessageListSelectDirection direction;
+ guint32 flags, mask;
+
+ direction = MESSAGE_LIST_SELECT_PREVIOUS | MESSAGE_LIST_SELECT_WRAP;
+ flags = CAMEL_MESSAGE_FLAGGED;
+ mask = CAMEL_MESSAGE_FLAGGED;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ message_list_select (message_list, direction, flags, mask);
+}
+
+static void
+action_mail_previous_unread_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ MessageListSelectDirection direction;
+ guint32 flags, mask;
+
+ direction = MESSAGE_LIST_SELECT_PREVIOUS | MESSAGE_LIST_SELECT_WRAP;
+ flags = 0;
+ mask = CAMEL_MESSAGE_SEEN;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ message_list_select (message_list, direction, flags, mask);
+}
+
+static void
+action_mail_print_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ GtkPrintOperationAction print_action;
+
+ print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
+ e_mail_reader_print (reader, print_action);
+}
+
+static void
+action_mail_print_preview_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ GtkPrintOperationAction print_action;
+
+ print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
+ e_mail_reader_print (reader, print_action);
+}
+
+static void
+action_mail_redirect_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWindow *window;
+ const gchar *uid;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ folder = message_list->folder;
+ uid = message_list->cursor_uid;
+ g_return_if_fail (uid != NULL);
+
+ if (!em_utils_check_user_can_send_mail (window))
+ return;
+
+ em_utils_redirect_message_by_uid (folder, uid);
+}
+
+static void
+action_mail_reply_all_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_reply_to_message (reader, REPLY_MODE_ALL);
+}
+
+static void
+action_mail_reply_list_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_reply_to_message (reader, REPLY_MODE_LIST);
+}
+
+static void
+action_mail_reply_sender_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_reply_to_message (reader, REPLY_MODE_SENDER);
+}
+
+static void
+action_mail_save_as_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWindow *window;
+ GPtrArray *uids;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ window = e_mail_reader_get_window (reader);
+
+ folder = message_list->folder;
+ uids = message_list_get_selected (message_list);
+
+ em_utils_save_messages (window, folder, uids);
+}
+
+static void
+action_mail_search_folder_from_mailing_list_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_create_vfolder_from_selected (reader, AUTO_MLIST);
+}
+
+static void
+action_mail_search_folder_from_recipients_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_create_vfolder_from_selected (reader, AUTO_TO);
+}
+
+static void
+action_mail_search_folder_from_sender_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_create_vfolder_from_selected (reader, AUTO_FROM);
+}
+
+static void
+action_mail_search_folder_from_subject_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ e_mail_reader_create_vfolder_from_selected (reader, AUTO_SUBJECT);
+}
+
+static void
+action_mail_select_all_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+ GtkHTML *html;
+ const gchar *action_name;
+ gboolean selection_active;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ html = EM_FORMAT_HTML (html_display)->html;
+
+ gtk_html_select_all (html);
+
+ action_name = "mail-clipboard-copy";
+ action = e_mail_reader_get_action (reader, action_name);
+ selection_active = gtk_html_command (html, "is-selection-active");
+ gtk_action_set_sensitive (action, selection_active);
+}
+
+static void
+action_mail_show_all_headers_cb (GtkToggleAction *action,
+ EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+ em_format_mode_t mode;
+
+ html_display = e_mail_reader_get_html_display (reader);
+
+ if (gtk_toggle_action_get_active (action))
+ mode = EM_FORMAT_ALLHEADERS;
+ else
+ mode = EM_FORMAT_NORMAL;
+
+ em_format_set_mode (EM_FORMAT (html_display), mode);
+}
+
+static void
+action_mail_show_source_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+ EMailShellBackend *mail_shell_backend;
+ EShellBackend *shell_backend;
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkWidget *browser;
+ GPtrArray *uids;
+ const gchar *folder_uri;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ shell_backend = e_mail_reader_get_shell_backend (reader);
+ mail_shell_backend = E_MAIL_SHELL_BACKEND (shell_backend);
+
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
+ uids = message_list_get_selected (message_list);
+ g_return_if_fail (uids->len > 0);
+
+ browser = e_mail_browser_new (mail_shell_backend);
+ reader = E_MAIL_READER (browser);
+ html_display = e_mail_reader_get_html_display (reader);
+ em_format_set_mode (EM_FORMAT (html_display), EM_FORMAT_SOURCE);
+ e_mail_reader_set_folder (reader, folder, folder_uri);
+ e_mail_reader_set_message (reader, uids->pdata[0], FALSE);
+ gtk_widget_show (browser);
+
+ message_list_free_uids (message_list, uids);
+}
+
+static void
+action_mail_toggle_important_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GPtrArray *uids;
+ guint ii;
+
+ message_list = e_mail_reader_get_message_list (reader);
+
+ folder = message_list->folder;
+ uids = message_list_get_selected (message_list);
+
+ camel_folder_freeze (folder);
+
+ for (ii = 0; ii < uids->len; ii++) {
+ guint32 flags;
+
+ flags = camel_folder_get_message_flags (
+ folder, uids->pdata[ii]);
+ flags ^= CAMEL_MESSAGE_FLAGGED;
+ if (flags & CAMEL_MESSAGE_FLAGGED)
+ flags &= ~CAMEL_MESSAGE_DELETED;
+ camel_folder_set_message_flags (
+ folder, uids->pdata[ii], CAMEL_MESSAGE_FLAGGED |
+ CAMEL_MESSAGE_DELETED, flags);
+ }
+
+ camel_folder_thaw (folder);
+
+ message_list_free_uids (message_list, uids);
+}
+
+static void
+action_mail_undelete_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ guint32 mask = CAMEL_MESSAGE_DELETED;
+ guint32 set = 0;
+
+ e_mail_reader_mark_selected (reader, mask, set);
+}
+
+static void
+action_mail_uri_copy_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ /* FIXME */
+ g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
+}
+
+static void
+action_mail_uri_copy_address_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ /* FIXME */
+ g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
+}
+
+static void
+action_mail_uri_to_search_folder_recipient_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ /* FIXME */
+ g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
+}
+
+static void
+action_mail_uri_to_search_folder_sender_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ /* FIXME */
+ g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
+}
+
+static void
+action_mail_zoom_100_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+ GtkHTML *html;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ html = EM_FORMAT_HTML (html_display)->html;
+
+ gtk_html_zoom_reset (html);
+}
+
+static void
+action_mail_zoom_in_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+ GtkHTML *html;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ html = EM_FORMAT_HTML (html_display)->html;
+
+ gtk_html_zoom_out (html);
+}
+
+static void
+action_mail_zoom_out_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+ GtkHTML *html;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ html = EM_FORMAT_HTML (html_display)->html;
+
+ gtk_html_zoom_out (html);
+}
+
+static GtkActionEntry mail_reader_entries[] = {
+
+ { "mail-add-sender",
+ NULL,
+ N_("A_dd Sender to Address Book"),
+ NULL,
+ N_("Add sender to address book"),
+ G_CALLBACK (action_mail_add_sender_cb) },
+
+ { "mail-check-for-junk",
+ "mail-mark-junk",
+ N_("Check for _Junk"),
+ NULL,
+ N_("Filter the selected messages for junk status"),
+ G_CALLBACK (action_mail_check_for_junk_cb) },
+
+ { "mail-clipboard-copy",
+ GTK_STOCK_COPY,
+ NULL,
+ NULL,
+ N_("Copy selected messages to the clipboard"),
+ G_CALLBACK (action_mail_clipboard_copy_cb) },
+
+ { "mail-copy",
+ "mail-copy",
+ N_("_Copy to Folder..."),
+ "<Shift><Control>y",
+ N_("Copy selected messages to another folder"),
+ G_CALLBACK (action_mail_copy_cb) },
+
+ { "mail-delete",
+ "user-trash",
+ N_("_Delete Message"),
+ "<Control>d",
+ N_("Mark the selected messages for deletion"),
+ G_CALLBACK (action_mail_delete_cb) },
+
+ { "mail-filter-on-mailing-list",
+ NULL,
+ N_("Filter on Mailing _List..."),
+ NULL,
+ N_("Create a rule to filter messages to this mailing list"),
+ G_CALLBACK (action_mail_filter_on_mailing_list_cb) },
+
+ { "mail-filter-on-recipients",
+ NULL,
+ N_("Filter on _Recipients..."),
+ NULL,
+ N_("Create a rule to filter messages to these recipients"),
+ G_CALLBACK (action_mail_filter_on_recipients_cb) },
+
+ { "mail-filter-on-sender",
+ NULL,
+ N_("Filter on Se_nder..."),
+ NULL,
+ N_("Create a rule to filter messages from this sender"),
+ G_CALLBACK (action_mail_filter_on_sender_cb) },
+
+ { "mail-filter-on-subject",
+ NULL,
+ N_("Filter on _Subject..."),
+ NULL,
+ N_("Create a rule to filter messages with this subject"),
+ G_CALLBACK (action_mail_filter_on_subject_cb) },
+
+ { "mail-filters-apply",
+ "stock_mail-filters-apply",
+ N_("A_pply Filters"),
+ "<Control>y",
+ N_("Apply filter rules to the selected messages"),
+ G_CALLBACK (action_mail_filters_apply_cb) },
+
+ { "mail-find",
+ GTK_STOCK_FIND,
+ N_("_Find in Message..."),
+ "<Shift><Control>f",
+ N_("Search for text in the body of the displayed message"),
+ G_CALLBACK (action_mail_find_cb) },
+
+ { "mail-flag-clear",
+ NULL,
+ N_("_Clear Flag"),
+ NULL,
+ N_("Remove the follow-up flag from the selected messages"),
+ G_CALLBACK (action_mail_flag_clear_cb) },
+
+ { "mail-flag-completed",
+ NULL,
+ N_("_Flag Completed"),
+ NULL,
+ N_("Set the follow-up flag to completed on the selected messages"),
+ G_CALLBACK (action_mail_flag_completed_cb) },
+
+ { "mail-flag-for-followup",
+ "stock_mail-flag-for-followup",
+ N_("Follow _Up..."),
+ "<Shift><Control>g",
+ N_("Flag the selected messages for follow-up"),
+ G_CALLBACK (action_mail_flag_for_followup_cb) },
+
+ { "mail-forward",
+ "mail-forward",
+ N_("_Forward"),
+ "<Control>f",
+ N_("Forward the selected message to someone"),
+ G_CALLBACK (action_mail_forward_cb) },
+
+ { "mail-forward-attached",
+ NULL,
+ N_("_Attached"),
+ NULL,
+ N_("Forward the selected message to someone as an attachment"),
+ G_CALLBACK (action_mail_forward_attached_cb) },
+
+ { "mail-forward-inline",
+ NULL,
+ N_("_Inline"),
+ NULL,
+ N_("Forward the selected message in the body of a new message"),
+ G_CALLBACK (action_mail_forward_inline_cb) },
+
+ { "mail-forward-quoted",
+ NULL,
+ N_("_Quoted"),
+ NULL,
+ N_("Forward the selected message quoted like a reply"),
+ G_CALLBACK (action_mail_forward_quoted_cb) },
+
+ { "mail-load-images",
+ "image-x-generic",
+ N_("_Load Images"),
+ "<Control>i",
+ N_("Force images in HTML mail to be loaded"),
+ G_CALLBACK (action_mail_load_images_cb) },
+
+ { "mail-mark-important",
+ "mail-mark-important",
+ N_("_Important"),
+ NULL,
+ N_("Mark the selected messages as important"),
+ G_CALLBACK (action_mail_mark_important_cb) },
+
+ { "mail-mark-junk",
+ "mail-mark-junk",
+ N_("_Junk"),
+ "<Control>j",
+ N_("Mark the selected messages as junk"),
+ G_CALLBACK (action_mail_mark_junk_cb) },
+
+ { "mail-mark-notjunk",
+ "mail-mark-notjunk",
+ N_("_Not Junk"),
+ "<Shift><Control>j",
+ N_("Mark the selected messasges as not being junk"),
+ G_CALLBACK (action_mail_mark_notjunk_cb) },
+
+ { "mail-mark-read",
+ "mail-mark-read",
+ N_("_Read"),
+ "<Control>k",
+ N_("Mark the selected messages as having been read"),
+ G_CALLBACK (action_mail_mark_read_cb) },
+
+ { "mail-mark-unimportant",
+ NULL,
+ N_("Uni_mportant"),
+ NULL,
+ N_("Mark the selected messages as unimportant"),
+ G_CALLBACK (action_mail_mark_unimportant_cb) },
+
+ { "mail-mark-unread",
+ "mail-mark-unread",
+ N_("_Unread"),
+ "<Shift><Control>k",
+ N_("Mark the selected messages as not having been read"),
+ G_CALLBACK (action_mail_mark_unread_cb) },
+
+ { "mail-message-edit",
+ NULL,
+ N_("_Edit as New Message..."),
+ NULL,
+ N_("Open the selected messages in the composer for editing"),
+ G_CALLBACK (action_mail_message_edit_cb) },
+
+ { "mail-message-new",
+ "mail-message-new",
+ N_("Compose _New Message"),
+ "<Shift><Control>m",
+ N_("Open a window for composing a mail message"),
+ G_CALLBACK (action_mail_message_new_cb) },
+
+ { "mail-message-open",
+ NULL,
+ N_("_Open in New Window"),
+ "<Control>o",
+ N_("Open the selected messages in a new window"),
+ G_CALLBACK (action_mail_message_open_cb) },
+
+ { "mail-move",
+ "mail-move",
+ N_("_Move to Folder..."),
+ "<Shift><Control>v",
+ N_("Move selected messages to another folder"),
+ G_CALLBACK (action_mail_move_cb) },
+
+ { "mail-next",
+ GTK_STOCK_GO_FORWARD,
+ N_("_Next Message"),
+ "<Control>Page_Down",
+ N_("Display the next message"),
+ G_CALLBACK (action_mail_next_cb) },
+
+ { "mail-next-important",
+ NULL,
+ N_("Next _Important Message"),
+ NULL,
+ N_("Display the next important message"),
+ G_CALLBACK (action_mail_next_important_cb) },
+
+ { "mail-next-thread",
+ NULL,
+ N_("Next _Thread"),
+ NULL,
+ N_("Display the next thread"),
+ G_CALLBACK (action_mail_next_thread_cb) },
+
+ { "mail-next-unread",
+ NULL,
+ N_("Next _Unread Message"),
+ "<Control>bracketright",
+ N_("Display the next unread message"),
+ G_CALLBACK (action_mail_next_unread_cb) },
+
+ { "mail-previous",
+ GTK_STOCK_GO_BACK,
+ N_("_Previous Message"),
+ "<Control>Page_Up",
+ N_("Display the previous message"),
+ G_CALLBACK (action_mail_previous_cb) },
+
+ { "mail-previous-important",
+ NULL,
+ N_("Pr_evious Important Message"),
+ NULL,
+ N_("Display the previous important message"),
+ G_CALLBACK (action_mail_previous_important_cb) },
+
+ { "mail-previous-unread",
+ NULL,
+ N_("P_revious Unread Message"),
+ "<Control>bracketleft",
+ N_("Display the previous unread message"),
+ G_CALLBACK (action_mail_previous_unread_cb) },
+
+ { "mail-print",
+ GTK_STOCK_PRINT,
+ NULL,
+ "<Control>p",
+ N_("Print this message"),
+ G_CALLBACK (action_mail_print_cb) },
+
+ { "mail-print-preview",
+ GTK_STOCK_PRINT_PREVIEW,
+ NULL,
+ NULL,
+ N_("Preview the message to be printed"),
+ G_CALLBACK (action_mail_print_preview_cb) },
+
+ { "mail-redirect",
+ NULL,
+ N_("Re_direct"),
+ NULL,
+ N_("Redirect (bounce) the selected message to someone"),
+ G_CALLBACK (action_mail_redirect_cb) },
+
+ { "mail-reply-all",
+ "mail-reply-all",
+ N_("Reply to _All"),
+ "<Shift><Control>r",
+ N_("Compose a reply to all the recipients of the selected message"),
+ G_CALLBACK (action_mail_reply_all_cb) },
+
+ { "mail-reply-list",
+ NULL,
+ N_("Reply to _List"),
+ "<Control>l",
+ N_("Compose a reply to the mailing list of the selected message"),
+ G_CALLBACK (action_mail_reply_list_cb) },
+
+ { "mail-reply-sender",
+ "mail-reply-sender",
+ N_("_Reply to Sender"),
+ "<Control>r",
+ N_("Compose a reply to the sender of the selected message"),
+ G_CALLBACK (action_mail_reply_sender_cb) },
+
+ { "mail-save-as",
+ GTK_STOCK_SAVE_AS,
+ N_("_Save as mbox..."),
+ NULL,
+ N_("Save selected messages as an mbox file"),
+ G_CALLBACK (action_mail_save_as_cb) },
+
+ { "mail-search-folder-from-mailing-list",
+ NULL,
+ N_("Search Folder from Mailing _List..."),
+ NULL,
+ N_("Create a search folder for this mailing list"),
+ G_CALLBACK (action_mail_search_folder_from_mailing_list_cb) },
+
+ { "mail-search-folder-from-recipients",
+ NULL,
+ N_("Search Folder from Recipien_ts..."),
+ NULL,
+ N_("Create a search folder for these recipients"),
+ G_CALLBACK (action_mail_search_folder_from_recipients_cb) },
+
+ { "mail-search-folder-from-sender",
+ NULL,
+ N_("Search Folder from Sen_der..."),
+ NULL,
+ N_("Create a search folder for this sender"),
+ G_CALLBACK (action_mail_search_folder_from_sender_cb) },
+
+ { "mail-search-folder-from-subject",
+ NULL,
+ N_("Search Folder from S_ubject..."),
+ NULL,
+ N_("Create a search folder for this subject"),
+ G_CALLBACK (action_mail_search_folder_from_subject_cb) },
+
+ { "mail-select-all",
+ NULL,
+ N_("Select _All Text"),
+ "<Shift><Control>x",
+ N_("Select all the text in a message"),
+ G_CALLBACK (action_mail_select_all_cb) },
+
+ { "mail-show-source",
+ NULL,
+ N_("_Message Source"),
+ "<Control>u",
+ N_("Show the raw email source of the message"),
+ G_CALLBACK (action_mail_show_source_cb) },
+
+ { "mail-toggle-important",
+ NULL,
+ NULL, /* No menu item; key press only */
+ NULL,
+ NULL,
+ G_CALLBACK (action_mail_toggle_important_cb) },
+
+ { "mail-undelete",
+ NULL,
+ N_("_Undelete Message"),
+ "<Shift><Control>d",
+ N_("Undelete the selected messages"),
+ G_CALLBACK (action_mail_undelete_cb) },
+
+ { "mail-uri-copy",
+ NULL,
+ N_("_Copy Link Location"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_mail_uri_copy_cb) },
+
+ { "mail-uri-copy-address",
+ GTK_STOCK_COPY,
+ N_("Copy _Email Address"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_mail_uri_copy_address_cb) },
+
+ { "mail-uri-to-search-folder-recipient",
+ NULL,
+ N_("_To This Address"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_mail_uri_to_search_folder_recipient_cb) },
+
+ { "mail-uri-to-search-folder-sender",
+ NULL,
+ N_("_From This Address"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_mail_uri_to_search_folder_sender_cb) },
+
+ { "mail-zoom-100",
+ GTK_STOCK_ZOOM_100,
+ N_("_Normal Size"),
+ "<Control>0",
+ N_("Reset the text to its original size"),
+ G_CALLBACK (action_mail_zoom_100_cb) },
+
+ { "mail-zoom-in",
+ GTK_STOCK_ZOOM_IN,
+ N_("_Zoom In"),
+ "<Control>plus",
+ N_("Increase the text size"),
+ G_CALLBACK (action_mail_zoom_in_cb) },
+
+ { "mail-zoom-out",
+ GTK_STOCK_ZOOM_OUT,
+ N_("Zoom _Out"),
+ "<Control>minus",
+ N_("Decrease the text size"),
+ G_CALLBACK (action_mail_zoom_out_cb) },
+
+ /*** Menus ***/
+
+ { "mail-create-rule-menu",
+ NULL,
+ N_("Create R_ule"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "mail-encoding-menu",
+ NULL,
+ N_("Ch_aracter Encoding"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "mail-forward-as-menu",
+ NULL,
+ N_("F_orward As..."),
+ NULL,
+ NULL,
+ NULL },
+
+ { "mail-goto-menu",
+ GTK_STOCK_JUMP_TO,
+ N_("_Go To"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "mail-mark-as-menu",
+ NULL,
+ N_("Mar_k As"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "mail-message-menu",
+ NULL,
+ N_("_Message"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "mail-uri-to-search-folder-menu",
+ NULL,
+ N_("Create _Search Folder"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "mail-zoom-menu",
+ NULL,
+ N_("_Zoom"),
+ NULL,
+ NULL,
+ NULL }
+};
+
+static EPopupActionEntry mail_reader_popup_entries[] = {
+
+ { "mail-popup-copy",
+ NULL,
+ "mail-copy" },
+
+ { "mail-popup-delete",
+ NULL,
+ "mail-delete" },
+
+ { "mail-popup-flag-for-followup",
+ N_("Mark for Follo_w Up..."),
+ "mail-flag-for-followup" },
+
+ { "mail-popup-forward",
+ NULL,
+ "mail-forward" },
+
+ { "mail-popup-mark-important",
+ N_("Mark as _Important"),
+ "mail-mark-important" },
+
+ { "mail-popup-mark-junk",
+ N_("Mark as _Junk"),
+ "mail-mark-junk" },
+
+ { "mail-popup-mark-notjunk",
+ N_("Mark as _Not Junk"),
+ "mail-mark-notjunk" },
+
+ { "mail-popup-mark-read",
+ N_("Mark as _Read"),
+ "mail-mark-read" },
+
+ { "mail-popup-mark-unimportant",
+ N_("Mark as Uni_mportant"),
+ "mail-mark-unimportant" },
+
+ { "mail-popup-mark-unread",
+ N_("Mark as _Unread"),
+ "mail-mark-unread" },
+
+ { "mail-popup-message-edit",
+ NULL,
+ "mail-message-edit" },
+
+ { "mail-popup-move",
+ NULL,
+ "mail-move" },
+
+ { "mail-popup-print",
+ NULL,
+ "mail-print" },
+
+ { "mail-popup-reply-all",
+ NULL,
+ "mail-reply-all" },
+
+ { "mail-popup-reply-sender",
+ NULL,
+ "mail-reply-sender" },
+
+ { "mail-popup-save-as",
+ NULL,
+ "mail-save-as" },
+
+ { "mail-popup-undelete",
+ NULL,
+ "mail-undelete" }
+};
+
+static GtkToggleActionEntry mail_reader_toggle_entries[] = {
+
+ { "mail-caret-mode",
+ NULL,
+ N_("_Caret Mode"),
+ "F7",
+ N_("Show a blinking cursor in the body of displayed messages"),
+ NULL, /* No callback required */
+ FALSE },
+
+ { "mail-show-all-headers",
+ NULL,
+ N_("All Message _Headers"),
+ NULL,
+ N_("Show messages with all email headers"),
+ G_CALLBACK (action_mail_show_all_headers_cb),
+ FALSE }
+};
+
+static gboolean
+mail_reader_html_button_release_event_cb (EMailReader *reader,
+ GdkEventButton *button,
+ GtkHTML *html)
+{
+ GtkAction *action;
+ const gchar *action_name;
+ gboolean selection_active;
+
+ action_name = "mail-clipboard-copy";
+ action = e_mail_reader_get_action (reader, action_name);
+ selection_active = gtk_html_command (html, "is-selection-active");
+ gtk_action_set_sensitive (action, selection_active);
+
+ return FALSE;
+}
+
+static void
+mail_reader_double_click_cb (EMailReader *reader,
+ gint row,
+ ETreePath path,
+ gint col,
+ GdkEvent *event)
+{
+ /* Ignore double clicks on columns that handle their own state. */
+ if (MESSAGE_LIST_COLUMN_IS_ACTIVE (col))
+ return;
+
+ e_mail_reader_activate (reader, "mail-message-open");
+}
+
+static gboolean
+mail_reader_key_press_event_cb (EMailReader *reader,
+ GdkEventKey *event)
+{
+ const gchar *action_name;
+
+ if ((event->state & GDK_CONTROL_MASK) != 0)
+ goto ctrl;
+
+ /* <keyval> alone */
+ switch (event->keyval) {
+ case GDK_Delete:
+ case GDK_KP_Delete:
+ action_name = "mail-delete";
+ break;
+
+ case GDK_Return:
+ case GDK_KP_Enter:
+ case GDK_ISO_Enter:
+ action_name = "mail-message-open";
+ break;
+
+ case GDK_period:
+ action_name = "mail-next-unread";
+ break;
+
+ case GDK_comma:
+ action_name = "mail-previous-unread";
+ break;
+
+#ifdef HAVE_XFREE
+ case XF86XK_Reply:
+ action_name = "mail-reply-all";
+ break;
+
+ case XF86XK_MailForward:
+ action_name = "mail-forward";
+ break;
+#endif
+
+ case '!':
+ action_name = "mail-toggle-important";
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ goto exit;
+
+ctrl:
+
+ /* Ctrl + <keyval> */
+ switch (event->keyval) {
+ case GDK_period:
+ action_name = "mail-next-unread";
+ break;
+
+ case GDK_comma:
+ action_name = "mail-previous-unread";
+ break;
+
+ default:
+ return FALSE;
+ }
+
+exit:
+ e_mail_reader_activate (reader, action_name);
+
+ return TRUE;
+}
+
+static gint
+mail_reader_key_press_cb (EMailReader *reader,
+ gint row,
+ ETreePath path,
+ gint col,
+ GdkEvent *event)
+{
+ return mail_reader_key_press_event_cb (reader, &event->key);
+}
+
+static gboolean
+mail_reader_message_read_cb (EMailReader *reader)
+{
+ MessageList *message_list;
+ const gchar *uid;
+
+ message_list = e_mail_reader_get_message_list (reader);
+
+ uid = g_object_get_data (G_OBJECT (reader), "mark-read-uid");
+ g_return_val_if_fail (uid != NULL, FALSE);
+
+ if (g_strcmp0 (message_list->cursor_uid, uid) == 0)
+ e_mail_reader_mark_as_read (reader, uid);
+
+ return FALSE;
+}
+
+static void
+mail_reader_message_loaded_cb (CamelFolder *folder,
+ const gchar *message_uid,
+ CamelMimeMessage *message,
+ gpointer user_data,
+ CamelException *ex)
+{
+ EMailReader *reader = user_data;
+ EMFormatHTMLDisplay *html_display;
+ MessageList *message_list;
+ EShellBackend *shell_backend;
+ EShellSettings *shell_settings;
+ EShell *shell;
+ EMEvent *event;
+ EMEventTargetMessage *target;
+ gboolean mark_read;
+ gint timeout_interval;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ shell_backend = e_mail_reader_get_shell_backend (reader);
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ /* If the user picked a different message in the time it took
+ * to fetch this message, then don't bother rendering it. */
+ if (g_strcmp0 (message_list->cursor_uid, message_uid) != 0)
+ return;
+
+ /** @Event: message.reading
+ * @Title: Viewing a message
+ * @Target: EMEventTargetMessage
+ *
+ * message.reading is emitted whenever a user views a message.
+ */
+ event = em_event_peek ();
+ target = em_event_target_new_message (
+ event, folder, message, message_uid, 0);
+ e_event_emit (
+ (EEvent *) event, "message.reading",
+ (EEventTarget *) target);
+
+ em_format_format (
+ EM_FORMAT (html_display), folder, message_uid, message);
+
+ /* Reset the shell view icon. */
+ e_shell_event (shell, "mail-icon", (gpointer) "evolution-mail");
+
+ /* Determine whether to mark the message as read. */
+ mark_read = e_shell_settings_get_boolean (
+ shell_settings, "mail-mark-seen");
+ timeout_interval = e_shell_settings_get_int (
+ shell_settings, "mail-mark-seen-timeout");
+
+ g_object_set_data_full (
+ G_OBJECT (reader), "mark-read-uid",
+ g_strdup (message_uid), (GDestroyNotify) g_free);
+
+ if (message_list->seen_id > 0)
+ g_source_remove (message_list->seen_id);
+
+ if (mark_read) {
+ message_list->seen_id = g_timeout_add (
+ timeout_interval, (GSourceFunc)
+ mail_reader_message_read_cb, reader);
+
+ } else if (camel_exception_is_set (ex)) {
+ GtkHTMLStream *stream;
+
+ /* Display the error inline and clear the exception. */
+ stream = gtk_html_begin (
+ EM_FORMAT_HTML (html_display)->html);
+ gtk_html_stream_printf (
+ stream, "<h2>%s</h2><p>%s</p>",
+ _("Unable to retrieve message"),
+ ex->desc);
+ gtk_html_stream_close (stream, GTK_HTML_STREAM_OK);
+ camel_exception_clear (ex);
+ }
+
+ e_mail_reader_update_actions (reader);
+
+ /* We referenced this in the call to mail_get_messagex(). */
+ g_object_unref (reader);
+}
+
+static gboolean
+mail_reader_message_selected_timeout_cb (EMailReader *reader)
+{
+ EMFormatHTMLDisplay *html_display;
+ MessageList *message_list;
+ const gchar *cursor_uid;
+ const gchar *format_uid;
+ const gchar *key;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ cursor_uid = message_list->cursor_uid;
+ format_uid = EM_FORMAT (html_display)->uid;
+
+ if (cursor_uid != NULL) {
+ if (g_strcmp0 (cursor_uid, format_uid) != 0)
+ mail_get_messagex (
+ message_list->folder, cursor_uid,
+ mail_reader_message_loaded_cb,
+ g_object_ref (reader),
+ mail_msg_fast_ordered_push);
+ } else
+ em_format_format (EM_FORMAT (html_display), NULL, NULL, NULL);
+
+ key = "message-selected-timeout";
+ g_object_set_data (G_OBJECT (reader), key, NULL);
+
+ return FALSE;
+}
+
+static void
+mail_reader_message_selected_cb (EMailReader *reader,
+ const gchar *uid)
+{
+ const gchar *key;
+ guint source_id;
+ gpointer data;
+
+ /* XXX This is kludgy, but we have no other place to store
+ * timeout state information. */
+
+ key = "message-selected-timeout";
+ data = g_object_get_data (G_OBJECT (reader), key);
+ source_id = GPOINTER_TO_UINT (data);
+
+ if (source_id > 0)
+ g_source_remove (source_id);
+
+ source_id = g_timeout_add (
+ 100, (GSourceFunc)
+ mail_reader_message_selected_timeout_cb, reader);
+
+ data = GUINT_TO_POINTER (source_id);
+ g_object_set_data (G_OBJECT (reader), key, data);
+
+ e_mail_reader_changed (reader);
+}
+
+static void
+mail_reader_emit_folder_loaded (EMailReader *reader)
+{
+ g_signal_emit (reader, signals[FOLDER_LOADED], 0);
+}
+
+static void
+mail_reader_set_folder (EMailReader *reader,
+ CamelFolder *folder,
+ const gchar *folder_uri)
+{
+ EMFormatHTMLDisplay *html_display;
+ MessageList *message_list;
+ gboolean outgoing;
+
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ outgoing = folder != NULL && folder_uri != NULL && (
+ em_utils_folder_is_drafts (folder, folder_uri) ||
+ em_utils_folder_is_outbox (folder, folder_uri) ||
+ em_utils_folder_is_sent (folder, folder_uri));
+
+ if (message_list->folder != NULL)
+ mail_sync_folder (message_list->folder, NULL, NULL);
+
+ em_format_format (EM_FORMAT (html_display), NULL, NULL, NULL);
+ message_list_set_folder (message_list, folder, folder_uri, outgoing);
+
+ mail_reader_emit_folder_loaded (reader);
+}
+
+static void
+mail_reader_set_message (EMailReader *reader,
+ const gchar *uid,
+ gboolean mark_read)
+{
+ MessageList *message_list;
+
+ message_list = e_mail_reader_get_message_list (reader);
+ message_list_select_uid (message_list, uid);
+}
+
+static void
+mail_reader_init_charset_actions (EMailReader *reader)
+{
+ GtkActionGroup *action_group;
+ GtkRadioAction *default_action;
+ GSList *radio_group;
+
+ action_group = e_mail_reader_get_action_group (reader);
+
+ radio_group = e_charset_add_radio_actions (
+ action_group, "mail-charset-", NULL,
+ G_CALLBACK (action_mail_charset_cb), reader);
+
+ /* XXX Add a tooltip! */
+ default_action = gtk_radio_action_new (
+ "mail-charset-default", _("Default"), NULL, NULL, -1);
+
+ gtk_radio_action_set_group (default_action, radio_group);
+
+ g_signal_connect (
+ default_action, "changed",
+ G_CALLBACK (action_mail_charset_cb), reader);
+
+ gtk_action_group_add_action (
+ action_group, GTK_ACTION (default_action));
+
+ gtk_radio_action_set_current_value (default_action, -1);
+}
+
+static void
+mail_reader_class_init (EMailReaderIface *iface)
+{
+ iface->set_folder = mail_reader_set_folder;
+ iface->set_message = mail_reader_set_message;
+
+ signals[CHANGED] = g_signal_new (
+ "changed",
+ G_OBJECT_CLASS_TYPE (iface),
+ G_SIGNAL_RUN_FIRST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[FOLDER_LOADED] = g_signal_new (
+ "folder-loaded",
+ G_OBJECT_CLASS_TYPE (iface),
+ G_SIGNAL_RUN_FIRST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[SHOW_SEARCH_BAR] = g_signal_new (
+ "show-search-bar",
+ G_OBJECT_CLASS_TYPE (iface),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EMailReaderIface, show_search_bar),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+GType
+e_mail_reader_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMailReaderIface),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_reader_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ 0, /* instance_size */
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) NULL,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ G_TYPE_INTERFACE, "EMailReader", &type_info, 0);
+
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+void
+e_mail_reader_init (EMailReader *reader)
+{
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EShellSettings *shell_settings;
+ EMFormatHTMLDisplay *html_display;
+ GtkActionGroup *action_group;
+ MessageList *message_list;
+ GConfBridge *bridge;
+ GtkAction *action;
+ GtkHTML *html;
+ const gchar *action_name;
+ const gchar *key;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+
+ action_group = e_mail_reader_get_action_group (reader);
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+ shell_backend = e_mail_reader_get_shell_backend (reader);
+
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ html = EM_FORMAT_HTML (html_display)->html;
+
+ gtk_action_group_add_actions (
+ action_group, mail_reader_entries,
+ G_N_ELEMENTS (mail_reader_entries), reader);
+ e_action_group_add_popup_actions (
+ action_group, mail_reader_popup_entries,
+ G_N_ELEMENTS (mail_reader_popup_entries));
+ gtk_action_group_add_toggle_actions (
+ action_group, mail_reader_toggle_entries,
+ G_N_ELEMENTS (mail_reader_toggle_entries), reader);
+
+ mail_reader_init_charset_actions (reader);
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ action_name = "mail-caret-mode";
+ key = "/apps/evolution/mail/display/caret_mode";
+ action = e_mail_reader_get_action (reader, action_name);
+ gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+
+ action_name = "mail-show-all-headers";
+ key = "/apps/evolution/mail/display/show_all_headers";
+ action = e_mail_reader_get_action (reader, action_name);
+ gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active");
+
+ /* Fine tuning. */
+
+ action_name = "mail-clipboard-copy";
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, FALSE);
+
+ action_name = "mail-delete";
+ action = e_mail_reader_get_action (reader, action_name);
+ g_object_set (action, "short-label", _("Delete"), NULL);
+
+ action_name = "mail-next";
+ action = e_mail_reader_get_action (reader, action_name);
+ g_object_set (action, "short-label", _("Next"), NULL);
+
+ action_name = "mail-previous";
+ action = e_mail_reader_get_action (reader, action_name);
+ g_object_set (action, "short-label", _("Previous"), NULL);
+
+ action_name = "mail-reply-sender";
+ action = e_mail_reader_get_action (reader, action_name);
+ g_object_set (action, "short-label", _("Reply"), NULL);
+
+ /* Bind properties. */
+
+ e_binding_new_full (
+ G_OBJECT (shell_settings), "mail-citation-color",
+ G_OBJECT (html_display), "citation-color",
+ e_binding_transform_string_to_color,
+ NULL, NULL);
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "mail-image-loading-policy",
+ G_OBJECT (html_display), "image-loading-policy");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "mail-only-local-photos",
+ G_OBJECT (html_display), "only-local-photos");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "mail-show-animated-images",
+ G_OBJECT (html), "animate");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "mail-show-sender-photo",
+ G_OBJECT (html_display), "show-sender-photo");
+
+ action_name = "mail-caret-mode";
+ action = e_mail_reader_get_action (reader, action_name);
+
+ e_mutual_binding_new (
+ G_OBJECT (action), "active",
+ G_OBJECT (html), "caret-mode");
+
+ /* Connect signals. */
+
+ g_signal_connect_swapped (
+ html, "button-release-event",
+ G_CALLBACK (mail_reader_html_button_release_event_cb), reader);
+
+ g_signal_connect_swapped (
+ html, "key-press-event",
+ G_CALLBACK (mail_reader_key_press_event_cb), reader);
+
+ g_signal_connect_swapped (
+ message_list, "message-selected",
+ G_CALLBACK (mail_reader_message_selected_cb), reader);
+
+ g_signal_connect_swapped (
+ message_list, "message-list-built",
+ G_CALLBACK (mail_reader_emit_folder_loaded), reader);
+
+ g_signal_connect_swapped (
+ message_list->tree, "double-click",
+ G_CALLBACK (mail_reader_double_click_cb), reader);
+
+ g_signal_connect_swapped (
+ message_list->tree, "key-press",
+ G_CALLBACK (mail_reader_key_press_cb), reader);
+
+ g_signal_connect_swapped (
+ message_list->tree, "selection-change",
+ G_CALLBACK (e_mail_reader_changed), reader);
+}
+
+void
+e_mail_reader_changed (EMailReader *reader)
+{
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+
+ g_signal_emit (reader, signals[CHANGED], 0);
+}
+
+guint32
+e_mail_reader_check_state (EMailReader *reader)
+{
+ MessageList *message_list;
+ GPtrArray *uids;
+ CamelFolder *folder;
+ CamelStore *store = NULL;
+ const gchar *folder_uri;
+ const gchar *tag;
+ gboolean can_clear_flags = FALSE;
+ gboolean can_flag_completed = FALSE;
+ gboolean can_flag_for_followup = FALSE;
+ gboolean has_deleted = FALSE;
+ gboolean has_important = FALSE;
+ gboolean has_junk = FALSE;
+ gboolean has_not_junk = FALSE;
+ gboolean has_read = FALSE;
+ gboolean has_undeleted = FALSE;
+ gboolean has_unimportant = FALSE;
+ gboolean has_unread = FALSE;
+ gboolean drafts_or_outbox;
+ gboolean store_supports_vjunk = FALSE;
+ guint32 state = 0;
+ guint ii;
+
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), 0);
+
+ message_list = e_mail_reader_get_message_list (reader);
+ uids = message_list_get_selected (message_list);
+ folder_uri = message_list->folder_uri;
+ folder = message_list->folder;
+
+ if (folder != NULL) {
+ store = CAMEL_STORE (folder->parent_store);
+ store_supports_vjunk = (store->flags & CAMEL_STORE_VJUNK);
+ }
+
+ drafts_or_outbox =
+ em_utils_folder_is_drafts (folder, folder_uri) ||
+ em_utils_folder_is_outbox (folder, folder_uri);
+
+ for (ii = 0; ii < uids->len; ii++) {
+ CamelMessageInfo *info;
+ guint32 flags;
+
+ info = camel_folder_get_message_info (
+ folder, uids->pdata[ii]);
+ if (info == NULL)
+ continue;
+
+ flags = camel_message_info_flags (info);
+
+ if (flags & CAMEL_MESSAGE_SEEN)
+ has_read = TRUE;
+ else
+ has_unread = TRUE;
+
+ if (drafts_or_outbox) {
+ has_junk = FALSE;
+ has_not_junk = FALSE;
+ } else if (store_supports_vjunk) {
+ guint32 bitmask;
+
+ /* XXX Strictly speaking, this logic is correct.
+ * Problem is there's nothing in the message
+ * list that indicates whether a message is
+ * already marked "Not Junk". So the user may
+ * think the "Not Junk" button is enabling and
+ * disabling itself randomly as he reads mail. */
+
+ if (flags & CAMEL_MESSAGE_JUNK)
+ has_junk = TRUE;
+ if (flags & CAMEL_MESSAGE_NOTJUNK)
+ has_not_junk = TRUE;
+
+ bitmask = CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_NOTJUNK;
+
+ /* If neither junk flag is set, the
+ * message can be marked either way. */
+ if ((flags & bitmask) == 0) {
+ has_junk = TRUE;
+ has_not_junk = TRUE;
+ }
+
+ } else {
+ has_junk = TRUE;
+ has_not_junk = TRUE;
+ }
+
+ if (flags & CAMEL_MESSAGE_DELETED)
+ has_deleted = TRUE;
+ else
+ has_undeleted = TRUE;
+
+ if (flags & CAMEL_MESSAGE_FLAGGED)
+ has_important = TRUE;
+ else
+ has_unimportant = TRUE;
+
+ tag = camel_message_info_user_tag (info, "follow-up");
+ if (tag != NULL && *tag != '\0') {
+ can_clear_flags = TRUE;
+ tag = camel_message_info_user_tag (
+ info, "completed-on");
+ if (tag != NULL && *tag != '\0')
+ can_flag_completed = TRUE;
+ } else
+ can_flag_for_followup = TRUE;
+ }
+
+ if (uids->len == 1)
+ state |= E_MAIL_READER_SELECTION_SINGLE;
+ if (uids->len > 1)
+ state |= E_MAIL_READER_SELECTION_MULTIPLE;
+ if (!drafts_or_outbox && uids->len == 1)
+ state |= E_MAIL_READER_SELECTION_CAN_ADD_SENDER;
+#if 0 /* FIXME */
+ if (can_edit)
+ state |= E_MAIL_READER_SELECTION_CAN_EDIT;
+#endif
+ if (can_clear_flags)
+ state |= E_MAIL_READER_SELECTION_FLAG_CLEAR;
+ if (can_flag_completed)
+ state |= E_MAIL_READER_SELECTION_FLAG_COMPLETED;
+ if (can_flag_for_followup)
+ state |= E_MAIL_READER_SELECTION_FLAG_FOLLOWUP;
+ if (has_deleted)
+ state |= E_MAIL_READER_SELECTION_HAS_DELETED;
+ if (has_important)
+ state |= E_MAIL_READER_SELECTION_HAS_IMPORTANT;
+ if (has_junk)
+ state |= E_MAIL_READER_SELECTION_HAS_JUNK;
+ if (has_not_junk)
+ state |= E_MAIL_READER_SELECTION_HAS_NOT_JUNK;
+ if (has_read)
+ state |= E_MAIL_READER_SELECTION_HAS_READ;
+ if (has_undeleted)
+ state |= E_MAIL_READER_SELECTION_HAS_UNDELETED;
+ if (has_unimportant)
+ state |= E_MAIL_READER_SELECTION_HAS_UNIMPORTANT;
+ if (has_unread)
+ state |= E_MAIL_READER_SELECTION_HAS_UNREAD;
+#if 0 /* FIXME */
+ if (has_callto_uri)
+ state |= E_MAIL_READER_SELECTION_HAS_URI_CALLTO;
+ if (has_http_uri)
+ state |= E_MAIL_READER_SELECTION_HAS_URI_HTTP;
+ if (has_mailto_uri)
+ state |= E_MAIL_READER_SELECTION_HAS_URI_MAILTO;
+ if (is_mailing_list)
+ state |= E_MAIL_READER_SELECTION_IS_MAILING_LIST;
+#endif
+
+ em_utils_uids_free (uids);
+
+ return state;
+
+}
+
+void
+e_mail_reader_update_actions (EMailReader *reader)
+{
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EShellSettings *shell_settings;
+ GtkAction *action;
+ GtkActionGroup *action_group;
+ const gchar *action_name;
+ gboolean sensitive;
+ guint32 state;
+
+ /* Be descriptive. */
+ gboolean any_messages_selected;
+ gboolean disable_printing;
+ gboolean enable_flag_clear;
+ gboolean enable_flag_completed;
+ gboolean enable_flag_for_followup;
+ gboolean single_message_selected;
+ gboolean multiple_messages_selected;
+ gboolean selection_has_deleted_messages;
+ gboolean selection_has_important_messages;
+ gboolean selection_has_junk_messages;
+ gboolean selection_has_not_junk_messages;
+ gboolean selection_has_read_messages;
+ gboolean selection_has_undeleted_messages;
+ gboolean selection_has_unimportant_messages;
+ gboolean selection_has_unread_messages;
+ gboolean selection_is_mailing_list;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+
+ action_group = e_mail_reader_get_action_group (reader);
+ state = e_mail_reader_check_state (reader);
+
+ shell_backend = e_mail_reader_get_shell_backend (reader);
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ disable_printing = e_shell_settings_get_boolean (
+ shell_settings, "disable-printing");
+
+ single_message_selected =
+ (state & E_MAIL_READER_SELECTION_SINGLE);
+ multiple_messages_selected =
+ (state & E_MAIL_READER_SELECTION_MULTIPLE);
+ /* FIXME Missing booleans */
+ enable_flag_clear =
+ (state & E_MAIL_READER_SELECTION_FLAG_CLEAR);
+ enable_flag_completed =
+ (state & E_MAIL_READER_SELECTION_FLAG_COMPLETED);
+ enable_flag_for_followup =
+ (state & E_MAIL_READER_SELECTION_FLAG_FOLLOWUP);
+ selection_has_deleted_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_DELETED);
+ selection_has_important_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_IMPORTANT);
+ selection_has_junk_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_JUNK);
+ selection_has_not_junk_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_NOT_JUNK);
+ selection_has_read_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_READ);
+ selection_has_undeleted_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_UNDELETED);
+ selection_has_unimportant_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_UNIMPORTANT);
+ selection_has_unread_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_UNREAD);
+ /* FIXME Missing booleans */
+ selection_is_mailing_list =
+ (state & E_MAIL_READER_SELECTION_IS_MAILING_LIST);
+
+ any_messages_selected =
+ (single_message_selected || multiple_messages_selected);
+
+ action_name = "mail-check-for-junk";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-copy";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-delete";
+ sensitive = selection_has_undeleted_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-filters-apply";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-forward";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-forward-attached";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-forward-inline";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-forward-quoted";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-load-images";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-mark-important";
+ sensitive = selection_has_unimportant_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-mark-junk";
+ sensitive = selection_has_not_junk_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-mark-notjunk";
+ sensitive = selection_has_junk_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-mark-read";
+ sensitive = selection_has_unread_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-mark-unimportant";
+ sensitive = selection_has_important_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-mark-unread";
+ sensitive = selection_has_read_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-message-edit";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-message-open";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-move";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-next-important";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-next-thread";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-next-unread";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-previous-important";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-previous-unread";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-print";
+ sensitive = single_message_selected && !disable_printing;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-print-preview";
+ sensitive = single_message_selected && !disable_printing;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-redirect";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-reply-all";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-reply-list";
+ sensitive = single_message_selected && selection_is_mailing_list;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-reply-sender";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-save-as";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-select-all";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-show-source";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-undelete";
+ sensitive = selection_has_deleted_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-zoom-100";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-zoom-in";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-zoom-out";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+}
+
+GtkAction *
+e_mail_reader_get_action (EMailReader *reader,
+ const gchar *action_name)
+{
+ GtkActionGroup *action_group;
+ GtkAction *action;
+
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
+ g_return_val_if_fail (action_name != NULL, NULL);
+
+ action_group = e_mail_reader_get_action_group (reader);
+ action = gtk_action_group_get_action (action_group, action_name);
+
+ if (action == NULL)
+ g_critical (
+ "%s: action `%s' not found", G_STRFUNC, action_name);
+
+ return action;
+}
+
+GtkActionGroup *
+e_mail_reader_get_action_group (EMailReader *reader)
+{
+ EMailReaderIface *iface;
+
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
+
+ iface = E_MAIL_READER_GET_IFACE (reader);
+ g_return_val_if_fail (iface->get_action_group != NULL, NULL);
+
+ return iface->get_action_group (reader);
+}
+
+gboolean
+e_mail_reader_get_hide_deleted (EMailReader *reader)
+{
+ EMailReaderIface *iface;
+
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), FALSE);
+
+ iface = E_MAIL_READER_GET_IFACE (reader);
+ g_return_val_if_fail (iface->get_hide_deleted != NULL, FALSE);
+
+ return iface->get_hide_deleted (reader);
+}
+
+EMFormatHTMLDisplay *
+e_mail_reader_get_html_display (EMailReader *reader)
+{
+ EMailReaderIface *iface;
+
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
+
+ iface = E_MAIL_READER_GET_IFACE (reader);
+ g_return_val_if_fail (iface->get_html_display != NULL, NULL);
+
+ return iface->get_html_display (reader);
+}
+
+MessageList *
+e_mail_reader_get_message_list (EMailReader *reader)
+{
+ EMailReaderIface *iface;
+
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
+
+ iface = E_MAIL_READER_GET_IFACE (reader);
+ g_return_val_if_fail (iface->get_message_list != NULL, NULL);
+
+ return iface->get_message_list (reader);
+}
+
+EShellBackend *
+e_mail_reader_get_shell_backend (EMailReader *reader)
+{
+ EMailReaderIface *iface;
+
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
+
+ iface = E_MAIL_READER_GET_IFACE (reader);
+ g_return_val_if_fail (iface->get_shell_backend != NULL, NULL);
+
+ return iface->get_shell_backend (reader);
+}
+
+GtkWindow *
+e_mail_reader_get_window (EMailReader *reader)
+{
+ EMailReaderIface *iface;
+
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
+
+ iface = E_MAIL_READER_GET_IFACE (reader);
+ g_return_val_if_fail (iface->get_window != NULL, NULL);
+
+ return iface->get_window (reader);
+}
+
+void
+e_mail_reader_set_folder (EMailReader *reader,
+ CamelFolder *folder,
+ const gchar *folder_uri)
+{
+ EMailReaderIface *iface;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+
+ iface = E_MAIL_READER_GET_IFACE (reader);
+ g_return_if_fail (iface->set_folder != NULL);
+
+ iface->set_folder (reader, folder, folder_uri);
+}
+
+/* Helper for e_mail_reader_set_folder_uri() */
+static void
+mail_reader_got_folder_cb (gchar *folder_uri,
+ CamelFolder *folder,
+ gpointer user_data)
+{
+ EMailReader *reader = user_data;
+
+ e_mail_reader_set_folder (reader, folder, folder_uri);
+}
+
+void
+e_mail_reader_set_folder_uri (EMailReader *reader,
+ const gchar *folder_uri)
+{
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+ g_return_if_fail (folder_uri != NULL);
+
+ /* Fetch the CamelFolder asynchronously. */
+ mail_get_folder (
+ folder_uri, 0, mail_reader_got_folder_cb,
+ reader, mail_msg_fast_ordered_push);
+}
+
+void
+e_mail_reader_set_message (EMailReader *reader,
+ const gchar *uid,
+ gboolean mark_read)
+{
+ EMailReaderIface *iface;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+
+ iface = E_MAIL_READER_GET_IFACE (reader);
+ g_return_if_fail (iface->set_message != NULL);
+
+ iface->set_message (reader, uid, mark_read);
+}
+
+void
+e_mail_reader_create_charset_menu (EMailReader *reader,
+ GtkUIManager *ui_manager,
+ guint merge_id)
+{
+ GtkAction *action;
+ const gchar *action_name;
+ const gchar *path;
+ GSList *list;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+ g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager));
+
+ action_name = "mail-charset-default";
+ action = e_mail_reader_get_action (reader, action_name);
+ g_return_if_fail (action != NULL);
+
+ list = gtk_radio_action_get_group (GTK_RADIO_ACTION (action));
+ list = g_slist_copy (list);
+ list = g_slist_remove (list, action);
+ list = g_slist_sort (list, (GCompareFunc) e_action_compare_by_label);
+
+ path = "/main-menu/view-menu/mail-message-view-actions/mail-encoding-menu";
+
+ while (list != NULL) {
+ action = list->data;
+
+ gtk_ui_manager_add_ui (
+ ui_manager, merge_id, path,
+ gtk_action_get_name (action),
+ gtk_action_get_name (action),
+ GTK_UI_MANAGER_AUTO, FALSE);
+
+ list = g_slist_delete_link (list, list);
+ }
+
+ gtk_ui_manager_ensure_update (ui_manager);
+}
+
+void
+e_mail_reader_show_search_bar (EMailReader *reader)
+{
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+
+ g_signal_emit (reader, signals[SHOW_SEARCH_BAR], 0);
+}
diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h
new file mode 100644
index 0000000000..c55ba92abd
--- /dev/null
+++ b/mail/e-mail-reader.h
@@ -0,0 +1,134 @@
+/*
+ * e-mail-reader.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_READER_H
+#define E_MAIL_READER_H
+
+#include <gtk/gtk.h>
+#include <camel/camel-folder.h>
+#include <mail/em-format-html-display.h>
+#include <mail/message-list.h>
+#include <shell/e-shell-backend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_READER \
+ (e_mail_reader_get_type ())
+#define E_MAIL_READER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_READER, EMailReader))
+#define E_MAIL_READER_IFACE(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_READER, EMailReaderIface))
+#define E_IS_MAIL_READER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_READER))
+#define E_IS_MAIL_READER_IFACE(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_READER))
+#define E_MAIL_READER_GET_IFACE(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE \
+ ((obj), E_TYPE_MAIL_READER, EMailReaderIface))
+
+/* Basename of the UI definition file. */
+#define E_MAIL_READER_UI_DEFINITION "evolution-mail-reader.ui"
+
+G_BEGIN_DECLS
+
+typedef struct _EMailReader EMailReader;
+typedef struct _EMailReaderIface EMailReaderIface;
+
+enum {
+ E_MAIL_READER_SELECTION_SINGLE = 1 << 0,
+ E_MAIL_READER_SELECTION_MULTIPLE = 1 << 1,
+ E_MAIL_READER_SELECTION_CAN_ADD_SENDER = 1 << 2,
+ E_MAIL_READER_SELECTION_CAN_EDIT = 1 << 3,
+ E_MAIL_READER_SELECTION_FLAG_CLEAR = 1 << 4,
+ E_MAIL_READER_SELECTION_FLAG_COMPLETED = 1 << 5,
+ E_MAIL_READER_SELECTION_FLAG_FOLLOWUP = 1 << 6,
+ E_MAIL_READER_SELECTION_HAS_DELETED = 1 << 7,
+ E_MAIL_READER_SELECTION_HAS_IMPORTANT = 1 << 8,
+ E_MAIL_READER_SELECTION_HAS_JUNK = 1 << 9,
+ E_MAIL_READER_SELECTION_HAS_NOT_JUNK = 1 << 10,
+ E_MAIL_READER_SELECTION_HAS_READ = 1 << 11,
+ E_MAIL_READER_SELECTION_HAS_UNDELETED = 1 << 12,
+ E_MAIL_READER_SELECTION_HAS_UNIMPORTANT = 1 << 13,
+ E_MAIL_READER_SELECTION_HAS_UNREAD = 1 << 14,
+ E_MAIL_READER_SELECTION_HAS_URI_CALLTO = 1 << 15,
+ E_MAIL_READER_SELECTION_HAS_URI_HTTP = 1 << 16,
+ E_MAIL_READER_SELECTION_HAS_URI_MAILTO = 1 << 17,
+ E_MAIL_READER_SELECTION_IS_MAILING_LIST = 1 << 18
+};
+
+struct _EMailReaderIface {
+ GTypeInterface parent_iface;
+
+ GtkActionGroup *
+ (*get_action_group) (EMailReader *reader);
+ gboolean (*get_hide_deleted) (EMailReader *reader);
+ EMFormatHTMLDisplay *
+ (*get_html_display) (EMailReader *reader);
+ MessageList * (*get_message_list) (EMailReader *reader);
+ EShellBackend * (*get_shell_backend) (EMailReader *reader);
+ GtkWindow * (*get_window) (EMailReader *reader);
+
+ void (*set_folder) (EMailReader *reader,
+ CamelFolder *folder,
+ const gchar *folder_uri);
+ void (*set_message) (EMailReader *reader,
+ const gchar *uid,
+ gboolean mark_read);
+
+ /* Signals */
+ void (*show_search_bar) (EMailReader *reader);
+};
+
+GType e_mail_reader_get_type (void);
+void e_mail_reader_init (EMailReader *reader);
+void e_mail_reader_changed (EMailReader *reader);
+guint32 e_mail_reader_check_state (EMailReader *reader);
+void e_mail_reader_update_actions (EMailReader *reader);
+GtkAction * e_mail_reader_get_action (EMailReader *reader,
+ const gchar *action_name);
+GtkActionGroup *
+ e_mail_reader_get_action_group (EMailReader *reader);
+gboolean e_mail_reader_get_hide_deleted (EMailReader *reader);
+EMFormatHTMLDisplay *
+ e_mail_reader_get_html_display (EMailReader *reader);
+MessageList * e_mail_reader_get_message_list (EMailReader *reader);
+EShellBackend * e_mail_reader_get_shell_backend (EMailReader *reader);
+GtkWindow * e_mail_reader_get_window (EMailReader *reader);
+void e_mail_reader_set_folder (EMailReader *reader,
+ CamelFolder *folder,
+ const gchar *folder_uri);
+void e_mail_reader_set_folder_uri (EMailReader *reader,
+ const gchar *folder_uri);
+void e_mail_reader_set_message (EMailReader *reader,
+ const gchar *uid,
+ gboolean mark_read);
+void e_mail_reader_create_charset_menu
+ (EMailReader *reader,
+ GtkUIManager *ui_manager,
+ guint merge_id);
+void e_mail_reader_show_search_bar (EMailReader *reader);
+
+G_END_DECLS
+
+#endif /* E_MAIL_READER_H */
diff --git a/mail/e-mail-shell-backend.c b/mail/e-mail-shell-backend.c
new file mode 100644
index 0000000000..10a99e744b
--- /dev/null
+++ b/mail/e-mail-shell-backend.c
@@ -0,0 +1,1294 @@
+/*
+ * e-mail-shell-backend.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-shell-backend.h"
+
+#include <glib/gi18n.h>
+#include <camel/camel-disco-store.h>
+#include <camel/camel-offline-store.h>
+#include <camel/camel-session.h>
+#include <camel/camel-url.h>
+
+#include "e-util/e-account-utils.h"
+#include "e-util/e-binding.h"
+#include "e-util/e-import.h"
+#include "e-util/e-util.h"
+#include "shell/e-shell.h"
+#include "shell/e-shell-window.h"
+#include "composer/e-msg-composer.h"
+#include "widgets/misc/e-preferences-window.h"
+
+#include "e-mail-shell-migrate.h"
+#include "e-mail-shell-settings.h"
+#include "e-mail-shell-sidebar.h"
+#include "e-mail-shell-view.h"
+
+#include "e-attachment-handler-mail.h"
+#include "e-mail-browser.h"
+#include "e-mail-reader.h"
+#include "em-account-prefs.h"
+#include "em-composer-prefs.h"
+#include "em-composer-utils.h"
+#include "em-config.h"
+#include "em-event.h"
+#include "em-folder-tree-model.h"
+#include "em-folder-utils.h"
+#include "em-format-hook.h"
+#include "em-format-html-display.h"
+#include "em-junk-hook.h"
+#include "em-mailer-prefs.h"
+#include "em-network-prefs.h"
+#include "em-utils.h"
+#include "mail-config.h"
+#include "mail-folder-cache.h"
+#include "mail-mt.h"
+#include "mail-ops.h"
+#include "mail-send-recv.h"
+#include "mail-session.h"
+#include "mail-vfolder.h"
+#include "importers/mail-importer.h"
+
+#define E_MAIL_SHELL_BACKEND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_SHELL_BACKEND, EMailShellBackendPrivate))
+
+#define BACKEND_NAME "mail"
+
+typedef struct _StoreInfo StoreInfo;
+
+/* XXX Temporary */
+CamelStore *vfolder_store;
+
+struct _StoreInfo {
+ CamelStore *store;
+ gint ref_count;
+ gchar *name;
+
+ /* Keep a reference to these so they remain around for the session. */
+ CamelFolder *vtrash;
+ CamelFolder *vjunk;
+
+ /* Initialization callback. */
+ void (*done) (CamelStore *store,
+ CamelFolderInfo *info,
+ gpointer user_data);
+ gpointer done_user_data;
+
+ guint removed : 1;
+};
+
+struct _EMailShellBackendPrivate {
+ GHashTable *store_hash;
+ MailAsyncEvent *async_event;
+ EMFolderTreeModel *folder_tree_model;
+ CamelStore *local_store;
+
+ gint mail_sync_in_progress;
+ guint mail_sync_timeout_source_id;
+};
+
+/* XXX Make this a preprocessor definition. */
+const gchar *x_mailer = "Evolution " VERSION SUB_VERSION " " VERSION_COMMENT;
+
+static gpointer parent_class;
+static GType mail_shell_backend_type;
+
+/* The array elements correspond to EMailFolderType. */
+static struct {
+ const gchar *name;
+ gchar *uri;
+ CamelFolder *folder;
+} default_local_folders[] = {
+ { N_("Inbox") },
+ { N_("Drafts") },
+ { N_("Outbox") },
+ { N_("Sent") },
+ { N_("Templates") },
+ { "Inbox" } /* "always local" inbox */
+};
+
+/* XXX So many things need the shell backend that it's
+ * just easier for now to make it globally available.
+ * We should fix this, though. */
+EMailShellBackend *global_mail_shell_backend = NULL;
+
+extern gint camel_application_is_exiting;
+
+static StoreInfo *
+store_info_new (CamelStore *store,
+ const gchar *name)
+{
+ CamelService *service;
+ StoreInfo *si;
+
+ g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
+
+ service = CAMEL_SERVICE (store);
+
+ si = g_slice_new0 (StoreInfo);
+ si->ref_count = 1;
+
+ if (name == NULL)
+ si->name = camel_service_get_name (service, TRUE);
+ else
+ si->name = g_strdup (name);
+
+ si->store = store;
+ camel_object_ref (store);
+
+ /* If these are vfolders then they need to be opened now,
+ * otherwise they won't keep track of all folders. */
+ if (store->flags & CAMEL_STORE_VTRASH)
+ si->vtrash = camel_store_get_trash (store, NULL);
+ if (store->flags & CAMEL_STORE_VJUNK)
+ si->vjunk = camel_store_get_junk (store, NULL);
+
+ return si;
+}
+
+static StoreInfo *
+store_info_ref (StoreInfo *si)
+{
+ g_return_val_if_fail (si != NULL, si);
+ g_return_val_if_fail (si->ref_count > 0, si);
+
+ g_atomic_int_add (&si->ref_count, 1);
+
+ return si;
+}
+
+static void
+store_info_unref (StoreInfo *si)
+{
+ g_return_if_fail (si != NULL);
+ g_return_if_fail (si->ref_count > 0);
+
+ if (g_atomic_int_exchange_and_add (&si->ref_count, -1) > 1)
+ return;
+
+ if (si->vtrash != NULL)
+ camel_object_unref (si->vtrash);
+ if (si->vjunk != NULL)
+ camel_object_unref (si->vjunk);
+ camel_object_unref (si->store);
+ g_free (si->name);
+
+ g_slice_free (StoreInfo, si);
+}
+
+static void
+store_hash_free (StoreInfo *si)
+{
+ si->removed = 1;
+ store_info_unref (si);
+}
+
+static gboolean
+mail_shell_backend_add_store_done (CamelStore *store,
+ CamelFolderInfo *info,
+ gpointer user_data)
+{
+ StoreInfo *si = user_data;
+
+ if (si->done != NULL)
+ si->done (store, info, si);
+
+ if (!si->removed) {
+ /* Let the counters know about the already-opened
+ * junk and trash folders. */
+ if (si->vtrash != NULL)
+ mail_note_folder (si->vtrash);
+ if (si->vjunk != NULL)
+ mail_note_folder (si->vjunk);
+ }
+
+ store_info_unref (si);
+
+ return TRUE;
+}
+
+static void
+mail_shell_backend_add_store (EMailShellBackend *mail_shell_backend,
+ CamelStore *store,
+ const gchar *name,
+ void (*done) (CamelStore *store,
+ CamelFolderInfo *info,
+ gpointer user_data))
+{
+ EMFolderTreeModel *folder_tree_model;
+ GHashTable *store_hash;
+ StoreInfo *si;
+
+ store_hash = mail_shell_backend->priv->store_hash;
+ folder_tree_model = mail_shell_backend->priv->folder_tree_model;
+
+ si = store_info_new (store, name);
+ si->done = done;
+ g_hash_table_insert (store_hash, store, si);
+
+ em_folder_tree_model_add_store (folder_tree_model, store, si->name);
+
+ mail_note_store (
+ mail_shell_backend, store, NULL,
+ mail_shell_backend_add_store_done, store_info_ref (si));
+}
+
+static void
+mail_shell_backend_add_local_store_done (CamelStore *store,
+ CamelFolderInfo *info,
+ gpointer unused)
+{
+ gint ii;
+
+ for (ii = 0; ii < G_N_ELEMENTS (default_local_folders); ii++) {
+ if (default_local_folders[ii].folder != NULL)
+ mail_note_folder (default_local_folders[ii].folder);
+ }
+}
+
+static void
+mail_shell_backend_add_local_store (EMailShellBackend *mail_shell_backend,
+ CamelStore *local_store,
+ const gchar *name)
+{
+ mail_shell_backend_add_store (
+ mail_shell_backend, local_store, name,
+ mail_shell_backend_add_local_store_done);
+}
+
+static void
+mail_shell_backend_init_hooks (void)
+{
+ e_plugin_hook_register_type (em_config_hook_get_type ());
+ e_plugin_hook_register_type (em_event_hook_get_type ());
+ e_plugin_hook_register_type (em_junk_hook_get_type ());
+
+ /* EMFormat classes must be registered before EMFormatHook. */
+ em_format_hook_register_type (em_format_get_type ());
+ em_format_hook_register_type (em_format_html_get_type ());
+ em_format_hook_register_type (em_format_html_display_get_type ());
+ e_plugin_hook_register_type (em_format_hook_get_type ());
+
+ em_junk_hook_register_type (emj_get_type ());
+}
+
+static void
+mail_shell_backend_init_importers (void)
+{
+ EImportClass *import_class;
+ EImportImporter *importer;
+
+ import_class = g_type_class_ref (e_import_get_type ());
+
+ importer = mbox_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+
+ importer = elm_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+
+ importer = pine_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+}
+
+static void
+mail_shell_backend_init_local_store (EShellBackend *shell_backend)
+{
+ EMailShellBackendPrivate *priv;
+ CamelException ex;
+ CamelService *service;
+ CamelURL *url;
+ MailAsyncEvent *async_event;
+ const gchar *data_dir;
+ gchar *temp;
+ gint ii;
+
+ priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+
+ camel_exception_init (&ex);
+
+ async_event = priv->async_event;
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+
+ url = camel_url_new ("mbox:", NULL);
+ temp = g_build_filename (data_dir, "local", NULL);
+ camel_url_set_path (url, temp);
+ g_free (temp);
+
+ temp = camel_url_to_string (url, 0);
+ service = camel_session_get_service (
+ session, temp, CAMEL_PROVIDER_STORE, &ex);
+ g_free (temp);
+
+ if (service == NULL)
+ goto fail;
+
+ for (ii = 0; ii < G_N_ELEMENTS (default_local_folders); ii++) {
+ /* FIXME Should this URI be account relative? */
+ camel_url_set_fragment (url, default_local_folders[ii].name);
+ default_local_folders[ii].uri = camel_url_to_string (url, 0);
+ default_local_folders[ii].folder = camel_store_get_folder (
+ CAMEL_STORE (service), default_local_folders[ii].name,
+ CAMEL_STORE_FOLDER_CREATE, &ex);
+ camel_exception_clear (&ex);
+ }
+
+ camel_url_free (url);
+
+ camel_object_ref (service);
+ g_object_ref (shell_backend);
+
+ mail_async_event_emit (
+ async_event, MAIL_ASYNC_GUI,
+ (MailAsyncFunc) mail_shell_backend_add_local_store,
+ shell_backend, service, _("On This Computer"));
+
+ priv->local_store = CAMEL_STORE (service);
+
+ return;
+
+fail:
+ g_warning ("Could not initialize local store/folder: %s", ex.desc);
+
+ camel_exception_clear (&ex);
+ camel_url_free (url);
+}
+
+static void
+mail_shell_backend_load_accounts (EShellBackend *shell_backend)
+{
+ EAccountList *account_list;
+ EIterator *iter;
+
+ account_list = e_get_account_list ();
+
+ for (iter = e_list_get_iterator ((EList *) account_list);
+ e_iterator_is_valid (iter); e_iterator_next (iter)) {
+
+ EAccountService *service;
+ EAccount *account;
+ const gchar *name;
+ const gchar *url;
+
+ account = (EAccount *) e_iterator_get (iter);
+ service = account->source;
+ name = account->name;
+ url = service->url;
+
+ if (!account->enabled)
+ continue;
+
+ if (url == NULL || *url == '\0')
+ continue;
+
+ /* HACK: mbox URL's are handled by the local store setup
+ * above. Any that come through as account sources
+ * are really movemail sources! */
+ if (g_str_has_prefix (url, "mbox:"))
+ continue;
+
+ e_mail_shell_backend_load_store_by_uri (
+ E_MAIL_SHELL_BACKEND (shell_backend), url, name);
+ }
+
+ g_object_unref (iter);
+}
+
+static void
+mail_shell_backend_mail_icon_cb (EShellWindow *shell_window,
+ const gchar *icon_name)
+{
+ GtkAction *action;
+
+ action = e_shell_window_get_shell_view_action (
+ shell_window, BACKEND_NAME);
+ g_object_set (action, "icon-name", icon_name, NULL);
+}
+
+static void
+action_mail_folder_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EMFolderTree *folder_tree = NULL;
+ EMailShellSidebar *mail_shell_sidebar;
+ EShellSidebar *shell_sidebar;
+ EShellView *shell_view;
+ const gchar *view_name;
+
+ /* Take care not to unnecessarily load the mail shell view. */
+ view_name = e_shell_window_get_active_view (shell_window);
+ if (g_strcmp0 (view_name, BACKEND_NAME) != 0)
+ goto exit;
+
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+exit:
+ em_folder_utils_create_folder (
+ NULL, folder_tree, GTK_WINDOW (shell_window));
+}
+
+static void
+action_mail_message_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ GtkWindow *window = GTK_WINDOW (shell_window);
+ EMailShellSidebar *mail_shell_sidebar;
+ EShellSidebar *shell_sidebar;
+ EShellView *shell_view;
+ EMFolderTree *folder_tree;
+ const gchar *view_name;
+ gchar *uri = NULL;
+
+ if (!em_utils_check_user_can_send_mail (window))
+ return;
+
+ /* Take care not to unnecessarily load the mail shell view. */
+ view_name = e_shell_window_get_active_view (shell_window);
+ if (g_strcmp0 (view_name, BACKEND_NAME) != 0)
+ goto exit;
+
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ uri = em_folder_tree_get_selected_uri (folder_tree);
+
+exit:
+ em_utils_compose_new_message (uri);
+
+ g_free (uri);
+}
+
+static GtkActionEntry item_entries[] = {
+
+ { "mail-message-new",
+ "mail-message-new",
+ NC_("New", "_Mail Message"),
+ "<Shift><Control>m",
+ N_("Compose a new mail message"),
+ G_CALLBACK (action_mail_message_new_cb) }
+};
+
+static GtkActionEntry source_entries[] = {
+
+ { "mail-folder-new",
+ "folder-new",
+ NC_("New", "Mail _Folder"),
+ NULL,
+ N_("Create a new mail folder"),
+ G_CALLBACK (action_mail_folder_new_cb) }
+};
+
+static void
+mail_shell_backend_init_preferences (EShell *shell)
+{
+ EAccountList *account_list;
+ GtkWidget *preferences_window;
+
+ account_list = e_get_account_list ();
+ preferences_window = e_shell_get_preferences_window (shell);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "mail-accounts",
+ "preferences-mail-accounts",
+ _("Mail Accounts"),
+ em_account_prefs_new (account_list),
+ 100);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "mail",
+ "preferences-mail",
+ _("Mail Preferences"),
+ em_mailer_prefs_new (shell),
+ 300);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "composer",
+ "preferences-composer",
+ _("Composer Preferences"),
+ em_composer_prefs_new (shell),
+ 400);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "system-network-proxy",
+ "preferences-system-network-proxy",
+ _("Network Preferences"),
+ em_network_prefs_new (),
+ 500);
+}
+
+static void
+mail_shell_backend_sync_store_done_cb (CamelStore *store,
+ gpointer user_data)
+{
+ EMailShellBackend *mail_shell_backend = user_data;
+
+ mail_shell_backend->priv->mail_sync_in_progress--;
+}
+
+static void
+mail_shell_backend_sync_store_cb (CamelStore *store,
+ EMailShellBackend *mail_shell_backend)
+{
+ if (!camel_application_is_exiting) {
+ mail_shell_backend->priv->mail_sync_in_progress++;
+ mail_sync_store (
+ store, FALSE,
+ mail_shell_backend_sync_store_done_cb,
+ mail_shell_backend);
+ }
+}
+
+static gboolean
+mail_shell_backend_mail_sync (EMailShellBackend *mail_shell_backend)
+{
+ if (camel_application_is_exiting)
+ return FALSE;
+
+ if (mail_shell_backend->priv->mail_sync_in_progress)
+ goto exit;
+
+ if (session == NULL || !camel_session_is_online (session))
+ goto exit;
+
+ e_mail_shell_backend_stores_foreach (
+ mail_shell_backend, (GHFunc)
+ mail_shell_backend_sync_store_cb,
+ mail_shell_backend);
+
+exit:
+ return !camel_application_is_exiting;
+}
+
+static void
+mail_shell_backend_notify_online_cb (EShell *shell,
+ GParamSpec *pspec,
+ EShellBackend *shell_backend)
+{
+ gboolean online;
+
+ online = e_shell_get_online (shell);
+ camel_session_set_online (session, online);
+}
+
+static void
+mail_shell_backend_handle_email_uri_cb (gchar *folder_uri,
+ CamelFolder *folder,
+ gpointer user_data)
+{
+ EMailShellBackend *mail_shell_backend = user_data;
+ CamelURL *url = user_data;
+ const gchar *forward;
+ const gchar *reply;
+ const gchar *uid;
+
+ if (folder == NULL) {
+ g_warning ("Could not open folder '%s'", folder_uri);
+ goto exit;
+ }
+
+ forward = camel_url_get_param (url, "forward");
+ reply = camel_url_get_param (url, "reply");
+ uid = camel_url_get_param (url, "uid");
+
+ if (reply != NULL) {
+ gint mode;
+
+ if (g_strcmp0 (reply, "all") == 0)
+ mode = REPLY_MODE_ALL;
+ else if (g_strcmp0 (reply, "list") == 0)
+ mode = REPLY_MODE_LIST;
+ else
+ mode = REPLY_MODE_SENDER;
+
+ em_utils_reply_to_message (folder, uid, NULL, mode, NULL);
+
+ } else if (forward != NULL) {
+ GPtrArray *uids;
+
+ uids = g_ptr_array_new ();
+ g_ptr_array_add (uids, g_strdup (uid));
+
+ if (g_strcmp0 (forward, "attached") == 0)
+ em_utils_forward_attached (folder, uids, folder_uri);
+ else if (g_strcmp0 (forward, "inline") == 0)
+ em_utils_forward_inline (folder, uids, folder_uri);
+ else if (g_strcmp0 (forward, "quoted") == 0)
+ em_utils_forward_quoted (folder, uids, folder_uri);
+ else
+ em_utils_forward_messages (folder, uids, folder_uri);
+
+ } else {
+ GtkWidget *browser;
+
+ /* FIXME Should pass in the shell module. */
+ browser = e_mail_browser_new (mail_shell_backend);
+ e_mail_reader_set_folder (
+ E_MAIL_READER (browser), folder, folder_uri);
+ e_mail_reader_set_message (
+ E_MAIL_READER (browser), uid, FALSE);
+ gtk_widget_show (browser);
+ }
+
+exit:
+ camel_url_free (url);
+}
+
+static gboolean
+mail_shell_backend_handle_uri_cb (EShell *shell,
+ const gchar *uri,
+ EMailShellBackend *mail_shell_backend)
+{
+ gboolean handled = TRUE;
+
+ if (g_str_has_prefix (uri, "mailto:")) {
+ if (em_utils_check_user_can_send_mail (NULL))
+ em_utils_compose_new_message_with_mailto (uri, NULL);
+
+ } else if (g_str_has_prefix (uri, "email:")) {
+ CamelURL *url;
+
+ url = camel_url_new (uri, NULL);
+ if (camel_url_get_param (url, "uid") != NULL) {
+ gchar *curi = em_uri_to_camel (uri);
+
+ mail_get_folder (
+ curi, 0,
+ mail_shell_backend_handle_email_uri_cb,
+ mail_shell_backend, mail_msg_unordered_push);
+ g_free (curi);
+
+ } else {
+ g_warning ("Email URI's must include a uid parameter");
+ camel_url_free (url);
+ }
+ } else
+ handled = FALSE;
+
+ return TRUE;
+}
+
+/* Helper for mail_shell_backend_prepare_for_[off|on]line_cb() */
+static void
+mail_shell_store_line_transition_done_cb (CamelStore *store,
+ gpointer user_data)
+{
+ EActivity *activity = user_data;
+
+ g_object_unref (activity);
+}
+
+/* Helper for mail_shell_backend_prepare_for_offline_cb() */
+static void
+mail_shell_store_prepare_for_offline_cb (CamelService *service,
+ gpointer unused,
+ EActivity *activity)
+{
+ if (CAMEL_IS_DISCO_STORE (service) || CAMEL_IS_OFFLINE_STORE (service))
+ mail_store_set_offline (
+ CAMEL_STORE (service), TRUE,
+ mail_shell_store_line_transition_done_cb,
+ g_object_ref (activity));
+}
+
+static void
+mail_shell_backend_prepare_for_offline_cb (EShell *shell,
+ EActivity *activity,
+ EMailShellBackend *mail_shell_backend)
+{
+ GList *watched_windows;
+ GtkWidget *parent = NULL;
+ gboolean synchronize = FALSE;
+
+ watched_windows = e_shell_get_watched_windows (shell);
+ if (watched_windows != NULL)
+ parent = GTK_WIDGET (watched_windows->data);
+
+ if (e_shell_get_network_available (shell))
+ synchronize = em_utils_prompt_user (
+ GTK_WINDOW (parent),
+ "/apps/evolution/mail/prompts/quick_offline",
+ "mail:ask-quick-offline", NULL);
+
+ if (!synchronize) {
+ mail_cancel_all ();
+ camel_session_set_network_state (session, FALSE);
+ }
+
+ e_mail_shell_backend_stores_foreach (
+ mail_shell_backend, (GHFunc)
+ mail_shell_store_prepare_for_offline_cb, activity);
+}
+
+/* Helper for mail_shell_backend_prepare_for_online_cb() */
+static void
+mail_shell_store_prepare_for_online_cb (CamelService *service,
+ gpointer unused,
+ EActivity *activity)
+{
+ if (CAMEL_IS_DISCO_STORE (service) || CAMEL_IS_OFFLINE_STORE (service))
+ mail_store_set_offline (
+ CAMEL_STORE (service), FALSE,
+ mail_shell_store_line_transition_done_cb,
+ g_object_ref (activity));
+}
+
+static void
+mail_shell_backend_prepare_for_online_cb (EShell *shell,
+ EActivity *activity,
+ EMailShellBackend *mail_shell_backend)
+{
+ camel_session_set_online (session, TRUE);
+
+ e_mail_shell_backend_stores_foreach (
+ mail_shell_backend, (GHFunc)
+ mail_shell_store_prepare_for_online_cb, activity);
+}
+
+static void
+mail_shell_backend_send_receive_cb (EShell *shell,
+ GtkWindow *parent,
+ EShellBackend *shell_backend)
+{
+ em_utils_clear_get_password_canceled_accounts_flag ();
+ mail_send_receive (parent);
+}
+
+static void
+mail_shell_backend_window_weak_notify_cb (EShell *shell,
+ GObject *where_the_object_was)
+{
+ g_signal_handlers_disconnect_by_func (
+ shell, mail_shell_backend_mail_icon_cb,
+ where_the_object_was);
+}
+
+static void
+mail_shell_backend_window_created_cb (EShell *shell,
+ GtkWindow *window,
+ EShellBackend *shell_backend)
+{
+ EShellSettings *shell_settings;
+ static gboolean first_time = TRUE;
+ const gchar *backend_name;
+
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ /* This applies to both the composer and signature editor. */
+ if (GTKHTML_IS_EDITOR (window)) {
+ GList *spell_languages;
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "composer-inline-spelling",
+ G_OBJECT (window), "inline-spelling");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "composer-magic-links",
+ G_OBJECT (window), "magic-links");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "composer-magic-smileys",
+ G_OBJECT (window), "magic-smileys");
+
+ spell_languages = e_load_spell_languages ();
+ gtkhtml_editor_set_spell_languages (
+ GTKHTML_EDITOR (window), spell_languages);
+ g_list_free (spell_languages);
+ }
+
+ if (E_IS_MSG_COMPOSER (window)) {
+ /* Integrate the new composer into the mail module. */
+ em_configure_new_composer (E_MSG_COMPOSER (window));
+ return;
+ }
+
+ if (!E_IS_SHELL_WINDOW (window))
+ return;
+
+ backend_name = E_SHELL_BACKEND_GET_CLASS (shell_backend)->name;
+
+ e_shell_window_register_new_item_actions (
+ E_SHELL_WINDOW (window), backend_name,
+ item_entries, G_N_ELEMENTS (item_entries));
+
+ e_shell_window_register_new_source_actions (
+ E_SHELL_WINDOW (window), backend_name,
+ source_entries, G_N_ELEMENTS (source_entries));
+
+ g_signal_connect_swapped (
+ shell, "event::mail-icon",
+ G_CALLBACK (mail_shell_backend_mail_icon_cb), window);
+
+ g_object_weak_ref (
+ G_OBJECT (window), (GWeakNotify)
+ mail_shell_backend_window_weak_notify_cb, shell);
+
+ if (first_time) {
+ g_signal_connect (
+ window, "map-event",
+ G_CALLBACK (e_msg_composer_check_autosave), NULL);
+ first_time = FALSE;
+ }
+}
+
+static void
+mail_shell_backend_dispose (GObject *object)
+{
+ EMailShellBackendPrivate *priv;
+
+ priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (object);
+
+ g_hash_table_remove_all (priv->store_hash);
+
+ if (priv->folder_tree_model != NULL) {
+ g_object_unref (priv->folder_tree_model);
+ priv->folder_tree_model = NULL;
+ }
+
+ if (priv->local_store != NULL) {
+ camel_object_unref (priv->local_store);
+ priv->local_store = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+mail_shell_backend_finalize (GObject *object)
+{
+ EMailShellBackendPrivate *priv;
+
+ priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->store_hash);
+ mail_async_event_destroy (priv->async_event);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+mail_shell_backend_constructed (GObject *object)
+{
+ EMailShellBackendPrivate *priv;
+ EShell *shell;
+ EShellBackend *shell_backend;
+
+ priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (object);
+
+ shell_backend = E_SHELL_BACKEND (object);
+ shell = e_shell_backend_get_shell (shell_backend);
+
+ /* This also initializes Camel, so it needs to happen early. */
+ mail_session_init (E_MAIL_SHELL_BACKEND (shell_backend));
+
+ mail_shell_backend_init_hooks ();
+ mail_shell_backend_init_importers ();
+
+ e_attachment_handler_mail_get_type ();
+
+ /* XXX This never gets unreffed. */
+ global_mail_shell_backend = g_object_ref (shell_backend);
+
+ priv->store_hash = g_hash_table_new_full (
+ g_direct_hash, g_direct_equal,
+ (GDestroyNotify) NULL,
+ (GDestroyNotify) store_hash_free);
+
+ priv->async_event = mail_async_event_new ();
+
+ priv->folder_tree_model = em_folder_tree_model_new (
+ E_MAIL_SHELL_BACKEND (shell_backend));
+
+ g_signal_connect (
+ shell, "notify::online",
+ G_CALLBACK (mail_shell_backend_notify_online_cb),
+ shell_backend);
+
+ g_signal_connect (
+ shell, "handle-uri",
+ G_CALLBACK (mail_shell_backend_handle_uri_cb),
+ shell_backend);
+
+ g_signal_connect (
+ shell, "prepare-for-offline",
+ G_CALLBACK (mail_shell_backend_prepare_for_offline_cb),
+ shell_backend);
+
+ g_signal_connect (
+ shell, "prepare-for-online",
+ G_CALLBACK (mail_shell_backend_prepare_for_online_cb),
+ shell_backend);
+
+ g_signal_connect (
+ shell, "send-receive",
+ G_CALLBACK (mail_shell_backend_send_receive_cb),
+ shell_backend);
+
+ g_signal_connect (
+ shell, "window-created",
+ G_CALLBACK (mail_shell_backend_window_created_cb),
+ shell_backend);
+
+ mail_config_init ();
+ mail_msg_init ();
+
+ mail_shell_backend_init_local_store (shell_backend);
+ mail_shell_backend_load_accounts (shell_backend);
+
+ /* Initialize settings before initializing preferences,
+ * since the preferences bind to the shell settings. */
+ e_mail_shell_settings_init (shell);
+ mail_shell_backend_init_preferences (shell);
+}
+
+static void
+mail_shell_backend_start (EShellBackend *shell_backend)
+{
+ EMailShellBackendPrivate *priv;
+ EShell *shell;
+ EShellSettings *shell_settings;
+ gboolean enable_search_folders;
+
+ priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ /* XXX Do we really still need this flag? */
+ mail_session_set_interactive (TRUE);
+
+ enable_search_folders = e_shell_settings_get_boolean (
+ shell_settings, "mail-enable-search-folders");
+ if (enable_search_folders)
+ vfolder_load_storage ();
+
+ mail_autoreceive_init (shell_backend, session);
+
+ if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL)
+ priv->mail_sync_timeout_source_id = g_timeout_add_seconds (
+ mail_config_get_sync_timeout (),
+ (GSourceFunc) mail_shell_backend_mail_sync,
+ shell_backend);
+}
+
+static void
+mail_shell_backend_class_init (EMailShellBackendClass *class)
+{
+ GObjectClass *object_class;
+ EShellBackendClass *shell_backend_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMailShellBackendPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = mail_shell_backend_dispose;
+ object_class->finalize = mail_shell_backend_finalize;
+ object_class->constructed = mail_shell_backend_constructed;
+
+ shell_backend_class = E_SHELL_BACKEND_CLASS (class);
+ shell_backend_class->shell_view_type = E_TYPE_MAIL_SHELL_VIEW;
+ shell_backend_class->name = BACKEND_NAME;
+ shell_backend_class->aliases = "";
+ shell_backend_class->schemes = "mailto:email";
+ shell_backend_class->sort_order = 200;
+ shell_backend_class->start = mail_shell_backend_start;
+ shell_backend_class->is_busy = NULL;
+ shell_backend_class->shutdown = NULL;
+ shell_backend_class->migrate = e_mail_shell_migrate;
+}
+
+static void
+mail_shell_backend_init (EMailShellBackend *mail_shell_backend)
+{
+ mail_shell_backend->priv =
+ E_MAIL_SHELL_BACKEND_GET_PRIVATE (mail_shell_backend);
+}
+
+GType
+e_mail_shell_backend_get_type (void)
+{
+ return mail_shell_backend_type;
+}
+
+void
+e_mail_shell_backend_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (EMailShellBackendClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_shell_backend_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMailShellBackend),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mail_shell_backend_init,
+ NULL /* value_table */
+ };
+
+ mail_shell_backend_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_BACKEND,
+ "EMailShellBackend", &type_info, 0);
+}
+
+/******************************** Public API *********************************/
+
+CamelFolder *
+e_mail_shell_backend_get_folder (EMailShellBackend *mail_shell_backend,
+ EMailFolderType folder_type)
+{
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
+
+ return default_local_folders[folder_type].folder;
+}
+
+const gchar *
+e_mail_shell_backend_get_folder_uri (EMailShellBackend *mail_shell_backend,
+ EMailFolderType folder_type)
+{
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
+
+ return default_local_folders[folder_type].uri;
+}
+
+EMFolderTreeModel *
+e_mail_shell_backend_get_folder_tree_model (EMailShellBackend *mail_shell_backend)
+{
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
+
+ return mail_shell_backend->priv->folder_tree_model;
+}
+
+void
+e_mail_shell_backend_add_store (EMailShellBackend *mail_shell_backend,
+ CamelStore *store,
+ const gchar *name)
+{
+ g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend));
+ g_return_if_fail (CAMEL_IS_STORE (store));
+ g_return_if_fail (name != NULL);
+
+ mail_shell_backend_add_store (mail_shell_backend, store, name, NULL);
+}
+
+CamelStore *
+e_mail_shell_backend_get_local_store (EMailShellBackend *mail_shell_backend)
+{
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
+
+ return mail_shell_backend->priv->local_store;
+}
+
+CamelStore *
+e_mail_shell_backend_load_store_by_uri (EMailShellBackend *mail_shell_backend,
+ const gchar *uri,
+ const gchar *name)
+{
+ CamelStore *store;
+ CamelProvider *provider;
+ CamelException ex;
+
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
+ g_return_val_if_fail (uri != NULL, NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+
+ camel_exception_init (&ex);
+
+ /* Load the service, but don't connect. Check its provider,
+ * and if this belongs in the shell's folder list, add it. */
+
+ provider = camel_provider_get (uri, &ex);
+ if (provider == NULL)
+ goto fail;
+
+ if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
+ return NULL;
+
+ store = (CamelStore *) camel_session_get_service (
+ session, uri, CAMEL_PROVIDER_STORE, &ex);
+ if (store == NULL)
+ goto fail;
+
+ e_mail_shell_backend_add_store (mail_shell_backend, store, name);
+
+ camel_object_unref (store);
+
+ return store;
+
+fail:
+ /* FIXME: Show an error dialog. */
+ g_warning (
+ "Couldn't get service: %s: %s", uri,
+ camel_exception_get_description (&ex));
+ camel_exception_clear (&ex);
+
+ return NULL;
+}
+
+/* Helper for e_mail_shell_backend_remove_store() */
+static void
+mail_shell_backend_remove_store_cb (CamelStore *store,
+ gpointer event_data,
+ gpointer user_data)
+{
+ camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL);
+ camel_object_unref (store);
+}
+
+void
+e_mail_shell_backend_remove_store (EMailShellBackend *mail_shell_backend,
+ CamelStore *store)
+{
+ GHashTable *store_hash;
+ MailAsyncEvent *async_event;
+ EMFolderTreeModel *folder_tree_model;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend));
+ g_return_if_fail (CAMEL_IS_STORE (store));
+
+ store_hash = mail_shell_backend->priv->store_hash;
+ async_event = mail_shell_backend->priv->async_event;
+ folder_tree_model = mail_shell_backend->priv->folder_tree_model;
+
+ /* Because the store hash holds a reference to each store used
+ * as a key in it, none of them will ever be gc'ed, meaning any
+ * call to camel_session_get_{service,store} with the same URL
+ * will always return the same object. So this works. */
+
+ if (g_hash_table_lookup (store_hash, store) == NULL)
+ return;
+
+ camel_object_ref (store);
+ g_hash_table_remove (store_hash, store);
+ mail_note_store_remove (store);
+ em_folder_tree_model_remove_store (folder_tree_model, store);
+
+ mail_async_event_emit (
+ async_event, MAIL_ASYNC_THREAD,
+ (MailAsyncFunc) mail_shell_backend_remove_store_cb,
+ store, NULL, NULL);
+}
+
+void
+e_mail_shell_backend_remove_store_by_uri (EMailShellBackend *mail_shell_backend,
+ const gchar *uri)
+{
+ CamelStore *store;
+ CamelProvider *provider;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend));
+ g_return_if_fail (uri != NULL);
+
+ provider = camel_provider_get (uri, NULL);
+ if (provider == NULL)
+ return;
+
+ if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
+ return;
+
+ store = (CamelStore *) camel_session_get_service (
+ session, uri, CAMEL_PROVIDER_STORE, NULL);
+ if (store != NULL) {
+ e_mail_shell_backend_remove_store (mail_shell_backend, store);
+ camel_object_unref (store);
+ }
+}
+
+void
+e_mail_shell_backend_stores_foreach (EMailShellBackend *mail_shell_backend,
+ GHFunc func,
+ gpointer user_data)
+{
+ GHashTable *store_hash;
+ GHashTableIter iter;
+ gpointer key, value;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend));
+ g_return_if_fail (func != NULL);
+
+ store_hash = mail_shell_backend->priv->store_hash;
+
+ g_hash_table_iter_init (&iter, store_hash);
+
+ while (g_hash_table_iter_next (&iter, &key, &value))
+ func (key, ((StoreInfo *) value)->name, user_data);
+}
+
+/******************* Code below here belongs elsewhere. *******************/
+
+#include "filter/filter-option.h"
+#include "shell/e-shell-settings.h"
+#include "mail/e-mail-label-list-store.h"
+
+GSList *
+e_mail_labels_get_filter_options (void)
+{
+ EShell *shell;
+ EShellSettings *shell_settings;
+ EMailLabelListStore *list_store;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GSList *list = NULL;
+ gboolean valid;
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+ list_store = e_shell_settings_get_object (
+ shell_settings, "mail-label-list-store");
+
+ model = GTK_TREE_MODEL (list_store);
+ valid = gtk_tree_model_get_iter_first (model, &iter);
+
+ while (valid) {
+ struct _filter_option *option;
+ gchar *name, *tag;
+
+ name = e_mail_label_list_store_get_name (list_store, &iter);
+ tag = e_mail_label_list_store_get_tag (list_store, &iter);
+
+ option = g_new0 (struct _filter_option, 1);
+ option->title = e_str_without_underscores (name);
+ option->value = tag; /* takes ownership */
+
+ g_free (name);
+
+ valid = gtk_tree_model_iter_next (model, &iter);
+ }
+
+ g_object_unref (list_store);
+
+ return list;
+}
diff --git a/mail/e-mail-shell-backend.h b/mail/e-mail-shell-backend.h
new file mode 100644
index 0000000000..248768062f
--- /dev/null
+++ b/mail/e-mail-shell-backend.h
@@ -0,0 +1,122 @@
+/*
+ * e-mail-shell-backend.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_SHELL_BACKEND_H
+#define E_MAIL_SHELL_BACKEND_H
+
+#include <shell/e-shell-backend.h>
+
+#include <camel/camel-folder.h>
+#include <camel/camel-store.h>
+#include <e-util/e-signature-list.h>
+#include <libedataserver/e-account-list.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_SHELL_BACKEND \
+ (e_mail_shell_backend_get_type ())
+#define E_MAIL_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_SHELL_BACKEND, EMailShellBackend))
+#define E_MAIL_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_SHELL_BACKEND, EMailShellBackendClass))
+#define E_IS_MAIL_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_SHELL_BACKEND))
+#define E_IS_MAIL_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_SHELL_BACKEND))
+#define E_MAIL_SHELL_BACKEND_GET_CLASS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_SHELL_BACKEND, EMailShellBackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailShellBackend EMailShellBackend;
+typedef struct _EMailShellBackendClass EMailShellBackendClass;
+typedef struct _EMailShellBackendPrivate EMailShellBackendPrivate;
+
+struct _EMailShellBackend {
+ EShellBackend parent;
+ EMailShellBackendPrivate *priv;
+};
+
+struct _EMailShellBackendClass {
+ EShellBackendClass parent_class;
+};
+
+typedef enum {
+ E_MAIL_FOLDER_INBOX,
+ E_MAIL_FOLDER_DRAFTS,
+ E_MAIL_FOLDER_OUTBOX,
+ E_MAIL_FOLDER_SENT,
+ E_MAIL_FOLDER_TEMPLATES,
+ E_MAIL_FOLDER_LOCAL_INBOX
+} EMailFolderType;
+
+struct _EMFolderTreeModel;
+
+/* Globally available shell backend.
+ *
+ * XXX I don't like having this globally available but passing it around
+ * to all the various utilities that need to access the backend's data
+ * directory and local folders is too much of a pain for now. */
+extern EMailShellBackend *global_mail_shell_backend;
+
+GType e_mail_shell_backend_get_type (void);
+void e_mail_shell_backend_register_type
+ (GTypeModule *type_module);
+CamelFolder * e_mail_shell_backend_get_folder
+ (EMailShellBackend *mail_shell_backend,
+ EMailFolderType folder_type);
+const gchar * e_mail_shell_backend_get_folder_uri
+ (EMailShellBackend *mail_shell_backend,
+ EMailFolderType folder_type);
+struct _EMFolderTreeModel *
+ e_mail_shell_backend_get_folder_tree_model
+ (EMailShellBackend *mail_shell_backend);
+void e_mail_shell_backend_add_store
+ (EMailShellBackend *mail_shell_backend,
+ CamelStore *store,
+ const gchar *name);
+CamelStore * e_mail_shell_backend_get_local_store
+ (EMailShellBackend *mail_shell_backend);
+CamelStore * e_mail_shell_backend_load_store_by_uri
+ (EMailShellBackend *mail_shell_backend,
+ const gchar *uri,
+ const gchar *name);
+void e_mail_shell_backend_remove_store
+ (EMailShellBackend *mail_shell_backend,
+ CamelStore *store);
+void e_mail_shell_backend_remove_store_by_uri
+ (EMailShellBackend *mail_shell_backend,
+ const gchar *uri);
+void e_mail_shell_backend_stores_foreach
+ (EMailShellBackend *mail_shell_backend,
+ GHFunc func,
+ gpointer user_data);
+
+/* XXX Find a better place for this function. */
+GSList * e_mail_labels_get_filter_options(void);
+
+G_END_DECLS
+
+#endif /* E_MAIL_SHELL_BACKEND_H */
diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c
new file mode 100644
index 0000000000..203876fcc3
--- /dev/null
+++ b/mail/e-mail-shell-content.c
@@ -0,0 +1,1016 @@
+/*
+ * e-mail-shell-content.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-shell-content.h"
+
+#include <glib/gi18n.h>
+#include <camel/camel-store.h>
+#include <libedataserver/e-data-server-util.h>
+
+#include "e-util/gconf-bridge.h"
+#include "widgets/menus/gal-view-etable.h"
+#include "widgets/menus/gal-view-instance.h"
+
+#include "em-folder-view.h"
+#include "em-search-context.h"
+#include "em-utils.h"
+#include "mail-config.h"
+#include "mail-ops.h"
+
+#include "e-mail-reader.h"
+#include "e-mail-search-bar.h"
+#include "e-mail-shell-backend.h"
+#include "e-mail-shell-view-actions.h"
+
+#define E_MAIL_SHELL_CONTENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContentPrivate))
+
+struct _EMailShellContentPrivate {
+ GtkWidget *paned;
+ GtkWidget *message_list;
+ GtkWidget *search_bar;
+
+ EMFormatHTMLDisplay *html_display;
+ GalViewInstance *view_instance;
+
+ gchar *selected_uid;
+
+ /* ETable scrolling hack */
+ gdouble default_scrollbar_position;
+
+ guint paned_binding_id;
+ guint scroll_timeout_id;
+
+ /* Signal handler IDs */
+ guint message_list_built_id;
+ guint message_list_scrolled_id;
+
+ guint preview_visible : 1;
+ guint suppress_message_selection : 1;
+ guint vertical_view : 1;
+ guint show_deleted : 1;
+};
+
+enum {
+ PROP_0,
+ PROP_PREVIEW_VISIBLE,
+ PROP_SHOW_DELETED,
+ PROP_VERTICAL_VIEW
+};
+
+static gpointer parent_class;
+static GType mail_shell_content_type;
+
+static void
+mail_shell_content_etree_unfreeze (MessageList *message_list,
+ GdkEvent *event)
+{
+ ETableItem *item;
+ GObject *object;
+
+ item = e_tree_get_item (message_list->tree);
+ object = G_OBJECT (((GnomeCanvasItem *) item)->canvas);
+
+ g_object_set_data (object, "freeze-cursor", 0);
+}
+
+static void
+mail_shell_content_message_list_scrolled_cb (EMailShellContent *mail_shell_content,
+ MessageList *message_list)
+{
+ const gchar *key;
+ gdouble position;
+ gchar *value;
+
+ /* Save the scrollbar position for the current folder. */
+
+ if (message_list->folder == NULL)
+ return;
+
+ key = "evolution:list_scroll_position";
+ position = message_list_get_scrollbar_position (message_list);
+ value = g_strdup_printf ("%f", position);
+
+ if (camel_object_meta_set (message_list->folder, key, value))
+ camel_object_state_write (message_list->folder);
+
+ g_free (value);
+}
+
+static gboolean
+mail_shell_content_scroll_timeout_cb (EMailShellContent *mail_shell_content)
+{
+ EMailShellContentPrivate *priv = mail_shell_content->priv;
+ MessageList *message_list;
+ EMailReader *reader;
+ const gchar *key;
+ gdouble position;
+ gchar *value;
+
+ /* Initialize the scrollbar position for the current folder
+ * and setup a callback to handle scrollbar position changes. */
+
+ reader = E_MAIL_READER (mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+ position = priv->default_scrollbar_position;
+
+ key = "evolution:list_scroll_position";
+ value = camel_object_meta_get (message_list->folder, key);
+
+ if (value != NULL) {
+ position = strtod (value, NULL);
+ g_free (value);
+ }
+
+ message_list_set_scrollbar_position (message_list, position);
+
+ priv->message_list_scrolled_id = g_signal_connect_swapped (
+ message_list, "message-list-scrolled",
+ G_CALLBACK (mail_shell_content_message_list_scrolled_cb),
+ mail_shell_content);
+
+ priv->scroll_timeout_id = 0;
+
+ return FALSE;
+}
+
+static void
+mail_shell_content_message_list_built_cb (EMailShellContent *mail_shell_content,
+ MessageList *message_list)
+{
+ EMailShellContentPrivate *priv = mail_shell_content->priv;
+ GtkScrolledWindow *scrolled_window;
+ GtkWidget *vscrollbar;
+ gdouble position = 0.0;
+
+ g_signal_handler_disconnect (
+ message_list, priv->message_list_built_id);
+ priv->message_list_built_id = 0;
+
+ if (message_list->cursor_uid == NULL && priv->selected_uid != NULL) {
+ CamelMessageInfo *info;
+
+ /* If the message isn't in the folder yet, keep selected_uid
+ * around, as it could be caught by a set_folder() at some
+ * later date. */
+ info = camel_folder_get_message_info (
+ message_list->folder, priv->selected_uid);
+ if (info != NULL) {
+ camel_folder_free_message_info (
+ message_list->folder, info);
+ e_mail_reader_set_message (
+ E_MAIL_READER (mail_shell_content),
+ priv->selected_uid, TRUE);
+ g_free (priv->selected_uid);
+ priv->selected_uid = NULL;
+ }
+
+ position = message_list_get_scrollbar_position (message_list);
+ }
+
+ priv->default_scrollbar_position = position;
+
+ /* FIXME This is a gross workaround for an ETable bug that I can't
+ * fix (Ximian bug #55303).
+ *
+ * Since e_canvas_item_region_show_relay() uses a timeout,
+ * we have to use a timeout of the same interval but a lower
+ * priority. */
+ priv->scroll_timeout_id = g_timeout_add_full (
+ G_PRIORITY_LOW, 250, (GSourceFunc)
+ mail_shell_content_scroll_timeout_cb,
+ mail_shell_content, NULL);
+
+ /* FIXME This is another ugly hack to hide a side-effect of the
+ * previous workaround. */
+ scrolled_window = GTK_SCROLLED_WINDOW (message_list);
+ vscrollbar = gtk_scrolled_window_get_vscrollbar (scrolled_window);
+ g_signal_connect_swapped (
+ vscrollbar, "button-press-event",
+ G_CALLBACK (mail_shell_content_etree_unfreeze),
+ message_list);
+}
+
+static void
+mail_shell_content_display_view_cb (EMailShellContent *mail_shell_content,
+ GalView *gal_view)
+{
+ EMailReader *reader;
+ MessageList *message_list;
+
+ reader = E_MAIL_READER (mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ if (GAL_IS_VIEW_ETABLE (gal_view))
+ gal_view_etable_attach_tree (
+ GAL_VIEW_ETABLE (gal_view), message_list->tree);
+}
+
+static void
+mail_shell_content_message_selected_cb (EMailShellContent *mail_shell_content,
+ const gchar *selected_uid,
+ MessageList *message_list)
+{
+ const gchar *key = "evolution:selected_uid";
+ CamelFolder *folder;
+
+ folder = message_list->folder;
+
+ /* This also gets triggered when selecting a store name on
+ * the sidebar such as "On This Computer", in which case
+ * 'folder' will be NULL. */
+ if (folder == NULL)
+ return;
+
+ if (camel_object_meta_set (folder, key, selected_uid))
+ camel_object_state_write (folder);
+
+ g_free (mail_shell_content->priv->selected_uid);
+ mail_shell_content->priv->selected_uid = NULL;
+}
+
+static void
+mail_shell_content_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_PREVIEW_VISIBLE:
+ e_mail_shell_content_set_preview_visible (
+ E_MAIL_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_SHOW_DELETED:
+ e_mail_shell_content_set_show_deleted (
+ E_MAIL_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_VERTICAL_VIEW:
+ e_mail_shell_content_set_vertical_view (
+ E_MAIL_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_shell_content_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_PREVIEW_VISIBLE:
+ g_value_set_boolean (
+ value,
+ e_mail_shell_content_get_preview_visible (
+ E_MAIL_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_SHOW_DELETED:
+ g_value_set_boolean (
+ value,
+ e_mail_shell_content_get_show_deleted (
+ E_MAIL_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_VERTICAL_VIEW:
+ g_value_set_boolean (
+ value,
+ e_mail_shell_content_get_vertical_view (
+ E_MAIL_SHELL_CONTENT (object)));
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_shell_content_dispose (GObject *object)
+{
+ EMailShellContentPrivate *priv;
+
+ priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object);
+
+ if (priv->paned != NULL) {
+ g_object_unref (priv->paned);
+ priv->paned = NULL;
+ }
+
+ if (priv->message_list != NULL) {
+ g_object_unref (priv->message_list);
+ priv->message_list = NULL;
+ }
+
+ if (priv->search_bar != NULL) {
+ g_object_unref (priv->search_bar);
+ priv->search_bar = NULL;
+ }
+
+ if (priv->html_display != NULL) {
+ g_object_unref (priv->html_display);
+ priv->html_display = NULL;
+ }
+
+ if (priv->view_instance != NULL) {
+ g_object_unref (priv->view_instance);
+ priv->view_instance = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+mail_shell_content_finalize (GObject *object)
+{
+ EMailShellContentPrivate *priv;
+
+ priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object);
+
+ g_free (priv->selected_uid);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+mail_shell_content_constructed (GObject *object)
+{
+ EMailShellContentPrivate *priv;
+ EShellContent *shell_content;
+ EShellBackend *shell_backend;
+ EShellView *shell_view;
+ EShellViewClass *shell_view_class;
+ EMailReader *reader;
+ MessageList *message_list;
+ GConfBridge *bridge;
+ GtkWidget *container;
+ GtkWidget *widget;
+ GtkHTML *html;
+ GalViewCollection *view_collection;
+ const gchar *key;
+
+ priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object);
+ priv->html_display = em_format_html_display_new ();
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ shell_content = E_SHELL_CONTENT (object);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ view_collection = shell_view_class->view_collection;
+
+ html = EM_FORMAT_HTML (priv->html_display)->html;
+
+ /* Build content widgets. */
+
+ container = GTK_WIDGET (object);
+
+ widget = gtk_vpaned_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->paned = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = message_list_new (shell_backend);
+ gtk_paned_add1 (GTK_PANED (container), widget);
+ priv->message_list = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_vbox_new (FALSE, 1);
+ gtk_paned_add2 (GTK_PANED (container), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (html));
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ gtk_widget_show (GTK_WIDGET (html));
+ gtk_widget_show (widget);
+
+ widget = e_mail_search_bar_new (html);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ priv->search_bar = g_object_ref (widget);
+ gtk_widget_hide (widget);
+
+ g_signal_connect_swapped (
+ widget, "changed",
+ G_CALLBACK (em_format_redraw), priv->html_display);
+
+ /* Load the view instance. */
+
+ e_mail_shell_content_update_view_instance (
+ E_MAIL_SHELL_CONTENT (shell_content));
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (priv->paned);
+ key = "/apps/evolution/mail/display/paned_size";
+ gconf_bridge_bind_property_delayed (bridge, key, object, "position");
+
+ object = G_OBJECT (shell_content);
+ key = "/apps/evolution/mail/display/show_deleted";
+ gconf_bridge_bind_property (bridge, key, object, "show-deleted");
+
+ /* Message list customizations. */
+
+ reader = E_MAIL_READER (shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ g_signal_connect_swapped (
+ message_list, "message-selected",
+ G_CALLBACK (mail_shell_content_message_selected_cb),
+ shell_content);
+}
+
+static guint32
+mail_shell_content_check_state (EShellContent *shell_content)
+{
+ return e_mail_reader_check_state (E_MAIL_READER (shell_content));
+}
+
+static GtkActionGroup *
+mail_shell_content_get_action_group (EMailReader *reader)
+{
+ EShellContent *shell_content;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+
+ shell_content = E_SHELL_CONTENT (reader);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ return E_SHELL_WINDOW_ACTION_GROUP_MAIL (shell_window);
+}
+
+static gboolean
+mail_shell_content_get_hide_deleted (EMailReader *reader)
+{
+ EMailShellContent *mail_shell_content;
+
+ mail_shell_content = E_MAIL_SHELL_CONTENT (reader);
+
+ return !e_mail_shell_content_get_show_deleted (mail_shell_content);
+}
+
+static EMFormatHTMLDisplay *
+mail_shell_content_get_html_display (EMailReader *reader)
+{
+ EMailShellContentPrivate *priv;
+
+ priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader);
+
+ return priv->html_display;
+}
+
+static MessageList *
+mail_shell_content_get_message_list (EMailReader *reader)
+{
+ EMailShellContentPrivate *priv;
+
+ priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader);
+
+ return MESSAGE_LIST (priv->message_list);
+}
+
+static EShellBackend *
+mail_shell_content_get_shell_backend (EMailReader *reader)
+{
+ EShellContent *shell_content;
+ EShellView *shell_view;
+
+ shell_content = E_SHELL_CONTENT (reader);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+
+ return e_shell_view_get_shell_backend (shell_view);
+}
+
+static GtkWindow *
+mail_shell_content_get_window (EMailReader *reader)
+{
+ EShellContent *shell_content;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+
+ shell_content = E_SHELL_CONTENT (reader);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ return GTK_WINDOW (shell_window);
+}
+
+static void
+mail_shell_content_set_folder (EMailReader *reader,
+ CamelFolder *folder,
+ const gchar *folder_uri)
+{
+ EMailShellContentPrivate *priv;
+ EMailReaderIface *default_iface;
+ MessageList *message_list;
+ gboolean different_folder;
+ gchar *meta_data;
+
+ priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader);
+
+ message_list = e_mail_reader_get_message_list (reader);
+
+ message_list_freeze (message_list);
+
+ different_folder =
+ message_list->folder != NULL &&
+ folder != message_list->folder;
+
+ /* Chain up to interface's default set_folder() method. */
+ default_iface = g_type_default_interface_peek (E_TYPE_MAIL_READER);
+ default_iface->set_folder (reader, folder, folder_uri);
+
+ if (folder == NULL)
+ goto exit;
+
+ mail_refresh_folder (folder, NULL, NULL);
+
+ /* This function gets triggered several times at startup,
+ * so we don't want to reset the message suppression state
+ * unless we're actually switching to a different folder. */
+ if (different_folder)
+ priv->suppress_message_selection = FALSE;
+
+ if (!priv->suppress_message_selection)
+ meta_data = camel_object_meta_get (
+ folder, "evolution:selected_uid");
+ else
+ meta_data = NULL;
+
+ g_free (priv->selected_uid);
+ priv->selected_uid = meta_data;
+
+ /* This is a one-time-only callback. */
+ if (message_list->cursor_uid == NULL && priv->message_list_built_id == 0)
+ priv->message_list_built_id = g_signal_connect_swapped (
+ message_list, "message-list-built",
+ G_CALLBACK (mail_shell_content_message_list_built_cb),
+ reader);
+
+exit:
+ message_list_thaw (message_list);
+}
+
+static void
+mail_shell_content_show_search_bar (EMailReader *reader)
+{
+ EMailShellContentPrivate *priv;
+
+ priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader);
+
+ gtk_widget_show (priv->search_bar);
+}
+
+static void
+mail_shell_content_class_init (EMailShellContentClass *class)
+{
+ GObjectClass *object_class;
+ EShellContentClass *shell_content_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMailShellContentPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = mail_shell_content_set_property;
+ object_class->get_property = mail_shell_content_get_property;
+ object_class->dispose = mail_shell_content_dispose;
+ object_class->finalize = mail_shell_content_finalize;
+ object_class->constructed = mail_shell_content_constructed;
+
+ shell_content_class = E_SHELL_CONTENT_CLASS (class);
+ shell_content_class->new_search_context = em_search_context_new;
+ shell_content_class->check_state = mail_shell_content_check_state;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PREVIEW_VISIBLE,
+ g_param_spec_boolean (
+ "preview-visible",
+ _("Preview is Visible"),
+ _("Whether the preview pane is visible"),
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHOW_DELETED,
+ g_param_spec_boolean (
+ "show-deleted",
+ "Show Deleted",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_VERTICAL_VIEW,
+ g_param_spec_boolean (
+ "vertical-view",
+ _("Vertical View"),
+ _("Whether vertical view is enabled"),
+ FALSE,
+ G_PARAM_READWRITE));
+}
+
+static void
+mail_shell_content_iface_init (EMailReaderIface *iface)
+{
+ iface->get_action_group = mail_shell_content_get_action_group;
+ iface->get_hide_deleted = mail_shell_content_get_hide_deleted;
+ iface->get_html_display = mail_shell_content_get_html_display;
+ iface->get_message_list = mail_shell_content_get_message_list;
+ iface->get_shell_backend = mail_shell_content_get_shell_backend;
+ iface->get_window = mail_shell_content_get_window;
+ iface->set_folder = mail_shell_content_set_folder;
+ iface->show_search_bar = mail_shell_content_show_search_bar;
+}
+
+static void
+mail_shell_content_init (EMailShellContent *mail_shell_content)
+{
+ mail_shell_content->priv =
+ E_MAIL_SHELL_CONTENT_GET_PRIVATE (mail_shell_content);
+
+ mail_shell_content->priv->preview_visible = TRUE;
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_mail_shell_content_get_type (void)
+{
+ return mail_shell_content_type;
+}
+
+void
+e_mail_shell_content_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (EMailShellContentClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_shell_content_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMailShellContent),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mail_shell_content_init,
+ NULL /* value_table */
+ };
+
+ static const GInterfaceInfo iface_info = {
+ (GInterfaceInitFunc) mail_shell_content_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL /* interface_data */
+ };
+
+ mail_shell_content_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_CONTENT,
+ "EMailShellContent", &type_info, 0);
+
+ g_type_module_add_interface (
+ type_module, mail_shell_content_type,
+ E_TYPE_MAIL_READER, &iface_info);
+}
+
+GtkWidget *
+e_mail_shell_content_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_MAIL_SHELL_CONTENT,
+ "shell-view", shell_view, NULL);
+}
+
+gboolean
+e_mail_shell_content_get_preview_visible (EMailShellContent *mail_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_CONTENT (mail_shell_content), FALSE);
+
+ return mail_shell_content->priv->preview_visible;
+}
+
+void
+e_mail_shell_content_set_preview_visible (EMailShellContent *mail_shell_content,
+ gboolean preview_visible)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_CONTENT (mail_shell_content));
+
+ if (preview_visible == mail_shell_content->priv->preview_visible)
+ return;
+
+ paned = GTK_PANED (mail_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ if (preview_visible)
+ gtk_widget_show (child);
+ else
+ gtk_widget_hide (child);
+
+ mail_shell_content->priv->preview_visible = preview_visible;
+
+ g_object_notify (G_OBJECT (mail_shell_content), "preview-visible");
+}
+
+gboolean
+e_mail_shell_content_get_show_deleted (EMailShellContent *mail_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_CONTENT (mail_shell_content), FALSE);
+
+ return mail_shell_content->priv->show_deleted;
+}
+
+void
+e_mail_shell_content_set_show_deleted (EMailShellContent *mail_shell_content,
+ gboolean show_deleted)
+{
+ g_return_if_fail (E_IS_MAIL_SHELL_CONTENT (mail_shell_content));
+
+ mail_shell_content->priv->show_deleted = show_deleted;
+
+ g_object_notify (G_OBJECT (mail_shell_content), "show-deleted");
+}
+
+gboolean
+e_mail_shell_content_get_vertical_view (EMailShellContent *mail_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_CONTENT (mail_shell_content), FALSE);
+
+ return mail_shell_content->priv->vertical_view;
+}
+
+void
+e_mail_shell_content_set_vertical_view (EMailShellContent *mail_shell_content,
+ gboolean vertical_view)
+{
+ GConfBridge *bridge;
+ GtkWidget *old_paned;
+ GtkWidget *new_paned;
+ GtkWidget *child1;
+ GtkWidget *child2;
+ guint binding_id;
+ const gchar *key;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_CONTENT (mail_shell_content));
+
+ if (vertical_view == mail_shell_content->priv->vertical_view)
+ return;
+
+ bridge = gconf_bridge_get ();
+ old_paned = mail_shell_content->priv->paned;
+ binding_id = mail_shell_content->priv->paned_binding_id;
+
+ child1 = gtk_paned_get_child1 (GTK_PANED (old_paned));
+ child2 = gtk_paned_get_child2 (GTK_PANED (old_paned));
+
+ if (binding_id > 0)
+ gconf_bridge_unbind (bridge, binding_id);
+
+ if (vertical_view) {
+ new_paned = gtk_hpaned_new ();
+ key = "/apps/evolution/mail/display/hpaned_size";
+ } else {
+ new_paned = gtk_vpaned_new ();
+ key = "/apps/evolution/mail/display/paned_size";
+ }
+
+ gtk_widget_reparent (child1, new_paned);
+ gtk_widget_reparent (child2, new_paned);
+ gtk_widget_show (new_paned);
+
+ gtk_widget_destroy (old_paned);
+ gtk_container_add (GTK_CONTAINER (mail_shell_content), new_paned);
+
+ binding_id = gconf_bridge_bind_property_delayed (
+ bridge, key, G_OBJECT (new_paned), "position");
+
+ mail_shell_content->priv->vertical_view = vertical_view;
+ mail_shell_content->priv->paned_binding_id = binding_id;
+ mail_shell_content->priv->paned = g_object_ref (new_paned);
+
+ e_mail_shell_content_update_view_instance (mail_shell_content);
+
+ g_object_notify (G_OBJECT (mail_shell_content), "vertical-view");
+}
+
+GalViewInstance *
+e_mail_shell_content_get_view_instance (EMailShellContent *mail_shell_content)
+{
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_CONTENT (mail_shell_content), NULL);
+
+ return mail_shell_content->priv->view_instance;
+}
+
+void
+e_mail_shell_content_set_search_strings (EMailShellContent *mail_shell_content,
+ GSList *search_strings)
+{
+ EMailSearchBar *search_bar;
+ ESearchingTokenizer *tokenizer;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_CONTENT (mail_shell_content));
+
+ search_bar = E_MAIL_SEARCH_BAR (mail_shell_content->priv->search_bar);
+ tokenizer = e_mail_search_bar_get_tokenizer (search_bar);
+
+ e_searching_tokenizer_set_secondary_case_sensitivity (tokenizer, FALSE);
+ e_searching_tokenizer_set_secondary_search_string (tokenizer, NULL);
+
+ while (search_strings != NULL) {
+ e_searching_tokenizer_add_secondary_search_string (
+ tokenizer, search_strings->data);
+ search_strings = g_slist_next (search_strings);
+ }
+
+ e_mail_search_bar_changed (search_bar);
+}
+
+void
+e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content)
+{
+ EMailReader *reader;
+ EShellContent *shell_content;
+ EShellView *shell_view;
+ EShellViewClass *shell_view_class;
+ GalViewCollection *view_collection;
+ GalViewInstance *view_instance;
+ MessageList *message_list;
+ gboolean outgoing_folder;
+ gboolean show_vertical_view;
+ gchar *view_id;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_CONTENT (mail_shell_content));
+
+ shell_content = E_SHELL_CONTENT (mail_shell_content);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ view_collection = shell_view_class->view_collection;
+
+ reader = E_MAIL_READER (mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ /* If no folder is selected, return silently. */
+ if (message_list->folder == NULL)
+ return;
+
+ /* If we have a folder, we should also have a URI. */
+ g_return_if_fail (message_list->folder_uri != NULL);
+
+ if (mail_shell_content->priv->view_instance != NULL) {
+ g_object_unref (mail_shell_content->priv->view_instance);
+ mail_shell_content->priv->view_instance = NULL;
+ }
+
+ view_id = mail_config_folder_to_safe_url (message_list->folder);
+ view_instance = e_shell_view_new_view_instance (shell_view, view_id);
+ mail_shell_content->priv->view_instance = view_instance;
+
+ show_vertical_view =
+ e_mail_shell_content_get_vertical_view (mail_shell_content);
+
+ if (show_vertical_view) {
+ gchar *filename;
+ gchar *safe_view_id;
+
+ /* Force the view instance into vertical view. */
+
+ g_free (view_instance->custom_filename);
+ g_free (view_instance->current_view_filename);
+
+ safe_view_id = g_strdup (view_id);
+ e_filename_make_safe (safe_view_id);
+
+ filename = g_strdup_printf (
+ "custom_wide_view-%s.xml", safe_view_id);
+ view_instance->custom_filename = g_build_filename (
+ view_collection->local_dir, filename, NULL);
+ g_free (filename);
+
+ filename = g_strdup_printf (
+ "current_wide_view-%s.xml", safe_view_id);
+ view_instance->current_view_filename = g_build_filename (
+ view_collection->local_dir, filename, NULL);
+ g_free (filename);
+
+ g_free (safe_view_id);
+ }
+
+ g_free (view_id);
+
+ outgoing_folder =
+ em_utils_folder_is_drafts (
+ message_list->folder, message_list->folder_uri) ||
+ em_utils_folder_is_outbox (
+ message_list->folder, message_list->folder_uri) ||
+ em_utils_folder_is_sent (
+ message_list->folder, message_list->folder_uri);
+
+ if (outgoing_folder) {
+ if (show_vertical_view)
+ gal_view_instance_set_default_view (
+ view_instance, "Wide_View_Sent");
+ else
+ gal_view_instance_set_default_view (
+ view_instance, "As_Sent_Folder");
+ } else if (show_vertical_view) {
+ gal_view_instance_set_default_view (
+ view_instance, "Wide_View_Normal");
+ }
+
+ gal_view_instance_load (view_instance);
+
+ if (!gal_view_instance_exists (view_instance)) {
+ gchar *state_filename;
+
+ state_filename = mail_config_folder_to_cachename (
+ message_list->folder, "et-header-");
+
+ if (g_file_test (state_filename, G_FILE_TEST_IS_REGULAR)) {
+ ETableSpecification *spec;
+ ETableState *state;
+ GalView *view;
+ gchar *spec_filename;
+
+ spec = e_table_specification_new ();
+ spec_filename = g_build_filename (
+ EVOLUTION_ETSPECDIR,
+ "message-list.etspec",
+ NULL);
+ e_table_specification_load_from_file (
+ spec, spec_filename);
+ g_free (spec_filename);
+
+ state = e_table_state_new ();
+ view = gal_view_etable_new (spec, "");
+
+ e_table_state_load_from_file (
+ state, state_filename);
+ gal_view_etable_set_state (
+ GAL_VIEW_ETABLE (view), state);
+ gal_view_instance_set_custom_view (
+ view_instance, view);
+
+ g_object_unref (state);
+ g_object_unref (view);
+ g_object_unref (spec);
+ }
+
+ g_free (state_filename);
+ }
+
+ g_signal_connect (
+ view_instance, "display-view",
+ G_CALLBACK (mail_shell_content_display_view_cb),
+ mail_shell_content);
+
+ mail_shell_content_display_view_cb (
+ mail_shell_content,
+ gal_view_instance_get_current_view (view_instance));
+}
diff --git a/mail/e-mail-shell-content.h b/mail/e-mail-shell-content.h
new file mode 100644
index 0000000000..57d2438705
--- /dev/null
+++ b/mail/e-mail-shell-content.h
@@ -0,0 +1,94 @@
+/*
+ * e-mail-shell-content.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_SHELL_CONTENT_H
+#define E_MAIL_SHELL_CONTENT_H
+
+#include <shell/e-shell-content.h>
+#include <shell/e-shell-view.h>
+
+#include <mail/em-format-html-display.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_SHELL_CONTENT \
+ (e_mail_shell_content_get_type ())
+#define E_MAIL_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContent))
+#define E_MAIL_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContentClass))
+#define E_IS_MAIL_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_SHELL_CONTENT))
+#define E_IS_MAIL_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_SHELL_CONTENT))
+#define E_MAIL_SHELL_CONTENT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContentClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailShellContent EMailShellContent;
+typedef struct _EMailShellContentClass EMailShellContentClass;
+typedef struct _EMailShellContentPrivate EMailShellContentPrivate;
+
+struct _EMailShellContent {
+ EShellContent parent;
+ EMailShellContentPrivate *priv;
+};
+
+struct _EMailShellContentClass {
+ EShellContentClass parent_class;
+};
+
+GType e_mail_shell_content_get_type (void);
+void e_mail_shell_content_register_type
+ (GTypeModule *type_module);
+GtkWidget * e_mail_shell_content_new(EShellView *shell_view);
+gboolean e_mail_shell_content_get_preview_visible
+ (EMailShellContent *mail_shell_content);
+void e_mail_shell_content_set_preview_visible
+ (EMailShellContent *mail_shell_content,
+ gboolean preview_visible);
+gboolean e_mail_shell_content_get_show_deleted
+ (EMailShellContent *mail_shell_content);
+void e_mail_shell_content_set_show_deleted
+ (EMailShellContent *mail_shell_content,
+ gboolean show_deleted);
+gboolean e_mail_shell_content_get_vertical_view
+ (EMailShellContent *mail_shell_content);
+void e_mail_shell_content_set_vertical_view
+ (EMailShellContent *mail_shell_content,
+ gboolean vertical_view);
+GalViewInstance *
+ e_mail_shell_content_get_view_instance
+ (EMailShellContent *mail_shell_content);
+void e_mail_shell_content_set_search_strings
+ (EMailShellContent *mail_shell_content,
+ GSList *search_strings);
+void e_mail_shell_content_update_view_instance
+ (EMailShellContent *mail_shell_content);
+
+G_END_DECLS
+
+#endif /* E_MAIL_SHELL_CONTENT_H */
diff --git a/mail/em-migrate.c b/mail/e-mail-shell-migrate.c
index 3f5beb3f84..6202224b0c 100644
--- a/mail/em-migrate.c
+++ b/mail/e-mail-shell-migrate.c
@@ -1,4 +1,6 @@
/*
+ * e-mail-shell-migrate.c
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,16 +15,11 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Jeffrey Stedfast <fejj@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "e-mail-shell-migrate.h"
#include <stdio.h>
#include <stdlib.h>
@@ -37,6 +34,7 @@
#include <ctype.h>
#include <glib.h>
+#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
@@ -53,27 +51,25 @@
#include <libxml/parser.h>
#include <libxml/xmlmemory.h>
-#include <glib/gi18n.h>
-
#include <e-util/e-util.h>
#include <libedataserver/e-xml-utils.h>
#include <libedataserver/e-data-server-util.h>
#include <e-util/e-xml-utils.h>
+#include "e-util/e-account-utils.h"
#include "e-util/e-bconf-map.h"
-#include "libedataserver/e-account-list.h"
-#include "e-util/e-signature-list.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
#include "e-util/e-plugin.h"
+#include "e-util/e-signature-utils.h"
+
+#include "e-mail-shell-backend.h"
+#include "shell/e-shell-migrate.h"
-#include "mail-component.h"
#include "mail-config.h"
-#include "mail-session.h"
#include "em-utils.h"
-#include "em-migrate.h"
-#define d(x)
+#define d(x) x
#ifndef G_OS_WIN32
/* No versions previous to 2.8 or thereabouts have been available on
@@ -380,7 +376,7 @@ parse_lsub (const char *lsub, char *dir_sep)
return NULL;
}
-static int
+static gboolean
read_imap_storeinfo (struct _account_info_1_0 *si)
{
FILE *storeinfo;
@@ -433,7 +429,7 @@ read_imap_storeinfo (struct _account_info_1_0 *si)
g_free (path);
if (storeinfo == NULL) {
g_warning ("could not find imap store info '%s'", path);
- return -1;
+ return FALSE;
}
/* ignore version */
@@ -473,10 +469,10 @@ read_imap_storeinfo (struct _account_info_1_0 *si)
fclose (storeinfo);
- return 0;
+ return TRUE;
}
-static int
+static gboolean
load_accounts_1_0 (xmlDocPtr doc)
{
xmlNodePtr source;
@@ -485,7 +481,7 @@ load_accounts_1_0 (xmlDocPtr doc)
char key[32];
if (!(source = e_bconf_get_path (doc, "/Mail/Accounts")))
- return 0;
+ return TRUE;
if ((val = e_bconf_get_value (source, "num"))) {
count = atoi (val);
@@ -536,11 +532,11 @@ load_accounts_1_0 (xmlDocPtr doc)
g_hash_table_insert (accounts_name_1_0, ai->name, ai);
}
- return 0;
+ return TRUE;
}
-static int
-em_migrate_1_0 (const char *evolution_dir, xmlDocPtr config_xmldb, xmlDocPtr filters, xmlDocPtr vfolders, CamelException *ex)
+static gboolean
+em_migrate_1_0 (const char *data_dir, xmlDocPtr config_xmldb, xmlDocPtr filters, xmlDocPtr vfolders, GError **error)
{
accounts_1_0 = g_hash_table_new_full (
g_str_hash, g_str_equal,
@@ -555,11 +551,11 @@ em_migrate_1_0 (const char *evolution_dir, xmlDocPtr config_xmldb, xmlDocPtr fil
g_hash_table_destroy (accounts_1_0);
g_hash_table_destroy (accounts_name_1_0);
- return 0;
+ return TRUE;
}
/* 1.2 upgrade functions */
-static int
+static gboolean
is_xml1encoded (const char *txt)
{
const unsigned char *p;
@@ -653,7 +649,7 @@ utf8_reencode (const char *txt)
}
}
-static int
+static gboolean
upgrade_xml_1_2_rec (xmlNodePtr node)
{
const char *value_tags[] = { "string", "address", "regex", "file", "command", NULL };
@@ -718,16 +714,16 @@ upgrade_xml_1_2_rec (xmlNodePtr node)
node = node->next;
}
- return 0;
+ return TRUE;
}
-static int
+static gboolean
em_upgrade_xml_1_2 (xmlDocPtr doc)
{
xmlNodePtr root;
if (!doc || !(root = xmlDocGetRootElement (doc)))
- return 0;
+ return TRUE;
return upgrade_xml_1_2_rec (root);
}
@@ -963,7 +959,7 @@ static struct {
};
/* remaps mail config from bconf to gconf */
-static int
+static gboolean
bconf_import(GConfClient *gconf, xmlDocPtr config_xmldb)
{
xmlNodePtr source;
@@ -1014,11 +1010,11 @@ bconf_import(GConfClient *gconf, xmlDocPtr config_xmldb)
e_bconf_import_xml_blob(gconf, config_xmldb, signature_map, "/Mail/Signatures",
"/apps/evolution/mail/signatures", "signature", NULL);
- return 0;
+ return TRUE;
}
-static int
-em_migrate_1_2(const char *evolution_dir, xmlDocPtr config_xmldb, xmlDocPtr filters, xmlDocPtr vfolders, CamelException *ex)
+static gboolean
+em_migrate_1_2(const char *data_dir, xmlDocPtr config_xmldb, xmlDocPtr filters, xmlDocPtr vfolders, GError **error)
{
GConfClient *gconf;
@@ -1029,7 +1025,7 @@ em_migrate_1_2(const char *evolution_dir, xmlDocPtr config_xmldb, xmlDocPtr filt
em_upgrade_xml_1_2(filters);
em_upgrade_xml_1_2(vfolders);
- return 0;
+ return TRUE;
}
/* 1.4 upgrade functions */
@@ -1106,18 +1102,31 @@ em_migrate_setup_progress_dialog (const char *title, const char *desc)
gchar *markup;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title ((GtkWindow *) window, _("Migrating..."));
+ gtk_window_set_modal ((GtkWindow *) window, TRUE);
+ gtk_container_set_border_width ((GtkContainer *) window, 6);
- gtk_window_set_title (GTK_WINDOW (window), _("Migrating..."));
- gtk_window_set_modal (GTK_WINDOW (window), TRUE);
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (window), 6);
+ vbox = gtk_vbox_new (FALSE, 6);
+ gtk_widget_show (vbox);
+ gtk_container_add ((GtkContainer *) window, vbox);
+
+ w = gtk_label_new (desc);
+
+ gtk_label_set_line_wrap ((GtkLabel *) w, TRUE);
+ gtk_widget_show (w);
+ gtk_box_pack_start_defaults ((GtkBox *) vbox, w);
- hbox = gtk_hbox_new (FALSE, 24);
+ hbox = gtk_hbox_new (FALSE, 6);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start_defaults ((GtkBox *) vbox, hbox);
- /* Install the info image */
- w = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
- gtk_misc_set_alignment (GTK_MISC (w), 0.5, 0.0);
- gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
+ label = (GtkLabel *) gtk_label_new ("");
+ gtk_widget_show ((GtkWidget *) label);
+ gtk_box_pack_start_defaults ((GtkBox *) hbox, (GtkWidget *) label);
+
+ progress = (GtkProgressBar *) gtk_progress_bar_new ();
+ gtk_widget_show ((GtkWidget *) progress);
+ gtk_box_pack_start_defaults ((GtkBox *) hbox, (GtkWidget *) progress);
/* Prepare the message */
vbox = gtk_vbox_new (FALSE, 12);
@@ -1158,13 +1167,13 @@ em_migrate_setup_progress_dialog (const char *title, const char *desc)
static void
em_migrate_close_progress_dialog (void)
{
- gtk_widget_destroy (GTK_WIDGET (window));
+ gtk_widget_destroy ((GtkWidget *) window);
}
static void
em_migrate_set_folder_name (const char *folder_name)
{
- gchar *text;
+ char *text;
text = g_strdup_printf (_("Migrating '%s':"), folder_name);
gtk_label_set_text (label, text);
@@ -1239,7 +1248,7 @@ is_mail_folder (const char *metadata)
return FALSE;
}
-static int
+static gboolean
get_local_et_expanded (const char *dirname)
{
xmlNodePtr node;
@@ -1254,24 +1263,24 @@ get_local_et_expanded (const char *dirname)
if (stat (buf, &st) == -1) {
g_free (buf);
- return -1;
+ return FALSE;
}
if (!(doc = xmlParseFile (buf))) {
g_free (buf);
- return -1;
+ return FALSE;
}
g_free (buf);
if (!(node = xmlDocGetRootElement (doc)) || strcmp ((char *)node->name, "expanded_state") != 0) {
xmlFreeDoc (doc);
- return -1;
+ return FALSE;
}
if (!(buf = (char *)xmlGetProp (node, (const unsigned char *)"default"))) {
xmlFreeDoc (doc);
- return -1;
+ return FALSE;
}
thread_list = strcmp (buf, "0") == 0 ? 0 : 1;
@@ -1357,7 +1366,7 @@ static int open_flags[3] = {
O_WRONLY | O_CREAT | O_APPEND,
};
-static int
+static gboolean
cp (const char *src, const char *dest, gboolean show_progress, int mode)
{
unsigned char readbuf[65536];
@@ -1371,18 +1380,18 @@ cp (const char *src, const char *dest, gboolean show_progress, int mode)
* want to corrupt their existing data */
if (g_stat (dest, &st) == 0 && st.st_size > 0 && mode == CP_UNIQUE) {
errno = EEXIST;
- return -1;
+ return FALSE;
}
if (g_stat (src, &st) == -1
|| (readfd = g_open (src, O_RDONLY | O_BINARY, 0)) == -1)
- return -1;
+ return FALSE;
if ((writefd = g_open (dest, open_flags[mode] | O_BINARY, 0666)) == -1) {
errnosav = errno;
close (readfd);
errno = errnosav;
- return -1;
+ return FALSE;
}
do {
@@ -1419,7 +1428,7 @@ cp (const char *src, const char *dest, gboolean show_progress, int mode)
utime (dest, &ut);
chmod (dest, st.st_mode);
- return 0;
+ return TRUE;
exception:
@@ -1434,12 +1443,12 @@ cp (const char *src, const char *dest, gboolean show_progress, int mode)
unlink (dest);
errno = errnosav;
- return -1;
+ return FALSE;
}
#ifndef G_OS_WIN32
-static int
+static gboolean
cp_r (const char *src, const char *dest, const char *pattern, int mode)
{
GString *srcpath, *destpath;
@@ -1449,10 +1458,10 @@ cp_r (const char *src, const char *dest, const char *pattern, int mode)
DIR *dir;
if (g_mkdir_with_parents (dest, 0777) == -1)
- return -1;
+ return FALSE;
if (!(dir = opendir (src)))
- return -1;
+ return FALSE;
srcpath = g_string_new (src);
g_string_append_c (srcpath, '/');
@@ -1487,7 +1496,7 @@ cp_r (const char *src, const char *dest, const char *pattern, int mode)
g_string_free (destpath, TRUE);
g_string_free (srcpath, TRUE);
- return 0;
+ return TRUE;
}
static void
@@ -1524,18 +1533,21 @@ mbox_build_filename (GString *path, const char *toplevel_dir, const char *full_n
}
}
-static int
-em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *full_name, CamelException *ex)
+static gboolean
+em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *full_name, GError **error)
{
CamelFolder *old_folder = NULL, *new_folder = NULL;
CamelStore *local_store = NULL;
+ CamelException ex;
char *name, *uri;
GPtrArray *uids;
struct stat st;
- int thread_list;
+ gboolean thread_list;
int index, i;
GString *src, *dest;
- int res = -1;
+ gboolean success = FALSE;
+
+ camel_exception_init (&ex);
src = g_string_new("");
@@ -1545,7 +1557,7 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu
|| !is_mail_folder(src->str)) {
/* Not an evolution mail folder */
g_string_free(src, TRUE);
- return 0;
+ return TRUE;
}
dest = g_string_new("");
@@ -1570,16 +1582,18 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu
dlen = dest->len;
if (g_mkdir_with_parents (dest->str, 0777) == -1 && errno != EEXIST) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Unable to create new folder `%s': %s"),
- dest->str, g_strerror(errno));
+ g_set_error (
+ error, E_SHELL_MIGRATE_ERROR,
+ E_SHELL_MIGRATE_ERROR_FAILED,
+ _("Unable to create new folder `%s': %s"),
+ dest->str, g_strerror (errno));
goto fatal;
}
*p = '/';
mode = CP_UNIQUE;
retry_copy:
- if (cp (src->str, dest->str, TRUE, mode) == -1) {
+ if (!cp (src->str, dest->str, TRUE, mode)) {
if (errno == EEXIST) {
int save = errno;
@@ -1596,9 +1610,11 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu
errno = save;
}
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Unable to copy folder `%s' to `%s': %s"),
- src->str, dest->str, g_strerror(errno));
+ g_set_error (
+ error, E_SHELL_MIGRATE_ERROR,
+ E_SHELL_MIGRATE_ERROR_FAILED,
+ _("Unable to copy folder `%s' to `%s': %s"),
+ src->str, dest->str, g_strerror (errno));
goto fatal;
}
ignore:
@@ -1618,14 +1634,14 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu
goto cmeta_err;
/* write the meta count */
- if (camel_file_util_encode_uint32 (fp, thread_list != -1 ? 1 : 0) == -1)
+ if (camel_file_util_encode_uint32 (fp, thread_list ? 1 : 0) == -1)
goto cmeta_err;
- if (thread_list != -1) {
+ if (!thread_list) {
if (camel_file_util_encode_string (fp, "evolution:thread_list") == -1)
goto cmeta_err;
- if (camel_file_util_encode_string (fp, thread_list ? "1" : "0") == -1)
+ if (camel_file_util_encode_string (fp, !thread_list ? "1" : "0") == -1)
goto cmeta_err;
}
@@ -1664,16 +1680,16 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu
} else {
guint32 flags = CAMEL_STORE_FOLDER_CREATE;
- if (!(local_store = camel_session_get_store ((CamelSession *) session, uri, ex))
- || !(old_folder = camel_store_get_folder (local_store, name, 0, ex)))
+ if (!(local_store = camel_session_get_store ((CamelSession *) session, uri, &ex))
+ || !(old_folder = camel_store_get_folder (local_store, name, 0, &ex)))
goto fatal;
flags |= (index ? CAMEL_STORE_FOLDER_BODY_INDEX : 0);
- if (!(new_folder = camel_store_get_folder (session->store, full_name, flags, ex)))
+ if (!(new_folder = camel_store_get_folder (session->store, full_name, flags, &ex)))
goto fatal;
- if (thread_list != -1) {
- camel_object_meta_set (new_folder, "evolution:thread_list", thread_list ? "1" : "0");
+ if (!thread_list) {
+ camel_object_meta_set (new_folder, "evolution:thread_list", !thread_list ? "1" : "0");
camel_object_state_write (new_folder);
}
@@ -1685,17 +1701,17 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu
if (!(info = camel_folder_get_message_info (old_folder, uids->pdata[i])))
continue;
- if (!(message = camel_folder_get_message (old_folder, uids->pdata[i], ex))) {
+ if (!(message = camel_folder_get_message (old_folder, uids->pdata[i], &ex))) {
camel_folder_free_message_info (old_folder, info);
camel_folder_free_uids (old_folder, uids);
goto fatal;
}
- camel_folder_append_message (new_folder, message, info, NULL, ex);
+ camel_folder_append_message (new_folder, message, info, NULL, &ex);
camel_folder_free_message_info (old_folder, info);
camel_object_unref (message);
- if (camel_exception_is_set (ex))
+ if (camel_exception_is_set (&ex))
break;
em_migrate_set_progress (((double) i + 1) / ((double) uids->len));
@@ -1703,10 +1719,10 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu
camel_folder_free_uids (old_folder, uids);
- if (camel_exception_is_set (ex))
+ if (camel_exception_is_set (&ex))
goto fatal;
}
- res = 0;
+ success = TRUE;
fatal:
g_free (uri);
g_free (name);
@@ -1719,34 +1735,42 @@ fatal:
if (new_folder)
camel_object_unref(new_folder);
- return res;
+ if (camel_exception_is_set (&ex)) {
+ g_set_error (
+ error, E_SHELL_MIGRATE_ERROR,
+ E_SHELL_MIGRATE_ERROR_FAILED,
+ "%s", camel_exception_get_description (&ex));
+ camel_exception_clear (&ex);
+ }
+
+ return success;
}
-static int
-em_migrate_dir (EMMigrateSession *session, const char *dirname, const char *full_name, CamelException *ex)
+static gboolean
+em_migrate_dir (EMMigrateSession *session, const char *dirname, const char *full_name, GError **error)
{
char *path;
DIR *dir;
struct stat st;
struct dirent *dent;
- int res = 0;
+ gboolean success = TRUE;
- if (em_migrate_folder(session, dirname, full_name, ex) == -1)
- return -1;
+ if (!em_migrate_folder(session, dirname, full_name, error))
+ return FALSE;
/* no subfolders, not readable, don't care */
path = g_strdup_printf ("%s/subfolders", dirname);
if (stat (path, &st) == -1 || !S_ISDIR (st.st_mode)) {
g_free (path);
- return 0;
+ return TRUE;
}
if (!(dir = opendir (path))) {
g_free (path);
- return 0;
+ return TRUE;
}
- while (res == 0 && (dent = readdir (dir))) {
+ while (success && (dent = readdir (dir))) {
char *full_path;
char *name;
@@ -1760,7 +1784,7 @@ em_migrate_dir (EMMigrateSession *session, const char *dirname, const char *full
}
name = g_strdup_printf ("%s/%s", full_name, dent->d_name);
- res = em_migrate_dir (session, full_path, name, ex);
+ success = em_migrate_dir (session, full_path, name, error);
g_free (full_path);
g_free (name);
}
@@ -1769,29 +1793,33 @@ em_migrate_dir (EMMigrateSession *session, const char *dirname, const char *full
g_free (path);
- return res;
+ return success;
}
-static int
-em_migrate_local_folders_1_4 (EMMigrateSession *session, CamelException *ex)
+static gboolean
+em_migrate_local_folders_1_4 (EMMigrateSession *session, GError **error)
{
struct dirent *dent;
struct stat st;
DIR *dir;
- int res = 0;
+ gboolean success = TRUE;
if (!(dir = opendir (session->srcdir))) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Unable to scan for existing mailboxes at `%s': %s"),
- session->srcdir, g_strerror(errno));
- return -1;
+ g_set_error (
+ error, E_SHELL_MIGRATE_ERROR,
+ E_SHELL_MIGRATE_ERROR_FAILED,
+ _("Unable to scan for existing mailboxes at "
+ "`%s': %s"), session->srcdir, g_strerror (errno));
+ return FALSE;
}
- em_migrate_setup_progress_dialog (NULL, _("The location and hierarchy of the Evolution mailbox "
- "folders has changed since Evolution 1.x.\n\nPlease be "
- "patient while Evolution migrates your folders..."));
+ em_migrate_setup_progress_dialog (
+ _("Migrating Folders"),
+ _("The location and hierarchy of the Evolution mailbox "
+ "folders has changed since Evolution 1.x.\n\nPlease be "
+ "patient while Evolution migrates your folders..."));
- while (res == 0 && (dent = readdir (dir))) {
+ while (success && (dent = readdir (dir))) {
char *full_path;
if (dent->d_name[0] == '.')
@@ -1803,7 +1831,7 @@ em_migrate_local_folders_1_4 (EMMigrateSession *session, CamelException *ex)
continue;
}
- res = em_migrate_dir (session, full_path, dent->d_name, ex);
+ success = em_migrate_dir (session, full_path, dent->d_name, error);
g_free (full_path);
}
@@ -1811,7 +1839,7 @@ em_migrate_local_folders_1_4 (EMMigrateSession *session, CamelException *ex)
em_migrate_close_progress_dialog ();
- return res;
+ return success;
}
static char *
@@ -1907,7 +1935,7 @@ get_nth_sig (int id)
char *uid = NULL;
int i = 0;
- list = mail_config_get_signatures ();
+ list = e_get_signature_list ();
iter = e_list_get_iterator ((EList *) list);
while (e_iterator_is_valid (iter) && i < id) {
@@ -1931,7 +1959,7 @@ em_upgrade_accounts_1_4 (void)
EAccountList *accounts;
EIterator *iter;
- if (!(accounts = mail_config_get_accounts ()))
+ if (!(accounts = e_get_account_list ()))
return;
iter = e_list_get_iterator ((EList *) accounts);
@@ -1964,18 +1992,18 @@ em_upgrade_accounts_1_4 (void)
g_object_unref (iter);
- mail_config_save_accounts ();
+ e_account_list_save (accounts);
}
-static int
-em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex)
+static gboolean
+em_migrate_pop_uid_caches_1_4 (const char *data_dir, GError **error)
{
GString *oldpath, *newpath;
struct dirent *dent;
size_t olen, nlen;
char *cache_dir;
DIR *dir;
- int res = 0;
+ gboolean success = TRUE;
/* Sigh, too many unique strings to translate, for cases which shouldn't ever happen */
@@ -1984,14 +2012,16 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex)
if (!(dir = opendir (cache_dir))) {
if (errno == ENOENT) {
g_free(cache_dir);
- return 0;
+ return TRUE;
}
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Unable to open old POP keep-on-server data `%s': %s"),
- cache_dir, g_strerror (errno));
+ g_set_error (
+ error, E_SHELL_MIGRATE_ERROR,
+ E_SHELL_MIGRATE_ERROR_FAILED,
+ _("Unable to open old POP keep-on-server data "
+ "`%s': %s"), cache_dir, g_strerror (errno));
g_free (cache_dir);
- return -1;
+ return FALSE;
}
oldpath = g_string_new (cache_dir);
@@ -1999,15 +2029,18 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex)
olen = oldpath->len;
g_free (cache_dir);
- cache_dir = g_build_filename (evolution_dir, "mail", "pop", NULL);
+ cache_dir = g_build_filename (data_dir, "pop", NULL);
if (g_mkdir_with_parents (cache_dir, 0777) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Unable to create POP3 keep-on-server data directory `%s': %s"),
- cache_dir, g_strerror(errno));
+ g_set_error (
+ error, E_SHELL_MIGRATE_ERROR,
+ E_SHELL_MIGRATE_ERROR_FAILED,
+ _("Unable to create POP3 keep-on-server data "
+ "directory `%s': %s"), cache_dir,
+ g_strerror (errno));
g_string_free (oldpath, TRUE);
g_free (cache_dir);
closedir (dir);
- return -1;
+ return FALSE;
}
newpath = g_string_new (cache_dir);
@@ -2015,7 +2048,7 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex)
nlen = newpath->len;
g_free (cache_dir);
- while (res == 0 && (dent = readdir (dir))) {
+ while (success && (dent = readdir (dir))) {
if (strncmp (dent->d_name, "cache-pop:__", 12) != 0)
continue;
@@ -2029,11 +2062,14 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex)
g_string_truncate (newpath, newpath->len - 1);
if (g_mkdir_with_parents (newpath->str, 0777) == -1
- || cp(oldpath->str, (g_string_append(newpath, "/uid-cache"))->str, FALSE, CP_UNIQUE)) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Unable to copy POP3 keep-on-server data `%s': %s"),
- oldpath->str, g_strerror(errno));
- res = -1;
+ || !cp(oldpath->str, (g_string_append(newpath, "/uid-cache"))->str, FALSE, CP_UNIQUE)) {
+ g_set_error (
+ error, E_SHELL_MIGRATE_ERROR,
+ E_SHELL_MIGRATE_ERROR_FAILED,
+ _("Unable to copy POP3 keep-on-server data "
+ "`%s': %s"), oldpath->str,
+ g_strerror (errno));
+ success = FALSE;
}
}
@@ -2043,11 +2079,11 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex)
closedir (dir);
- return res;
+ return success;
}
-static int
-em_migrate_imap_caches_1_4 (const char *evolution_dir, CamelException *ex)
+static gboolean
+em_migrate_imap_caches_1_4 (const char *data_dir, GError **error)
{
char *src, *dest;
struct stat st;
@@ -2055,10 +2091,10 @@ em_migrate_imap_caches_1_4 (const char *evolution_dir, CamelException *ex)
src = g_build_filename (g_get_home_dir (), "evolution", "mail", "imap", NULL);
if (stat (src, &st) == -1 || !S_ISDIR (st.st_mode)) {
g_free (src);
- return 0;
+ return TRUE;
}
- dest = g_build_filename (evolution_dir, "mail", "imap", NULL);
+ dest = g_build_filename (data_dir, "imap", NULL);
/* we don't care if this fails, it's only a cache... */
cp_r (src, dest, "summary", CP_OVERWRITE);
@@ -2066,11 +2102,11 @@ em_migrate_imap_caches_1_4 (const char *evolution_dir, CamelException *ex)
g_free (dest);
g_free (src);
- return 0;
+ return TRUE;
}
-static int
-em_migrate_folder_expand_state_1_4 (const char *evolution_dir, CamelException *ex)
+static gboolean
+em_migrate_folder_expand_state_1_4 (const char *data_dir, GError **error)
{
GString *srcpath, *destpath;
size_t slen, dlen, rlen;
@@ -2083,15 +2119,15 @@ em_migrate_folder_expand_state_1_4 (const char *evolution_dir, CamelException *e
g_string_append (srcpath, "/evolution/config");
if (stat (srcpath->str, &st) == -1 || !S_ISDIR (st.st_mode)) {
g_string_free (srcpath, TRUE);
- return 0;
+ return TRUE;
}
- destpath = g_string_new (evolution_dir);
- g_string_append (destpath, "/mail/config");
+ destpath = g_string_new (data_dir);
+ g_string_append (destpath, "/config");
if (g_mkdir_with_parents (destpath->str, 0777) == -1 || !(dir = opendir (srcpath->str))) {
g_string_free (destpath, TRUE);
g_string_free (srcpath, TRUE);
- return 0;
+ return TRUE;
}
g_string_append (srcpath, "/et-expanded-");
@@ -2122,7 +2158,7 @@ em_migrate_folder_expand_state_1_4 (const char *evolution_dir, CamelException *e
/* this should always be the case afaik... */
inptr += rlen;
new = g_string_new ("mbox:");
- g_string_append_printf (new, "%s/mail/local#", evolution_dir);
+ g_string_append_printf (new, "%s/local#", data_dir);
full_name = g_strdup (inptr);
inptr = full_name + strlen (full_name) - 12;
@@ -2164,11 +2200,11 @@ em_migrate_folder_expand_state_1_4 (const char *evolution_dir, CamelException *e
g_string_free (destpath, TRUE);
g_string_free (srcpath, TRUE);
- return 0;
+ return TRUE;
}
-static int
-em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException *ex)
+static gboolean
+em_migrate_folder_view_settings_1_4 (const char *data_dir, GError **error)
{
GString *srcpath, *destpath;
size_t slen, dlen, rlen;
@@ -2181,15 +2217,15 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException *
g_string_append (srcpath, "/evolution/views/mail");
if (stat (srcpath->str, &st) == -1 || !S_ISDIR (st.st_mode)) {
g_string_free (srcpath, TRUE);
- return 0;
+ return TRUE;
}
- destpath = g_string_new (evolution_dir);
- g_string_append (destpath, "/mail/views");
+ destpath = g_string_new (data_dir);
+ g_string_append (destpath, "/views");
if (g_mkdir_with_parents (destpath->str, 0777) == -1 || !(dir = opendir (srcpath->str))) {
g_string_free (destpath, TRUE);
g_string_free (srcpath, TRUE);
- return 0;
+ return TRUE;
}
g_string_append_c (srcpath, '/');
@@ -2241,7 +2277,7 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException *
/* this should always be the case afaik... */
inptr += rlen;
new = g_string_new ("mbox:");
- g_string_append_printf (new, "%s/mail/local#", evolution_dir);
+ g_string_append_printf (new, "%s/local#", data_dir);
full_name = g_strdup (inptr);
inptr = full_name + strlen (full_name) - 12;
@@ -2286,7 +2322,7 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException *
g_string_free (destpath, TRUE);
g_string_free (srcpath, TRUE);
- return 0;
+ return TRUE;
}
#define SUBFOLDER_DIR_NAME "subfolders"
@@ -2367,16 +2403,16 @@ e_path_to_physical (const char *prefix, const char *vpath)
return ppath;
}
-static int
-em_migrate_imap_cmeta_1_4(const char *evolution_dir, CamelException *ex)
+static gboolean
+em_migrate_imap_cmeta_1_4(const char *data_dir, GError **error)
{
GConfClient *gconf;
GSList *paths, *p;
EAccountList *accounts;
const EAccount *account;
- if (!(accounts = mail_config_get_accounts()))
- return 0;
+ if (!(accounts = e_get_account_list ()))
+ return TRUE;
gconf = gconf_client_get_default();
paths = gconf_client_get_list(gconf, "/apps/evolution/shell/offline/folder_paths", GCONF_VALUE_STRING, NULL);
@@ -2396,8 +2432,8 @@ em_migrate_imap_cmeta_1_4(const char *evolution_dir, CamelException *ex)
if (url) {
char *dir, *base;
- base = g_strdup_printf("%s/mail/imap/%s@%s/folders",
- evolution_dir,
+ base = g_strdup_printf("%s/imap/%s@%s/folders",
+ data_dir,
url->user?url->user:"",
url->host?url->host:"");
@@ -2441,7 +2477,7 @@ em_migrate_imap_cmeta_1_4(const char *evolution_dir, CamelException *ex)
/* we couldn't care less if this doesn't work */
- return 0;
+ return TRUE;
}
static void
@@ -2480,52 +2516,53 @@ remove_system_searches(xmlDocPtr searches)
}
}
-static int
-em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders, CamelException *ex)
+static gboolean
+em_migrate_1_4 (const char *data_dir, xmlDocPtr filters, xmlDocPtr vfolders, GError **error)
{
EMMigrateSession *session;
CamelException lex;
struct stat st;
- char *path;
+ gchar *path;
xmlDocPtr searches;
- path = g_build_filename (evolution_dir, "mail", NULL);
-
- camel_init (path, TRUE);
+ camel_init (data_dir, TRUE);
camel_provider_init();
- session = (EMMigrateSession *) em_migrate_session_new (path);
- g_free (path);
+ session = (EMMigrateSession *) em_migrate_session_new (data_dir);
session->srcdir = g_build_filename (g_get_home_dir (), "evolution", "local", NULL);
path = g_strdup_printf ("mbox:%s/.evolution/mail/local", g_get_home_dir ());
if (stat (path + 5, &st) == -1) {
if (errno != ENOENT || g_mkdir_with_parents (path + 5, 0777) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to create local mail storage `%s': %s"),
- path + 5, g_strerror (errno));
+ g_set_error (
+ error, E_SHELL_MIGRATE_ERROR,
+ E_SHELL_MIGRATE_ERROR_FAILED,
+ _("Failed to create local mail storage "
+ "`%s': %s"), path + 5, g_strerror (errno));
g_free (session->srcdir);
camel_object_unref (session);
g_free (path);
- return -1;
+ return FALSE;
}
}
camel_exception_init (&lex);
if (!(session->store = camel_session_get_store ((CamelSession *) session, path, &lex))) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to create local mail storage `%s': %s"),
- path, lex.desc);
+ g_set_error (
+ error, E_SHELL_MIGRATE_ERROR,
+ E_SHELL_MIGRATE_ERROR_FAILED,
+ _("Failed to create local mail storage `%s': %s"),
+ path, lex.desc);
g_free (session->srcdir);
camel_object_unref (session);
camel_exception_clear (&lex);
g_free (path);
- return -1;
+ return FALSE;
}
g_free (path);
- if (em_migrate_local_folders_1_4 (session, ex) == -1)
- return -1;
+ if (!em_migrate_local_folders_1_4 (session, error))
+ return FALSE;
camel_object_unref (session->store);
g_free (session->srcdir);
@@ -2543,26 +2580,24 @@ em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders
g_free(path);
if (searches) {
remove_system_searches(searches);
- path = g_build_filename(evolution_dir, "mail", NULL);
- emm_save_xml(searches, path, "searches.xml");
- g_free(path);
+ emm_save_xml(searches, data_dir, "searches.xml");
xmlFreeDoc(searches);
}
- if (em_migrate_pop_uid_caches_1_4 (evolution_dir, ex) == -1)
- return -1;
+ if (!em_migrate_pop_uid_caches_1_4 (data_dir, error))
+ return FALSE;
/* these are non-fatal */
- em_migrate_imap_caches_1_4 (evolution_dir, ex);
- camel_exception_clear(ex);
- em_migrate_folder_expand_state_1_4 (evolution_dir, ex);
- camel_exception_clear(ex);
- em_migrate_folder_view_settings_1_4 (evolution_dir, ex);
- camel_exception_clear(ex);
- em_migrate_imap_cmeta_1_4(evolution_dir, ex);
- camel_exception_clear(ex);
-
- return 0;
+ em_migrate_imap_caches_1_4 (data_dir, error);
+ g_clear_error (error);
+ em_migrate_folder_expand_state_1_4 (data_dir, error);
+ g_clear_error (error);
+ em_migrate_folder_view_settings_1_4 (data_dir, error);
+ g_clear_error (error);
+ em_migrate_imap_cmeta_1_4 (data_dir, error);
+ g_clear_error (error);
+
+ return TRUE;
}
static void
@@ -2572,7 +2607,7 @@ em_update_accounts_2_11 (void)
EIterator *iter;
gboolean changed = FALSE;
- if (!(accounts = mail_config_get_accounts ()))
+ if (!(accounts = e_get_account_list ()))
return;
iter = e_list_get_iterator ((EList *) accounts);
@@ -2595,13 +2630,13 @@ em_update_accounts_2_11 (void)
g_object_unref (iter);
if (changed)
- mail_config_save_accounts ();
+ e_account_list_save (accounts);
}
#endif /* !G_OS_WIN32 */
-static int
-emm_setup_initial(const char *evolution_dir)
+static gboolean
+emm_setup_initial(const gchar *data_dir)
{
GDir *dir;
const char *d;
@@ -2613,10 +2648,10 @@ emm_setup_initial(const char *evolution_dir)
d(printf("Setting up initial mail tree\n"));
- base = g_build_filename(evolution_dir, "mail", "local", NULL);
+ base = g_build_filename(data_dir, "local", NULL);
if (g_mkdir_with_parents(base, 0777) == -1 && errno != EEXIST) {
g_free(base);
- return -1;
+ return FALSE;
}
/* e.g. try en-AU then en, etc */
@@ -2632,7 +2667,7 @@ emm_setup_initial(const char *evolution_dir)
}
/* Make sure we found one. */
- g_return_val_if_fail (*language_names != NULL, 0);
+ g_return_val_if_fail (*language_names != NULL, FALSE);
dir = g_dir_open(local, 0, NULL);
if (dir) {
@@ -2652,7 +2687,7 @@ emm_setup_initial(const char *evolution_dir)
g_free(local);
g_free(base);
- return 0;
+ return TRUE;
}
static gboolean
@@ -2767,8 +2802,8 @@ em_update_sa_junk_setting_2_23 (void)
static gboolean
update_progress_in_main_thread (double *progress)
{
- em_migrate_set_progress (*progress);
- return FALSE;
+ em_migrate_set_progress (*progress);
+ return FALSE;
}
static void
@@ -2796,13 +2831,11 @@ migrate_folders(CamelStore *store, gboolean is_local, CamelFolderInfo *fi, const
if (folder != NULL)
camel_folder_summary_migrate_infos (folder->summary);
-
migrate_folders(store, is_local, fi->child, acc, ex, done, nth_folder, total_folders);
-
fi = fi->next;
}
- if ( (*nth_folder) == (total_folders - 1))
+ if ((*nth_folder) == (total_folders - 1))
*done = TRUE;
}
@@ -2812,28 +2845,30 @@ count_folders (CamelFolderInfo *fi, int *count)
{
while (fi) {
*count = *count + 1;
- count_folders (fi->child , count);
+ count_folders (fi->child, count);
fi = fi->next;
}
}
static CamelStore *
-setup_local_store (MailComponent *mc)
+setup_local_store (EShellBackend *shell_backend,
+ EMMigrateSession *session)
{
CamelURL *url;
+ const gchar *data_dir;
char *tmp;
CamelStore *store;
url = camel_url_new("mbox:", NULL);
- tmp = g_build_filename (mail_component_peek_base_directory(mc), "local", NULL);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ tmp = g_build_filename (data_dir, "local", NULL);
camel_url_set_path(url, tmp);
g_free(tmp);
tmp = camel_url_to_string(url, 0);
- store = (CamelStore *)camel_session_get_service(session, tmp, CAMEL_PROVIDER_STORE, NULL);
+ store = (CamelStore *)camel_session_get_service(CAMEL_SESSION (session), tmp, CAMEL_PROVIDER_STORE, NULL);
g_free(tmp);
return store;
-
}
struct migrate_folders_to_db_structure {
@@ -2845,7 +2880,8 @@ struct migrate_folders_to_db_structure {
gboolean is_local_store;
};
-static void migrate_folders_to_db_thread (struct migrate_folders_to_db_structure *migrate_dbs)
+static void
+migrate_folders_to_db_thread (struct migrate_folders_to_db_structure *migrate_dbs)
{
int num_of_folders = 0, nth_folder = 0;
count_folders (migrate_dbs->info, &num_of_folders);
@@ -2855,116 +2891,136 @@ static void migrate_folders_to_db_thread (struct migrate_folders_to_db_structure
}
static void
-migrate_to_db()
+migrate_to_db (EShellBackend *shell_backend)
{
- EAccountList *accounts;
- EIterator *iter;
- int i=0, len;
- MailComponent *component = mail_component_peek ();
- CamelStore *store = NULL;
- CamelFolderInfo *info;
+ EMMigrateSession *session;
+ EAccountList *accounts;
+ EIterator *iter;
+ int i=0, len;
+ CamelStore *store = NULL;
+ CamelFolderInfo *info;
+ const gchar *data_dir;
- if (!(accounts = mail_config_get_accounts ()))
- return;
+ if (!(accounts = e_get_account_list ()))
+ return;
- iter = e_list_get_iterator ((EList *) accounts);
- len = e_list_length ((EList *) accounts);
+ iter = e_list_get_iterator ((EList *) accounts);
+ len = e_list_length ((EList *) accounts);
+
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ session = (EMMigrateSession *) em_migrate_session_new (data_dir);
+ camel_session_set_online ((CamelSession *) session, FALSE);
+ em_migrate_setup_progress_dialog (
+ _("Migrating Folders"),
+ _("The summary format of the Evolution mailbox "
+ "folders has been moved to SQLite since Evolution 2.24.\n\nPlease be "
+ "patient while Evolution migrates your folders..."));
+
+ em_migrate_set_progress ( (double)i/(len+1));
+ store = setup_local_store (shell_backend, session);
+ info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, NULL);
+ if (info) {
+ GThread *thread;
+ struct migrate_folders_to_db_structure migrate_dbs;
+
+ if (g_str_has_suffix (((CamelService *)store)->url->path, ".evolution/mail/local"))
+ migrate_dbs.is_local_store = TRUE;
+ else
+ migrate_dbs.is_local_store = FALSE;
+ camel_exception_init (&migrate_dbs.ex);
+ migrate_dbs.account_name = _("On This Computer");
+ migrate_dbs.info = info;
+ migrate_dbs.store = store;
+ migrate_dbs.done = FALSE;
+
+ thread = g_thread_create ((GThreadFunc) migrate_folders_to_db_thread, &migrate_dbs, TRUE, NULL);
+ while (!migrate_dbs.done)
+ g_main_context_iteration (NULL, TRUE);
+ }
+ i++;
+ em_migrate_set_progress ( (double)i/(len+1));
- camel_session_set_online ((CamelSession *) session, FALSE);
- em_migrate_setup_progress_dialog (_("Migrating Folders"), _("The summary format of the Evolution mailbox "
- "folders has been moved to SQLite since Evolution 2.24.\n\nPlease be "
- "patient while Evolution migrates your folders..."));
+ while (e_iterator_is_valid (iter)) {
+ EAccount *account = (EAccount *) e_iterator_get (iter);
+ EAccountService *service;
+ const char *name;
- store = setup_local_store (component);
- info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, NULL);
- if (info) {
+ service = account->source;
+ name = account->name;
+ em_migrate_set_progress ( (double)i/(len+1));
+ if (account->enabled
+ && service->url != NULL
+ && service->url[0]
+ && strncmp(service->url, "mbox:", 5) != 0) {
+
+ CamelException ex;
+
+ camel_exception_init (&ex);
+ e_mail_shell_backend_load_store_by_uri (
+ E_MAIL_SHELL_BACKEND (shell_backend),
+ service->url, name);
+
+ store = (CamelStore *) camel_session_get_service (CAMEL_SESSION (session), service->url, CAMEL_PROVIDER_STORE, &ex);
+ info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, &ex);
+ if (info) {
GThread *thread;
struct migrate_folders_to_db_structure migrate_dbs;
- if (g_str_has_suffix (((CamelService *)store)->url->path, ".evolution/mail/local"))
- migrate_dbs.is_local_store = TRUE;
- else
- migrate_dbs.is_local_store = FALSE;
- camel_exception_init (&migrate_dbs.ex);
- migrate_dbs.account_name = _("On This Computer");
+ migrate_dbs.ex = ex;
+ migrate_dbs.account_name = account->name;
migrate_dbs.info = info;
migrate_dbs.store = store;
migrate_dbs.done = FALSE;
thread = g_thread_create ((GThreadFunc) migrate_folders_to_db_thread, &migrate_dbs, TRUE, NULL);
while (!migrate_dbs.done)
- g_main_context_iteration (NULL, TRUE);
+ g_main_context_iteration (NULL, TRUE);
+ } else
+ printf("%s:%s: failed to get folder infos \n", G_STRLOC, G_STRFUNC);
+ camel_exception_clear(&ex);
+
}
i++;
- while (e_iterator_is_valid (iter)) {
- EAccount *account = (EAccount *) e_iterator_get (iter);
- EAccountService *service;
- const char *name;
-
- service = account->source;
- name = account->name;
- if (account->enabled
- && service->url != NULL
- && service->url[0]
- && strncmp(service->url, "mbox:", 5) != 0) {
-
- CamelException ex;
-
- camel_exception_init (&ex);
- mail_component_load_store_by_uri (component, service->url, name);
-
- store = (CamelStore *) camel_session_get_service (session, service->url, CAMEL_PROVIDER_STORE, &ex);
- info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, &ex);
- if (info) {
- GThread *thread;
- struct migrate_folders_to_db_structure migrate_dbs;
-
- migrate_dbs.ex = ex;
- migrate_dbs.account_name = account->name;
- migrate_dbs.info = info;
- migrate_dbs.store = store;
- migrate_dbs.done = FALSE;
-
- thread = g_thread_create ((GThreadFunc) migrate_folders_to_db_thread, &migrate_dbs, TRUE, NULL);
- while (!migrate_dbs.done)
- g_main_context_iteration (NULL, TRUE);
- } else
- printf("%s:%s: failed to get folder infos \n", G_STRLOC, G_STRFUNC);
- camel_exception_clear(&ex);
- }
- i++;
- e_iterator_next (iter);
- }
- /* camel_session_set_online ((CamelSession *) session, TRUE); */
- g_object_unref (iter);
- em_migrate_close_progress_dialog ();
-}
+ e_iterator_next (iter);
+
+ }
+ //camel_session_set_online ((CamelSession *) session, TRUE);
-int
-em_migrate (const char *evolution_dir, int major, int minor, int revision, CamelException *ex)
+ g_object_unref (iter);
+ em_migrate_close_progress_dialog ();
+
+ g_object_unref (session);
+}
+
+gboolean
+e_mail_shell_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error)
{
struct stat st;
- char *path;
+ const gchar *data_dir;
+ gchar *path;
/* make sure ~/.evolution/mail exists */
- path = g_build_filename (evolution_dir, "mail", NULL);
- if (g_stat (path, &st) == -1) {
- if (errno != ENOENT || g_mkdir_with_parents (path, 0777) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Unable to create local mail folders at `%s': %s"),
- path, g_strerror (errno));
- g_free (path);
- return -1;
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ if (g_stat (data_dir, &st) == -1) {
+ if (errno != ENOENT || g_mkdir_with_parents (data_dir, 0777) == -1) {
+ g_set_error (
+ error, E_SHELL_MIGRATE_ERROR,
+ E_SHELL_MIGRATE_ERROR_FAILED,
+ _("Unable to create local mail folders at "
+ "`%s': %s"), data_dir, g_strerror (errno));
+ return FALSE;
}
}
- g_free (path);
-
if (major == 0)
- return emm_setup_initial(evolution_dir);
+ return emm_setup_initial (data_dir);
if (major == 1 && minor < 5) {
#ifndef G_OS_WIN32
@@ -2972,46 +3028,46 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel
path = g_build_filename (g_get_home_dir (), "evolution", NULL);
if (minor <= 2 && !(config_xmldb = emm_load_xml (path, "config.xmldb"))) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Unable to read settings from previous Evolution install, "
- "`evolution/config.xmldb' does not exist or is corrupt."));
- g_free (path);
- return -1;
+ g_set_error (
+ error, E_SHELL_MIGRATE_ERROR,
+ E_SHELL_MIGRATE_ERROR_FAILED,
+ _("Unable to read settings from previous "
+ "Evolution install, `evolution/config.xmldb' "
+ "does not exist or is corrupt."));
+ return FALSE;
}
filters = emm_load_xml (path, "filters.xml");
vfolders = emm_load_xml (path, "vfolders.xml");
g_free (path);
if (minor == 0) {
- if (em_migrate_1_0 (evolution_dir, config_xmldb, filters, vfolders, ex) == -1) {
+ if (!em_migrate_1_0 (data_dir, config_xmldb, filters, vfolders, error)) {
xmlFreeDoc (config_xmldb);
xmlFreeDoc (filters);
xmlFreeDoc (vfolders);
- return -1;
+ return FALSE;
}
}
if (minor <= 2) {
- if (em_migrate_1_2 (evolution_dir, config_xmldb, filters, vfolders, ex) == -1) {
+ if (!em_migrate_1_2 (data_dir, config_xmldb, filters, vfolders, error)) {
xmlFreeDoc (config_xmldb);
xmlFreeDoc (filters);
xmlFreeDoc (vfolders);
- return -1;
+ return FALSE;
}
xmlFreeDoc (config_xmldb);
}
if (minor <= 4) {
- if (em_migrate_1_4 (evolution_dir, filters, vfolders, ex) == -1) {
+ if (!em_migrate_1_4 (data_dir, filters, vfolders, error)) {
xmlFreeDoc (filters);
xmlFreeDoc (vfolders);
- return -1;
+ return FALSE;
}
}
- path = g_build_filename (evolution_dir, "mail", NULL);
-
if (filters) {
emm_save_xml (filters, path, "filters.xml");
xmlFreeDoc (filters);
@@ -3042,8 +3098,8 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel
if (major < 2 || (major == 2 && minor < 24)) {
em_update_sa_junk_setting_2_23 ();
- migrate_to_db ();
+ migrate_to_db (shell_backend);
}
- return 0;
+ return TRUE;
}
diff --git a/e-util/e-corba-utils.c b/mail/e-mail-shell-migrate.h
index f673370bfc..8f3057ec0d 100644
--- a/e-util/e-corba-utils.c
+++ b/mail/e-mail-shell-migrate.h
@@ -1,4 +1,6 @@
/*
+ * e-mail-shell-migrate.h
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,31 +15,24 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#ifndef E_MAIL_SHELL_BACKEND_MIGRATE_H
+#define E_MAIL_SHELL_BACKEND_MIGRATE_H
+
+#include <glib.h>
+#include <shell/e-shell-backend.h>
-#include "e-corba-utils.h"
+G_BEGIN_DECLS
-
-const CORBA_char *
-e_safe_corba_string (const char *s)
-{
- if (s == NULL)
- return (CORBA_char *) "";
+gboolean e_mail_shell_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error);
- return s;
-}
+G_END_DECLS
-CORBA_char *
-e_safe_corba_string_dup (const char *s)
-{
- return CORBA_string_dup (e_safe_corba_string (s));
-}
+#endif /* E_MAIL_SHELL_BACKEND_MIGRATE_H */
diff --git a/mail/e-mail-shell-settings.c b/mail/e-mail-shell-settings.c
new file mode 100644
index 0000000000..8237924e3c
--- /dev/null
+++ b/mail/e-mail-shell-settings.c
@@ -0,0 +1,521 @@
+/*
+ * e-mail-shell-settings.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-shell-settings.h"
+
+#include <gconf/gconf-client.h>
+#include <libedataserver/e-account-list.h>
+
+#include "e-util/e-signature-list.h"
+#include "mail/e-mail-label-list-store.h"
+#include "mail/mail-session.h"
+
+void
+e_mail_shell_settings_init (EShell *shell)
+{
+ EShellSettings *shell_settings;
+ gpointer object;
+
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ /* XXX Default values should match the GConf schema.
+ * Yes it's redundant, but we're stuck with GConf. */
+
+ /*** Global Objects ***/
+
+ e_shell_settings_install_property (
+ g_param_spec_object (
+ "mail-label-list-store",
+ NULL,
+ NULL,
+ E_TYPE_MAIL_LABEL_LIST_STORE,
+ G_PARAM_READWRITE));
+
+ object = e_mail_label_list_store_new ();
+ e_shell_settings_set_object (
+ shell_settings, "mail-label-list-store", object);
+ g_object_unref (object);
+
+ e_shell_settings_install_property (
+ g_param_spec_pointer (
+ "mail-session",
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ camel_object_ref (session);
+ e_shell_settings_set_pointer (
+ shell_settings, "mail-session", session);
+
+ /*** Mail Preferences ***/
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-address-compress",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-address-compress",
+ "/apps/evolution/mail/display/address_compress");
+
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "mail-address-count",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-address-count",
+ "/apps/evolution/mail/display/address_count");
+
+ e_shell_settings_install_property (
+ g_param_spec_string (
+ "mail-charset-default",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-charset-default",
+ "/apps/evolution/mail/display/charset");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-check-for-junk",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-check-for-junk",
+ "/apps/evolution/mail/junk/check_incoming");
+
+ e_shell_settings_install_property (
+ g_param_spec_string (
+ "mail-citation-color",
+ NULL,
+ NULL,
+ "#737373",
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-citation-color",
+ "/apps/evolution/mail/display/citation_colour");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-confirm-expunge",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-confirm-expunge",
+ "/apps/evolution/mail/prompts/expunge");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-confirm-unwanted-html",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-confirm-unwanted-html",
+ "/apps/evolution/mail/prompts/unwanted_html");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-empty-trash-on-exit",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-empty-trash-on-exit",
+ "/apps/evolution/mail/trash/empty_on_exit");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-enable-search-folders",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-enable-search-folders",
+ "/apps/evolution/mail/display/enable_vfolders");
+
+ e_shell_settings_install_property (
+ g_param_spec_string (
+ "mail-font-monospace",
+ NULL,
+ NULL,
+ "",
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-font-monospace",
+ "/apps/evolution/mail/display/fonts/monospace");
+
+ e_shell_settings_install_property (
+ g_param_spec_string (
+ "mail-font-variable",
+ NULL,
+ NULL,
+ "",
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-font-variable",
+ "/apps/evolution/mail/display/fonts/variable");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-force-message-limit",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-force-message-limit",
+ "/apps/evolution/mail/display/force_message_limit");
+
+ /* This value corresponds to MailConfigForwardStyle enum. */
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "mail-forward-style",
+ NULL,
+ NULL,
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-forward-style",
+ "/apps/evolution/mail/format/forward_style");
+
+ /* This value corresponds to MailConfigHTTPMode enum. */
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "mail-image-loading-policy",
+ NULL,
+ NULL,
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-image-loading-policy",
+ "/apps/evolution/mail/display/load_http_images");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-magic-spacebar",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-magic-spacebar",
+ "/apps/evolution/mail/display/magic_spacebar");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-mark-citations",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-mark-citations",
+ "/apps/evolution/mail/display/mark_citations");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-mark-seen",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-mark-seen",
+ "/apps/evolution/mail/display/mark_seen");
+
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "mail-mark-seen-timeout",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-mark-seen-timeout",
+ "/apps/evolution/mail/display/mark_seen_timeout");
+
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "mail-message-text-part-limit",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-message-text-part-limit",
+ "/apps/evolution/mail/display/message_text_part_limit");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-only-local-photos",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-only-local-photos",
+ "/apps/evolution/mail/display/photo_local");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-prompt-delete-in-vfolder",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-prompt-delete-in-vfolder",
+ "/apps/evolution/mail/prompts/delete_in_vfolder");
+
+ /* This value corresponds to MailConfigReplyStyle enum,
+ * but the ordering of the combo box items in preferences
+ * has changed. We use transformation functions there. */
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "mail-reply-style",
+ NULL,
+ NULL,
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-reply-style",
+ "/apps/evolution/mail/format/reply_style");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-show-animated-images",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-show-animated-images",
+ "/apps/evolution/mail/display/animated_images");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-show-sender-photo",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-show-sender-photo",
+ "/apps/evolution/mail/display/sender_photo");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "mail-use-custom-fonts",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-use-custom-fonts",
+ "/apps/evolution/mail/display/fonts/use_custom");
+
+
+ /*** Composer Preferences ***/
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "composer-format-html",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "composer-format-html",
+ "/apps/evolution/mail/composer/send_html");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "composer-inline-spelling",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "composer-inline-spelling",
+ "/apps/evolution/mail/composer/inline_spelling");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "composer-magic-links",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "composer-magic-links",
+ "/apps/evolution/mail/composer/magic_links");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "composer-magic-smileys",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "composer-magic-smileys",
+ "/apps/evolution/mail/composer/magic_smileys");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "composer-outlook-filenames",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "composer-outlook-filenames",
+ "/apps/evolution/mail/composer/outlook_filenames");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "composer-prompt-only-bcc",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "composer-prompt-only-bcc",
+ "/apps/evolution/mail/prompts/only_bcc");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "composer-prompt-empty-subject",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "composer-prompt-empty-subject",
+ "/apps/evolution/mail/prompts/empty_subject");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "composer-reply-start-bottom",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "composer-reply-start-bottom",
+ "/apps/evolution/mail/composer/reply_start_bottom");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "composer-request-receipt",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "composer-request-receipt",
+ "/apps/evolution/mail/composer/request_receipt");
+
+ e_shell_settings_install_property (
+ g_param_spec_string (
+ "composer-spell-color",
+ NULL,
+ NULL,
+ "#ff0000",
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "composer-spell-color",
+ "/apps/evolution/mail/composer/spell_color");
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "composer-top-signature",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "composer-top-signature",
+ "/apps/evolution/mail/composer/top_signature");
+}
diff --git a/calendar/gui/control-factory.h b/mail/e-mail-shell-settings.h
index c79d70b5ba..4267fd8a60 100644
--- a/calendar/gui/control-factory.h
+++ b/mail/e-mail-shell-settings.h
@@ -1,4 +1,5 @@
/*
+ * e-mail-shell-settings.h
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -14,18 +15,19 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifndef _CONTROL_FACTORY_H_
-#define _CONTROL_FACTORY_H_
+#ifndef E_MAIL_SHELL_SETTINGS_H
+#define E_MAIL_SHELL_SETTINGS_H
+
+#include <shell/e-shell.h>
+
+G_BEGIN_DECLS
-#include <bonobo/bonobo-control.h>
+void e_mail_shell_settings_init (EShell *shell);
-BonoboControl *control_factory_new_control (void);
+G_END_DECLS
-#endif /* _CONTROL_FACTORY_H_ */
+#endif /* E_MAIL_SHELL_SETTINGS_H */
diff --git a/mail/e-mail-shell-sidebar.c b/mail/e-mail-shell-sidebar.c
new file mode 100644
index 0000000000..1b090fa703
--- /dev/null
+++ b/mail/e-mail-shell-sidebar.c
@@ -0,0 +1,347 @@
+/*
+ * e-mail-shell-sidebar.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-shell-sidebar.h"
+
+#include <string.h>
+#include <camel/camel.h>
+
+#include "em-utils.h"
+#include "em-folder-utils.h"
+
+#include "e-mail-shell-backend.h"
+
+#define E_MAIL_SHELL_SIDEBAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_SHELL_SIDEBAR, EMailShellSidebarPrivate))
+
+struct _EMailShellSidebarPrivate {
+ GtkWidget *folder_tree;
+};
+
+enum {
+ PROP_0,
+ PROP_FOLDER_TREE
+};
+
+static gpointer parent_class;
+static GType mail_shell_sidebar_type;
+
+static void
+mail_shell_sidebar_selection_changed_cb (EShellSidebar *shell_sidebar,
+ GtkTreeSelection *selection)
+{
+ EShellView *shell_view;
+ EShellViewClass *shell_view_class;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ const gchar *icon_name;
+ gchar *display_name = NULL;
+ gboolean is_folder = FALSE;
+ guint flags = 0;
+
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ gtk_tree_model_get (
+ model, &iter,
+ COL_STRING_DISPLAY_NAME, &display_name,
+ COL_BOOL_IS_FOLDER, &is_folder,
+ COL_UINT_FLAGS, &flags, -1);
+
+ if (is_folder)
+ icon_name = em_folder_utils_get_icon_name (flags);
+ else {
+ icon_name = shell_view_class->icon_name;
+ display_name = g_strdup (shell_view_class->label);
+ }
+
+ e_shell_sidebar_set_icon_name (shell_sidebar, icon_name);
+ e_shell_sidebar_set_primary_text (shell_sidebar, display_name);
+
+ g_free (display_name);
+}
+
+static void
+mail_shell_sidebar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_FOLDER_TREE:
+ g_value_set_object (
+ value, e_mail_shell_sidebar_get_folder_tree (
+ E_MAIL_SHELL_SIDEBAR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_shell_sidebar_dispose (GObject *object)
+{
+ EMailShellSidebarPrivate *priv;
+
+ priv = E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ if (priv->folder_tree != NULL) {
+ g_object_unref (priv->folder_tree);
+ priv->folder_tree = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+mail_shell_sidebar_finalize (GObject *object)
+{
+ EMailShellSidebarPrivate *priv;
+
+ priv = E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+mail_shell_sidebar_constructed (GObject *object)
+{
+ EMailShellSidebarPrivate *priv;
+ EMailShellBackend *mail_shell_backend;
+ EShellSidebar *shell_sidebar;
+ EShellBackend *shell_backend;
+ EShellView *shell_view;
+ GtkTreeSelection *selection;
+ GtkTreeView *tree_view;
+ GtkWidget *container;
+ GtkWidget *widget;
+
+ priv = E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ /* Chain up to parent's constructed method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ shell_sidebar = E_SHELL_SIDEBAR (object);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ mail_shell_backend = E_MAIL_SHELL_BACKEND (shell_backend);
+
+ /* Build sidebar widgets. */
+
+ container = GTK_WIDGET (object);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = em_folder_tree_new (mail_shell_backend);
+ em_folder_tree_set_excluded (EM_FOLDER_TREE (widget), 0);
+ em_folder_tree_enable_drag_and_drop (EM_FOLDER_TREE (widget));
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->folder_tree = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ tree_view = GTK_TREE_VIEW (priv->folder_tree);
+ selection = gtk_tree_view_get_selection (tree_view);
+
+ g_signal_connect_swapped (
+ selection, "changed",
+ G_CALLBACK (mail_shell_sidebar_selection_changed_cb),
+ shell_sidebar);
+}
+
+static guint32
+mail_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
+{
+ EMailShellBackend *mail_shell_backend;
+ EMailShellSidebar *mail_shell_sidebar;
+ EShellBackend *shell_backend;
+ EShellView *shell_view;
+ EMFolderTree *folder_tree;
+ GtkTreeSelection *selection;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ CamelFolder *folder;
+ CamelStore *local_store;
+ CamelStore *store;
+ gchar *full_name;
+ gchar *uri;
+ gboolean allows_children = TRUE;
+ gboolean can_delete = TRUE;
+ gboolean is_junk = FALSE;
+ gboolean is_outbox = FALSE;
+ gboolean is_store;
+ gboolean is_trash = FALSE;
+ guint32 folder_flags = 0;
+ guint32 state = 0;
+
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ mail_shell_backend = E_MAIL_SHELL_BACKEND (shell_backend);
+ local_store = e_mail_shell_backend_get_local_store (mail_shell_backend);
+
+ mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ tree_view = GTK_TREE_VIEW (folder_tree);
+
+ selection = gtk_tree_view_get_selection (tree_view);
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return 0;
+
+ gtk_tree_model_get (
+ model, &iter,
+ COL_POINTER_CAMEL_STORE, &store,
+ COL_STRING_FULL_NAME, &full_name,
+ COL_BOOL_IS_STORE, &is_store,
+ COL_UINT_FLAGS, &folder_flags,
+ COL_STRING_URI, &uri, -1);
+
+ if (!is_store) {
+ is_junk = (strcmp (full_name, CAMEL_VJUNK_NAME) == 0);
+ is_trash = (strcmp (full_name, CAMEL_VTRASH_NAME) == 0);
+ allows_children = !(is_junk || is_trash);
+
+ /* Don't allow deletion of special local folders. */
+ if (store == local_store)
+ can_delete =
+ (strcmp (full_name, "Drafts") != 0) &&
+ (strcmp (full_name, "Inbox") != 0) &&
+ (strcmp (full_name, "Outbox") != 0) &&
+ (strcmp (full_name, "Sent") != 0) &&
+ (strcmp (full_name, "Templates") != 0);
+
+ folder = em_folder_tree_get_selected_folder (folder_tree);
+ is_outbox = em_utils_folder_is_outbox (folder, NULL);
+ can_delete &= !(folder_flags & CAMEL_FOLDER_SYSTEM);
+ }
+
+ if (allows_children)
+ state |= E_MAIL_SHELL_SIDEBAR_FOLDER_ALLOWS_CHILDREN;
+ if (can_delete)
+ state |= E_MAIL_SHELL_SIDEBAR_FOLDER_CAN_DELETE;
+ if (is_junk)
+ state |= E_MAIL_SHELL_SIDEBAR_FOLDER_IS_JUNK;
+ if (is_outbox)
+ state |= E_MAIL_SHELL_SIDEBAR_FOLDER_IS_OUTBOX;
+ if (is_store)
+ state |= E_MAIL_SHELL_SIDEBAR_FOLDER_IS_STORE;
+ if (is_trash)
+ state |= E_MAIL_SHELL_SIDEBAR_FOLDER_IS_TRASH;
+
+ return state;
+}
+
+static void
+mail_shell_sidebar_class_init (EMailShellSidebarClass *class)
+{
+ GObjectClass *object_class;
+ EShellSidebarClass *shell_sidebar_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMailShellSidebarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = mail_shell_sidebar_get_property;
+ object_class->dispose = mail_shell_sidebar_dispose;
+ object_class->finalize = mail_shell_sidebar_finalize;
+ object_class->constructed = mail_shell_sidebar_constructed;
+
+ shell_sidebar_class = E_SHELL_SIDEBAR_CLASS (class);
+ shell_sidebar_class->check_state = mail_shell_sidebar_check_state;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FOLDER_TREE,
+ g_param_spec_object (
+ "folder-tree",
+ NULL,
+ NULL,
+ EM_TYPE_FOLDER_TREE,
+ G_PARAM_READABLE));
+}
+
+static void
+mail_shell_sidebar_init (EMailShellSidebar *mail_shell_sidebar)
+{
+ mail_shell_sidebar->priv =
+ E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (mail_shell_sidebar);
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_mail_shell_sidebar_get_type (void)
+{
+ return mail_shell_sidebar_type;
+}
+
+void
+e_mail_shell_sidebar_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (EMailShellSidebarClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_shell_sidebar_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMailShellSidebar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mail_shell_sidebar_init,
+ NULL /* value_table */
+ };
+
+ mail_shell_sidebar_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_SIDEBAR,
+ "EMailShellSidebar", &type_info, 0);
+}
+
+GtkWidget *
+e_mail_shell_sidebar_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_MAIL_SHELL_SIDEBAR,
+ "shell-view", shell_view, NULL);
+}
+
+EMFolderTree *
+e_mail_shell_sidebar_get_folder_tree (EMailShellSidebar *mail_shell_sidebar)
+{
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_SIDEBAR (mail_shell_sidebar), NULL);
+
+ return EM_FOLDER_TREE (mail_shell_sidebar->priv->folder_tree);
+}
diff --git a/mail/e-mail-shell-sidebar.h b/mail/e-mail-shell-sidebar.h
new file mode 100644
index 0000000000..10a2ff6a2a
--- /dev/null
+++ b/mail/e-mail-shell-sidebar.h
@@ -0,0 +1,81 @@
+/*
+ * e-mail-shell-sidebar.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_SHELL_SIDEBAR_H
+#define E_MAIL_SHELL_SIDEBAR_H
+
+#include <shell/e-shell-sidebar.h>
+#include <shell/e-shell-view.h>
+#include <mail/em-folder-tree.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_SHELL_SIDEBAR \
+ (e_mail_shell_sidebar_get_type ())
+#define E_MAIL_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_SHELL_SIDEBAR, EMailShellSidebar))
+#define E_MAIL_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_SHELL_SIDEBAR, EMailShellSidebarClass))
+#define E_IS_MAIL_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_SHELL_SIDEBAR))
+#define E_IS_MAIL_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_SHELL_SIDEBAR))
+#define E_MAIL_SHELL_SIDEBAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_SHELL_SIDEBAR, EMailShellSidebarClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailShellSidebar EMailShellSidebar;
+typedef struct _EMailShellSidebarClass EMailShellSidebarClass;
+typedef struct _EMailShellSidebarPrivate EMailShellSidebarPrivate;
+
+enum {
+ E_MAIL_SHELL_SIDEBAR_FOLDER_ALLOWS_CHILDREN = 1 << 0,
+ E_MAIL_SHELL_SIDEBAR_FOLDER_CAN_DELETE = 1 << 1,
+ E_MAIL_SHELL_SIDEBAR_FOLDER_IS_JUNK = 1 << 2,
+ E_MAIL_SHELL_SIDEBAR_FOLDER_IS_OUTBOX = 1 << 3,
+ E_MAIL_SHELL_SIDEBAR_FOLDER_IS_STORE = 1 << 4,
+ E_MAIL_SHELL_SIDEBAR_FOLDER_IS_TRASH = 1 << 5
+};
+
+struct _EMailShellSidebar {
+ EShellSidebar parent;
+ EMailShellSidebarPrivate *priv;
+};
+
+struct _EMailShellSidebarClass {
+ EShellSidebarClass parent_class;
+};
+
+GType e_mail_shell_sidebar_get_type (void);
+void e_mail_shell_sidebar_register_type
+ (GTypeModule *type_module);
+GtkWidget * e_mail_shell_sidebar_new(EShellView *shell_view);
+EMFolderTree * e_mail_shell_sidebar_get_folder_tree
+ (EMailShellSidebar *mail_shell_sidebar);
+
+G_END_DECLS
+
+#endif /* E_MAIL_SHELL_SIDEBAR_H */
diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c
new file mode 100644
index 0000000000..3d0b76d176
--- /dev/null
+++ b/mail/e-mail-shell-view-actions.c
@@ -0,0 +1,1713 @@
+/*
+ * e-mail-shell-view-actions.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-shell-view-private.h"
+
+static void
+action_gal_save_custom_view_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellContent *mail_shell_content;
+ EShellView *shell_view;
+ GalViewInstance *view_instance;
+
+ /* All shell views repond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with saving the custom view. */
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ mail_shell_content = mail_shell_view->priv->mail_shell_content;
+ view_instance = e_mail_shell_content_get_view_instance (mail_shell_content);
+ gal_view_instance_save_as (view_instance);
+}
+
+static void
+action_mail_account_disable_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellBackend *mail_shell_backend;
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ EAccountList *account_list;
+ EAccount *account;
+ gchar *folder_uri;
+
+ mail_shell_backend = mail_shell_view->priv->mail_shell_backend;
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+ g_return_if_fail (folder_uri != NULL);
+
+ account_list = e_get_account_list ();
+ account = mail_config_get_account_by_source_url (folder_uri);
+ g_return_if_fail (account != NULL);
+
+ if (e_account_list_account_has_proxies (account_list, account))
+ e_account_list_remove_account_proxies (account_list, account);
+
+ account->enabled = !account->enabled;
+ e_account_list_change (account_list, account);
+ e_mail_shell_backend_remove_store_by_uri (
+ mail_shell_backend, folder_uri);
+
+ if (account->parent_uid != NULL)
+ e_account_list_remove (account_list, account);
+
+ e_account_list_save (account_list);
+
+ g_free (folder_uri);
+}
+
+static void
+action_mail_create_search_folder_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ /* FIXME */
+ g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action)));
+}
+
+static void
+action_mail_download_foreach_cb (CamelService *service)
+{
+ if (CAMEL_IS_DISCO_STORE (service) ||
+ CAMEL_IS_OFFLINE_STORE (service))
+ mail_store_prepare_offline (CAMEL_STORE (service));
+}
+
+static void
+action_mail_download_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellBackend *mail_shell_backend;
+
+ mail_shell_backend = mail_shell_view->priv->mail_shell_backend;
+
+ e_mail_shell_backend_stores_foreach (
+ mail_shell_backend, (GHFunc)
+ action_mail_download_foreach_cb, NULL);
+}
+
+static void
+action_mail_empty_trash_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ em_utils_empty_trash (GTK_WIDGET (shell_window));
+}
+
+static void
+action_mail_flush_outbox_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ mail_send ();
+}
+
+static void
+action_mail_folder_copy_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ CamelFolderInfo *folder_info;
+ EMFolderTree *folder_tree;
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder_info = em_folder_tree_get_selected_folder_info (folder_tree);
+ g_return_if_fail (folder_info != NULL);
+
+ /* XXX Leaking folder_info? */
+ em_folder_utils_copy_folder (folder_info, FALSE);
+}
+
+static void
+action_mail_folder_delete_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ CamelFolder *folder;
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder = em_folder_tree_get_selected_folder (folder_tree);
+ g_return_if_fail (folder != NULL);
+
+ em_folder_utils_delete_folder (folder);
+}
+
+static void
+action_mail_folder_expunge_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailReader *reader;
+ MessageList *message_list;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+ g_return_if_fail (message_list->folder != NULL);
+
+ em_utils_expunge_folder (
+ GTK_WIDGET (shell_window), message_list->folder);
+}
+
+static void
+action_mail_folder_mark_all_as_read_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailReader *reader;
+ MessageList *message_list;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ CamelFolder *folder;
+ GtkWindow *parent;
+ GPtrArray *uids;
+ const gchar *key;
+ const gchar *prompt;
+ guint ii;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ parent = GTK_WINDOW (shell_window);
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+ folder = message_list->folder;
+ g_return_if_fail (folder != NULL);
+
+ key = "/apps/evolution/mail/prompts/mark_all_read";
+ prompt = "mail:ask-mark-all-read";
+
+ if (!em_utils_prompt_user (parent, key, prompt, NULL))
+ return;
+
+ uids = message_list_get_uids (message_list);
+
+ camel_folder_freeze (folder);
+ for (ii = 0; ii < uids->len; ii++)
+ camel_folder_set_message_flags (
+ folder, uids->pdata[ii],
+ CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
+ camel_folder_thaw (folder);
+
+ message_list_free_uids (message_list, uids);
+}
+
+static void
+action_mail_folder_move_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ CamelFolderInfo *folder_info;
+ EMFolderTree *folder_tree;
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder_info = em_folder_tree_get_selected_folder_info (folder_tree);
+ g_return_if_fail (folder_info != NULL);
+
+ /* XXX Leaking folder_info? */
+ em_folder_utils_copy_folder (folder_info, TRUE);
+}
+
+static void
+action_mail_folder_new_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EMailShellSidebar *mail_shell_sidebar;
+ CamelFolderInfo *folder_info;
+ EMFolderTree *folder_tree;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder_info = em_folder_tree_get_selected_folder_info (folder_tree);
+ g_return_if_fail (folder_info != NULL);
+
+ em_folder_utils_create_folder (
+ folder_info, folder_tree, GTK_WINDOW (shell_window));
+ camel_folder_info_free (folder_info);
+}
+
+static void
+action_mail_folder_properties_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ EShellView *shell_view;
+ GtkTreeSelection *selection;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *uri;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+ tree_view = GTK_TREE_VIEW (folder_tree);
+ selection = gtk_tree_view_get_selection (tree_view);
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return;
+
+ gtk_tree_model_get (model, &iter, COL_STRING_URI, &uri, -1);
+ em_folder_properties_show (shell_view, NULL, uri);
+ g_free (uri);
+}
+
+static void
+action_mail_folder_refresh_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ CamelFolder *folder;
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder = em_folder_tree_get_selected_folder (folder_tree);
+ g_return_if_fail (folder != NULL);
+
+ mail_refresh_folder (folder, NULL, NULL);
+}
+
+static void
+action_mail_folder_rename_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ CamelFolder *folder;
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder = em_folder_tree_get_selected_folder (folder_tree);
+ g_return_if_fail (folder != NULL);
+
+ em_folder_utils_rename_folder (folder);
+}
+
+/* Helper for action_mail_folder_select_all_cb() */
+static gboolean
+action_mail_folder_select_all_timeout_cb (MessageList *message_list)
+{
+ message_list_select_all (message_list);
+ gtk_widget_grab_focus (GTK_WIDGET (message_list));
+
+ return FALSE;
+}
+
+static void
+action_mail_folder_select_all_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailReader *reader;
+ MessageList *message_list;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ if (message_list->threaded) {
+ gtk_action_activate (ACTION (MAIL_THREADS_EXPAND_ALL));
+
+ /* XXX The timeout below is added so that the execution
+ * thread to expand all conversation threads would
+ * have completed. The timeout 505 is just to ensure
+ * that the value is a small delta more than the
+ * timeout value in mail_regen_list(). */
+ g_timeout_add (
+ 505, (GSourceFunc)
+ action_mail_folder_select_all_timeout_cb,
+ message_list);
+ } else
+ /* If there is no threading, just select all immediately. */
+ action_mail_folder_select_all_timeout_cb (message_list);
+}
+
+static void
+action_mail_folder_select_thread_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ MessageList *message_list;
+ EMailReader *reader;
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ message_list_select_thread (message_list);
+}
+
+static void
+action_mail_folder_select_subthread_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ MessageList *message_list;
+ EMailReader *reader;
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ message_list_select_subthread (message_list);
+}
+
+static void
+action_mail_hide_deleted_cb (GtkToggleAction *action,
+ EMailShellView *mail_shell_view)
+{
+ MessageList *message_list;
+ EMailReader *reader;
+ gboolean active;
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ active = gtk_toggle_action_get_active (action);
+ message_list_set_hidedeleted (message_list, active);
+}
+
+static void
+action_mail_hide_read_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ MessageList *message_list;
+ EMailReader *reader;
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ message_list_hide_add (
+ message_list,
+ "(match-all (system-flag \"seen\"))",
+ ML_HIDE_SAME, ML_HIDE_SAME);
+}
+
+static void
+action_mail_hide_selected_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ MessageList *message_list;
+ EMailReader *reader;
+ GPtrArray *uids;
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ uids = message_list_get_selected (message_list);
+ message_list_hide_uids (message_list, uids);
+ message_list_free_uids (message_list, uids);
+}
+
+static void
+action_mail_label_cb (GtkToggleAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailReader *reader;
+ MessageList *message_list;
+ CamelFolder *folder;
+ GPtrArray *uids;
+ const gchar *tag;
+ gint ii;
+
+ tag = g_object_get_data (G_OBJECT (action), "tag");
+ g_return_if_fail (tag != NULL);
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+ folder = message_list->folder;
+
+ uids = message_list_get_selected (message_list);
+
+ for (ii = 0; ii < uids->len; ii++) {
+ if (gtk_toggle_action_get_active (action))
+ camel_folder_set_message_user_flag (
+ folder, uids->pdata[ii], tag, TRUE);
+ else {
+ camel_folder_set_message_user_flag (
+ folder, uids->pdata[ii], tag, FALSE);
+ camel_folder_set_message_user_tag (
+ folder, uids->pdata[ii], "label", NULL);
+ }
+ }
+
+ message_list_free_uids (message_list, uids);
+}
+
+static void
+action_mail_label_new_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EShell *shell;
+ EShellSettings *shell_settings;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ EMailLabelDialog *label_dialog;
+ EMailLabelListStore *store;
+ EMailReader *reader;
+ MessageList *message_list;
+ CamelFolder *folder;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkWidget *dialog;
+ GPtrArray *uids;
+ GdkColor label_color;
+ const gchar *property_name;
+ const gchar *label_name;
+ gchar *label_tag;
+ gint n_children;
+ guint ii;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ dialog = e_mail_label_dialog_new (GTK_WINDOW (shell_window));
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Add Label"));
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+ goto exit;
+
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ label_dialog = E_MAIL_LABEL_DIALOG (dialog);
+ label_name = e_mail_label_dialog_get_label_name (label_dialog);
+ e_mail_label_dialog_get_label_color (label_dialog, &label_color);
+
+ property_name = "mail-label-list-store";
+ store = e_shell_settings_get_object (shell_settings, property_name);
+ e_mail_label_list_store_set (store, NULL, label_name, &label_color);
+ g_object_unref (store);
+
+ /* XXX This is awkward. We've added a new label to the list store
+ * but we don't have the new label's tag nor an iterator to use
+ * to fetch it. We know the label was appended to the store,
+ * so we have to dig it out manually. EMailLabelListStore API
+ * probably needs some rethinking. */
+ model = GTK_TREE_MODEL (store);
+ n_children = gtk_tree_model_iter_n_children (model, NULL);
+ gtk_tree_model_iter_nth_child (model, &iter, NULL, n_children - 1);
+ label_tag = e_mail_label_list_store_get_tag (store, &iter);
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+ folder = message_list->folder;
+
+ uids = message_list_get_selected (message_list);
+
+ for (ii = 0; ii < uids->len; ii++)
+ camel_folder_set_message_user_flag (
+ folder, uids->pdata[ii], label_tag, TRUE);
+
+ message_list_free_uids (message_list, uids);
+
+ g_free (label_tag);
+
+exit:
+ gtk_widget_destroy (dialog);
+}
+
+static void
+action_mail_label_none_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellSettings *shell_settings;
+ EShellWindow *shell_window;
+ EMailReader *reader;
+ MessageList *message_list;
+ GtkTreeModel *tree_model;
+ CamelFolder *folder;
+ GtkTreeIter iter;
+ GPtrArray *uids;
+ gboolean valid;
+ guint ii;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ tree_model = e_shell_settings_get_object (
+ shell_settings, "mail-label-list-store");
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+ uids = message_list_get_selected (message_list);
+ folder = message_list->folder;
+
+ valid = gtk_tree_model_get_iter_first (tree_model, &iter);
+
+ while (valid) {
+ gchar *tag;
+
+ tag = e_mail_label_list_store_get_tag (
+ E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+
+ for (ii = 0; ii < uids->len; ii++) {
+ camel_folder_set_message_user_flag (
+ folder, uids->pdata[ii], tag, FALSE);
+ camel_folder_set_message_user_tag (
+ folder, uids->pdata[ii], "label", NULL);
+ }
+
+ g_free (tag);
+
+ valid = gtk_tree_model_iter_next (tree_model, &iter);
+ }
+
+ message_list_free_uids (message_list, uids);
+}
+
+static void
+action_mail_preview_cb (GtkToggleAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellContent *mail_shell_content;
+ gboolean active;
+
+ mail_shell_content = mail_shell_view->priv->mail_shell_content;
+ active = gtk_toggle_action_get_active (action);
+
+ e_mail_shell_content_set_preview_visible (mail_shell_content, active);
+}
+
+static void
+action_mail_show_hidden_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ MessageList *message_list;
+ EMailReader *reader;
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ message_list_hide_clear (message_list);
+}
+
+static void
+action_mail_smart_backward_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellSettings *shell_settings;
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ EMFormatHTMLDisplay *html_display;
+ EMailReader *reader;
+ MessageList *message_list;
+ GtkToggleAction *toggle_action;
+ GtkHTML *html;
+ gboolean caret_mode;
+ gboolean magic_spacebar;
+
+ /* This implements the so-called "Magic Backspace". */
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ magic_spacebar = e_shell_settings_get_boolean (
+ shell_settings, "mail-magic-spacebar");
+
+ toggle_action = GTK_TOGGLE_ACTION (ACTION (MAIL_CARET_MODE));
+ caret_mode = gtk_toggle_action_get_active (toggle_action);
+
+ html = EM_FORMAT_HTML (html_display)->html;
+
+ if (gtk_html_command (html, "scroll-backward"))
+ return;
+
+ if (caret_mode || !magic_spacebar)
+ return;
+
+ /* XXX Are two separate calls really necessary? */
+
+ if (message_list_select (
+ message_list, MESSAGE_LIST_SELECT_PREVIOUS,
+ 0, CAMEL_MESSAGE_SEEN))
+ return;
+
+ if (message_list_select (
+ message_list, MESSAGE_LIST_SELECT_PREVIOUS |
+ MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN))
+ return;
+
+ em_folder_tree_select_prev_path (folder_tree, TRUE);
+
+ gtk_widget_grab_focus (GTK_WIDGET (message_list));
+}
+
+static void
+action_mail_smart_forward_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellSettings *shell_settings;
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ EMFormatHTMLDisplay *html_display;
+ EMailReader *reader;
+ MessageList *message_list;
+ GtkToggleAction *toggle_action;
+ GtkHTML *html;
+ gboolean caret_mode;
+ gboolean magic_spacebar;
+
+ /* This implements the so-called "Magic Spacebar". */
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ magic_spacebar = e_shell_settings_get_boolean (
+ shell_settings, "mail-magic-spacebar");
+
+ toggle_action = GTK_TOGGLE_ACTION (ACTION (MAIL_CARET_MODE));
+ caret_mode = gtk_toggle_action_get_active (toggle_action);
+
+ html = EM_FORMAT_HTML (html_display)->html;
+
+ if (gtk_html_command (html, "scroll-forward"))
+ return;
+
+ if (caret_mode || !magic_spacebar)
+ return;
+
+ /* XXX Are two separate calls really necessary? */
+
+ if (message_list_select (
+ message_list, MESSAGE_LIST_SELECT_NEXT,
+ 0, CAMEL_MESSAGE_SEEN))
+ return;
+
+ if (message_list_select (
+ message_list, MESSAGE_LIST_SELECT_NEXT |
+ MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN))
+ return;
+
+ em_folder_tree_select_next_path (folder_tree, TRUE);
+
+ gtk_widget_grab_focus (GTK_WIDGET (message_list));
+}
+
+static void
+action_mail_stop_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ mail_cancel_all ();
+}
+
+static void
+action_mail_threads_collapse_all_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ MessageList *message_list;
+ EMailReader *reader;
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ message_list_set_threaded_collapse_all (message_list);
+}
+
+static void
+action_mail_threads_expand_all_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ MessageList *message_list;
+ EMailReader *reader;
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ message_list_set_threaded_expand_all (message_list);
+}
+
+static void
+action_mail_threads_group_by_cb (GtkToggleAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellContent *mail_shell_content;
+ MessageList *message_list;
+ EMailReader *reader;
+ gboolean active;
+
+ mail_shell_content = mail_shell_view->priv->mail_shell_content;
+ active = gtk_toggle_action_get_active (action);
+
+ reader = E_MAIL_READER (mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ message_list_set_threaded (message_list, active);
+}
+
+static void
+action_mail_tools_filters_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ em_utils_edit_filters (GTK_WIDGET (shell_window));
+}
+
+static void
+action_mail_tools_search_folders_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ vfolder_edit (E_SHELL_VIEW (mail_shell_view));
+}
+
+static void
+action_mail_tools_subscriptions_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ GtkWidget *dialog;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ dialog = em_subscribe_editor_new ();
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog), GTK_WINDOW (shell_window));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ /* XXX Dialog destroys itself. */
+}
+
+static void
+action_mail_view_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EMailShellView *mail_shell_view)
+{
+ EMailShellContent *mail_shell_content;
+ gboolean vertical_view;
+
+ mail_shell_content = mail_shell_view->priv->mail_shell_content;
+ vertical_view = (gtk_radio_action_get_current_value (action) == 1);
+
+ e_mail_shell_content_set_vertical_view (
+ mail_shell_content, vertical_view);
+}
+
+static void
+action_search_execute_cb (GtkAction *action,
+ EMailShellView *mail_shell_view)
+{
+ EShellView *shell_view;
+
+ /* All shell views respond to the activation of this action,
+ * which is defined by EShellWindow. But only the currently
+ * active shell view proceeds with executing the search. */
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ e_mail_shell_view_execute_search (mail_shell_view);
+}
+
+static void
+action_search_filter_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EMailShellView *mail_shell_view)
+{
+ e_mail_shell_view_execute_search (mail_shell_view);
+}
+
+static void
+action_search_scope_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EMailShellView *mail_shell_view)
+{
+ e_mail_shell_view_execute_search (mail_shell_view);
+}
+
+static GtkActionEntry mail_entries[] = {
+
+ { "mail-account-disable",
+ NULL,
+ N_("_Disable Account"),
+ NULL,
+ N_("Disable this account"),
+ G_CALLBACK (action_mail_account_disable_cb) },
+
+ { "mail-create-search-folder",
+ NULL,
+ N_("C_reate Search Folder From Search..."),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_mail_create_search_folder_cb) },
+
+ { "mail-download",
+ NULL,
+ N_("_Download Messages for Offline Usage"),
+ NULL,
+ N_("Download messages of accounts and folders marked for offline"),
+ G_CALLBACK (action_mail_download_cb) },
+
+ { "mail-empty-trash",
+ NULL,
+ N_("Empty _Trash"),
+ NULL,
+ N_("Permanently remove all the deleted messages from all folders"),
+ G_CALLBACK (action_mail_empty_trash_cb) },
+
+ { "mail-flush-outbox",
+ "mail-send",
+ N_("Fl_ush Outbox"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_mail_flush_outbox_cb) },
+
+ { "mail-folder-copy",
+ "folder-copy",
+ N_("_Copy Folder To..."),
+ NULL,
+ N_("Copy the selected folder into another folder"),
+ G_CALLBACK (action_mail_folder_copy_cb) },
+
+ { "mail-folder-delete",
+ GTK_STOCK_DELETE,
+ NULL,
+ NULL,
+ N_("Permanently remove this folder"),
+ G_CALLBACK (action_mail_folder_delete_cb) },
+
+ { "mail-folder-expunge",
+ NULL,
+ N_("E_xpunge"),
+ "<Control>e",
+ N_("Permanently remove all deleted messages from this folder"),
+ G_CALLBACK (action_mail_folder_expunge_cb) },
+
+ { "mail-folder-mark-all-as-read",
+ "mail-read",
+ N_("Mar_k All Messages as Read"),
+ NULL,
+ N_("Mark all messages in the folder as read"),
+ G_CALLBACK (action_mail_folder_mark_all_as_read_cb) },
+
+ { "mail-folder-move",
+ "folder-move",
+ N_("_Move Folder To..."),
+ NULL,
+ N_("Move the selected folder into another folder"),
+ G_CALLBACK (action_mail_folder_move_cb) },
+
+ { "mail-folder-new",
+ "folder-new",
+ N_("_New..."),
+ NULL,
+ N_("Create a new folder for storing mail"),
+ G_CALLBACK (action_mail_folder_new_cb) },
+
+ { "mail-folder-properties",
+ GTK_STOCK_PROPERTIES,
+ NULL,
+ NULL,
+ N_("Change the properties of this folder"),
+ G_CALLBACK (action_mail_folder_properties_cb) },
+
+ { "mail-folder-refresh",
+ GTK_STOCK_REFRESH,
+ NULL,
+ "F5",
+ N_("Refresh the folder"),
+ G_CALLBACK (action_mail_folder_refresh_cb) },
+
+ { "mail-folder-rename",
+ NULL,
+ N_("_Rename..."),
+ "F2",
+ N_("Change the name of this folder"),
+ G_CALLBACK (action_mail_folder_rename_cb) },
+
+ { "mail-folder-select-all",
+ NULL,
+ N_("Select _All Messages"),
+ "<Control>a",
+ N_("Select all visible messages"),
+ G_CALLBACK (action_mail_folder_select_all_cb) },
+
+ { "mail-folder-select-thread",
+ NULL,
+ N_("Select Message _Thread"),
+ "<Control>h",
+ N_("Select all messages in the same thread as the selected message"),
+ G_CALLBACK (action_mail_folder_select_thread_cb) },
+
+ { "mail-folder-select-subthread",
+ NULL,
+ N_("Select Message S_ubthread"),
+ "<Shift><Control>h",
+ N_("Select all replies to the currently selected message"),
+ G_CALLBACK (action_mail_folder_select_subthread_cb) },
+
+ { "mail-label-new",
+ NULL,
+ N_("_New Label"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_mail_label_new_cb) },
+
+ { "mail-label-none",
+ NULL,
+ N_("N_one"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_mail_label_none_cb) },
+
+ { "mail-hide-read",
+ NULL,
+ N_("Hide _Read Messages"),
+ NULL,
+ N_("Temporarily hide all messages that have already been read"),
+ G_CALLBACK (action_mail_hide_read_cb) },
+
+ { "mail-hide-selected",
+ NULL,
+ N_("Hide S_elected Messages"),
+ NULL,
+ N_("Temporarily hide the selected messages"),
+ G_CALLBACK (action_mail_hide_selected_cb) },
+
+ { "mail-show-hidden",
+ NULL,
+ N_("Show Hidde_n Messages"),
+ NULL,
+ N_("Show messages that have been temporarily hidden"),
+ G_CALLBACK (action_mail_show_hidden_cb) },
+
+ { "mail-smart-backward",
+ NULL,
+ NULL, /* No menu item; key press only */
+ NULL,
+ NULL,
+ G_CALLBACK (action_mail_smart_backward_cb) },
+
+ { "mail-smart-forward",
+ NULL,
+ NULL, /* No menu item; key press only */
+ NULL,
+ NULL,
+ G_CALLBACK (action_mail_smart_forward_cb) },
+
+ { "mail-stop",
+ GTK_STOCK_STOP,
+ N_("Cancel"),
+ NULL,
+ N_("Cancel the current mail operation"),
+ G_CALLBACK (action_mail_stop_cb) },
+
+ { "mail-threads-collapse-all",
+ NULL,
+ N_("Collapse All _Threads"),
+ "<Shift><Control>b",
+ N_("Collapse all message threads"),
+ G_CALLBACK (action_mail_threads_collapse_all_cb) },
+
+ { "mail-threads-expand-all",
+ NULL,
+ N_("E_xpand All Threads"),
+ NULL,
+ N_("Expand all message threads"),
+ G_CALLBACK (action_mail_threads_expand_all_cb) },
+
+ { "mail-tools-filters",
+ NULL,
+ N_("_Message Filters"),
+ NULL,
+ N_("Create or edit rules for filtering new mail"),
+ G_CALLBACK (action_mail_tools_filters_cb) },
+
+ { "mail-tools-search-folders",
+ NULL,
+ N_("Search F_olders"),
+ NULL,
+ N_("Create or edit search folder definitions"),
+ G_CALLBACK (action_mail_tools_search_folders_cb) },
+
+ { "mail-tools-subscriptions",
+ NULL,
+ N_("_Subscriptions..."),
+ NULL,
+ N_("Subscribe or unsubscribe to folders on remote servers"),
+ G_CALLBACK (action_mail_tools_subscriptions_cb) },
+
+ /*** Menus ***/
+
+ { "mail-folder-menu",
+ NULL,
+ N_("F_older"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "mail-label-menu",
+ NULL,
+ N_("_Label"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "mail-preview-menu",
+ NULL,
+ N_("_Preview"),
+ NULL,
+ NULL,
+ NULL }
+};
+
+static EPopupActionEntry mail_popup_entries[] = {
+
+ { "mail-popup-account-disable",
+ NULL,
+ "mail-account-disable" },
+
+ { "mail-popup-empty-trash",
+ NULL,
+ "mail-empty-trash" },
+
+ { "mail-popup-flush-outbox",
+ NULL,
+ "mail-flush-outbox" },
+
+ { "mail-popup-folder-copy",
+ NULL,
+ "mail-folder-copy" },
+
+ { "mail-popup-folder-delete",
+ NULL,
+ "mail-folder-delete" },
+
+ { "mail-popup-folder-move",
+ NULL,
+ "mail-folder-move" },
+
+ { "mail-popup-folder-new",
+ N_("_New Folder..."),
+ "mail-folder-new" },
+
+ { "mail-popup-folder-properties",
+ NULL,
+ "mail-folder-properties" },
+
+ { "mail-popup-folder-refresh",
+ NULL,
+ "mail-folder-refresh" },
+
+ { "mail-popup-folder-rename",
+ NULL,
+ "mail-folder-rename" }
+};
+
+static GtkToggleActionEntry mail_toggle_entries[] = {
+
+ { "mail-hide-deleted",
+ NULL,
+ N_("Hide _Deleted Messages"),
+ NULL,
+ N_("Hide deleted messages rather than displaying "
+ "them with a line through them"),
+ G_CALLBACK (action_mail_hide_deleted_cb),
+ TRUE },
+
+ { "mail-preview",
+ NULL,
+ N_("Show Message _Preview"),
+ "<Control>m",
+ N_("Show message preview pane"),
+ G_CALLBACK (action_mail_preview_cb),
+ TRUE },
+
+ { "mail-threads-group-by",
+ NULL,
+ N_("_Group By Threads"),
+ "<Control>t",
+ N_("Threaded message list"),
+ G_CALLBACK (action_mail_threads_group_by_cb),
+ FALSE }
+};
+
+static GtkRadioActionEntry mail_view_entries[] = {
+
+ /* This action represents the initial active mail view.
+ * It should not be visible in the UI, nor should it be
+ * possible to switch to it from another shell view. */
+ { "mail-view-internal",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ -1 },
+
+ { "mail-view-classic",
+ NULL,
+ N_("_Classic View"),
+ NULL,
+ N_("Show message preview below the message list"),
+ 0 },
+
+ { "mail-view-vertical",
+ NULL,
+ N_("_Vertical View"),
+ NULL,
+ N_("Show message preview alongside the message list"),
+ 1 }
+};
+
+static GtkRadioActionEntry mail_filter_entries[] = {
+
+ { "mail-filter-all-messages",
+ NULL,
+ N_("All Messages"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_ALL_MESSAGES },
+
+ { "mail-filter-important-messages",
+ "emblem-important",
+ N_("Important Messages"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_IMPORTANT_MESSAGES },
+
+ { "mail-filter-last-5-days-messages",
+ NULL,
+ N_("Last 5 Days' Messages"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_LAST_5_DAYS_MESSAGES },
+
+ { "mail-filter-messages-not-junk",
+ "mail-mark-notjunk",
+ N_("Messages Not Junk"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_MESSAGES_NOT_JUNK },
+
+ { "mail-filter-messages-with-attachments",
+ "mail-attachment",
+ N_("Messages with Attachments"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS },
+
+ { "mail-filter-no-label",
+ NULL,
+ N_("No Label"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_NO_LABEL },
+
+ { "mail-filter-read-messages",
+ "mail-read",
+ N_("Read Messages"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_READ_MESSAGES },
+
+ { "mail-filter-recent-messages",
+ NULL,
+ N_("Recent Messages"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_RECENT_MESSAGES },
+
+ { "mail-filter-unread-messages",
+ "mail-unread",
+ N_("Unread Messages"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_UNREAD_MESSAGES }
+};
+
+static GtkRadioActionEntry mail_search_entries[] = {
+
+ { "mail-search-body-contains",
+ NULL,
+ N_("Body contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_BODY_CONTAINS },
+
+ { "mail-search-message-contains",
+ NULL,
+ N_("Message contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_MESSAGE_CONTAINS },
+
+ { "mail-search-recipients-contain",
+ NULL,
+ N_("Recipients contain"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_RECIPIENTS_CONTAIN },
+
+ { "mail-search-sender-contains",
+ NULL,
+ N_("Sender contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_SENDER_CONTAINS },
+
+ { "mail-search-subject-contains",
+ NULL,
+ N_("Subject contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_SUBJECT_CONTAINS },
+
+ { "mail-search-subject-or-recipients-contains",
+ NULL,
+ N_("Subject or Recipients contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_SUBJECT_OR_RECIPIENTS_CONTAINS },
+
+ { "mail-search-subject-or-sender-contains",
+ NULL,
+ N_("Subject or Sender contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_SUBJECT_OR_SENDER_CONTAINS }
+};
+
+static GtkRadioActionEntry mail_scope_entries[] = {
+
+ { "mail-scope-all-accounts",
+ NULL,
+ N_("All Accounts"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SCOPE_ALL_ACCOUNTS },
+
+ { "mail-scope-current-account",
+ NULL,
+ N_("Current Account"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SCOPE_CURRENT_ACCOUNT },
+
+ { "mail-scope-current-folder",
+ NULL,
+ N_("Current Folder"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SCOPE_CURRENT_FOLDER },
+
+ { "mail-scope-current-message",
+ NULL,
+ N_("Current Message"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SCOPE_CURRENT_MESSAGE }
+};
+
+void
+e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellContent *shell_content;
+ GtkActionGroup *action_group;
+ GtkRadioAction *radio_action;
+ GConfBridge *bridge;
+ GObject *object;
+ GObject *src_object;
+ GObject *dst_object;
+ const gchar *key;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view));
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ /* Mail Actions */
+ action_group = ACTION_GROUP (MAIL);
+ gtk_action_group_add_actions (
+ action_group, mail_entries,
+ G_N_ELEMENTS (mail_entries), mail_shell_view);
+ e_action_group_add_popup_actions (
+ action_group, mail_popup_entries,
+ G_N_ELEMENTS (mail_popup_entries));
+ gtk_action_group_add_toggle_actions (
+ action_group, mail_toggle_entries,
+ G_N_ELEMENTS (mail_toggle_entries), mail_shell_view);
+ gtk_action_group_add_radio_actions (
+ action_group, mail_view_entries,
+ G_N_ELEMENTS (mail_view_entries), -1,
+ G_CALLBACK (action_mail_view_cb), mail_shell_view);
+ gtk_action_group_add_radio_actions (
+ action_group, mail_search_entries,
+ G_N_ELEMENTS (mail_search_entries),
+ MAIL_SEARCH_SUBJECT_OR_SENDER_CONTAINS,
+ NULL, NULL);
+ gtk_action_group_add_radio_actions (
+ action_group, mail_scope_entries,
+ G_N_ELEMENTS (mail_scope_entries),
+ MAIL_SCOPE_CURRENT_FOLDER,
+ G_CALLBACK (action_search_scope_cb), mail_shell_view);
+
+ radio_action = GTK_RADIO_ACTION (ACTION (MAIL_SCOPE_ALL_ACCOUNTS));
+ e_shell_content_set_scope_action (shell_content, radio_action);
+ e_shell_content_set_scope_visible (shell_content, TRUE);
+
+ /* Bind GObject properties for GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (ACTION (MAIL_PREVIEW));
+ key = "/apps/evolution/mail/display/show_preview";
+ gconf_bridge_bind_property (bridge, key, object, "active");
+
+ object = G_OBJECT (ACTION (MAIL_THREADS_GROUP_BY));
+ key = "/apps/evolution/mail/display/thread_list";
+ gconf_bridge_bind_property (bridge, key, object, "active");
+
+ object = G_OBJECT (ACTION (MAIL_VIEW_VERTICAL));
+ key = "/apps/evolution/mail/display/layout";
+ gconf_bridge_bind_property (bridge, key, object, "current-value");
+
+ /* Fine tuning. */
+
+ src_object = G_OBJECT (ACTION (MAIL_THREADS_GROUP_BY));
+
+ dst_object = G_OBJECT (ACTION (MAIL_FOLDER_SELECT_THREAD));
+ e_binding_new (src_object, "active", dst_object, "sensitive");
+
+ dst_object = G_OBJECT (ACTION (MAIL_FOLDER_SELECT_SUBTHREAD));
+ e_binding_new (src_object, "active", dst_object, "sensitive");
+
+ dst_object = G_OBJECT (ACTION (MAIL_THREADS_COLLAPSE_ALL));
+ e_binding_new (src_object, "active", dst_object, "sensitive");
+
+ dst_object = G_OBJECT (ACTION (MAIL_THREADS_EXPAND_ALL));
+ e_binding_new (src_object, "active", dst_object, "sensitive");
+
+ /* XXX The boolean sense of the GConf key is the inverse of
+ * the menu item, so we have to maintain two properties. */
+ e_mutual_binding_new_with_negation (
+ G_OBJECT (shell_content), "show-deleted",
+ G_OBJECT (ACTION (MAIL_HIDE_DELETED)), "active");
+
+ g_signal_connect (
+ ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
+ G_CALLBACK (action_gal_save_custom_view_cb), mail_shell_view);
+
+ g_signal_connect (
+ ACTION (SEARCH_EXECUTE), "activate",
+ G_CALLBACK (action_search_execute_cb), mail_shell_view);
+}
+
+/* Helper for e_mail_shell_view_update_popup_labels() */
+static void
+mail_shell_view_update_label_action (GtkToggleAction *action,
+ MessageList *message_list,
+ GPtrArray *uids,
+ const gchar *label_tag)
+{
+ CamelFolder *folder;
+ gboolean exists = FALSE;
+ gboolean not_exists = FALSE;
+ gboolean sensitive;
+ guint ii;
+
+ folder = message_list->folder;
+
+ /* Figure out the proper label action state for the selected
+ * messages. If all the selected messages have the given label,
+ * make the toggle action active. If all the selected message
+ * DO NOT have the given label, make the toggle action inactive.
+ * If some do and some don't, make the action insensitive. */
+
+ for (ii = 0; ii < uids->len && (!exists || !not_exists); ii++) {
+ const gchar *old_label;
+ gchar *new_label;
+
+ /* Check for new-style labels. */
+ if (camel_folder_get_message_user_flag (
+ folder, uids->pdata[ii], label_tag)) {
+ exists = TRUE;
+ continue;
+ }
+
+ /* Check for old-style labels. */
+ old_label = camel_folder_get_message_user_tag (
+ folder, uids->pdata[ii], "label");
+ if (old_label == NULL) {
+ not_exists = TRUE;
+ continue;
+ }
+
+ /* Convert old-style labels ("<name>") to "$Label<name>". */
+ new_label = g_alloca (strlen (old_label) + 10);
+ g_stpcpy (g_stpcpy (new_label, "$Label"), old_label);
+
+ if (strcmp (new_label, label_tag) == 0)
+ exists = TRUE;
+ else
+ not_exists = TRUE;
+ }
+
+ sensitive = !(exists && not_exists);
+ gtk_toggle_action_set_active (action, exists);
+ gtk_action_set_sensitive (GTK_ACTION (action), sensitive);
+}
+
+void
+e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view)
+{
+ EShell *shell;
+ EShellSettings *shell_settings;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ EMailReader *reader;
+ MessageList *message_list;
+ GtkUIManager *ui_manager;
+ GtkActionGroup *action_group;
+ GtkTreeModel *tree_model;
+ GtkTreeIter iter;
+ GPtrArray *uids;
+ const gchar *path;
+ gboolean valid;
+ guint merge_id;
+ gint ii = 0;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view));
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ tree_model = e_shell_settings_get_object (
+ shell_settings, "mail-label-list-store");
+
+ action_group = ACTION_GROUP (MAIL_LABEL);
+ merge_id = mail_shell_view->priv->label_merge_id;
+ path = "/mail-message-popup/mail-label-menu/mail-label-actions";
+
+ /* Unmerge the previous menu items. */
+ gtk_ui_manager_remove_ui (ui_manager, merge_id);
+ e_action_group_remove_all_actions (action_group);
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+ uids = message_list_get_selected (message_list);
+
+ valid = gtk_tree_model_get_iter_first (tree_model, &iter);
+
+ while (valid) {
+ GtkToggleAction *toggle_action;
+ GtkAction *action;
+ gchar *action_name;
+ gchar *stock_id;
+ gchar *label;
+ gchar *tag;
+
+ label = e_mail_label_list_store_get_name (
+ E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+ stock_id = e_mail_label_list_store_get_stock_id (
+ E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+ tag = e_mail_label_list_store_get_tag (
+ E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+ action_name = g_strdup_printf ("mail-label-%d", ii);
+
+ /* XXX Add a tooltip! */
+ toggle_action = gtk_toggle_action_new (
+ action_name, label, NULL, stock_id);
+
+ g_object_set_data_full (
+ G_OBJECT (toggle_action), "tag",
+ tag, (GDestroyNotify) g_free);
+
+ /* Configure the action before we connect to signals. */
+ mail_shell_view_update_label_action (
+ toggle_action, message_list, uids, tag);
+
+ g_signal_connect (
+ toggle_action, "toggled",
+ G_CALLBACK (action_mail_label_cb), mail_shell_view);
+
+ /* The action group takes ownership of the action. */
+ action = GTK_ACTION (toggle_action);
+ gtk_action_group_add_action (action_group, action);
+ g_object_unref (toggle_action);
+
+ gtk_ui_manager_add_ui (
+ ui_manager, merge_id, path, action_name,
+ action_name, GTK_UI_MANAGER_AUTO, FALSE);
+
+ g_free (label);
+ g_free (stock_id);
+ g_free (action_name);
+
+ valid = gtk_tree_model_iter_next (tree_model, &iter);
+ ii++;
+ }
+
+ message_list_free_uids (message_list, uids);
+
+ g_object_unref (tree_model);
+}
+
+void
+e_mail_shell_view_update_search_filter (EMailShellView *mail_shell_view)
+{
+ EShell *shell;
+ EShellContent *shell_content;
+ EShellSettings *shell_settings;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ GtkActionGroup *action_group;
+ GtkRadioAction *radio_action;
+ GtkTreeModel *tree_model;
+ GtkTreeIter iter;
+ GList *list;
+ GSList *group;
+ gboolean valid;
+ gint ii = 0;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view));
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ tree_model = e_shell_settings_get_object (
+ shell_settings, "mail-label-list-store");
+
+ action_group = ACTION_GROUP (MAIL_FILTER);
+ e_action_group_remove_all_actions (action_group);
+
+ /* Add the standard filter actions. */
+ gtk_action_group_add_radio_actions (
+ action_group, mail_filter_entries,
+ G_N_ELEMENTS (mail_filter_entries),
+ MAIL_FILTER_ALL_MESSAGES,
+ G_CALLBACK (action_search_filter_cb),
+ mail_shell_view);
+
+ /* Retrieve the radio group from an action we just added. */
+ list = gtk_action_group_list_actions (action_group);
+ radio_action = GTK_RADIO_ACTION (list->data);
+ group = gtk_radio_action_get_group (radio_action);
+ g_list_free (list);
+
+ valid = gtk_tree_model_get_iter_first (tree_model, &iter);
+
+ while (valid) {
+ GtkAction *action;
+ gchar *action_name;
+ gchar *stock_id;
+ gchar *label;
+
+ label = e_mail_label_list_store_get_name (
+ E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+ stock_id = e_mail_label_list_store_get_stock_id (
+ E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+
+ action_name = g_strdup_printf ("mail-filter-label-%d", ii);
+ radio_action = gtk_radio_action_new (
+ action_name, label, NULL, stock_id, ii);
+ g_free (action_name);
+
+ gtk_radio_action_set_group (radio_action, group);
+ group = gtk_radio_action_get_group (radio_action);
+
+ /* The action group takes ownership of the action. */
+ action = GTK_ACTION (radio_action);
+ gtk_action_group_add_action (action_group, action);
+ g_object_unref (radio_action);
+
+ g_free (label);
+ g_free (stock_id);
+
+ valid = gtk_tree_model_iter_next (tree_model, &iter);
+ ii++;
+ }
+
+ /* Use any action in the group; doesn't matter which. */
+ e_shell_content_set_filter_action (shell_content, radio_action);
+
+ ii = MAIL_FILTER_UNREAD_MESSAGES;
+ e_shell_content_add_filter_separator_after (shell_content, ii);
+
+ ii = MAIL_FILTER_READ_MESSAGES;
+ e_shell_content_add_filter_separator_before (shell_content, ii);
+
+ g_object_unref (tree_model);
+}
diff --git a/mail/e-mail-shell-view-actions.h b/mail/e-mail-shell-view-actions.h
new file mode 100644
index 0000000000..2a05582df8
--- /dev/null
+++ b/mail/e-mail-shell-view-actions.h
@@ -0,0 +1,257 @@
+/*
+ * e-mail-shell-view-actions.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_SHELL_VIEW_ACTIONS_H
+#define E_MAIL_SHELL_VIEW_ACTIONS_H
+
+#include <shell/e-shell-window-actions.h>
+
+/* Mail Actions */
+#define E_SHELL_WINDOW_ACTION_MAIL_ACCOUNT_DISABLE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-account-disable")
+#define E_SHELL_WINDOW_ACTION_MAIL_ADD_SENDER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-add-sender")
+#define E_SHELL_WINDOW_ACTION_MAIL_CARET_MODE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-caret-mode")
+#define E_SHELL_WINDOW_ACTION_MAIL_CHECK_FOR_JUNK(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-check-for-junk")
+#define E_SHELL_WINDOW_ACTION_MAIL_CLIPBOARD_COPY(window) \
+ E_SHELL_WINDOw_ACTION ((window), "mail-clipboard-copy")
+#define E_SHELL_WINDOW_ACTION_MAIL_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-copy")
+#define E_SHELL_WINDOW_ACTION_MAIL_CREATE_SEARCH_FOLDER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-create-search-folder")
+#define E_SHELL_WINDOW_ACTION_MAIL_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-delete")
+#define E_SHELL_WINDOW_ACTION_MAIL_DOWNLOAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-download")
+#define E_SHELL_WINDOW_ACTION_MAIL_EMPTY_TRASH(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-empty-trash")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_MAILING_LIST(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-mailing-list")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_RECIPIENTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-recipients")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_SENDER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-sender")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_SUBJECT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-subject")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTERS_APPLY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filters-apply")
+#define E_SHELL_WINDOW_ACTION_MAIL_FIND(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-find")
+#define E_SHELL_WINDOW_ACTION_MAIL_FLAG_CLEAR(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-flag-clear")
+#define E_SHELL_WINDOW_ACTION_MAIL_FLAG_COMPLETED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-flag-completed")
+#define E_SHELL_WINDOW_ACTION_MAIL_FLAG_FOR_FOLLOWUP(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-flag-for-followup")
+#define E_SHELL_WINDOW_ACTION_MAIL_FLUSH_OUTBOX(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-flush-outbox")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-copy")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-delete")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_EXPUNGE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-expunge")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_MARK_ALL_READ(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-mark-all-read")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_MOVE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-move")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-new")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_PROPERTIES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-properties")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_REFRESH(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-refresh")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_RENAME(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-rename")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_ALL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_THREAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-thread")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_SUBTHREAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-subthread")
+#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-forward")
+#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_ATTACHED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-forward-attached")
+#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_INLINE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-forward-inline")
+#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_QUOTED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-forward-quoted")
+#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_DELETED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-hide-deleted")
+#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_READ(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-hide-read")
+#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_SELECTED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-hide-selected")
+#define E_SHELL_WINDOW_ACTION_MAIL_LABEL_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-label-new")
+#define E_SHELL_WINDOW_ACTION_MAIL_LABEL_NONE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-label-none")
+#define E_SHELL_WINDOW_ACTION_MAIL_LOAD_IMAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-load-images")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_IMPORTANT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-mark-important")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_JUNK(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-mark-junk")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_NOTJUNK(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-mark-notjunk")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_READ(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-mark-read")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_UNIMPORTANT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-mark-unimportant")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_UNREAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-mark-unread")
+#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_EDIT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-message-edit")
+#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-message-new")
+#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_OPEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-message-open")
+#define E_SHELL_WINDOW_ACTION_MAIL_MOVE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-move")
+#define E_SHELL_WINDOW_ACTION_MAIL_NEXT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-next")
+#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_IMPORTANT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-next-important")
+#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_THREAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-next-thread")
+#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_UNREAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-next-unread")
+#define E_SHELL_WINDOW_ACTION_MAIL_PREVIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-preview")
+#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-previous")
+#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS_IMPORTANT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-previous-important")
+#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS_UNREAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-previous-unread")
+#define E_SHELL_WINDOW_ACTION_MAIL_PRINT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-print")
+#define E_SHELL_WINDOW_ACTION_MAIL_PRINT_PREVIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-print-preview")
+#define E_SHELL_WINDOW_ACTION_MAIL_REDIRECT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-redirect")
+#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_ALL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-reply-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_LIST(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-reply-list")
+#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_SENDER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-reply-sender")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_MAILING_LIST(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-mailing-list")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_RECIPIENTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-recipients")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_SENDER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-sender")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_SUBJECT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-subject")
+#define E_SHELL_WINDOW_ACTION_MAIL_SELECT_ALL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-select-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_ALL_HEADERS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-show-all-headers")
+#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_HIDDEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-show-hidden")
+#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_SOURCE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-show-source")
+#define E_SHELL_WINDOW_ACTION_MAIL_SMART_BACKWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-smart-backward")
+#define E_SHELL_WINDOW_ACTION_MAIL_SMART_FORWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-smart-forward")
+#define E_SHELL_WINDOW_ACTION_MAIL_STOP(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-stop")
+#define E_SHELL_WINDOW_ACTION_MAIL_THREADS_COLLAPSE_ALL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-threads-collapse-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_THREADS_EXPAND_ALL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-threads-expand-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_THREADS_GROUP_BY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-threads-group-by")
+#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_FILTERS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-tools-filters")
+#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_SEARCH_FOLDERS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-tools-search-folders")
+#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_SUBSCRIPTIONS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-tools-subscriptions")
+#define E_SHELL_WINDOW_ACTION_MAIL_UNDELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-undelete")
+#define E_SHELL_WINDOW_ACTION_MAIL_VIEW_CLASSIC(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-view-classic")
+#define E_SHELL_WINDOW_ACTION_MAIL_VIEW_VERTICAL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-view-vertical")
+#define E_SHELL_WINDOW_ACTION_MAIL_ZOOM_100(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-zoom-100")
+#define E_SHELL_WINDOW_ACTION_MAIL_ZOOM_IN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-zoom-in")
+#define E_SHELL_WINDOW_ACTION_MAIL_ZOOM_OUT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-zoom-out")
+
+/* Mail Query Actions */
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ALL_MESSAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-all-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_IMPORTANT_MESSAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-important-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_LAST_5_DAYS_MESSAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-last-5-days-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_MESSAGES_NOT_JUNK(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-messages-not-junk")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-messages-with-attachments")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_NO_LABEL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-no-label")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_READ_MESSAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-read-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_RECENT_MESSAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-recent-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_UNREAD_MESSAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-unread-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_ALL_ACCOUNTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-scope-all-accounts")
+#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_CURRENT_ACCOUNT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-scope-current-account")
+#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_CURRENT_FOLDER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-scope-current-folder")
+#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_CURRENT_MESSAGE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-scope-current-message")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_BODY_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-body-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_MESSAGE_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-message-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_RECIPIENTS_CONTAIN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-recipients-contain")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SENDER_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-sender-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SUBJECT_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-subject-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SUBJECT_OR_RECIPIENTS_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-subject-or-recipients-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SUBJECT_OR_SENDER_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-subject-or-sender-contains")
+
+/* Action Groups */
+#define E_SHELL_WINDOW_ACTION_GROUP_MAIL(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "mail")
+#define E_SHELL_WINDOW_ACTION_GROUP_MAIL_FILTER(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "mail-filter")
+#define E_SHELL_WINDOW_ACTION_GROUP_MAIL_LABEL(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "mail-label")
+
+#endif /* E_MAIL_SHELL_VIEW_ACTIONS_H */
diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c
new file mode 100644
index 0000000000..9026c8ed60
--- /dev/null
+++ b/mail/e-mail-shell-view-private.c
@@ -0,0 +1,898 @@
+/*
+ * e-mail-shell-view-private.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-shell-view-private.h"
+
+#include "widgets/menus/gal-view-factory-etable.h"
+
+static void
+mail_shell_view_folder_tree_selected_cb (EMailShellView *mail_shell_view,
+ const gchar *full_name,
+ const gchar *uri,
+ guint32 flags,
+ EMFolderTree *folder_tree)
+{
+ EMailReader *reader;
+ gboolean folder_selected;
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+
+ folder_selected =
+ !(flags & CAMEL_FOLDER_NOSELECT) &&
+ full_name != NULL;
+
+ if (folder_selected) {
+ EMFolderTreeModel *model;
+
+ model = em_folder_tree_get_model (folder_tree);
+ em_folder_tree_model_set_selected (model, uri);
+ em_folder_tree_model_save_state (model);
+
+ e_mail_reader_set_folder_uri (reader, uri);
+ } else
+ e_mail_reader_set_folder (reader, NULL, NULL);
+
+ e_shell_view_update_actions (E_SHELL_VIEW (mail_shell_view));
+}
+
+static void
+mail_shell_view_folder_tree_popup_event_cb (EShellView *shell_view,
+ GdkEventButton *event)
+{
+ const gchar *widget_path;
+
+ widget_path = "/mail-folder-popup";
+ e_shell_view_show_popup_menu (shell_view, widget_path, event);
+}
+
+static gboolean
+mail_shell_view_key_press_event_cb (EMailShellView *mail_shell_view,
+ GdkEventKey *event)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkAction *action;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ if ((event->state & GDK_CONTROL_MASK) != 0)
+ return FALSE;
+
+ switch (event->keyval) {
+ case GDK_space:
+ action = ACTION (MAIL_SMART_FORWARD);
+ break;
+
+ case GDK_BackSpace:
+ action = ACTION (MAIL_SMART_BACKWARD);
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ gtk_action_activate (action);
+
+ return TRUE;
+}
+
+static gint
+mail_shell_view_message_list_key_press_cb (EMailShellView *mail_shell_view,
+ gint row,
+ ETreePath path,
+ gint col,
+ GdkEvent *event)
+{
+ return mail_shell_view_key_press_event_cb (
+ mail_shell_view, &event->key);
+}
+
+static gboolean
+mail_shell_view_message_list_right_click_cb (EShellView *shell_view,
+ gint row,
+ ETreePath path,
+ gint col,
+ GdkEventButton *event)
+{
+ const gchar *widget_path;
+
+ widget_path = "/mail-message-popup";
+ e_shell_view_show_popup_menu (shell_view, widget_path, event);
+
+ return TRUE;
+}
+
+static void
+mail_shell_view_reader_changed_cb (EMailShellView *mail_shell_view)
+{
+ EMailShellContent *mail_shell_content;
+
+ mail_shell_content = mail_shell_view->priv->mail_shell_content;
+ e_mail_shell_content_update_view_instance (mail_shell_content);
+ e_mail_shell_view_update_sidebar (mail_shell_view);
+}
+
+static void
+mail_shell_view_reader_status_message_cb (EMailShellView *mail_shell_view,
+ const gchar *status_message)
+{
+ EShellView *shell_view;
+ EShellTaskbar *shell_taskbar;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_taskbar = e_shell_view_get_shell_taskbar (shell_view);
+
+ e_shell_taskbar_set_message (shell_taskbar, status_message);
+}
+
+static void
+mail_shell_view_load_view_collection (EShellViewClass *shell_view_class)
+{
+ GalViewCollection *collection;
+ GalViewFactory *factory;
+ ETableSpecification *spec;
+ const gchar *base_dir;
+ gchar *filename;
+
+ collection = shell_view_class->view_collection;
+
+ base_dir = EVOLUTION_ETSPECDIR;
+ spec = e_table_specification_new ();
+ filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
+ if (!e_table_specification_load_from_file (spec, filename))
+ g_critical ("Unable to load ETable specification file "
+ "for mail");
+ g_free (filename);
+
+ factory = gal_view_factory_etable_new (spec);
+ gal_view_collection_add_factory (collection, factory);
+ g_object_unref (factory);
+ g_object_unref (spec);
+
+ gal_view_collection_load (collection);
+}
+
+static void
+mail_shell_view_notify_view_id_cb (EMailShellView *mail_shell_view)
+{
+ EMailShellContent *mail_shell_content;
+ GalViewInstance *view_instance;
+ const gchar *view_id;
+
+ mail_shell_content = mail_shell_view->priv->mail_shell_content;
+ view_instance = NULL; /* FIXME */
+ view_id = e_shell_view_get_view_id (E_SHELL_VIEW (mail_shell_view));
+
+ /* A NULL view ID implies we're in a custom view. But you can
+ * only get to a custom view via the "Define Views" dialog, which
+ * would have already modified the view instance appropriately.
+ * Furthermore, there's no way to refer to a custom view by ID
+ * anyway, since custom views have no IDs. */
+ if (view_id == NULL)
+ return;
+
+ gal_view_instance_set_current_view_id (view_instance, view_id);
+}
+
+void
+e_mail_shell_view_private_init (EMailShellView *mail_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ if (!gal_view_collection_loaded (shell_view_class->view_collection))
+ mail_shell_view_load_view_collection (shell_view_class);
+
+ g_signal_connect (
+ mail_shell_view, "notify::view-id",
+ G_CALLBACK (mail_shell_view_notify_view_id_cb), NULL);
+}
+
+void
+e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
+{
+ EMailShellViewPrivate *priv = mail_shell_view->priv;
+ EMailShellSidebar *mail_shell_sidebar;
+ EShell *shell;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ EShellContent *shell_content;
+ EShellSettings *shell_settings;
+ EShellSidebar *shell_sidebar;
+ EShellWindow *shell_window;
+ EMFormatHTMLDisplay *html_display;
+ EMFolderTreeModel *folder_tree_model;
+ EMFolderTree *folder_tree;
+ RuleContext *context;
+ FilterRule *rule = NULL;
+ GtkTreeModel *tree_model;
+ GtkUIManager *ui_manager;
+ MessageList *message_list;
+ EMailReader *reader;
+ GtkHTML *html;
+ const gchar *source;
+ guint merge_id;
+ gchar *uri;
+ gint ii = 0;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ tree_model = e_shell_settings_get_object (
+ shell_settings, "mail-label-list-store");
+
+ e_shell_window_add_action_group (shell_window, "mail");
+ e_shell_window_add_action_group (shell_window, "mail-filter");
+ e_shell_window_add_action_group (shell_window, "mail-label");
+
+ merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ priv->label_merge_id = merge_id;
+
+ /* Cache these to avoid lots of awkward casting. */
+ priv->mail_shell_backend = g_object_ref (shell_backend);
+ priv->mail_shell_content = g_object_ref (shell_content);
+ priv->mail_shell_sidebar = g_object_ref (shell_sidebar);
+
+ reader = E_MAIL_READER (shell_content);
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+ html = EM_FORMAT_HTML (html_display)->html;
+
+ g_signal_connect_swapped (
+ folder_tree, "folder-selected",
+ G_CALLBACK (mail_shell_view_folder_tree_selected_cb),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ folder_tree, "popup-event",
+ G_CALLBACK (mail_shell_view_folder_tree_popup_event_cb),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ message_list->tree, "key-press",
+ G_CALLBACK (mail_shell_view_message_list_key_press_cb),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ message_list->tree, "right-click",
+ G_CALLBACK (mail_shell_view_message_list_right_click_cb),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ reader, "changed",
+ G_CALLBACK (mail_shell_view_reader_changed_cb),
+ mail_shell_view);
+
+ /* Use the same callback as "changed". */
+ g_signal_connect_swapped (
+ reader, "folder-loaded",
+ G_CALLBACK (mail_shell_view_reader_changed_cb),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ tree_model, "row-changed",
+ G_CALLBACK (e_mail_shell_view_update_search_filter),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ tree_model, "row-deleted",
+ G_CALLBACK (e_mail_shell_view_update_search_filter),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ tree_model, "row-inserted",
+ G_CALLBACK (e_mail_shell_view_update_search_filter),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ html, "key-press-event",
+ G_CALLBACK (mail_shell_view_key_press_event_cb),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ html, "status-message",
+ G_CALLBACK (mail_shell_view_reader_status_message_cb),
+ mail_shell_view);
+
+ e_mail_shell_view_actions_init (mail_shell_view);
+ e_mail_shell_view_update_search_filter (mail_shell_view);
+ e_mail_reader_init (reader);
+
+ /* Populate built-in rules for search entry popup menu.
+ * Keep the assertions, please. If the conditions aren't
+ * met we're going to crash anyway, just more mysteriously. */
+ context = e_shell_content_get_search_context (shell_content);
+ source = FILTER_SOURCE_DEMAND;
+ while ((rule = rule_context_next_rule (context, rule, source))) {
+ g_assert (ii < MAIL_NUM_SEARCH_RULES);
+ priv->search_rules[ii++] = g_object_ref (rule);
+ }
+ g_assert (ii == MAIL_NUM_SEARCH_RULES);
+
+ /* Restore the previously selected folder. */
+ folder_tree_model = em_folder_tree_get_model (folder_tree);
+ uri = em_folder_tree_model_get_selected (folder_tree_model);
+ if (uri != NULL) {
+ gboolean expanded;
+
+ expanded = em_folder_tree_model_get_expanded_uri (
+ folder_tree_model, uri);
+ em_folder_tree_set_selected (folder_tree, uri, FALSE);
+ e_mail_reader_set_folder_uri (reader, uri);
+
+ if (!expanded)
+ em_folder_tree_model_set_expanded_uri (
+ folder_tree_model, uri, expanded);
+
+ g_free (uri);
+ }
+}
+
+void
+e_mail_shell_view_private_dispose (EMailShellView *mail_shell_view)
+{
+ EMailShellViewPrivate *priv = mail_shell_view->priv;
+ gint ii;
+
+ DISPOSE (priv->mail_shell_backend);
+ DISPOSE (priv->mail_shell_content);
+ DISPOSE (priv->mail_shell_sidebar);
+
+ for (ii = 0; ii < MAIL_NUM_SEARCH_RULES; ii++)
+ DISPOSE (priv->search_rules[ii]);
+}
+
+void
+e_mail_shell_view_private_finalize (EMailShellView *mail_shell_view)
+{
+ /* XXX Nothing to do? */
+}
+
+void
+e_mail_shell_view_execute_search (EMailShellView *mail_shell_view)
+{
+ EShell *shell;
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellContent *shell_content;
+ EShellSettings *shell_settings;
+ EMFormatHTMLDisplay *html_display;
+ EMailShellContent *mail_shell_content;
+ MessageList *message_list;
+ FilterRule *rule;
+ EMailReader *reader;
+ CamelFolder *folder;
+ GtkAction *action;
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeIter tree_iter;
+ GString *string;
+ GList *iter;
+ GSList *search_strings = NULL;
+ const gchar *folder_uri;
+ const gchar *text;
+ gboolean valid;
+ gchar *query;
+ gchar *temp;
+ gchar *tag;
+ gint value;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view));
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ mail_shell_content = mail_shell_view->priv->mail_shell_content;
+
+ reader = E_MAIL_READER (shell_content);
+ html_display = e_mail_reader_get_html_display (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ folder_uri = message_list->folder_uri;
+ folder = message_list->folder;
+
+ /* This returns a new object reference. */
+ model = e_shell_settings_get_object (
+ shell_settings, "mail-label-list-store");
+
+ text = e_shell_content_get_search_text (shell_content);
+ if (text == NULL || *text == '\0') {
+ query = g_strdup ("");
+ goto filter;
+ }
+
+ /* Replace variables in the selected rule with the
+ * current search text and extract a query string. */
+
+ action = ACTION (MAIL_SEARCH_SUBJECT_OR_SENDER_CONTAINS);
+ value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
+ g_return_if_fail (value >= 0 && value < MAIL_NUM_SEARCH_RULES);
+ rule = mail_shell_view->priv->search_rules[value];
+
+ for (iter = rule->parts; iter != NULL; iter = iter->next) {
+ FilterPart *part = iter->data;
+ FilterElement *element = NULL;
+
+ if (strcmp (part->name, "subject") == 0)
+ element = filter_part_find_element (part, "subject");
+ else if (strcmp (part->name, "body") == 0)
+ element = filter_part_find_element (part, "word");
+ else if (strcmp (part->name, "sender") == 0)
+ element = filter_part_find_element (part, "sender");
+ else if (strcmp (part->name, "to") == 0)
+ element = filter_part_find_element (part, "recipient");
+
+ if (strcmp (part->name, "body") == 0) {
+ struct _camel_search_words *words;
+ gint ii;
+
+ words = camel_search_words_split ((guchar *) text);
+ for (ii = 0; ii < words->len; ii++)
+ search_strings = g_slist_prepend (
+ search_strings, g_strdup (
+ words->words[ii]->word));
+ camel_search_words_free (words);
+ }
+
+ if (element != NULL) {
+ FilterInput *input = FILTER_INPUT (element);
+ filter_input_set_value (input, text);
+ }
+ }
+
+ string = g_string_sized_new (1024);
+ filter_rule_build_code (rule, string);
+ query = g_string_free (string, FALSE);
+
+filter:
+
+ /* Apply selected filter. */
+
+ value = e_shell_content_get_filter_value (shell_content);
+ switch (value) {
+ case MAIL_FILTER_ALL_MESSAGES:
+ break;
+
+ case MAIL_FILTER_UNREAD_MESSAGES:
+ temp = g_strdup_printf (
+ "(and %s (match-all (not "
+ "(system-flag \"Seen\"))))", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case MAIL_FILTER_NO_LABEL:
+ string = g_string_sized_new (1024);
+ g_string_append_printf (
+ string, "(and %s (and ", query);
+ valid = gtk_tree_model_get_iter_first (
+ model, &tree_iter);
+ while (valid) {
+ tag = e_mail_label_list_store_get_tag (
+ E_MAIL_LABEL_LIST_STORE (model),
+ &tree_iter);
+ g_string_append_printf (
+ string, " (match-all (not (or "
+ "(= (user-tag \"label\") \"%s\") "
+ "(user-flag \"$Label%s\") "
+ "(user-flag \"%s\"))))",
+ tag, tag, tag);
+ g_free (tag);
+
+ valid = gtk_tree_model_iter_next (
+ model, &tree_iter);
+ }
+ g_string_append_len (string, "))", 2);
+ g_free (query);
+ query = g_string_free (string, FALSE);
+ break;
+
+ case MAIL_FILTER_READ_MESSAGES:
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(system-flag \"Seen\")))", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case MAIL_FILTER_RECENT_MESSAGES:
+ if (em_utils_folder_is_sent (folder, folder_uri))
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(> (get-sent-date) "
+ "(- (get-current-date) 86400))))",
+ query);
+ else
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(> (get-received-date) "
+ "(- (get_current_date) 86400))))",
+ query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case MAIL_FILTER_LAST_5_DAYS_MESSAGES:
+ if (em_utils_folder_is_sent (folder, folder_uri))
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(> (get-sent-date) "
+ "(- (get-current-date) 432000))))",
+ query);
+ else
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(> (get-received-date) "
+ "(- (get_current_date) 432000))))",
+ query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS:
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(system-flag \"Attachments\")))", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case MAIL_FILTER_IMPORTANT_MESSAGES:
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(system-flag \"Flagged\")))", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case MAIL_FILTER_MESSAGES_NOT_JUNK:
+ temp = g_strdup_printf (
+ "(and %s (match-all (not "
+ "(system-flag \"junk\"))))", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ default:
+ /* The action value also serves as a path for
+ * the label list store. That's why we number
+ * the label actions from zero. */
+ path = gtk_tree_path_new_from_indices (value, -1);
+ gtk_tree_model_get_iter (model, &tree_iter, path);
+ gtk_tree_path_free (path);
+
+ tag = e_mail_label_list_store_get_tag (
+ E_MAIL_LABEL_LIST_STORE (model), &tree_iter);
+ temp = g_strdup_printf (
+ "(and %s (match-all (or "
+ "(= (user-tag \"label\") \"%s\") "
+ "(user-flag \"$Label%s\") "
+ "(user-flag \"%s\"))))",
+ query, tag, tag, tag);
+ g_free (tag);
+
+ g_free (query);
+ query = temp;
+ break;
+ }
+
+ message_list_set_search (message_list, query);
+
+ e_mail_shell_content_set_search_strings (
+ mail_shell_content, search_strings);
+
+ g_slist_foreach (search_strings, (GFunc) g_free, NULL);
+ g_slist_free (search_strings);
+
+ g_object_unref (model);
+ g_free (query);
+}
+
+/* Helper for e_mail_shell_view_create_filter_from_selected() */
+static void
+mail_shell_view_create_filter_cb (CamelFolder *folder,
+ const gchar *uid,
+ CamelMimeMessage *message,
+ gpointer user_data)
+{
+ struct {
+ const gchar *source;
+ gint type;
+ } *filter_data = user_data;
+
+ if (message != NULL)
+ filter_gui_add_from_message (
+ message, filter_data->source, filter_data->type);
+
+ g_free (filter_data);
+}
+
+void
+e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view,
+ gint filter_type)
+{
+ EMailReader *reader;
+ MessageList *message_list;
+ CamelFolder *folder;
+ const gchar *filter_source;
+ const gchar *folder_uri;
+ GPtrArray *uids;
+
+ struct {
+ const gchar *source;
+ gint type;
+ } *filter_data;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view));
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+ folder_uri = message_list->folder_uri;
+ folder = message_list->folder;
+
+ if (em_utils_folder_is_sent (folder, folder_uri))
+ filter_source = FILTER_SOURCE_OUTGOING;
+ else if (em_utils_folder_is_outbox (folder, folder_uri))
+ filter_source = FILTER_SOURCE_OUTGOING;
+ else
+ filter_source = FILTER_SOURCE_INCOMING;
+
+ uids = message_list_get_selected (message_list);
+
+ if (uids->len == 1) {
+ filter_data = g_malloc (sizeof (*filter_data));
+ filter_data->source = filter_source;
+ filter_data->type = filter_type;
+
+ mail_get_message (
+ folder, uids->pdata[0],
+ mail_shell_view_create_filter_cb,
+ filter_data, mail_msg_unordered_push);
+ }
+
+ em_utils_uids_free (uids);
+}
+
+/* Helper for e_mail_shell_view_create_vfolder_from_selected() */
+static void
+mail_shell_view_create_vfolder_cb (CamelFolder *folder,
+ const gchar *uid,
+ CamelMimeMessage *message,
+ gpointer user_data)
+{
+ struct {
+ gchar *uri;
+ gint type;
+ } *vfolder_data = user_data;
+
+ if (message != NULL)
+ vfolder_gui_add_from_message (
+ message, vfolder_data->type, vfolder_data->uri);
+
+ g_free (vfolder_data->uri);
+ g_free (vfolder_data);
+}
+
+void
+e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view,
+ gint vfolder_type)
+{
+ EMailReader *reader;
+ MessageList *message_list;
+ CamelFolder *folder;
+ const gchar *folder_uri;
+ GPtrArray *uids;
+
+ struct {
+ gchar *uri;
+ gint type;
+ } *vfolder_data;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view));
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+ folder_uri = message_list->folder_uri;
+ folder = message_list->folder;
+
+ uids = message_list_get_selected (message_list);
+
+ if (uids->len == 1) {
+ vfolder_data = g_malloc (sizeof (*vfolder_data));
+ vfolder_data->uri = g_strdup (folder_uri);
+ vfolder_data->type = vfolder_type;
+
+ mail_get_message (
+ folder, uids->pdata[0],
+ mail_shell_view_create_vfolder_cb,
+ vfolder_data, mail_msg_unordered_push);
+ }
+
+ em_utils_uids_free (uids);
+}
+
+void
+e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
+{
+ EMailShellBackend *mail_shell_backend;
+ EMailShellContent *mail_shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellView *shell_view;
+ EMailReader *reader;
+ MessageList *message_list;
+ CamelStore *local_store;
+ CamelFolder *folder;
+ GPtrArray *selected;
+ GString *buffer;
+ const gchar *display_name;
+ const gchar *folder_uri;
+ gchar *folder_name;
+ gchar *title;
+ guint32 num_deleted;
+ guint32 num_junked;
+ guint32 num_junked_not_deleted;
+ guint32 num_unread;
+ guint32 num_visible;
+
+ g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view));
+
+ mail_shell_backend = mail_shell_view->priv->mail_shell_backend;
+ mail_shell_content = mail_shell_view->priv->mail_shell_content;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ reader = E_MAIL_READER (mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+ folder_uri = message_list->folder_uri;
+ folder = message_list->folder;
+
+ local_store = e_mail_shell_backend_get_local_store (mail_shell_backend);
+
+ /* If no folder is selected, reset the sidebar banners
+ * to their default values and stop. */
+ if (folder == NULL) {
+ GtkAction *action;
+ gchar *label;
+
+ action = e_shell_view_get_action (shell_view);
+
+ g_object_get (action, "label", &label, NULL);
+ e_shell_sidebar_set_secondary_text (shell_sidebar, NULL);
+ e_shell_view_set_title (shell_view, label);
+ g_free (label);
+
+ return;
+ }
+
+ camel_object_get (
+ folder, NULL,
+ CAMEL_FOLDER_NAME, &folder_name,
+ CAMEL_FOLDER_DELETED, &num_deleted,
+ CAMEL_FOLDER_JUNKED, &num_junked,
+ CAMEL_FOLDER_JUNKED_NOT_DELETED, &num_junked_not_deleted,
+ CAMEL_FOLDER_UNREAD, &num_unread,
+ CAMEL_FOLDER_VISIBLE, &num_visible,
+ NULL);
+
+ buffer = g_string_sized_new (256);
+ selected = message_list_get_selected (message_list);
+
+ if (selected->len > 1)
+ g_string_append_printf (
+ buffer, ngettext ("%d selected, ", "%d selected, ",
+ selected->len), selected->len);
+
+ if (CAMEL_IS_VTRASH_FOLDER (folder)) {
+ CamelVTrashFolder *trash_folder;
+
+ trash_folder = (CamelVTrashFolder *) folder;
+
+ /* "Trash" folder */
+ if (trash_folder->type == CAMEL_VTRASH_FOLDER_TRASH)
+ g_string_append_printf (
+ buffer, ngettext ("%d deleted",
+ "%d deleted", num_deleted), num_deleted);
+
+ /* "Junk" folder (hide deleted messages) */
+ else if (e_mail_reader_get_hide_deleted (reader))
+ g_string_append_printf (
+ buffer, ngettext ("%d junk",
+ "%d junk", num_junked_not_deleted),
+ num_junked_not_deleted);
+
+ /* "Junk" folder (show deleted messages) */
+ else
+ g_string_append_printf (
+ buffer, ngettext ("%d junk", "%d junk",
+ num_junked), num_junked);
+
+ /* "Drafts" folder */
+ } else if (em_utils_folder_is_drafts (folder, folder_uri)) {
+ g_string_append_printf (
+ buffer, ngettext ("%d draft", "%d drafts",
+ num_visible), num_visible);
+
+ /* "Outbox" folder */
+ } else if (em_utils_folder_is_outbox (folder, folder_uri)) {
+ g_string_append_printf (
+ buffer, ngettext ("%d unsent", "%d unsent",
+ num_visible), num_visible);
+
+ /* "Sent" folder */
+ } else if (em_utils_folder_is_sent (folder, folder_uri)) {
+ g_string_append_printf (
+ buffer, ngettext ("%d sent", "%d sent",
+ num_visible), num_visible);
+
+ /* Normal folder */
+ } else {
+ if (!e_mail_reader_get_hide_deleted (reader))
+ num_visible +=
+ num_deleted - num_junked +
+ num_junked_not_deleted;
+
+ if (num_unread > 0 && selected->len <= 1)
+ g_string_append_printf (
+ buffer, ngettext ("%d unread, ",
+ "%d unread, ", num_unread), num_unread);
+ g_string_append_printf (
+ buffer, ngettext ("%d total", "%d total",
+ num_visible), num_visible);
+ }
+
+ message_list_free_uids (message_list, selected);
+
+ /* Choose a suitable folder name for displaying. */
+ if (folder->parent_store == local_store && (
+ strcmp (folder_name, "Drafts") == 0 ||
+ strcmp (folder_name, "Inbox") == 0 ||
+ strcmp (folder_name, "Outbox") == 0 ||
+ strcmp (folder_name, "Sent") == 0 ||
+ strcmp (folder_name, "Templates") == 0))
+ display_name = _(folder_name);
+ else if (strcmp (folder_name, "INBOX") == 0)
+ display_name = _("Inbox");
+ else
+ display_name = folder_name;
+
+ title = g_strdup_printf ("%s (%s)", display_name, buffer->str);
+ e_shell_sidebar_set_secondary_text (shell_sidebar, buffer->str);
+ e_shell_view_set_title (shell_view, title);
+ g_free (title);
+
+ camel_object_free (folder, CAMEL_FOLDER_NAME, folder_name);
+ g_string_free (buffer, TRUE);
+}
diff --git a/mail/e-mail-shell-view-private.h b/mail/e-mail-shell-view-private.h
new file mode 100644
index 0000000000..4b27c4c541
--- /dev/null
+++ b/mail/e-mail-shell-view-private.h
@@ -0,0 +1,170 @@
+/*
+ * e-mail-shell-view-private.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_SHELL_VIEW_PRIVATE_H
+#define E_MAIL_SHELL_VIEW_PRIVATE_H
+
+#include "e-mail-shell-view.h"
+
+#include <glib/gi18n.h>
+#include <gtkhtml/gtkhtml.h>
+#include <camel/camel-disco-store.h>
+#include <camel/camel-offline-store.h>
+#include <camel/camel-vtrash-folder.h>
+#include <camel/camel-search-private.h> /* for camel_search_word */
+
+#include "e-util/e-util.h"
+#include "e-util/e-binding.h"
+#include "e-util/gconf-bridge.h"
+#include "e-util/e-account-utils.h"
+#include "filter/filter-part.h"
+#include "widgets/misc/e-popup-action.h"
+#include "widgets/menus/gal-view-instance.h"
+
+#include "e-mail-label-dialog.h"
+#include "e-mail-label-list-store.h"
+#include "e-mail-reader.h"
+#include "em-composer-utils.h"
+#include "em-folder-properties.h"
+#include "em-folder-selector.h"
+#include "em-folder-utils.h"
+#include "em-subscribe-editor.h"
+#include "em-utils.h"
+#include "mail-autofilter.h"
+#include "mail-config.h"
+#include "mail-ops.h"
+#include "mail-send-recv.h"
+#include "mail-vfolder.h"
+
+#include "e-mail-shell-backend.h"
+#include "e-mail-shell-content.h"
+#include "e-mail-shell-sidebar.h"
+#include "e-mail-shell-view-actions.h"
+
+#define E_MAIL_SHELL_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_SHELL_VIEW, EMailShellViewPrivate))
+
+/* Shorthand, requires a variable named "shell_window". */
+#define ACTION(name) \
+ (E_SHELL_WINDOW_ACTION_##name (shell_window))
+#define ACTION_GROUP(name) \
+ (E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window))
+
+/* For use in dispose() methods. */
+#define DISPOSE(obj) \
+ G_STMT_START { \
+ if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \
+ } G_STMT_END
+
+/* ETable Specifications */
+#define ETSPEC_FILENAME "message-list.etspec"
+
+G_BEGIN_DECLS
+
+/* Filter items are displayed in ascending order.
+ * Labels are numbered from zero, so subsequent items must have
+ * sufficiently large values. Unfortunately this introduces an
+ * arbitrary upper bound on labels. */
+enum {
+ MAIL_FILTER_ALL_MESSAGES = -3,
+ MAIL_FILTER_UNREAD_MESSAGES = -2,
+ MAIL_FILTER_NO_LABEL = -1,
+ /* Labels go here */
+ MAIL_FILTER_READ_MESSAGES = 5000,
+ MAIL_FILTER_RECENT_MESSAGES = 5001,
+ MAIL_FILTER_LAST_5_DAYS_MESSAGES = 5002,
+ MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS = 5003,
+ MAIL_FILTER_IMPORTANT_MESSAGES = 5004,
+ MAIL_FILTER_MESSAGES_NOT_JUNK = 5005
+};
+
+/* Search items are displayed in ascending order. */
+enum {
+ MAIL_SEARCH_SUBJECT_OR_SENDER_CONTAINS,
+ MAIL_SEARCH_SUBJECT_OR_RECIPIENTS_CONTAINS,
+ MAIL_SEARCH_RECIPIENTS_CONTAIN,
+ MAIL_SEARCH_MESSAGE_CONTAINS,
+ MAIL_SEARCH_SUBJECT_CONTAINS,
+ MAIL_SEARCH_SENDER_CONTAINS,
+ MAIL_SEARCH_BODY_CONTAINS,
+ MAIL_NUM_SEARCH_RULES
+};
+
+/* Scope items are displayed in ascending order. */
+enum {
+ MAIL_SCOPE_CURRENT_FOLDER,
+ MAIL_SCOPE_CURRENT_ACCOUNT,
+ MAIL_SCOPE_ALL_ACCOUNTS,
+ MAIL_SCOPE_CURRENT_MESSAGE
+};
+
+struct _EMailShellViewPrivate {
+
+ /*** Other Stuff ***/
+
+ /* These are just for convenience. */
+ EMailShellBackend *mail_shell_backend;
+ EMailShellContent *mail_shell_content;
+ EMailShellSidebar *mail_shell_sidebar;
+
+ /* For UI merging and unmerging. */
+ guint merge_id;
+ guint label_merge_id;
+
+ /* Filter rules correspond to the search entry menu. */
+ FilterRule *search_rules[MAIL_NUM_SEARCH_RULES];
+
+ guint show_deleted : 1;
+};
+
+void e_mail_shell_view_private_init
+ (EMailShellView *mail_shell_view,
+ EShellViewClass *shell_view_class);
+void e_mail_shell_view_private_constructed
+ (EMailShellView *mail_shell_view);
+void e_mail_shell_view_private_dispose
+ (EMailShellView *mail_shell_view);
+void e_mail_shell_view_private_finalize
+ (EMailShellView *mail_shell_view);
+
+/* Private Utilities */
+
+void e_mail_shell_view_actions_init
+ (EMailShellView *mail_shell_view);
+void e_mail_shell_view_execute_search
+ (EMailShellView *mail_shell_view);
+void e_mail_shell_view_create_filter_from_selected
+ (EMailShellView *mail_shell_view,
+ gint filter_type);
+void e_mail_shell_view_create_vfolder_from_selected
+ (EMailShellView *mail_shell_view,
+ gint vfolder_type);
+void e_mail_shell_view_update_popup_labels
+ (EMailShellView *mail_shell_view);
+void e_mail_shell_view_update_search_filter
+ (EMailShellView *mail_shell_view);
+void e_mail_shell_view_update_sidebar
+ (EMailShellView *mail_shell_view);
+
+G_END_DECLS
+
+#endif /* E_MAIL_SHELL_VIEW_PRIVATE_H */
diff --git a/mail/e-mail-shell-view.c b/mail/e-mail-shell-view.c
new file mode 100644
index 0000000000..8d8b4aa2b3
--- /dev/null
+++ b/mail/e-mail-shell-view.c
@@ -0,0 +1,260 @@
+/*
+ * e-mail-shell-view.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-shell-view-private.h"
+
+static gpointer parent_class;
+static GType mail_shell_view_type;
+
+static void
+mail_shell_view_dispose (GObject *object)
+{
+ e_mail_shell_view_private_dispose (E_MAIL_SHELL_VIEW (object));
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+mail_shell_view_finalize (GObject *object)
+{
+ e_mail_shell_view_private_finalize (E_MAIL_SHELL_VIEW (object));
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+mail_shell_view_constructed (GObject *object)
+{
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ e_mail_shell_view_private_constructed (E_MAIL_SHELL_VIEW (object));
+}
+
+static void
+mail_shell_view_toggled (EShellView *shell_view)
+{
+ EMailShellViewPrivate *priv;
+ EShellWindow *shell_window;
+ GtkUIManager *ui_manager;
+ const gchar *basename;
+ gboolean view_is_active;
+
+ /* Chain up to parent's toggled() method. */
+ E_SHELL_VIEW_CLASS (parent_class)->toggled (shell_view);
+
+ priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (shell_view);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ view_is_active = e_shell_view_is_active (shell_view);
+ basename = E_MAIL_READER_UI_DEFINITION;
+
+ if (view_is_active && priv->merge_id == 0) {
+ priv->merge_id = e_load_ui_definition (ui_manager, basename);
+ e_mail_reader_create_charset_menu (
+ E_MAIL_READER (priv->mail_shell_content),
+ ui_manager, priv->merge_id);
+ } else if (!view_is_active && priv->merge_id != 0) {
+ gtk_ui_manager_remove_ui (ui_manager, priv->merge_id);
+ priv->merge_id = 0;
+ }
+
+ gtk_ui_manager_ensure_update (ui_manager);
+}
+
+static void
+mail_shell_view_update_actions (EShellView *shell_view)
+{
+ EMailShellView *mail_shell_view;
+ EMailShellSidebar *mail_shell_sidebar;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellWindow *shell_window;
+ EMFolderTree *folder_tree;
+ EAccount *account = NULL;
+ GtkAction *action;
+ const gchar *label;
+ gchar *uri;
+ gboolean sensitive;
+ guint32 state;
+
+ /* Be descriptive. */
+ gboolean account_is_groupwise;
+ gboolean folder_allows_children;
+ gboolean folder_can_be_deleted;
+ gboolean folder_is_junk;
+ gboolean folder_is_outbox;
+ gboolean folder_is_store;
+ gboolean folder_is_trash;
+
+ mail_shell_view = E_MAIL_SHELL_VIEW (shell_view);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ e_mail_reader_update_actions (E_MAIL_READER (shell_content));
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ state = e_shell_sidebar_check_state (shell_sidebar);
+
+ folder_allows_children =
+ (state & E_MAIL_SHELL_SIDEBAR_FOLDER_ALLOWS_CHILDREN);
+ folder_can_be_deleted =
+ (state & E_MAIL_SHELL_SIDEBAR_FOLDER_CAN_DELETE);
+ folder_is_junk =
+ (state & E_MAIL_SHELL_SIDEBAR_FOLDER_IS_JUNK);
+ folder_is_outbox =
+ (state & E_MAIL_SHELL_SIDEBAR_FOLDER_IS_OUTBOX);
+ folder_is_store =
+ (state & E_MAIL_SHELL_SIDEBAR_FOLDER_IS_STORE);
+ folder_is_trash =
+ (state & E_MAIL_SHELL_SIDEBAR_FOLDER_IS_TRASH);
+
+ uri = em_folder_tree_get_selected_uri (folder_tree);
+ if (uri != NULL) {
+ account = mail_config_get_account_by_source_url (uri);
+
+ /* FIXME This belongs in a GroupWise plugin. */
+ account_is_groupwise =
+ (g_strrstr (uri, "groupwise://") != NULL) &&
+ account != NULL && account->parent_uid != NULL;
+
+ g_free (uri);
+ }
+
+ action = ACTION (MAIL_ACCOUNT_DISABLE);
+ sensitive = (account != NULL) && folder_is_store;
+ if (account_is_groupwise)
+ label = _("Proxy _Logout");
+ else
+ label = _("_Disable Account");
+ gtk_action_set_sensitive (action, sensitive);
+ g_object_set (action, "label", label, NULL);
+
+ action = ACTION (MAIL_EMPTY_TRASH);
+ sensitive = folder_is_trash;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FLUSH_OUTBOX);
+ sensitive = folder_is_outbox;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_COPY);
+ sensitive = !folder_is_store;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_DELETE);
+ sensitive = !folder_is_store && folder_can_be_deleted;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_MOVE);
+ sensitive = !folder_is_store && folder_can_be_deleted;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_NEW);
+ sensitive = folder_allows_children;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_PROPERTIES);
+ sensitive = !folder_is_store;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_REFRESH);
+ sensitive = !folder_is_store;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_RENAME);
+ sensitive = !folder_is_store && folder_can_be_deleted;
+ gtk_action_set_sensitive (action, sensitive);
+
+ e_mail_shell_view_update_popup_labels (mail_shell_view);
+}
+
+static void
+mail_shell_view_class_init (EMailShellViewClass *class,
+ GTypeModule *type_module)
+{
+ GObjectClass *object_class;
+ EShellViewClass *shell_view_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMailShellViewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = mail_shell_view_dispose;
+ object_class->finalize = mail_shell_view_finalize;
+ object_class->constructed = mail_shell_view_constructed;
+
+ shell_view_class = E_SHELL_VIEW_CLASS (class);
+ shell_view_class->label = _("Mail");
+ shell_view_class->icon_name = "evolution-mail";
+ shell_view_class->ui_definition = "evolution-mail.ui";
+ shell_view_class->ui_manager_id = "org.gnome.evolution.mail";
+ shell_view_class->search_options = "/mail-search-options";
+ shell_view_class->search_rules = "searchtypes.xml";
+ shell_view_class->new_shell_content = e_mail_shell_content_new;
+ shell_view_class->new_shell_sidebar = e_mail_shell_sidebar_new;
+ shell_view_class->toggled = mail_shell_view_toggled;
+ shell_view_class->update_actions = mail_shell_view_update_actions;
+}
+
+static void
+mail_shell_view_init (EMailShellView *mail_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ mail_shell_view->priv =
+ E_MAIL_SHELL_VIEW_GET_PRIVATE (mail_shell_view);
+
+ e_mail_shell_view_private_init (mail_shell_view, shell_view_class);
+}
+
+GType
+e_mail_shell_view_get_type (void)
+{
+ return mail_shell_view_type;
+}
+
+void
+e_mail_shell_view_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (EMailShellViewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) mail_shell_view_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMailShellView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) mail_shell_view_init,
+ NULL /* value_table */
+ };
+
+ mail_shell_view_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_VIEW,
+ "EMailShellView", &type_info, 0);
+}
diff --git a/mail/e-mail-shell-view.h b/mail/e-mail-shell-view.h
new file mode 100644
index 0000000000..d20bde74a6
--- /dev/null
+++ b/mail/e-mail-shell-view.h
@@ -0,0 +1,72 @@
+/*
+ * e-mail-shell-view.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_SHELL_VIEW_H
+#define E_MAIL_SHELL_VIEW_H
+
+#include <shell/e-shell-view.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_SHELL_VIEW \
+ (e_mail_shell_view_get_type ())
+#define E_MAIL_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_SHELL_VIEW, EMailShellView))
+#define E_MAIL_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_SHELL_VIEW, EMailShellViewClass))
+#define E_IS_MAIL_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_SHELL_VIEW))
+#define E_IS_MAIL_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_SHELL_VIEW))
+#define E_MAIL_SHELL_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_SHELL_VIEW, EMailShellViewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailShellView EMailShellView;
+typedef struct _EMailShellViewClass EMailShellViewClass;
+typedef struct _EMailShellViewPrivate EMailShellViewPrivate;
+
+struct _EMailShellView {
+ EShellView parent;
+ EMailShellViewPrivate *priv;
+};
+
+struct _EMailShellViewClass {
+ EShellViewClass parent_class;
+};
+
+GType e_mail_shell_view_get_type (void);
+void e_mail_shell_view_register_type
+ (GTypeModule *type_module);
+gboolean e_mail_shell_view_get_show_deleted
+ (EMailShellView *mail_shell_view);
+void e_mail_shell_view_set_show_deleted
+ (EMailShellView *mail_shell_view,
+ gboolean show_deleted);
+
+G_END_DECLS
+
+#endif /* E_MAIL_SHELL_VIEW_H */
diff --git a/mail/e-searching-tokenizer.c b/mail/e-searching-tokenizer.c
index 724cc3b74a..726ae41ed4 100644
--- a/mail/e-searching-tokenizer.c
+++ b/mail/e-searching-tokenizer.c
@@ -38,77 +38,17 @@
#define d(x)
+#define E_SEARCHING_TOKENIZER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SEARCHING_TOKENIZER, ESearchingTokenizerPrivate))
+
enum {
MATCH_SIGNAL,
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0, };
-
-static void e_searching_tokenizer_begin (HTMLTokenizer *, const char *);
-static void e_searching_tokenizer_end (HTMLTokenizer *);
-static char *e_searching_tokenizer_peek_token (HTMLTokenizer *);
-static char *e_searching_tokenizer_next_token (HTMLTokenizer *);
-static gboolean e_searching_tokenizer_has_more (HTMLTokenizer *);
-
-static HTMLTokenizer *e_searching_tokenizer_clone (HTMLTokenizer *);
-
-/*
- static const gchar *space_tags[] = { "br", NULL };*/
-
-static HTMLTokenizerClass *parent_class = NULL;
-
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-
-/* ???
-typedef struct _SharedState SharedState;
-struct _SharedState {
- gint refs;
- gchar *str_primary;
- gchar *str_secondary;
- gboolean case_sensitive_primary;
- gboolean case_sensitive_secondary;
-};
-*/
-
-/* ********************************************************************** */
-
-
-#if 0
-static SharedState *
-shared_state_new (void)
-{
- SharedState *shared = g_new0 (SharedState, 1);
- shared->refs = 1;
- return shared;
-}
-
-static void
-shared_state_ref (SharedState *shared)
-{
- g_return_if_fail (shared != NULL);
- g_return_if_fail (shared->refs > 0);
- ++shared->refs;
-}
-
-static void
-shared_state_unref (SharedState *shared)
-{
- if (shared) {
- g_return_if_fail (shared->refs > 0);
- --shared->refs;
- if (shared->refs == 0) {
- g_free (shared->str_primary);
- g_free (shared->str_secondary);
- g_free (shared);
- }
- }
-}
-#endif
-
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-
-/* ********************************************************************** */
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
/* Utility functions */
@@ -185,7 +125,7 @@ ignore_tag (const char *tag)
*out = 0;
for (i=0;i<sizeof(ignored_tags)/sizeof(ignored_tags[0]);i++) {
- if (strcmp(t, ignored_tags[i]) == 0)
+ if (strcmp (t, ignored_tags[i]) == 0)
return 1;
}
@@ -223,7 +163,7 @@ struct _trie {
/* will be enabled only if debug is enabled */
#if d(1) -1 != -1
static void
-dump_trie(struct _state *s, int d)
+dump_trie (struct _state *s, int d)
{
char *p = alloca(d*2+1);
struct _match *m;
@@ -236,7 +176,7 @@ dump_trie(struct _state *s, int d)
while (m) {
printf(" %s'%c' -> %p\n", p, m->ch, m->match);
if (m->match)
- dump_trie(m->match, d+1);
+ dump_trie (m->match, d+1);
m = m->next;
}
}
@@ -248,7 +188,7 @@ dump_trie(struct _state *s, int d)
for a neat demo */
static inline struct _match *
-g(struct _state *q, guint32 c)
+g (struct _state *q, guint32 c)
{
struct _match *m = q->matches;
@@ -259,7 +199,7 @@ g(struct _state *q, guint32 c)
}
static struct _trie *
-build_trie(int nocase, int len, unsigned char **words)
+build_trie (int nocase, int len, unsigned char **words)
{
struct _state *q, *qt, *r;
const unsigned char *word;
@@ -276,8 +216,8 @@ build_trie(int nocase, int len, unsigned char **words)
trie->root.fail = NULL;
trie->root.next = NULL;
- trie->state_chunks = e_memchunk_new(8, sizeof(struct _state));
- trie->match_chunks = e_memchunk_new(8, sizeof(struct _match));
+ trie->state_chunks = e_memchunk_new (8, sizeof(struct _state));
+ trie->match_chunks = e_memchunk_new (8, sizeof(struct _match));
/* This will correspond to the length of the longest pattern */
state_depth_size = 0;
@@ -295,8 +235,8 @@ build_trie(int nocase, int len, unsigned char **words)
depth = 0;
while ((c = camel_utf8_getc (&word))) {
if (nocase)
- c = g_unichar_tolower(c);
- m = g(q, c);
+ c = g_unichar_tolower (c);
+ m = g (q, c);
if (m == NULL) {
m = e_memchunk_alloc(trie->match_chunks);
m->ch = c;
@@ -325,7 +265,7 @@ build_trie(int nocase, int len, unsigned char **words)
}
d(printf("Dumping trie:\n"));
- d(dump_trie(&trie->root, 0));
+ d(dump_trie (&trie->root, 0));
/* Step 2: Build failure graph */
@@ -341,14 +281,14 @@ build_trie(int nocase, int len, unsigned char **words)
c = m->ch;
qt = m->match;
r = q->fail;
- while (r && (n = g(r, c)) == NULL)
+ while (r && (n = g (r, c)) == NULL)
r = r->fail;
if (r != NULL) {
qt->fail = n->match;
if (qt->fail->final > qt->final)
qt->final = qt->fail->final;
} else {
- if ((n = g(&trie->root, c)))
+ if ((n = g (&trie->root, c)))
qt->fail = n->match;
else
qt->fail = &trie->root;
@@ -359,10 +299,10 @@ build_trie(int nocase, int len, unsigned char **words)
}
}
- d(printf("After failure analysis\n"));
- d(dump_trie(&trie->root, 0));
+ d (printf("After failure analysis\n"));
+ d (dump_trie (&trie->root, 0));
- g_free(state_depth);
+ g_free (state_depth);
trie->max_depth = state_depth_size;
@@ -370,12 +310,12 @@ build_trie(int nocase, int len, unsigned char **words)
}
static void
-free_trie(struct _trie *t)
+free_trie (struct _trie *t)
{
e_memchunk_destroy(t->match_chunks);
e_memchunk_destroy(t->state_chunks);
- g_free(t);
+ g_free (t);
}
/* ********************************************************************** */
@@ -445,10 +385,10 @@ searcher_new (int flags, int argc, unsigned char **argv, const char *tags, const
s = g_malloc(sizeof(*s));
- s->t = build_trie((flags&SEARCH_CASE) == 0, argc, argv);
+ s->t = build_trie ((flags&SEARCH_CASE) == 0, argc, argv);
s->words = argc;
- s->tags = g_strdup(tags);
- s->tage = g_strdup(tage);
+ s->tags = g_strdup (tags);
+ s->tage = g_strdup (tage);
s->flags = flags;
s->state = &s->t->root;
s->matchcount = 0;
@@ -477,20 +417,20 @@ searcher_new (int flags, int argc, unsigned char **argv, const char *tags, const
}
static void
-searcher_free(struct _searcher *s)
+searcher_free (struct _searcher *s)
{
struct _token *t;
- while ((t = (struct _token *)e_dlist_remhead(&s->input)))
- g_free(t);
- while ((t = (struct _token *)e_dlist_remhead(&s->output)))
- g_free(t);
- g_free(s->tags);
- g_free(s->tage);
- g_free(s->last);
- g_free(s->submatches);
- free_trie(s->t);
- g_free(s);
+ while ((t = (struct _token *)e_dlist_remhead (&s->input)))
+ g_free (t);
+ while ((t = (struct _token *)e_dlist_remhead (&s->output)))
+ g_free (t);
+ g_free (s->tags);
+ g_free (s->tage);
+ g_free (s->last);
+ g_free (s->submatches);
+ free_trie (s->t);
+ g_free (s);
}
static struct _token *
append_token(EDList *list, const char *tok, int len)
@@ -508,7 +448,7 @@ append_token(EDList *list, const char *tok, int len)
return token;
}
-#define free_token(x) (g_free(x))
+#define free_token(x) (g_free (x))
static void
output_token(struct _searcher *s, struct _token *token)
@@ -518,10 +458,10 @@ output_token(struct _searcher *s, struct _token *token)
if (token->tok[0] == TAG_ESCAPE) {
if (token->offset >= s->offout) {
- d(printf("moving tag token '%s' from input to output\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
+ d (printf("moving tag token '%s' from input to output\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
e_dlist_addtail(&s->output, (EDListNode *)token);
} else {
- d(printf("discarding tag token '%s' from input\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
+ d (printf("discarding tag token '%s' from input\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
free_token(token);
}
} else {
@@ -530,12 +470,12 @@ output_token(struct _searcher *s, struct _token *token)
if (left > 0) {
pre = s->offout - token->offset;
if (pre>0)
- memmove(token->tok, token->tok+pre, left+1);
- d(printf("adding partial remaining/failed '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
+ memmove (token->tok, token->tok+pre, left+1);
+ d (printf("adding partial remaining/failed '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
s->offout = offend;
e_dlist_addtail(&s->output, (EDListNode *)token);
} else {
- d(printf("discarding whole token '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
+ d (printf("discarding whole token '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
free_token(token);
}
}
@@ -564,30 +504,30 @@ output_match(struct _searcher *s, unsigned int start, unsigned int end)
struct _token *starttoken, *endtoken;
char b[8];
- d(printf("output match: %d-%d at %d\n", start, end, s->offout));
+ d (printf("output match: %d-%d at %d\n", start, end, s->offout));
starttoken = find_token(s, start);
endtoken = find_token(s, end);
if (starttoken == NULL || endtoken == NULL) {
- d(printf("Cannot find match history for match %d-%d\n", start, end));
+ d (printf("Cannot find match history for match %d-%d\n", start, end));
return;
}
- d(printf("start in token '%s'\n", starttoken->tok[0]==TAG_ESCAPE?starttoken->tok+1:starttoken->tok));
- d(printf("end in token '%s'\n", endtoken->tok[0]==TAG_ESCAPE?endtoken->tok+1:endtoken->tok));
+ d (printf("start in token '%s'\n", starttoken->tok[0]==TAG_ESCAPE?starttoken->tok+1:starttoken->tok));
+ d (printf("end in token '%s'\n", endtoken->tok[0]==TAG_ESCAPE?endtoken->tok+1:endtoken->tok));
/* output pending stuff that didn't match afterall */
while ((struct _token *)s->input.head != starttoken) {
- token = (struct _token *)e_dlist_remhead(&s->input);
- d(printf("appending failed match '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
+ token = (struct _token *)e_dlist_remhead (&s->input);
+ d (printf("appending failed match '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
output_token(s, token);
}
/* output any pre-match text */
if (s->offout < start) {
token = append_token(&s->output, starttoken->tok + (s->offout-starttoken->offset), start-s->offout);
- d(printf("adding pre-match text '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
+ d (printf("adding pre-match text '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
s->offout = start;
}
@@ -599,11 +539,11 @@ output_match(struct _searcher *s, unsigned int start, unsigned int end)
if (s->tags)
append_token(&s->output, s->tags, -1);
- /* output match node(s) */
+ /* output match node (s) */
if (starttoken != endtoken) {
while ((struct _token *)s->input.head != endtoken) {
- token = (struct _token *)e_dlist_remhead(&s->input);
- d(printf("appending (partial) match node (head) '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
+ token = (struct _token *)e_dlist_remhead (&s->input);
+ d (printf("appending (partial) match node (head) '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
output_token(s, token);
}
}
@@ -611,7 +551,7 @@ output_match(struct _searcher *s, unsigned int start, unsigned int end)
/* any remaining partial content */
if (s->offout < end) {
token = append_token(&s->output, endtoken->tok+(s->offout-endtoken->offset), end-s->offout);
- d(printf("appending (partial) match node (tail) '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
+ d (printf("appending (partial) match node (tail) '%s'\n", token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
s->offout = end;
}
@@ -628,7 +568,7 @@ output_match(struct _searcher *s, unsigned int start, unsigned int end)
/* output any sub-pending blocks */
static void
-output_subpending(struct _searcher *s)
+output_subpending (struct _searcher *s)
{
int i;
@@ -639,7 +579,7 @@ output_subpending(struct _searcher *s)
/* returns true if a merge took place */
static int
-merge_subpending(struct _searcher *s, int offstart, int offend)
+merge_subpending (struct _searcher *s, int offstart, int offend)
{
int i;
@@ -664,11 +604,11 @@ merge_subpending(struct _searcher *s, int offstart, int offend)
}
static void
-push_subpending(struct _searcher *s, int offstart, int offend)
+push_subpending (struct _searcher *s, int offstart, int offend)
{
/* This is really an assertion, we just ignore the last pending match instead of crashing though */
if (s->submatchp >= s->words) {
- d(printf("ERROR: submatch pending stack overflow\n"));
+ d (printf("ERROR: submatch pending stack overflow\n"));
s->submatchp = s->words-1;
}
@@ -679,11 +619,11 @@ push_subpending(struct _searcher *s, int offstart, int offend)
/* move any (partial) tokens from input to output if they are beyond the current output position */
static void
-output_pending(struct _searcher *s)
+output_pending (struct _searcher *s)
{
struct _token *token;
- while ( (token = (struct _token *)e_dlist_remhead(&s->input)) )
+ while ( (token = (struct _token *)e_dlist_remhead (&s->input)) )
output_token(s, token);
}
@@ -707,7 +647,7 @@ flush_extra(struct _searcher *s)
return;
while ((struct _token *)s->input.head != starttoken) {
- token = (struct _token *)e_dlist_remhead(&s->input);
+ token = (struct _token *)e_dlist_remhead (&s->input);
output_token(s, token);
}
}
@@ -727,8 +667,8 @@ searcher_next_token(struct _searcher *s)
/* get next token */
tok = (unsigned char *)s->next_token(s->next_data);
if (tok == NULL) {
- output_subpending(s);
- output_pending(s);
+ output_subpending (s);
+ output_pending (s);
break;
}
@@ -737,14 +677,14 @@ searcher_next_token(struct _searcher *s)
token->offset = s->offset;
tok = (unsigned char *)token->tok;
- d(printf("new token %d '%s'\n", token->offset, token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
+ d (printf("new token %d '%s'\n", token->offset, token->tok[0]==TAG_ESCAPE?token->tok+1:token->tok));
/* tag test, reset state on unknown tags */
if (tok[0] == TAG_ESCAPE) {
if (!ignore_tag ((char *)tok)) {
/* force reset */
- output_subpending(s);
- output_pending(s);
+ output_subpending (s);
+ output_pending (s);
q = &t->root;
}
@@ -755,12 +695,12 @@ searcher_next_token(struct _searcher *s)
pre_tok = stok = tok;
while ((c = camel_utf8_getc (&tok))) {
if ((s->flags & SEARCH_CASE) == 0)
- c = g_unichar_tolower(c);
- while (q && (m = g(q, c)) == NULL)
+ c = g_unichar_tolower (c);
+ while (q && (m = g (q, c)) == NULL)
q = q->fail;
if (q == NULL) {
/* mismatch ... reset state */
- output_subpending(s);
+ output_subpending (s);
q = &t->root;
} else if (m != NULL) {
/* keep track of previous offsets of utf8 chars, rotating buffer */
@@ -779,21 +719,21 @@ searcher_next_token(struct _searcher *s)
if (q->matches == NULL) {
if (s->submatchp == 0) {
/* nothing pending, always put something in so we can try merge */
- push_subpending(s, offstart, offend);
- } else if (!merge_subpending(s, offstart, offend)) {
+ push_subpending (s, offstart, offend);
+ } else if (!merge_subpending (s, offstart, offend)) {
/* can't merge, output what we have, and start againt */
- output_subpending(s);
- push_subpending(s, offstart, offend);
+ output_subpending (s);
+ push_subpending (s, offstart, offend);
/*output_match(s, offstart, offend);*/
} else if (e_dlist_length(&s->input) > 8) {
/* we're continuing to match and merge, but we have a lot of stuff
waiting, so flush it out now since this is a safe point to do it */
- output_subpending(s);
+ output_subpending (s);
}
} else {
/* merge/add subpending */
- if (!merge_subpending(s, offstart, offend))
- push_subpending(s, offstart, offend);
+ if (!merge_subpending (s, offstart, offend))
+ push_subpending (s, offstart, offend);
}
}
}
@@ -810,7 +750,7 @@ searcher_next_token(struct _searcher *s)
if (s->current)
free_token(s->current);
- s->current = token = (struct _token *)e_dlist_remhead(&s->output);
+ s->current = token = (struct _token *)e_dlist_remhead (&s->output);
return token ? g_strdup (token->tok) : NULL;
}
@@ -824,7 +764,7 @@ searcher_peek_token(struct _searcher *s)
tok = searcher_next_token(s);
if (tok) {
/* need to clear this so we dont free it while its still active */
- e_dlist_addhead(&s->output, (EDListNode *)s->current);
+ e_dlist_addhead (&s->output, (EDListNode *)s->current);
s->current = NULL;
}
@@ -832,7 +772,7 @@ searcher_peek_token(struct _searcher *s)
}
static int
-searcher_pending(struct _searcher *s)
+searcher_pending (struct _searcher *s)
{
return !(e_dlist_empty(&s->input) && e_dlist_empty(&s->output));
}
@@ -841,7 +781,7 @@ searcher_pending(struct _searcher *s)
struct _search_info {
GPtrArray *strv;
- char *colour;
+ char *color;
unsigned int size:8;
unsigned int flags:8;
};
@@ -849,12 +789,12 @@ struct _search_info {
/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
static struct _search_info *
-search_info_new(void)
+search_info_new (void)
{
struct _search_info *s;
s = g_malloc0(sizeof(struct _search_info));
- s->strv = g_ptr_array_new();
+ s->strv = g_ptr_array_new ();
return s;
}
@@ -866,14 +806,14 @@ search_info_set_flags(struct _search_info *si, unsigned int flags, unsigned int
}
static void
-search_info_set_colour(struct _search_info *si, const char *colour)
+search_info_set_color (struct _search_info *si, const char *color)
{
- g_free(si->colour);
- si->colour = g_strdup(colour);
+ g_free (si->color);
+ si->color = g_strdup (color);
}
static void
-search_info_add_string(struct _search_info *si, const char *s)
+search_info_add_string (struct _search_info *si, const char *s)
{
const unsigned char *start;
guint32 c;
@@ -890,44 +830,44 @@ search_info_add_string(struct _search_info *si, const char *s)
}
/* should probably also strip trailing, but i'm lazy today */
if (start[0])
- g_ptr_array_add(si->strv, g_strdup ((char *)start));
+ g_ptr_array_add (si->strv, g_strdup ((char *)start));
}
}
static void
-search_info_clear(struct _search_info *si)
+search_info_clear (struct _search_info *si)
{
int i;
for (i=0;i<si->strv->len;i++)
- g_free(si->strv->pdata[i]);
+ g_free (si->strv->pdata[i]);
- g_ptr_array_set_size(si->strv, 0);
+ g_ptr_array_set_size (si->strv, 0);
}
static void
-search_info_free(struct _search_info *si)
+search_info_free (struct _search_info *si)
{
int i;
for (i=0;i<si->strv->len;i++)
- g_free(si->strv->pdata[i]);
+ g_free (si->strv->pdata[i]);
- g_ptr_array_free(si->strv, TRUE);
- g_free(si->colour);
- g_free(si);
+ g_ptr_array_free (si->strv, TRUE);
+ g_free (si->color);
+ g_free (si);
}
static struct _search_info *
-search_info_clone(struct _search_info *si)
+search_info_clone (struct _search_info *si)
{
struct _search_info *out;
int i;
- out = search_info_new();
+ out = search_info_new ();
for (i=0;i<si->strv->len;i++)
- g_ptr_array_add(out->strv, g_strdup(si->strv->pdata[i]));
- out->colour = g_strdup(si->colour);
+ g_ptr_array_add (out->strv, g_strdup (si->strv->pdata[i]));
+ out->color = g_strdup (si->color);
out->flags = si->flags;
out->size = si->size;
@@ -935,7 +875,7 @@ search_info_clone(struct _search_info *si)
}
static struct _searcher *
-search_info_to_searcher(struct _search_info *si)
+search_info_to_searcher (struct _search_info *si)
{
char *tags, *tage;
const gchar *col;
@@ -943,10 +883,10 @@ search_info_to_searcher(struct _search_info *si)
if (si->strv->len == 0)
return NULL;
- if (si->colour == NULL)
+ if (si->color == NULL)
col = "red";
else
- col = si->colour;
+ col = si->color;
tags = alloca(20+strlen(col));
sprintf(tags, "%c<font color=\"%s\">", TAG_ESCAPE, col);
@@ -965,287 +905,289 @@ struct _ESearchingTokenizerPrivate {
/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-static void
-e_searching_tokenizer_finalise (GObject *obj)
-{
- ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (obj);
- struct _ESearchingTokenizerPrivate *p = st->priv;
-
- search_info_free (p->primary);
- search_info_free (p->secondary);
- if (p->engine)
- searcher_free(p->engine);
+/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
- /* again wtf?
- shared_state_unref (st->priv->shared);
- */
+/* blah blah the htmltokeniser doesn't like being asked
+ for a token if it doens't hvae any! */
+static char *
+get_token (HTMLTokenizer *tokenizer)
+{
+ HTMLTokenizerClass *class = HTML_TOKENIZER_CLASS (parent_class);
- g_free (p);
+ if (class->has_more (tokenizer))
+ return class->next_token (tokenizer);
- if (G_OBJECT_CLASS (parent_class)->finalize)
- G_OBJECT_CLASS (parent_class)->finalize(obj);
+ return NULL;
}
+/* proxy matched event, not sure what its for otherwise */
static void
-e_searching_tokenizer_class_init (ESearchingTokenizerClass *klass)
+matched (ESearchingTokenizer *tokenizer)
{
- GObjectClass *obj_class = (GObjectClass *) klass;
- HTMLTokenizerClass *tok_class = HTML_TOKENIZER_CLASS (klass);
-
- parent_class = g_type_class_ref (HTML_TYPE_TOKENIZER);
-
- signals[MATCH_SIGNAL] =
- g_signal_new ("match",
- E_TYPE_SEARCHING_TOKENIZER,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESearchingTokenizerClass, match),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- obj_class->finalize = e_searching_tokenizer_finalise;
-
- tok_class->begin = e_searching_tokenizer_begin;
- tok_class->end = e_searching_tokenizer_end;
-
- tok_class->peek_token = e_searching_tokenizer_peek_token;
- tok_class->next_token = e_searching_tokenizer_next_token;
- tok_class->has_more = e_searching_tokenizer_has_more;
- tok_class->clone = e_searching_tokenizer_clone;
+ /*++tokenizer->priv->match_count;*/
+ g_signal_emit (tokenizer, signals[MATCH_SIGNAL], 0);
}
+/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
+
static void
-e_searching_tokenizer_init (ESearchingTokenizer *st)
+searching_tokenizer_finalize (GObject *object)
{
- struct _ESearchingTokenizerPrivate *p;
+ ESearchingTokenizerPrivate *priv;
- p = st->priv = g_new0 (struct _ESearchingTokenizerPrivate, 1);
+ priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (object);
- p->primary = search_info_new();
- search_info_set_flags(p->primary, SEARCH_BOLD, SEARCH_CASE|SEARCH_BOLD);
- search_info_set_colour(p->primary, "red");
+ search_info_free (priv->primary);
+ search_info_free (priv->secondary);
- p->secondary = search_info_new();
- search_info_set_flags(p->secondary, SEARCH_BOLD, SEARCH_CASE|SEARCH_BOLD);
- search_info_set_colour(p->secondary, "purple");
-}
-
-GType
-e_searching_tokenizer_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (ESearchingTokenizerClass),
- NULL, NULL,
- (GClassInitFunc) e_searching_tokenizer_class_init,
- NULL, NULL,
- sizeof (ESearchingTokenizer),
- 0,
- (GInstanceInitFunc) e_searching_tokenizer_init,
- };
+ if (priv->engine != NULL)
+ searcher_free (priv->engine);
- type = g_type_register_static (HTML_TYPE_TOKENIZER, "ESearchingTokenizer", &info, 0);
- }
-
- return type;
-}
-
-ESearchingTokenizer *
-e_searching_tokenizer_new (void)
-{
- return g_object_new (E_TYPE_SEARCHING_TOKENIZER, NULL);
-}
-
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-
-/* blah blah the htmltokeniser doesn't like being asked
- for a token if it doens't hvae any! */
-static char *get_token(HTMLTokenizer *t)
-{
- HTMLTokenizerClass *klass = HTML_TOKENIZER_CLASS (parent_class);
-
- return klass->has_more(t) ? klass->next_token(t) : NULL;
+ /* Chain up to parent's finalize () method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-e_searching_tokenizer_begin (HTMLTokenizer *t, const char *content_type)
+searching_tokenizer_begin (HTMLTokenizer *tokenizer,
+ const gchar *content_type)
{
- ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (t);
- struct _ESearchingTokenizerPrivate *p = st->priv;
+ ESearchingTokenizerPrivate *priv;
+
+ priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (tokenizer);
/* reset search */
- if (p->engine) {
- searcher_free(p->engine);
- p->engine = NULL;
+ if (priv->engine != NULL) {
+ searcher_free (priv->engine);
+ priv->engine = NULL;
}
- if ((p->engine = search_info_to_searcher(p->primary))
- || (p->engine = search_info_to_searcher(p->secondary))) {
- /*HTMLTokenizerClass *klass = HTML_TOKENIZER_CLASS (parent_class);*/
-
- /*searcher_set_tokenfunc(p->engine, klass->next_token, st);*/
- searcher_set_tokenfunc(p->engine, get_token, st);
+ if ((priv->engine = search_info_to_searcher (priv->primary))
+ || (priv->engine = search_info_to_searcher (priv->secondary))) {
+ searcher_set_tokenfunc(priv->engine, get_token, tokenizer);
}
/* else - no engine, no search active */
- HTML_TOKENIZER_CLASS (parent_class)->begin (t, content_type);
+ /* Chain up to parent's begin() method. */
+ HTML_TOKENIZER_CLASS (parent_class)->begin (tokenizer, content_type);
}
-static void
-e_searching_tokenizer_end (HTMLTokenizer *t)
+static gchar *
+searching_tokenizer_peek_token (HTMLTokenizer *tokenizer)
{
- /* so end gets called before any get/next tokens.
- I dont get it. */
-#if 0
- ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (t);
- struct _ESearchingTokenizerPrivate *p = st->priv;
-
- /* not sure if we should reset search every time ... *shrug* */
- if (p->engine) {
- searcher_free(p->engine);
- p->engine = NULL;
- }
-#endif
+ ESearchingTokenizerPrivate *priv;
- HTML_TOKENIZER_CLASS (parent_class)->end (t);
-}
-
-static char *
-e_searching_tokenizer_peek_token (HTMLTokenizer *tok)
-{
- ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (tok);
+ priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (tokenizer);
- /* If no search is active, just use the default method. */
- if (st->priv->engine == NULL)
- return HTML_TOKENIZER_CLASS (parent_class)->peek_token (tok);
+ if (priv->engine != NULL)
+ return searcher_peek_token (priv->engine);
- return searcher_peek_token(st->priv->engine);
+ /* Chain up to parent's peek_token() method. */
+ return HTML_TOKENIZER_CLASS (parent_class)->peek_token (tokenizer);
}
-static char *
-e_searching_tokenizer_next_token (HTMLTokenizer *tok)
+static gchar *
+searching_tokenizer_next_token (HTMLTokenizer *tokenizer)
{
- ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (tok);
+ ESearchingTokenizerPrivate *priv;
int oldmatched;
char *token;
+ priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (tokenizer);
+
/* If no search is active, just use the default method. */
- if (st->priv->engine == NULL)
- return HTML_TOKENIZER_CLASS (parent_class)->next_token (tok);
+ if (priv->engine == NULL)
+ return HTML_TOKENIZER_CLASS (parent_class)->next_token (tokenizer);
- oldmatched = st->priv->engine->matchcount;
+ oldmatched = priv->engine->matchcount;
- token = searcher_next_token(st->priv->engine);
+ token = searcher_next_token (priv->engine);
/* not sure if this has to be accurate or just say we had some matches */
- if (oldmatched != st->priv->engine->matchcount)
- g_signal_emit (st, signals[MATCH_SIGNAL], 0);
+ if (oldmatched != priv->engine->matchcount)
+ g_signal_emit (tokenizer, signals[MATCH_SIGNAL], 0);
return token;
}
static gboolean
-e_searching_tokenizer_has_more (HTMLTokenizer *tok)
+searching_tokenizer_has_more (HTMLTokenizer *tokenizer)
{
- ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (tok);
+ ESearchingTokenizerPrivate *priv;
- return (st->priv->engine != NULL && searcher_pending(st->priv->engine))
- || HTML_TOKENIZER_CLASS (parent_class)->has_more (tok);
+ priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (tokenizer);
+
+ return (priv->engine != NULL && searcher_pending (priv->engine)) ||
+ HTML_TOKENIZER_CLASS (parent_class)->has_more (tokenizer);
}
-/* proxy matched event, not sure what its for otherwise */
+static HTMLTokenizer *
+searching_tokenizer_clone (HTMLTokenizer *tokenizer)
+{
+ ESearchingTokenizer *orig_st;
+ ESearchingTokenizer *new_st;
+
+ orig_st = E_SEARCHING_TOKENIZER (tokenizer);
+ new_st = e_searching_tokenizer_new ();
+
+ search_info_free (new_st->priv->primary);
+ search_info_free (new_st->priv->secondary);
+
+ new_st->priv->primary = search_info_clone (orig_st->priv->primary);
+ new_st->priv->secondary = search_info_clone (orig_st->priv->secondary);
+
+ g_signal_connect_swapped (
+ new_st, "match", G_CALLBACK (matched), orig_st);
+
+ return HTML_TOKENIZER (new_st);
+}
static void
-matched (ESearchingTokenizer *st)
+searching_tokenizer_class_init (ESearchingTokenizerClass *class)
{
- /*++st->priv->match_count;*/
- g_signal_emit (st, signals[MATCH_SIGNAL], 0);
+ GObjectClass *object_class;
+ HTMLTokenizerClass *tokenizer_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ESearchingTokenizerPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = searching_tokenizer_finalize;
+
+ tokenizer_class = HTML_TOKENIZER_CLASS (class);
+ tokenizer_class->begin = searching_tokenizer_begin;
+ tokenizer_class->peek_token = searching_tokenizer_peek_token;
+ tokenizer_class->next_token = searching_tokenizer_next_token;
+ tokenizer_class->has_more = searching_tokenizer_has_more;
+ tokenizer_class->clone = searching_tokenizer_clone;
+
+ signals[MATCH_SIGNAL] = g_signal_new (
+ "match",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ESearchingTokenizerClass, match),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
-static HTMLTokenizer *
-e_searching_tokenizer_clone (HTMLTokenizer *tok)
+static void
+searching_tokenizer_init (ESearchingTokenizer *tokenizer)
{
- ESearchingTokenizer *orig_st = E_SEARCHING_TOKENIZER (tok);
- ESearchingTokenizer *new_st = E_SEARCHING_TOKENIZER (e_searching_tokenizer_new ());
+ tokenizer->priv = E_SEARCHING_TOKENIZER_GET_PRIVATE (tokenizer);
+
+ tokenizer->priv->primary = search_info_new ();
+ search_info_set_flags (
+ tokenizer->priv->primary,
+ SEARCH_BOLD, SEARCH_CASE | SEARCH_BOLD);
+ search_info_set_color (tokenizer->priv->primary, "red");
+
+ tokenizer->priv->secondary = search_info_new ();
+ search_info_set_flags(
+ tokenizer->priv->secondary,
+ SEARCH_BOLD, SEARCH_CASE | SEARCH_BOLD);
+ search_info_set_color (tokenizer->priv->secondary, "purple");
+}
- search_info_free(new_st->priv->primary);
- search_info_free(new_st->priv->secondary);
+GType
+e_searching_tokenizer_get_type (void)
+{
+ static GType type = 0;
- new_st->priv->primary = search_info_clone(orig_st->priv->primary);
- new_st->priv->secondary = search_info_clone(orig_st->priv->secondary);
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ESearchingTokenizerClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) searching_tokenizer_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ESearchingTokenizer),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) searching_tokenizer_init,
+ NULL /* value_table */
+ };
-#if 0
- shared_state_ref (orig_st->priv->shared);
- shared_state_unref (new_st->priv->shared);
- new_st->priv->shared = orig_st->priv->shared;
-#endif
+ type = g_type_register_static (
+ HTML_TYPE_TOKENIZER, "ESearchingTokenizer",
+ &type_info, 0);
+ }
- g_signal_connect_swapped (new_st, "match", G_CALLBACK(matched), orig_st);
+ return type;
+}
- return HTML_TOKENIZER (new_st);
+ESearchingTokenizer *
+e_searching_tokenizer_new (void)
+{
+ return g_object_new (E_TYPE_SEARCHING_TOKENIZER, NULL);
}
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
void
-e_searching_tokenizer_set_primary_search_string (ESearchingTokenizer *st, const gchar *search_str)
+e_searching_tokenizer_set_primary_search_string (ESearchingTokenizer *tokenizer,
+ const gchar *primary_string)
{
- g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st));
+ g_return_if_fail (E_IS_SEARCHING_TOKENIZER (tokenizer));
- search_info_clear(st->priv->primary);
- search_info_add_string(st->priv->primary, search_str);
+ search_info_clear (tokenizer->priv->primary);
+ search_info_add_string (tokenizer->priv->primary, primary_string);
}
void
-e_searching_tokenizer_add_primary_search_string (ESearchingTokenizer *st, const gchar *search_str)
+e_searching_tokenizer_add_primary_search_string (ESearchingTokenizer *tokenizer,
+ const gchar *primary_string)
{
- g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st));
+ g_return_if_fail (E_IS_SEARCHING_TOKENIZER (tokenizer));
- search_info_add_string(st->priv->primary, search_str);
+ search_info_add_string (tokenizer->priv->primary, primary_string);
}
void
-e_searching_tokenizer_set_primary_case_sensitivity (ESearchingTokenizer *st, gboolean iscase)
+e_searching_tokenizer_set_primary_case_sensitivity (ESearchingTokenizer *tokenizer,
+ gboolean case_sensitive)
{
- g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st));
+ g_return_if_fail (E_IS_SEARCHING_TOKENIZER (tokenizer));
- search_info_set_flags(st->priv->primary, iscase?SEARCH_CASE:0, SEARCH_CASE);
+ search_info_set_flags (
+ tokenizer->priv->primary,
+ case_sensitive ? SEARCH_CASE : 0, SEARCH_CASE);
}
void
-e_searching_tokenizer_set_secondary_search_string (ESearchingTokenizer *st, const gchar *search_str)
+e_searching_tokenizer_set_secondary_search_string (ESearchingTokenizer *tokenizer,
+ const gchar *secondary_string)
{
- g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st));
+ g_return_if_fail (E_IS_SEARCHING_TOKENIZER (tokenizer));
- search_info_clear(st->priv->secondary);
- search_info_add_string(st->priv->secondary, search_str);
+ search_info_clear (tokenizer->priv->secondary);
+ search_info_add_string (tokenizer->priv->secondary, secondary_string);
}
void
-e_searching_tokenizer_add_secondary_search_string (ESearchingTokenizer *st, const gchar *search_str)
+e_searching_tokenizer_add_secondary_search_string (ESearchingTokenizer *tokenizer,
+ const gchar *secondary_string)
{
- g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st));
+ g_return_if_fail (E_IS_SEARCHING_TOKENIZER (tokenizer));
- search_info_add_string(st->priv->secondary, search_str);
+ search_info_add_string (tokenizer->priv->secondary, secondary_string);
}
void
-e_searching_tokenizer_set_secondary_case_sensitivity (ESearchingTokenizer *st, gboolean iscase)
+e_searching_tokenizer_set_secondary_case_sensitivity (ESearchingTokenizer *tokenizer,
+ gboolean case_sensitive)
{
- g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st));
+ g_return_if_fail (E_IS_SEARCHING_TOKENIZER (tokenizer));
- search_info_set_flags(st->priv->secondary, iscase?SEARCH_CASE:0, SEARCH_CASE);
+ search_info_set_flags (
+ tokenizer->priv->secondary,
+ case_sensitive ? SEARCH_CASE : 0, SEARCH_CASE);
}
/* Note: only returns the primary search string count */
gint
-e_searching_tokenizer_match_count (ESearchingTokenizer *st)
+e_searching_tokenizer_match_count (ESearchingTokenizer *tokenizer)
{
- g_return_val_if_fail (E_IS_SEARCHING_TOKENIZER (st), -1);
+ g_return_val_if_fail (E_IS_SEARCHING_TOKENIZER (tokenizer), -1);
- if (st->priv->engine && st->priv->primary->strv->len)
- return st->priv->engine->matchcount;
+ if (tokenizer->priv->engine && tokenizer->priv->primary->strv->len)
+ return tokenizer->priv->engine->matchcount;
return 0;
}
diff --git a/mail/e-searching-tokenizer.h b/mail/e-searching-tokenizer.h
index f96c37ed49..7eb603a25d 100644
--- a/mail/e-searching-tokenizer.h
+++ b/mail/e-searching-tokenizer.h
@@ -21,50 +21,72 @@
*
*/
-#ifndef __E_SEARCHING_TOKENIZER_H__
-#define __E_SEARCHING_TOKENIZER_H__
+#ifndef E_SEARCHING_TOKENIZER_H
+#define E_SEARCHING_TOKENIZER_H
#include <glib.h>
#include <gtkhtml/htmltokenizer.h>
-#define E_TYPE_SEARCHING_TOKENIZER (e_searching_tokenizer_get_type ())
-#define E_SEARCHING_TOKENIZER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_SEARCHING_TOKENIZER, ESearchingTokenizer))
-#define E_SEARCHING_TOKENIZER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_SEARCHING_TOKENIZER, ESearchingTokenizerClass))
-#define E_IS_SEARCHING_TOKENIZER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_SEARCHING_TOKENIZER))
-#define E_IS_SEARCHING_TOKENIZER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_SEARCHING_TOKENIZER))
+/* Standard GObject macros */
+#define E_TYPE_SEARCHING_TOKENIZER \
+ (e_searching_tokenizer_get_type ())
+#define E_SEARCHING_TOKENIZER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SEARCHING_TOKENIZER, ESearchingTokenizer))
+#define E_SEARCHING_TOKENIZER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SEARCHING_TOKENIZER, ESearchingTokenizerClass))
+#define E_IS_SEARCHING_TOKENIZER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SEARCHING_TOKENIZER))
+#define E_IS_SEARCHING_TOKENIZER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SEARCHING_TOKENIZER))
+#define E_SEARCH_TOKENIZER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SEARCHING_TOKENIZER, ESearchingTokenizerClass))
+
+G_BEGIN_DECLS
typedef struct _ESearchingTokenizer ESearchingTokenizer;
typedef struct _ESearchingTokenizerClass ESearchingTokenizerClass;
-
-struct _ESearchingTokenizerPrivate;
+typedef struct _ESearchingTokenizerPrivate ESearchingTokenizerPrivate;
struct _ESearchingTokenizer {
HTMLTokenizer parent;
-
- struct _ESearchingTokenizerPrivate *priv;
+ ESearchingTokenizerPrivate *priv;
};
struct _ESearchingTokenizerClass {
HTMLTokenizerClass parent_class;
- void (*match) (ESearchingTokenizer *);
+ void (*match) (ESearchingTokenizer *tokenizer);
};
-GType e_searching_tokenizer_get_type (void);
-
-ESearchingTokenizer *e_searching_tokenizer_new (void);
-
-/* For now, just a simple API */
-
-void e_searching_tokenizer_set_primary_search_string (ESearchingTokenizer *, const char *);
-void e_searching_tokenizer_add_primary_search_string (ESearchingTokenizer *, const char *);
-void e_searching_tokenizer_set_primary_case_sensitivity (ESearchingTokenizer *, gboolean is_case_sensitive);
-
-void e_searching_tokenizer_set_secondary_search_string (ESearchingTokenizer *, const char *);
-void e_searching_tokenizer_add_secondary_search_string (ESearchingTokenizer *st, const char *search_str);
-void e_searching_tokenizer_set_secondary_case_sensitivity (ESearchingTokenizer *, gboolean is_case_sensitive);
-
-
-int e_searching_tokenizer_match_count (ESearchingTokenizer *);
-
-#endif /* __E_SEARCHING_TOKENIZER_H__ */
+GType e_searching_tokenizer_get_type (void);
+ESearchingTokenizer *
+ e_searching_tokenizer_new (void);
+void e_searching_tokenizer_set_primary_search_string
+ (ESearchingTokenizer *tokenizer,
+ const gchar *primary_string);
+void e_searching_tokenizer_add_primary_search_string
+ (ESearchingTokenizer *tokenizer,
+ const gchar *primary_string);
+void e_searching_tokenizer_set_primary_case_sensitivity
+ (ESearchingTokenizer *tokenizer,
+ gboolean case_sensitive);
+void e_searching_tokenizer_set_secondary_search_string
+ (ESearchingTokenizer *tokenizer,
+ const gchar *secondary_string);
+void e_searching_tokenizer_add_secondary_search_string
+ (ESearchingTokenizer *tokenizer,
+ const gchar *secondary_string);
+void e_searching_tokenizer_set_secondary_case_sensitivity
+ (ESearchingTokenizer *tokenizer,
+ gboolean case_sensitive);
+gint e_searching_tokenizer_match_count
+ (ESearchingTokenizer *tokenizer);
+
+G_END_DECLS
+
+#endif /* E_SEARCHING_TOKENIZER_H */
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 2b13e7e015..e5f0f98001 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -51,10 +51,11 @@
#include <libgnomeui/gnome-druid.h>
#include <libgnomeui/gnome-druid-page-standard.h>
-#include <libedataserver/e-account-list.h>
#include <e-util/e-signature-list.h>
#include "e-util/e-error.h"
+#include "e-util/e-account-utils.h"
+#include "e-util/e-signature-utils.h"
#include "e-util/e-util-private.h"
#include "em-config.h"
@@ -62,14 +63,15 @@
#include "em-account-editor.h"
#include "mail-session.h"
#include "mail-send-recv.h"
-#include "mail-signature-editor.h"
-#include "mail-component.h"
+#include "e-signature-editor.h"
#include "em-utils.h"
#include "em-composer-prefs.h"
#include "mail-config.h"
#include "mail-ops.h"
#include "mail-mt.h"
+#include "e-mail-shell-backend.h"
+
#if defined (HAVE_NSS)
#include "smime/gui/e-cert-selector.h"
#endif
@@ -209,7 +211,7 @@ emae_finalise(GObject *o)
EMAccountEditorPrivate *p = emae->priv;
if (p->sig_added_id) {
- ESignatureList *signatures = mail_config_get_signatures();
+ ESignatureList *signatures = e_get_signature_list ();
g_signal_handler_disconnect(signatures, p->sig_added_id);
g_signal_handler_disconnect(signatures, p->sig_removed_id);
@@ -467,11 +469,13 @@ default_folders_clicked (GtkButton *button, gpointer user_data)
EMAccountEditor *emae = user_data;
const char *uri;
- uri = mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_DRAFTS);
+ uri = e_mail_shell_backend_get_folder_uri (
+ global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
em_folder_selection_button_set_selection((EMFolderSelectionButton *)emae->priv->drafts_folder_button, uri);
emae_account_folder_changed((EMFolderSelectionButton *)emae->priv->drafts_folder_button, emae);
- uri = mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_SENT);
+ uri = e_mail_shell_backend_get_folder_uri (
+ global_mail_shell_backend, E_MAIL_FOLDER_SENT);
em_folder_selection_button_set_selection((EMFolderSelectionButton *)emae->priv->sent_folder_button, uri);
emae_account_folder_changed((EMFolderSelectionButton *)emae->priv->sent_folder_button, emae);
}
@@ -482,7 +486,10 @@ GtkWidget *em_account_editor_folder_selector_button_new (char *widget_name, char
GtkWidget *
em_account_editor_folder_selector_button_new (char *widget_name, char *string1, char *string2, int int1, int int2)
{
- return (GtkWidget *)em_folder_selection_button_new(string1 ? string1 : _("Select Folder"), NULL);
+ EMFolderTreeModel *model;
+
+ model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend);
+ return (GtkWidget *)em_folder_selection_button_new(model, string1 ? string1 : _("Select Folder"), NULL);
}
GtkWidget *em_account_editor_dropdown_new(char *widget_name, char *string1, char *string2, int int1, int int2);
@@ -675,10 +682,19 @@ emae_signaturetype_changed(GtkComboBox *dropdown, EMAccountEditor *emae)
static void
emae_signature_new(GtkWidget *w, EMAccountEditor *emae)
{
- /* TODO: why is this in composer prefs? apart from it being somewhere to put it? */
- em_composer_prefs_new_signature((GtkWindow *)gtk_widget_get_toplevel(w),
- gconf_client_get_bool(mail_config_get_gconf_client(),
- "/apps/evolution/mail/composer/send_html", NULL));
+ EShell *shell;
+ EShellSettings *shell_settings;
+ GtkWidget *parent;
+ gboolean html_mode;
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+ parent = gtk_widget_get_toplevel (w);
+
+ html_mode = e_shell_settings_get_boolean (
+ shell_settings, "composer-format-html");
+
+ em_composer_prefs_new_signature (GTK_WINDOW (parent), html_mode);
}
static GtkWidget *
@@ -703,7 +719,7 @@ emae_setup_signatures(EMAccountEditor *emae, GladeXML *xml)
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, _("None"), 1, NULL, -1);
- signatures = mail_config_get_signatures ();
+ signatures = e_get_signature_list ();
if (p->sig_added_id == 0) {
p->sig_added_id = g_signal_connect(signatures, "signature-added", G_CALLBACK(emae_signature_added), emae);
@@ -909,7 +925,11 @@ emae_account_folder(EMAccountEditor *emae, const char *name, int item, int deffo
em_folder_selection_button_set_selection(folder, tmp);
g_free(tmp);
} else {
- em_folder_selection_button_set_selection(folder, mail_component_get_folder_uri(NULL, deffolder));
+ const gchar *uri;
+
+ uri = e_mail_shell_backend_get_folder_uri (
+ global_mail_shell_backend, deffolder);
+ em_folder_selection_button_set_selection(folder, uri);
}
g_object_set_data((GObject *)folder, "account-item", GINT_TO_POINTER(item));
@@ -1402,8 +1422,8 @@ emae_refresh_providers(EMAccountEditor *emae, EMAccountEditorService *service)
int active = 0, i;
struct _service_info *info = &emae_service_info[service->type];
const char *uri = e_account_get_string(account, info->account_uri_key);
- const char *tmp;
char *current = NULL;
+ const gchar *tmp;
CamelURL *url;
dropdown = service->providers;
@@ -1815,8 +1835,8 @@ emae_identity_page(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, st
gui->management_frame = glade_xml_get_widget(xml, "management_frame");
gui->default_account = GTK_TOGGLE_BUTTON (glade_xml_get_widget (xml, "management_default"));
- if (!mail_config_get_default_account ()
- || (account == mail_config_get_default_account ())
+ if (!e_get_default_account ()
+ || (account == e_get_default_account ())
|| (GPOINTER_TO_INT(g_object_get_data (G_OBJECT (emae->account), "default_flagged"))) )
gtk_toggle_button_set_active (gui->default_account, TRUE);
@@ -2401,8 +2421,8 @@ emae_defaults_page(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, st
g_free (gladefile);
/* Special folders */
- gui->drafts_folder_button = (GtkButton *)emae_account_folder(emae, "drafts_button", E_ACCOUNT_DRAFTS_FOLDER_URI, MAIL_COMPONENT_FOLDER_DRAFTS, xml);
- gui->sent_folder_button = (GtkButton *)emae_account_folder(emae, "sent_button", E_ACCOUNT_SENT_FOLDER_URI, MAIL_COMPONENT_FOLDER_SENT, xml);
+ gui->drafts_folder_button = (GtkButton *)emae_account_folder(emae, "drafts_button", E_ACCOUNT_DRAFTS_FOLDER_URI, E_MAIL_FOLDER_DRAFTS, xml);
+ gui->sent_folder_button = (GtkButton *)emae_account_folder(emae, "sent_button", E_ACCOUNT_SENT_FOLDER_URI, E_MAIL_FOLDER_SENT, xml);
/* Special Folders "Reset Defaults" button */
gui->restore_folders_button = (GtkButton *)glade_xml_get_widget (xml, "default_folders_button");
@@ -2832,7 +2852,6 @@ emae_check_complete(EConfig *ec, const char *pageid, void *data)
g_warning("buz2\n");
}
-
} else if (!strcmp(pageid, "20.receive_options")) {
if (emae->priv->source.provider
&& emae->priv->extra_provider != emae->priv->source.provider) {
@@ -2849,7 +2868,7 @@ emae_check_complete(EConfig *ec, const char *pageid, void *data)
len = strlen(tmp);
template = alloca(len + 14);
strcpy(template, tmp);
- while (mail_config_get_account_by_name(template))
+ while (e_get_account_by_name (template))
sprintf(template + len, " (%d)", i++);
gtk_entry_set_text(emae->priv->identity_entries[0], template);
@@ -2902,7 +2921,7 @@ emae_check_complete(EConfig *ec, const char *pageid, void *data)
if (ok && (pageid == NULL || !strcmp(pageid, "40.management"))) {
ok = (tmp = e_account_get_string(emae->account, E_ACCOUNT_NAME))
&& tmp[0]
- && ((ea = mail_config_get_account_by_name(tmp)) == NULL
+ && ((ea = e_get_account_by_name (tmp)) == NULL
|| ea == emae->original);
if (!ok) {
d(printf("management page incomplete\n"));
@@ -2922,6 +2941,7 @@ em_account_editor_check (EMAccountEditor *emae, const char *page)
static void
add_new_store (char *uri, CamelStore *store, void *user_data)
{
+#if 0 /* KILL-BONOBO: Try to actually fix this? */
MailComponent *component = mail_component_peek ();
EAccount *account = user_data;
@@ -2929,13 +2949,14 @@ add_new_store (char *uri, CamelStore *store, void *user_data)
return;
mail_component_add_store (component, store, account->name);
+#endif
}
static void
emae_commit(EConfig *ec, GSList *items, void *data)
{
EMAccountEditor *emae = data;
- EAccountList *accounts = mail_config_get_accounts();
+ EAccountList *accounts = e_get_account_list ();
EAccount *account;
/* the mail-config*acconts* api needs a lot of work */
@@ -3001,13 +3022,21 @@ em_account_editor_construct(EMAccountEditor *emae, EAccount *account, em_account
emae->do_signature = TRUE;
} else {
+ const gchar *uri;
+
/* TODO: have a get_default_account thing?? */
emae->account = e_account_new();
emae->account->enabled = TRUE;
- e_account_set_string(emae->account, E_ACCOUNT_DRAFTS_FOLDER_URI,
- mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_DRAFTS));
- e_account_set_string(emae->account, E_ACCOUNT_SENT_FOLDER_URI,
- mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_SENT));
+
+ uri = e_mail_shell_backend_get_folder_uri (
+ global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
+ e_account_set_string (
+ emae->account, E_ACCOUNT_DRAFTS_FOLDER_URI, uri);
+
+ uri = e_mail_shell_backend_get_folder_uri (
+ global_mail_shell_backend, E_MAIL_FOLDER_SENT);
+ e_account_set_string (
+ emae->account, E_ACCOUNT_SENT_FOLDER_URI, uri);
}
/* sort the providers, remote first */
diff --git a/mail/em-account-prefs.c b/mail/em-account-prefs.c
index d2303aa73b..82342de3c9 100644
--- a/mail/em-account-prefs.c
+++ b/mail/em-account-prefs.c
@@ -1,4 +1,6 @@
/*
+ * em-account-prefs.c
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,13 +15,17 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Jeffrey Stedfast <fejj@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
+/* XXX EAccountManager handles all the user interface stuff. This subclass
+ * applies policies using mailer resources that EAccountManager does not
+ * have access to. The desire is to someday move account management
+ * completely out of the mailer, perhaps to evolution-data-server. */
+
+#include "em-account-prefs.h"
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -28,550 +34,294 @@
#include <glib/gi18n.h>
-#include "mail-component.h"
-#include "mail-config.h"
-#include "mail-ops.h"
-#include "mail-send-recv.h"
-
-#include "libedataserver/e-account-list.h"
#include "e-util/e-error.h"
-#include "e-util/e-util-private.h"
-
-#include "em-account-prefs.h"
+#include "em-config.h"
#include "em-account-editor.h"
+#include "e-mail-shell-backend.h"
-static void em_account_prefs_class_init (EMAccountPrefsClass *class);
-static void em_account_prefs_init (EMAccountPrefs *prefs);
-static void em_account_prefs_finalise (GObject *obj);
-static void em_account_prefs_destroy (GtkObject *object);
-
-static void mail_accounts_load (EMAccountPrefs *prefs);
-
-
-static GtkVBoxClass *parent_class = NULL;
+#define EM_ACCOUNT_PREFS_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_ACCOUNT_PREFS, EMAccountPrefsPrivate))
+struct _EMAccountPrefsPrivate {
+ gpointer druid; /* weak pointer */
+ gpointer editor; /* weak pointer */
+};
-#define PREFS_WINDOW(prefs) GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (prefs), GTK_TYPE_WINDOW))
+static gpointer parent_class;
-
-GType
-em_account_prefs_get_type (void)
+static void
+account_prefs_enable_account_cb (EAccountTreeView *tree_view)
{
- static GType type = 0;
+ EAccount *account;
- if (!type) {
- GTypeInfo type_info = {
- sizeof (EMAccountPrefsClass),
- NULL, NULL,
- (GClassInitFunc) em_account_prefs_class_init,
- NULL, NULL,
- sizeof (EMAccountPrefs),
- 0,
- (GInstanceInitFunc) em_account_prefs_init,
- };
-
- type = g_type_register_static (gtk_vbox_get_type (), "EMAccountPrefs", &type_info, 0);
- }
+ account = e_account_tree_view_get_selected (tree_view);
+ g_return_if_fail (account != NULL);
- return type;
+ e_mail_shell_backend_load_store_by_uri (
+ global_mail_shell_backend,
+ account->source->url, account->name);
}
static void
-em_account_prefs_class_init (EMAccountPrefsClass *klass)
+account_prefs_disable_account_cb (EAccountTreeView *tree_view)
{
- GtkObjectClass *gtk_object_class = (GtkObjectClass *) klass;
- GObjectClass *object_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_ref (gtk_vbox_get_type ());
+ EAccountList *account_list;
+ EAccount *account;
+ gpointer parent;
+ gint response;
- gtk_object_class->destroy = em_account_prefs_destroy;
-
- object_class->finalize = em_account_prefs_finalise;
-}
+ account = e_account_tree_view_get_selected (tree_view);
+ g_return_if_fail (account != NULL);
-static void
-em_account_prefs_init (EMAccountPrefs *prefs)
-{
- prefs->druid = NULL;
- prefs->editor = NULL;
-}
+ account_list = e_account_tree_view_get_account_list (tree_view);
+ g_return_if_fail (account_list != NULL);
-static void
-em_account_prefs_destroy (GtkObject *obj)
-{
- EMAccountPrefs *prefs = (EMAccountPrefs *) obj;
+ if (!e_account_list_account_has_proxies (account_list, account))
+ return;
- prefs->destroyed = TRUE;
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (tree_view));
+ parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
- GTK_OBJECT_CLASS (parent_class)->destroy (obj);
-}
+ response = e_error_run (
+ parent, "mail:ask-delete-proxy-accounts", NULL);
-static void
-em_account_prefs_finalise (GObject *obj)
-{
- EMAccountPrefs *prefs = (EMAccountPrefs *) obj;
+ if (response != GTK_RESPONSE_YES) {
+ g_signal_stop_emission_by_name (tree_view, "disable-account");
+ return;
+ }
- g_object_unref (prefs->gui);
+ e_account_list_remove_account_proxies (account_list, account);
- G_OBJECT_CLASS (parent_class)->finalize (obj);
+ e_mail_shell_backend_remove_store_by_uri (
+ global_mail_shell_backend, account->source->url);
}
static void
-account_add_finished (EMAccountPrefs *prefs, GObject *deadbeef)
+account_prefs_add_account (EAccountManager *manager)
{
- /* Either Cancel or Finished was clicked in the druid so reload the accounts */
- prefs->druid = NULL;
+ EMAccountPrefsPrivate *priv;
+ EMAccountEditor *emae;
+ gpointer parent;
- if (!prefs->destroyed)
- mail_accounts_load (prefs);
+ priv = EM_ACCOUNT_PREFS_GET_PRIVATE (manager);
- g_object_unref (prefs);
-}
-
-#include "em-config.h"
-
-static void
-account_add_clicked (GtkButton *button, gpointer user_data)
-{
- EMAccountPrefs *prefs = (EMAccountPrefs *) user_data;
-
- if (prefs->druid == NULL) {
- EMAccountEditor *emae;
-
- /** @HookPoint-EMConfig: New Mail Account Druid
- * @Id: org.gnome.evolution.mail.config.accountDruid
- * @Type: E_CONFIG_DRUID
- * @Class: org.gnome.evolution.mail.config:1.0
- * @Target: EMConfigTargetAccount
- *
- * The new mail account druid.
- */
- emae = em_account_editor_new(NULL, EMAE_DRUID, "org.gnome.evolution.mail.config.accountDruid");
- prefs->druid = emae->editor;
-
- gtk_window_set_transient_for((GtkWindow *)prefs->druid, (GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)prefs));
- g_object_ref(prefs);
- /* rather nasty hack to reload the accounts, it should just listen to the e-account-list */
- g_object_weak_ref((GObject *) prefs->druid, (GWeakNotify) account_add_finished, prefs);
- gtk_widget_show(emae->editor);
- } else {
- gdk_window_raise (prefs->druid->window);
+ if (priv->druid != NULL) {
+ gtk_window_present (GTK_WINDOW (priv->druid));
+ return;
}
+
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+ parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
+ /** @HookPoint-EMConfig: New Mail Account Druid
+ * @Id: org.gnome.evolution.mail.config.accountDruid
+ * @Type: E_CONFIG_DRUID
+ * @Class: org.gnome.evolution.mail.config:1.0
+ * @Target: EMConfigTargetAccount
+ *
+ * The new mail account druid.
+ */
+ emae = em_account_editor_new (
+ NULL, EMAE_DRUID,
+ "org.gnome.evolution.mail.config.accountDruid");
+ priv->druid = emae->editor;
+
+ g_object_add_weak_pointer (G_OBJECT (priv->druid), &priv->druid);
+ gtk_window_set_transient_for (GTK_WINDOW (priv->druid), parent);
+ gtk_widget_show (priv->druid);
}
static void
-account_edit_finished (EMAccountPrefs *prefs, GObject *deadbeef)
+account_prefs_edit_account (EAccountManager *manager)
{
- prefs->editor = NULL;
-
- if (!prefs->destroyed)
- mail_accounts_load (prefs);
+ EMAccountPrefsPrivate *priv;
+ EMAccountEditor *emae;
+ EAccountTreeView *tree_view;
+ EAccountList *account_list;
+ EAccount *account;
+ gpointer parent;
- g_object_unref (prefs);
-}
+ priv = EM_ACCOUNT_PREFS_GET_PRIVATE (manager);
-static void
-account_edit_clicked (GtkButton *button, gpointer user_data)
-{
- EMAccountPrefs *prefs = (EMAccountPrefs *) user_data;
-
- if (prefs->editor == NULL) {
- GtkTreeSelection *selection;
- EAccount *account = NULL;
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- selection = gtk_tree_view_get_selection (prefs->table);
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- gtk_tree_model_get (model, &iter, 3, &account, -1);
-
- if (account && !account->parent_uid && !mail_config_has_proxies (account)) {
- EMAccountEditor *emae;
-
- /** @HookPoint-EMConfig: Mail Account Editor
- * @Id: org.gnome.evolution.mail.config.accountEditor
- * @Type: E_CONFIG_BOOK
- * @Class: org.gnome.evolution.mail.config:1.0
- * @Target: EMConfigTargetAccount
- *
- * The account editor window.
- */
- emae = em_account_editor_new(account, EMAE_NOTEBOOK, "org.gnome.evolution.mail.config.accountEditor");
- prefs->editor = emae->editor;
-
- gtk_window_set_transient_for((GtkWindow *)prefs->editor, (GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)prefs));
- g_object_ref(prefs);
- /* rather nasty hack to reload the accounts, it should just listen to the e-account-list */
- g_object_weak_ref((GObject *)prefs->editor, (GWeakNotify) account_edit_finished, prefs);
- gtk_widget_show(emae->editor);
- }
- } else {
- gdk_window_raise (prefs->editor->window);
+ if (priv->editor != NULL) {
+ gtk_window_present (GTK_WINDOW (priv->editor));
+ return;
}
+
+ account_list = e_account_manager_get_account_list (manager);
+ tree_view = e_account_manager_get_tree_view (manager);
+ account = e_account_tree_view_get_selected (tree_view);
+ g_return_if_fail (account != NULL);
+
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+ parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
+ /** @HookPoint-EMConfig: Mail Account Editor
+ * @Id: org.gnome.evolution.mail.config.accountEditor
+ * @Type: E_CONFIG_BOOK
+ * @Class: org.gnome.evolution.mail.config:1.0
+ * @Target: EMConfigTargetAccount
+ *
+ * The account editor window.
+ */
+ emae = em_account_editor_new (
+ account, EMAE_NOTEBOOK,
+ "org.gnome.evolution.mail.config.accountEditor");
+ priv->editor = emae->editor;
+
+ g_object_add_weak_pointer (G_OBJECT (priv->editor), &priv->editor);
+ gtk_window_set_transient_for (GTK_WINDOW (priv->editor), parent);
+ gtk_widget_show (priv->editor);
}
static void
-account_delete_clicked (GtkButton *button, gpointer user_data)
+account_prefs_delete_account (EAccountManager *manager)
{
- EMAccountPrefs *prefs = user_data;
- GtkTreeSelection *selection;
- EAccount *account = NULL;
- EAccountList *accounts;
- GtkTreeModel *model;
- GtkTreeIter iter;
- int ans;
- gboolean has_proxies = FALSE;
-
- selection = gtk_tree_view_get_selection (prefs->table);
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- gtk_tree_model_get (model, &iter, 3, &account, -1);
-
- /* make sure we have a valid account selected and that we aren't editing anything... */
- if (account == NULL || prefs->editor != NULL)
+ EMAccountPrefsPrivate *priv;
+ EAccountTreeView *tree_view;
+ EAccountList *account_list;
+ EAccount *account;
+ gboolean has_proxies;
+ gpointer parent;
+ gint response;
+
+ priv = EM_ACCOUNT_PREFS_GET_PRIVATE (manager);
+
+ account_list = e_account_manager_get_account_list (manager);
+ tree_view = e_account_manager_get_tree_view (manager);
+ account = e_account_tree_view_get_selected (tree_view);
+ g_return_if_fail (account != NULL);
+
+ /* Make sure we aren't editing anything... */
+ if (priv->editor != NULL)
return;
- has_proxies = mail_config_has_proxies (account);
- ans = e_error_run(PREFS_WINDOW(prefs), has_proxies?"mail:ask-delete-account-with-proxies":"mail:ask-delete-account",NULL);
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+ parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
- if (ans == GTK_RESPONSE_YES) {
- int len;
+ has_proxies =
+ e_account_list_account_has_proxies (account_list, account);
- /* remove it from the folder-tree in the shell */
- if (account->enabled && account->source && account->source->url)
- mail_component_remove_store_by_uri (mail_component_peek (), account->source->url);
+ response = e_error_run (
+ parent, has_proxies ?
+ "mail:ask-delete-account-with-proxies" :
+ "mail:ask-delete-account", NULL);
- /* remove all the proxies account has created*/
- if (has_proxies)
- mail_config_remove_account_proxies (account);
-
- /* remove it from the config file */
- mail_config_remove_account (account);
- accounts = mail_config_get_accounts ();
-
- mail_config_write ();
-
- gtk_list_store_remove ((GtkListStore *) model, &iter);
-
- len = e_list_length ((EList *) accounts);
- if (len > 0) {
- if ( !gtk_list_store_iter_is_valid ((GtkListStore *) model, &iter))
- gtk_tree_model_get_iter_first (model, &iter);
-
- gtk_tree_selection_select_iter (selection, &iter);
- } else {
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), FALSE);
- }
+ if (response != GTK_RESPONSE_YES) {
+ g_signal_stop_emission_by_name (manager, "delete-account");
+ return;
}
-}
-static void
-account_default_clicked (GtkButton *button, gpointer user_data)
-{
- EMAccountPrefs *prefs = user_data;
- GtkTreeSelection *selection;
- EAccount *account = NULL;
- GtkTreeModel *model;
- GtkTreeIter iter;
+ /* Remove the account from the folder tree. */
+ if (account->enabled && account->source && account->source->url)
+ e_mail_shell_backend_remove_store_by_uri (
+ global_mail_shell_backend, account->source->url);
- selection = gtk_tree_view_get_selection (prefs->table);
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- gtk_tree_model_get (model, &iter, 3, &account, -1);
+ /* Remove all the proxies the account has created. */
+ if (has_proxies)
+ e_account_list_remove_account_proxies (account_list, account);
- if (account) {
- mail_config_set_default_account (account);
+ /* Remove it from the config file. */
+ e_account_list_remove (account_list, account);
- mail_config_write ();
-
- mail_accounts_load (prefs);
- }
+ e_account_list_save (account_list);
}
static void
-account_able_changed(EAccount *account)
+account_prefs_dispose (GObject *object)
{
- MailComponent *component = mail_component_peek ();
+ EMAccountPrefsPrivate *priv;
- /* FIXME: do this directly by listening to the mail accounts changed events in the relevant components */
+ priv = EM_ACCOUNT_PREFS_GET_PRIVATE (object);
- if (account->source->url) {
- if (account->enabled)
- mail_component_load_store_by_uri (component,
- account->source->url,
- account->name);
- else
- mail_component_remove_store_by_uri (component, account->source->url);
+ if (priv->druid != NULL) {
+ g_object_remove_weak_pointer (
+ G_OBJECT (priv->druid), &priv->druid);
+ priv->druid = NULL;
}
- mail_config_write ();
-}
-
-static void
-account_able_toggled (GtkCellRendererToggle *renderer, char *arg1, gpointer user_data)
-{
- EMAccountPrefs *prefs = user_data;
- GtkTreeSelection *selection;
- EAccount *account = NULL;
- GtkTreeModel *model;
- GtkTreePath *path;
- GtkTreeIter iter;
-
- path = gtk_tree_path_new_from_string (arg1);
- model = gtk_tree_view_get_model (prefs->table);
- selection = gtk_tree_view_get_selection (prefs->table);
-
- if (gtk_tree_model_get_iter (model, &iter, path)) {
- gtk_tree_model_get (model, &iter, 3, &account, -1);
-
- if (mail_config_has_proxies (account)) {
- int ans;
-
- ans = e_error_run(PREFS_WINDOW(prefs), "mail:ask-delete-proxy-accounts",NULL);
-
- if (ans == GTK_RESPONSE_NO) {
- gtk_tree_path_free (path);
- return;
- }
-
- mail_config_remove_account_proxies (account);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), 1);
- }
-
- account->enabled = !account->enabled;
- e_account_list_change(mail_config_get_accounts(), account);
- account_able_changed (account);
- gtk_list_store_set ((GtkListStore *) model, &iter, 0, account->enabled, -1);
-
- /* let the rest of the application know it changed */
+ if (priv->editor != NULL) {
+ g_object_remove_weak_pointer (
+ G_OBJECT (priv->editor), &priv->editor);
+ priv->editor = NULL;
}
- gtk_tree_path_free (path);
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-account_double_click (GtkTreeView *treeview, GtkTreePath *path,
- GtkTreeViewColumn *column, EMAccountPrefs *prefs)
+account_prefs_class_init (EMAccountPrefsClass *class)
{
- account_edit_clicked (NULL, prefs);
-}
+ GObjectClass *object_class;
+ EAccountManagerClass *account_manager_class;
-static void
-account_cursor_change (GtkTreeSelection *selection, EMAccountPrefs *prefs)
-{
- EAccount *account = NULL;
- GtkTreeModel *model;
- GtkTreeIter iter;
- const char *url = NULL;
- int state;
- EAccount *default_account;
- default_account = mail_config_get_default_account ();
-
- state = gconf_client_key_is_writable(mail_config_get_gconf_client(), "/apps/evolution/mail/accounts", NULL);
- if (state) {
- state = gtk_tree_selection_get_selected (selection, &model, &iter);
- if (state) {
- gtk_tree_model_get (model, &iter, 3, &account, -1);
- url = e_account_get_string (account, E_ACCOUNT_SOURCE_URL);
- } else {
- gtk_widget_grab_focus (GTK_WIDGET (prefs->mail_add));
- }
- gtk_widget_set_sensitive (GTK_WIDGET (prefs), TRUE);
- } else {
- gtk_widget_set_sensitive (GTK_WIDGET (prefs), FALSE);
- }
-
- if( url != NULL )
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), !mail_config_has_proxies(account));
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMAccountPrefsPrivate));
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), state);
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = account_prefs_dispose;
- if(account == default_account)
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), FALSE);
- else
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), state);
+ account_manager_class = E_ACCOUNT_MANAGER_CLASS (class);
+ account_manager_class->add_account = account_prefs_add_account;
+ account_manager_class->edit_account = account_prefs_edit_account;
+ account_manager_class->delete_account = account_prefs_delete_account;
}
static void
-mail_accounts_load (EMAccountPrefs *prefs)
-{
- EAccount *default_account;
- EAccountList *accounts;
- GtkListStore *model;
- GtkTreeIter iter;
- char *name, *val;
- EIterator *node;
- int row = 0;
- GtkTreeSelection *selection;
-
- model = (GtkListStore *) gtk_tree_view_get_model (prefs->table);
- gtk_list_store_clear (model);
-
- default_account = mail_config_get_default_account ();
-
- accounts = mail_config_get_accounts ();
- node = e_list_get_iterator ((EList *) accounts);
- selection = gtk_tree_view_get_selection(prefs->table);
-
- while (e_iterator_is_valid (node)) {
- EAccount *account;
- CamelURL *url;
-
- account = (EAccount *) e_iterator_get (node);
-
- if (!account->parent_uid) {
- url = account->source && account->source->url ? camel_url_new (account->source->url, NULL) : NULL;
-
- gtk_list_store_append (model, &iter);
- if (account == default_account) {
- /* translators: default account indicator */
- name = val = g_strdup_printf ("%s %s", account->name, _("[Default]"));
- } else {
- val = account->name;
- name = NULL;
- }
-
- gtk_list_store_set (model, &iter,
- 0, account->enabled,
- 1, val,
- 2, url && url->protocol ? url->protocol : (char *) _("None"),
- 3, account,
- -1);
- g_free (name);
-
- if (url)
- camel_url_free (url);
-
- /* select the first row by default */
- if (row == 0 && !prefs->changed)
- gtk_tree_selection_select_iter (selection, &iter);
- row++;
- }
-
- e_iterator_next (node);
- }
-
- g_object_unref (node);
-}
-
-
-
-GtkWidget *em_account_prefs_treeview_new (char *widget_name, char *string1, char *string2,
- int int1, int int2);
-
-GtkWidget *
-em_account_prefs_treeview_new (char *widget_name, char *string1, char *string2, int int1, int int2)
+account_prefs_init (EMAccountPrefs *prefs)
{
- GtkWidget *table, *scrolled;
- GtkTreeSelection *selection;
- GtkCellRenderer *renderer;
- GtkListStore *model;
-
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN);
-
- renderer = gtk_cell_renderer_toggle_new ();
- g_object_set ((GObject *) renderer, "activatable", TRUE, NULL);
-
- model = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
- table = gtk_tree_view_new_with_model ((GtkTreeModel *) model);
- g_object_unref (model);
- gtk_tree_view_insert_column_with_attributes ((GtkTreeView *) table, -1, _("Enabled"),
- renderer, "active", 0, NULL);
-
- g_object_set_data ((GObject *) scrolled, "renderer", renderer);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes ((GtkTreeView *) table, -1, _("Account name"),
- renderer, "text", 1, NULL);
- gtk_tree_view_insert_column_with_attributes ((GtkTreeView *)table, -1, _("Protocol"),
- renderer, "text", 2, NULL);
- selection = gtk_tree_view_get_selection ((GtkTreeView *) table);
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- gtk_tree_view_set_headers_visible ((GtkTreeView *) table, TRUE);
- atk_object_set_name (gtk_widget_get_accessible (table), _("Mail Accounts"));
-
-
- /* FIXME: column auto-resize? */
- /* Is this needed?
- gtk_tree_view_column_set_alignment (gtk_tree_view_get_column (prefs->table, 0), 1.0);*/
+ EAccountManager *manager;
+ EAccountTreeView *tree_view;
- gtk_container_add (GTK_CONTAINER (scrolled), table);
+ prefs->priv = EM_ACCOUNT_PREFS_GET_PRIVATE (prefs);
- g_object_set_data ((GObject *) scrolled, "table", table);
+ manager = E_ACCOUNT_MANAGER (prefs);
+ tree_view = e_account_manager_get_tree_view (manager);
- gtk_widget_show (scrolled);
- gtk_widget_show (table);
+ g_signal_connect (
+ tree_view, "enable-account",
+ G_CALLBACK (account_prefs_enable_account_cb), NULL);
- return scrolled;
+ g_signal_connect (
+ tree_view, "disable-account",
+ G_CALLBACK (account_prefs_disable_account_cb), NULL);
}
-static void
-em_account_prefs_construct (EMAccountPrefs *prefs)
+GType
+em_account_prefs_get_type (void)
{
- GtkWidget *toplevel, *widget;
- GtkCellRenderer *renderer;
- GladeXML *gui;
- char *gladefile;
-
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- "mail-config.glade",
- NULL);
- gui = glade_xml_new (gladefile, "accounts_tab", NULL);
- g_free (gladefile);
-
- prefs->gui = gui;
-
- /* get our toplevel widget */
- toplevel = glade_xml_get_widget (gui, "toplevel");
-
- /* reparent */
- g_object_ref (toplevel);
- gtk_container_remove (GTK_CONTAINER (toplevel->parent), toplevel);
- gtk_container_add (GTK_CONTAINER (prefs), toplevel);
- g_object_unref (toplevel);
-
- widget = glade_xml_get_widget (gui, "etableMailAccounts");
-
- prefs->table = (GtkTreeView *) g_object_get_data ((GObject *) widget, "table");
-
- renderer = g_object_get_data ((GObject *) widget, "renderer");
- g_signal_connect (renderer, "toggled", G_CALLBACK (account_able_toggled), prefs);
-
- prefs->changed = FALSE;
- mail_accounts_load (prefs);
- prefs->changed = TRUE;
-
- prefs->mail_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountAdd"));
- g_signal_connect (prefs->mail_add, "clicked", G_CALLBACK (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);
-
- prefs->mail_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountDelete"));
- g_signal_connect (prefs->mail_delete, "clicked", G_CALLBACK (account_delete_clicked), prefs);
+ static GType type = 0;
- prefs->mail_default = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountDefault"));
- g_signal_connect (prefs->mail_default, "clicked", G_CALLBACK (account_default_clicked), prefs);
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMAccountPrefsClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) account_prefs_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMAccountPrefs),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) account_prefs_init,
+ NULL /* value_table */
+ };
- g_signal_connect (gtk_tree_view_get_selection (prefs->table),
- "changed", G_CALLBACK (account_cursor_change), prefs);
- g_signal_connect (prefs->table, "row-activated", G_CALLBACK (account_double_click), prefs);
+ type = g_type_register_static (
+ E_TYPE_ACCOUNT_MANAGER, "EMAccountPrefs",
+ &type_info, 0);
+ }
- account_cursor_change(gtk_tree_view_get_selection(prefs->table), prefs);
+ return type;
}
GtkWidget *
-em_account_prefs_new (GNOME_Evolution_Shell shell)
+em_account_prefs_new (EAccountList *account_list)
{
- EMAccountPrefs *new;
-
- new = (EMAccountPrefs *) g_object_new (em_account_prefs_get_type (), NULL);
- em_account_prefs_construct (new);
- new->shell = shell;
+ g_return_val_if_fail (E_IS_ACCOUNT_LIST (account_list), NULL);
- return (GtkWidget *) new;
+ return g_object_new (
+ EM_TYPE_ACCOUNT_PREFS, "account-list", account_list, NULL);
}
diff --git a/mail/em-account-prefs.h b/mail/em-account-prefs.h
index 0dabc8a11a..82df8fa941 100644
--- a/mail/em-account-prefs.h
+++ b/mail/em-account-prefs.h
@@ -1,4 +1,5 @@
/*
+ * em-account-prefs.h
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -14,78 +15,55 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Jeffrey Stedfast <fejj@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifndef __EM_ACCOUNT_PREFS_H__
-#define __EM_ACCOUNT_PREFS_H__
+#ifndef EM_ACCOUNT_PREFS_H
+#define EM_ACCOUNT_PREFS_H
#include <gtk/gtk.h>
-#include <glade/glade.h>
-
#include <table/e-table.h>
-
-#include "evolution-config-control.h"
-
-#include <shell/Evolution.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-
-#define EM_ACCOUNT_PREFS_TYPE (em_account_prefs_get_type ())
-#define EM_ACCOUNT_PREFS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EM_ACCOUNT_PREFS_TYPE, EMAccountPrefs))
-#define EM_ACCOUNT_PREFS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EM_ACCOUNT_PREFS_TYPE, EMAccountPrefsClass))
-#define EM_IS_ACCOUNT_PREFS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EM_ACCOUNT_PREFS_TYPE))
-#define EM_IS_ACCOUNT_PREFS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EM_ACCOUNT_PREFS_TYPE))
+#include <libedataserver/e-account-list.h>
+#include <misc/e-account-manager.h>
+
+/* Standard GObject macros */
+#define EM_TYPE_ACCOUNT_PREFS \
+ (em_account_prefs_get_type ())
+#define EM_ACCOUNT_PREFS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_TYPE_ACCOUNT_PREFS, EMAccountPrefs))
+#define EM_ACCOUNT_PREFS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_TYPE_ACCOUNT_PREFS, EMAccountPrefsClass))
+#define EM_IS_ACCOUNT_PREFS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_TYPE_ACCOUNT_PREFS))
+#define EM_IS_ACCOUNT_PREFS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EM_TYPE_ACCOUNT_PREFS))
+#define EM_ACCOUNT_PREFS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_TYPE_ACCOUNT_PREFS, EMAccountPrefsClass))
+
+G_BEGIN_DECLS
typedef struct _EMAccountPrefs EMAccountPrefs;
typedef struct _EMAccountPrefsClass EMAccountPrefsClass;
+typedef struct _EMAccountPrefsPrivate EMAccountPrefsPrivate;
struct _EMAccountPrefs {
- GtkVBox parent_object;
-
- GNOME_Evolution_Shell shell;
-
- GladeXML *gui;
-
- GtkWidget *druid;
- GtkWidget *editor;
-
- GtkTreeView *table;
-
- GtkButton *mail_add;
- GtkButton *mail_edit;
- GtkButton *mail_delete;
- GtkButton *mail_default;
-
- guint destroyed : 1;
- guint changed : 1;
+ EAccountManager parent;
+ EMAccountPrefsPrivate *priv;
};
struct _EMAccountPrefsClass {
- GtkVBoxClass parent_class;
-
- /* signals */
-
+ EAccountManagerClass parent_class;
};
+GType em_account_prefs_get_type (void);
+GtkWidget * em_account_prefs_new (EAccountList *account_list);
-GType em_account_prefs_get_type (void);
-
-GtkWidget *em_account_prefs_new (GNOME_Evolution_Shell shell);
-
-/* needed by global config */
-#define EM_ACCOUNT_PREFS_CONTROL_ID "OAFIID:GNOME_Evolution_Mail_AccountPrefs_ConfigControl:" BASE_VERSION
-
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
-#endif /* __EM_ACCOUNT_PREFS_H__ */
+#endif /* EM_ACCOUNT_PREFS_H */
diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c
index 8c704a2827..68c1392410 100644
--- a/mail/em-composer-prefs.c
+++ b/mail/em-composer-prefs.c
@@ -30,63 +30,137 @@
#include <unistd.h>
#include <fcntl.h>
-#include "e-util/e-signature.h"
-#include "e-util/e-signature-list.h"
+#include "e-util/e-binding.h"
+#include "e-util/e-signature-utils.h"
#include "e-util/gconf-bridge.h"
#include "em-composer-prefs.h"
#include "composer/e-msg-composer.h"
-#include <bonobo/bonobo-generic-factory.h>
-
#include <camel/camel-iconv.h>
#include <misc/e-gui-utils.h>
+#include <glib/gi18n.h>
#include <glib/gstdio.h>
-#include <gdk/gdkkeysyms.h>
#include <gtkhtml/gtkhtml.h>
#include <editor/gtkhtml-spell-language.h>
#include "misc/e-charset-picker.h"
+#include "misc/e-signature-manager.h"
+#include "misc/e-signature-preview.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
#include "mail-config.h"
-#include "mail-signature-editor.h"
+#include "e-signature-editor.h"
#include "em-config.h"
static gpointer parent_class;
-static void
-composer_prefs_dispose (GObject *object)
+static gboolean
+transform_color_to_string (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
{
- EMComposerPrefs *prefs = (EMComposerPrefs *) object;
- ESignatureList *signature_list;
+ const GdkColor *color;
+ gchar *string;
- signature_list = mail_config_get_signatures ();
+ color = g_value_get_boxed (src_value);
+ string = gdk_color_to_string (color);
+ g_value_set_string (dst_value, string);
+ g_free (string);
- if (prefs->sig_added_id != 0) {
- g_signal_handler_disconnect (
- signature_list, prefs->sig_added_id);
- prefs->sig_added_id = 0;
+ return TRUE;
+}
+
+static gboolean
+transform_string_to_color (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ GdkColor color;
+ const gchar *string;
+ gboolean success = FALSE;
+
+ string = g_value_get_string (src_value);
+ if (gdk_color_parse (string, &color)) {
+ g_value_set_boxed (dst_value, &color);
+ success = TRUE;
}
- if (prefs->sig_removed_id != 0) {
- g_signal_handler_disconnect (
- signature_list, prefs->sig_removed_id);
- prefs->sig_removed_id = 0;
+ return success;
+}
+
+static gboolean
+transform_old_to_new_reply_style (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ gboolean success = TRUE;
+
+ /* XXX This is the kind of legacy crap we wind up
+ * with when we don't migrate things properly. */
+
+ switch (g_value_get_int (src_value)) {
+ case 0: /* Quoted: 0 -> 2 */
+ g_value_set_int (dst_value, 2);
+ break;
+
+ case 1: /* Do Not Quote: 1 -> 3 */
+ g_value_set_int (dst_value, 3);
+ break;
+
+ case 2: /* Attach: 2 -> 0 */
+ g_value_set_int (dst_value, 0);
+ break;
+
+ case 3: /* Outlook: 3 -> 1 */
+ g_value_set_int (dst_value, 1);
+ break;
+
+ default:
+ success = FALSE;
+ break;
}
- if (prefs->sig_changed_id != 0) {
- g_signal_handler_disconnect (
- signature_list, prefs->sig_changed_id);
- prefs->sig_changed_id = 0;
+ return success;
+}
+
+static gboolean
+transform_new_to_old_reply_style (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ gboolean success = TRUE;
+
+ /* XXX This is the kind of legacy crap we wind up
+ * with when we don't migrate things properly. */
+
+ switch (g_value_get_int (src_value)) {
+ case 0: /* Attach: 0 -> 2 */
+ g_value_set_int (dst_value, 2);
+ break;
+
+ case 1: /* Outlook: 1 -> 3 */
+ g_value_set_int (dst_value, 3);
+ break;
+
+ case 2: /* Quoted: 2 -> 0 */
+ g_value_set_int (dst_value, 0);
+ break;
+
+ case 3: /* Do Not Quote: 3 -> 1 */
+ g_value_set_int (dst_value, 1);
+ break;
+
+ default:
+ success = FALSE;
+ break;
}
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ return success;
}
static void
@@ -96,8 +170,6 @@ composer_prefs_finalize (GObject *object)
g_object_unref (prefs->gui);
- g_hash_table_destroy (prefs->sig_hash);
-
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -110,17 +182,12 @@ composer_prefs_class_init (EMComposerPrefsClass *class)
parent_class = g_type_class_peek_parent (class);
object_class = G_OBJECT_CLASS (class);
- object_class->dispose = composer_prefs_dispose;
object_class->finalize = composer_prefs_finalize;
}
static void
composer_prefs_init (EMComposerPrefs *prefs)
{
- prefs->sig_hash = g_hash_table_new_full (
- g_direct_hash, g_direct_equal,
- (GDestroyNotify) NULL,
- (GDestroyNotify) gtk_tree_row_reference_free);
}
GType
@@ -149,186 +216,6 @@ em_composer_prefs_get_type (void)
return type;
}
-static void
-sig_load_preview (EMComposerPrefs *prefs,
- ESignature *signature)
-{
- GtkHTML *html;
- gchar *str;
-
- html = prefs->sig_preview;
-
- if (signature == NULL) {
- gtk_html_load_from_string (html, " ", 1);
- return;
- }
-
- if (signature->script)
- str = mail_config_signature_run_script (signature->filename);
- else
- str = e_msg_composer_get_sig_file_content (
- signature->filename, signature->html);
- if (!str || !*str) {
- /* make html stream happy and write at least one character */
- g_free (str);
- str = g_strdup (" ");
- }
-
- if (signature->html) {
- gtk_html_load_from_string (html, str, strlen (str));
- } else {
- GtkHTMLStream *stream;
- int len;
-
- len = strlen (str);
- stream = gtk_html_begin_content (html, "text/html; charset=utf-8");
- gtk_html_write (html, stream, "<PRE>", 5);
- if (len)
- gtk_html_write (html, stream, str, len);
- gtk_html_write (html, stream, "</PRE>", 6);
- gtk_html_end (html, stream, GTK_HTML_STREAM_OK);
- }
-
- g_free (str);
-}
-
-static void
-signature_added (ESignatureList *signature_list,
- ESignature *signature,
- EMComposerPrefs *prefs)
-{
- GtkTreeRowReference *row;
- GtkTreeModel *model;
- GtkTreePath *path;
- GtkTreeIter iter;
-
- /* autogen signature is special */
- if (signature->autogen)
- return;
-
- model = gtk_tree_view_get_model (prefs->sig_list);
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (
- GTK_LIST_STORE (model), &iter,
- 0, signature->name, 1, signature, -1);
-
- path = gtk_tree_model_get_path (model, &iter);
- row = gtk_tree_row_reference_new (model, path);
- gtk_tree_path_free (path);
-
- g_hash_table_insert (prefs->sig_hash, signature, row);
-}
-
-static void
-signature_removed (ESignatureList *signature_list,
- ESignature *signature,
- EMComposerPrefs *prefs)
-{
- GtkTreeRowReference *row;
- GtkTreeModel *model;
- GtkTreePath *path;
- GtkTreeIter iter;
-
- if (!(row = g_hash_table_lookup (prefs->sig_hash, signature)))
- return;
-
- model = gtk_tree_view_get_model (prefs->sig_list);
- path = gtk_tree_row_reference_get_path (row);
- g_hash_table_remove (prefs->sig_hash, signature);
-
- if (!gtk_tree_model_get_iter (model, &iter, path)) {
- gtk_tree_path_free (path);
- return;
- }
-
- gtk_list_store_remove ((GtkListStore *) model, &iter);
-}
-
-static void
-signature_changed (ESignatureList *signature_list,
- ESignature *signature,
- EMComposerPrefs *prefs)
-{
- GtkTreeSelection *selection;
- GtkTreeRowReference *row;
- GtkTreeModel *model;
- GtkTreePath *path;
- GtkTreeIter iter;
- ESignature *cur;
-
- if (!(row = g_hash_table_lookup (prefs->sig_hash, signature)))
- return;
-
- model = gtk_tree_view_get_model (prefs->sig_list);
- path = gtk_tree_row_reference_get_path (row);
-
- if (!gtk_tree_model_get_iter (model, &iter, path)) {
- gtk_tree_path_free (path);
- return;
- }
-
- gtk_tree_path_free (path);
-
- gtk_list_store_set ((GtkListStore *) model, &iter, 0, signature->name, -1);
-
- selection = gtk_tree_view_get_selection (prefs->sig_list);
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- gtk_tree_model_get (model, &iter, 1, &cur, -1);
- if (cur == signature)
- sig_load_preview (prefs, signature);
- }
-}
-
-static void
-sig_edit_cb (GtkWidget *widget, EMComposerPrefs *prefs)
-{
- GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkWidget *parent;
- GtkTreeIter iter;
- ESignature *signature;
-
- selection = gtk_tree_view_get_selection (prefs->sig_list);
- if (!gtk_tree_selection_get_selected (selection, &model, &iter))
- return;
-
- gtk_tree_model_get (model, &iter, 1, &signature, -1);
-
- if (!signature->script) {
- GtkWidget *editor;
-
- /* normal signature */
- if (!signature->filename || *signature->filename == '\0') {
- g_free (signature->filename);
- signature->filename = g_strdup (_("Unnamed"));
- }
-
- editor = e_signature_editor_new ();
- e_signature_editor_set_signature (
- E_SIGNATURE_EDITOR (editor), signature);
-
- parent = gtk_widget_get_toplevel ((GtkWidget *) prefs);
- if (GTK_WIDGET_TOPLEVEL (parent))
- gtk_window_set_transient_for (
- GTK_WINDOW (editor), GTK_WINDOW (parent));
-
- gtk_widget_show (editor);
- } else {
- /* signature script */
- GtkWidget *entry;
-
- entry = glade_xml_get_widget (prefs->sig_script_gui, "filechooserbutton_add_script");
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (entry), signature->filename);
-
- entry = glade_xml_get_widget (prefs->sig_script_gui, "entry_add_script_name");
- gtk_entry_set_text (GTK_ENTRY (entry), signature->name);
-
- g_object_set_data ((GObject *) entry, "sig", signature);
-
- gtk_window_present ((GtkWindow *) prefs->sig_script_dialog);
- }
-}
-
void
em_composer_prefs_new_signature (GtkWindow *parent,
gboolean html_mode)
@@ -342,222 +229,6 @@ em_composer_prefs_new_signature (GtkWindow *parent,
}
static void
-sig_delete_cb (GtkWidget *widget, EMComposerPrefs *prefs)
-{
- GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkTreeIter iter;
- ESignature *signature;
-
- selection = gtk_tree_view_get_selection (prefs->sig_list);
-
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- gtk_tree_model_get (model, &iter, 1, &signature, -1);
- mail_config_remove_signature (signature);
- }
- gtk_widget_grab_focus ((GtkWidget *)prefs->sig_list);
-}
-
-static void
-sig_add_cb (GtkWidget *widget, EMComposerPrefs *prefs)
-{
- gboolean send_html;
- GtkWidget *parent;
-
- send_html = gconf_client_get_bool (
- mail_config_get_gconf_client (),
- "/apps/evolution/mail/composer/send_html", NULL);
-
- parent = gtk_widget_get_toplevel (GTK_WIDGET (prefs));
- parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
-
- em_composer_prefs_new_signature (GTK_WINDOW (parent), send_html);
- gtk_widget_grab_focus (GTK_WIDGET (prefs->sig_list));
-}
-
-static void
-sig_add_script_response (GtkWidget *widget, int button, EMComposerPrefs *prefs)
-{
- gchar *script, **argv = NULL;
- GtkWidget *entry;
- const gchar *name;
- int argc;
-
- if (button == GTK_RESPONSE_ACCEPT) {
- entry = glade_xml_get_widget (prefs->sig_script_gui, "filechooserbutton_add_script");
- script = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (entry));
-
- entry = glade_xml_get_widget (prefs->sig_script_gui, "entry_add_script_name");
- name = gtk_entry_get_text (GTK_ENTRY (entry));
- if (script && *script && g_shell_parse_argv (script, &argc, &argv, NULL)) {
- struct stat st;
-
- if (g_stat (argv[0], &st) == 0 && S_ISREG (st.st_mode) && g_access (argv[0], X_OK) == 0) {
- ESignature *signature;
-
- if ((signature = g_object_get_data ((GObject *) entry, "sig"))) {
- /* we're just editing an existing signature script */
- g_free (signature->name);
- signature->name = g_strdup (name);
- g_free(signature->filename);
- signature->filename = g_strdup(script);
- e_signature_list_change (mail_config_get_signatures (), signature);
- } else {
- signature = mail_config_signature_new (script, TRUE, TRUE);
- signature->name = g_strdup (name);
-
- e_signature_list_add (mail_config_get_signatures (), signature);
- g_object_unref (signature);
- }
-
- mail_config_save_signatures();
-
- gtk_widget_hide (prefs->sig_script_dialog);
- g_strfreev (argv);
- g_free (script);
-
- return;
- }
- }
-
- e_error_run((GtkWindow *)prefs->sig_script_dialog, "mail:signature-notscript", argv ? argv[0] : script, NULL);
- g_strfreev (argv);
- g_free (script);
- return;
- }
-
- gtk_widget_hide (widget);
-}
-
-static void
-sig_add_script_cb (GtkWidget *widget, EMComposerPrefs *prefs)
-{
- GtkWidget *entry;
-
- entry = glade_xml_get_widget (prefs->sig_script_gui, "entry_add_script_name");
- gtk_entry_set_text (GTK_ENTRY (entry), _("Unnamed"));
-
- g_object_set_data ((GObject *) entry, "sig", NULL);
-
- gtk_window_present ((GtkWindow *) prefs->sig_script_dialog);
-}
-
-static void
-sig_selection_changed (GtkTreeSelection *selection,
- EMComposerPrefs *prefs)
-{
- ESignature *signature;
- GtkTreeModel *model;
- GtkTreeIter iter;
- gboolean valid;
-
- valid = gtk_tree_selection_get_selected (selection, &model, &iter);
-
- if (valid) {
- gtk_tree_model_get (model, &iter, 1, &signature, -1);
- sig_load_preview (prefs, signature);
- } else
- sig_load_preview (prefs, NULL);
-
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->sig_delete), valid);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->sig_edit), valid);
-}
-
-static void
-sig_fill_list (EMComposerPrefs *prefs)
-{
- ESignatureList *signature_list;
- GtkTreeModel *model;
- EIterator *iterator;
-
- model = gtk_tree_view_get_model (prefs->sig_list);
- gtk_list_store_clear (GTK_LIST_STORE (model));
-
- signature_list = mail_config_get_signatures ();
- iterator = e_list_get_iterator ((EList *) signature_list);
-
- while (e_iterator_is_valid (iterator)) {
- ESignature *signature;
-
- signature = (ESignature *) e_iterator_get (iterator);
- signature_added (signature_list, signature, prefs);
-
- e_iterator_next (iterator);
- }
-
- g_object_unref (iterator);
-
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->sig_edit), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->sig_delete), FALSE);
-
- prefs->sig_added_id = g_signal_connect (
- signature_list, "signature-added",
- G_CALLBACK (signature_added), prefs);
-
- prefs->sig_removed_id = g_signal_connect (
- signature_list, "signature-removed",
- G_CALLBACK (signature_removed), prefs);
-
- prefs->sig_changed_id = g_signal_connect (
- signature_list, "signature-changed",
- G_CALLBACK (signature_changed), prefs);
-}
-
-static void
-url_requested (GtkHTML *html,
- const gchar *url,
- GtkHTMLStream *handle)
-{
- GtkHTMLStreamStatus status;
- gchar buf[128];
- gssize size;
- gint fd;
- gchar *filename;
-
- if (strncmp (url, "file:", 5) == 0)
- filename = g_filename_from_uri (url, NULL, NULL);
- else
- filename = g_strdup (url);
- fd = g_open (filename, O_RDONLY | O_BINARY, 0);
- g_free (filename);
-
- status = GTK_HTML_STREAM_OK;
- if (fd != -1) {
- while ((size = read (fd, buf, sizeof (buf)))) {
- if (size == -1) {
- status = GTK_HTML_STREAM_ERROR;
- break;
- } else
- gtk_html_write (html, handle, buf, size);
- }
- } else
- status = GTK_HTML_STREAM_ERROR;
-
- gtk_html_end (html, handle, status);
- if (fd > 0)
- close (fd);
-}
-
-static void
-spell_color_set (GtkColorButton *color_button,
- EMComposerPrefs *prefs)
-{
- GConfClient *client;
- const gchar *key;
- GdkColor color;
- gchar *string;
-
- gtk_color_button_get_color (color_button, &color);
- string = gdk_color_to_string (&color);
-
- client = mail_config_get_gconf_client ();
- key = "/apps/evolution/mail/composer/spell_color";
- gconf_client_set_string (client, key, string, NULL);
-
- g_free (string);
-}
-
-static void
spell_language_toggled_cb (GtkCellRendererToggle *renderer,
const gchar *path_string,
EMComposerPrefs *prefs)
@@ -619,13 +290,8 @@ spell_setup (EMComposerPrefs *prefs)
{
const GList *available_languages;
GList *active_languages;
- GConfClient *client;
GtkListStore *store;
- GdkColor color;
- const gchar *key;
- gchar *string;
- client = mail_config_get_gconf_client ();
store = GTK_LIST_STORE (prefs->language_model);
available_languages = gtkhtml_spell_language_get_available ();
@@ -652,52 +318,6 @@ spell_setup (EMComposerPrefs *prefs)
}
g_list_free (active_languages);
-
- key = "/apps/evolution/mail/composer/spell_color";
- string = gconf_client_get_string (client, key, NULL);
- if (string == NULL || !gdk_color_parse (string, &color))
- gdk_color_parse ("Red", &color);
- gtk_color_button_set_color (GTK_COLOR_BUTTON (prefs->color), &color);
-
- g_signal_connect (
- prefs->color, "color_set",
- G_CALLBACK (spell_color_set), prefs);
-}
-
-static gint
-reply_style_new_order (gint style_id,
- gboolean from_enum_to_option_id)
-{
- gint values[] = {
- MAIL_CONFIG_REPLY_ATTACH, 0,
- MAIL_CONFIG_REPLY_OUTLOOK, 1,
- MAIL_CONFIG_REPLY_QUOTED, 2,
- MAIL_CONFIG_REPLY_DO_NOT_QUOTE, 3,
- -1, -1};
- gint ii;
-
- for (ii = from_enum_to_option_id ? 0 : 1; values[ii] != -1; ii += 2) {
- if (values[ii] == style_id)
- return values [from_enum_to_option_id ? ii + 1 : ii - 1];
- }
-
- return style_id;
-}
-
-static void
-style_changed (GtkComboBox *combobox, const gchar *key)
-{
- GConfClient *client;
- gint style;
-
- client = mail_config_get_gconf_client ();
- style = gtk_combo_box_get_active (combobox);
- g_return_if_fail (style >= 0);
-
- if (g_str_has_suffix (key, "/reply_style"))
- style = reply_style_new_order (style, FALSE);
-
- gconf_client_set_int (client, key, style, NULL);
}
static void
@@ -781,38 +401,15 @@ emcp_free (EConfig *ec, GSList *items, gpointer data)
g_slist_free (items);
}
-static gboolean
-signature_key_press_cb (GtkTreeView *tree_view,
- GdkEventKey *event,
- EMComposerPrefs *prefs)
-{
- /* No need to care about anything other than DEL key */
- if (event->keyval == GDK_Delete) {
- sig_delete_cb (GTK_WIDGET (tree_view), prefs);
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-sig_tree_event_cb (GtkTreeView *tree_view,
- GdkEvent *event,
- EMComposerPrefs *prefs)
-{
- if (event->type == GDK_2BUTTON_PRESS) {
- sig_edit_cb (GTK_WIDGET (tree_view), prefs);
- return TRUE;
- }
-
- return FALSE;
-}
-
static void
-em_composer_prefs_construct (EMComposerPrefs *prefs)
+em_composer_prefs_construct (EMComposerPrefs *prefs,
+ EShell *shell)
{
GtkWidget *toplevel, *widget, *menu, *info_pixmap;
- GtkDialog *dialog;
+ GtkWidget *container;
+ EShellSettings *shell_settings;
+ ESignatureList *signature_list;
+ ESignatureTreeView *signature_tree_view;
GladeXML *gui;
GtkTreeView *view;
GtkListStore *store;
@@ -820,25 +417,22 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
GtkCellRenderer *renderer;
GConfBridge *bridge;
GConfClient *client;
- const gchar *key;
- int style;
gchar *buf;
EMConfig *ec;
EMConfigTargetPrefs *target;
GSList *l;
int i;
gchar *gladefile;
- gboolean sensitive;
bridge = gconf_bridge_get ();
client = mail_config_get_gconf_client ();
+ shell_settings = e_shell_get_shell_settings (shell);
gladefile = g_build_filename (EVOLUTION_GLADEDIR,
"mail-config.glade",
NULL);
gui = glade_xml_new (gladefile, "composer_toplevel", NULL);
prefs->gui = gui;
- prefs->sig_script_gui = glade_xml_new (gladefile, "vbox_add_script_signature", NULL);
g_free (gladefile);
/** @HookPoint-EMConfig: Mail Composer Preferences
@@ -858,57 +452,50 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
/* General tab */
/* Default Behavior */
- key = "/apps/evolution/mail/composer/send_html";
widget = glade_xml_get_widget (gui, "chkSendHTML");
- if (!gconf_client_key_is_writable (client, key, NULL))
- gtk_widget_set_sensitive (widget, FALSE);
- gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "composer-format-html",
+ G_OBJECT (widget), "active");
- key = "/apps/evolution/mail/prompts/empty_subject";
widget = glade_xml_get_widget (gui, "chkPromptEmptySubject");
- if (!gconf_client_key_is_writable (client, key, NULL))
- gtk_widget_set_sensitive (widget, FALSE);
- gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "composer-prompt-empty-subject",
+ G_OBJECT (widget), "active");
- key = "/apps/evolution/mail/prompts/only_bcc";
widget = glade_xml_get_widget (gui, "chkPromptBccOnly");
- if (!gconf_client_key_is_writable (client, key, NULL))
- gtk_widget_set_sensitive (widget, FALSE);
- gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "composer-prompt-only-bcc",
+ G_OBJECT (widget), "active");
- key = "/apps/evolution/mail/composer/magic_smileys";
widget = glade_xml_get_widget (gui, "chkAutoSmileys");
- if (!gconf_client_key_is_writable (client, key, NULL))
- gtk_widget_set_sensitive (widget, FALSE);
- gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "composer-magic-smileys",
+ G_OBJECT (widget), "active");
- key = "/apps/evolution/mail/composer/request_receipt";
widget = glade_xml_get_widget (gui, "chkRequestReceipt");
- if (!gconf_client_key_is_writable (client, key, NULL))
- gtk_widget_set_sensitive (widget, FALSE);
- gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "composer-request-receipt",
+ G_OBJECT (widget), "active");
- key = "/apps/evolution/mail/composer/reply_start_bottom";
widget = glade_xml_get_widget (gui, "chkReplyStartBottom");
- if (!gconf_client_key_is_writable (client, key, NULL))
- gtk_widget_set_sensitive (widget, FALSE);
- gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "composer-reply-start-bottom",
+ G_OBJECT (widget), "active");
- key = "/apps/evolution/mail/composer/outlook_filenames";
widget = glade_xml_get_widget (gui, "chkOutlookFilenames");
- if (!gconf_client_key_is_writable (client, key, NULL))
- gtk_widget_set_sensitive (widget, FALSE);
- gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "composer-outlook-filenames",
+ G_OBJECT (widget), "active");
- key = "/apps/evolution/mail/composer/top_signature";
widget = glade_xml_get_widget (gui, "chkTopSignature");
- if (!gconf_client_key_is_writable (client, key, NULL))
- gtk_widget_set_sensitive (widget, FALSE);
- gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "composer-top-signature",
+ G_OBJECT (widget), "active");
- key = "/apps/evolution/mail/composer/inline_spelling";
widget = glade_xml_get_widget (gui, "chkEnableSpellChecking");
- gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "composer-inline-spelling",
+ G_OBJECT (widget), "active");
prefs->charset = GTK_OPTION_MENU (
glade_xml_get_widget (gui, "omenuCharset1"));
@@ -924,8 +511,6 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
g_free (buf);
/* Spell Checking */
- widget = glade_xml_get_widget (gui, "colorButtonSpellCheckColor");
- prefs->color = GTK_COLOR_BUTTON (widget);
widget = glade_xml_get_widget (gui, "listSpellCheckLanguage");
view = GTK_TREE_VIEW (widget);
store = gtk_list_store_new (
@@ -945,7 +530,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
gtk_tree_view_insert_column_with_attributes (
view, -1, _("Language(s)"),
- gtk_cell_renderer_text_new (),
+ gtk_cell_renderer_text_new (),
"text", 1, NULL);
selection = gtk_tree_view_get_selection (view);
gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
@@ -953,114 +538,84 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
gtk_image_set_from_stock (
GTK_IMAGE (info_pixmap),
GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_BUTTON);
+
+ widget = glade_xml_get_widget (gui, "colorButtonSpellCheckColor");
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "composer-spell-color",
+ G_OBJECT (widget), "color",
+ transform_string_to_color,
+ transform_color_to_string,
+ NULL, NULL);
+
spell_setup (prefs);
/* Forwards and Replies */
- prefs->forward_style = GTK_COMBO_BOX (glade_xml_get_widget (gui, "comboboxForwardStyle"));
- style = gconf_client_get_int (client, "/apps/evolution/mail/format/forward_style", NULL);
- gtk_combo_box_set_active (prefs->forward_style, style);
- g_signal_connect (prefs->forward_style, "changed", G_CALLBACK (style_changed), (gpointer) "/apps/evolution/mail/format/forward_style");
-
- prefs->reply_style = GTK_COMBO_BOX (glade_xml_get_widget (gui, "comboboxReplyStyle"));
- style = gconf_client_get_int (client, "/apps/evolution/mail/format/reply_style", NULL);
- gtk_combo_box_set_active (prefs->reply_style, reply_style_new_order (style, TRUE));
- g_signal_connect (prefs->reply_style, "changed", G_CALLBACK (style_changed), (gpointer) "/apps/evolution/mail/format/reply_style");
+ widget = glade_xml_get_widget (gui, "comboboxForwardStyle");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-forward-style",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "comboboxReplyStyle");
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "mail-reply-style",
+ G_OBJECT (widget), "active",
+ transform_old_to_new_reply_style,
+ transform_new_to_old_reply_style,
+ NULL, NULL);
/* Signatures */
- dialog = (GtkDialog *) gtk_dialog_new ();
-
- gtk_widget_realize ((GtkWidget *) dialog);
- gtk_container_set_border_width ((GtkContainer *)dialog->action_area, 12);
- gtk_container_set_border_width ((GtkContainer *)dialog->vbox, 0);
-
- prefs->sig_script_dialog = (GtkWidget *) dialog;
- gtk_dialog_add_buttons (dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
- GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
- gtk_dialog_set_has_separator (dialog, FALSE);
- gtk_window_set_title ((GtkWindow *) dialog, _("Add signature script"));
- 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 ((GtkBox *) dialog->vbox, widget, TRUE, TRUE, 0);
-
- key = "/apps/evolution/mail/signatures";
- sensitive = gconf_client_key_is_writable (client, key, NULL);
-
- widget = glade_xml_get_widget (gui, "cmdSignatureAdd");
- gtk_widget_set_sensitive (widget, sensitive);
- g_signal_connect (
- widget, "clicked",
- G_CALLBACK (sig_add_cb), prefs);
- prefs->sig_add = GTK_BUTTON (widget);
+ signature_list = e_get_signature_list ();
+ container = glade_xml_get_widget (gui, "alignSignatures");
+ widget = e_signature_manager_new (signature_list);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ gtk_widget_show (widget);
+
+ /* The mail shell backend responds to the "window-created" signal
+ * that this triggers and configures it with composer preferences. */
+ g_signal_connect_swapped (
+ widget, "editor-created",
+ G_CALLBACK (e_shell_watch_window), shell);
- widget = glade_xml_get_widget (gui, "cmdSignatureAddScript");
- gtk_widget_set_sensitive (widget, sensitive && !mail_config_scripts_disabled ());
- g_signal_connect (
- widget, "clicked",
- G_CALLBACK (sig_add_script_cb), prefs);
- prefs->sig_add_script = GTK_BUTTON (widget);
+ e_binding_new (
+ G_OBJECT (shell_settings), "composer-format-html",
+ G_OBJECT (widget), "prefer-html");
- widget = glade_xml_get_widget (gui, "cmdSignatureEdit");
- gtk_widget_set_sensitive (widget, sensitive);
- g_signal_connect (
- widget, "clicked",
- G_CALLBACK (sig_edit_cb), prefs);
- prefs->sig_edit = GTK_BUTTON (widget);
+ e_binding_new_with_negation (
+ G_OBJECT (shell_settings), "disable-command-line",
+ G_OBJECT (widget), "allow-scripts");
- widget = glade_xml_get_widget (gui, "cmdSignatureDelete");
- gtk_widget_set_sensitive (widget, sensitive);
- g_signal_connect (
- widget, "clicked",
- G_CALLBACK (sig_delete_cb), prefs);
- prefs->sig_delete = GTK_BUTTON (widget);
-
- widget = glade_xml_get_widget (gui, "listSignatures");
- gtk_widget_set_sensitive (widget, sensitive);
- prefs->sig_list = GTK_TREE_VIEW (widget);
- store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
- gtk_tree_view_set_model (prefs->sig_list, GTK_TREE_MODEL (store));
- gtk_tree_view_insert_column_with_attributes (
- prefs->sig_list, -1, _("Signature(s)"),
- gtk_cell_renderer_text_new (), "text", 0, NULL);
- selection = gtk_tree_view_get_selection (prefs->sig_list);
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- g_signal_connect (
- selection, "changed",
- G_CALLBACK (sig_selection_changed), prefs);
- g_signal_connect (
- prefs->sig_list, "event",
- G_CALLBACK (sig_tree_event_cb), prefs);
+ signature_tree_view = e_signature_manager_get_tree_view (
+ E_SIGNATURE_MANAGER (widget));
- sig_fill_list (prefs);
+ container = glade_xml_get_widget (gui, "scrolled-sig");
+ widget = e_signature_preview_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ gtk_widget_show (widget);
- /* 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_widget_show (GTK_WIDGET (prefs->sig_preview));
- gtk_container_add (
- GTK_CONTAINER (widget),
- GTK_WIDGET (prefs->sig_preview));
+ e_binding_new_with_negation (
+ G_OBJECT (shell_settings), "disable-command-line",
+ G_OBJECT (widget), "allow-scripts");
+
+ e_binding_new (
+ G_OBJECT (signature_tree_view), "selected",
+ G_OBJECT (widget), "signature");
/* get our toplevel widget */
target = em_config_target_new_prefs (ec, client);
e_config_set_target ((EConfig *)ec, (EConfigTarget *)target);
toplevel = e_config_create_widget ((EConfig *)ec);
gtk_container_add (GTK_CONTAINER (prefs), toplevel);
-
- g_signal_connect (
- prefs->sig_list, "key-press-event",
- G_CALLBACK (signature_key_press_cb), prefs);
}
GtkWidget *
-em_composer_prefs_new (void)
+em_composer_prefs_new (EShell *shell)
{
EMComposerPrefs *prefs;
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+
prefs = g_object_new (EM_TYPE_COMPOSER_PREFS, NULL);
- em_composer_prefs_construct (prefs);
+ em_composer_prefs_construct (prefs, shell);
return GTK_WIDGET (prefs);
}
diff --git a/mail/em-composer-prefs.h b/mail/em-composer-prefs.h
index 2e12c7ffb2..83560b13d9 100644
--- a/mail/em-composer-prefs.h
+++ b/mail/em-composer-prefs.h
@@ -20,10 +20,12 @@
*
*/
-#ifndef __EM_COMPOSER_PREFS_H__
-#define __EM_COMPOSER_PREFS_H__
+#ifndef EM_COMPOSER_PREFS_H
+#define EM_COMPOSER_PREFS_H
#include <gtk/gtk.h>
+#include <glade/glade.h>
+#include <shell/e-shell.h>
/* Standard GObject macros */
#define EM_TYPE_COMPOSER_PREFS \
@@ -50,19 +52,17 @@ typedef struct _EMComposerPrefs EMComposerPrefs;
typedef struct _EMComposerPrefsClass EMComposerPrefsClass;
struct _ESignature;
-struct _GladeXML;
struct _EMComposerPrefs {
GtkVBox parent;
- struct _GladeXML *gui;
+ GladeXML *gui;
/* General tab */
/* Default Behavior */
GtkOptionMenu *charset;
- GtkColorButton *color;
GtkTreeModel *language_model;
/* Forwards and Replies */
@@ -70,20 +70,7 @@ struct _EMComposerPrefs {
GtkComboBox *reply_style;
/* Signatures */
- GtkTreeView *sig_list;
- GHashTable *sig_hash;
- GtkButton *sig_add;
- GtkButton *sig_add_script;
- GtkButton *sig_edit;
- GtkButton *sig_delete;
struct _GtkHTML *sig_preview;
-
- struct _GladeXML *sig_script_gui;
- GtkWidget *sig_script_dialog;
-
- guint sig_added_id;
- guint sig_removed_id;
- guint sig_changed_id;
};
struct _EMComposerPrefsClass {
@@ -91,7 +78,7 @@ struct _EMComposerPrefsClass {
};
GType em_composer_prefs_get_type (void);
-GtkWidget * em_composer_prefs_new (void);
+GtkWidget * em_composer_prefs_new (EShell *shell);
void em_composer_prefs_new_signature (GtkWindow *parent,
gboolean html_mode);
@@ -101,4 +88,4 @@ void em_composer_prefs_new_signature (GtkWindow *parent,
G_END_DECLS
-#endif /* __EM_COMPOSER_PREFS_H__ */
+#endif /* EM_COMPOSER_PREFS_H */
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 4ed3e70b8f..fdff69861b 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -37,20 +37,22 @@
#include "mail-config.h"
#include "mail-session.h"
#include "mail-send-recv.h"
-#include "mail-component.h"
#include "e-util/e-error.h"
+#include "e-util/e-account-utils.h"
#include "em-utils.h"
#include "em-composer-utils.h"
#include "composer/e-msg-composer.h"
#include "composer/e-composer-autosave.h"
+#include "composer/e-composer-post-header.h"
+#include "em-folder-selector.h"
+#include "em-folder-tree.h"
#include "em-format-html.h"
+#include "em-format-html-print.h"
#include "em-format-quote.h"
#include "em-event.h"
-#include "libedataserver/e-account-list.h"
-
#include <camel/camel-folder.h>
#include <camel/camel-multipart.h>
#include <camel/camel-string-utils.h>
@@ -58,6 +60,8 @@
#include <camel/camel-nntp-address.h>
#include <camel/camel-vee-folder.h>
+#include "e-mail-shell-backend.h"
+
#ifdef G_OS_WIN32
/* Undef the similar macro from pthread.h, it doesn't check if
* gmtime() returns NULL.
@@ -72,6 +76,9 @@
static EAccount * guess_account (CamelMimeMessage *message, CamelFolder *folder);
+static void em_utils_composer_send_cb (EMsgComposer *composer);
+static void em_utils_composer_save_draft_cb (EMsgComposer *composer);
+
struct emcs_t {
unsigned int ref_count;
@@ -88,28 +95,67 @@ emcs_new (void)
{
struct emcs_t *emcs;
- emcs = g_new (struct emcs_t, 1);
+ emcs = g_new0 (struct emcs_t, 1);
emcs->ref_count = 1;
- emcs->drafts_folder = NULL;
- emcs->drafts_uid = NULL;
- emcs->folder = NULL;
- emcs->flags = 0;
- emcs->set = 0;
- emcs->uid = NULL;
return emcs;
}
static void
+emcs_set_drafts_info (struct emcs_t *emcs,
+ CamelFolder *drafts_folder,
+ const gchar *drafts_uid)
+{
+ g_return_if_fail (emcs != NULL);
+ g_return_if_fail (drafts_folder != NULL);
+ g_return_if_fail (drafts_uid != NULL);
+
+ if (emcs->drafts_folder != NULL)
+ camel_object_unref (emcs->drafts_folder);
+ g_free (emcs->drafts_uid);
+
+ camel_object_ref (drafts_folder);
+ emcs->drafts_folder = drafts_folder;
+ emcs->drafts_uid = g_strdup (drafts_uid);
+
+ g_debug ("%s", G_STRFUNC);
+}
+
+static void
+emcs_set_folder_info (struct emcs_t *emcs,
+ CamelFolder *folder,
+ const gchar *uid,
+ guint32 flags,
+ guint32 set)
+{
+ g_return_if_fail (emcs != NULL);
+ g_return_if_fail (folder != NULL);
+ g_return_if_fail (uid != NULL);
+
+ if (emcs->folder != NULL)
+ camel_object_unref (emcs->folder);
+ g_free (emcs->uid);
+
+ camel_object_ref (folder);
+ emcs->folder = folder;
+ emcs->uid = g_strdup (uid);
+ emcs->flags = flags;
+ emcs->set = set;
+
+ g_debug ("%s", G_STRFUNC);
+}
+
+static void
free_emcs (struct emcs_t *emcs)
{
- if (emcs->drafts_folder)
+ if (emcs->drafts_folder != NULL)
camel_object_unref (emcs->drafts_folder);
g_free (emcs->drafts_uid);
- if (emcs->folder)
+ if (emcs->folder != NULL)
camel_object_unref (emcs->folder);
g_free (emcs->uid);
+
g_free (emcs);
}
@@ -127,12 +173,6 @@ emcs_unref (struct emcs_t *emcs)
free_emcs (emcs);
}
-static void
-composer_destroy_cb (gpointer user_data, GObject *deadbeef)
-{
- emcs_unref (user_data);
-}
-
static gboolean
ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recipients)
{
@@ -226,17 +266,6 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag
mail_send ();
}
} else {
- if (!emcs) {
- /* disconnect the previous signal handlers */
- g_signal_handlers_disconnect_matched (send->composer, G_SIGNAL_MATCH_FUNC, 0,
- 0, NULL, em_utils_composer_send_cb, NULL);
- g_signal_handlers_disconnect_matched (send->composer, G_SIGNAL_MATCH_FUNC, 0,
- 0, NULL, em_utils_composer_save_draft_cb, NULL);
-
- /* reconnect to the signals using a non-NULL emcs for the callback data */
- em_composer_utils_setup_default_callbacks (send->composer);
- }
-
e_msg_composer_set_enable_autosave (send->composer, TRUE);
gtk_widget_show (GTK_WIDGET (send->composer));
}
@@ -416,8 +445,8 @@ composer_get_message (EMsgComposer *composer, gboolean save_html_object_data)
return message;
}
-void
-em_utils_composer_send_cb (EMsgComposer *composer, gpointer user_data)
+static void
+em_utils_composer_send_cb (EMsgComposer *composer)
{
EComposerHeaderTable *table;
CamelMimeMessage *message;
@@ -429,32 +458,36 @@ em_utils_composer_send_cb (EMsgComposer *composer, gpointer user_data)
table = e_msg_composer_get_header_table (composer);
account = e_composer_header_table_get_account (table);
if (!account || !account->enabled) {
- e_error_run((GtkWindow *)composer, "mail:send-no-account-enabled", NULL);
+ e_error_run (
+ GTK_WINDOW (composer),
+ "mail:send-no-account-enabled", NULL);
return;
}
- if (!(message = composer_get_message (composer, FALSE)))
+ if ((message = composer_get_message (composer, FALSE)) == NULL)
return;
- mail_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX);
+ mail_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
camel_object_ref (mail_folder);
/* mail the message */
- info = camel_message_info_new(NULL);
- camel_message_info_set_flags(info, CAMEL_MESSAGE_SEEN, ~0);
+ info = camel_message_info_new (NULL);
+ camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, ~0);
send = g_malloc (sizeof (*send));
- send->emcs = user_data;
+ send->emcs = g_object_get_data (G_OBJECT (composer), "emcs");
if (send->emcs)
emcs_ref (send->emcs);
send->send = TRUE;
- send->composer = composer;
- g_object_ref (composer);
+ send->composer = g_object_ref (composer);
gtk_widget_hide (GTK_WIDGET (composer));
e_msg_composer_set_enable_autosave (composer, FALSE);
- mail_append_mail (mail_folder, message, info, composer_send_queued_cb, send);
+ mail_append_mail (
+ mail_folder, message, info, composer_send_queued_cb, send);
+
camel_object_unref (mail_folder);
camel_object_unref (message);
}
@@ -495,17 +528,9 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i
composer_set_no_change (sdi->composer, FALSE, FALSE);
- if ((emcs = sdi->emcs) == NULL) {
+ if ((emcs = sdi->emcs) == NULL)
emcs = emcs_new ();
- /* disconnect the previous signal handlers */
- g_signal_handlers_disconnect_by_func (sdi->composer, G_CALLBACK (em_utils_composer_send_cb), NULL);
- g_signal_handlers_disconnect_by_func (sdi->composer, G_CALLBACK (em_utils_composer_save_draft_cb), NULL);
-
- /* reconnect to the signals using a non-NULL emcs for the callback data */
- em_composer_utils_setup_default_callbacks (sdi->composer);
- }
-
if (emcs->drafts_folder) {
/* delete the original draft message */
camel_folder_set_message_flags (emcs->drafts_folder, emcs->drafts_uid,
@@ -557,13 +582,13 @@ save_draft_folder (char *uri, CamelFolder *folder, gpointer data)
}
}
-void
-em_utils_composer_save_draft_cb (EMsgComposer *composer, gpointer user_data)
+static void
+em_utils_composer_save_draft_cb (EMsgComposer *composer)
{
- const char *default_drafts_folder_uri = mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_DRAFTS);
- CamelFolder *drafts_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS);
+ CamelFolder *local_drafts_folder;
EComposerHeaderTable *table;
struct _save_draft_info *sdi;
+ const gchar *local_drafts_folder_uri;
CamelFolder *folder = NULL;
CamelMimeMessage *msg;
CamelMessageInfo *info;
@@ -573,19 +598,25 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer, gpointer user_data)
* get destroyed while we're in mail_msg_wait() a little lower
* down, waiting for the folder to open */
- g_object_ref(composer);
+ local_drafts_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
+
+ local_drafts_folder_uri = e_mail_shell_backend_get_folder_uri (
+ global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
+
+ g_object_ref (composer);
msg = e_msg_composer_get_message_draft (composer);
table = e_msg_composer_get_header_table (composer);
account = e_composer_header_table_get_account (table);
- sdi = g_malloc(sizeof(struct _save_draft_info));
+ sdi = g_malloc (sizeof(struct _save_draft_info));
sdi->composer = composer;
- sdi->emcs = user_data;
+ sdi->emcs = g_object_get_data (G_OBJECT (composer), "emcs");
if (sdi->emcs)
- emcs_ref(sdi->emcs);
+ emcs_ref (sdi->emcs);
if (account && account->drafts_folder_uri &&
- strcmp (account->drafts_folder_uri, default_drafts_folder_uri) != 0) {
+ strcmp (account->drafts_folder_uri, local_drafts_folder_uri) != 0) {
int id;
id = mail_get_folder (account->drafts_folder_uri, 0, save_draft_folder, &folder, mail_msg_unordered_push);
@@ -601,11 +632,11 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer, gpointer user_data)
return;
}
- folder = drafts_folder;
- camel_object_ref (drafts_folder);
+ folder = local_drafts_folder;
+ camel_object_ref (local_drafts_folder);
}
} else {
- folder = drafts_folder;
+ folder = local_drafts_folder;
camel_object_ref (folder);
}
@@ -617,43 +648,24 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer, gpointer user_data)
camel_object_unref (msg);
}
-void
-em_composer_utils_setup_callbacks (EMsgComposer *composer,
- CamelFolder *folder,
- const char *uid,
- guint32 flags,
- guint32 set,
- CamelFolder *drafts,
- const char *drafts_uid)
+static void
+em_utils_composer_print_cb (EMsgComposer *composer,
+ GtkPrintOperationAction action)
{
- struct emcs_t *emcs;
-
- emcs = emcs_new ();
-
- if (folder && uid) {
- camel_object_ref (folder);
- emcs->folder = folder;
- emcs->uid = g_strdup (uid);
- emcs->flags = flags;
- emcs->set = set;
- }
-
- if (drafts && drafts_uid) {
- camel_object_ref (drafts);
- emcs->drafts_folder = drafts;
- emcs->drafts_uid = g_strdup (drafts_uid);
- }
+ CamelMimeMessage *message;
+ EMFormatHTMLPrint *efhp;
- g_signal_connect (composer, "send", G_CALLBACK (em_utils_composer_send_cb), emcs);
- g_signal_connect (composer, "save-draft", G_CALLBACK (em_utils_composer_save_draft_cb), emcs);
+ message = e_msg_composer_get_message_print (composer, 1);
- g_object_weak_ref ((GObject *) composer, (GWeakNotify) composer_destroy_cb, emcs);
+ efhp = em_format_html_print_new (NULL, action);
+ em_format_html_print_raw_message (efhp, message);
+ g_object_unref (efhp);
}
/* Composing messages... */
static EMsgComposer *
-create_new_composer (const char *subject, const char *fromuri, gboolean use_default_callbacks, gboolean lite)
+create_new_composer (const char *subject, const char *fromuri, gboolean lite)
{
EMsgComposer *composer;
EComposerHeaderTable *table;
@@ -678,9 +690,6 @@ create_new_composer (const char *subject, const char *fromuri, gboolean use_defa
e_composer_header_table_set_account (table, account);
e_composer_header_table_set_subject (table, subject);
- if (use_default_callbacks)
- em_composer_utils_setup_default_callbacks (composer);
-
return composer;
}
@@ -695,7 +704,7 @@ em_utils_compose_new_message (const char *fromuri)
{
GtkWidget *composer;
- composer = (GtkWidget *) create_new_composer ("", fromuri, TRUE, FALSE);
+ composer = (GtkWidget *) create_new_composer ("", fromuri, FALSE);
if (composer == NULL)
return;
@@ -715,7 +724,7 @@ em_utils_compose_lite_new_message (const char *fromuri)
{
GtkWidget *composer;
- composer = (GtkWidget *) create_new_composer ("", fromuri, TRUE, TRUE);
+ composer = (GtkWidget *) create_new_composer ("", fromuri, TRUE);
if (composer == NULL)
return NULL;
@@ -745,7 +754,6 @@ em_utils_compose_new_message_with_mailto (const char *url, const char *fromuri)
composer = e_msg_composer_new ();
table = e_msg_composer_get_header_table (composer);
- em_composer_utils_setup_default_callbacks (composer);
if (fromuri
&& (account = mail_config_get_account_by_source_url(fromuri)))
@@ -899,10 +907,12 @@ edit_message (CamelMimeMessage *message, CamelFolder *drafts, const char *uid)
composer = e_msg_composer_new_with_message (message);
- if (em_utils_folder_is_templates(drafts, NULL) == TRUE)
- em_composer_utils_setup_callbacks (composer, NULL, NULL, 0, 0, NULL, NULL);
- else
- em_composer_utils_setup_callbacks (composer, NULL, NULL, 0, 0, drafts, uid);
+ if (em_utils_folder_is_drafts (drafts, NULL)) {
+ struct emcs_t *emcs;
+
+ emcs = g_object_get_data (G_OBJECT (composer), "emcs");
+ emcs_set_drafts_info (emcs, drafts, uid);
+ }
composer_set_no_change (composer, TRUE, FALSE);
@@ -1025,7 +1035,7 @@ forward_attached (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, Cam
{
EMsgComposer *composer;
- composer = create_new_composer (subject, fromuri, TRUE, FALSE);
+ composer = create_new_composer (subject, fromuri, FALSE);
if (composer == NULL)
return;
@@ -1104,7 +1114,7 @@ forward_non_attached (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages,
text = em_utils_message_to_html (message, _("-------- Forwarded Message --------"), flags, &len, NULL, NULL);
if (text) {
- composer = create_new_composer (subject, fromuri, !uids || !uids->pdata [i], FALSE);
+ composer = create_new_composer (subject, fromuri, FALSE);
if (composer) {
if (CAMEL_IS_MULTIPART(camel_medium_get_content_object((CamelMedium *)message)))
@@ -1112,8 +1122,12 @@ forward_non_attached (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages,
e_msg_composer_set_body_text (composer, text, len);
- if (uids && uids->pdata[i])
- em_composer_utils_setup_callbacks (composer, folder, uids->pdata[i], CAMEL_MESSAGE_FORWARDED, CAMEL_MESSAGE_FORWARDED, NULL, NULL);
+ if (uids && uids->pdata[i]) {
+ struct emcs_t *emcs;
+
+ emcs = g_object_get_data (G_OBJECT (composer), "emcs");
+ emcs_set_folder_info (emcs, folder, uids->pdata[i], CAMEL_MESSAGE_FORWARDED, CAMEL_MESSAGE_FORWARDED);
+ }
composer_set_no_change (composer, TRUE, FALSE);
@@ -1269,8 +1283,6 @@ redirect_get_composer (CamelMimeMessage *message)
composer = e_msg_composer_new_redirect (message, account ? account->name : NULL);
- em_composer_utils_setup_default_callbacks (composer);
-
return composer;
}
@@ -1513,7 +1525,8 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message)
}
/* Send the receipt */
- out_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX);
+ out_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
info = camel_message_info_new (NULL);
camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
mail_append_mail (out_folder, receipt, info, em_utils_receipt_done, NULL);
@@ -1609,7 +1622,8 @@ em_utils_forward_message_raw (CamelFolder *folder, CamelMimeMessage *message, co
g_free (subject);
/* and send it */
- out_folder = mail_component_get_folder (NULL, MAIL_COMPONENT_FOLDER_OUTBOX);
+ out_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
info = camel_message_info_new (NULL);
camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
mail_append_mail (out_folder, forward, info, emu_forward_raw_done, NULL);
@@ -1625,10 +1639,10 @@ generate_account_hash (void)
EAccountList *accounts;
EIterator *iter;
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
account_hash = g_hash_table_new (camel_strcase_hash, camel_strcase_equal);
- def = mail_config_get_default_account ();
+ def = e_get_default_account ();
iter = e_list_get_iterator ((EList *) accounts);
while (e_iterator_is_valid (iter)) {
@@ -2310,6 +2324,7 @@ em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage
guint32 flags;
EMEvent *eme;
EMEventTargetMessage *target;
+ struct emcs_t *emcs;
if (folder && uid && message == NULL) {
struct _reply_data *rd = g_malloc0(sizeof(*rd));
@@ -2374,7 +2389,8 @@ em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage
composer_set_body (composer, message, source);
- em_composer_utils_setup_callbacks (composer, folder, uid, flags, flags, NULL, NULL);
+ emcs = g_object_get_data (G_OBJECT (composer), "emcs");
+ emcs_set_folder_info (emcs, folder, uid, flags, flags);
composer_set_no_change (composer, TRUE, FALSE);
@@ -2383,3 +2399,107 @@ em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage
return composer;
}
+
+static void
+post_header_clicked_cb (EComposerPostHeader *header,
+ EMailShellBackend *mail_shell_backend)
+{
+ EMFolderTreeModel *model;
+ GtkWidget *folder_tree;
+ GtkWidget *dialog;
+ GList *list;
+
+ model = e_mail_shell_backend_get_folder_tree_model (mail_shell_backend);
+ folder_tree = em_folder_tree_new_with_model (model);
+
+ em_folder_tree_set_multiselect (
+ EM_FOLDER_TREE (folder_tree), TRUE);
+ em_folder_tree_set_excluded (
+ EM_FOLDER_TREE (folder_tree),
+ EMFT_EXCLUDE_NOSELECT |
+ EMFT_EXCLUDE_VIRTUAL |
+ EMFT_EXCLUDE_VTRASH);
+
+ dialog = em_folder_selector_new (
+ EM_FOLDER_TREE (folder_tree),
+ EM_FOLDER_SELECTOR_CAN_CREATE,
+ _("Posting destination"),
+ _("Choose folders to post the message to."),
+ NULL);
+
+ list = e_composer_post_header_get_folders (header);
+ em_folder_selector_set_selected_list (
+ EM_FOLDER_SELECTOR (dialog), list);
+ g_list_foreach (list, (GFunc) g_free, NULL);
+ g_list_free (list);
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK) {
+ /* Prevent the header's "custom" flag from being reset,
+ * which is what the default method will do next. */
+ g_signal_stop_emission_by_name (header, "clicked");
+ goto exit;
+ }
+
+ list = em_folder_selector_get_selected_uris (
+ EM_FOLDER_SELECTOR (dialog));
+ e_composer_post_header_set_folders (header, list);
+ g_list_foreach (list, (GFunc) g_free, NULL);
+ g_list_free (list);
+
+exit:
+ gtk_widget_destroy (dialog);
+}
+
+/**
+ * em_configure_new_composer:
+ * @composer: a newly created #EMsgComposer
+ *
+ * Integrates a newly created #EMsgComposer into the mail backend. The
+ * composer can't link directly to the mail backend without introducing
+ * circular library dependencies, so this function finishes configuring
+ * things the #EMsgComposer instance can't do itself.
+ **/
+void
+em_configure_new_composer (EMsgComposer *composer)
+{
+ EComposerHeaderTable *table;
+ EComposerHeaderType header_type;
+ EComposerHeader *header;
+ struct emcs_t *emcs;
+
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+ header_type = E_COMPOSER_HEADER_POST_TO;
+ table = e_msg_composer_get_header_table (composer);
+ header = e_composer_header_table_get_header (table, header_type);
+
+ emcs = emcs_new ();
+
+ g_object_set_data_full (
+ G_OBJECT (composer), "emcs", emcs,
+ (GDestroyNotify) emcs_unref);
+
+ g_signal_connect (
+ composer, "send",
+ G_CALLBACK (em_utils_composer_send_cb), NULL);
+
+ g_signal_connect (
+ composer, "save-draft",
+ G_CALLBACK (em_utils_composer_save_draft_cb), NULL);
+
+ g_signal_connect (
+ composer, "print",
+ G_CALLBACK (em_utils_composer_print_cb), NULL);
+
+ /* Handle "Post To:" button clicks, which displays a folder tree
+ * widget. The composer doesn't know about folder tree widgets,
+ * so it can't handle this itself.
+ *
+ * Note: This is a G_SIGNAL_RUN_LAST signal, which allows us to
+ * stop the signal emission if the user cancels or closes
+ * the folder selector dialog. See the handler function. */
+ g_signal_connect (
+ header, "clicked",
+ G_CALLBACK (post_header_clicked_cb),
+ global_mail_shell_backend);
+}
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index 60944cb840..8ee05a50b5 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -41,14 +41,6 @@ struct _EMFormat;
struct _EAccount;
struct _EDestination;
-void em_composer_utils_setup_callbacks (struct _EMsgComposer *composer, struct _CamelFolder *folder, const char *uid,
- guint32 flags, guint32 set, struct _CamelFolder *drafts, const char *drafts_uid);
-
-#define em_composer_utils_setup_default_callbacks(composer) em_composer_utils_setup_callbacks (composer, NULL, NULL, 0, 0, NULL, NULL)
-
-void em_utils_composer_send_cb(struct _EMsgComposer *composer, gpointer user_data);
-void em_utils_composer_save_draft_cb(struct _EMsgComposer *composer, gpointer user_data);
-
void em_utils_compose_new_message (const char *fromuri);
struct _EMsgComposer * em_utils_compose_lite_new_message (const char *fromuri);
@@ -85,6 +77,8 @@ void em_utils_get_reply_all (struct _CamelMimeMessage *message, struct _CamelInt
struct _EMsgComposer * em_utils_reply_to_message (struct _CamelFolder *, const char *uid, struct _CamelMimeMessage *message, int mode, struct _EMFormat *source);
struct _EDestination ** em_utils_camel_address_to_destination (struct _CamelInternetAddress *iaddr);
+void em_configure_new_composer (struct _EMsgComposer *composer);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c
index b975b81089..7b49df8a15 100644
--- a/mail/em-filter-folder-element.c
+++ b/mail/em-filter-folder-element.c
@@ -33,11 +33,12 @@
#include "em-filter-folder-element.h"
#include "mail/em-folder-selection-button.h"
-#include "mail/mail-component.h"
#include "mail/em-utils.h"
#include "libedataserver/e-sexp.h"
#include "e-util/e-error.h"
+#include "e-mail-shell-backend.h"
+
#define d(x)
static gboolean validate(FilterElement *fe);
@@ -248,6 +249,7 @@ static GtkWidget *
get_widget(FilterElement *fe)
{
EMFilterFolderElement *ff = (EMFilterFolderElement *)fe;
+ EMFolderTreeModel *model;
GtkWidget *button;
char *uri;
@@ -255,7 +257,8 @@ get_widget(FilterElement *fe)
uri = ff->uri;
else
uri = em_uri_to_camel (ff->uri);
- button = em_folder_selection_button_new(_("Select Folder"), NULL);
+ model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend);
+ button = em_folder_selection_button_new (model, _("Select Folder"), NULL);
em_folder_selection_button_set_selection(EM_FOLDER_SELECTION_BUTTON(button), uri);
if (!ff->store_camel_uri)
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index c835a1b593..6a8a67b454 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -58,13 +58,6 @@
#include <camel/camel-vee-store.h>
#include <camel/camel-operation.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-ui-component.h>
-#include <bonobo/bonobo-ui-util.h>
-
/* for efilterbar stuff */
#include <libedataserver/e-sexp.h>
#include "mail-vfolder.h"
@@ -149,7 +142,6 @@ static void emfb_search_menu_activated(ESearchBar *esb, int id, EMFolderBrowser
static void emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb);
static void emfb_search_search_cleared(ESearchBar *esb);
-static int emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderBrowser *emfb);
static void emfb_list_message_selected (MessageList *ml, const char *uid, EMFolderBrowser *emfb);
static void emfb_expand_all_threads(BonoboUIComponent *uid, void *data, const char *path);
@@ -214,27 +206,6 @@ enum {
/* label IDs are set above this number */
#define VIEW_ITEMS_MASK 63
-/* Options for View */
-static EMFBSearchBarItem emfb_view_items[] = {
- {{ (gchar *) N_("All Messages"), VIEW_ALL_MESSAGES, 0 }, NULL},
- {{ (gchar *) N_("Unread Messages"), VIEW_UNREAD_MESSAGES, 0 }, "mail-unread"},
- {{ NULL, 0, 0 }, NULL},
- {{ (gchar *) N_("No Label"),VIEW_NO_LABEL, 0 }, NULL},
- {{ NULL, -1, 0 }, NULL}
-};
-
-/* TODO: Following options should be customizable */
-static EMFBSearchBarItem temp_view_items[] = {
- {{ NULL, 0, 0 }, NULL},
- {{ (gchar *) N_("Read Messages"), VIEW_READ_MESSAGES, 0 }, "mail-read"},
- {{ (gchar *) N_("Recent Messages"), VIEW_RECENT_MESSAGES, 0 }, NULL},
- {{ (gchar *) N_("Last 5 Days' Messages"), VIEW_LAST_FIVE_DAYS, 0 }, NULL},
- {{ (gchar *) N_("Messages with Attachments"), VIEW_WITH_ATTACHMENTS, 0 }, "mail-attachment"},
- {{ (gchar *) N_("Important Messages"), VIEW_MESSAGES_MARKED_AS_IMPORTANT, 0}, "emblem-important"},
- {{ (gchar *) N_("Messages Not Junk"), VIEW_NOT_JUNK, 0 }, "mail-mark-notjunk"},
- {{ NULL, -1, 0 }, NULL}
-};
-
static ESearchBarItem emfb_search_scope_items[] = {
E_FILTERBAR_CURRENT_FOLDER,
E_FILTERBAR_CURRENT_ACCOUNT,
@@ -244,197 +215,6 @@ static ESearchBarItem emfb_search_scope_items[] = {
static EMFolderViewClass *emfb_parent;
-/* Needed since the paned wont take the position its given otherwise ... */
-static void
-emfb_pane_realised(GtkWidget *w, EMFolderBrowser *emfb)
-{
- GConfClient *gconf;
-
- gconf = mail_config_get_gconf_client ();
-
- if (emfb->priv->show_wide)
- gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int(gconf, "/apps/evolution/mail/display/hpaned_size", NULL));
- else
- gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int(gconf, "/apps/evolution/mail/display/paned_size", NULL));
-}
-
-static gboolean
-emfb_pane_button_release_event(GtkWidget *w, GdkEventButton *e, EMFolderBrowser *emfb)
-{
- GConfClient *gconf = mail_config_get_gconf_client ();
-
- if (GTK_WIDGET_REALIZED (w)) {
- if (emfb->priv->show_wide)
- gconf_client_set_int(gconf, "/apps/evolution/mail/display/hpaned_size",
- gtk_paned_get_position(GTK_PANED(w)), NULL);
- else
- gconf_client_set_int(gconf, "/apps/evolution/mail/display/paned_size",
- gtk_paned_get_position(GTK_PANED(w)), NULL);
-
- }
-
- return FALSE;
-}
-
-static void
-free_one_ui_file (gpointer data,
- gpointer user_data)
-{
- g_free (data);
-}
-
-static GtkWidget *
-generate_viewoption_menu (GtkWidget *emfv)
-{
- GtkWidget *menu, *menu_item;
- gint i = 0;
- GSList *l;
-
- menu = gtk_menu_new ();
-
- for (i = 0; emfb_view_items[i].search.id != -1; ++i) {
- if (emfb_view_items[i].search.text) {
- char *str;
-
- str = e_str_without_underscores (_(emfb_view_items[i].search.text));
- menu_item = gtk_image_menu_item_new_with_label (str);
- if (emfb_view_items[i].image) {
- GtkWidget *image;
-
- image = gtk_image_new_from_icon_name (
- emfb_view_items[i].image,
- GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (
- GTK_IMAGE_MENU_ITEM (menu_item),
- image);
- }
- g_free (str);
- } else {
- menu_item = gtk_menu_item_new ();
- gtk_widget_set_sensitive (menu_item, FALSE);
- }
-
- g_object_set_data (G_OBJECT (menu_item), "EsbItemId",
- GINT_TO_POINTER (emfb_view_items[i].search.id));
-
- gtk_widget_show (menu_item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- }
-
- /* Add the labels */
- for (l = mail_config_get_labels (), i = 0; l; l = l->next, i++) {
- EUtilLabel *label = l->data;
- if (label->name && *(label->name)) {
- char *str;
- GdkPixmap *pixmap;
- GdkColor colour;
- GdkGC *gc;
- GtkWidget *image;
-
- gdk_color_parse(label->colour, &colour);
- gdk_colormap_alloc_color(gdk_colormap_get_system(), &colour, FALSE, TRUE);
-
- pixmap = gdk_pixmap_new(((GtkWidget *)emfv)->window, 16, 16, -1);
- gc = gdk_gc_new(((GtkWidget *)emfv)->window);
- gdk_gc_set_foreground(gc, &colour);
- gdk_draw_rectangle(pixmap, gc, TRUE, 0, 0, 16, 16);
- g_object_unref(gc);
-
- image = gtk_image_new_from_pixmap(pixmap, NULL);
- str = e_str_without_underscores (label->name);
- menu_item = gtk_image_menu_item_new_with_label (str);
- g_free (str);
- gtk_image_menu_item_set_image ((GtkImageMenuItem *)menu_item, image);
- g_object_set_data (G_OBJECT (menu_item), "EsbItemId",
- GINT_TO_POINTER (VIEW_LABEL + (VIEW_ITEMS_MASK + 1) * i));
-
- g_object_set_data_full (G_OBJECT (menu_item), "LabelTag",
- g_strdup (strncmp (label->tag, "$Label", 6) == 0 ? label->tag + 6 : label->tag),
- g_free);
- }
-
- gtk_widget_show (menu_item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- }
-
- for (i = 0; temp_view_items[i].search.id != -1; ++i) {
- if (temp_view_items[i].search.text) {
- char *str;
- str = e_str_without_underscores (_(temp_view_items[i].search.text));
- menu_item = gtk_image_menu_item_new_with_label (str);
- if (temp_view_items[i].image) {
- GtkWidget *image;
-
- image = gtk_image_new_from_icon_name (
- temp_view_items[i].image,
- GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (
- GTK_IMAGE_MENU_ITEM (menu_item),
- image);
- }
- g_free (str);
- } else {
- menu_item = gtk_menu_item_new ();
- gtk_widget_set_sensitive (menu_item, FALSE);
- }
-
- g_object_set_data (G_OBJECT (menu_item), "EsbItemId",
- GINT_TO_POINTER (temp_view_items[i].search.id));
-
- gtk_widget_show (menu_item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- }
-
- return menu;
-}
-
-#if 0
-static GArray *
-viewoption_menu_generator ()
-{
- GArray *menu = g_array_new (FALSE, FALSE, sizeof (ESearchBarItem));
- gint i = 0;
- ESearchBarItem dup_item;
- GSList *l;
-
- for (i = 0; emfb_view_items[i].search.id != -1; i++)
- g_array_append_vals (menu, &emfb_view_items[i], 1);
-
- for (l = mail_config_get_labels (); l; l = l->next) {
- ESearchBarItem item;
- EUtilLabel *label = l->data;
-
- item.text = label->name;
- item.id = VIEW_LABEL;
-
- g_array_append_vals (menu, &item, 1);
- }
-
- dup_item.id = -1;
- dup_item.text = NULL;
- g_array_append_vals (menu, &dup_item, 1);
-
- return menu;
-}
-#endif
-
-static void
-emfb_realize (GtkWidget *widget)
-{
- GtkWidget *menu;
- EMFolderBrowser *emfb = (EMFolderBrowser *)widget;
- int id;
-
- menu = generate_viewoption_menu (widget);
- id = e_search_bar_get_viewitem_id (E_SEARCH_BAR (emfb->search));
-
- e_search_bar_set_viewoption_menu (E_SEARCH_BAR (emfb->search), menu);
-
- /* restore last selected ID, if any */
- if (id != -1)
- e_search_bar_set_viewitem_id (E_SEARCH_BAR (emfb->search), id);
-}
-
static void
html_scroll (GtkHTML *html,
GtkOrientation orientation,
@@ -455,29 +235,6 @@ html_scroll (GtkHTML *html,
}
}
-static gboolean
-labels_changed_idle_cb (gpointer user_data)
-{
- EMFolderBrowser *emfb = (EMFolderBrowser*) user_data;
-
- emfb_realize (GTK_WIDGET (emfb));
-
- emfb->priv->labels_change_idle_id = 0;
-
- return FALSE;
-}
-
-static void
-gconf_labels_changed (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
-{
- EMFolderBrowser *emfb = (EMFolderBrowser*) user_data;
-
- /* regenerate menu option whenever something changed in labels */
- if (emfb && !emfb->priv->labels_change_idle_id)
- emfb->priv->labels_change_idle_id = g_idle_add (labels_changed_idle_cb, emfb);
-}
-
static void
emfb_init(GObject *o)
{
@@ -496,80 +253,78 @@ emfb_init(GObject *o)
g_signal_connect_after (((EMFormatHTML *)(emfb->view.preview))->html, "scroll", G_CALLBACK (html_scroll), emfb);
- g_slist_foreach (emfb->view.ui_files, free_one_ui_file, NULL);
- g_slist_free(emfb->view.ui_files);
-
- emfb->view.ui_files = g_slist_append(NULL,
- g_build_filename (EVOLUTION_UIDIR,
- "evolution-mail-global.xml",
- NULL));
- emfb->view.ui_files = g_slist_append(emfb->view.ui_files,
- g_build_filename (EVOLUTION_UIDIR,
- "evolution-mail-list.xml",
- NULL));
- emfb->view.ui_files = g_slist_append(emfb->view.ui_files,
- g_build_filename (EVOLUTION_UIDIR,
- "evolution-mail-message.xml",
- NULL));
+// g_slist_foreach (emfb->view.ui_files, free_one_ui_file, NULL);
+// g_slist_free(emfb->view.ui_files);
+
+// emfb->view.ui_files = g_slist_append(NULL,
+// g_build_filename (EVOLUTION_UIDIR,
+// "evolution-mail-global.xml",
+// NULL));
+// emfb->view.ui_files = g_slist_append(emfb->view.ui_files,
+// g_build_filename (EVOLUTION_UIDIR,
+// "evolution-mail-list.xml",
+// NULL));
+// emfb->view.ui_files = g_slist_append(emfb->view.ui_files,
+// g_build_filename (EVOLUTION_UIDIR,
+// "evolution-mail-message.xml",
+// NULL));
emfb->view.enable_map = g_slist_prepend(emfb->view.enable_map, (void *)emfb_enable_map);
- if (search_context) {
- const char *systemrules = g_object_get_data (G_OBJECT (search_context), "system");
- const char *userrules = g_object_get_data (G_OBJECT (search_context), "user");
- EFilterBar *efb;
- GConfClient *gconf;
-
- emfb->search = e_filter_bar_new(search_context, systemrules, userrules, emfb_search_config_search, emfb);
- efb = (EFilterBar *)emfb->search;
- efb->account_search_vf = NULL;
- efb->all_account_search_vf = NULL;
- efb->account_search_cancel = NULL;
- e_search_bar_set_menu ((ESearchBar *)emfb->search, emfb_search_items);
- e_search_bar_set_scopeoption ((ESearchBar *)emfb->search, emfb_search_scope_items);
- emfb->priv->scope_restricted = TRUE;
- g_signal_connect(emfb, "realize", G_CALLBACK(emfb_realize), NULL);
- gtk_widget_show((GtkWidget *)emfb->search);
-
- p->search_menu_activated_id = g_signal_connect(emfb->search, "menu_activated", G_CALLBACK(emfb_search_menu_activated), emfb);
- p->search_activated_id = g_signal_connect(emfb->search, "search_activated", G_CALLBACK(emfb_search_search_activated), emfb);
- g_signal_connect(emfb->search, "search_cleared", G_CALLBACK(emfb_search_search_cleared), NULL);
-
- gtk_box_pack_start((GtkBox *)emfb, (GtkWidget *)emfb->search, FALSE, TRUE, 0);
-
- gconf = mail_config_get_gconf_client ();
- emfb->priv->labels_change_notify_id = gconf_client_notify_add (gconf, E_UTIL_LABELS_GCONF_KEY, gconf_labels_changed, emfb, NULL, NULL);
- }
-
- emfb->priv->show_wide = gconf_client_get_bool(mail_config_get_gconf_client(), "/apps/evolution/mail/display/show_wide", NULL);
- emfb->vpane = emfb->priv->show_wide?gtk_hpaned_new():gtk_vpaned_new();
-
- g_signal_connect(emfb->vpane, "realize", G_CALLBACK(emfb_pane_realised), emfb);
- emfb->priv->vpane_resize_id = g_signal_connect(emfb->vpane, "button_release_event", G_CALLBACK(emfb_pane_button_release_event), emfb);
-
- gtk_widget_show(emfb->vpane);
-
- gtk_box_pack_start((GtkBox *)emfb, emfb->vpane, TRUE, TRUE, 0);
-
- gtk_paned_pack1 (GTK_PANED (emfb->vpane), GTK_WIDGET (emfb->view.list), FALSE, FALSE);
- gtk_widget_show((GtkWidget *)emfb->view.list);
-
- /* currently: just use a scrolledwindow for preview widget */
- p->scroll = gtk_scrolled_window_new(NULL, NULL);
- gtk_scrolled_window_set_policy((GtkScrolledWindow *)p->scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *)p->scroll, GTK_SHADOW_IN);
- gtk_widget_show(p->scroll);
-
- html = GTK_WIDGET (emfb->view.preview->formathtml.html);
-
- p->preview = gtk_vbox_new (FALSE, 1);
- p->search_bar = e_mail_search_bar_new (GTK_HTML (html));
- gtk_container_add((GtkContainer *)p->scroll, html);
- gtk_widget_show(html);
- gtk_box_pack_start ((GtkBox *)p->preview, p->scroll, TRUE, TRUE, 0);
- gtk_box_pack_start ((GtkBox *)p->preview, p->search_bar, FALSE, FALSE, 0);
- gtk_paned_pack2 (GTK_PANED (emfb->vpane), p->preview, TRUE, FALSE);
- gtk_widget_show(p->preview);
+// if (search_context) {
+// const char *systemrules = g_object_get_data (G_OBJECT (search_context), "system");
+// const char *userrules = g_object_get_data (G_OBJECT (search_context), "user");
+// EFilterBar *efb;
+// GConfClient *gconf;
+//
+// emfb->search = e_filter_bar_new(search_context, systemrules, userrules, emfb_search_config_search, emfb);
+// efb = (EFilterBar *)emfb->search;
+// efb->account_search_vf = NULL;
+// efb->all_account_search_vf = NULL;
+// efb->account_search_cancel = NULL;
+// e_search_bar_set_menu ((ESearchBar *)emfb->search, emfb_search_items);
+// e_search_bar_set_scopeoption ((ESearchBar *)emfb->search, emfb_search_scope_items);
+// e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, FALSE);
+// emfb->priv->scope_restricted = TRUE;
+// g_signal_connect(emfb, "realize", G_CALLBACK(emfb_realize), NULL);
+// gtk_widget_show((GtkWidget *)emfb->search);
+//
+// p->search_menu_activated_id = g_signal_connect(emfb->search, "menu_activated", G_CALLBACK(emfb_search_menu_activated), emfb);
+// p->search_activated_id = g_signal_connect(emfb->search, "search_activated", G_CALLBACK(emfb_search_search_activated), emfb);
+// g_signal_connect(emfb->search, "search_cleared", G_CALLBACK(emfb_search_search_cleared), NULL);
+//
+// gtk_box_pack_start((GtkBox *)emfb, (GtkWidget *)emfb->search, FALSE, TRUE, 0);
+//
+// gconf = mail_config_get_gconf_client ();
+// emfb->priv->labels_change_notify_id = gconf_client_notify_add (gconf, E_UTIL_LABELS_GCONF_KEY, gconf_labels_changed, emfb, NULL, NULL);
+// }
+//
+// emfb->priv->show_wide = gconf_client_get_bool(mail_config_get_gconf_client(), "/apps/evolution/mail/display/show_wide", NULL);
+// emfb->vpane = emfb->priv->show_wide?gtk_hpaned_new():gtk_vpaned_new();
+//
+// g_signal_connect(emfb->vpane, "realize", G_CALLBACK(emfb_pane_realised), emfb);
+// emfb->priv->vpane_resize_id = g_signal_connect(emfb->vpane, "button_release_event", G_CALLBACK(emfb_pane_button_release_event), emfb);
+//
+// gtk_widget_show(emfb->vpane);
+//
+// gtk_box_pack_start_defaults((GtkBox *)emfb, emfb->vpane);
+//
+// gtk_paned_pack1 (GTK_PANED (emfb->vpane), GTK_WIDGET (emfb->view.list), FALSE, FALSE);
+// gtk_widget_show((GtkWidget *)emfb->view.list);
+//
+// /* currently: just use a scrolledwindow for preview widget */
+// p->scroll = gtk_scrolled_window_new(NULL, NULL);
+// gtk_scrolled_window_set_policy((GtkScrolledWindow *)p->scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+// gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *)p->scroll, GTK_SHADOW_IN);
+// gtk_widget_show(p->scroll);
+//
+// p->preview = gtk_vbox_new (FALSE, 6);
+// gtk_container_add((GtkContainer *)p->scroll, (GtkWidget *)emfb->view.preview->formathtml.html);
+// gtk_widget_show((GtkWidget *)emfb->view.preview->formathtml.html);
+// gtk_box_pack_start ((GtkBox *)p->preview, p->scroll, TRUE, TRUE, 0);
+// gtk_box_pack_start ((GtkBox *)p->preview, em_format_html_get_search_dialog (emfb->view.preview), FALSE, FALSE, 0);
+// gtk_paned_pack2 (GTK_PANED (emfb->vpane), p->preview, TRUE, FALSE);
+// gtk_widget_show(p->preview);
g_signal_connect_swapped (
p->search_bar, "changed",
@@ -586,23 +341,11 @@ emfb_init(GObject *o)
e_event_emit((EEvent *)eme, "emfb.created", (EEventTarget *)target);
- g_signal_connect (((EMFolderView *) emfb)->list->tree, "key_press", G_CALLBACK(emfb_list_key_press), emfb);
g_signal_connect (((EMFolderView *) emfb)->list, "message_selected", G_CALLBACK (emfb_list_message_selected), emfb);
}
static void
-emfb_finalise(GObject *o)
-{
- EMFolderBrowser *emfb = (EMFolderBrowser *)o;
-
- g_free (emfb->priv->select_uid);
- g_free (emfb->priv);
-
- ((GObjectClass *)emfb_parent)->finalize(o);
-}
-
-static void
emfb_destroy(GtkObject *o)
{
EMFolderBrowser *emfb = (EMFolderBrowser *)o;
@@ -622,8 +365,8 @@ emfb_destroy(GtkObject *o)
emfb->priv->idle_scroll_id = 0;
}
- if (emfb->view.folder && emfb->priv->folder_changed_id)
- camel_object_remove_event(emfb->view.folder, emfb->priv->folder_changed_id);
+// if (emfb->view.folder && emfb->priv->folder_changed_id)
+// camel_object_remove_event(emfb->view.folder, emfb->priv->folder_changed_id);
if (emfb->priv->labels_change_notify_id) {
GConfClient *gconf = mail_config_get_gconf_client ();
@@ -643,84 +386,6 @@ emfb_destroy(GtkObject *o)
((GtkObjectClass *)emfb_parent)->destroy(o);
}
-static void
-emfb_show_search_bar (EMFolderView *folder_view)
-{
- EMFolderBrowser *browser = (EMFolderBrowser *) folder_view;
-
- gtk_widget_show (browser->priv->search_bar);
-}
-
-static void
-emfb_class_init(GObjectClass *klass)
-{
- klass->finalize = emfb_finalise;
-
- folder_browser_signals[ACCOUNT_SEARCH_ACTIVATED] =
- g_signal_new ("account_search_activated",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMFolderBrowserClass, account_search_activated),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- folder_browser_signals[ACCOUNT_SEARCH_CLEARED] =
- g_signal_new ("account_search_cleared",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMFolderBrowserClass, account_search_cleared),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-
- ((GtkObjectClass *)klass)->destroy = emfb_destroy;
- ((EMFolderViewClass *)klass)->set_folder = emfb_set_folder;
- ((EMFolderViewClass *)klass)->activate = emfb_activate;
- ((EMFolderViewClass *)klass)->show_search_bar = emfb_show_search_bar;
-}
-
-GType
-em_folder_browser_get_type(void)
-{
- static GType type = 0;
-
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(EMFolderBrowserClass),
- NULL, NULL,
- (GClassInitFunc)emfb_class_init,
- NULL, NULL,
- sizeof(EMFolderBrowser), 0,
- (GInstanceInitFunc)emfb_init
- };
- emfb_parent = g_type_class_ref(em_folder_view_get_type());
- type = g_type_register_static(em_folder_view_get_type(), "EMFolderBrowser", &info, 0);
- }
-
- return type;
-}
-
-GtkWidget *em_folder_browser_new(void)
-{
- EMFolderBrowser *emfb = g_object_new(em_folder_browser_get_type(), 0);
-
- /** @HookPoint-EMMenu: Main Mail Menu
- * @Id: org.gnome.evolution.mail.browser
- * @Class: org.gnome.evolution.mail.bonobomenu:1.0
- * @Target: EMMenuTargetSelect
- *
- * The main menu of mail view of the main application window.
- * If the folder is NULL (not selected), the target will be empty, not NULL.
- */
- ((EMFolderView *)emfb)->menu = em_menu_new("org.gnome.evolution.mail.browser");
-
- return (GtkWidget *)emfb;
-}
-
void em_folder_browser_show_preview(EMFolderBrowser *emfb, gboolean state)
{
if ((emfb->view.preview_active ^ state) == 0
@@ -776,42 +441,6 @@ gboolean em_folder_browser_get_wide (EMFolderBrowser *emfb)
return emfb->priv->show_wide;
}
-void em_folder_browser_show_wide(EMFolderBrowser *emfb, gboolean state)
-{
- GtkWidget *w;
- int paned_size;
-
- if ((emfb->priv->show_wide && state)
- || emfb->view.list == NULL) {
- emfb->priv->show_wide = state;
- return;
- }
-
- emfb->priv->show_wide = state;
-
- w = emfb->priv->show_wide?gtk_hpaned_new():gtk_vpaned_new();
-
- g_signal_handler_disconnect(emfb->vpane, emfb->priv->vpane_resize_id);
- g_signal_connect(w, "realize", G_CALLBACK(emfb_pane_realised), emfb);
- emfb->priv->vpane_resize_id = g_signal_connect(w, "button_release_event", G_CALLBACK(emfb_pane_button_release_event), emfb);
-
- gtk_box_pack_start((GtkBox *)emfb, w, TRUE, TRUE, 0);
- gtk_widget_reparent((GtkWidget *)emfb->view.list, w);
- gtk_widget_reparent((GtkWidget *)emfb->priv->preview, w);
- gtk_widget_destroy(emfb->vpane);
- gtk_container_child_set (GTK_CONTAINER (w), GTK_WIDGET (emfb->view.list), "resize", FALSE, "shrink", FALSE, NULL);
- gtk_container_child_set (GTK_CONTAINER (w), GTK_WIDGET (emfb->priv->preview), "resize", TRUE, "shrink", FALSE, NULL);
- gtk_container_resize_children ((GtkContainer *)w);
- emfb->vpane = w;
- gtk_widget_show(w);
-
- paned_size = gconf_client_get_int(mail_config_get_gconf_client(), emfb->priv->show_wide ? "/apps/evolution/mail/display/hpaned_size":"/apps/evolution/mail/display/paned_size", NULL);
- gtk_paned_set_position (GTK_PANED (emfb->vpane), paned_size);
-
- if (((EMFolderView *)emfb)->folder)
- em_folder_view_setup_view_instance ((EMFolderView *) emfb);
-}
-
/* ********************************************************************** */
/* FIXME: Need to separate system rules from user ones */
@@ -849,165 +478,6 @@ emfb_search_menu_activated(ESearchBar *esb, int id, EMFolderBrowser *emfb)
}
}
-static void
-emfb_search_config_search(EFilterBar *efb, FilterRule *rule, int id, const char *query, void *data)
-{
- EMFolderBrowser *emfb = data;
- EMailSearchBar *search_bar;
- ESearchingTokenizer *tokenizer;
- GList *partl;
- struct _camel_search_words *words;
- int i;
- GSList *strings = NULL;
-
- /* we scan the parts of a rule, and set all the types we know about to the query string */
- partl = rule->parts;
- while (partl) {
- FilterPart *part = partl->data;
-
- if (!strcmp(part->name, "subject")) {
- FilterInput *input = (FilterInput *)filter_part_find_element(part, "subject");
- if (input)
- filter_input_set_value(input, query);
- } else if (!strcmp(part->name, "body")) {
- FilterInput *input = (FilterInput *)filter_part_find_element(part, "word");
- if (input)
- filter_input_set_value(input, query);
-
- words = camel_search_words_split((unsigned char *)query);
- for (i=0;i<words->len;i++)
- strings = g_slist_prepend(strings, g_strdup(words->words[i]->word));
- camel_search_words_free (words);
- } else if(!strcmp(part->name, "sender")) {
- FilterInput *input = (FilterInput *)filter_part_find_element(part, "sender");
- if (input)
- filter_input_set_value(input, query);
- } else if(!strcmp(part->name, "to")) {
- FilterInput *input = (FilterInput *)filter_part_find_element(part, "recipient");
- if (input)
- filter_input_set_value(input, query);
- }
-
- partl = partl->next;
- }
-
- search_bar = E_MAIL_SEARCH_BAR (emfb->priv->search_bar);
-
- /* XXX This is a hack, but this code is on its way out anyway.
- * Function is called once before the search bar is created. */
- if (!E_IS_MAIL_SEARCH_BAR (search_bar))
- return;
-
- tokenizer = e_mail_search_bar_get_tokenizer (search_bar);
-
- e_searching_tokenizer_set_secondary_case_sensitivity (tokenizer, FALSE);
- e_searching_tokenizer_set_secondary_search_string (tokenizer, NULL);
-
- while (strings != NULL) {
- e_searching_tokenizer_add_secondary_search_string (
- tokenizer, strings->data);
- g_free (strings->data);
- strings = g_slist_delete_link (strings, strings);
- }
-
- e_mail_search_bar_changed (search_bar);
-}
-
-static const gchar *
-get_view_query (ESearchBar *esb, CamelFolder *folder, const char *folder_uri)
-{
- const gchar *view_sexp = NULL;
- gint id;
- GtkWidget *menu_item;
- char *tag;
- gboolean duplicate = TRUE;
-
- /* Get the current selected view */
- id = e_search_bar_get_viewitem_id (esb);
- menu_item = e_search_bar_get_selected_viewitem (esb);
-
- switch (id & VIEW_ITEMS_MASK) {
- case VIEW_ALL_MESSAGES:
- /* one space indicates no filtering */
- view_sexp = " ";
- break;
-
- /* README: All the sexp below are not rocket science but it is not straightforward as well.
- I believe it is better to document the assumptions and the conventions followed for the sexp,
- before I forget so that no one else again needs to read through the code -- Sankar */
-
- case VIEW_UNREAD_MESSAGES:
- view_sexp = "(match-all (not (system-flag \"Seen\")))";
- break;
- case VIEW_READ_MESSAGES:
- view_sexp = "(match-all (system-flag \"Seen\" ))";
- break;
- case VIEW_RECENT_MESSAGES:
- if (!em_utils_folder_is_sent (folder, folder_uri))
- view_sexp = "(match-all (> (get-received-date) (- (get-current-date) 86400)))";
- else
- view_sexp = "(match-all (> (get-sent-date) (- (get-current-date) 86400)))";
- break;
- case VIEW_LAST_FIVE_DAYS:
- if (!em_utils_folder_is_sent (folder, folder_uri))
- view_sexp = " (match-all (> (get-received-date) (- (get-current-date) 432000)))";
- else
- view_sexp = " (match-all (> (get-sent-date) (- (get-current-date) 432000)))";
- break;
- case VIEW_WITH_ATTACHMENTS:
- view_sexp = "(match-all (system-flag \"Attachments\" ))";
- break;
- case VIEW_NOT_JUNK:
- view_sexp = "(match-all (not (system-flag \"junk\")))";
- break;
- case VIEW_NO_LABEL: {
- GSList *l;
- GString *s = g_string_new ("(and");
-
- for (l = mail_config_get_labels (); l; l = l->next) {
- EUtilLabel *label = (EUtilLabel *)l->data;
-
- if (label && label->tag) {
- const gchar *tag = label->tag;
-
- if (strncmp (tag, "$Label", 6) == 0)
- tag += 6;
-
- g_string_append_printf (s, " (match-all (not (or (= (user-tag \"label\") \"%s\") (user-flag \"$Label%s\") (user-flag \"%s\"))))", tag, tag, tag);
- /* FIXME: I dont see a way of mapping this kind of sexp into sql atm. I guess this option could be kicked out */
- /* May be we should copy what I did for system flags -- Sankar */
- }
- }
-
- g_string_append (s, ")");
-
- duplicate = FALSE;
- view_sexp = g_string_free (s, FALSE);
- } break;
- case VIEW_LABEL:
- tag = (char *)g_object_get_data (G_OBJECT (menu_item), "LabelTag");
- view_sexp = g_strdup_printf ("(match-all (or (= (user-tag \"label\") \"%s\") (user-flag \"$Label%s\") (user-flag \"%s\")))", tag, tag, tag);
- duplicate = FALSE;
- break;
- case VIEW_MESSAGES_MARKED_AS_IMPORTANT:
- view_sexp = "(match-all (system-flag \"Flagged\" ))";
- break;
- case VIEW_ANY_FIELD_CONTAINS:
- break;
-
- case VIEW_CUSTOMIZE:
- /* one space indicates no filtering, so here use two */
- view_sexp = " ";
- break;
- }
-
- if (duplicate)
- view_sexp = g_strdup (view_sexp);
-
- return view_sexp;
-}
-
-
struct _setup_msg {
MailMsg base;
@@ -1336,60 +806,6 @@ emfb_search_search_cleared(ESearchBar *esb)
/* ********************************************************************** */
-static int
-emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderBrowser *emfb)
-{
- gboolean state, folder_choose = TRUE;
- if ((ev->key.state & GDK_CONTROL_MASK) != 0)
- return FALSE;
-
- switch (ev->key.keyval) {
- case GDK_space:
- if (!emfb->view.preview->caret_mode && mail_config_get_enable_magic_spacebar ()) {
- state = gtk_html_command(((EMFormatHTML *)((EMFolderView *) emfb)->preview)->html, "scroll-forward");
- if (!state) {
- folder_choose = message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN);
- if (!folder_choose)
- folder_choose = message_list_select(((EMFolderView *) emfb)->list,
- MESSAGE_LIST_SELECT_NEXT | MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN);
- }
-
- } else
- em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->scroll), TRUE);
- break;
- case GDK_BackSpace:
- if (!emfb->view.preview->caret_mode && mail_config_get_enable_magic_spacebar ()) {
- state = gtk_html_command(((EMFormatHTML *)((EMFolderView *) emfb)->preview)->html, "scroll-backward");
- if (!state) {
- folder_choose = message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, CAMEL_MESSAGE_SEEN);
- if (!folder_choose)
- folder_choose = message_list_select(((EMFolderView *) emfb)->list,
- MESSAGE_LIST_SELECT_PREVIOUS | MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN);
- }
-
- } else
- em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->scroll), FALSE);
- break;
- default:
- return FALSE;
- }
-
- if (!folder_choose && !emfb->view.preview->caret_mode && mail_config_get_enable_magic_spacebar ()) {
- /* check for unread messages. if yes .. rewindback to the folder */
- EMFolderTree *emft = g_object_get_data((GObject*)emfb, "foldertree");
- switch (ev->key.keyval) {
- case GDK_space:
- em_folder_tree_select_next_path (emft, TRUE);
- break;
- case GDK_BackSpace:
- em_folder_tree_select_prev_path (emft, TRUE);
- break;
- }
- gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list);
- }
- return TRUE;
-}
-
static void
emfb_list_message_selected (MessageList *ml, const char *uid, EMFolderBrowser *emfb)
{
@@ -1413,326 +829,6 @@ emfb_list_message_selected (MessageList *ml, const char *uid, EMFolderBrowser *e
/* ********************************************************************** */
static void
-emfb_edit_cut(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
-
- /* TODO: pity we can't sucblass this method, ugh, virtualise it? */
-
- if (GTK_WIDGET_HAS_FOCUS(((ESearchBar *)emfb->search)->entry))
- gtk_editable_cut_clipboard((GtkEditable *)((ESearchBar *)emfb->search)->entry);
- else if (GTK_WIDGET_HAS_FOCUS(emfb->view.preview->formathtml.html))
- em_format_html_display_cut(emfb->view.preview);
- else
- message_list_copy(emfb->view.list, TRUE);
-}
-
-static void
-emfb_edit_copy(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
-
- if (GTK_WIDGET_HAS_FOCUS(((ESearchBar *)emfb->search)->entry))
- gtk_editable_copy_clipboard((GtkEditable *)((ESearchBar *)emfb->search)->entry);
- else if (GTK_WIDGET_HAS_FOCUS(emfb->view.preview->formathtml.html))
- em_format_html_display_copy(emfb->view.preview);
- else
- message_list_copy(emfb->view.list, FALSE);
-}
-
-static void
-emfb_edit_paste(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
-
- if (GTK_WIDGET_HAS_FOCUS(((ESearchBar *)emfb->search)->entry))
- gtk_editable_paste_clipboard((GtkEditable *)((ESearchBar *)emfb->search)->entry);
- else
- message_list_paste(emfb->view.list);
-}
-
-static void
-emfb_edit_invert_selection(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- message_list_invert_selection(emfv->list);
-}
-
-static gboolean
-emfb_select_all_daemon (MessageList *ml)
-{
- message_list_select_all(ml);
- gtk_widget_grab_focus ((GtkWidget *)ml);
- return FALSE;
-}
-
-static void
-emfb_edit_select_all(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- if (emfv->list->threaded) {
-
- emfb_expand_all_threads (uid, data, path);
-
- /* The time out below is added so that the execution thread to
- expand all conversations threads would've completed.
-
- The timeout 505 is just to ensure that the value is a small delta
- more than the timeout value in expand_all_threads thread. */
-
- g_timeout_add (505, (GSourceFunc) emfb_select_all_daemon, emfv->list);
-
- } else {
- /* If there is no threading, just select-all immediately */
- emfb_select_all_daemon (emfv->list);
- }
-}
-
-static void
-emfb_edit_select_thread(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- message_list_select_thread(emfv->list);
-}
-
-static void
-emfb_edit_select_subthread(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- message_list_select_subthread (emfv->list);
-}
-
-static void
-emfb_folder_properties(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
-
- if (emfb->view.folder_uri)
- em_folder_properties_show(NULL, emfb->view.folder, emfb->view.folder_uri);
-}
-
-/* VIEWTHREADED*/
-static void
-emfb_expand_all_threads(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- message_list_set_threaded_expand_all(emfv->list);
-
-}
-
-static void
-emfb_collapse_all_threads(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- message_list_set_threaded_collapse_all(emfv->list);
-}
-
-static void
-emfb_folder_copy(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
- CamelFolderInfo *fi = NULL;
- CamelException ex;
-
- /* FIXME: This function MUST become multi-threaded.
- FIXME: This interface should NOT use a folderinfo */
-
- camel_exception_init (&ex);
-
- if ((fi = camel_store_get_folder_info (emfb->view.folder->parent_store,
- emfb->view.folder->full_name,
- CAMEL_STORE_FOLDER_INFO_FAST,
- &ex)) != NULL)
- em_folder_utils_copy_folder(fi, FALSE);
-
- camel_exception_clear (&ex);
-
- return;
-}
-
-static void
-emfb_folder_move(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
- CamelFolderInfo *fi = NULL;
- CamelException ex;
-
- camel_exception_init (&ex);
-
- /* FIXME: This function MUST become multi-threaded.
- FIXME: This interface should NOT use a folderinfo */
-
- if ((fi = camel_store_get_folder_info (emfb->view.folder->parent_store,
- emfb->view.folder->full_name,
- CAMEL_STORE_FOLDER_INFO_FAST,
- &ex)) != NULL)
- em_folder_utils_copy_folder(fi, TRUE);
-
- camel_exception_clear (&ex);
-
- return;
-}
-
-static void
-emfb_folder_delete(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
-
- em_folder_utils_delete_folder (emfb->view.folder);
-
- return;
-}
-
-static void
-emfb_folder_refresh(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
- EMFolderTree *tree = g_object_get_data (G_OBJECT (emfb), "foldertree");
- CamelFolder *folder;
-
- if ((folder = em_folder_tree_get_selected_folder (tree)) != NULL)
- mail_refresh_folder(folder, NULL, NULL);
-}
-
-
-static void
-emfb_folder_rename(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
-
- em_folder_utils_rename_folder (emfb->view.folder);
-
- return;
-}
-
-static void
-emfb_folder_create(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
- CamelFolderInfo *fi = NULL;
- EMFolderTree *tree = g_object_get_data (G_OBJECT (emfb), "foldertree");
-
- /* FIXME: This function MUST be multithreaded
- FIXME: This interface should NOT use a folderinfo */
- if (emfb->view.folder) {
- if ((fi = em_folder_tree_get_selected_folder_info (tree)) != NULL) {
- em_folder_utils_create_folder (fi, tree, NULL);
- camel_folder_info_free(fi);
- }
- } else {
- em_folder_utils_create_folder (NULL, tree, NULL);
- }
-
- return;
-}
-
-static void
-emfb_folder_expunge(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
-
- if (emfb->view.folder)
- em_utils_expunge_folder(gtk_widget_get_toplevel((GtkWidget *)emfb), emfb->view.folder);
-}
-
-static void
-emfb_mark_all_read(BonoboUIComponent *uid, void *data, const char *path)
-{
- /* FIXME: make a 'mark messages' function? */
- EMFolderView *emfv = data;
- GPtrArray *uids;
- int i;
-
- if (emfv->folder == NULL)
- return;
- if( em_utils_prompt_user((GtkWindow *)emfv, "/apps/evolution/mail/prompts/mark_all_read","mail:ask-mark-all-read", NULL)){
- uids = message_list_get_uids(emfv->list);
- camel_folder_freeze(emfv->folder);
- for (i=0;i<uids->len;i++)
- camel_folder_set_message_flags(emfv->folder, uids->pdata[i], CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
- camel_folder_thaw(emfv->folder);
- message_list_free_uids(emfv->list, uids);
- }
-}
-
-static void
-emfb_view_hide_read(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- message_list_hide_add(emfv->list, "(match-all (system-flag \"seen\"))", ML_HIDE_SAME, ML_HIDE_SAME);
-}
-
-static void
-emfb_view_hide_selected(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids;
-
- /* TODO: perhaps this should sit directly on message_list? */
- /* is it worth it, it's so trivial */
-
- /* A new flag CAMEL_MESSAGE_HIDDEN is added by Sankar
- while extending the CAMEL_MESSAGE_FLAGS for proxy permissions.
- This can be used to hide messages. */
-
- uids = message_list_get_selected(emfv->list);
- message_list_hide_uids(emfv->list, uids);
- message_list_free_uids(emfv->list, uids);
-}
-
-static void
-emfb_view_show_all(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- message_list_hide_clear(emfv->list);
-}
-
-/* ********************************************************************** */
-
-static void
-emfb_mail_stop(BonoboUIComponent *uid, void *data, const char *path)
-{
- mail_cancel_all();
-}
-
-static void
-emfb_tools_filters(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
-
- em_utils_edit_filters ((GtkWidget *) emfb);
-}
-
-static void
-emfb_subscribe_editor_destroy(GtkWidget *w, EMFolderBrowser *emfb)
-{
- emfb->priv->subscribe_editor = NULL;
-}
-
-static void
-emfb_tools_subscriptions(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderBrowser *emfb = data;
-
- if (emfb->priv->subscribe_editor) {
- gdk_window_show(emfb->priv->subscribe_editor->window);
- } else {
- emfb->priv->subscribe_editor = (GtkWidget *)em_subscribe_editor_new();
- e_dialog_set_transient_for((GtkWindow *)emfb->priv->subscribe_editor, (GtkWidget *)emfb);
- g_signal_connect(emfb->priv->subscribe_editor, "destroy", G_CALLBACK(emfb_subscribe_editor_destroy), emfb);
- gtk_widget_show(emfb->priv->subscribe_editor);
- }
-}
-
-static void
emfb_focus_search(BonoboUIComponent *uid, void *data, const char *path)
{
EMFolderBrowser *emfb = data;
@@ -1746,46 +842,9 @@ emfb_help_debug (BonoboUIComponent *uid, void *data, const char *path)
mail_component_show_logger ((GtkWidget *) data);
}
-static void
-emfb_tools_vfolders(BonoboUIComponent *uid, void *data, const char *path)
-{
- /* FIXME: rename/refactor this */
- vfolder_edit();
-}
-
static BonoboUIVerb emfb_verbs[] = {
- BONOBO_UI_UNSAFE_VERB ("EditCut", emfb_edit_cut),
- BONOBO_UI_UNSAFE_VERB ("EditCopy", emfb_edit_copy),
- BONOBO_UI_UNSAFE_VERB ("EditPaste", emfb_edit_paste),
-
- BONOBO_UI_UNSAFE_VERB ("EditInvertSelection", emfb_edit_invert_selection),
- BONOBO_UI_UNSAFE_VERB ("EditSelectAll", emfb_edit_select_all),
- BONOBO_UI_UNSAFE_VERB ("EditSelectThread", emfb_edit_select_thread),
- BONOBO_UI_UNSAFE_VERB ("EditSelectSubthread", emfb_edit_select_subthread),
- BONOBO_UI_UNSAFE_VERB ("ChangeFolderProperties", emfb_folder_properties),
- BONOBO_UI_UNSAFE_VERB ("FolderExpunge", emfb_folder_expunge),
- /* HideDeleted is a toggle */
- BONOBO_UI_UNSAFE_VERB ("MessageMarkAllAsRead", emfb_mark_all_read),
- BONOBO_UI_UNSAFE_VERB ("ViewHideRead", emfb_view_hide_read),
- BONOBO_UI_UNSAFE_VERB ("ViewHideSelected", emfb_view_hide_selected),
- BONOBO_UI_UNSAFE_VERB ("ViewShowAll", emfb_view_show_all),
- /* ViewThreaded is a toggle */
-
- BONOBO_UI_UNSAFE_VERB ("ViewThreadsExpandAll", emfb_expand_all_threads),
- BONOBO_UI_UNSAFE_VERB ("ViewThreadsCollapseAll", emfb_collapse_all_threads),
-
- BONOBO_UI_UNSAFE_VERB ("FolderCopy", emfb_folder_copy),
- BONOBO_UI_UNSAFE_VERB ("FolderMove", emfb_folder_move),
- BONOBO_UI_UNSAFE_VERB ("FolderDelete", emfb_folder_delete),
- BONOBO_UI_UNSAFE_VERB ("FolderRefresh", emfb_folder_refresh),
- BONOBO_UI_UNSAFE_VERB ("FolderRename", emfb_folder_rename),
- BONOBO_UI_UNSAFE_VERB ("FolderCreate", emfb_folder_create),
BONOBO_UI_UNSAFE_VERB ("HelpDebug", emfb_help_debug),
- BONOBO_UI_UNSAFE_VERB ("MailStop", emfb_mail_stop),
- BONOBO_UI_UNSAFE_VERB ("ToolsFilters", emfb_tools_filters),
- BONOBO_UI_UNSAFE_VERB ("ToolsSubscriptions", emfb_tools_subscriptions),
- BONOBO_UI_UNSAFE_VERB ("ToolsVFolders", emfb_tools_vfolders),
BONOBO_UI_UNSAFE_VERB ("FocusSearch", emfb_focus_search),
/* ViewPreview is a toggle */
@@ -1793,16 +852,13 @@ static BonoboUIVerb emfb_verbs[] = {
BONOBO_UI_VERB_END
};
-static EPixmap emfb_pixmaps[] = {
- E_PIXMAP ("/commands/FolderCreate", "folder-new", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ChangeFolderProperties", "document-properties", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/FolderCopy", "folder-copy", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/FolderMove", "folder-move", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageMarkAllAsRead", "mail-read", GTK_ICON_SIZE_MENU),
-
- E_PIXMAP_END
-};
-
+static gboolean
+emfb_select_all_daemon (MessageList *ml)
+{
+ message_list_select_all(ml);
+ gtk_widget_grab_focus ((GtkWidget *)ml);
+ return FALSE;
+}
static void
emfb_hide_deleted(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
@@ -1819,199 +875,10 @@ emfb_hide_deleted(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_E
}
static void
-emfb_view_threaded(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- GConfClient *gconf;
- EMFolderView *emfv = data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- gconf = mail_config_get_gconf_client ();
- gconf_client_set_bool(gconf, "/apps/evolution/mail/display/thread_list", state[0] != '0', NULL);
-
- if (camel_object_meta_set(emfv->folder, "evolution:thread_list", state))
- camel_object_state_write(emfv->folder);
-
- /* FIXME: do set_threaded via meta-data listener on folder? */
- message_list_set_threaded(emfv->list, state[0] != '0');
-
- /* FIXME: update selection state? */
-}
-
-static void
-emfb_view_preview(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- GConfClient *gconf;
- EMFolderView *emfv = data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- gconf = mail_config_get_gconf_client ();
- gconf_client_set_bool(gconf, "/apps/evolution/mail/display/show_preview", state[0] != '0', NULL);
-
- if (camel_object_meta_set(emfv->folder, "evolution:show_preview", state))
- camel_object_state_write(emfv->folder);
-
- /* FIXME: do this via folder listener */
- em_folder_browser_show_preview((EMFolderBrowser *)emfv, state[0] != '0');
-}
-
-static void
-emfb_show_next(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- GConfClient *gconf;
- EMFolderBrowser *emfb = data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- gconf = mail_config_get_gconf_client ();
- gconf_client_set_bool(gconf, "/apps/evolution/mail/display/show_wide", state[0] != '0', NULL);
-
- em_folder_browser_show_wide(emfb, state[0] != '0');
-}
-
-static void
-emfb_show_below(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- GConfClient *gconf;
- EMFolderBrowser *emfb = data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- gconf = mail_config_get_gconf_client ();
- gconf_client_set_bool(gconf, "/apps/evolution/mail/display/show_wide", state[0] == '0', NULL);
-
- em_folder_browser_show_wide(emfb, state[0] == '0');
-}
-
-static void
-emfb_list_scrolled (MessageList *ml, EMFolderBrowser *emfb)
-{
- EMFolderView *emfv = (EMFolderView *) emfb;
- double position;
- char *state;
-
- position = message_list_get_scrollbar_position (ml);
- state = g_strdup_printf ("%f", position);
-
- if (camel_object_meta_set (emfv->folder, "evolution:list_scroll_position", state))
- camel_object_state_write (emfv->folder);
-
- g_free (state);
-}
-
-static gboolean
-scroll_idle_cb (EMFolderBrowser *emfb)
-{
- EMFolderView *emfv = (EMFolderView *) emfb;
- double position;
- char *state;
-
- if ((state = camel_object_meta_get (emfv->folder, "evolution:list_scroll_position"))) {
- position = strtod (state, NULL);
- g_free (state);
- } else {
- position = emfb->priv->default_scroll_position;
- }
-
- message_list_set_scrollbar_position (emfv->list, position);
-
- emfb->priv->list_scrolled_id = g_signal_connect (emfv->list, "message_list_scrolled", G_CALLBACK (emfb_list_scrolled), emfb);
-
- emfb->priv->idle_scroll_id = 0;
-
- return FALSE;
-}
-
-static void
-emfb_gui_folder_changed(CamelFolder *folder, void *dummy, EMFolderBrowser *emfb)
-{
- if (emfb->priv->select_uid) {
- CamelMessageInfo *mi;
-
- mi = camel_folder_get_message_info(emfb->view.folder, emfb->priv->select_uid);
- if (mi) {
- camel_folder_free_message_info(emfb->view.folder, mi);
- em_folder_view_set_message(&emfb->view, emfb->priv->select_uid, FALSE);
- g_free (emfb->priv->select_uid);
- emfb->priv->select_uid = NULL;
- }
- }
-
- g_object_unref(emfb);
-}
-
-static void
-emfb_folder_changed(CamelFolder *folder, CamelFolderChangeInfo *changes, EMFolderBrowser *emfb)
-{
- g_object_ref(emfb);
- mail_async_event_emit(emfb->view.async, MAIL_ASYNC_GUI, (MailAsyncFunc)emfb_gui_folder_changed, folder, NULL, emfb);
-}
-
-static void
-emfb_etree_unfreeze (GtkWidget *widget, GdkEvent *event, EMFolderView *emfv)
-{
-
- ETableItem *item = e_tree_get_item (emfv->list->tree);
-
- g_object_set_data (G_OBJECT (((GnomeCanvasItem *) item)->canvas), "freeze-cursor", 0);
-}
-
-
-/* TODO: This should probably be handled by message-list, by storing/queueing
- up the select operation if its busy rebuilding the message-list */
-static void
-emfb_list_built (MessageList *ml, EMFolderBrowser *emfb)
-{
- EMFolderView *emfv = (EMFolderView *) emfb;
- double position = 0.0f;
-
- g_signal_handler_disconnect (ml, emfb->priv->list_built_id);
- emfb->priv->list_built_id = 0;
-
- if (emfv->list->cursor_uid == NULL) {
- if (emfb->priv->select_uid) {
- CamelMessageInfo *mi;
-
- /* If the message isn't in the folder yet, keep select_uid around, it could be caught by
- folder_changed, at some later date */
- mi = camel_folder_get_message_info(emfv->folder, emfb->priv->select_uid);
- if (mi) {
- camel_folder_free_message_info(emfv->folder, mi);
- em_folder_view_set_message(emfv, emfb->priv->select_uid, TRUE);
- g_free (emfb->priv->select_uid);
- emfb->priv->select_uid = NULL;
- }
-
- /* change the default to the current position */
- position = message_list_get_scrollbar_position (ml);
- } else {
- /* NOTE: not all users want this, so we need a preference for it perhaps? see bug #52887 */
- /* FIXME: if the 1st message in the list is unread, this will actually select the second unread msg */
- /*message_list_select (ml, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE);*/
- }
- }
-
- emfb->priv->default_scroll_position = position;
-
- /* FIXME: this is a gross workaround for an etable bug that I can't fix - bug #55303 */
- /* this needs to be a lower priority than anything in e-table-item/e-canvas, since
- * e_canvas_item_region_show_relay() uses a timeout, we have to use a timeout of the
- * same interval but a lower priority. */
- emfb->priv->idle_scroll_id = g_timeout_add_full (G_PRIORITY_LOW, 250, (GSourceFunc) scroll_idle_cb, emfb, NULL);
- /* FIXME: This is another ugly hack done to hide a bug that above hack leaves. */
- g_signal_connect (((GtkScrolledWindow *) ml)->vscrollbar, "button-press-event", G_CALLBACK (emfb_etree_unfreeze), emfb);
-}
-
-static void
emfb_set_search_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
{
EMFolderBrowser *emfb = (EMFolderBrowser *) emfv;
- const gchar *state;
+ char *state;
message_list_freeze(emfv->list);
@@ -2025,10 +892,10 @@ emfb_set_search_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
emfb->priv->idle_scroll_id = 0;
}
- if (emfb->view.folder) {
- camel_object_remove_event(emfb->view.folder, emfb->priv->folder_changed_id);
- emfb->priv->folder_changed_id = 0;
- }
+// if (emfb->view.folder) {
+// camel_object_remove_event(emfb->view.folder, emfb->priv->folder_changed_id);
+// emfb->priv->folder_changed_id = 0;
+// }
emfb_parent->set_folder(emfv, folder, uri);
@@ -2051,7 +918,7 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
struct _EMFolderBrowserPrivate *p = emfb->priv;
gboolean different_folder;
- message_list_freeze(emfv->list);
+// message_list_freeze(emfv->list);
if (emfb->priv->list_scrolled_id) {
g_signal_handler_disconnect (emfv->list, emfb->priv->list_scrolled_id);
@@ -2063,16 +930,16 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
emfb->priv->idle_scroll_id = 0;
}
- if (emfb->view.folder && emfb->priv->folder_changed_id) {
- camel_object_remove_event(emfb->view.folder, emfb->priv->folder_changed_id);
- emfb->priv->folder_changed_id = 0;
- }
-
- different_folder =
- emfb->view.folder != NULL &&
- folder != emfb->view.folder;
-
- emfb_parent->set_folder(emfv, folder, uri);
+// if (emfb->view.folder && emfb->priv->folder_changed_id) {
+// camel_object_remove_event(emfb->view.folder, emfb->priv->folder_changed_id);
+// emfb->priv->folder_changed_id = 0;
+// }
+//
+// different_folder =
+// emfb->view.folder != NULL &&
+// folder != emfb->view.folder;
+//
+// emfb_parent->set_folder(emfv, folder, uri);
/* This is required since we get activated the first time
before the folder is open and need to override the
@@ -2094,32 +961,32 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
gconf_client_set_bool (gconf, "/apps/evolution/mail/display/safe_list", FALSE, NULL);
}
- mail_refresh_folder(folder, NULL, NULL);
-
- emfb->priv->folder_changed_id = camel_object_hook_event(folder, "folder_changed",
- (CamelObjectEventHookFunc)emfb_folder_changed, emfb);
-
- /* FIXME: this mostly copied from activate() */
- if ((sstate = camel_object_meta_get(folder, "evolution:show_preview"))) {
- state = sstate[0] != '0';
- g_free(sstate);
- } else
- state = gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_preview", NULL);
- em_folder_browser_show_preview(emfb, state);
- if (emfv->uic)
- bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewPreview", "state", state?"1":"0", NULL);
-
- if ((sstate = camel_object_meta_get(folder, "evolution:thread_list"))) {
- state = sstate[0] != '0';
- g_free(sstate);
- } else
- state = gconf_client_get_bool(gconf, "/apps/evolution/mail/display/thread_list", NULL);
- message_list_set_threaded(emfv->list, state);
- if (emfv->uic) {
- bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreaded", "state", state?"1":"0", NULL);
- bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreadsCollapseAll", "sensitive", state?"1":"0", NULL);
- bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreadsExpandAll", "sensitive", state?"1":"0", NULL);
- }
+// mail_refresh_folder(folder, NULL, NULL);
+//
+// emfb->priv->folder_changed_id = camel_object_hook_event(folder, "folder_changed",
+// (CamelObjectEventHookFunc)emfb_folder_changed, emfb);
+//
+// /* FIXME: this mostly copied from activate() */
+// if ((sstate = camel_object_meta_get(folder, "evolution:show_preview"))) {
+// state = sstate[0] != '0';
+// g_free(sstate);
+// } else
+// state = gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_preview", NULL);
+// em_folder_browser_show_preview(emfb, state);
+// if (emfv->uic)
+// bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewPreview", "state", state?"1":"0", NULL);
+//
+// if ((sstate = camel_object_meta_get(folder, "evolution:thread_list"))) {
+// state = sstate[0] != '0';
+// g_free(sstate);
+// } else
+// state = gconf_client_get_bool(gconf, "/apps/evolution/mail/display/thread_list", NULL);
+// message_list_set_threaded(emfv->list, state);
+// if (emfv->uic) {
+// bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreaded", "state", state?"1":"0", NULL);
+// bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreadsCollapseAll", "sensitive", state?"1":"0", NULL);
+// bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreadsExpandAll", "sensitive", state?"1":"0", NULL);
+// }
if (emfv->uic) {
state = (folder->folder_flags & CAMEL_FOLDER_IS_TRASH) == 0;
@@ -2155,26 +1022,26 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
e_search_bar_paint ((ESearchBar *)emfb->search);
}
- /* This function gets triggered several times at startup,
- * so we don't want to reset the message suppression state
- * unless we're actually switching to a different folder. */
- if (different_folder)
- p->suppress_message_selection = FALSE;
-
- if (!p->suppress_message_selection)
- sstate = camel_object_meta_get (
- folder, "evolution:selected_uid");
- else
- sstate = NULL;
-
- g_free (p->select_uid);
- p->select_uid = sstate;
-
- if (emfv->list->cursor_uid == NULL && emfb->priv->list_built_id == 0)
- p->list_built_id = g_signal_connect(emfv->list, "message_list_built", G_CALLBACK (emfb_list_built), emfv);
- }
-
- message_list_thaw(emfv->list);
+// /* This function gets triggered several times at startup,
+// * so we don't want to reset the message suppression state
+// * unless we're actually switching to a different folder. */
+// if (different_folder)
+// p->suppress_message_selection = FALSE;
+//
+// if (!p->suppress_message_selection)
+// sstate = camel_object_meta_get (
+// folder, "evolution:selected_uid");
+// else
+// sstate = NULL;
+//
+// g_free (p->select_uid);
+// p->select_uid = sstate;
+//
+// if (emfv->list->cursor_uid == NULL && emfb->priv->list_built_id == 0)
+// p->list_built_id = g_signal_connect(emfv->list, "message_list_built", G_CALLBACK (emfb_list_built), emfv);
+// }
+//
+// message_list_thaw(emfv->list);
}
static void
@@ -2186,35 +1053,6 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
char *sstate;
EMFolderBrowser *emfb = (EMFolderBrowser *) emfv;
- gconf = mail_config_get_gconf_client ();
-
- /* parent loads all ui files via ui_files */
- emfb_parent->activate(emfv, uic, act);
-
- bonobo_ui_component_add_verb_list_with_data(uic, emfb_verbs, emfv);
- e_pixmaps_update(uic, emfb_pixmaps);
-
- /* FIXME: finish */
- /* (Pre)view pane size (do this first because it affects the
- preview settings - see folder_browser_set_message_preview()
- internals for details) */
- g_signal_handler_block(emfb->vpane, emfb->priv->vpane_resize_id);
- gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int (gconf, emfb->priv->show_wide ? "/apps/evolution/mail/display/hpaned_size": "/apps/evolution/mail/display/paned_size", NULL));
- g_signal_handler_unblock(emfb->vpane, emfb->priv->vpane_resize_id);
-
- /* (Pre)view toggle */
- if (emfv->folder
- && (sstate = camel_object_meta_get(emfv->folder, "evolution:show_preview"))) {
- state = sstate[0] == '1';
- g_free(sstate);
- } else {
- state = gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_preview", NULL);
- }
-
- bonobo_ui_component_set_prop(uic, "/commands/ViewPreview", "state", state?"1":"0", NULL);
- em_folder_browser_show_preview((EMFolderBrowser *)emfv, state);
- bonobo_ui_component_add_listener(uic, "ViewPreview", emfb_view_preview, emfv);
-
/* Stop button */
state = mail_msg_active((unsigned int)-1);
bonobo_ui_component_set_prop(uic, "/commands/MailStop", "sensitive", state?"1":"0", NULL);
@@ -2229,55 +1067,6 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "state", state ? "1" : "0", NULL);
bonobo_ui_component_add_listener(uic, "HideDeleted", emfb_hide_deleted, emfv);
em_folder_view_set_hide_deleted(emfv, state); /* <- not sure if this optimal, but it'll do */
-
- /* FIXME: If we have no folder, we can't do a few of the lookups we need,
- perhaps we should postpone till we can */
-
- /* ViewThreaded */
- if (emfv->folder
- && (sstate = camel_object_meta_get(emfv->folder, "evolution:thread_list"))) {
- state = sstate[0] != '0';
- g_free(sstate);
- } else {
- state = gconf_client_get_bool(gconf, "/apps/evolution/mail/display/thread_list", NULL);
- }
-
- bonobo_ui_component_set_prop(uic, "/commands/ViewThreaded", "state", state?"1":"0", NULL);
- bonobo_ui_component_set_prop(uic, "/commands/ViewThreadsCollapseAll", "sensitive", state?"1":"0", NULL);
- bonobo_ui_component_set_prop(uic, "/commands/ViewThreadsExpandAll", "sensitive", state?"1":"0", NULL);
- bonobo_ui_component_add_listener(uic, "ViewThreaded", emfb_view_threaded, emfv);
- message_list_set_threaded(emfv->list, state);
-
- /* Show wide display */
- if (emfb->priv->show_wide) {
- bonobo_ui_component_set_prop(uic, "/commands/ViewAfter", "state", "1", NULL);
- bonobo_ui_component_set_prop(uic, "/commands/ViewBelow", "state", "0", NULL);
- } else {
- bonobo_ui_component_set_prop(uic, "/commands/ViewAfter", "state", "0", NULL);
- bonobo_ui_component_set_prop(uic, "/commands/ViewBelow", "state", "1", NULL);
- }
-
- bonobo_ui_component_add_listener(uic, "ViewAfter", emfb_show_next, emfv);
- bonobo_ui_component_add_listener(uic, "ViewBelow", emfb_show_below, emfv);
- /* em_folder_browser_show_wide((EMFolderBrowser *)emfv, state); */
-
- /* FIXME: Selection state */
-
- /* FIXME: property menu customisation */
- /*folder_browser_setup_property_menu (fb, fb->uicomp);*/
-
- if (((EMFolderBrowser *)emfv)->search)
- e_search_bar_set_ui_component((ESearchBar *)((EMFolderBrowser *)emfv)->search, uic);
- } else {
- const BonoboUIVerb *v;
-
- for (v = &emfb_verbs[0]; v->cname; v++)
- bonobo_ui_component_remove_verb(uic, v->cname);
-
- if (((EMFolderBrowser *)emfv)->search)
- e_search_bar_set_ui_component((ESearchBar *)((EMFolderBrowser *)emfv)->search, NULL);
-
- emfb_parent->activate(emfv, uic, act);
}
}
diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c
index b0fbfc65d2..c22987b37c 100644
--- a/mail/em-folder-properties.c
+++ b/mail/em-folder-properties.c
@@ -39,12 +39,13 @@
#include "em-folder-properties.h"
#include "em-config.h"
-#include "mail-component.h"
#include "mail-ops.h"
#include "mail-mt.h"
#include "mail-vfolder.h"
#include "mail-config.h"
+#include "e-mail-shell-backend.h"
+
struct _prop_data {
void *object;
CamelArgV *argv;
@@ -287,7 +288,10 @@ static EMConfigItem emfp_items[] = {
static gboolean emfp_items_translated = FALSE;
static void
-emfp_dialog_got_folder_quota (CamelFolder *folder, CamelFolderQuotaInfo *quota, void *data)
+emfp_dialog_got_folder_quota (CamelFolder *folder,
+ const gchar *folder_uri,
+ CamelFolderQuotaInfo *quota,
+ void *data)
{
GtkWidget *dialog, *w;
struct _prop_data *prop_data;
@@ -295,20 +299,28 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, CamelFolderQuotaInfo *quota,
gint32 count, i,deleted;
EMConfig *ec;
EMConfigTargetFolder *target;
+ EShellBackend *shell_backend;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
CamelArgGetV *arggetv;
CamelArgV *argv;
+ CamelStore *local_store;
gboolean hide_deleted;
GConfClient *gconf;
CamelStore *store;
- char *uri = (char *)data;
- if (folder == NULL) {
- g_free (uri);
+ if (folder == NULL)
return;
- }
store = folder->parent_store;
+ shell_view = E_SHELL_VIEW (data);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ local_store = e_mail_shell_backend_get_local_store (
+ E_MAIL_SHELL_BACKEND (shell_backend));
+
prop_data = g_malloc0 (sizeof (*prop_data));
prop_data->object = folder;
camel_object_ref (folder);
@@ -341,7 +353,7 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, CamelFolderQuotaInfo *quota,
camel_object_get (folder, NULL, CAMEL_FOLDER_TOTAL, &prop_data->total, NULL);
}
- if (store == mail_component_peek_local_store(NULL)
+ if (store == local_store
&& (!strcmp(prop_data->name, "Drafts")
|| !strcmp(prop_data->name, "Templates")
|| !strcmp(prop_data->name, "Inbox")
@@ -387,11 +399,11 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, CamelFolderQuotaInfo *quota,
g_free (arggetv);
prop_data->argv = argv;
- dialog = gtk_dialog_new_with_buttons (_("Folder Properties"), NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
+ dialog = gtk_dialog_new_with_buttons (
+ _("Folder Properties"), GTK_WINDOW (shell_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
gtk_window_set_default_size ((GtkWindow *) dialog, 192, 160);
gtk_widget_ensure_style (dialog);
gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *) dialog)->vbox, 12);
@@ -411,7 +423,7 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, CamelFolderQuotaInfo *quota,
l = g_slist_prepend(l, &emfp_items[i]);
e_config_add_items((EConfig *)ec, l, emfp_commit, NULL, emfp_free, prop_data);
- target = em_config_target_new_folder(ec, folder, uri);
+ target = em_config_target_new_folder(ec, folder, folder_uri);
e_config_set_target((EConfig *)ec, (EConfigTarget *)target);
w = e_config_create_widget((EConfig *)ec);
@@ -421,15 +433,17 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, CamelFolderQuotaInfo *quota,
g_signal_connect (dialog, "response", G_CALLBACK (emfp_dialog_response), prop_data);
gtk_widget_show (dialog);
-
- g_free (uri);
}
static void
emfp_dialog_got_folder (char *uri, CamelFolder *folder, void *data)
{
+ EShellView *shell_view = data;
+
/* this should be called in a thread too */
- mail_get_folder_quota (folder, emfp_dialog_got_folder_quota, g_strdup (uri), mail_msg_unordered_push);
+ mail_get_folder_quota (
+ folder, uri, emfp_dialog_got_folder_quota,
+ shell_view, mail_msg_unordered_push);
}
/**
@@ -442,27 +456,32 @@ emfp_dialog_got_folder (char *uri, CamelFolder *folder, void *data)
* as NULL, then the folder @uri will be loaded first.
**/
void
-em_folder_properties_show(GtkWindow *parent, CamelFolder *folder, const char *uri)
+em_folder_properties_show (EShellView *shell_view,
+ CamelFolder *folder,
+ const gchar *uri)
{
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+ g_return_if_fail (uri != NULL);
+
/* HACK: its the old behaviour, not very 'neat' but it works */
- if (!strncmp(uri, "vfolder:", 8)) {
- CamelURL *url = camel_url_new(uri, NULL);
+ if (!strncmp (uri, "vfolder:", 8)) {
+ CamelURL *url = camel_url_new (uri, NULL);
/* MORE HACK: UNMATCHED is a special folder which you can't modify, so check for it here */
if (url == NULL
|| url->fragment == NULL
|| strcmp(url->fragment, CAMEL_UNMATCHED_NAME) != 0) {
if (url)
- camel_url_free(url);
- vfolder_edit_rule(uri);
+ camel_url_free (url);
+ vfolder_edit_rule (uri);
return;
}
- if (url)
- camel_url_free(url);
+ if (url != NULL)
+ camel_url_free (url);
}
if (folder == NULL)
- mail_get_folder(uri, 0, emfp_dialog_got_folder, NULL, mail_msg_unordered_push);
+ mail_get_folder(uri, 0, emfp_dialog_got_folder, shell_view, mail_msg_unordered_push);
else
- emfp_dialog_got_folder((char *)uri, folder, NULL);
+ emfp_dialog_got_folder((char *)uri, folder, shell_view);
}
diff --git a/mail/em-folder-properties.h b/mail/em-folder-properties.h
index cd58a9eeb4..330be151a3 100644
--- a/mail/em-folder-properties.h
+++ b/mail/em-folder-properties.h
@@ -24,18 +24,15 @@
#ifndef __EM_FOLDER_PROPERTIES_H__
#define __EM_FOLDER_PROPERTIES_H__
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+#include <camel/camel-folder.h>
+#include <shell/e-shell-view.h>
-struct _CamelFolder;
-struct _GtkWindow;
+G_BEGIN_DECLS
-void em_folder_properties_show(struct _GtkWindow *parent, struct _CamelFolder *folder, const char *uri);
+void em_folder_properties_show (EShellView *shell_view,
+ CamelFolder *folder,
+ const gchar *uri);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* __EM_FOLDER_PROPERTIES_H__ */
diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c
index ce97dcb85d..27b1f1b08b 100644
--- a/mail/em-folder-selection-button.c
+++ b/mail/em-folder-selection-button.c
@@ -25,11 +25,9 @@
#endif
#include <string.h>
-
-#include <e-util/e-util.h>
#include <glib/gi18n.h>
+#include <e-util/e-util.h>
-#include "mail-component.h"
#include "mail-config.h"
#include "em-folder-tree.h"
#include "em-folder-selector.h"
@@ -37,250 +35,459 @@
#include "em-folder-selection-button.h"
-static void em_folder_selection_button_class_init (EMFolderSelectionButtonClass *klass);
-static void em_folder_selection_button_init (EMFolderSelectionButton *emfsb);
-static void em_folder_selection_button_destroy (GtkObject *obj);
-static void em_folder_selection_button_finalize (GObject *obj);
-static void em_folder_selection_button_clicked (GtkButton *button);
-
-static GtkButtonClass *parent_class = NULL;
+#define EM_FOLDER_SELECTION_BUTTON_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButtonPrivate))
struct _EMFolderSelectionButtonPrivate {
+ gpointer model; /* weak pointer */
+
GtkWidget *icon;
GtkWidget *label;
- GtkWidget *selector;
-
- char *uri; /* for single-select mode */
+ gchar *uri; /* for single-select mode */
GList *uris; /* for multi-select mode */
- char *title;
- char *caption;
+ gchar *title;
+ gchar *caption;
gboolean multiple_select;
};
enum {
+ PROP_0,
+ PROP_CAPTION,
+ PROP_MODEL,
+ PROP_MULTISELECT,
+ PROP_TITLE
+};
+
+enum {
SELECTED,
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
-GType
-em_folder_selection_button_get_type (void)
+static void
+folder_selection_button_unselected (EMFolderSelectionButton *button)
{
- static GType type = 0;
+ const gchar *text;
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EMFolderSelectionButtonClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) em_folder_selection_button_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMFolderSelectionButton),
- 0, /* n_preallocs */
- (GInstanceInitFunc) em_folder_selection_button_init,
- };
+ text = _("<click here to select a folder>");
+ gtk_image_set_from_pixbuf (GTK_IMAGE (button->priv->icon), NULL);
+ gtk_label_set_text (GTK_LABEL (button->priv->label), text);
+}
+
+static void
+folder_selection_button_set_contents (EMFolderSelectionButton *button)
+{
+ EAccount *account;
+ GtkLabel *label;
+ const gchar *uri;
+ gchar *folder_name;
+
+ uri = button->priv->uri;
+ label = GTK_LABEL (button->priv->label);
+ folder_name = em_utils_folder_name_from_uri (uri);
- type = g_type_register_static (GTK_TYPE_BUTTON, "EMFolderSelectionButton", &info, 0);
+ if (folder_name == NULL) {
+ folder_selection_button_unselected (button);
+ return;
}
- return type;
+ account = mail_config_get_account_by_source_url (uri);
+
+ if (account != NULL) {
+ gchar *tmp = folder_name;
+
+ folder_name = g_strdup_printf (
+ "%s/%s", e_account_get_string (
+ account, E_ACCOUNT_NAME), _(folder_name));
+ gtk_label_set_text (label, folder_name);
+ g_free (tmp);
+ } else
+ gtk_label_set_text (label, _(folder_name));
+
+ g_free (folder_name);
}
static void
-em_folder_selection_button_class_init (EMFolderSelectionButtonClass *klass)
+folder_selection_button_set_model (EMFolderSelectionButton *button,
+ EMFolderTreeModel *model)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
- GtkButtonClass *button_class = GTK_BUTTON_CLASS (klass);
-
- parent_class = g_type_class_ref (GTK_TYPE_BUTTON);
-
- object_class->finalize = em_folder_selection_button_finalize;
- gtk_object_class->destroy = em_folder_selection_button_destroy;
- button_class->clicked = em_folder_selection_button_clicked;
-
- signals[SELECTED] = g_signal_new ("selected",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EMFolderSelectionButtonClass, selected),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_return_if_fail (button->priv->model == NULL);
+
+ button->priv->model = model;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (model), &button->priv->model);
}
static void
-set_contents_unselected (EMFolderSelectionButton *button)
+folder_selection_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- gtk_image_set_from_pixbuf (GTK_IMAGE (button->priv->icon), NULL);
- gtk_label_set_text (GTK_LABEL (button->priv->label), _("<click here to select a folder>"));
+ switch (property_id) {
+ case PROP_CAPTION:
+ em_folder_selection_button_set_caption (
+ EM_FOLDER_SELECTION_BUTTON (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_MODEL:
+ folder_selection_button_set_model (
+ EM_FOLDER_SELECTION_BUTTON (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_MULTISELECT:
+ em_folder_selection_button_set_multiselect (
+ EM_FOLDER_SELECTION_BUTTON (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_TITLE:
+ em_folder_selection_button_set_title (
+ EM_FOLDER_SELECTION_BUTTON (object),
+ g_value_get_string (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-set_contents (EMFolderSelectionButton *button)
+folder_selection_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- struct _EMFolderSelectionButtonPrivate *priv = button->priv;
- char *folder_name = em_utils_folder_name_from_uri (priv->uri);
+ switch (property_id) {
+ case PROP_CAPTION:
+ g_value_set_string (
+ value,
+ em_folder_selection_button_get_caption (
+ EM_FOLDER_SELECTION_BUTTON (object)));
+ return;
+
+ case PROP_MODEL:
+ g_value_set_object (
+ value,
+ em_folder_selection_button_get_model (
+ EM_FOLDER_SELECTION_BUTTON (object)));
+ return;
+
+ case PROP_MULTISELECT:
+ g_value_set_boolean (
+ value,
+ em_folder_selection_button_get_multiselect (
+ EM_FOLDER_SELECTION_BUTTON (object)));
+ return;
+
+ case PROP_TITLE:
+ g_value_set_string (
+ value,
+ em_folder_selection_button_get_title (
+ EM_FOLDER_SELECTION_BUTTON (object)));
+ return;
+ }
- if (folder_name) {
- EAccount *account = mail_config_get_account_by_source_url (priv->uri);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
- if (account) {
- char *tmp = folder_name;
- folder_name = g_strdup_printf ("%s/%s", e_account_get_string (account, E_ACCOUNT_NAME), _(folder_name));
- g_free (tmp);
- gtk_label_set_text (GTK_LABEL (priv->label), folder_name);
- } else
- gtk_label_set_text (GTK_LABEL (priv->label), _(folder_name));
+static void
+folder_selection_button_dispose (GObject *object)
+{
+ EMFolderSelectionButtonPrivate *priv;
- g_free (folder_name);
- } else {
- set_contents_unselected (button);
+ priv = EM_FOLDER_SELECTION_BUTTON_GET_PRIVATE (object);
+
+ if (priv->model != NULL) {
+ g_object_remove_weak_pointer (
+ G_OBJECT (priv->model), &priv->model);
+ priv->model = NULL;
}
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-em_folder_selection_button_init (EMFolderSelectionButton *emfsb)
+folder_selection_button_finalize (GObject *object)
{
- struct _EMFolderSelectionButtonPrivate *priv;
- GtkWidget *box;
+ EMFolderSelectionButtonPrivate *priv;
- priv = g_new0 (struct _EMFolderSelectionButtonPrivate, 1);
- emfsb->priv = priv;
+ priv = EM_FOLDER_SELECTION_BUTTON_GET_PRIVATE (object);
- priv->multiple_select = FALSE;
+ g_list_foreach (priv->uris, (GFunc) g_free, NULL);
+ g_list_free (priv->uris);
- box = gtk_hbox_new (FALSE, 4);
+ g_free (priv->title);
+ g_free (priv->caption);
+ g_free (priv->uri);
- priv->icon = gtk_image_new ();
- gtk_widget_show (priv->icon);
- gtk_box_pack_start (GTK_BOX (box), priv->icon, FALSE, TRUE, 0);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
- priv->label = gtk_label_new ("");
- gtk_widget_show (priv->label);
- gtk_label_set_justify (GTK_LABEL (priv->label), GTK_JUSTIFY_LEFT);
- gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.0);
- gtk_box_pack_start (GTK_BOX (box), priv->label, TRUE, TRUE, 0);
+static void
+folder_selection_button_destroy (GtkObject *object)
+{
+ EMFolderSelectionButtonPrivate *priv;
- gtk_widget_show (box);
- gtk_container_add (GTK_CONTAINER (emfsb), box);
+ priv = EM_FOLDER_SELECTION_BUTTON_GET_PRIVATE (object);
- set_contents (emfsb);
+ /* Chain up to parent's destroy() method. */
+ GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
-em_folder_selection_button_destroy (GtkObject *obj)
+folder_selection_button_clicked (GtkButton *button)
{
- struct _EMFolderSelectionButtonPrivate *priv = ((EMFolderSelectionButton *) obj)->priv;
+ EMFolderSelectionButtonPrivate *priv;
+ EMFolderTree *emft;
+ GtkWidget *dialog;
+
+ priv = EM_FOLDER_SELECTION_BUTTON_GET_PRIVATE (button);
+
+ emft = (EMFolderTree *) em_folder_tree_new_with_model (priv->model);
+
+ em_folder_tree_set_multiselect (emft, priv->multiple_select);
+ em_folder_tree_set_excluded (
+ emft, EMFT_EXCLUDE_NOSELECT |
+ EMFT_EXCLUDE_VIRTUAL | EMFT_EXCLUDE_VTRASH);
+
+ dialog = em_folder_selector_new (
+ emft, EM_FOLDER_SELECTOR_CAN_CREATE,
+ priv->title, priv->caption, NULL);
- if (priv->selector) {
- gtk_widget_destroy(priv->selector);
- priv->selector = NULL;
+ if (priv->multiple_select)
+ em_folder_selector_set_selected_list (
+ EM_FOLDER_SELECTOR (dialog), priv->uris);
+ else
+ em_folder_selector_set_selected (
+ EM_FOLDER_SELECTOR (dialog), priv->uri);
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+ goto exit;
+
+ if (priv->multiple_select) {
+ GList *uris;
+
+ uris = em_folder_selector_get_selected_uris (
+ EM_FOLDER_SELECTOR (dialog));
+ em_folder_selection_button_set_selection_mult (
+ EM_FOLDER_SELECTION_BUTTON (button), uris);
+ } else {
+ const gchar *uri;
+
+ uri = em_folder_selector_get_selected_uri (
+ EM_FOLDER_SELECTOR (dialog));
+ em_folder_selection_button_set_selection (
+ EM_FOLDER_SELECTION_BUTTON (button), uri);
}
- GTK_OBJECT_CLASS (parent_class)->destroy (obj);
+ g_signal_emit (button, signals[SELECTED], 0);
+
+exit:
+ gtk_widget_destroy (dialog);
+}
+
+static void
+folder_selection_button_class_init (EMFolderSelectionButtonClass *class)
+{
+ GObjectClass *object_class;
+ GtkObjectClass *gtk_object_class;
+ GtkButtonClass *button_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMFolderSelectionButtonPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = folder_selection_button_set_property;
+ object_class->get_property = folder_selection_button_get_property;
+ object_class->dispose = folder_selection_button_dispose;
+ object_class->finalize = folder_selection_button_finalize;
+
+ gtk_object_class = GTK_OBJECT_CLASS (class);
+ gtk_object_class->destroy = folder_selection_button_destroy;
+
+ button_class = GTK_BUTTON_CLASS (class);
+ button_class->clicked = folder_selection_button_clicked;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CAPTION,
+ g_param_spec_string (
+ "caption",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MODEL,
+ g_param_spec_object (
+ "model",
+ NULL,
+ NULL,
+ EM_TYPE_FOLDER_TREE_MODEL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MULTISELECT,
+ g_param_spec_boolean (
+ "multiselect",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_TITLE,
+ g_param_spec_string (
+ "title",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ signals[SELECTED] = g_signal_new (
+ "selected",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EMFolderSelectionButtonClass, selected),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
static void
-em_folder_selection_button_finalize (GObject *obj)
+folder_selection_button_init (EMFolderSelectionButton *emfsb)
{
- struct _EMFolderSelectionButtonPrivate *priv = ((EMFolderSelectionButton *) obj)->priv;
+ GtkWidget *box;
- GList *lst = ((EMFolderSelectionButton*) obj)->priv->uris;
- g_list_foreach (lst, (GFunc) g_free, NULL);
- g_list_free (lst);
+ emfsb->priv = EM_FOLDER_SELECTION_BUTTON_GET_PRIVATE (emfsb);
- g_free (priv->title);
- g_free (priv->caption);
- g_free (priv->uri);
- g_free (priv);
+ emfsb->priv->multiple_select = FALSE;
+
+ box = gtk_hbox_new (FALSE, 4);
- G_OBJECT_CLASS (parent_class)->finalize (obj);
+ emfsb->priv->icon = gtk_image_new ();
+ gtk_widget_show (emfsb->priv->icon);
+ gtk_box_pack_start (GTK_BOX (box), emfsb->priv->icon, FALSE, TRUE, 0);
+
+ emfsb->priv->label = gtk_label_new ("");
+ gtk_widget_show (emfsb->priv->label);
+ gtk_label_set_justify (GTK_LABEL (emfsb->priv->label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (emfsb->priv->label), 0.0, 0.0);
+ gtk_box_pack_start (GTK_BOX (box), emfsb->priv->label, TRUE, TRUE, 0);
+
+ gtk_widget_show (box);
+ gtk_container_add (GTK_CONTAINER (emfsb), box);
+
+ folder_selection_button_set_contents (emfsb);
}
-static void
-emfsb_selector_response (EMFolderSelector *emfs, int response, EMFolderSelectionButton *button)
+GType
+em_folder_selection_button_get_type (void)
{
- if (response == GTK_RESPONSE_OK) {
- if (button->priv->multiple_select) {
- GList *uris = em_folder_selector_get_selected_uris (emfs);
+ static GType type = 0;
- em_folder_selection_button_set_selection_mult (button, uris);
- g_signal_emit (button, signals[SELECTED], 0);
- } else {
- const char *uri = em_folder_selector_get_selected_uri (emfs);
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMFolderSelectionButtonClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) folder_selection_button_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMFolderSelectionButton),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) folder_selection_button_init,
+ NULL /* value_table */
+ };
- em_folder_selection_button_set_selection (button, uri);
- g_signal_emit (button, signals[SELECTED], 0);
- }
+ type = g_type_register_static (
+ GTK_TYPE_BUTTON, "EMFolderSelectionButton",
+ &type_info, 0);
}
- gtk_widget_destroy ((GtkWidget *) emfs);
+ return type;
}
-static void
-em_folder_selection_button_clicked (GtkButton *button)
+GtkWidget *
+em_folder_selection_button_new (EMFolderTreeModel *model,
+ const gchar *title,
+ const gchar *caption)
{
- struct _EMFolderSelectionButtonPrivate *priv = EM_FOLDER_SELECTION_BUTTON (button)->priv;
- EMFolderTreeModel *model;
- EMFolderTree *emft;
- GtkWidget *dialog;
+ g_return_val_if_fail (EM_IS_FOLDER_TREE_MODEL (model), NULL);
- if (GTK_BUTTON_CLASS (parent_class)->clicked != NULL)
- (* GTK_BUTTON_CLASS (parent_class)->clicked) (button);
+ return g_object_new (
+ EM_TYPE_FOLDER_SELECTION_BUTTON,
+ "model", model, "title", title,
+ "caption", caption, NULL);
+}
- if (priv->selector) {
- gtk_window_present((GtkWindow *)priv->selector);
- return;
- }
+EMFolderTreeModel *
+em_folder_selection_button_get_model (EMFolderSelectionButton *button)
+{
+ g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), NULL);
- model = mail_component_peek_tree_model (mail_component_peek ());
- emft = (EMFolderTree *) em_folder_tree_new_with_model (model);
- g_object_unref (model);
- em_folder_tree_set_multiselect (emft, priv->multiple_select);
- em_folder_tree_set_excluded(emft, EMFT_EXCLUDE_NOSELECT|EMFT_EXCLUDE_VIRTUAL|EMFT_EXCLUDE_VTRASH);
- dialog = em_folder_selector_new (emft, EM_FOLDER_SELECTOR_CAN_CREATE, priv->title, priv->caption, NULL);
- if (priv->multiple_select)
- em_folder_selector_set_selected_list ((EMFolderSelector *) dialog, priv->uris);
- else
- em_folder_selector_set_selected ((EMFolderSelector *) dialog, priv->uri);
- g_signal_connect (dialog, "response", G_CALLBACK (emfsb_selector_response), button);
- priv->selector = dialog;
- g_signal_connect(dialog, "destroy", G_CALLBACK(gtk_widget_destroyed), &priv->selector);
- gtk_widget_show (dialog);
+ return button->priv->model;
}
-GtkWidget *
-em_folder_selection_button_new (const char *title, const char *caption)
+const gchar *
+em_folder_selection_button_get_caption (EMFolderSelectionButton *button)
{
- EMFolderSelectionButton *button = g_object_new (EM_TYPE_FOLDER_SELECTION_BUTTON, NULL);
+ g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), NULL);
- button->priv->title = g_strdup (title);
+ return button->priv->caption;
+}
+
+void
+em_folder_selection_button_set_caption (EMFolderSelectionButton *button,
+ const gchar *caption)
+{
+ g_return_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button));
+
+ g_free (button->priv->caption);
button->priv->caption = g_strdup (caption);
- return GTK_WIDGET (button);
+ g_object_notify (G_OBJECT (button), "caption");
}
-void
-em_folder_selection_button_set_selection (EMFolderSelectionButton *button, const char *uri)
+gboolean
+em_folder_selection_button_get_multiselect (EMFolderSelectionButton *button)
{
- struct _EMFolderSelectionButtonPrivate *priv = button->priv;
+ g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), FALSE);
+
+ return button->priv->multiple_select;
+}
+void
+em_folder_selection_button_set_multiselect (EMFolderSelectionButton *button,
+ gboolean multiselect)
+{
g_return_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button));
- if (priv->uri != uri) {
- g_free (priv->uri);
- priv->uri = g_strdup (uri);
- }
+ button->priv->multiple_select = multiselect;
- set_contents (button);
+ g_object_notify (G_OBJECT (button), "multiselect");
}
-const char *
+const gchar *
em_folder_selection_button_get_selection (EMFolderSelectionButton *button)
{
g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), NULL);
@@ -289,20 +496,40 @@ em_folder_selection_button_get_selection (EMFolderSelectionButton *button)
}
void
-em_folder_selection_button_set_selection_mult (EMFolderSelectionButton *button, GList *uris)
+em_folder_selection_button_set_selection (EMFolderSelectionButton *button,
+ const gchar *uri)
+{
+ g_return_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button));
+
+ if (g_strcmp0 (button->priv->uri, uri) == 0)
+ return;
+
+ g_free (button->priv->uri);
+ button->priv->uri = g_strdup (uri);
+
+ folder_selection_button_set_contents (button);
+}
+
+GList *
+em_folder_selection_button_get_selection_mult (EMFolderSelectionButton *button)
+{
+ g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), NULL);
+
+ return button->priv->uris;
+}
+
+void
+em_folder_selection_button_set_selection_mult (EMFolderSelectionButton *button,
+ GList *uris)
{
- struct _EMFolderSelectionButtonPrivate *priv = button->priv;
char *caption, *tmp, *tmp2;
g_return_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button));
- if (priv->uris) {
- g_list_foreach (priv->uris, (GFunc) g_free, NULL);
- g_list_free (priv->uris);
- priv->uris = NULL;
- }
+ g_list_foreach (button->priv->uris, (GFunc) g_free, NULL);
+ g_list_free (button->priv->uris);
- priv->uris = uris;
+ button->priv->uris = uris;
/* compile the name */
caption = g_strdup ("");
@@ -319,34 +546,36 @@ em_folder_selection_button_set_selection_mult (EMFolderSelectionButton *button,
/* apparently, we do not know this folder, so we'll just skip it */
g_free (uris->data);
uris = g_list_next (uris);
- priv->uris = g_list_remove (priv->uris, uris->data);
+ button->priv->uris = g_list_remove (
+ button->priv->uris, uris->data);
}
}
if (caption[0])
- gtk_label_set_text (GTK_LABEL (priv->label), caption + 2);
+ gtk_label_set_text (
+ GTK_LABEL (button->priv->label), caption + 2);
else
- set_contents_unselected (button);
+ folder_selection_button_unselected (button);
g_free (caption);
}
-GList *
-em_folder_selection_button_get_selection_mult (EMFolderSelectionButton *button)
+const gchar *
+em_folder_selection_button_get_title (EMFolderSelectionButton *button)
{
- g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), NULL);
+ g_return_val_if_fail (EM_FOLDER_SELECTION_BUTTON (button), NULL);
- return button->priv->uris;
+ return button->priv->title;
}
void
-em_folder_selection_button_set_multiselect (EMFolderSelectionButton *button, gboolean value)
+em_folder_selection_button_set_title (EMFolderSelectionButton *button,
+ const gchar *title)
{
- button->priv->multiple_select = value;
-}
+ g_return_if_fail (EM_FOLDER_SELECTION_BUTTON (button));
-gboolean
-em_folder_selection_button_get_multiselect (EMFolderSelectionButton *button)
-{
- return button->priv->multiple_select;
+ g_free (button->priv->title);
+ button->priv->title = g_strdup (title);
+
+ g_object_notify (G_OBJECT (button), "title");
}
diff --git a/mail/em-folder-selection-button.h b/mail/em-folder-selection-button.h
index c0ab32f88e..391b6b1dbd 100644
--- a/mail/em-folder-selection-button.h
+++ b/mail/em-folder-selection-button.h
@@ -21,29 +21,41 @@
*
*/
-#ifndef __EM_FOLDER_SELECTION_BUTTON_H__
-#define __EM_FOLDER_SELECTION_BUTTON_H__
+#ifndef EM_FOLDER_SELECTION_BUTTON_H
+#define EM_FOLDER_SELECTION_BUTTON_H
#include <gtk/gtk.h>
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define EM_TYPE_FOLDER_SELECTION_BUTTON (em_folder_selection_button_get_type ())
-#define EM_FOLDER_SELECTION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButton))
-#define EM_FOLDER_SELECTION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButtonClass))
-#define EM_IS_FOLDER_SELECTION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON))
-#define EM_IS_FOLDER_SELECTION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON))
-
-typedef struct _EMFolderSelectionButton EMFolderSelectionButton;
-typedef struct _EMFolderSelectionButtonClass EMFolderSelectionButtonClass;
+#include <mail/em-folder-tree-model.h>
+
+/* Standard GObject macros */
+#define EM_TYPE_FOLDER_SELECTION_BUTTON \
+ (em_folder_selection_button_get_type ())
+#define EM_FOLDER_SELECTION_BUTTON(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButton))
+#define EM_FOLDER_SELECTION_BUTTON_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButtonClass))
+#define EM_IS_FOLDER_SELECTION_BUTTON(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON))
+#define EM_IS_FOLDER_SELECTION_BUTTON_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON))
+#define EM_FOLDER_SELECTION_BUTTON_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButtonClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMFolderSelectionButton EMFolderSelectionButton;
+typedef struct _EMFolderSelectionButtonClass EMFolderSelectionButtonClass;
+typedef struct _EMFolderSelectionButtonPrivate EMFolderSelectionButtonPrivate;
struct _EMFolderSelectionButton {
GtkButton parent;
-
- struct _EMFolderSelectionButtonPrivate *priv;
+ EMFolderSelectionButtonPrivate *priv;
};
struct _EMFolderSelectionButtonClass {
@@ -51,25 +63,43 @@ struct _EMFolderSelectionButtonClass {
/* Signals. */
- void (* selected) (EMFolderSelectionButton *button);
+ void (*selected) (EMFolderSelectionButton *button);
};
-
-GType em_folder_selection_button_get_type (void);
-
-GtkWidget *em_folder_selection_button_new (const char *title, const char *caption);
-
-void em_folder_selection_button_set_selection (EMFolderSelectionButton *button, const char *uri);
-const char *em_folder_selection_button_get_selection (EMFolderSelectionButton *button);
-
-void em_folder_selection_button_set_selection_mult (EMFolderSelectionButton *button, GList *uris);
-GList *em_folder_selection_button_get_selection_mult (EMFolderSelectionButton *button);
-
-void em_folder_selection_button_set_multiselect (EMFolderSelectionButton *button, gboolean value);
-gboolean em_folder_selection_button_get_multiselect (EMFolderSelectionButton *button);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __EM_FOLDER_SELECTION_BUTTON_H__ */
+GType em_folder_selection_button_get_type (void);
+GtkWidget * em_folder_selection_button_new
+ (EMFolderTreeModel *model,
+ const gchar *title,
+ const gchar *caption);
+EMFolderTreeModel *
+ em_folder_selection_button_get_model
+ (EMFolderSelectionButton *button);
+const gchar * em_folder_selection_button_get_caption
+ (EMFolderSelectionButton *button);
+void em_folder_selection_button_set_caption
+ (EMFolderSelectionButton *button,
+ const gchar *caption);
+gboolean em_folder_selection_button_get_multiselect
+ (EMFolderSelectionButton *button);
+void em_folder_selection_button_set_multiselect
+ (EMFolderSelectionButton *button,
+ gboolean multiselect);
+const gchar * em_folder_selection_button_get_selection
+ (EMFolderSelectionButton *button);
+void em_folder_selection_button_set_selection
+ (EMFolderSelectionButton *button,
+ const gchar *uri);
+GList * em_folder_selection_button_get_selection_mult
+ (EMFolderSelectionButton *button);
+void em_folder_selection_button_set_selection_mult
+ (EMFolderSelectionButton *button,
+ GList *uris);
+const gchar * em_folder_selection_button_get_title
+ (EMFolderSelectionButton *button);
+void em_folder_selection_button_set_title
+ (EMFolderSelectionButton *button,
+ const gchar *title);
+
+G_END_DECLS
+
+#endif /* EM_FOLDER_SELECTION_BUTTON_H */
diff --git a/mail/em-folder-selection.c b/mail/em-folder-selection.c
index cfb244c2eb..07c0bfdcff 100644
--- a/mail/em-folder-selection.c
+++ b/mail/em-folder-selection.c
@@ -32,7 +32,8 @@
#include "em-folder-tree.h"
#include "em-folder-selector.h"
#include "em-folder-selection.h"
-#include "mail-component.h"
+
+#include "e-mail-shell-backend.h"
/* TODO: rmeove this file, it could just go on em-folder-selection or em-utils */
@@ -63,7 +64,7 @@ em_select_folder (GtkWindow *parent_window, const char *title, const char *oklab
GtkWidget *dialog;
EMFolderTree *emft;
- model = mail_component_peek_tree_model (mail_component_peek ());
+ model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend);
emft = (EMFolderTree *) em_folder_tree_new_with_model (model);
if (exclude)
em_folder_tree_set_excluded_func(emft, exclude, user_data);
diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c
index ae6a8965a4..e04460b7ac 100644
--- a/mail/em-folder-selector.c
+++ b/mail/em-folder-selector.c
@@ -21,14 +21,8 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include <string.h>
-
#include <glib/gi18n.h>
-
#include <e-util/e-util.h>
#include <misc/e-gui-utils.h>
@@ -42,87 +36,84 @@
#define d(x)
-
extern CamelSession *session;
+static gpointer parent_class;
+static void
+folder_selector_finalize (GObject *object)
+{
+ EMFolderSelector *emfs = EM_FOLDER_SELECTOR (object);
-static void em_folder_selector_class_init (EMFolderSelectorClass *klass);
-static void em_folder_selector_init (EMFolderSelector *emfs);
-static void em_folder_selector_destroy (GtkObject *obj);
-static void em_folder_selector_finalize (GObject *obj);
-
-
-static GtkDialogClass *parent_class = NULL;
+ g_free (emfs->selected_path);
+ g_free (emfs->selected_uri);
+ g_free (emfs->created_uri);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
-GType
-em_folder_selector_get_type (void)
+static void
+folder_selector_destroy (GtkObject *object)
{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EMFolderSelectorClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) em_folder_selector_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMFolderSelector),
- 0, /* n_preallocs */
- (GInstanceInitFunc) em_folder_selector_init,
- };
+ EMFolderSelector *emfs = EM_FOLDER_SELECTOR (object);
+ EMFolderTreeModel *model;
- type = g_type_register_static (GTK_TYPE_DIALOG, "EMFolderSelector", &info, 0);
+ if (emfs->created_id != 0) {
+ model = em_folder_tree_get_model (emfs->emft);
+ g_signal_handler_disconnect (model, emfs->created_id);
+ emfs->created_id = 0;
}
- return type;
+ /* Chain up to parent's destroy() method. */
+ GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
-em_folder_selector_class_init (EMFolderSelectorClass *klass)
+folder_selector_class_init (EMFolderSelectorClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
+ GObjectClass *object_class;
+ GtkObjectClass *gtk_object_class;
- parent_class = g_type_class_ref (GTK_TYPE_DIALOG);
+ parent_class = g_type_class_peek_parent (class);
- object_class->finalize = em_folder_selector_finalize;
- gtk_object_class->destroy = em_folder_selector_destroy;
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = folder_selector_finalize;
+
+ gtk_object_class = GTK_OBJECT_CLASS (class);
+ gtk_object_class->destroy = folder_selector_destroy;
}
static void
-em_folder_selector_init (EMFolderSelector *emfs)
+folder_selector_init (EMFolderSelector *emfs)
{
emfs->selected_path = NULL;
emfs->selected_uri = NULL;
}
-static void
-em_folder_selector_destroy (GtkObject *obj)
+GType
+em_folder_selector_get_type (void)
{
- EMFolderSelector *emfs = (EMFolderSelector *) obj;
- EMFolderTreeModel *model;
-
- if (emfs->created_id != 0) {
- model = em_folder_tree_get_model (emfs->emft);
- g_signal_handler_disconnect (model, emfs->created_id);
- emfs->created_id = 0;
- }
-
- GTK_OBJECT_CLASS (parent_class)->destroy (obj);
-}
+ static GType type = 0;
-static void
-em_folder_selector_finalize (GObject *obj)
-{
- EMFolderSelector *emfs = (EMFolderSelector *) obj;
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMFolderSelectorClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) folder_selector_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMFolderSelector),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) folder_selector_init,
+ NULL /* value_table */
+ };
- g_free (emfs->selected_path);
- g_free (emfs->selected_uri);
- g_free (emfs->created_uri);
+ type = g_type_register_static (
+ GTK_TYPE_DIALOG, "EMFolderSelector", &type_info, 0);
+ }
- G_OBJECT_CLASS (parent_class)->finalize (obj);
+ return type;
}
static void
@@ -132,7 +123,9 @@ emfs_response (GtkWidget *dialog, int response, EMFolderSelector *emfs)
return;
g_object_set_data ((GObject *)emfs->emft, "select", GUINT_TO_POINTER (1));
- em_folder_utils_create_folder (NULL, emfs->emft, GTK_WINDOW (dialog));
+
+ /* FIXME Pass a parent window. */
+ em_folder_utils_create_folder (NULL, emfs->emft, NULL);
g_signal_stop_emission_by_name (emfs, "response");
}
@@ -172,7 +165,7 @@ folder_activated_cb (EMFolderTree *emft, const char *path, const char *uri, EMFo
void
em_folder_selector_construct (EMFolderSelector *emfs, EMFolderTree *emft, guint32 flags, const char *title, const char *text, const char *oklabel)
{
- GtkWidget *label;
+ GtkWidget *widget;
gtk_window_set_modal (GTK_WINDOW (emfs), FALSE);
gtk_window_set_default_size (GTK_WINDOW (emfs), 350, 300);
@@ -194,19 +187,29 @@ em_folder_selector_construct (EMFolderSelector *emfs, EMFolderTree *emft, guint3
gtk_dialog_set_response_sensitive (GTK_DIALOG (emfs), GTK_RESPONSE_OK, FALSE);
gtk_dialog_set_default_response (GTK_DIALOG (emfs), GTK_RESPONSE_OK);
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_box_pack_end (
+ GTK_BOX (GTK_DIALOG (emfs)->vbox), widget, TRUE, TRUE, 6);
+ gtk_widget_show (widget);
+
emfs->emft = emft;
- gtk_widget_show ((GtkWidget *) emft);
+ gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (emft));
+ gtk_widget_show (GTK_WIDGET (emft));
g_signal_connect (emfs->emft, "folder-selected", G_CALLBACK (folder_selected_cb), emfs);
g_signal_connect (emfs->emft, "folder-activated", G_CALLBACK (folder_activated_cb), emfs);
- gtk_box_pack_end (GTK_BOX (GTK_DIALOG (emfs)->vbox), (GtkWidget *)emft, TRUE, TRUE, 6);
if (text != NULL) {
- label = gtk_label_new (text);
- gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
- gtk_widget_show (label);
+ widget = gtk_label_new (text);
+ gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_LEFT);
+ gtk_widget_show (widget);
- gtk_box_pack_end (GTK_BOX (GTK_DIALOG (emfs)->vbox), label, FALSE, TRUE, 6);
+ gtk_box_pack_end (GTK_BOX (GTK_DIALOG (emfs)->vbox), widget, FALSE, TRUE, 6);
}
gtk_widget_grab_focus ((GtkWidget *) emfs->emft);
diff --git a/mail/em-folder-selector.h b/mail/em-folder-selector.h
index 12662ae5f7..5d13f10cb9 100644
--- a/mail/em-folder-selector.h
+++ b/mail/em-folder-selector.h
@@ -26,20 +26,30 @@
#include <gtk/gtk.h>
-#ifdef cplusplus
-extern "C" {
-#pragma }
-#endif /* cplusplus */
-
-#define EM_TYPE_FOLDER_SELECTOR (em_folder_selector_get_type ())
-#define EM_FOLDER_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EM_TYPE_FOLDER_SELECTOR, EMFolderSelector))
-#define EM_FOLDER_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EM_TYPE_FOLDER_SELECTOR, EMFolderSelectorClass))
-#define EM_IS_FOLDER_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EM_TYPE_FOLDER_SELECTOR))
-#define EM_IS_FOLDER_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EM_TYPE_FOLDER_SELECTOR))
-
-typedef struct _EMFolderSelector EMFolderSelector;
+/* Standard GObject macros */
+#define EM_TYPE_FOLDER_SELECTOR \
+ (em_folder_selector_get_type ())
+#define EM_FOLDER_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_TYPE_FOLDER_SELECTOR, EMFolderSelector))
+#define EM_FOLDER_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_TYPE_FOLDER_SELECTOR, EMFolderSelectorClass))
+#define EM_IS_FOLDER_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_TYPE_FOLDER_SELECTOR))
+#define EM_IS_FOLDER_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EM_TYPE_FOLDER_SELECTOR))
+#define EM_FOLDER_SELECTOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_TYPE_FOLDER_SELECTOR, EMFolderSelectorClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMFolderSelector EMFolderSelector;
+typedef struct _EMFolderSelectorClass EMFolderSelectorClass;
typedef struct _EMFolderSelectorPrivate EMFolderSelectorPrivate;
-typedef struct _EMFolderSelectorClass EMFolderSelectorClass;
struct _EMFolderSelector {
GtkDialog parent;
@@ -87,8 +97,6 @@ const char *em_folder_selector_get_selected_path (EMFolderSelector *emfs);
GList *em_folder_selector_get_selected_uris (EMFolderSelector *emfs);
GList *em_folder_selector_get_selected_paths (EMFolderSelector *emfs);
-#ifdef cplusplus
-}
-#endif /* cplusplus */
+G_END_DECLS
#endif /* EM_FOLDER_SELECTOR_H */
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index d90bcbbacb..c0e3f2bb68 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -20,9 +20,7 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "em-folder-tree-model.h"
#include <stdio.h>
#include <string.h>
@@ -37,8 +35,9 @@
#include <libedataserver/e-xml-utils.h>
#include <libedataserver/e-data-server-util.h>
-#include <e-util/e-util.h>
-#include <e-util/e-mktemp.h>
+#include "e-util/e-util.h"
+#include "e-util/e-mktemp.h"
+#include "e-util/e-account-utils.h"
#include <glib/gi18n.h>
@@ -50,7 +49,6 @@
#include "mail-mt.h"
/* sigh, these 2 only needed for outbox total count checking - a mess */
-#include "mail-component.h"
#include "mail-folder-cache.h"
#include "em-utils.h"
@@ -59,11 +57,19 @@
#include <camel/camel-folder.h>
#include <camel/camel-vee-store.h>
-#include "em-folder-tree-model.h"
+#include "e-mail-shell-backend.h"
#define u(x) /* unread count debug */
#define d(x)
+#define EM_FOLDER_TREE_MODEL_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_FOLDER_TREE_MODEL, EMFolderTreeModelPrivate))
+
+struct _EMFolderTreeModelPrivate {
+ gpointer shell_backend; /* weak pointer */
+};
+
static GType col_types[] = {
G_TYPE_STRING, /* display name */
G_TYPE_POINTER, /* store object */
@@ -77,19 +83,15 @@ static GType col_types[] = {
G_TYPE_BOOLEAN, /* has not-yet-loaded subfolders */
};
-/* GObject virtual method overrides */
-static void em_folder_tree_model_class_init (EMFolderTreeModelClass *klass);
-static void em_folder_tree_model_init (EMFolderTreeModel *model);
-static void em_folder_tree_model_finalize (GObject *obj);
-
-/* interface init methods */
-static void tree_model_iface_init (GtkTreeModelIface *iface);
-static void tree_sortable_iface_init (GtkTreeSortableIface *iface);
-
static void account_changed (EAccountList *accounts, EAccount *account, gpointer user_data);
static void account_removed (EAccountList *accounts, EAccount *account, gpointer user_data);
enum {
+ PROP_0,
+ PROP_SHELL_BACKEND
+};
+
+enum {
LOADING_ROW,
LOADED_ROW,
FOLDER_ADDED,
@@ -98,95 +100,62 @@ enum {
extern CamelStore *vfolder_store;
-static guint signals[LAST_SIGNAL] = { 0, };
-static GtkTreeStoreClass *parent_class = NULL;
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
-GType
-em_folder_tree_model_get_type (void)
+static void
+store_info_free (EMFolderTreeModelStoreInfo *si)
{
- static GType type = 0;
+ camel_object_remove_event (si->store, si->created_id);
+ camel_object_remove_event (si->store, si->deleted_id);
+ camel_object_remove_event (si->store, si->renamed_id);
+ camel_object_remove_event (si->store, si->subscribed_id);
+ camel_object_remove_event (si->store, si->unsubscribed_id);
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EMFolderTreeModelClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) em_folder_tree_model_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMFolderTreeModel),
- 0, /* n_preallocs */
- (GInstanceInitFunc) em_folder_tree_model_init,
- };
- static const GInterfaceInfo tree_model_info = {
- (GInterfaceInitFunc) tree_model_iface_init,
- NULL,
- NULL
- };
- static const GInterfaceInfo sortable_info = {
- (GInterfaceInitFunc) tree_sortable_iface_init,
- NULL,
- NULL
- };
+ g_free (si->display_name);
+ camel_object_unref (si->store);
+ gtk_tree_row_reference_free (si->row);
+ g_hash_table_destroy (si->full_hash);
+ g_free (si);
+}
+
+static void
+folder_tree_model_load_state (EMFolderTreeModel *model,
+ const gchar *filename)
+{
+ xmlNodePtr root, node;
- type = g_type_register_static (GTK_TYPE_TREE_STORE, "EMFolderTreeModel", &info, 0);
+ if (model->state)
+ xmlFreeDoc (model->state);
- g_type_add_interface_static (type, GTK_TYPE_TREE_MODEL,
- &tree_model_info);
- g_type_add_interface_static (type, GTK_TYPE_TREE_SORTABLE,
- &sortable_info);
+ if ((model->state = e_xml_parse_file (filename)) != NULL) {
+ node = xmlDocGetRootElement (model->state);
+ if (!node || strcmp ((char *)node->name, "tree-state") != 0) {
+ /* it is not expected XML file, thus free it and use the default */
+ xmlFreeDoc (model->state);
+ } else
+ return;
}
- return type;
-}
+ /* setup some defaults - expand "Local Folders" and "Search Folders" */
+ model->state = xmlNewDoc ((const unsigned char *)"1.0");
+ root = xmlNewDocNode (model->state, NULL, (const unsigned char *)"tree-state", NULL);
+ xmlDocSetRootElement (model->state, root);
+ node = xmlNewChild (root, NULL, (const unsigned char *)"node", NULL);
+ xmlSetProp (node, (const unsigned char *)"name", (const unsigned char *)"local");
+ xmlSetProp (node, (const unsigned char *)"expand", (const unsigned char *)"true");
-static void
-em_folder_tree_model_class_init (EMFolderTreeModelClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (GTK_TYPE_TREE_STORE);
-
- object_class->finalize = em_folder_tree_model_finalize;
-
- /* signals */
- signals[LOADING_ROW] =
- g_signal_new ("loading-row",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EMFolderTreeModelClass, loading_row),
- NULL, NULL,
- e_marshal_VOID__POINTER_POINTER,
- G_TYPE_NONE, 2,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
-
- signals[LOADED_ROW] =
- g_signal_new ("loaded-row",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EMFolderTreeModelClass, loaded_row),
- NULL, NULL,
- e_marshal_VOID__POINTER_POINTER,
- G_TYPE_NONE, 2,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
-
- signals[FOLDER_ADDED] =
- g_signal_new ("folder-added",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EMFolderTreeModelClass, folder_added),
- NULL, NULL,
- e_marshal_VOID__STRING_STRING,
- G_TYPE_NONE, 2,
- G_TYPE_STRING,
- G_TYPE_STRING);
+ node = xmlNewChild (root, NULL, (const unsigned char *)"node", NULL);
+ xmlSetProp (node, (const unsigned char *)"name", (const unsigned char *)"vfolder");
+ xmlSetProp (node, (const unsigned char *)"expand", (const unsigned char *)"true");
}
static int
-sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data)
+folder_tree_model_sort (GtkTreeModel *model,
+ GtkTreeIter *a,
+ GtkTreeIter *b,
+ gpointer user_data)
{
char *aname, *bname;
CamelStore *store;
@@ -194,13 +163,21 @@ sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data
guint32 aflags, bflags;
int rv = -2;
- gtk_tree_model_get (model, a, COL_BOOL_IS_STORE, &is_store,
- COL_POINTER_CAMEL_STORE, &store,
- COL_STRING_DISPLAY_NAME, &aname, COL_UINT_FLAGS, &aflags, -1);
- gtk_tree_model_get (model, b, COL_STRING_DISPLAY_NAME, &bname, COL_UINT_FLAGS, &bflags, -1);
+ gtk_tree_model_get (
+ model, a,
+ COL_BOOL_IS_STORE, &is_store,
+ COL_POINTER_CAMEL_STORE, &store,
+ COL_STRING_DISPLAY_NAME, &aname,
+ COL_UINT_FLAGS, &aflags, -1);
+
+ gtk_tree_model_get (
+ model, b,
+ COL_STRING_DISPLAY_NAME, &bname,
+ COL_UINT_FLAGS, &bflags, -1);
if (is_store) {
- /* On This Computer is always first and Search Folders is always last */
+ /* On This Computer is always first, and Search Folders
+ * is always last. */
if (!strcmp (aname, _("On This Computer")))
rv = -1;
else if (!strcmp (bname, _("On This Computer")))
@@ -210,13 +187,13 @@ sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data
else if (!strcmp (bname, _("Search Folders")))
rv = -1;
} else if (store == vfolder_store) {
- /* UNMATCHED is always last */
+ /* UNMATCHED is always last. */
if (aname && !strcmp (aname, _("UNMATCHED")))
rv = 1;
else if (bname && !strcmp (bname, _("UNMATCHED")))
rv = -1;
} else {
- /* Inbox is always first */
+ /* Inbox is always first. */
if ((aflags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX)
rv = -1;
else if ((bflags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX)
@@ -239,73 +216,57 @@ sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data
}
static void
-store_info_free (struct _EMFolderTreeModelStoreInfo *si)
+folder_tree_model_set_shell_backend (EMFolderTreeModel *model,
+ EShellBackend *shell_backend)
{
- camel_object_remove_event (si->store, si->created_id);
- camel_object_remove_event (si->store, si->deleted_id);
- camel_object_remove_event (si->store, si->renamed_id);
- camel_object_remove_event (si->store, si->subscribed_id);
- camel_object_remove_event (si->store, si->unsubscribed_id);
+ g_return_if_fail (model->priv->shell_backend == NULL);
- g_free (si->display_name);
- camel_object_unref (si->store);
- gtk_tree_row_reference_free (si->row);
- g_hash_table_destroy (si->full_hash);
- g_free (si);
+ model->priv->shell_backend = shell_backend;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_backend),
+ &model->priv->shell_backend);
}
static void
-emft_model_unread_count_changed (GtkTreeModel *model, GtkTreeIter *iter)
+folder_tree_model_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GtkTreeIter parent_iter;
- GtkTreeIter child_iter = *iter;
-
- g_signal_handlers_block_by_func (
- model, emft_model_unread_count_changed, NULL);
-
- /* Folders are displayed with a bold weight to indicate that
- they contain unread messages. We signal that parent rows
- have changed here to update them. */
-
- while (gtk_tree_model_iter_parent (model, &parent_iter, &child_iter)) {
- GtkTreePath *parent_path;
-
- parent_path = gtk_tree_model_get_path (model, &parent_iter);
- gtk_tree_model_row_changed (model, parent_path, &parent_iter);
- gtk_tree_path_free (parent_path);
- child_iter = parent_iter;
+ switch (property_id) {
+ case PROP_SHELL_BACKEND:
+ folder_tree_model_set_shell_backend (
+ EM_FOLDER_TREE_MODEL (object),
+ g_value_get_object (value));
+ return;
}
- g_signal_handlers_unblock_by_func (
- model, emft_model_unread_count_changed, NULL);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-em_folder_tree_model_init (EMFolderTreeModel *model)
+folder_tree_model_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- model->store_hash = g_hash_table_new_full (
- g_direct_hash, g_direct_equal,
- (GDestroyNotify) NULL,
- (GDestroyNotify) store_info_free);
-
- model->uri_hash = g_hash_table_new_full (
- g_str_hash, g_str_equal,
- (GDestroyNotify) g_free,
- (GDestroyNotify) gtk_tree_row_reference_free);
-
- gtk_tree_sortable_set_default_sort_func ((GtkTreeSortable *) model, sort_cb, NULL, NULL);
+ switch (property_id) {
+ case PROP_SHELL_BACKEND:
+ g_value_set_object (
+ value,
+ em_folder_tree_model_get_mail_shell_backend (
+ EM_FOLDER_TREE_MODEL (object)));
+ return;
+ }
- model->accounts = mail_config_get_accounts ();
- model->account_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
- model->account_changed_id = g_signal_connect (model->accounts, "account-changed", G_CALLBACK (account_changed), model);
- model->account_removed_id = g_signal_connect (model->accounts, "account-removed", G_CALLBACK (account_removed), model);
- /* g_signal_connect (model, "row-changed", G_CALLBACK (emft_model_unread_count_changed), NULL); */
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-em_folder_tree_model_finalize (GObject *obj)
+folder_tree_model_finalize (GObject *object)
{
- EMFolderTreeModel *model = (EMFolderTreeModel *) obj;
+ EMFolderTreeModel *model = (EMFolderTreeModel *) object;
g_free (model->filename);
if (model->state)
@@ -318,75 +279,232 @@ em_folder_tree_model_finalize (GObject *obj)
g_signal_handler_disconnect (model->accounts, model->account_changed_id);
g_signal_handler_disconnect (model->accounts, model->account_removed_id);
- G_OBJECT_CLASS (parent_class)->finalize (obj);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+folder_tree_model_constructed (GObject *object)
+{
+ EMFolderTreeModel *model = EM_FOLDER_TREE_MODEL (object);
+ EShellBackend *shell_backend;
+ const gchar *config_dir;
+ gchar *filename;
+
+ shell_backend = model->priv->shell_backend;
+ config_dir = e_shell_backend_get_config_dir (shell_backend);
+
+ filename = g_build_filename (
+ config_dir, "folder-tree-expand-state.xml", NULL);
+ folder_tree_model_load_state (model, filename);
+ model->filename = filename;
+}
+
+static void
+folder_tree_model_class_init (EMFolderTreeModelClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMFolderTreeModelPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = folder_tree_model_set_property;
+ object_class->get_property = folder_tree_model_get_property;
+ object_class->finalize = folder_tree_model_finalize;
+ object_class->constructed = folder_tree_model_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_BACKEND,
+ g_param_spec_object (
+ "shell-backend",
+ _("Shell Backend"),
+ NULL,
+ E_TYPE_SHELL_BACKEND,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ signals[LOADING_ROW] = g_signal_new (
+ "loading-row",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EMFolderTreeModelClass, loading_row),
+ NULL, NULL,
+ e_marshal_VOID__POINTER_POINTER,
+ G_TYPE_NONE, 2,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ signals[LOADED_ROW] = g_signal_new (
+ "loaded-row",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EMFolderTreeModelClass, loaded_row),
+ NULL, NULL,
+ e_marshal_VOID__POINTER_POINTER,
+ G_TYPE_NONE, 2,
+ G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ signals[FOLDER_ADDED] = g_signal_new (
+ "folder-added",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EMFolderTreeModelClass, folder_added),
+ NULL, NULL,
+ e_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
}
+static void
+folder_tree_model_init (EMFolderTreeModel *model)
+{
+ GHashTable *store_hash;
+ GHashTable *uri_hash;
+
+ store_hash = g_hash_table_new_full (
+ g_direct_hash, g_direct_equal,
+ (GDestroyNotify) NULL,
+ (GDestroyNotify) store_info_free);
+
+ uri_hash = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) gtk_tree_row_reference_free);
+
+ model->priv = EM_FOLDER_TREE_MODEL_GET_PRIVATE (model);
+ model->store_hash = store_hash;
+ model->uri_hash = uri_hash;
+
+ gtk_tree_store_set_column_types (
+ GTK_TREE_STORE (model), NUM_COLUMNS, col_types);
+ gtk_tree_sortable_set_default_sort_func (
+ GTK_TREE_SORTABLE (model),
+ folder_tree_model_sort, NULL, NULL);
+ gtk_tree_sortable_set_sort_column_id (
+ GTK_TREE_SORTABLE (model),
+ GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
+ GTK_SORT_ASCENDING);
+
+ model->accounts = e_get_account_list ();
+ model->account_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
+ model->account_changed_id = g_signal_connect (
+ model->accounts, "account-changed",
+ G_CALLBACK (account_changed), model);
+ model->account_removed_id = g_signal_connect (
+ model->accounts, "account-removed",
+ G_CALLBACK (account_removed), model);
+ //g_signal_connect (
+ // model, "row-changed",
+ // G_CALLBACK (emft_model_unread_count_changed), NULL);
+}
static void
tree_model_iface_init (GtkTreeModelIface *iface)
{
- ;
}
static void
tree_sortable_iface_init (GtkTreeSortableIface *iface)
{
- ;
+}
+
+GType
+em_folder_tree_model_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMFolderTreeModelClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) folder_tree_model_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMFolderTreeModel),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) folder_tree_model_init,
+ NULL /* value_table */
+ };
+
+ static const GInterfaceInfo tree_model_info = {
+ (GInterfaceInitFunc) tree_model_iface_init,
+ NULL,
+ NULL
+ };
+
+ static const GInterfaceInfo sortable_info = {
+ (GInterfaceInitFunc) tree_sortable_iface_init,
+ NULL,
+ NULL
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_TREE_STORE, "EMFolderTreeModel",
+ &type_info, 0);
+
+ g_type_add_interface_static (
+ type, GTK_TYPE_TREE_MODEL, &tree_model_info);
+ g_type_add_interface_static (
+ type, GTK_TYPE_TREE_SORTABLE, &sortable_info);
+ }
+
+ return type;
}
static void
-em_folder_tree_model_load_state (EMFolderTreeModel *model, const char *filename)
+emft_model_unread_count_changed (GtkTreeModel *model, GtkTreeIter *iter)
{
- xmlNodePtr root, node;
+ GtkTreeIter parent_iter;
+ GtkTreeIter child_iter = *iter;
- if (model->state)
- xmlFreeDoc (model->state);
+ g_signal_handlers_block_by_func (
+ model, emft_model_unread_count_changed, NULL);
- if ((model->state = e_xml_parse_file (filename)) != NULL) {
- node = xmlDocGetRootElement (model->state);
- if (!node || strcmp ((char *)node->name, "tree-state") != 0) {
- /* it is not expected XML file, thus free it and use the default */
- xmlFreeDoc (model->state);
- } else
- return;
- }
+ /* Folders are displayed with a bold weight to indicate that
+ they contain unread messages. We signal that parent rows
+ have changed here to update them. */
- /* setup some defaults - expand "Local Folders" and "Search Folders" */
- model->state = xmlNewDoc ((const unsigned char *)"1.0");
- root = xmlNewDocNode (model->state, NULL, (const unsigned char *)"tree-state", NULL);
- xmlDocSetRootElement (model->state, root);
+ while (gtk_tree_model_iter_parent (model, &parent_iter, &child_iter)) {
+ GtkTreePath *parent_path;
- node = xmlNewChild (root, NULL, (const unsigned char *)"node", NULL);
- xmlSetProp (node, (const unsigned char *)"name", (const unsigned char *)"local");
- xmlSetProp (node, (const unsigned char *)"expand", (const unsigned char *)"true");
+ parent_path = gtk_tree_model_get_path (model, &parent_iter);
+ gtk_tree_model_row_changed (model, parent_path, &parent_iter);
+ gtk_tree_path_free (parent_path);
+ child_iter = parent_iter;
+ }
- node = xmlNewChild (root, NULL, (const unsigned char *)"node", NULL);
- xmlSetProp (node, (const unsigned char *)"name", (const unsigned char *)"vfolder");
- xmlSetProp (node, (const unsigned char *)"expand", (const unsigned char *)"true");
+ g_signal_handlers_unblock_by_func (
+ model, emft_model_unread_count_changed, NULL);
}
+
+
EMFolderTreeModel *
-em_folder_tree_model_new (const char *evolution_dir)
+em_folder_tree_model_new (EMailShellBackend *mail_shell_backend)
{
- EMFolderTreeModel *model;
- char *filename;
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
- model = g_object_new (EM_TYPE_FOLDER_TREE_MODEL, NULL);
- gtk_tree_store_set_column_types ((GtkTreeStore *) model, NUM_COLUMNS, col_types);
- gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable *) model,
- GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
- GTK_SORT_ASCENDING);
+ return g_object_new (
+ EM_TYPE_FOLDER_TREE_MODEL,
+ "shell-backend", mail_shell_backend, NULL);
+}
- filename = g_build_filename (evolution_dir, "mail", "config", "folder-tree-expand-state.xml", NULL);
- em_folder_tree_model_load_state (model, filename);
- model->filename = filename;
+EMailShellBackend *
+em_folder_tree_model_get_mail_shell_backend (EMFolderTreeModel *model)
+{
+ g_return_val_if_fail (EM_IS_FOLDER_TREE_MODEL (model), NULL);
- return model;
+ return model->priv->shell_backend;
}
-
static void
account_changed (EAccountList *accounts, EAccount *account, gpointer user_data)
{
@@ -442,13 +560,15 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite
struct _EMFolderTreeModelStoreInfo *si,
CamelFolderInfo *fi, int fully_loaded)
{
+ EShellBackend *shell_backend;
+ EMailShellBackend *mail_shell_backend;
GtkTreeRowReference *uri_row, *path_row;
GtkTreeStore *tree_store;
unsigned int unread;
GtkTreePath *path;
GtkTreeIter sub;
gboolean load = FALSE;
- struct _CamelFolder *folder;
+ CamelFolder *folder;
gboolean emitted = FALSE;
const char *name;
const gchar *icon_name;
@@ -459,6 +579,8 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite
return;
tree_store = GTK_TREE_STORE (model);
+ shell_backend = model->priv->shell_backend;
+ mail_shell_backend = E_MAIL_SHELL_BACKEND (shell_backend);
if (!fully_loaded)
load = fi->child == NULL && !(fi->flags & (CAMEL_FOLDER_NOCHILDREN | CAMEL_FOLDER_NOINFERIORS));
@@ -476,7 +598,15 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite
/* This is duplicated in mail-folder-cache too, should perhaps be functionised */
unread = fi->unread;
if (mail_note_get_folder_from_uri(fi->uri, &folder) && folder) {
- if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX)) {
+ CamelFolder *local_drafts;
+ CamelFolder *local_outbox;
+
+ local_drafts = e_mail_shell_backend_get_folder (
+ mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
+ local_outbox = e_mail_shell_backend_get_folder (
+ mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
+
+ if (folder == local_outbox) {
int total;
if ((total = camel_folder_get_message_count (folder)) > 0) {
@@ -488,7 +618,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite
unread = total > 0 ? total : 0;
}
- if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS)) {
+ if (folder == local_drafts) {
int total;
if ((total = camel_folder_get_message_count (folder)) > 0) {
@@ -507,7 +637,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite
/* TODO: maybe this should be handled by mail_get_folderinfo (except em-folder-tree doesn't use it, duh) */
flags = fi->flags;
name = fi->name;
- if (si->store == mail_component_peek_local_store(NULL)) {
+ if (si->store == e_mail_shell_backend_get_local_store (mail_shell_backend)) {
if (!strcmp(fi->full_name, "Drafts")) {
name = _("Drafts");
} else if (!strcmp(fi->full_name, "Templates")) {
diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h
index 706e3895b3..8758b8dc9e 100644
--- a/mail/em-folder-tree-model.h
+++ b/mail/em-folder-tree-model.h
@@ -20,31 +20,39 @@
*
*/
-#ifndef __EM_FOLDER_TREE_MODEL_H__
-#define __EM_FOLDER_TREE_MODEL_H__
+#ifndef EM_FOLDER_TREE_MODEL_H
+#define EM_FOLDER_TREE_MODEL_H
#include <gtk/gtk.h>
-
#include <libxml/tree.h>
-
#include <camel/camel-store.h>
-
#include <libedataserver/e-account-list.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define EM_TYPE_FOLDER_TREE_MODEL (em_folder_tree_model_get_type ())
-#define EM_FOLDER_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EM_TYPE_FOLDER_TREE_MODEL, EMFolderTreeModel))
-#define EM_FOLDER_TREE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EM_TYPE_FOLDER_TREE_MODEL, EMFolderTreeModelClass))
-#define EM_IS_FOLDER_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EM_TYPE_FOLDER_TREE_MODEL))
-#define EM_IS_FOLDER_TREE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EM_TYPE_FOLDER_TREE_MODEL))
-#define EM_FOLDER_TREE_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EM_TYPE_FOLDER_TREE_MODEL, EMFolderTreeModelClass))
+#include <mail/e-mail-shell-backend.h>
+
+/* Standard GObject macros */
+#define EM_TYPE_FOLDER_TREE_MODEL \
+ (em_folder_tree_model_get_type ())
+#define EM_FOLDER_TREE_MODEL(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_TYPE_FOLDER_TREE_MODEL, EMFolderTreeModel))
+#define EM_FOLDER_TREE_MODEL_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_TYPE_FOLDER_TREE_MODEL, EMFolderTreeModelClass))
+#define EM_IS_FOLDER_TREE_MODEL(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_TYPE_FOLDER_TREE_MODEL))
+#define EM_IS_FOLDER_TREE_MODEL_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EM_TYPE_FOLDER_TREE_MODEL))
+#define EM_FOLDER_TREE_MODEL_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_TYPE_FOLDER_TREE_MODEL, EMFolderTreeModelClass))
+
+G_BEGIN_DECLS
typedef struct _EMFolderTreeModel EMFolderTreeModel;
typedef struct _EMFolderTreeModelClass EMFolderTreeModelClass;
+typedef struct _EMFolderTreeModelPrivate EMFolderTreeModelPrivate;
typedef struct _EMFolderTreeModelStoreInfo EMFolderTreeModelStoreInfo;
enum {
@@ -81,7 +89,8 @@ struct _EMFolderTreeModelStoreInfo {
};
struct _EMFolderTreeModel {
- GtkTreeStore parent_object;
+ GtkTreeStore parent;
+ EMFolderTreeModelPrivate *priv;
char *filename; /* state filename */
xmlDocPtr state; /* saved expanded state from previous session */
@@ -116,11 +125,12 @@ struct _EMFolderTreeModelClass {
};
-GType em_folder_tree_model_get_type (void);
-
-
-EMFolderTreeModel *em_folder_tree_model_new (const char *evolution_dir);
-
+GType em_folder_tree_model_get_type (void);
+EMFolderTreeModel *
+ em_folder_tree_model_new (EMailShellBackend *mail_shell_backend);
+EMailShellBackend *
+ em_folder_tree_model_get_mail_shell_backend
+ (EMFolderTreeModel *model);
void em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *iter,
struct _EMFolderTreeModelStoreInfo *si,
@@ -149,8 +159,6 @@ void em_folder_tree_model_set_unread_count (EMFolderTreeModel *model, CamelStore
gboolean em_folder_tree_model_is_type_inbox (EMFolderTreeModel *model, CamelStore *store, const char *full);
char * em_folder_tree_model_get_folder_name (EMFolderTreeModel *model, CamelStore *store, const char *full);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
-#endif /* __EM_FOLDER_TREE_MODEL_H__ */
+#endif /* EM_FOLDER_TREE_MODEL_H */
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 77e62dfbcf..f4980dc8e7 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -48,6 +48,7 @@
#include <camel/camel-file-utils.h>
#include <camel/camel-stream-fs.h>
+#include "e-util/e-account-utils.h"
#include "e-util/e-mktemp.h"
#include "e-util/e-request.h"
#include "e-util/e-icon-factory.h"
@@ -60,7 +61,6 @@
#include "mail-ops.h"
#include "mail-tools.h"
#include "mail-config.h"
-#include "mail-component.h"
#include "mail-send-recv.h"
#include "mail-vfolder.h"
@@ -73,8 +73,14 @@
#include "em-folder-properties.h"
#include "em-event.h"
+#include "e-mail-shell-backend.h"
+
#define d(x)
+#define EM_FOLDER_TREE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_FOLDER_TREE, EMFolderTreePrivate))
+
struct _selected_uri {
char *key; /* store:path or account/path */
char *uri;
@@ -83,7 +89,6 @@ struct _selected_uri {
};
struct _EMFolderTreePrivate {
- GtkTreeView *treeview;
EMFolderTreeModel *model;
GSList *select_uris; /* selected_uri structures of each path pending selection. */
@@ -115,6 +120,7 @@ struct _EMFolderTreePrivate {
enum {
FOLDER_ACTIVATED, /* aka double-clicked or user hit enter */
FOLDER_SELECTED,
+ POPUP_EVENT,
LAST_SIGNAL
};
@@ -153,11 +159,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
extern CamelSession *session;
extern CamelStore *vfolder_store;
-static void em_folder_tree_class_init (EMFolderTreeClass *klass);
-static void em_folder_tree_init (EMFolderTree *emft);
-static void em_folder_tree_destroy (GtkObject *obj);
-static void em_folder_tree_finalize (GObject *obj);
-
static gboolean emft_save_state (EMFolderTree *emft);
static void emft_queue_save_state (EMFolderTree *emft);
@@ -177,68 +178,170 @@ struct _emft_selection_data {
gboolean set;
};
-static GtkVBoxClass *parent_class = NULL;
+static gpointer parent_class = NULL;
-GType
-em_folder_tree_get_type (void)
+static void
+folder_tree_emit_popup_event (EMFolderTree *emft,
+ GdkEvent *event)
{
- static GType type = 0;
+ g_signal_emit (emft, signals[POPUP_EVENT], 0, event);
+}
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EMFolderTreeClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) em_folder_tree_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMFolderTree),
- 0, /* n_preallocs */
- (GInstanceInitFunc) em_folder_tree_init,
- };
+static void
+emft_free_select_uri (struct _selected_uri *u)
+{
+ g_free (u->uri);
+ if (u->store)
+ camel_object_unref (u->store);
+ g_free (u->key);
+ g_free (u->path);
+ g_free (u);
+}
+
+static void
+folder_tree_finalize (GObject *object)
+{
+ EMFolderTreePrivate *priv;
+
+ priv = EM_FOLDER_TREE_GET_PRIVATE (object);
- type = g_type_register_static (GTK_TYPE_VBOX, "EMFolderTree", &info, 0);
+ if (priv->select_uris != NULL) {
+ g_slist_foreach (
+ priv->select_uris,
+ (GFunc) emft_free_select_uri, NULL);
+ g_slist_free (priv->select_uris);
+ g_hash_table_destroy (priv->select_uris_table);
+ priv->select_uris = NULL;
}
- return type;
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-em_folder_tree_class_init (EMFolderTreeClass *klass)
+em_folder_tree_destroy (GtkObject *object)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ EMFolderTreePrivate *priv;
+
+ priv = EM_FOLDER_TREE_GET_PRIVATE (object);
+
+ if (priv->loaded_row_id != 0) {
+ g_signal_handler_disconnect (priv->model, priv->loaded_row_id);
+ priv->loaded_row_id = 0;
+ }
- parent_class = g_type_class_ref (GTK_TYPE_VBOX);
+ if (priv->save_state_id != 0) {
+ g_source_remove (priv->save_state_id);
+ emft_save_state (EM_FOLDER_TREE (object));
+ }
+
+ if (priv->autoscroll_id != 0) {
+ g_source_remove (priv->autoscroll_id);
+ priv->autoscroll_id = 0;
+ }
+
+ if (priv->autoexpand_id != 0) {
+ gtk_tree_row_reference_free (priv->autoexpand_row);
+ priv->autoexpand_row = NULL;
- object_class->finalize = em_folder_tree_finalize;
+ g_source_remove (priv->autoexpand_id);
+ priv->autoexpand_id = 0;
+ }
+
+ priv->model = NULL;
+
+ /* Chain up to parent's destroy() method. */
+ GTK_OBJECT_CLASS (parent_class)->destroy (object);
+}
+
+static void
+folder_tree_class_init (EMFolderTreeClass *class)
+{
+ GObjectClass *object_class;
+ GtkObjectClass *gtk_object_class;
+ GtkWidgetClass *widget_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMFolderTreePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = folder_tree_finalize;
+
+ gtk_object_class = GTK_OBJECT_CLASS (class);
gtk_object_class->destroy = em_folder_tree_destroy;
+ widget_class = GTK_WIDGET_CLASS (class);
widget_class->popup_menu = emft_popup_menu;
- signals[FOLDER_SELECTED] =
- g_signal_new ("folder-selected",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EMFolderTreeClass, folder_selected),
- NULL, NULL,
- e_marshal_VOID__STRING_STRING_UINT,
- G_TYPE_NONE, 3,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_UINT);
-
- signals[FOLDER_ACTIVATED] =
- g_signal_new ("folder-activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EMFolderTreeClass, folder_activated),
- NULL, NULL,
- e_marshal_VOID__STRING_STRING,
- G_TYPE_NONE, 2,
- G_TYPE_STRING,
- G_TYPE_STRING);
+ signals[FOLDER_SELECTED] = g_signal_new (
+ "folder-selected",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EMFolderTreeClass, folder_selected),
+ NULL, NULL,
+ e_marshal_VOID__STRING_STRING_UINT,
+ G_TYPE_NONE, 3,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_UINT);
+
+ signals[FOLDER_ACTIVATED] = g_signal_new (
+ "folder-activated",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EMFolderTreeClass, folder_activated),
+ NULL, NULL,
+ e_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+
+ signals[POPUP_EVENT] = g_signal_new (
+ "popup-event",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EMFolderTreeClass, popup_event),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__BOXED,
+ G_TYPE_NONE, 1,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+}
+
+static void
+folder_tree_init (EMFolderTree *emft)
+{
+ GHashTable *select_uris_table;
+
+ select_uris_table = g_hash_table_new (g_str_hash, g_str_equal);
+
+ emft->priv = EM_FOLDER_TREE_GET_PRIVATE (emft);
+ emft->priv->select_uris_table = select_uris_table;
+}
+
+GType
+em_folder_tree_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMFolderTreeClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) folder_tree_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMFolderTree),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) folder_tree_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_TREE_VIEW, "EMFolderTree", &type_info, 0);
+ }
+
+ return type;
}
static gboolean
@@ -334,91 +437,6 @@ emft_select_func(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *
return (flags & emft->priv->excluded) == 0;
}
-static void
-emft_free_select_uri(void *v, void *data)
-{
- struct _selected_uri *u = v;
-
- g_free(u->uri);
- if (u->store)
- camel_object_unref(u->store);
- g_free(u->key);
- g_free(u->path);
- g_free(u);
-}
-
-static void
-em_folder_tree_init (EMFolderTree *emft)
-{
- struct _EMFolderTreePrivate *priv;
-
- priv = g_new0 (struct _EMFolderTreePrivate, 1);
- priv->select_uris_table = g_hash_table_new(g_str_hash, g_str_equal);
- priv->treeview = NULL;
- priv->model = NULL;
- priv->drag_row = NULL;
- priv->skip_double_click = FALSE;
-
- emft->priv = priv;
-}
-
-static void
-em_folder_tree_finalize (GObject *obj)
-{
- EMFolderTree *emft = (EMFolderTree *) obj;
-
- if (emft->priv->select_uris) {
- g_slist_foreach(emft->priv->select_uris, emft_free_select_uri, emft);
- g_slist_free(emft->priv->select_uris);
- g_hash_table_destroy(emft->priv->select_uris_table);
- emft->priv->select_uris = NULL;
- }
-
- g_free (emft->priv);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-em_folder_tree_destroy (GtkObject *obj)
-{
- EMFolderTree *emft = (EMFolderTree *) obj;
- struct _EMFolderTreePrivate *priv = emft->priv;
-
- if (priv->loading_row_id != 0) {
- g_signal_handler_disconnect (priv->model, priv->loading_row_id);
- priv->loading_row_id = 0;
- }
-
- if (priv->loaded_row_id != 0) {
- g_signal_handler_disconnect (priv->model, priv->loaded_row_id);
- priv->loaded_row_id = 0;
- }
-
- if (priv->save_state_id != 0) {
- g_source_remove (priv->save_state_id);
- emft_save_state (emft);
- }
-
- if (priv->autoscroll_id != 0) {
- g_source_remove (priv->autoscroll_id);
- priv->autoscroll_id = 0;
- }
-
- if (priv->autoexpand_id != 0) {
- gtk_tree_row_reference_free (priv->autoexpand_row);
- priv->autoexpand_row = NULL;
-
- g_source_remove (priv->autoexpand_id);
- priv->autoexpand_id = 0;
- }
-
- priv->treeview = NULL;
- priv->model = NULL;
-
- GTK_OBJECT_CLASS (parent_class)->destroy (obj);
-}
-
static GtkTreeView *
folder_tree_new (EMFolderTree *emft, EMFolderTreeModel *model)
{
@@ -432,7 +450,10 @@ folder_tree_new (EMFolderTree *emft, EMFolderTreeModel *model)
gconf = mail_config_get_gconf_client ();
side_bar_search = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/side_bar_search", NULL);
- tree = gtk_tree_view_new_with_model ((GtkTreeModel *) model);
+ /* FIXME[KILL-BONOBO] Gross hack */
+ tree = GTK_WIDGET (emft);
+ gtk_tree_view_set_model (
+ GTK_TREE_VIEW (tree), GTK_TREE_MODEL (model));
GTK_WIDGET_SET_FLAGS(tree, GTK_CAN_FOCUS);
column = gtk_tree_view_column_new ();
@@ -467,39 +488,31 @@ em_folder_tree_construct (EMFolderTree *emft, EMFolderTreeModel *model)
{
struct _EMFolderTreePrivate *priv = emft->priv;
GtkTreeSelection *selection;
- GtkWidget *scrolled;
-
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN);
priv->model = model;
- priv->treeview = folder_tree_new (emft, model);
- gtk_widget_show ((GtkWidget *) priv->treeview);
+ folder_tree_new (emft, model);
+ gtk_widget_show (GTK_WIDGET (emft));
- g_signal_connect (priv->treeview, "row-expanded", G_CALLBACK (emft_tree_row_expanded), emft);
- g_signal_connect (priv->treeview, "test-collapse-row", G_CALLBACK (emft_tree_test_collapse_row), emft);
- g_signal_connect (priv->treeview, "row-activated", G_CALLBACK (emft_tree_row_activated), emft);
- g_signal_connect (priv->treeview, "button-press-event", G_CALLBACK (emft_tree_button_press), emft);
- g_signal_connect (priv->treeview, "key-press-event", G_CALLBACK (emft_tree_user_event), emft);
+ g_signal_connect (emft, "row-expanded", G_CALLBACK (emft_tree_row_expanded), emft);
+ g_signal_connect (emft, "test-collapse-row", G_CALLBACK (emft_tree_test_collapse_row), emft);
+ g_signal_connect (emft, "row-activated", G_CALLBACK (emft_tree_row_activated), emft);
+ g_signal_connect (emft, "button-press-event", G_CALLBACK (emft_tree_button_press), emft);
+ g_signal_connect (emft, "key-press-event", G_CALLBACK (emft_tree_user_event), emft);
- selection = gtk_tree_view_get_selection ((GtkTreeView *) priv->treeview);
+ selection = gtk_tree_view_get_selection ((GtkTreeView *) emft);
g_signal_connect (selection, "changed", G_CALLBACK (emft_tree_selection_changed), emft);
-
- gtk_container_add ((GtkContainer *) scrolled, (GtkWidget *) priv->treeview);
- gtk_widget_show (scrolled);
-
- gtk_box_pack_start ((GtkBox *) emft, scrolled, TRUE, TRUE, 0);
}
GtkWidget *
-em_folder_tree_new (void)
+em_folder_tree_new (EMailShellBackend *mail_shell_backend)
{
EMFolderTreeModel *model;
EMFolderTree *emft;
- model = em_folder_tree_model_new (e_get_user_data_dir ());
+ g_return_val_if_fail (
+ E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL);
+
+ model = e_mail_shell_backend_get_folder_tree_model (mail_shell_backend);
emft = (EMFolderTree *) em_folder_tree_new_with_model (model);
g_object_unref (model);
@@ -511,18 +524,20 @@ static void
emft_select_uri(EMFolderTree *emft, GtkTreePath *path, struct _selected_uri *u)
{
struct _EMFolderTreePrivate *priv = emft->priv;
+ GtkTreeView *tree_view;
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection(priv->treeview);
+ tree_view = GTK_TREE_VIEW (emft);
+ selection = gtk_tree_view_get_selection (tree_view);
gtk_tree_selection_select_path(selection, path);
if (!priv->cursor_set) {
- gtk_tree_view_set_cursor (priv->treeview, path, NULL, FALSE);
+ gtk_tree_view_set_cursor (tree_view, path, NULL, FALSE);
priv->cursor_set = TRUE;
}
- gtk_tree_view_scroll_to_cell (priv->treeview, path, NULL, TRUE, 0.8f, 0.0f);
+ gtk_tree_view_scroll_to_cell (tree_view, path, NULL, TRUE, 0.8f, 0.0f);
g_hash_table_remove(priv->select_uris_table, u->key);
priv->select_uris = g_slist_remove(priv->select_uris, u);
- emft_free_select_uri((void *)u, NULL);
+ emft_free_select_uri(u);
}
static void
@@ -530,7 +545,9 @@ emft_expand_node (EMFolderTreeModel *model, const char *key, EMFolderTree *emft)
{
struct _EMFolderTreePrivate *priv = emft->priv;
struct _EMFolderTreeModelStoreInfo *si;
+ EMailShellBackend *mail_shell_backend;
GtkTreeRowReference *row;
+ GtkTreeView *tree_view;
GtkTreePath *path;
EAccount *account;
CamelStore *store;
@@ -548,7 +565,10 @@ emft_expand_node (EMFolderTreeModel *model, const char *key, EMFolderTree *emft)
memcpy (uid, key, n);
uid[n] = '\0';
- if ((account = mail_config_get_account_by_uid (uid)) && account->enabled) {
+ tree_view = GTK_TREE_VIEW (emft);
+ mail_shell_backend = em_folder_tree_model_get_mail_shell_backend (model);
+
+ if ((account = e_get_account_by_uid (uid)) && account->enabled) {
CamelException ex;
camel_exception_init (&ex);
@@ -563,7 +583,7 @@ emft_expand_node (EMFolderTreeModel *model, const char *key, EMFolderTree *emft)
camel_object_ref (store);
} else if (!strcmp (uid, "local")) {
- if (!(store = mail_component_peek_local_store (NULL)))
+ if (!(store = e_mail_shell_backend_get_local_store (mail_shell_backend)))
return;
camel_object_ref (store);
@@ -585,7 +605,7 @@ emft_expand_node (EMFolderTreeModel *model, const char *key, EMFolderTree *emft)
row = si->row;
path = gtk_tree_row_reference_get_path (row);
- gtk_tree_view_expand_to_path (priv->treeview, path);
+ gtk_tree_view_expand_to_path (tree_view, path);
u = g_hash_table_lookup(emft->priv->select_uris_table, key);
if (u)
@@ -599,6 +619,7 @@ emft_maybe_expand_row (EMFolderTreeModel *model, GtkTreePath *tree_path, GtkTree
{
struct _EMFolderTreePrivate *priv = emft->priv;
struct _EMFolderTreeModelStoreInfo *si;
+ GtkTreeView *tree_view;
gboolean is_store;
CamelStore *store;
EAccount *account;
@@ -607,6 +628,8 @@ emft_maybe_expand_row (EMFolderTreeModel *model, GtkTreePath *tree_path, GtkTree
struct _selected_uri *u;
gboolean is_expanded;
+ tree_view = GTK_TREE_VIEW (emft);
+
gtk_tree_model_get ((GtkTreeModel *) model, iter,
COL_STRING_FULL_NAME, &full_name,
COL_POINTER_CAMEL_STORE, &store,
@@ -614,7 +637,7 @@ emft_maybe_expand_row (EMFolderTreeModel *model, GtkTreePath *tree_path, GtkTree
-1);
si = g_hash_table_lookup (model->store_hash, store);
- if ((account = mail_config_get_account_by_name (si->display_name))) {
+ if ((account = e_get_account_by_name (si->display_name))) {
key = g_strdup_printf ("%s/%s", account->uid, full_name ? full_name : "");
} else if (CAMEL_IS_VEE_STORE (store)) {
/* vfolder store */
@@ -628,8 +651,8 @@ emft_maybe_expand_row (EMFolderTreeModel *model, GtkTreePath *tree_path, GtkTree
u = g_hash_table_lookup(priv->select_uris_table, key);
if (is_expanded || u) {
if (is_expanded) {
- gtk_tree_view_expand_to_path (priv->treeview, tree_path);
- gtk_tree_view_expand_row (priv->treeview, tree_path, FALSE);
+ gtk_tree_view_expand_to_path (tree_view, tree_path);
+ gtk_tree_view_expand_row (tree_view, tree_path, FALSE);
} else {
char *c = strrchr (key, '/');
@@ -660,7 +683,7 @@ em_folder_tree_new_with_model (EMFolderTreeModel *model)
emft->priv->loading_row_id = g_signal_connect (model, "loading-row", G_CALLBACK (emft_maybe_expand_row), emft);
emft->priv->loaded_row_id = g_signal_connect (model, "loaded-row", G_CALLBACK (emft_maybe_expand_row), emft);
- a11y = gtk_widget_get_accessible (GTK_WIDGET (emft->priv->treeview));
+ a11y = gtk_widget_get_accessible (GTK_WIDGET (emft));
atk_object_set_name (a11y, _("Mail Folder Tree"));
return (GtkWidget *) emft;
@@ -942,6 +965,7 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, int x, int y
{
struct _EMFolderTreePrivate *priv = emft->priv;
GtkTreeViewDropPosition pos;
+ GtkTreeView *tree_view;
GtkTreePath *dest_path;
struct _DragDataReceivedAsync *m;
gboolean is_store;
@@ -950,7 +974,9 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, int x, int y
char *full_name;
int i;
- if (!gtk_tree_view_get_dest_row_at_pos (priv->treeview, x, y, &dest_path, &pos))
+ tree_view = GTK_TREE_VIEW (emft);
+
+ if (!gtk_tree_view_get_dest_row_at_pos (tree_view, x, y, &dest_path, &pos))
return;
/* this means we are receiving no data */
@@ -1028,6 +1054,7 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path)
struct _EMFolderTreePrivate *p = emft->priv;
char *full_name = NULL, *uri = NULL, *src_uri = NULL;
CamelStore *local, *sstore, *dstore;
+ EMailShellBackend *mail_shell_backend;
GdkAtom atom = GDK_NONE;
gboolean is_store;
GtkTreeIter iter;
@@ -1045,7 +1072,8 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path)
COL_POINTER_CAMEL_STORE, &dstore,
COL_STRING_URI, &uri, -1);
- local = mail_component_peek_local_store (NULL);
+ mail_shell_backend = em_folder_tree_model_get_mail_shell_backend (p->model);
+ local = e_mail_shell_backend_get_local_store (mail_shell_backend);
targets = context->targets;
@@ -1223,10 +1251,13 @@ tree_drag_drop (GtkWidget *widget, GdkDragContext *context, int x, int y, guint
{
struct _EMFolderTreePrivate *priv = emft->priv;
GtkTreeViewColumn *column;
+ GtkTreeView *tree_view;
int cell_x, cell_y;
GtkTreePath *path;
GdkAtom target;
+ tree_view = GTK_TREE_VIEW (emft);
+
if (priv->autoscroll_id != 0) {
g_source_remove (priv->autoscroll_id);
priv->autoscroll_id = 0;
@@ -1240,7 +1271,7 @@ tree_drag_drop (GtkWidget *widget, GdkDragContext *context, int x, int y, guint
priv->autoexpand_id = 0;
}
- if (!gtk_tree_view_get_path_at_pos (priv->treeview, x, y, &path, &column, &cell_x, &cell_y))
+ if (!gtk_tree_view_get_path_at_pos (tree_view, x, y, &path, &column, &cell_x, &cell_y))
return FALSE;
target = emft_drop_target(emft, context, path);
@@ -1268,6 +1299,9 @@ static void
tree_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, EMFolderTree *emft)
{
struct _EMFolderTreePrivate *priv = emft->priv;
+ GtkTreeView *tree_view;
+
+ tree_view = GTK_TREE_VIEW (emft);
if (priv->autoscroll_id != 0) {
g_source_remove (priv->autoscroll_id);
@@ -1282,7 +1316,7 @@ tree_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, EMFolde
priv->autoexpand_id = 0;
}
- gtk_tree_view_set_drag_dest_row(emft->priv->treeview, NULL, GTK_TREE_VIEW_DROP_BEFORE);
+ gtk_tree_view_set_drag_dest_row(tree_view, NULL, GTK_TREE_VIEW_DROP_BEFORE);
}
@@ -1291,19 +1325,20 @@ tree_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, EMFolde
static gboolean
tree_autoscroll (EMFolderTree *emft)
{
- struct _EMFolderTreePrivate *priv = emft->priv;
GtkAdjustment *vadjustment;
+ GtkTreeView *tree_view;
GdkRectangle rect;
GdkWindow *window;
int offset, y;
float value;
/* get the y pointer position relative to the treeview */
- window = gtk_tree_view_get_bin_window (priv->treeview);
+ tree_view = GTK_TREE_VIEW (emft);
+ window = gtk_tree_view_get_bin_window (tree_view);
gdk_window_get_pointer (window, NULL, &y, NULL);
/* rect is in coorinates relative to the scrolled window relative to the treeview */
- gtk_tree_view_get_visible_rect (priv->treeview, &rect);
+ gtk_tree_view_get_visible_rect (tree_view, &rect);
/* move y into the same coordinate system as rect */
y += rect.y;
@@ -1315,7 +1350,7 @@ tree_autoscroll (EMFolderTree *emft)
return TRUE;
}
- vadjustment = gtk_tree_view_get_vadjustment (priv->treeview);
+ vadjustment = gtk_tree_view_get_vadjustment (tree_view);
value = CLAMP (vadjustment->value + offset, 0.0, vadjustment->upper - vadjustment->page_size);
gtk_adjustment_set_value (vadjustment, value);
@@ -1327,10 +1362,12 @@ static gboolean
tree_autoexpand (EMFolderTree *emft)
{
struct _EMFolderTreePrivate *priv = emft->priv;
+ GtkTreeView *tree_view;
GtkTreePath *path;
+ tree_view = GTK_TREE_VIEW (emft);
path = gtk_tree_row_reference_get_path (priv->autoexpand_row);
- gtk_tree_view_expand_row (priv->treeview, path, FALSE);
+ gtk_tree_view_expand_row (tree_view, path, FALSE);
gtk_tree_path_free (path);
return TRUE;
@@ -1342,13 +1379,16 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guin
struct _EMFolderTreePrivate *priv = emft->priv;
GtkTreeModel *model = (GtkTreeModel *) priv->model;
GtkTreeViewDropPosition pos;
+ GtkTreeView *tree_view;
GdkDragAction action = 0;
GtkTreePath *path;
GtkTreeIter iter;
GdkAtom target;
int i;
- if (!gtk_tree_view_get_dest_row_at_pos(priv->treeview, x, y, &path, &pos))
+ tree_view = GTK_TREE_VIEW (emft);
+
+ if (!gtk_tree_view_get_dest_row_at_pos(tree_view, x, y, &path, &pos))
return FALSE;
if (priv->autoscroll_id == 0)
@@ -1356,7 +1396,7 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guin
gtk_tree_model_get_iter (model, &iter, path);
- if (gtk_tree_model_iter_has_child (model, &iter) && !gtk_tree_view_row_expanded (priv->treeview, path)) {
+ if (gtk_tree_model_iter_has_child (model, &iter) && !gtk_tree_view_row_expanded (tree_view, path)) {
if (priv->autoexpand_id != 0) {
GtkTreePath *autoexpand_path;
@@ -1392,10 +1432,10 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guin
action = context->suggested_action;
if (action == GDK_ACTION_COPY && (context->actions & GDK_ACTION_MOVE))
action = GDK_ACTION_MOVE;
- gtk_tree_view_set_drag_dest_row(priv->treeview, path, GTK_TREE_VIEW_DROP_INTO_OR_AFTER);
+ gtk_tree_view_set_drag_dest_row(tree_view, path, GTK_TREE_VIEW_DROP_INTO_OR_AFTER);
break;
default:
- gtk_tree_view_set_drag_dest_row(priv->treeview, path, GTK_TREE_VIEW_DROP_INTO_OR_AFTER);
+ gtk_tree_view_set_drag_dest_row(tree_view, path, GTK_TREE_VIEW_DROP_INTO_OR_AFTER);
action = context->suggested_action;
break;
}
@@ -1415,11 +1455,14 @@ void
em_folder_tree_enable_drag_and_drop (EMFolderTree *emft)
{
struct _EMFolderTreePrivate *priv;
+ GtkTreeView *tree_view;
static int setup = 0;
int i;
g_return_if_fail (EM_IS_FOLDER_TREE (emft));
+ tree_view = GTK_TREE_VIEW (emft);
+
priv = emft->priv;
if (!setup) {
for (i=0; i<NUM_DRAG_TYPES; i++)
@@ -1431,23 +1474,27 @@ em_folder_tree_enable_drag_and_drop (EMFolderTree *emft)
setup = 1;
}
- gtk_drag_source_set((GtkWidget *)priv->treeview, GDK_BUTTON1_MASK, drag_types, NUM_DRAG_TYPES, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
- gtk_drag_dest_set((GtkWidget *)priv->treeview, GTK_DEST_DEFAULT_ALL, drop_types, NUM_DROP_TYPES, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
+ gtk_drag_source_set((GtkWidget *)tree_view, GDK_BUTTON1_MASK, drag_types, NUM_DRAG_TYPES, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
+ gtk_drag_dest_set((GtkWidget *)tree_view, GTK_DEST_DEFAULT_ALL, drop_types, NUM_DROP_TYPES, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
- g_signal_connect (priv->treeview, "drag-begin", G_CALLBACK (tree_drag_begin), emft);
- g_signal_connect (priv->treeview, "drag-data-delete", G_CALLBACK (tree_drag_data_delete), emft);
- g_signal_connect (priv->treeview, "drag-data-get", G_CALLBACK (tree_drag_data_get), emft);
- g_signal_connect (priv->treeview, "drag-data-received", G_CALLBACK (tree_drag_data_received), emft);
- g_signal_connect (priv->treeview, "drag-drop", G_CALLBACK (tree_drag_drop), emft);
- g_signal_connect (priv->treeview, "drag-end", G_CALLBACK (tree_drag_end), emft);
- g_signal_connect (priv->treeview, "drag-leave", G_CALLBACK (tree_drag_leave), emft);
- g_signal_connect (priv->treeview, "drag-motion", G_CALLBACK (tree_drag_motion), emft);
+ g_signal_connect (tree_view, "drag-begin", G_CALLBACK (tree_drag_begin), emft);
+ g_signal_connect (tree_view, "drag-data-delete", G_CALLBACK (tree_drag_data_delete), emft);
+ g_signal_connect (tree_view, "drag-data-get", G_CALLBACK (tree_drag_data_get), emft);
+ g_signal_connect (tree_view, "drag-data-received", G_CALLBACK (tree_drag_data_received), emft);
+ g_signal_connect (tree_view, "drag-drop", G_CALLBACK (tree_drag_drop), emft);
+ g_signal_connect (tree_view, "drag-end", G_CALLBACK (tree_drag_end), emft);
+ g_signal_connect (tree_view, "drag-leave", G_CALLBACK (tree_drag_leave), emft);
+ g_signal_connect (tree_view, "drag-motion", G_CALLBACK (tree_drag_motion), emft);
}
void
em_folder_tree_set_multiselect (EMFolderTree *tree, gboolean mode)
{
- GtkTreeSelection *sel = gtk_tree_view_get_selection ((GtkTreeView *) tree->priv->treeview);
+ GtkTreeSelection *sel;
+ GtkTreeView *tree_view;
+
+ tree_view = GTK_TREE_VIEW (tree);
+ sel = gtk_tree_view_get_selection (tree_view);
tree->priv->do_multiselect = mode;
gtk_tree_selection_set_mode (sel, mode ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_SINGLE);
@@ -1467,10 +1514,14 @@ void em_folder_tree_set_excluded_func(EMFolderTree *emft, EMFTExcludeFunc exclud
GList *
em_folder_tree_get_selected_uris (EMFolderTree *emft)
{
- GtkTreeSelection *selection = gtk_tree_view_get_selection (emft->priv->treeview);
+ GtkTreeSelection *selection;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
GList *list = NULL, *rows, *l;
GSList *sl;
- GtkTreeModel *model;
+
+ tree_view = GTK_TREE_VIEW (emft);
+ selection = gtk_tree_view_get_selection (tree_view);
/* at first, add lost uris */
for (sl = emft->priv->select_uris; sl; sl = g_slist_next(sl))
@@ -1507,9 +1558,13 @@ get_selected_uris_path_iterate (GtkTreeModel *model, GtkTreePath *treepath, GtkT
GList *
em_folder_tree_get_selected_paths (EMFolderTree *emft)
{
- GtkTreeSelection *selection = gtk_tree_view_get_selection (emft->priv->treeview);
+ GtkTreeSelection *selection;
+ GtkTreeView *tree_view;
GList *list = NULL;
+ tree_view = GTK_TREE_VIEW (emft);
+ selection = gtk_tree_view_get_selection (tree_view);
+
gtk_tree_selection_selected_foreach (selection, get_selected_uris_path_iterate, &list);
return list;
@@ -1520,7 +1575,7 @@ emft_clear_selected_list(EMFolderTree *emft)
{
struct _EMFolderTreePrivate *priv = emft->priv;
- g_slist_foreach(priv->select_uris, emft_free_select_uri, emft);
+ g_slist_foreach(priv->select_uris, (GFunc) emft_free_select_uri, NULL);
g_slist_free(priv->select_uris);
g_hash_table_destroy(priv->select_uris_table);
priv->select_uris = NULL;
@@ -1658,13 +1713,13 @@ emft_get_folder_info__done (struct _EMFolderTreeGetFolderInfo *m)
struct _EMFolderTreeModelStoreInfo *si;
GtkTreeIter root, iter, titer;
CamelFolderInfo *fi;
+ GtkTreeView *tree_view;
GtkTreeStore *model;
GtkTreePath *path;
gboolean is_store;
/* check that we haven't been destroyed */
- if (priv->treeview == NULL)
- return;
+ g_return_if_fail (GTK_IS_TREE_VIEW (m->emft));
/* check that our parent folder hasn't been deleted/unsubscribed */
if (!gtk_tree_row_reference_valid (m->root))
@@ -1675,7 +1730,8 @@ emft_get_folder_info__done (struct _EMFolderTreeGetFolderInfo *m)
return;
}
- model = (GtkTreeStore *) gtk_tree_view_get_model (priv->treeview);
+ tree_view = GTK_TREE_VIEW (m->emft);
+ model = (GtkTreeStore *) gtk_tree_view_get_model (tree_view);
path = gtk_tree_row_reference_get_path (m->root);
gtk_tree_model_get_iter ((GtkTreeModel *) model, &root, path);
@@ -1683,7 +1739,7 @@ emft_get_folder_info__done (struct _EMFolderTreeGetFolderInfo *m)
/* if we had an error, then we need to re-set the load subdirs state and collapse the node */
if (!m->fi && camel_exception_is_set(&m->base.ex)) {
gtk_tree_store_set(model, &root, COL_BOOL_LOAD_SUBDIRS, TRUE, -1);
- gtk_tree_view_collapse_row (priv->treeview, path);
+ gtk_tree_view_collapse_row (tree_view, path);
gtk_tree_path_free (path);
return;
}
@@ -1722,7 +1778,7 @@ emft_get_folder_info__done (struct _EMFolderTreeGetFolderInfo *m)
if (is_store) {
path = gtk_tree_model_get_path ((GtkTreeModel *) model, &root);
- gtk_tree_view_collapse_row (priv->treeview, path);
+ gtk_tree_view_collapse_row (tree_view, path);
emft_queue_save_state (m->emft);
gtk_tree_path_free (path);
return;
@@ -1778,7 +1834,7 @@ emft_update_model_expanded_state (struct _EMFolderTreePrivate *priv, GtkTreeIter
-1);
si = g_hash_table_lookup (priv->model->store_hash, store);
- if ((account = mail_config_get_account_by_name (si->display_name))) {
+ if ((account = e_get_account_by_name (si->display_name))) {
key = g_strdup_printf ("%s/%s", account->uid, full_name ? full_name : "");
} else if (CAMEL_IS_VEE_STORE (store)) {
/* vfolder store */
@@ -1881,53 +1937,6 @@ emft_tree_row_activated (GtkTreeView *treeview, GtkTreePath *tree_path, GtkTreeV
g_free(uri);
}
-#if 0
-static void
-emft_popup_view (GtkWidget *item, EMFolderTree *emft)
-{
-
-}
-
-static void
-emft_popup_open_new (GtkWidget *item, EMFolderTree *emft)
-{
-}
-#endif
-
-static void
-emft_popup_copy(EPopup *ep, EPopupItem *item, void *data)
-{
- EMFolderTree *emft = data;
- CamelFolderInfo *fi = NULL;
-
- /* FIXME: use async apis */
- if ((fi = em_folder_tree_get_selected_folder_info (emft)) != NULL)
- em_folder_utils_copy_folder(fi, FALSE);
-}
-
-static void
-emft_popup_move(EPopup *ep, EPopupItem *item, void *data)
-{
- EMFolderTree *emft = data;
- CamelFolderInfo *fi = NULL;
-
- /* FIXME: use async apis */
- if ((fi = em_folder_tree_get_selected_folder_info (emft)) != NULL)
- em_folder_utils_copy_folder(fi, TRUE);
-}
-
-static void
-emft_popup_new_folder (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderTree *emft = data;
- CamelFolderInfo *fi;
-
- if ((fi = em_folder_tree_get_selected_folder_info (emft)) != NULL) {
- em_folder_utils_create_folder (fi, emft, NULL);
- camel_folder_info_free(fi);
- }
-}
-
static void
selfunc (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
{
@@ -1954,247 +1963,15 @@ emft_selection_get_selected (GtkTreeSelection *selection, GtkTreeModel **model,
}
}
-static void
-emft_popup_delete_folder (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderTree *emft = data;
- CamelFolder *folder;
-
- if ((folder = em_folder_tree_get_selected_folder (emft)) != NULL) {
- em_folder_utils_delete_folder(folder);
- }
-}
-
-static void
-emft_popup_rename_folder (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderTree *emft = data;
- CamelFolder *folder;
-
- if ((folder = em_folder_tree_get_selected_folder (emft)) != NULL) {
- em_folder_utils_rename_folder(folder);
- }
-}
-
-static void
-emft_popup_refresh_folder (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderTree *emft = data;
- CamelFolder *folder;
-
- if ((folder = em_folder_tree_get_selected_folder (emft)) != NULL)
- mail_refresh_folder(folder, NULL, NULL);
-}
-
-static void
-emft_popup_flush_outbox (EPopup *ep, EPopupItem *pitem, void *data)
-{
- mail_send ();
-}
-
-static void
-emft_popup_empty_trash (EPopup *ep, EPopupItem *pitem, void *data)
-{
- em_utils_empty_trash (data);
-}
-
-static void
-emft_popup_properties (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderTree *emft = data;
- struct _EMFolderTreePrivate *priv = emft->priv;
- GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkTreeIter iter;
- char *uri;
-
- selection = gtk_tree_view_get_selection (priv->treeview);
- if (!emft_selection_get_selected (selection, &model, &iter))
- return;
-
- gtk_tree_model_get (model, &iter, COL_STRING_URI, &uri, -1);
- em_folder_properties_show (NULL, NULL, uri);
- g_free (uri);
-}
-
-static void
-emft_popup_uvfolder (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderTree *emft = data;
- CamelFolder *folder;
-
- if ((folder = em_folder_tree_get_selected_folder (emft)) != NULL) {
- char *meta = camel_object_meta_get(folder, "vfolder:unread");
- if (!meta || strcmp(meta, "false") == 0)
- camel_object_meta_set(folder, "vfolder:unread", "true");
- else
- camel_object_meta_set(folder, "vfolder:unread", "false");
- camel_object_state_write (folder);
- g_free (meta);
- }
-}
-
-static EPopupItem emft_popup_items[] = {
-#if 0
- { E_POPUP_ITEM, "00.emc.00", N_("_View"), emft_popup_view, NULL, NULL, EM_POPUP_FOLDER_SELECT },
- { E_POPUP_ITEM, "00.emc.01", N_("Open in _New Window"), emft_popup_open_new, NULL, NULL, EM_POPUP_FOLDER_SELECT },
-
- { E_POPUP_BAR, "10.emc" },
-#endif
- /* FIXME: need to disable for nochildren folders */
- { E_POPUP_ITEM, (gchar *) "10.emc.00", (gchar *) N_("_New Folder..."), emft_popup_new_folder, NULL, (gchar *) "folder-new", 0, EM_POPUP_FOLDER_INFERIORS },
-
- { E_POPUP_ITEM, (gchar *) "10.emc.05", (gchar *) N_("_Copy..."), emft_popup_copy, NULL, (gchar *) "folder-copy", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT },
- { E_POPUP_ITEM, (gchar *) "10.emc.06", (gchar *) N_("_Move..."), emft_popup_move, NULL, (gchar *) "folder-move", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_DELETE },
-
- /* FIXME: need to disable for undeletable folders */
- { E_POPUP_BAR, (gchar *) "20.emc" },
- { E_POPUP_ITEM, (gchar *) "20.emc.01", (gchar *) N_("_Delete"), emft_popup_delete_folder, NULL, (gchar *) "edit-delete", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_DELETE },
-
- { E_POPUP_BAR, (gchar *) "30.emc" },
- { E_POPUP_ITEM, (gchar *) "30.emc.02", (gchar *) N_("_Rename..."), emft_popup_rename_folder, NULL, NULL, 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_DELETE },
- { E_POPUP_ITEM, (gchar *) "30.emc.03", (gchar *) N_("Re_fresh"), emft_popup_refresh_folder, NULL, (gchar *) "view-refresh", EM_POPUP_FOLDER_NONSTATIC, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT},
- { E_POPUP_ITEM, (gchar *) "30.emc.04", (gchar *) N_("Fl_ush Outbox"), emft_popup_flush_outbox, NULL, (gchar *) "mail-send", EM_POPUP_FOLDER_OUTBOX, 0 },
-
-
- { E_POPUP_BAR, (gchar *) "99.emc" },
- { E_POPUP_ITEM, (gchar *) "99.emc.00", (gchar *) N_("_Properties"), emft_popup_properties, NULL, (gchar *) "document-properties", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT }
-};
-static EPopupItem trash_popup_item = {E_POPUP_ITEM, (gchar *) "30.emc.05", (gchar *) N_("_Empty Trash"), emft_popup_empty_trash,NULL,NULL, 1, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT};
-
-static void
-emft_popup_free(EPopup *ep, GSList *items, void *data)
-{
- g_slist_free(items);
-}
-
static gboolean
-emft_popup (EMFolderTree *emft, GdkEvent *event)
+emft_popup_menu (GtkWidget *widget)
{
- GtkTreeView *treeview;
- GtkTreeSelection *selection;
- CamelStore *local, *store;
- EMPopupTargetFolder *target;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GSList *menus = NULL;
- guint32 info_flags = 0;
- guint32 flags = 0;
- guint32 folder_type_flags = 0;
- gboolean isstore;
- char *uri, *full_name;
- GtkMenu *menu;
- EMPopup *emp;
- CamelFolder *selfolder = NULL;
- int i;
-
- treeview = emft->priv->treeview;
-
- /* this centralises working out when the user's done something */
- emft_tree_user_event(treeview, (GdkEvent *)event, emft);
-
- /* FIXME: we really need the folderinfo to build a proper menu */
- selection = gtk_tree_view_get_selection (treeview);
- if (!emft_selection_get_selected (selection, &model, &iter))
- return FALSE;
-
- gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store,
- COL_STRING_URI, &uri, COL_STRING_FULL_NAME, &full_name,
- COL_BOOL_IS_STORE, &isstore, COL_UINT_FLAGS, &folder_type_flags, -1);
-
- /* Stores have full_name == NULL, otherwise its just a placeholder */
- /* NB: This is kind of messy */
- if (!isstore && full_name == NULL) {
- g_free (uri);
- return FALSE;
- }
-
- /* TODO: em_popup_target_folder_new? */
- if (isstore) {
- flags |= EM_POPUP_FOLDER_STORE;
- } else {
- flags |= EM_POPUP_FOLDER_FOLDER;
-
- local = mail_component_peek_local_store (NULL);
-
- /* don't allow deletion of special local folders */
- if (!(store == local && is_special_local_folder (full_name)))
- flags |= EM_POPUP_FOLDER_DELETE;
-
- /* hack for vTrash/vJunk */
- if (!strcmp (full_name, CAMEL_VTRASH_NAME) || !strcmp (full_name, CAMEL_VJUNK_NAME))
- info_flags |= CAMEL_FOLDER_VIRTUAL | CAMEL_FOLDER_NOINFERIORS;
-
- selfolder = em_folder_tree_get_selected_folder (emft);
-
- if (folder_type_flags & CAMEL_FOLDER_SYSTEM)
- flags &= ~EM_POPUP_FOLDER_DELETE;
-
- if (em_utils_folder_is_outbox (selfolder, NULL))
- info_flags |= CAMEL_FOLDER_TYPE_OUTBOX;
- }
-
- /** @HookPoint-EMPopup: Folder Tree Context Menu
- * @Id: org.gnome.evolution.mail.foldertree.popup
- * @Class: org.gnome.evolution.mail.popup:1.0
- * @Target: EMPopupTargetFolder
- *
- * This is the context menu shown on the folder tree.
- */
- emp = em_popup_new ("org.gnome.evolution.mail.foldertree.popup");
-
- /* FIXME: pass valid fi->flags here */
- target = em_popup_target_new_folder (emp, uri, info_flags, flags);
-
- for (i = 0; i < sizeof (emft_popup_items) / sizeof (emft_popup_items[0]); i++)
- menus = g_slist_prepend (menus, &emft_popup_items[i]);
-
- if ((folder_type_flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_TRASH)
- menus = g_slist_prepend (menus, &trash_popup_item);
- if (!isstore && strstr(uri, "vfolder")) {
- /* This is a vfolder, so lets add hacked up menu item. */
- static EPopupItem *item = NULL;
- char *meta = camel_object_meta_get (selfolder, "vfolder:unread");
-
- if (!item)
- item = g_malloc0(sizeof(*item));
- if (meta && (strcmp (meta, "true") == 0))
- item->type = E_POPUP_TOGGLE | E_POPUP_ACTIVE;
- else
- item->type = E_POPUP_TOGGLE & ~E_POPUP_ACTIVE;
- item->path = (gchar *) "99.emc.99";
- item->label = _("_Unread Search Folder");
- item->activate = emft_popup_uvfolder;
- item->visible = EM_POPUP_FOLDER_SELECT;
- item->user_data = NULL;
- menus = g_slist_prepend (menus, item);
- g_free (meta);
- }
-
- e_popup_add_items ((EPopup *)emp, menus, NULL, emft_popup_free, emft);
-
- menu = e_popup_create_menu_once ((EPopup *)emp, (EPopupTarget *)target, 0);
-
- if (event == NULL || event->type == GDK_KEY_PRESS) {
- /* FIXME: menu pos function */
- gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
- } else {
- gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button.button, event->button.time);
- }
-
- g_free (full_name);
- g_free (uri);
+ folder_tree_emit_popup_event (EM_FOLDER_TREE (widget), NULL);
return TRUE;
}
static gboolean
-emft_popup_menu (GtkWidget *widget)
-{
- return emft_popup (EM_FOLDER_TREE (widget), NULL);
-}
-
-static gboolean
emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTree *emft)
{
GtkTreeSelection *selection;
@@ -2225,7 +2002,9 @@ emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTr
gtk_tree_path_free (tree_path);
- return emft_popup (emft, (GdkEvent *)event);
+ folder_tree_emit_popup_event (emft, (GdkEvent *) event);
+
+ return TRUE;
}
/* This is called for keyboard and mouse events, it seems the only way
@@ -2284,6 +2063,7 @@ em_folder_tree_set_selected (EMFolderTree *emft, const char *uri, gboolean expan
void
em_folder_tree_select_next_path (EMFolderTree *emft, gboolean skip_read_folders)
{
+ GtkTreeView *tree_view;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter, parent, child;
@@ -2293,7 +2073,8 @@ em_folder_tree_select_next_path (EMFolderTree *emft, gboolean skip_read_folders)
g_return_if_fail (EM_IS_FOLDER_TREE (emft));
- selection = gtk_tree_view_get_selection(emft->priv->treeview);
+ tree_view = GTK_TREE_VIEW (emft);
+ selection = gtk_tree_view_get_selection(tree_view);
if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
current_path = gtk_tree_model_get_path (model, &iter);
@@ -2328,16 +2109,16 @@ em_folder_tree_select_next_path (EMFolderTree *emft, gboolean skip_read_folders)
}
if (path) {
- if (!gtk_tree_view_row_expanded (emft->priv->treeview, path))
- gtk_tree_view_expand_to_path (emft->priv->treeview, path);
+ if (!gtk_tree_view_row_expanded (tree_view, path))
+ gtk_tree_view_expand_to_path (tree_view, path);
gtk_tree_selection_select_path(selection, path);
if (!priv->cursor_set) {
- gtk_tree_view_set_cursor (priv->treeview, path, NULL, FALSE);
+ gtk_tree_view_set_cursor (tree_view, path, NULL, FALSE);
priv->cursor_set = TRUE;
}
- gtk_tree_view_scroll_to_cell (priv->treeview, path, NULL, TRUE, 0.5f, 0.0f);
+ gtk_tree_view_scroll_to_cell (tree_view, path, NULL, TRUE, 0.5f, 0.0f);
}
return;
}
@@ -2363,6 +2144,7 @@ get_last_child (GtkTreeModel *model, GtkTreeIter *iter)
void
em_folder_tree_select_prev_path (EMFolderTree *emft, gboolean skip_read_folders)
{
+ GtkTreeView *tree_view;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter, child;
@@ -2372,7 +2154,8 @@ em_folder_tree_select_prev_path (EMFolderTree *emft, gboolean skip_read_folders)
g_return_if_fail (EM_IS_FOLDER_TREE (emft));
- selection = gtk_tree_view_get_selection(emft->priv->treeview);
+ tree_view = GTK_TREE_VIEW (emft);
+ selection = gtk_tree_view_get_selection (tree_view);
if (gtk_tree_selection_get_selected(selection, &model, &iter)){
@@ -2406,17 +2189,17 @@ em_folder_tree_select_prev_path (EMFolderTree *emft, gboolean skip_read_folders)
}
if (path) {
- if (!gtk_tree_view_row_expanded (priv->treeview, path)) {
- gtk_tree_view_expand_to_path (priv->treeview, path);
+ if (!gtk_tree_view_row_expanded (tree_view, path)) {
+ gtk_tree_view_expand_to_path (tree_view, path);
}
gtk_tree_selection_select_path(selection, path);
if (!priv->cursor_set) {
- gtk_tree_view_set_cursor (priv->treeview, path, NULL, FALSE);
+ gtk_tree_view_set_cursor (tree_view, path, NULL, FALSE);
priv->cursor_set = TRUE;
}
- gtk_tree_view_scroll_to_cell (priv->treeview, path, NULL, TRUE, 0.5f, 0.0f);
+ gtk_tree_view_scroll_to_cell (tree_view, path, NULL, TRUE, 0.5f, 0.0f);
}
return;
}
@@ -2425,6 +2208,7 @@ em_folder_tree_select_prev_path (EMFolderTree *emft, gboolean skip_read_folders)
char *
em_folder_tree_get_selected_uri (EMFolderTree *emft)
{
+ GtkTreeView *tree_view;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
@@ -2432,7 +2216,9 @@ em_folder_tree_get_selected_uri (EMFolderTree *emft)
g_return_val_if_fail (EM_IS_FOLDER_TREE (emft), NULL);
- selection = gtk_tree_view_get_selection(emft->priv->treeview);
+ tree_view = GTK_TREE_VIEW (emft);
+ selection = gtk_tree_view_get_selection (tree_view);
+
if (gtk_tree_selection_get_selected(selection, &model, &iter))
gtk_tree_model_get(model, &iter, COL_STRING_URI, &uri, -1);
@@ -2442,6 +2228,7 @@ em_folder_tree_get_selected_uri (EMFolderTree *emft)
char *
em_folder_tree_get_selected_path (EMFolderTree *emft)
{
+ GtkTreeView *tree_view;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
@@ -2449,7 +2236,9 @@ em_folder_tree_get_selected_path (EMFolderTree *emft)
g_return_val_if_fail (EM_IS_FOLDER_TREE (emft), NULL);
- selection = gtk_tree_view_get_selection(emft->priv->treeview);
+ tree_view = GTK_TREE_VIEW (emft);
+ selection = gtk_tree_view_get_selection (tree_view);
+
if (gtk_tree_selection_get_selected(selection, &model, &iter))
gtk_tree_model_get(model, &iter, COL_STRING_FULL_NAME, &name, -1);
@@ -2459,6 +2248,7 @@ em_folder_tree_get_selected_path (EMFolderTree *emft)
CamelFolder *
em_folder_tree_get_selected_folder (EMFolderTree *emft)
{
+ GtkTreeView *tree_view;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
@@ -2471,7 +2261,9 @@ em_folder_tree_get_selected_folder (EMFolderTree *emft)
camel_exception_init (&ex);
- selection = gtk_tree_view_get_selection(emft->priv->treeview);
+ tree_view = GTK_TREE_VIEW (emft);
+ selection = gtk_tree_view_get_selection (tree_view);
+
if (gtk_tree_selection_get_selected(selection, &model, &iter))
gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store,
COL_STRING_FULL_NAME, &full_name, -1);
@@ -2487,6 +2279,7 @@ em_folder_tree_get_selected_folder (EMFolderTree *emft)
CamelFolderInfo *
em_folder_tree_get_selected_folder_info (EMFolderTree *emft)
{
+ GtkTreeView *tree_view;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
@@ -2499,7 +2292,9 @@ em_folder_tree_get_selected_folder_info (EMFolderTree *emft)
camel_exception_init (&ex);
- selection = gtk_tree_view_get_selection(emft->priv->treeview);
+ tree_view = GTK_TREE_VIEW (emft);
+ selection = gtk_tree_view_get_selection (tree_view);
+
if (gtk_tree_selection_get_selected(selection, &model, &iter))
gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store,
COL_STRING_FULL_NAME, &full_name,
@@ -2571,12 +2366,6 @@ emft_queue_save_state (EMFolderTree *emft)
priv->save_state_id = g_timeout_add_seconds (1, (GSourceFunc) emft_save_state, emft);
}
-GtkWidget *
-em_folder_tree_get_tree_view (EMFolderTree *emft)
-{
- return (GtkWidget *)emft->priv->treeview;
-}
-
void
em_folder_tree_set_skip_double_click (EMFolderTree *emft, gboolean skip)
{
diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h
index e76acf4df1..7b148d424b 100644
--- a/mail/em-folder-tree.h
+++ b/mail/em-folder-tree.h
@@ -21,28 +21,38 @@
*
*/
-#ifndef __EM_FOLDER_TREE_H__
-#define __EM_FOLDER_TREE_H__
+#ifndef EM_FOLDER_TREE_H
+#define EM_FOLDER_TREE_H
#include <gtk/gtk.h>
#include <camel/camel-store.h>
-
-#include "mail/em-folder-tree-model.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define EM_TYPE_FOLDER_TREE (em_folder_tree_get_type ())
-#define EM_FOLDER_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EM_TYPE_FOLDER_TREE, EMFolderTree))
-#define EM_FOLDER_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EM_TYPE_FOLDER_TREE, EMFolderTreeClass))
-#define EM_IS_FOLDER_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EM_TYPE_FOLDER_TREE))
-#define EM_IS_FOLDER_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EM_TYPE_FOLDER_TREE))
-#define EM_FOLDER_TREE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EM_TYPE_FOLDER_TREE, EMFolderTreeClass))
+#include <mail/e-mail-shell-backend.h>
+#include <mail/em-folder-tree-model.h>
+
+/* Standard GObject macros */
+#define EM_TYPE_FOLDER_TREE \
+ (em_folder_tree_get_type ())
+#define EM_FOLDER_TREE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_TYPE_FOLDER_TREE, EMFolderTree))
+#define EM_FOLDER_TREE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_TYPE_FOLDER_TREE, EMFolderTreeClass))
+#define EM_IS_FOLDER_TREE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_TYPE_FOLDER_TREE))
+#define EM_IS_FOLDER_TREE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EM_TYPE_FOLDER_TREE))
+#define EM_FOLDER_TREE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_TYPE_FOLDER_TREE, EMFolderTreeClass))
+
+G_BEGIN_DECLS
typedef struct _EMFolderTree EMFolderTree;
typedef struct _EMFolderTreeClass EMFolderTreeClass;
+typedef struct _EMFolderTreePrivate EMFolderTreePrivate;
/* not sure this api is the best, but its the easiest to implement and will cover what we need */
#define EMFT_EXCLUDE_NOSELECT CAMEL_FOLDER_NOSELECT
@@ -54,22 +64,27 @@ typedef struct _EMFolderTreeClass EMFolderTreeClass;
typedef gboolean (*EMFTExcludeFunc)(EMFolderTree *emft, GtkTreeModel *model, GtkTreeIter *iter, void *data);
struct _EMFolderTree {
- GtkVBox parent_object;
-
- struct _EMFolderTreePrivate *priv;
+ GtkTreeView parent_object;
+ EMFolderTreePrivate *priv;
};
struct _EMFolderTreeClass {
- GtkVBoxClass parent_class;
+ GtkTreeViewClass parent_class;
/* signals */
- void (* folder_activated) (EMFolderTree *emft, const char *full_name, const char *uri);
- void (* folder_selected) (EMFolderTree *emft, const char *full_name, const char *uri, guint32 flags);
+ void (*folder_activated) (EMFolderTree *emft,
+ const gchar *full_name,
+ const gchar *uri);
+ void (*folder_selected) (EMFolderTree *emft,
+ const gchar *full_name,
+ const gchar *uri,
+ guint32 flags);
+ void (*popup_event) (EMFolderTree *emft);
};
GType em_folder_tree_get_type (void);
-GtkWidget *em_folder_tree_new (void);
+GtkWidget *em_folder_tree_new (EMailShellBackend *mail_shell_backend);
GtkWidget *em_folder_tree_new_with_model (EMFolderTreeModel *model);
void em_folder_tree_enable_drag_and_drop (EMFolderTree *emft);
@@ -94,11 +109,8 @@ EMFolderTreeModel *em_folder_tree_get_model (EMFolderTree *emft);
EMFolderTreeModelStoreInfo *em_folder_tree_get_model_storeinfo (EMFolderTree *emft, CamelStore *store);
gboolean em_folder_tree_create_folder (EMFolderTree *emft, const char *full_name, const char *uri);
-GtkWidget * em_folder_tree_get_tree_view (EMFolderTree *emft);
void em_folder_tree_set_skip_double_click (EMFolderTree *emft, gboolean skip);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
-#endif /* __EM_FOLDER_TREE_H__ */
+#endif /* EM_FOLDER_TREE_H */
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index ad60516bb1..2b319ff360 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -57,7 +57,6 @@
#include "mail-ops.h"
#include "mail-tools.h"
#include "mail-config.h"
-#include "mail-component.h"
#include "mail-vfolder.h"
#include "mail-folder-cache.h"
@@ -70,6 +69,8 @@
#include "em-folder-selection.h"
#include "em-folder-properties.h"
+#include "e-mail-shell-backend.h"
+
#define d(x)
extern CamelSession *session;
@@ -268,6 +269,7 @@ emfu_copy_folder_selected (const char *uri, void *data)
{
struct _copy_folder_data *cfd = data;
CamelStore *fromstore = NULL, *tostore = NULL;
+ CamelStore *local_store;
const gchar *tobase = NULL;
CamelException ex;
CamelURL *url;
@@ -279,13 +281,15 @@ emfu_copy_folder_selected (const char *uri, void *data)
camel_exception_init (&ex);
+ local_store = e_mail_shell_backend_get_local_store (global_mail_shell_backend);
+
if (!(fromstore = camel_session_get_store (session, cfd->fi->uri, &ex))) {
e_error_run(NULL,
cfd->delete?"mail:no-move-folder-notexist":"mail:no-copy-folder-notexist", cfd->fi->full_name, uri, ex.desc, NULL);
goto fail;
}
- if (cfd->delete && fromstore == mail_component_peek_local_store (NULL) && emfu_is_special_local_folder (cfd->fi->full_name)) {
+ if (cfd->delete && fromstore == local_store && emfu_is_special_local_folder (cfd->fi->full_name)) {
GtkWidget *w = e_error_new (NULL,
"mail:no-rename-special-folder", cfd->fi->full_name, NULL);
em_utils_show_error_silent (w);
@@ -397,13 +401,13 @@ emfu_delete_response (GtkWidget *dialog, int response, gpointer data)
void
em_folder_utils_delete_folder (CamelFolder *folder)
{
- CamelStore *local;
+ CamelStore *local_store;
GtkWidget *dialog;
int flags = 0;
- local = mail_component_peek_local_store (NULL);
+ local_store = e_mail_shell_backend_get_local_store (global_mail_shell_backend);
- if (folder->parent_store == local && emfu_is_special_local_folder (folder->full_name)) {
+ if (folder->parent_store == local_store && emfu_is_special_local_folder (folder->full_name)) {
dialog = e_error_new (NULL, "mail:no-delete-special-folder", folder->full_name, NULL);
em_utils_show_error_silent (dialog);
return;
@@ -432,14 +436,14 @@ em_folder_utils_rename_folder (CamelFolder *folder)
{
char *prompt, *new_name;
const char *p;
- CamelStore *local;
+ CamelStore *local_store;
gboolean done = FALSE;
size_t base_len;
- local = mail_component_peek_local_store (NULL);
+ local_store = e_mail_shell_backend_get_local_store (global_mail_shell_backend);
/* don't allow user to rename one of the special local folders */
- if (folder->parent_store == local && emfu_is_special_local_folder (folder->full_name)) {
+ if (folder->parent_store == local_store && emfu_is_special_local_folder (folder->full_name)) {
e_error_run(NULL,
"mail:no-rename-special-folder", folder->full_name, NULL);
return;
@@ -690,10 +694,10 @@ em_folder_utils_create_folder (CamelFolderInfo *folderinfo, EMFolderTree *emft,
EMFolderTreeModel *model;
GtkWidget *dialog;
- model = mail_component_peek_tree_model (mail_component_peek ());
+ model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend);
folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model);
- dialog = em_folder_selector_create_new (folder_tree, 0, _("Create folder"), _("Specify where to create the folder:"));
+ dialog = em_folder_selector_create_new (folder_tree, 0, _("Create Folder"), _("Specify where to create the folder:"));
if (folderinfo != NULL)
em_folder_selector_set_selected ((EMFolderSelector *) dialog, folderinfo->uri);
if (parent) {
diff --git a/mail/em-folder-utils.h b/mail/em-folder-utils.h
index c139a9e74c..f78dbbcd66 100644
--- a/mail/em-folder-utils.h
+++ b/mail/em-folder-utils.h
@@ -24,7 +24,7 @@
#ifndef EM_FOLDER_UTILS_H
#define EM_FOLDER_UTILS_H
-#include <glib.h>
+#include <gtk/gtk.h>
#include <camel/camel-folder.h>
#include <camel/camel-store.h>
#include <mail/em-folder-tree.h>
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index d0f8289a15..b72e187365 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -27,6 +27,7 @@
#include <sys/stat.h>
#include <unistd.h>
+#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <gdk/gdkkeysyms.h>
@@ -54,13 +55,6 @@
#include <camel/camel-offline-store.h>
#include <camel/camel-vee-store.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-ui-component.h>
-#include <bonobo/bonobo-ui-util.h>
-
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-embedded.h>
#include <gtkhtml/gtkhtml-stream.h>
@@ -71,10 +65,8 @@
#include "menus/gal-view-etable.h"
#include "menus/gal-view-factory-etable.h"
#include "menus/gal-view-instance.h"
-#include "menus/gal-view-menus.h"
#include "misc/e-charset-picker.h"
-#include <misc/e-filter-bar.h>
#include <misc/e-spinner.h>
#include "e-util/e-error.h"
@@ -84,6 +76,7 @@
#include "e-util/e-profile-event.h"
#include "e-util/e-util-private.h"
#include "e-util/e-util-labels.h"
+#include "shell/e-shell.h"
#include "filter/filter-rule.h"
@@ -94,110 +87,76 @@
#include "em-folder-browser.h"
#include "em-mailer-prefs.h"
#include "em-folder-browser.h"
-#include "em-message-browser.h"
#include "message-list.h"
#include "em-utils.h"
#include "em-composer-utils.h"
#include "em-menu.h"
#include "em-event.h"
+#include "e-mail-shell-backend.h"
#include "mail-mt.h"
#include "mail-ops.h"
#include "mail-config.h"
#include "mail-autofilter.h"
#include "mail-vfolder.h"
-#include "mail-component.h"
#include "mail-tools.h"
-#include "evolution-shell-component-utils.h" /* Pixmap stuff, sigh */
-
#ifdef HAVE_XFREE
#include <X11/XF86keysym.h>
#endif
-static void emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv);
-static void emfv_list_built(MessageList *ml, EMFolderView *emfv);
-static int emfv_list_right_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv);
-static void emfv_list_double_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv);
-static int emfv_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderView *emfv);
-static void emfv_list_selection_change(ETree *tree, EMFolderView *emfv);
-
-static void emfv_format_link_clicked(EMFormatHTMLDisplay *efhd, const char *uri, EMFolderView *);
-static int emfv_format_popup_event(EMFormatHTMLDisplay *efhd, GdkEventButton *event, const char *uri, CamelMimePart *part, EMFolderView *);
-
-static void emfv_enable_menus(EMFolderView *emfv);
-
-static void emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri);
-static void emfv_set_folder_uri(EMFolderView *emfv, const char *uri);
-static void emfv_set_message(EMFolderView *emfv, const char *uid, int nomarkseen);
-static void emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int state);
-
-static void emfv_message_reply(EMFolderView *emfv, int mode);
-static void vfolder_type_current (EMFolderView *emfv, int type);
-static void filter_type_current (EMFolderView *emfv, int type);
-
-static void emfv_setting_setup(EMFolderView *emfv);
-
-static void emfv_on_url_cb(GObject *emitter, const char *url, EMFolderView *emfv);
-static void emfv_on_url(EMFolderView *emfv, const char *uri, const char *nice_uri);
-
-static void emfv_set_seen (EMFolderView *emfv, const char *uid);
-static gboolean emfv_on_html_button_released_cb (GtkHTML *html, GdkEventButton *button, EMFolderView *emfv);
-static gboolean emfv_popup_menu (GtkWidget *widget);
-
-
/* this is added to emfv->enable_map in :init() */
static const EMFolderViewEnable emfv_enable_map[] = {
{ "EditCut", EM_POPUP_SELECT_MANY },
{ "EditCopy", EM_FOLDER_VIEW_SELECT_SELECTION },
{ "EditPaste", EM_POPUP_SELECT_FOLDER },
- { "SelectAllText", EM_POPUP_SELECT_ONE },
+// { "SelectAllText", EM_POPUP_SELECT_ONE },
/* FIXME: should these be single-selection? */
{ "MailNext", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_NEXT_MSG },
- { "MailNextFlagged", EM_POPUP_SELECT_MANY },
- { "MailNextUnread", EM_POPUP_SELECT_MANY },
- { "MailNextThread", EM_POPUP_SELECT_MANY },
+// { "MailNextFlagged", EM_POPUP_SELECT_MANY },
+// { "MailNextUnread", EM_POPUP_SELECT_MANY },
+// { "MailNextThread", EM_POPUP_SELECT_MANY },
{ "MailPrevious", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_PREV_MSG },
- { "MailPreviousFlagged", EM_POPUP_SELECT_MANY },
- { "MailPreviousUnread", EM_POPUP_SELECT_MANY },
+// { "MailPreviousFlagged", EM_POPUP_SELECT_MANY },
+// { "MailPreviousUnread", EM_POPUP_SELECT_MANY },
{ "AddSenderToAddressbook", EM_POPUP_SELECT_ADD_SENDER },
- { "MessageApplyFilters", EM_POPUP_SELECT_MANY },
- { "MessageFilterJunk", EM_POPUP_SELECT_MANY },
- { "MessageCopy", EM_POPUP_SELECT_MANY },
- { "MessageDelete", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_DELETE },
- { "MessageDeleteKey", EM_POPUP_SELECT_MANY},
- { "MessageForward", EM_POPUP_SELECT_MANY },
- { "MessageForwardAttached", EM_POPUP_SELECT_MANY },
- { "MessageForwardInline", EM_POPUP_SELECT_ONE },
- { "MessageForwardQuoted", EM_POPUP_SELECT_ONE },
- { "MessageRedirect", EM_POPUP_SELECT_ONE },
- { "MessageMarkAsRead", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_READ },
- { "MessageMarkAsUnRead", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_UNREAD },
- { "MessageMarkAsImportant", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_IMPORTANT },
- { "MessageMarkAsUnimportant", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_UNIMPORTANT },
- { "MessageMarkAsJunk", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_JUNK },
- { "MessageMarkAsNotJunk", EM_POPUP_SELECT_MANY},
+// { "MessageApplyFilters", EM_POPUP_SELECT_MANY },
+// { "MessageFilterJunk", EM_POPUP_SELECT_MANY },
+// { "MessageCopy", EM_POPUP_SELECT_MANY },
+// { "MessageDelete", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_DELETE },
+// { "MessageDeleteKey", EM_POPUP_SELECT_MANY},
+// { "MessageForward", EM_POPUP_SELECT_MANY },
+// { "MessageForwardAttached", EM_POPUP_SELECT_MANY },
+// { "MessageForwardInline", EM_POPUP_SELECT_ONE },
+// { "MessageForwardQuoted", EM_POPUP_SELECT_ONE },
+// { "MessageRedirect", EM_POPUP_SELECT_ONE },
+// { "MessageMarkAsRead", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_READ },
+// { "MessageMarkAsUnRead", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_UNREAD },
+// { "MessageMarkAsImportant", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_IMPORTANT },
+// { "MessageMarkAsUnimportant", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_UNIMPORTANT },
+// { "MessageMarkAsJunk", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_JUNK },
+// { "MessageMarkAsNotJunk", EM_POPUP_SELECT_MANY},
{ "MessageFollowUpFlag", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_FLAG_FOLLOWUP },
{ "MessageFollowUpComplete", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_FLAG_COMPLETED },
{ "MessageFollowUpClear", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_FLAG_CLEAR },
- { "MessageMove", EM_POPUP_SELECT_MANY },
- { "MessageOpen", EM_POPUP_SELECT_MANY },
- { "MessageReplyAll", EM_POPUP_SELECT_ONE },
- { "MessageReplyList", EM_POPUP_SELECT_ONE|EM_POPUP_SELECT_MAILING_LIST },
- { "MessageReplySender", EM_POPUP_SELECT_ONE },
- { "MessageEdit", EM_POPUP_SELECT_ONE },
- { "MessageSaveAs", EM_POPUP_SELECT_MANY },
+// { "MessageMove", EM_POPUP_SELECT_MANY },
+// { "MessageOpen", EM_POPUP_SELECT_MANY },
+// { "MessageReplyAll", EM_POPUP_SELECT_ONE },
+// { "MessageReplyList", EM_POPUP_SELECT_ONE|EM_POPUP_SELECT_MAILING_LIST },
+// { "MessageReplySender", EM_POPUP_SELECT_ONE },
+// { "MessageEdit", EM_POPUP_SELECT_ONE },
+// { "MessageSaveAs", EM_POPUP_SELECT_MANY },
{ "MessageSearch", EM_POPUP_SELECT_ONE| EM_FOLDER_VIEW_PREVIEW_PRESENT },
- { "MessageUndelete", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_UNDELETE },
- { "PrintMessage", EM_POPUP_SELECT_ONE },
- { "PrintPreviewMessage", EM_POPUP_SELECT_ONE },
+// { "MessageUndelete", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_UNDELETE },
+// { "PrintMessage", EM_POPUP_SELECT_ONE },
+// { "PrintPreviewMessage", EM_POPUP_SELECT_ONE },
- { "TextZoomIn", EM_POPUP_SELECT_ONE },
- { "TextZoomOut", EM_POPUP_SELECT_ONE },
- { "TextZoomReset", EM_POPUP_SELECT_ONE },
+// { "TextZoomIn", EM_POPUP_SELECT_ONE },
+// { "TextZoomOut", EM_POPUP_SELECT_ONE },
+// { "TextZoomReset", EM_POPUP_SELECT_ONE },
{ "ToolsFilterMailingList", EM_POPUP_SELECT_ONE|EM_POPUP_SELECT_MAILING_LIST},
{ "ToolsFilterRecipient", EM_POPUP_SELECT_ONE },
@@ -208,11 +167,11 @@ static const EMFolderViewEnable emfv_enable_map[] = {
{ "ToolsVFolderSender", EM_POPUP_SELECT_ONE },
{ "ToolsVFolderSubject", EM_POPUP_SELECT_ONE },
- { "ViewLoadImages", EM_POPUP_SELECT_ONE },
- { "ViewSource", EM_POPUP_SELECT_ONE },
+// { "ViewLoadImages", EM_POPUP_SELECT_ONE },
+// { "ViewSource", EM_POPUP_SELECT_ONE },
- /* always enabled */
- { "MailStop", 0 },
+// /* always enabled */
+// { "MailStop", 0 },
{ NULL },
};
@@ -226,9 +185,6 @@ struct _EMFolderViewPrivate {
GtkWidget *invisible;
char *selection_uri;
- GalViewInstance *view_instance;
- GalViewMenus *view_menus;
-
char *selected_uid;
};
@@ -245,59 +201,48 @@ extern CamelSession *session;
static guint signals[LAST_SIGNAL];
-static void emfv_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, EMFolderView *emfv);
-static void emfv_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EMFolderView *emfv);
-
-#ifdef ENABLE_PROFILING
-static void
-emfv_format_complete(EMFormat *emf, EMFolderView *emfv)
-{
- e_profile_event_emit("goto.done", emf->uid?emf->uid:"", 0);
-}
-#endif
-
static void
emfv_init(GObject *o)
{
EMFolderView *emfv = (EMFolderView *)o;
struct _EMFolderViewPrivate *p;
- gtk_box_set_homogeneous (GTK_BOX (emfv), FALSE);
-
- p = emfv->priv = g_malloc0(sizeof(struct _EMFolderViewPrivate));
-
- emfv->statusbar_active = TRUE;
- emfv->list_active = FALSE;
-
- emfv->ui_files = g_slist_append(NULL,
- g_build_filename (EVOLUTION_UIDIR,
- "evolution-mail-message.xml",
- NULL));
-
- emfv->ui_app_name = "evolution-mail";
+// gtk_box_set_homogeneous (GTK_BOX (emfv), FALSE);
+//
+// p = emfv->priv = g_malloc0(sizeof(struct _EMFolderViewPrivate));
+//
+// emfv->statusbar_active = TRUE;
+// emfv->list_active = FALSE;
+//
+// emfv->ui_files = g_slist_append(NULL,
+// g_build_filename (EVOLUTION_UIDIR,
+// "evolution-mail-message.xml",
+// NULL));
+//
+// emfv->ui_app_name = "evolution-mail";
emfv->enable_map = g_slist_prepend(NULL, (void *)emfv_enable_map);
- emfv->list = (MessageList *)message_list_new();
- g_signal_connect(emfv->list, "message_selected", G_CALLBACK(emfv_list_message_selected), emfv);
- g_signal_connect(emfv->list, "message_list_built", G_CALLBACK(emfv_list_built), emfv);
-
- /* FIXME: should this hang off message-list instead? */
- g_signal_connect(emfv->list->tree, "right_click", G_CALLBACK(emfv_list_right_click), emfv);
- g_signal_connect(emfv->list->tree, "double_click", G_CALLBACK(emfv_list_double_click), emfv);
- g_signal_connect(emfv->list->tree, "key_press", G_CALLBACK(emfv_list_key_press), emfv);
- g_signal_connect(emfv->list->tree, "selection_change", G_CALLBACK(emfv_list_selection_change), emfv);
-
- emfv->preview = (EMFormatHTMLDisplay *)em_format_html_display_new();
- /* FIXME: set_session should NOT be called here. Should it be a constructor attribute? */
- em_format_set_session ((EMFormat *) emfv->preview, session);
- g_signal_connect(emfv->preview, "link_clicked", G_CALLBACK(emfv_format_link_clicked), emfv);
+// emfv->list = (MessageList *)message_list_new();
+// g_signal_connect(emfv->list, "message_selected", G_CALLBACK(emfv_list_message_selected), emfv);
+// g_signal_connect(emfv->list, "message_list_built", G_CALLBACK(emfv_list_built), emfv);
+//
+// /* FIXME: should this hang off message-list instead? */
+// g_signal_connect(emfv->list->tree, "right_click", G_CALLBACK(emfv_list_right_click), emfv);
+// g_signal_connect(emfv->list->tree, "double_click", G_CALLBACK(emfv_list_double_click), emfv);
+// g_signal_connect(emfv->list->tree, "key_press", G_CALLBACK(emfv_list_key_press), emfv);
+// g_signal_connect(emfv->list->tree, "selection_change", G_CALLBACK(emfv_list_selection_change), emfv);
+//
+// emfv->preview = (EMFormatHTMLDisplay *)em_format_html_display_new();
+// /* FIXME: set_session should NOT be called here. Should it be a constructor attribute? */
+// em_format_set_session ((EMFormat *) emfv->preview, session);
+// g_signal_connect(emfv->preview, "link_clicked", G_CALLBACK(emfv_format_link_clicked), emfv);
g_signal_connect(emfv->preview, "popup_event", G_CALLBACK(emfv_format_popup_event), emfv);
- g_signal_connect (emfv->preview, "on_url", G_CALLBACK (emfv_on_url_cb), emfv);
- g_signal_connect (((EMFormatHTML *)emfv->preview)->html, "button-release-event", G_CALLBACK (emfv_on_html_button_released_cb), emfv);
-#ifdef ENABLE_PROFILING
- g_signal_connect(emfv->preview, "complete", G_CALLBACK (emfv_format_complete), emfv);
-#endif
+// g_signal_connect (emfv->preview, "on_url", G_CALLBACK (emfv_on_url_cb), emfv);
+// g_signal_connect (((EMFormatHTML *)emfv->preview)->html, "button-release-event", G_CALLBACK (emfv_on_html_button_released_cb), emfv);
+//#ifdef ENABLE_PROFILING
+// g_signal_connect(emfv->preview, "complete", G_CALLBACK (emfv_format_complete), emfv);
+//#endif
p->invisible = gtk_invisible_new();
g_signal_connect(p->invisible, "selection_get", G_CALLBACK(emfv_selection_get), emfv);
g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(emfv_selection_clear_event), emfv);
@@ -305,87 +250,6 @@ emfv_init(GObject *o)
gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1);
emfv->async = mail_async_event_new();
-
- emfv_setting_setup(emfv);
-}
-
-static void
-free_one_ui_file (gpointer data,
- gpointer user_data)
-{
- g_free (data);
-}
-
-static void
-emfv_finalise(GObject *o)
-{
- EMFolderView *emfv = (EMFolderView *)o;
- struct _EMFolderViewPrivate *p = emfv->priv;
-
- g_slist_foreach (emfv->ui_files, free_one_ui_file, NULL);
- g_slist_free(emfv->ui_files);
- g_slist_free(emfv->enable_map);
-
- g_free(p);
-
- ((GObjectClass *)emfv_parent)->finalize(o);
-}
-
-static void
-emfv_destroy (GtkObject *o)
-{
- EMFolderView *emfv = (EMFolderView *) o;
- struct _EMFolderViewPrivate *p = emfv->priv;
-
- p->destroyed = TRUE;
-
- if (emfv->list && emfv->list->seen_id) {
- g_source_remove(emfv->list->seen_id);
- emfv->list->seen_id = 0;
- }
-
- if (p->setting_notify_id) {
- GConfClient *gconf = gconf_client_get_default();
-
- gconf_client_notify_remove(gconf, p->setting_notify_id);
- p->setting_notify_id = 0;
- g_object_unref(gconf);
- }
-
- if (emfv->folder) {
- camel_object_unref(emfv->folder);
- g_free(emfv->folder_uri);
- emfv->folder = NULL;
- emfv->folder_uri = NULL;
- }
-
- if (emfv->async) {
- mail_async_event_destroy(emfv->async);
- emfv->async = NULL;
- }
-
- if (p->invisible) {
- gtk_object_destroy((GtkObject *)p->invisible);
- p->invisible = NULL;
- }
-
- if (p->selected_id != 0) {
- g_source_remove(p->selected_id);
- p->selected_id = 0;
- }
-
- g_free(p->selected_uid);
- p->selected_uid = NULL;
-
- g_free (emfv->displayed_uid);
- emfv->displayed_uid = NULL;
-
- emfv->preview = NULL;
- emfv->list = NULL;
- emfv->preview_active = FALSE;
- emfv->uic = NULL;
-
- ((GtkObjectClass *) emfv_parent)->destroy (o);
}
static void
@@ -404,7 +268,7 @@ emfv_class_init(GObjectClass *klass)
((EMFolderViewClass *)klass)->set_message = emfv_set_message;
((EMFolderViewClass *)klass)->activate = emfv_activate;
- ((EMFolderViewClass *)klass)->on_url = emfv_on_url;
+// ((EMFolderViewClass *)klass)->on_url = emfv_on_url;
signals[EMFV_ON_URL] = g_signal_new ("on-url",
G_OBJECT_CLASS_TYPE (klass),
@@ -434,365 +298,6 @@ emfv_class_init(GObjectClass *klass)
0);
}
-GType
-em_folder_view_get_type(void)
-{
- static GType type = 0;
-
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(EMFolderViewClass),
- NULL, NULL,
- (GClassInitFunc)emfv_class_init,
- NULL, NULL,
- sizeof(EMFolderView), 0,
- (GInstanceInitFunc)emfv_init
- };
- emfv_parent = g_type_class_ref(gtk_vbox_get_type());
- type = g_type_register_static(gtk_vbox_get_type(), "EMFolderView", &info, 0);
- }
-
- return type;
-}
-
-GtkWidget *em_folder_view_new(void)
-{
- EMFolderView *emfv = g_object_new(em_folder_view_get_type(), NULL);
-
- return (GtkWidget *)emfv;
-}
-
-/* flag all selected messages. Return number flagged */
-/* FIXME: Should this be part of message-list instead? */
-int
-em_folder_view_mark_selected(EMFolderView *emfv, guint32 mask, guint32 set)
-{
- GPtrArray *uids;
- int i;
-
- if (emfv->folder == NULL)
- return 0;
-
- uids = message_list_get_selected(emfv->list);
- if (!CAMEL_IS_VEE_FOLDER(emfv->folder))
- camel_folder_freeze(emfv->folder);
-
- for (i=0; i<uids->len; i++)
- camel_folder_set_message_flags(emfv->folder, uids->pdata[i], mask, set);
-
- message_list_free_uids(emfv->list, uids);
- if (!CAMEL_IS_VEE_FOLDER(emfv->folder))
- camel_folder_thaw(emfv->folder);
-
- return i;
-}
-
-/* should this be elsewhere/take a uid list? */
-int
-em_folder_view_open_selected(EMFolderView *emfv)
-{
- GPtrArray *uids, *views;
- int i = 0;
-
- uids = message_list_get_selected(emfv->list);
-
- if (uids->len >= 10) {
- char *num = g_strdup_printf("%d", uids->len);
- int doit;
-
- doit = em_utils_prompt_user((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emfv),
- "/apps/evolution/mail/prompts/open_many",
- "mail:ask-open-many", num, NULL);
- g_free(num);
- if (!doit) {
- message_list_free_uids(emfv->list, uids);
- return 0;
- }
- }
-
- if (em_utils_folder_is_drafts(emfv->folder, emfv->folder_uri)
- || em_utils_folder_is_templates(emfv->folder, emfv->folder_uri)
- || em_utils_folder_is_outbox(emfv->folder, emfv->folder_uri)) {
- em_utils_edit_messages(emfv->folder, uids, TRUE);
- return uids->len;
- }
-
- /* for vfolders we need to edit the *original*, not the vfolder copy */
- views = g_ptr_array_new();
- for (i=0;i<uids->len;i++) {
- if (camel_object_is((CamelObject *)emfv->folder, camel_vee_folder_get_type())) {
- CamelVeeMessageInfo *vinfo = (CamelVeeMessageInfo *)camel_folder_get_message_info(emfv->folder, uids->pdata[i]);
-
- if (vinfo) {
- char *uid;
- /* TODO: get_location shouldn't strdup the uid */
- CamelFolder *f = camel_vee_folder_get_location((CamelVeeFolder *)emfv->folder, vinfo, &uid);
- char *uri = mail_tools_folder_to_url(f);
-
- if (em_utils_folder_is_drafts(f, uri) || em_utils_folder_is_outbox(f, uri)) {
- GPtrArray *edits = g_ptr_array_new();
-
- g_ptr_array_add(edits, uid);
- em_utils_edit_messages(f, edits, TRUE);
- } else {
- g_free(uid);
- g_ptr_array_add(views, g_strdup(uids->pdata[i]));
- }
- g_free(uri);
- }
- } else {
- g_ptr_array_add(views, g_strdup(uids->pdata[i]));
- }
- }
-
- /* TODO: have an em_utils_open_messages call? */
- for (i=0; i<views->len; i++) {
- EMMessageBrowser *emmb;
-
- emmb = (EMMessageBrowser *)em_message_browser_window_new();
- message_list_set_threaded(((EMFolderView *)emmb)->list, emfv->list->threaded);
- /* always keep actual message in a list view, even it doesn't belong to the filter anymore */
- message_list_ensure_message (((EMFolderView *)emmb)->list, views->pdata[i]);
- message_list_set_search (((EMFolderView *)emmb)->list, emfv->list->search);
- em_folder_view_set_hide_deleted((EMFolderView *)emmb, emfv->hide_deleted);
- /* FIXME: session needs to be passed easier than this */
- em_format_set_session((EMFormat *)((EMFolderView *)emmb)->preview, ((EMFormat *)emfv->preview)->session);
- em_folder_view_set_folder((EMFolderView *)emmb, emfv->folder, emfv->folder_uri);
- em_folder_view_set_message((EMFolderView *)emmb, views->pdata[i], FALSE);
- gtk_widget_show(emmb->window);
- /* TODO: this loads the message twice (!) */
- em_utils_handle_receipt (emfv->folder, uids->pdata[i], NULL);
- g_free(views->pdata[i]);
- }
- g_ptr_array_free(views, TRUE);
-
- message_list_free_uids(emfv->list, uids);
-
- return i;
-}
-
-/* ******************************************************************************** */
-static void
-emfv_list_display_view(GalViewInstance *instance, GalView *view, EMFolderView *emfv)
-{
- if (GAL_IS_VIEW_ETABLE(view))
- gal_view_etable_attach_tree(GAL_VIEW_ETABLE(view), emfv->list->tree);
-}
-
-static void
-emfv_setup_view_instance(EMFolderView *emfv)
-{
- static GalViewCollection *collection = NULL;
- struct _EMFolderViewPrivate *p = emfv->priv;
- gboolean outgoing, show_wide=FALSE;
- char *id;
-
- g_return_if_fail (emfv->folder);
- g_return_if_fail (emfv->folder_uri);
-
- if (collection == NULL) {
- ETableSpecification *spec;
- GalViewFactory *factory;
- const char *evolution_dir;
- char *dir;
- char *galviewsmaildir;
- char *etspecfile;
-
- collection = gal_view_collection_new ();
-
- gal_view_collection_set_title (collection, _("Mail"));
-
- evolution_dir = mail_component_peek_base_directory (mail_component_peek ());
- galviewsmaildir = g_build_filename (EVOLUTION_GALVIEWSDIR,
- "mail",
- NULL);
- dir = g_build_filename (evolution_dir, "views", NULL);
- gal_view_collection_set_storage_directories (collection, galviewsmaildir, dir);
- g_free (dir);
- g_free (galviewsmaildir);
-
- spec = e_table_specification_new ();
- etspecfile = g_build_filename (EVOLUTION_ETSPECDIR,
- "message-list.etspec",
- NULL);
- if (!e_table_specification_load_from_file (spec, etspecfile))
- g_error ("Unable to load ETable specification file "
- "for mail");
- g_free (etspecfile);
-
- factory = gal_view_factory_etable_new (spec);
- g_object_unref (spec);
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- gal_view_collection_load (collection);
- }
-
- if (p->view_instance) {
- g_object_unref(p->view_instance);
- p->view_instance = NULL;
- }
-
- if (p->view_menus) {
- g_object_unref(p->view_menus);
- p->view_menus = NULL;
- }
-
- /* TODO: should this go through mail-config api? */
- id = mail_config_folder_to_safe_url (emfv->folder);
- p->view_instance = gal_view_instance_new (collection, id);
-
- show_wide = emfv->list_active ? em_folder_browser_get_wide ((EMFolderBrowser *) emfv):FALSE;
- if (show_wide) {
- char *safe_id, *filename;
-
- /* Force to use the wide view */
- g_free (p->view_instance->custom_filename);
- g_free (p->view_instance->current_view_filename);
- safe_id = g_strdup (id);
- e_filename_make_safe (safe_id);
- filename = g_strdup_printf ("custom_wide_view-%s.xml", safe_id);
- p->view_instance->custom_filename = g_build_filename (collection->local_dir, filename, NULL);
- g_free (filename);
- filename = g_strdup_printf ("current_wide_view-%s.xml", safe_id);
- p->view_instance->current_view_filename = g_build_filename (collection->local_dir, filename, NULL);
- g_free (filename);
- g_free (safe_id);
- }
- g_free (id);
-
- outgoing = em_utils_folder_is_drafts (emfv->folder, emfv->folder_uri)
- || em_utils_folder_is_sent (emfv->folder, emfv->folder_uri)
- || em_utils_folder_is_outbox (emfv->folder, emfv->folder_uri);
-
- if (outgoing) {
- if (show_wide)
- gal_view_instance_set_default_view(p->view_instance, "Wide_View_Sent");
- else
- gal_view_instance_set_default_view(p->view_instance, "As_Sent_Folder");
- } else if (show_wide) {
- gal_view_instance_set_default_view(p->view_instance, "Wide_View_Normal");
- }
-
- gal_view_instance_load(p->view_instance);
-
- if (!gal_view_instance_exists(p->view_instance)) {
- struct stat st;
- char *path;
-
- path = mail_config_folder_to_cachename (emfv->folder, "et-header-");
- if (path && g_stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
- ETableSpecification *spec;
- ETableState *state;
- GalView *view;
- char *etspecfile;
-
- spec = e_table_specification_new ();
- etspecfile = g_build_filename (EVOLUTION_ETSPECDIR,
- "message-list.etspec",
- NULL);
- e_table_specification_load_from_file (spec, etspecfile);
- g_free (etspecfile);
- view = gal_view_etable_new (spec, "");
- g_object_unref (spec);
-
- state = e_table_state_new ();
- e_table_state_load_from_file (state, path);
- gal_view_etable_set_state (GAL_VIEW_ETABLE (view), state);
- g_object_unref (state);
-
- gal_view_instance_set_custom_view(p->view_instance, view);
- g_object_unref (view);
- }
-
- g_free (path);
- }
-
- g_signal_connect(p->view_instance, "display_view", G_CALLBACK(emfv_list_display_view), emfv);
- emfv_list_display_view(p->view_instance, gal_view_instance_get_current_view(p->view_instance), emfv);
-
- if (emfv->list_active && emfv->uic) {
- p->view_menus = gal_view_menus_new(p->view_instance);
- gal_view_menus_apply(p->view_menus, emfv->uic, NULL);
- }
-}
-
-void em_folder_view_setup_view_instance (EMFolderView *emfv)
-{
- emfv_setup_view_instance (emfv);
-}
-
-/* ********************************************************************** */
-
-static void
-emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
-{
- int isout = (folder && uri
- && (em_utils_folder_is_drafts(folder, uri)
- || em_utils_folder_is_sent(folder, uri)
- || em_utils_folder_is_outbox(folder, uri)));
-
- if (folder == emfv->folder)
- return;
-
- if (emfv->priv->selected_id)
- g_source_remove(emfv->priv->selected_id);
-
- if (emfv->preview)
- em_format_format ((EMFormat *) emfv->preview, NULL, NULL, NULL);
-
- message_list_set_folder(emfv->list, folder, uri, isout);
- g_free(emfv->folder_uri);
- emfv->folder_uri = uri ? g_strdup(uri):NULL;
-
- if (emfv->folder) {
- emfv->hide_deleted = emfv->list->hidedeleted; /* <- a bit nasty but makes it track the display better */
- mail_sync_folder (emfv->folder, NULL, NULL);
- camel_object_unref(emfv->folder);
- }
-
- emfv->folder = folder;
- if (folder) {
- /* We need to set this up to get the right view options for the message-list,
- * even if we're not showing it */
- emfv_setup_view_instance(emfv);
- camel_object_ref(folder);
- }
-
- emfv_enable_menus(emfv);
-
- /* TODO: should probably be called after all processing, not just this class's impl */
- g_signal_emit(emfv, signals[EMFV_LOADED], 0);
-}
-
-static void
-emfv_got_folder(char *uri, CamelFolder *folder, void *data)
-{
- EMFolderView *emfv = data;
-
- em_folder_view_set_folder(emfv, folder, uri);
-}
-
-static void
-emfv_set_folder_uri(EMFolderView *emfv, const char *uri)
-{
- mail_get_folder(uri, 0, emfv_got_folder, emfv, mail_msg_fast_ordered_push);
-}
-
-static void
-emfv_set_message(EMFolderView *emfv, const char *uid, int nomarkseen)
-{
- e_profile_event_emit("goto.uid", uid?uid:"<none>", 0);
-
- /* This could possible race with other set messages, but likelyhood is small */
- emfv->priv->nomarkseen = nomarkseen;
- message_list_select_uid(emfv->list, uid);
- /* force an update, since we may not get an updated event if we select the same uid */
- emfv_list_message_selected(emfv->list, uid, emfv);
-}
-
-/* ********************************************************************** */
-
static void
emfv_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, EMFolderView *emfv)
{
@@ -820,694 +325,6 @@ emfv_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EMFolder
/* Popup menu
In many cases these are the functions called by the bonobo callbacks too */
-static void
-emfv_popup_open(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- em_folder_view_open_selected(emfv);
-}
-
-static void
-emfv_popup_edit (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids;
-
- if (!em_utils_check_user_can_send_mail((GtkWidget *)emfv))
- return;
-
- uids = message_list_get_selected(emfv->list);
- em_utils_edit_messages (emfv->folder, uids, FALSE);
-}
-
-static void
-emfv_popup_saveas(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids;
-
- uids = message_list_get_selected(emfv->list);
- em_utils_save_messages((GtkWidget *)emfv, emfv->folder, uids);
-}
-
-static void
-emfv_view_load_images(BonoboUIComponent *uic, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- if (emfv->preview)
- em_format_html_load_http((EMFormatHTML *)emfv->preview);
-}
-
-static void
-emfv_popup_print(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- em_folder_view_print(emfv, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-}
-
-static void
-emfv_popup_copy_text(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- gtk_html_copy (((EMFormatHTML *)emfv->preview)->html);
-}
-
-static void
-emfv_popup_source(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- EMMessageBrowser *emmb;
- GPtrArray *uids;
-
- uids = message_list_get_selected(emfv->list);
-
- emmb = (EMMessageBrowser *)em_message_browser_window_new();
- em_format_set_session((EMFormat *)((EMFolderView *)emmb)->preview, ((EMFormat *)emfv->preview)->session);
- message_list_ensure_message (((EMFolderView *)emmb)->list, uids->pdata[0]);
- em_folder_view_set_folder((EMFolderView *)emmb, emfv->folder, emfv->folder_uri);
- em_format_set_mode((EMFormat *)((EMFolderView *)emmb)->preview, EM_FORMAT_SOURCE);
- em_folder_view_set_message((EMFolderView *)emmb, uids->pdata[0], FALSE);
- gtk_widget_show(emmb->window);
-
- message_list_free_uids(emfv->list, uids);
-}
-
-static void
-emfv_mail_compose(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- if (!em_utils_check_user_can_send_mail((GtkWidget *)emfv))
- return;
-
- em_utils_compose_new_message(emfv->folder_uri);
-}
-
-static void
-emfv_popup_reply_sender(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- emfv_message_reply(emfv, REPLY_MODE_SENDER);
-}
-
-static void
-emfv_popup_reply_list(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- emfv_message_reply(emfv, REPLY_MODE_LIST);
-}
-
-static void
-emfv_popup_reply_all(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- emfv_message_reply(emfv, REPLY_MODE_ALL);
-}
-
-static void
-emfv_popup_forward(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids;
-
- if (!em_utils_check_user_can_send_mail((GtkWidget *)emfv))
- return;
-
- uids = message_list_get_selected(emfv->list);
- em_utils_forward_messages (emfv->folder, uids, emfv->folder_uri);
-}
-
-static void
-emfv_popup_flag_followup(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids = message_list_get_selected(emfv->list);
-
- em_utils_flag_for_followup((GtkWidget *)emfv, emfv->folder, uids);
-}
-
-static void
-emfv_popup_flag_completed(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids;
-
- uids = message_list_get_selected(emfv->list);
- em_utils_flag_for_followup_completed((GtkWidget *)emfv, emfv->folder, uids);
-
- if (emfv->preview)
- em_format_redraw (EM_FORMAT (emfv->preview));
-}
-
-static void
-emfv_popup_flag_clear(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids = message_list_get_selected(emfv->list);
-
- em_utils_flag_for_followup_clear((GtkWidget *)emfv, emfv->folder, uids);
-
- if (emfv->preview)
- em_format_redraw (EM_FORMAT (emfv->preview));
-}
-
-static void
-emfv_popup_mark_read(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
-}
-
-static void
-emfv_popup_mark_unread(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, 0);
-
- if (emfv->list->seen_id) {
- g_source_remove(emfv->list->seen_id);
- emfv->list->seen_id = 0;
- }
-}
-
-static void
-emfv_popup_mark_important(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_FLAGGED|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_FLAGGED);
-}
-
-static void
-emfv_popup_mark_unimportant(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_FLAGGED, 0);
-}
-
-static void
-emfv_select_next_message (EMFolderView *emfv, int count, gboolean always_can_previous)
-{
- if (emfv && count == 1) {
- if (!message_list_select (emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0) && (emfv->hide_deleted || always_can_previous))
- message_list_select (emfv->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, 0);
- }
-}
-
-static void
-emfv_popup_mark_junk (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- int count;
-
- count = em_folder_view_mark_selected(emfv,
- CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_NOTJUNK|CAMEL_MESSAGE_JUNK_LEARN,
- CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN);
-
- emfv_select_next_message (emfv, count, TRUE);
-}
-
-static void
-emfv_popup_mark_nojunk (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- int count;
-
- count = em_folder_view_mark_selected(emfv,
- CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_NOTJUNK|CAMEL_MESSAGE_JUNK_LEARN,
- CAMEL_MESSAGE_NOTJUNK|CAMEL_MESSAGE_JUNK_LEARN);
-
- emfv_select_next_message (emfv, count, TRUE);
-}
-
-#define DelInVFolderCheckName "DelInVFolderCheck"
-#define DelInVFolderKey "/apps/evolution/mail/prompts/delete_in_vfolder"
-
-static void
-emfv_delete_msg_response (GtkWidget *dialog, int response, gpointer data)
-{
- if (response == GTK_RESPONSE_OK) {
- EMFolderView *emfv = data;
- int count;
- GPtrArray *uids;
-
- if (dialog) {
- GList *children, *l;
- GtkWidget *check = NULL;
-
- children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox));
- for (l = children; l; l = l->next) {
- if (GTK_IS_ALIGNMENT (l->data)) {
- check = gtk_bin_get_child (GTK_BIN (l->data));
-
- if (check && GTK_IS_CHECK_BUTTON (check) &&
- !strcmp (gtk_widget_get_name (check), DelInVFolderCheckName))
- break;
-
- check = NULL;
- }
- }
-
- if (check) {
- GConfClient *gconf = gconf_client_get_default ();
- gconf_client_set_bool (gconf, DelInVFolderKey, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)), NULL);
- g_object_unref (gconf);
- }
-
- g_list_free (children);
- }
-
- uids = message_list_get_selected(emfv->list);
- if (!CAMEL_IS_VEE_FOLDER(emfv->folder))
- camel_folder_freeze(emfv->folder);
-
- for (count=0; count < uids->len; count++) {
- if (camel_folder_get_message_flags (emfv->folder, uids->pdata[count]) & CAMEL_MESSAGE_USER_NOT_DELETABLE) {
- if (emfv->preview_active) {
- GtkHTMLStream *hstream = gtk_html_begin(((EMFormatHTML *)emfv->preview)->html);
-
- gtk_html_stream_printf(hstream, "<h2>%s</h2><p>%s</p>",
- _("Mail Deletion Failed"),
- _("You do not have sufficient permissions to delete this mail."));
- gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK);
- } else {
- GtkWidget *w = e_error_new (NULL, "mail:no-delete-permission", "", NULL);
- em_utils_show_error_silent (w);
- }
-
- count = -1;
- break;
- } else
- camel_folder_set_message_flags(emfv->folder, uids->pdata[count], CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED );
- }
-
- message_list_free_uids(emfv->list, uids);
- if (!CAMEL_IS_VEE_FOLDER(emfv->folder))
- camel_folder_thaw(emfv->folder);
-
- emfv_select_next_message (emfv, count, FALSE);
- }
-
- if (dialog)
- gtk_widget_destroy (dialog);
-}
-
-static void
-emfv_popup_delete (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- GConfClient *gconf = gconf_client_get_default ();
-
- if (emfv->folder && emfv->folder->parent_store && CAMEL_IS_VEE_STORE (emfv->folder->parent_store)
- && !gconf_client_get_bool (gconf, DelInVFolderKey, NULL)) {
- GtkWidget *dialog, *checkbox, *align;
-
- dialog = e_error_new (NULL, "mail:ask-delete-vfolder-msg", emfv->folder->full_name, NULL);
- g_signal_connect (dialog, "response", G_CALLBACK (emfv_delete_msg_response), emfv);
- checkbox = gtk_check_button_new_with_label (_("Do not ask me again."));
- gtk_widget_set_name (checkbox, DelInVFolderCheckName);
- align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
- gtk_container_add (GTK_CONTAINER (align), checkbox);
- gtk_widget_show (checkbox);
- gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox), align, TRUE, TRUE, 6);
- gtk_widget_show (align);
- gtk_widget_show (dialog);
- } else {
- emfv_delete_msg_response (NULL, GTK_RESPONSE_OK, emfv);
- }
-
- g_object_unref (gconf);
-}
-#undef DelInVFolderCheckName
-#undef DelInVFolderKey
-
-static void
-emfv_popup_undelete(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_DELETED, 0);
-}
-
-struct _move_data {
- EMFolderView *emfv;
- GPtrArray *uids;
- int delete;
-};
-
-static char *default_xfer_messages_uri = NULL;
-
-static void
-emfv_popup_move_cb(const char *uri, void *data)
-{
- struct _move_data *d = data;
-
- if (uri) {
- g_free (default_xfer_messages_uri);
- default_xfer_messages_uri = g_strdup (uri);
- mail_transfer_messages(d->emfv->folder, d->uids, d->delete, uri, 0, NULL, NULL);
- } else
- em_utils_uids_free(d->uids);
-
- g_object_unref(d->emfv);
- g_free(d);
-}
-
-static void
-emfv_popup_move(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- struct _move_data *d;
-
- d = g_malloc(sizeof(*d));
- d->emfv = emfv;
- g_object_ref(emfv);
- d->uids = message_list_get_selected(emfv->list);
- d->delete = TRUE;
-
- em_select_folder ((GtkWindow *) emfv, _("Select folder"), _("_Move"), default_xfer_messages_uri, NULL, emfv_popup_move_cb, d);
-}
-
-static void
-emfv_popup_copy(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- struct _move_data *d;
-
- d = g_malloc(sizeof(*d));
- d->emfv = emfv;
- g_object_ref(emfv);
- d->uids = message_list_get_selected(emfv->list);
- d->delete = FALSE;
-
- em_select_folder ((GtkWindow *) emfv, _("Select folder"), _("C_opy"), default_xfer_messages_uri, NULL, emfv_popup_move_cb, d);
-}
-
-static void
-emfv_set_label (EMFolderView *emfv, const char *label)
-{
- GPtrArray *uids = message_list_get_selected (emfv->list);
- int i;
-
- for (i = 0; i < uids->len; i++)
- camel_folder_set_message_user_flag (emfv->folder, uids->pdata[i], label, TRUE);
-
- message_list_free_uids (emfv->list, uids);
-}
-
-static void
-emfv_unset_label (EMFolderView *emfv, const char *label)
-{
- GPtrArray *uids = message_list_get_selected (emfv->list);
- int i;
-
- for (i = 0; i < uids->len; i++) {
- camel_folder_set_message_user_flag (emfv->folder, uids->pdata[i], label, FALSE);
- camel_folder_set_message_user_tag (emfv->folder, uids->pdata[i], "label", NULL);
- }
-
- message_list_free_uids (emfv->list, uids);
-}
-
-static void
-emfv_popup_label_clear(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- GSList *l;
- EUtilLabel *label;
-
- for (l = mail_config_get_labels (); l; l = l->next) {
- label = l->data;
- emfv_unset_label(emfv, label->tag);
- }
-}
-
-static void
-emfv_popup_label_set(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
-
- if (pitem->type & E_POPUP_ACTIVE)
- emfv_set_label (emfv, pitem->user_data);
- else
- emfv_unset_label (emfv, pitem->user_data);
-}
-
-static void
-emfv_popup_label_new (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- char *tag = e_util_labels_add_with_dlg (NULL, NULL);
-
- if (tag) {
- emfv_set_label (emfv, tag);
- g_free (tag);
- }
-}
-
-static void
-emfv_popup_add_sender(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids = message_list_get_selected(emfv->list);
- CamelMessageInfo *info;
- const char *addr;
-
- if (uids->len == 1
- && (info = camel_folder_get_message_info(emfv->folder, uids->pdata[0])) != NULL
- && (addr = camel_message_info_from(info)) != NULL
- && addr[0] != 0)
- em_utils_add_address((GtkWidget *)emfv, addr);
-
- em_utils_uids_free(uids);
-}
-
-static void
-emfv_popup_apply_filters(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids = message_list_get_selected(emfv->list);
-
- mail_filter_on_demand(emfv->folder, uids);
-}
-
-static void
-emfv_popup_filter_junk(EPopup *ep, EPopupItem *pitem, void *data)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids = message_list_get_selected(emfv->list);
-
- mail_filter_junk(emfv->folder, uids);
-}
-
-/* filter callbacks, this will eventually be a wizard, see
- filter_type_current/vfolder_type_current for implementation */
-
-#define EMFV_POPUP_AUTO_TYPE(autotype, name, type) \
-static void \
-name(EPopup *ep, EPopupItem *item, void *data) \
-{ \
- EMFolderView *emfv = data; \
- autotype(emfv, type); \
-}
-
-EMFV_POPUP_AUTO_TYPE(vfolder_type_current, emfv_popup_vfolder_subject, AUTO_SUBJECT)
-EMFV_POPUP_AUTO_TYPE(vfolder_type_current, emfv_popup_vfolder_sender, AUTO_FROM)
-EMFV_POPUP_AUTO_TYPE(vfolder_type_current, emfv_popup_vfolder_recipients, AUTO_TO)
-EMFV_POPUP_AUTO_TYPE(vfolder_type_current, emfv_popup_vfolder_mlist, AUTO_MLIST)
-
-EMFV_POPUP_AUTO_TYPE(filter_type_current, emfv_popup_filter_subject, AUTO_SUBJECT)
-EMFV_POPUP_AUTO_TYPE(filter_type_current, emfv_popup_filter_sender, AUTO_FROM)
-EMFV_POPUP_AUTO_TYPE(filter_type_current, emfv_popup_filter_recipients, AUTO_TO)
-EMFV_POPUP_AUTO_TYPE(filter_type_current, emfv_popup_filter_mlist, AUTO_MLIST)
-
-/* TODO: Move some of these to be 'standard' menu's */
-
-static EPopupItem emfv_popup_items[] = {
- { E_POPUP_ITEM, (gchar *) "00.emfv.00", (gchar *) N_("_Copy"), emfv_popup_copy_text, NULL, (gchar *) "edit-copy", EM_FOLDER_VIEW_SELECT_DISPLAY|EM_FOLDER_VIEW_SELECT_SELECTION },
-
- { E_POPUP_BAR, (gchar *) "10.emfv", NULL, NULL, NULL, NULL },
-
- { E_POPUP_ITEM, (gchar *) "10.emfv.00", (gchar *) N_("_Reply to Sender"), emfv_popup_reply_sender, NULL, (gchar *) "mail-reply-sender", EM_POPUP_SELECT_ONE },
- { E_POPUP_ITEM, (gchar *) "10.emfv.01", (gchar *) N_("Reply to _All"), emfv_popup_reply_all, NULL, (gchar *) "mail-reply-all", EM_POPUP_SELECT_ONE },
- { E_POPUP_ITEM, (gchar *) "10.emfv.02", (gchar *) N_("_Forward"), emfv_popup_forward, NULL, (gchar *) "mail-forward", EM_POPUP_SELECT_MANY },
-
- { E_POPUP_BAR, (gchar *) "20.emfv", NULL, NULL, NULL, NULL },
- /* EM_POPUP_EDIT was used here. This is changed to EM_POPUP_SELECT_ONE as Edit-as-new-messaeg need not be restricted to Sent-Items folder alone */
- { E_POPUP_ITEM, (gchar *) "20.emfv.00", (gchar *) N_("_Edit as New Message..."), emfv_popup_edit, NULL, NULL, EM_POPUP_SELECT_ONE },
- { E_POPUP_ITEM, (gchar *) "20.emfv.01", (gchar *) N_("_Save As..."), emfv_popup_saveas, NULL, (gchar *) "document-save-as", EM_POPUP_SELECT_MANY },
- { E_POPUP_ITEM, (gchar *) "20.emfv.02", (gchar *) N_("_Print..."), emfv_popup_print, NULL, (gchar *) "document-print", EM_POPUP_SELECT_ONE },
-
- { E_POPUP_BAR, (gchar *) "40.emfv", NULL, NULL, NULL, NULL },
- { E_POPUP_ITEM, (gchar *) "40.emfv.00", (gchar *) N_("_Delete"), emfv_popup_delete, NULL, (gchar *) "edit-delete", EM_POPUP_SELECT_DELETE|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "40.emfv.01", (gchar *) N_("U_ndelete"), emfv_popup_undelete, NULL, NULL, EM_POPUP_SELECT_UNDELETE|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "40.emfv.02", (gchar *) N_("_Move to Folder..."), emfv_popup_move, NULL, (gchar *) "mail-move", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "40.emfv.03", (gchar *) N_("_Copy to Folder..."), emfv_popup_copy, NULL, (gchar *) "mail-copy", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY },
-
- { E_POPUP_BAR, (gchar *) "50.emfv", NULL, NULL, NULL, NULL },
- { E_POPUP_ITEM, (gchar *) "50.emfv.00", (gchar *) N_("Mar_k as Read"), emfv_popup_mark_read, NULL, (gchar *) "mail-mark-read", EM_POPUP_SELECT_MARK_READ|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "50.emfv.01", (gchar *) N_("Mark as _Unread"), emfv_popup_mark_unread, NULL, (gchar *) "mail-mark-unread", EM_POPUP_SELECT_MARK_UNREAD|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "50.emfv.02", (gchar *) N_("Mark as _Important"), emfv_popup_mark_important, NULL, (gchar *) "mail-mark-important", EM_POPUP_SELECT_MARK_IMPORTANT|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "50.emfv.03", (gchar *) N_("Mark as Un_important"), emfv_popup_mark_unimportant, NULL, NULL, EM_POPUP_SELECT_MARK_UNIMPORTANT|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "50.emfv.04", (gchar *) N_("Mark as _Junk"), emfv_popup_mark_junk, NULL, (gchar *) "mail-mark-junk", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY|EM_POPUP_SELECT_JUNK },
- { E_POPUP_ITEM, (gchar *) "50.emfv.05", (gchar *) N_("Mark as _Not Junk"), emfv_popup_mark_nojunk, NULL, (gchar *) "mail-mark-notjunk", EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY|EM_POPUP_SELECT_NOT_JUNK },
- { E_POPUP_ITEM, (gchar *) "50.emfv.06", (gchar *) N_("Mark for Follo_w Up..."), emfv_popup_flag_followup, NULL, (gchar *) "stock_mail-flag-for-followup", EM_POPUP_SELECT_FLAG_FOLLOWUP|EM_FOLDER_VIEW_SELECT_LISTONLY },
-
- { E_POPUP_SUBMENU, (gchar *) "60.label.00", (gchar *) N_("_Label"), NULL, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "60.label.00/00.label", (gchar *) N_("_None"), emfv_popup_label_clear, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_BAR, (gchar *) "60.label.00/00.label.00", NULL, NULL, NULL, NULL },
- { E_POPUP_BAR, (gchar *) "60.label.00/01.label", NULL, NULL, NULL, NULL },
- { E_POPUP_ITEM, (gchar *) "60.label.00/01.label.00", (gchar *) N_("_New Label"), emfv_popup_label_new, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY },
-
- { E_POPUP_BAR, (gchar *) "70.emfv.06", NULL, NULL, NULL, NULL },
-
- { E_POPUP_ITEM, (gchar *) "70.emfv.07", (gchar *) N_("Fla_g Completed"), emfv_popup_flag_completed, NULL, (gchar *) "stock_mail-flag-for-followup-done", EM_POPUP_SELECT_FLAG_COMPLETED|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "70.emfv.08", (gchar *) N_("Cl_ear Flag"), emfv_popup_flag_clear, NULL, NULL, EM_POPUP_SELECT_FLAG_CLEAR|EM_FOLDER_VIEW_SELECT_LISTONLY },
-
- { E_POPUP_BAR, (gchar *) "90.filter", NULL, NULL, NULL, NULL },
- { E_POPUP_SUBMENU, (gchar *) "90.filter.00", (gchar *) N_("Crea_te Rule From Message"), NULL, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY },
- /* Translators: The following strings are used while creating a new search folder, to specify what parameter the search folder would be based on. */
- { E_POPUP_ITEM, (gchar *) "90.filter.00/00.00", (gchar *) N_("Search Folder based on _Subject"), emfv_popup_vfolder_subject, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "90.filter.00/00.01", (gchar *) N_("Search Folder based on Se_nder"), emfv_popup_vfolder_sender, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "90.filter.00/00.02", (gchar *) N_("Search Folder based on _Recipients"), emfv_popup_vfolder_recipients, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "90.filter.00/00.03", (gchar *) N_("Search Folder based on Mailing _List"),
- emfv_popup_vfolder_mlist, NULL, NULL, EM_POPUP_SELECT_ONE|EM_POPUP_SELECT_MAILING_LIST|EM_FOLDER_VIEW_SELECT_LISTONLY },
-
- { E_POPUP_BAR, (gchar *) "90.filter.00/10", NULL, NULL, NULL, NULL },
- /* Translators: The following strings are used while creating a new message filter, to specify what parameter the filter would be based on. */
- { E_POPUP_ITEM, (gchar *) "90.filter.00/10.00", (gchar *) N_("Filter based on Sub_ject"), emfv_popup_filter_subject, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "90.filter.00/10.01", (gchar *) N_("Filter based on Sen_der"), emfv_popup_filter_sender, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "90.filter.00/10.02", (gchar *) N_("Filter based on Re_cipients"), emfv_popup_filter_recipients, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, (gchar *) "90.filter.00/10.03", (gchar *) N_("Filter based on _Mailing List"),
- emfv_popup_filter_mlist, NULL, NULL, EM_POPUP_SELECT_ONE|EM_POPUP_SELECT_MAILING_LIST|EM_FOLDER_VIEW_SELECT_LISTONLY },
-};
-
-static enum _e_popup_t
-emfv_popup_labels_get_state_for_tag (EMFolderView *emfv, GPtrArray *uids, const char *label_tag)
-{
- enum _e_popup_t state = 0;
- int i;
- gboolean exists = FALSE, not_exists = FALSE;
-
- g_return_val_if_fail (emfv != 0, state);
- g_return_val_if_fail (label_tag != NULL, state);
-
- for (i = 0; i < uids->len && (!exists || !not_exists); i++) {
- if (camel_folder_get_message_user_flag (emfv->folder, uids->pdata[i], label_tag))
- exists = TRUE;
- else {
- const char *label = e_util_labels_get_new_tag (camel_folder_get_message_user_tag (emfv->folder, uids->pdata[i], "label"));
-
- /* backward compatibility... */
- if (label && !strcmp (label, label_tag))
- exists = TRUE;
- else
- not_exists = TRUE;
- }
- }
-
- if (exists && not_exists)
- state = E_POPUP_INCONSISTENT;
- else if (exists)
- state = E_POPUP_ACTIVE;
-
- return state;
-}
-
-static void
-emfv_popup_labels_free(EPopup *ep, GSList *l, void *data)
-{
- while (l) {
- GSList *n = l->next;
- EPopupItem *item = l->data;
-
- g_free(item->path);
- g_free(item);
-
- g_slist_free_1(l);
- l = n;
- }
-}
-
-static void
-emfv_popup_items_free(EPopup *ep, GSList *items, void *data)
-{
- g_slist_free(items);
-}
-
-static void
-emfv_popup(EMFolderView *emfv, GdkEvent *event, int on_display)
-{
- GSList *menus = NULL, *l, *label_list = NULL;
- GtkMenu *menu;
- EMPopup *emp;
- EMPopupTargetSelect *target;
- int i;
-
- /** @HookPoint-EMPopup: Message List Context Menu
- * @Id: org.gnome.evolution.mail.folderview.popup.select
- * @Type: EMPopup
- * @Target: EMPopupTargetSelect
- *
- * This is the context menu shown on the message list or over a message.
- */
- emp = em_popup_new("org.gnome.evolution.mail.folderview.popup");
- target = em_folder_view_get_popup_target(emfv, emp, on_display);
-
- for (i=0;i<sizeof(emfv_popup_items)/sizeof(emfv_popup_items[0]);i++)
- menus = g_slist_prepend(menus, &emfv_popup_items[i]);
-
- e_popup_add_items((EPopup *)emp, menus, NULL, emfv_popup_items_free, emfv);
-
- i = 1;
- if (!on_display) {
- GPtrArray *uids = message_list_get_selected (emfv->list);
-
- for (l = mail_config_get_labels (); l; l = l->next) {
- EPopupItem *item;
- EUtilLabel *label = l->data;
- GdkPixmap *pixmap;
- GdkColor colour;
- GdkGC *gc;
-
- item = g_malloc0(sizeof(*item));
- item->type = E_POPUP_TOGGLE | emfv_popup_labels_get_state_for_tag (emfv, uids, label->tag);
- item->path = g_strdup_printf("60.label.00/00.label.%02d", i++);
- item->label = label->name;
- item->activate = emfv_popup_label_set;
- item->user_data = label->tag;
-
- item->visible = EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY;
-
- gdk_color_parse (label->colour, &colour);
- gdk_colormap_alloc_color(gdk_colormap_get_system(), &colour, FALSE, TRUE);
-
- pixmap = gdk_pixmap_new(((GtkWidget *)emfv)->window, 16, 16, -1);
- gc = gdk_gc_new(((GtkWidget *)emfv)->window);
- gdk_gc_set_foreground(gc, &colour);
- gdk_draw_rectangle(pixmap, gc, TRUE, 0, 0, 16, 16);
- g_object_unref(gc);
-
- item->image = gtk_image_new_from_pixmap(pixmap, NULL);
- gtk_widget_show(item->image);
-
- label_list = g_slist_prepend(label_list, item);
- }
-
- message_list_free_uids (emfv->list, uids);
- }
-
- e_popup_add_items((EPopup *)emp, label_list, NULL, emfv_popup_labels_free, emfv);
-
- menu = e_popup_create_menu_once((EPopup *)emp, (EPopupTarget *)target, 0);
-
- if (event == NULL || event->type == GDK_KEY_PRESS) {
- /* FIXME: menu pos function */
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, event ? event->key.time : gtk_get_current_event_time());
- } else {
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button.button, event->button.time);
- }
-}
-
/* ********************************************************************** */
/* Bonobo menu's */
@@ -1520,57 +337,6 @@ from(BonoboUIComponent *uid, void *data, const char *path) \
to(NULL, NULL, data); \
}
-EMFV_MAP_CALLBACK(emfv_add_sender_addressbook, emfv_popup_add_sender)
-EMFV_MAP_CALLBACK(emfv_message_apply_filters, emfv_popup_apply_filters)
-EMFV_MAP_CALLBACK(emfv_message_filter_junk, emfv_popup_filter_junk)
-EMFV_MAP_CALLBACK(emfv_message_copy, emfv_popup_copy)
-EMFV_MAP_CALLBACK(emfv_message_move, emfv_popup_move)
-EMFV_MAP_CALLBACK(emfv_message_forward, emfv_popup_forward)
-EMFV_MAP_CALLBACK(emfv_message_reply_all, emfv_popup_reply_all)
-EMFV_MAP_CALLBACK(emfv_message_reply_list, emfv_popup_reply_list)
-EMFV_MAP_CALLBACK(emfv_message_reply_sender, emfv_popup_reply_sender)
-EMFV_MAP_CALLBACK(emfv_message_mark_read, emfv_popup_mark_read)
-EMFV_MAP_CALLBACK(emfv_message_mark_unread, emfv_popup_mark_unread)
-EMFV_MAP_CALLBACK(emfv_message_mark_important, emfv_popup_mark_important)
-EMFV_MAP_CALLBACK(emfv_message_mark_unimportant, emfv_popup_mark_unimportant)
-EMFV_MAP_CALLBACK(emfv_message_mark_junk, emfv_popup_mark_junk)
-EMFV_MAP_CALLBACK(emfv_message_mark_nojunk, emfv_popup_mark_nojunk)
-EMFV_MAP_CALLBACK(emfv_message_delete, emfv_popup_delete)
-EMFV_MAP_CALLBACK(emfv_message_undelete, emfv_popup_undelete)
-EMFV_MAP_CALLBACK(emfv_message_followup_flag, emfv_popup_flag_followup)
-EMFV_MAP_CALLBACK(emfv_message_followup_clear, emfv_popup_flag_clear)
-EMFV_MAP_CALLBACK(emfv_message_followup_completed, emfv_popup_flag_completed)
-EMFV_MAP_CALLBACK(emfv_message_open, emfv_popup_open)
-EMFV_MAP_CALLBACK(emfv_message_edit, emfv_popup_edit)
-EMFV_MAP_CALLBACK(emfv_message_saveas, emfv_popup_saveas)
-EMFV_MAP_CALLBACK(emfv_print_message, emfv_popup_print)
-EMFV_MAP_CALLBACK(emfv_message_source, emfv_popup_source)
-
-static void
-emfv_empty_trash(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- em_utils_empty_trash (gtk_widget_get_toplevel ((GtkWidget *) emfv));
-}
-
-static void
-prepare_offline(void *key, void *value, void *data)
-{
- CamelService *service = key;
-
- if (CAMEL_IS_DISCO_STORE(service)
- || CAMEL_IS_OFFLINE_STORE(service)) {
- mail_store_prepare_offline((CamelStore *)service);
- }
-}
-
-static void
-emfv_prepare_offline(BonoboUIComponent *uid, void *data, const char *path)
-{
- mail_component_stores_foreach(mail_component_peek(), prepare_offline, NULL);
-}
-
static void
emfv_edit_cut(BonoboUIComponent *uid, void *data, const char *path)
{
@@ -1602,326 +368,6 @@ emfv_edit_paste(BonoboUIComponent *uid, void *data, const char *path)
}
static void
-emfv_select_all_text(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
- gboolean selected;
-
- gtk_html_select_all (((EMFormatHTML *)emfv->preview)->html);
- selected = gtk_html_command (((EMFormatHTML *)emfv->preview)->html, "is-selection-active");
- bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL);
-
-}
-
-static void
-emfv_mail_next(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- e_profile_event_emit("goto.next", "", 0);
-
- message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0);
-}
-
-static void
-emfv_mail_next_flagged(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT|MESSAGE_LIST_SELECT_WRAP, CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED);
-}
-
-static void
-emfv_mail_next_unread(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- gtk_widget_grab_focus((GtkWidget *) emfv->list);
- message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT|MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN);
-}
-
-static void
-emfv_mail_next_thread(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- message_list_select_next_thread(emfv->list);
-}
-
-static void
-emfv_mail_previous(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- message_list_select(emfv->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, 0);
-}
-
-static void
-emfv_mail_previous_flagged(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- message_list_select(emfv->list, MESSAGE_LIST_SELECT_PREVIOUS|MESSAGE_LIST_SELECT_WRAP, CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED);
-}
-
-static void
-emfv_mail_previous_unread(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- gtk_widget_grab_focus((GtkWidget *) emfv->list);
- message_list_select(emfv->list, MESSAGE_LIST_SELECT_PREVIOUS|MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN);
-}
-
-static void
-emfv_message_forward_attached (BonoboUIComponent *uic, void *data, const char *path)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids;
-
- if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv))
- return;
-
- uids = message_list_get_selected (emfv->list);
- em_utils_forward_attached (emfv->folder, uids, emfv->folder_uri);
-}
-
-static void
-emfv_message_forward_inline (BonoboUIComponent *uic, void *data, const char *path)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids;
-
- if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv))
- return;
-
- uids = message_list_get_selected (emfv->list);
- em_utils_forward_inline (emfv->folder, uids, emfv->folder_uri);
-}
-
-static void
-emfv_message_forward_quoted (BonoboUIComponent *uic, void *data, const char *path)
-{
- EMFolderView *emfv = data;
- GPtrArray *uids;
-
- if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv))
- return;
-
- uids = message_list_get_selected (emfv->list);
- em_utils_forward_quoted (emfv->folder, uids, emfv->folder_uri);
-}
-
-static void
-emfv_message_redirect (BonoboUIComponent *uic, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- if (emfv->list->cursor_uid == NULL)
- return;
-
- if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv))
- return;
-
- em_utils_redirect_message_by_uid (emfv->folder, emfv->list->cursor_uid);
-}
-
-static gboolean
-html_contains_nonwhitespace (const char *html, gint len)
-{
- const char *p;
- gunichar c = 0;
-
- if (!html || len<=0)
- return FALSE;
-
- p = html;
-
- while (p && p - html < len) {
- c = g_utf8_get_char (p);
- if (!c)
- break;
-
- if (c == '<') {
- /* skip until next '>' */
- while (c = g_utf8_get_char (p), c && c != '>' && p - html < len)
- p = g_utf8_next_char (p);
- if (!c)
- break;
- }else if (c == '&') {
- /* sequence '&nbsp;' is a space */
- if (g_ascii_strncasecmp (p, "&nbsp;", 6) == 0)
- p = p + 5;
- else
- break;
- }else if (!g_unichar_isspace (c)) {
- break;
- }
-
- p = g_utf8_next_char (p);
- }
-
- return p - html < len - 1 && c != 0;
-}
-
-static void
-emfv_message_reply(EMFolderView *emfv, int mode)
-{
- char *html = NULL;
- gint len;
-
- if (emfv->list->cursor_uid == NULL)
- return;
-
- if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv))
- return;
-
- if (gtk_html_command(((EMFormatHTML *)emfv->preview)->html, "is-selection-active")
- && (html = gtk_html_get_selection_html (((EMFormatHTML *)emfv->preview)->html, &len))
- && len && html[0] && html_contains_nonwhitespace (html, len)) {
- CamelMimeMessage *msg, *src;
- struct _camel_header_raw *header;
-
- src = (CamelMimeMessage *)((EMFormat *)emfv->preview)->message;
- msg = camel_mime_message_new();
-
- /* need to strip content- headers */
- header = ((CamelMimePart *)src)->headers;
- while (header) {
- if (g_ascii_strncasecmp(header->name, "content-", 8) != 0)
- camel_medium_add_header((CamelMedium *)msg, header->name, header->value);
- header = header->next;
- }
- camel_mime_part_set_encoding((CamelMimePart *)msg, CAMEL_TRANSFER_ENCODING_8BIT);
- camel_mime_part_set_content((CamelMimePart *)msg,
- html, len, "text/html");
- em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, msg, mode, NULL);
- camel_object_unref(msg);
- } else {
- em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, NULL, mode, (EMFormat *)emfv->preview);
- }
-
- g_free (html);
-}
-
-static void
-emfv_message_search(BonoboUIComponent *uic, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- em_folder_view_show_search_bar (emfv);
-}
-
-static void
-emfv_print_preview_message(BonoboUIComponent *uic, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- em_folder_view_print(emfv, GTK_PRINT_OPERATION_ACTION_PREVIEW);
-}
-
-static void
-emfv_text_zoom_in(BonoboUIComponent *uic, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- if (emfv->preview)
- em_format_html_display_zoom_in(emfv->preview);
-}
-
-static void
-emfv_text_zoom_out(BonoboUIComponent *uic, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- if (emfv->preview)
- em_format_html_display_zoom_out(emfv->preview);
-}
-
-static void
-emfv_text_zoom_reset(BonoboUIComponent *uic, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- if (emfv->preview)
- em_format_html_display_zoom_reset(emfv->preview);
-}
-
-/* ********************************************************************** */
-
-struct _filter_data {
- const char *source;
- char *uri;
- int type;
-};
-
-static void
-filter_data_free (struct _filter_data *fdata)
-{
- g_free (fdata->uri);
- g_free (fdata);
-}
-
-static void
-filter_type_got_message (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *user_data)
-{
- struct _filter_data *data = user_data;
-
- if (msg)
- filter_gui_add_from_message (msg, data->source, data->type);
-
- filter_data_free (data);
-}
-
-static void
-filter_type_uid (CamelFolder *folder, const char *uid, const char *source, int type)
-{
- struct _filter_data *data;
-
- data = g_malloc0 (sizeof (*data));
- data->type = type;
- data->source = source;
-
- mail_get_message (folder, uid, filter_type_got_message, data, mail_msg_unordered_push);
-}
-
-static void
-filter_type_current (EMFolderView *emfv, int type)
-{
- const char *source;
- GPtrArray *uids;
-
- if (em_utils_folder_is_sent (emfv->folder, emfv->folder_uri)
- || em_utils_folder_is_outbox (emfv->folder, emfv->folder_uri))
- source = FILTER_SOURCE_OUTGOING;
- else
- source = FILTER_SOURCE_INCOMING;
-
- uids = message_list_get_selected (emfv->list);
-
- if (uids->len == 1)
- filter_type_uid (emfv->folder, (char *) uids->pdata[0], source, type);
-
- em_utils_uids_free (uids);
-}
-
-EMFV_MAP_CALLBACK(emfv_tools_filter_subject, emfv_popup_filter_subject)
-EMFV_MAP_CALLBACK(emfv_tools_filter_sender, emfv_popup_filter_sender)
-EMFV_MAP_CALLBACK(emfv_tools_filter_recipient, emfv_popup_filter_recipients)
-EMFV_MAP_CALLBACK(emfv_tools_filter_mlist, emfv_popup_filter_mlist)
-
-static void
-vfolder_type_got_message (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *user_data)
-{
- struct _filter_data *data = user_data;
-
- if (msg)
- vfolder_gui_add_from_message (msg, data->type, data->uri);
-
- filter_data_free (data);
-}
-
-static void
emp_uri_popup_vfolder_sender(EPopup *ep, EPopupItem *pitem, void *data)
{
EMFolderView *emfv = data;
@@ -1977,272 +423,28 @@ emp_uri_popup_vfolder_recipient(EPopup *ep, EPopupItem *pitem, void *data)
camel_url_free(url);
}
-static void
-vfolder_type_uid (CamelFolder *folder, const char *uid, const char *uri, int type)
-{
- struct _filter_data *data;
-
- data = g_malloc0 (sizeof (*data));
- data->type = type;
- data->uri = g_strdup (uri);
-
- mail_get_message (folder, uid, vfolder_type_got_message, data, mail_msg_unordered_push);
-}
-
-static void
-vfolder_type_current (EMFolderView *emfv, int type)
-{
- GPtrArray *uids;
-
- uids = message_list_get_selected (emfv->list);
-
- if (uids->len == 1) {
- /* ensures vfolder is running */
- vfolder_load_storage ();
-
- vfolder_type_uid (emfv->folder, (char *) uids->pdata[0], emfv->folder_uri, type);
- }
-
- em_utils_uids_free (uids);
-}
-
-EMFV_MAP_CALLBACK(emfv_tools_vfolder_subject, emfv_popup_vfolder_subject)
-EMFV_MAP_CALLBACK(emfv_tools_vfolder_sender, emfv_popup_vfolder_sender)
-EMFV_MAP_CALLBACK(emfv_tools_vfolder_recipient, emfv_popup_vfolder_recipients)
-EMFV_MAP_CALLBACK(emfv_tools_vfolder_mlist, emfv_popup_vfolder_mlist)
-
/* ********************************************************************** */
static BonoboUIVerb emfv_message_verbs[] = {
- BONOBO_UI_UNSAFE_VERB ("EmptyTrash", emfv_empty_trash),
- BONOBO_UI_UNSAFE_VERB ("PrepareForOffline", emfv_prepare_offline),
BONOBO_UI_UNSAFE_VERB ("EditCut", emfv_edit_cut),
BONOBO_UI_UNSAFE_VERB ("EditCopy", emfv_edit_copy),
BONOBO_UI_UNSAFE_VERB ("EditPaste", emfv_edit_paste),
- BONOBO_UI_UNSAFE_VERB ("SelectAllText", emfv_select_all_text),
-
- BONOBO_UI_UNSAFE_VERB ("MailNext", emfv_mail_next),
- BONOBO_UI_UNSAFE_VERB ("MailNextFlagged", emfv_mail_next_flagged),
- BONOBO_UI_UNSAFE_VERB ("MailNextUnread", emfv_mail_next_unread),
- BONOBO_UI_UNSAFE_VERB ("MailNextThread", emfv_mail_next_thread),
- BONOBO_UI_UNSAFE_VERB ("MailPrevious", emfv_mail_previous),
- BONOBO_UI_UNSAFE_VERB ("MailPreviousFlagged", emfv_mail_previous_flagged),
- BONOBO_UI_UNSAFE_VERB ("MailPreviousUnread", emfv_mail_previous_unread),
-
- BONOBO_UI_UNSAFE_VERB ("AddSenderToAddressbook", emfv_add_sender_addressbook),
-
- BONOBO_UI_UNSAFE_VERB ("MessageApplyFilters", emfv_message_apply_filters),
- BONOBO_UI_UNSAFE_VERB ("MessageFilterJunk", emfv_message_filter_junk),
- BONOBO_UI_UNSAFE_VERB ("MessageCopy", emfv_message_copy),
- BONOBO_UI_UNSAFE_VERB ("MessageDelete", emfv_message_delete),
- BONOBO_UI_UNSAFE_VERB ("MessageDeleteKey", emfv_message_delete),
- BONOBO_UI_UNSAFE_VERB ("MessageForward", emfv_message_forward),
- BONOBO_UI_UNSAFE_VERB ("MessageForwardAttached", emfv_message_forward_attached),
- BONOBO_UI_UNSAFE_VERB ("MessageForwardInline", emfv_message_forward_inline),
- BONOBO_UI_UNSAFE_VERB ("MessageForwardQuoted", emfv_message_forward_quoted),
- BONOBO_UI_UNSAFE_VERB ("MessageRedirect", emfv_message_redirect),
- BONOBO_UI_UNSAFE_VERB ("MessageMarkAsRead", emfv_message_mark_read),
- BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnRead", emfv_message_mark_unread),
- BONOBO_UI_UNSAFE_VERB ("MessageMarkAsImportant", emfv_message_mark_important),
- BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnimportant", emfv_message_mark_unimportant),
- BONOBO_UI_UNSAFE_VERB ("MessageMarkAsJunk", emfv_message_mark_junk),
- BONOBO_UI_UNSAFE_VERB ("MessageMarkAsNotJunk", emfv_message_mark_nojunk),
- BONOBO_UI_UNSAFE_VERB ("MessageFollowUpFlag", emfv_message_followup_flag),
- BONOBO_UI_UNSAFE_VERB ("MessageFollowUpComplete", emfv_message_followup_completed),
- BONOBO_UI_UNSAFE_VERB ("MessageFollowUpClear", emfv_message_followup_clear),
- BONOBO_UI_UNSAFE_VERB ("MessageMove", emfv_message_move),
- BONOBO_UI_UNSAFE_VERB ("MessageOpen", emfv_message_open),
- BONOBO_UI_UNSAFE_VERB ("MessageReplyAll", emfv_message_reply_all),
- BONOBO_UI_UNSAFE_VERB ("MessageReplyList", emfv_message_reply_list),
- BONOBO_UI_UNSAFE_VERB ("MessageReplySender", emfv_message_reply_sender),
- BONOBO_UI_UNSAFE_VERB ("MessageEdit", emfv_message_edit),
- BONOBO_UI_UNSAFE_VERB ("MessageSaveAs", emfv_message_saveas),
- BONOBO_UI_UNSAFE_VERB ("MessageSearch", emfv_message_search),
- BONOBO_UI_UNSAFE_VERB ("MessageUndelete", emfv_message_undelete),
-
- BONOBO_UI_UNSAFE_VERB ("PrintMessage", emfv_print_message),
- BONOBO_UI_UNSAFE_VERB ("PrintPreviewMessage", emfv_print_preview_message),
-
- BONOBO_UI_UNSAFE_VERB ("TextZoomIn", emfv_text_zoom_in),
- BONOBO_UI_UNSAFE_VERB ("TextZoomOut", emfv_text_zoom_out),
- BONOBO_UI_UNSAFE_VERB ("TextZoomReset", emfv_text_zoom_reset),
-
- BONOBO_UI_UNSAFE_VERB ("ViewSource", emfv_message_source),
-
- BONOBO_UI_UNSAFE_VERB ("MailCompose", emfv_mail_compose),
-
- /* TODO: This stuff should just be 1 item that runs a wizard */
- BONOBO_UI_UNSAFE_VERB ("ToolsFilterMailingList", emfv_tools_filter_mlist),
- BONOBO_UI_UNSAFE_VERB ("ToolsFilterRecipient", emfv_tools_filter_recipient),
- BONOBO_UI_UNSAFE_VERB ("ToolsFilterSender", emfv_tools_filter_sender),
- BONOBO_UI_UNSAFE_VERB ("ToolsFilterSubject", emfv_tools_filter_subject),
- BONOBO_UI_UNSAFE_VERB ("ToolsVFolderMailingList", emfv_tools_vfolder_mlist),
- BONOBO_UI_UNSAFE_VERB ("ToolsVFolderRecipient", emfv_tools_vfolder_recipient),
- BONOBO_UI_UNSAFE_VERB ("ToolsVFolderSender", emfv_tools_vfolder_sender),
- BONOBO_UI_UNSAFE_VERB ("ToolsVFolderSubject", emfv_tools_vfolder_subject),
-
- BONOBO_UI_UNSAFE_VERB ("ViewLoadImages", emfv_view_load_images),
- /* ViewHeaders stuff is a radio */
- /* CaretMode is a toggle */
+// BONOBO_UI_UNSAFE_VERB ("SelectAllText", emfv_select_all_text),
- BONOBO_UI_VERB_END
-};
-static EPixmap emfv_message_pixmaps[] = {
-
- E_PIXMAP ("/commands/EditCopy", "edit-copy", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/EditCut", "edit-cut", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/EditPaste", "edit-paste", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MailCompose", "mail-message-new", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageApplyFilters", "stock_mail-filters-apply", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageCopy", "mail-copy", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageDelete", "user-trash", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageFilterJunk", "mail-mark-junk", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageFollowUpFlag", "stock_mail-flag-for-followup", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageForward", "mail-forward", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageMarkAsImportant", "mail-mark-important", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageMarkAsJunk", "mail-mark-junk", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageMarkAsNotJunk", "mail-mark-notjunk", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageMarkAsRead", "mail-mark-read", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageMarkAsUnRead", "mail-mark-unread", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageMove", "mail-move", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageReplyAll", "mail-reply-all", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageReplySender", "mail-reply-sender", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageSaveAs", "document-save-as", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/MessageSearch", "edit-find", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/PrintMessage", "document-print", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/PrintPreviewMessage", "document-print-preview", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/TextZoomIn", "zoom-in", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/TextZoomOut", "zoom-out", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/TextZoomReset", "zoom-original", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ViewLoadImages", "image-x-generic", GTK_ICON_SIZE_MENU),
-
- E_PIXMAP ("/menu/MessagePlaceholder/Message/MessageNavigation/GoTo", "go-jump", GTK_ICON_SIZE_MENU),
-
- E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageReplySender", "mail-reply-sender", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageReplyAll", "mail-reply-all", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageForward", "mail-forward", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/MailMessageToolbar/PrintMessage", "document-print", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageMove", "mail-move", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageCopy", "mail-copy", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageDelete", "edit-delete", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageMarkAsJunk", "mail-mark-junk", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageMarkAsNotJunk", "mail-mark-notjunk", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/MailNextButtons/MailNext", "go-next", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/MailNextButtons/MailPrevious", "go-previous", GTK_ICON_SIZE_LARGE_TOOLBAR),
-
- E_PIXMAP_END
-};
-
-
-static void
-emfv_enable_menus(EMFolderView *emfv)
-{
- guint32 disable_mask;
- GString *name;
- GSList *l;
+// BONOBO_UI_UNSAFE_VERB ("MessageDelete", emfv_message_delete),
+// BONOBO_UI_UNSAFE_VERB ("MessageDeleteKey", emfv_message_delete),
+// BONOBO_UI_UNSAFE_VERB ("MessageOpen", emfv_message_open),
+// BONOBO_UI_UNSAFE_VERB ("MessageSearch", emfv_message_search),
- if (emfv->uic == NULL)
- return;
-
- {
- if (emfv->menu && emfv->folder) {
- EMMenuTargetSelect *t;
-
- t = em_menu_target_new_select(emfv->menu, emfv->folder, emfv->folder_uri, message_list_get_selected(emfv->list));
- t->target.widget = GTK_WIDGET (emfv);
- e_menu_update_target((EMenu *)emfv->menu, t);
- }
- }
-
- if (emfv->folder) {
- EMPopup *emp = em_popup_new("dummy");
- EMPopupTargetSelect *t;
-
- t = em_folder_view_get_popup_target(emfv, emp, FALSE);
- disable_mask = t->target.mask;
- e_popup_target_free((EPopup *)emp, t);
- g_object_unref(emp);
- } else {
- disable_mask = ~0;
- }
-
- name = g_string_new("");
- for (l = emfv->enable_map; l; l = l->next) {
- EMFolderViewEnable *map = l->data;
- int i;
-
- for (i=0;map[i].name;i++) {
- int state = (map[i].mask & disable_mask) == 0;
-
- g_string_printf(name, "/commands/%s", map[i].name);
- bonobo_ui_component_set_prop(emfv->uic, name->str, "sensitive", state?"1":"0", NULL);
- }
- }
-
- g_string_free(name, TRUE);
-}
-
-static void
-emfv_view_mode(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- EMFolderView *emfv = data;
- int i;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- /* TODO: I don't like this stuff much, is there any way we can move listening for such events
- elsehwere? Probably not I guess, unless there's a EMFolderViewContainer for bonobo usage
- of a folder view */
-
- i = state[0] != '0';
-
- em_format_set_mode((EMFormat *)emfv->preview, i);
-
- if (EM_FOLDER_VIEW_GET_CLASS (emfv)->update_message_style) {
- GConfClient *gconf = mail_config_get_gconf_client ();
-
- gconf_client_set_int (gconf, "/apps/evolution/mail/display/message_style", i, NULL);
- }
-}
-
-static void
-emfv_caret_mode(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- EMFolderView *emfv = data;
+// BONOBO_UI_UNSAFE_VERB ("ViewSource", emfv_message_source),
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- em_format_html_display_set_caret_mode(emfv->preview, state[0] != '0');
-
- gconf_client_set_bool(mail_config_get_gconf_client(), "/apps/evolution/mail/display/caret_mode", state[0] != '0', NULL);
-}
-
-static void
-emfv_charset_changed(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
-{
- EMFolderView *emfv = data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- /* menu items begin with "Charset-" = 8 characters */
- if (state[0] != '0' && strlen(path) > 8) {
- path += 8;
- /* default charset used in mail view */
- if (!strcmp(path, _("Default")))
- path = NULL;
-
- em_format_set_charset((EMFormat *)emfv->preview, path);
- }
-}
+ BONOBO_UI_VERB_END
+};
static void
emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
{
- struct _EMFolderViewPrivate *p = emfv->priv;
if (act) {
em_format_mode_t style;
@@ -2255,27 +457,25 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
bonobo_ui_util_set_ui(uic, PREFIX, (char *)l->data, emfv->ui_app_name, NULL);
bonobo_ui_component_add_verb_list_with_data(uic, emfv_message_verbs, emfv);
- e_pixmaps_update(uic, emfv_message_pixmaps);
-
/* must do plugin menu's after main ones because of bonobo bustedness */
if (emfv->menu)
e_menu_activate((EMenu *)emfv->menu, uic, act);
- state = emfv->preview->caret_mode;
- bonobo_ui_component_set_prop(uic, "/commands/CaretMode", "state", state?"1":"0", NULL);
- bonobo_ui_component_add_listener(uic, "CaretMode", emfv_caret_mode, emfv);
+// state = emfv->preview->caret_mode;
+// bonobo_ui_component_set_prop(uic, "/commands/CaretMode", "state", state?"1":"0", NULL);
+// bonobo_ui_component_add_listener(uic, "CaretMode", emfv_caret_mode, emfv);
- style = ((EMFormat *)emfv->preview)->mode?EM_FORMAT_ALLHEADERS:EM_FORMAT_NORMAL;
- if (style)
- bonobo_ui_component_set_prop(uic, "/commands/ViewFullHeaders", "state", "1", NULL);
- bonobo_ui_component_add_listener(uic, "ViewFullHeaders", emfv_view_mode, emfv);
- em_format_set_mode((EMFormat *)emfv->preview, style);
+// style = ((EMFormat *)emfv->preview)->mode?EM_FORMAT_ALLHEADERS:EM_FORMAT_NORMAL;
+// if (style)
+// bonobo_ui_component_set_prop(uic, "/commands/ViewFullHeaders", "state", "1", NULL);
+// bonobo_ui_component_add_listener(uic, "ViewFullHeaders", emfv_view_mode, emfv);
+// em_format_set_mode((EMFormat *)emfv->preview, style);
if (emfv->folder)
bonobo_ui_component_set_prop(uic, "/commands/MessageEdit", "sensitive", "0", NULL);
- /* default charset used in mail view */
- e_charset_picker_bonobo_ui_populate (uic, "/menu/View", _("Default"), emfv_charset_changed, emfv);
+// /* default charset used in mail view */
+// e_charset_picker_bonobo_ui_populate (uic, "/menu/View", _("Default"), emfv_charset_changed, emfv);
emfv_enable_menus(emfv);
if (emfv->statusbar_active)
@@ -2294,16 +494,6 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
for (v = &emfv_message_verbs[0]; v->cname; v++)
bonobo_ui_component_remove_verb(uic, v->cname);
- if (p->view_instance) {
- g_object_unref(p->view_instance);
- p->view_instance = NULL;
- }
-
- if (p->view_menus) {
- g_object_unref(p->view_menus);
- p->view_menus = NULL;
- }
-
if (emfv->folder)
mail_sync_folder(emfv->folder, NULL, NULL);
@@ -2311,37 +501,6 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
}
}
-int
-em_folder_view_print (EMFolderView *emfv, GtkPrintOperationAction action)
-{
- EMFormatHTMLPrint *efhp;
- GPtrArray *uids;
-
- if (emfv->folder == NULL)
- return 0;
-
- uids = message_list_get_selected (emfv->list);
- if (uids->len != 1)
- goto exit;
-
- efhp = em_format_html_print_new (
- (EMFormatHTML *) emfv->preview, action);
- em_format_set_session (
- (EMFormat *) efhp,
- ((EMFormat *) emfv->preview)->session);
- em_format_merge_handler ((EMFormat *) efhp,
- (EMFormat *) emfv->preview);
-
- em_format_html_print_message (
- efhp, emfv->folder, uids->pdata[0]);
- g_object_unref (efhp);
-
-exit:
- message_list_free_uids (emfv->list, uids);
-
- return 0;
-}
-
EMPopupTargetSelect *
em_folder_view_get_popup_target(EMFolderView *emfv, EMPopup *emp, int on_display)
{
@@ -2384,18 +543,6 @@ em_folder_view_get_popup_target(EMFolderView *emfv, EMPopup *emp, int on_display
}
void
-em_folder_view_set_statusbar (EMFolderView *emfv, gboolean statusbar)
-{
- g_return_if_fail (emfv);
-
- emfv->statusbar_active = statusbar;
-
- if (statusbar && emfv->uic)
- bonobo_ui_component_set_translate (emfv->uic, "/",
- "<status><item name=\"main\"/></status>", NULL);
-}
-
-void
em_folder_view_set_hide_deleted(EMFolderView *emfv, gboolean status)
{
if (emfv->folder && (emfv->folder->folder_flags & CAMEL_FOLDER_IS_TRASH))
@@ -2444,6 +591,7 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM
EMFolderView *emfv = data;
EMEvent *eme;
EMEventTargetMessage *target;
+ EShell *shell;
if (emfv->preview == NULL) {
emfv->priv->nomarkseen = FALSE;
@@ -2455,7 +603,8 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM
e_profile_event_emit("goto.loaded", emfv->displayed_uid, 0);
- mail_indicate_new_mail (FALSE);
+ shell = e_shell_backend_get_shell (mail_shell_backend);
+ e_shell_event (shell, "mail-icon", "evolution-mail");
/** @Event: message.reading
* @Title: Viewing a message
@@ -2575,100 +724,6 @@ emfv_message_selected_timeout(void *data)
return FALSE;
}
-static void
-emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv)
-{
- e_profile_event_emit("goto.listuid", uid, 0);
-
- if (emfv->preview_active) {
- if (emfv->priv->selected_id != 0)
- g_source_remove(emfv->priv->selected_id);
-
- emfv->priv->selected_id = g_timeout_add(100, emfv_message_selected_timeout, emfv);
-
- g_free(emfv->priv->selected_uid);
- emfv->priv->selected_uid = g_strdup(uid);
- }
-
- emfv_enable_menus(emfv);
-
- g_signal_emit(emfv, signals[EMFV_CHANGED], 0);
-}
-
-static void
-emfv_list_built(MessageList *ml, EMFolderView *emfv)
-{
- if (!emfv->priv->destroyed) {
- emfv_enable_menus(emfv);
- g_signal_emit(emfv, signals[EMFV_LOADED], 0);
- }
-}
-
-static void
-emfv_list_double_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv)
-{
- /* Ignore double-clicks on columns that handle thier own state */
- if (MESSAGE_LIST_COLUMN_IS_ACTIVE (col))
- return;
-
- em_folder_view_open_selected(emfv);
-}
-
-static int
-emfv_list_right_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv)
-{
- emfv_popup(emfv, event, FALSE);
-
- return TRUE;
-}
-
-static int
-emfv_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderView *emfv)
-{
- GPtrArray *uids;
- int i;
- guint32 flags;
-
- if ((ev->key.state & GDK_CONTROL_MASK) != 0)
- return FALSE;
-
- switch (ev->key.keyval) {
- case GDK_Return:
- case GDK_KP_Enter:
- case GDK_ISO_Enter:
- em_folder_view_open_selected(emfv);
- break;
-#ifdef HAVE_XFREE
- case XF86XK_Reply:
- emfv_message_reply(emfv, REPLY_MODE_ALL);
- break;
- case XF86XK_MailForward:
- uids = message_list_get_selected(emfv->list);
- em_utils_forward_messages (emfv->folder, uids, emfv->folder_uri);
- break;
-#endif /* HAVE_XFREE */
- case '!':
- uids = message_list_get_selected(emfv->list);
-
- camel_folder_freeze(emfv->folder);
- for (i = 0; i < uids->len; i++) {
- flags = camel_folder_get_message_flags(emfv->folder, uids->pdata[i]) ^ CAMEL_MESSAGE_FLAGGED;
- if (flags & CAMEL_MESSAGE_FLAGGED)
- flags &= ~CAMEL_MESSAGE_DELETED;
- camel_folder_set_message_flags(emfv->folder, uids->pdata[i],
- CAMEL_MESSAGE_FLAGGED|CAMEL_MESSAGE_DELETED, flags);
- }
- camel_folder_thaw(emfv->folder);
-
- message_list_free_uids(emfv->list, uids);
- break;
- default:
- return FALSE;
- }
-
- return TRUE;
-}
-
static gboolean
emfv_popup_menu (GtkWidget *widget)
{
@@ -2690,41 +745,13 @@ emfv_popup_menu (GtkWidget *widget)
}
static void
-emfv_list_selection_change(ETree *tree, EMFolderView *emfv)
-{
- /* we can't just listen to the message-list message selected thing, since we dont get them
- in all cases. blah */
- g_signal_emit(emfv, signals[EMFV_CHANGED], 0);
-}
-
-static void
-emfv_format_link_clicked(EMFormatHTMLDisplay *efhd, const char *uri, EMFolderView *emfv)
-{
- if (!strncmp (uri, "##", 2))
- return;
-
- if (!g_ascii_strncasecmp (uri, "mailto:", 7)) {
- em_utils_compose_new_message_with_mailto (uri, emfv->folder_uri);
- } else if (*uri == '#') {
- gtk_html_jump_to_anchor (((EMFormatHTML *) efhd)->html, uri + 1);
- } else if (!g_ascii_strncasecmp (uri, "thismessage:", 12)) {
- /* ignore */
- } else if (!g_ascii_strncasecmp (uri, "cid:", 4)) {
- /* ignore */
- } else {
- /* FIXME Pass a parent window. */
- e_show_uri (NULL, uri);
- }
-}
-
-static void
emp_uri_popup_link_copy(EPopup *ep, EPopupItem *pitem, void *data)
{
EMFolderView *emfv = data;
struct _EMFolderViewPrivate *p = emfv->priv;
g_free(p->selection_uri);
- p->selection_uri = g_strdup(pitem->user_data);
+ p->selection_uri = em_utils_url_unescape_amp(pitem->user_data);
gtk_selection_owner_set(p->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time());
@@ -2954,43 +981,17 @@ emfv_set_seen(EMFolderView *emfv, const char *uid)
/* keep these two tables in sync */
enum {
- EMFV_ANIMATE_IMAGES = 1,
- EMFV_CHARSET,
- EMFV_CITATION_COLOUR,
- EMFV_CITATION_MARK,
- EMFV_CARET_MODE,
- EMFV_MESSAGE_STYLE,
- EMFV_MARK_SEEN,
- EMFV_MARK_SEEN_TIMEOUT,
- EMFV_LOAD_HTTP,
+ EMFV_CHARSET = 1,
EMFV_HEADERS,
- EMFV_SHOW_PREVIEW,
EMFV_SHOW_DELETED,
- EMFV_THREAD_LIST,
- EMFV_PANED_SIZE,
- EMFV_SENDER_PHOTO,
- EMFV_PHOTO_LOCAL,
EMFV_SETTINGS /* last, for loop count */
};
/* IF these get too long, update key field */
static const char * const emfv_display_keys[] = {
- "animate_images",
"charset",
- "citation_colour",
- "mark_citations",
- "caret_mode",
- "message_style",
- "mark_seen",
- "mark_seen_timeout",
- "load_http_images",
"headers",
- "show_preview",
"show_deleted",
- "thread_list",
- "paned_size",
- "sender_photo",
- "photo_local",
};
static GHashTable *emfv_setting_key;
@@ -3010,49 +1011,9 @@ emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFold
g_return_if_fail (tkey != NULL);
switch(GPOINTER_TO_INT(g_hash_table_lookup(emfv_setting_key, tkey+1))) {
- case EMFV_ANIMATE_IMAGES:
- em_format_html_display_set_animate(emfv->preview, gconf_value_get_bool (value));
- break;
case EMFV_CHARSET:
em_format_set_default_charset((EMFormat *)emfv->preview, gconf_value_get_string (value));
break;
- case EMFV_CITATION_COLOUR: {
- const char *s;
- GdkColor colour;
- guint32 rgb;
-
- s = gconf_value_get_string (value);
- gdk_color_parse(s?s:"#737373", &colour);
- rgb = ((colour.red & 0xff00) << 8) | (colour.green & 0xff00) | ((colour.blue & 0xff00) >> 8);
- em_format_html_set_mark_citations((EMFormatHTML *)emfv->preview,
- ((EMFormatHTML *)emfv->preview)->mark_citations, rgb);
- break; }
- case EMFV_CITATION_MARK:
- em_format_html_set_mark_citations((EMFormatHTML *)emfv->preview,
- gconf_value_get_bool (value),
- ((EMFormatHTML *)emfv->preview)->citation_colour);
- break;
- case EMFV_CARET_MODE:
- em_format_html_display_set_caret_mode(emfv->preview, gconf_value_get_bool (value));
- break;
- case EMFV_MESSAGE_STYLE:
- if (EM_FOLDER_VIEW_GET_CLASS (emfv)->update_message_style) {
- int style = gconf_value_get_int (value);
-
- if (style < EM_FORMAT_NORMAL || style > EM_FORMAT_SOURCE)
- style = EM_FORMAT_NORMAL;
- em_format_set_mode((EMFormat *)emfv->preview, style);
- }
- break;
- case EMFV_MARK_SEEN:
- emfv->mark_seen = gconf_value_get_bool (value);
- break;
- case EMFV_MARK_SEEN_TIMEOUT:
- emfv->mark_seen_timeout = gconf_value_get_int (value);
- break;
- case EMFV_LOAD_HTTP:
- em_format_html_set_load_http((EMFormatHTML *)emfv->preview, gconf_value_get_int(value));
- break;
case EMFV_HEADERS: {
GSList *header_config_list, *p;
EMFormat *emf = (EMFormat *)emfv->preview;
@@ -3077,45 +1038,6 @@ emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFold
if (emf->message)
em_format_redraw(emf);
break; }
- case EMFV_SENDER_PHOTO: {
- EMFormat *emf = (EMFormat *)emfv->preview;
-
- emf->show_photo = gconf_value_get_bool (value);
- if (emf->message)
- em_format_redraw(emf);
-
- break; }
- case EMFV_PHOTO_LOCAL: {
- EMFormat *emf = (EMFormat *)emfv->preview;
-
- emf->photo_local = gconf_value_get_bool (value);
-
- break; }
- case EMFV_SHOW_PREVIEW: {
- gboolean state_gconf, state_camel;
- char *ret;
-
- /* If emfv->folder hasn't been initialized, do nothing */
- if (!emfv->folder)
- return;
-
- state_gconf = gconf_value_get_bool (value);
- if (state_gconf == FALSE)
- emfv_enable_menus (emfv);
-
- if ((ret = camel_object_meta_get (emfv->folder, "evolution:show_preview"))) {
- state_camel = (ret[0] != '0');
- g_free (ret);
- if (state_gconf == state_camel)
- return;
- }
-
- if (camel_object_meta_set (emfv->folder, "evolution:show_preview", state_gconf ? "1" : "0"))
- camel_object_state_write (emfv->folder);
- if (emfv->list_active)
- em_folder_browser_show_preview ((EMFolderBrowser *)emfv, state_gconf);
- bonobo_ui_component_set_prop (emfv->uic, "/commands/ViewPreview", "state", state_gconf ? "1" : "0", NULL);
- break; }
case EMFV_SHOW_DELETED: {
gboolean state;
@@ -3126,155 +1048,5 @@ emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFold
if (emfv->uic)
bonobo_ui_component_set_prop (emfv->uic, "/commands/HideDeleted", "state", state ? "0" : "1", NULL);
break; }
- case EMFV_THREAD_LIST: {
- gboolean state_gconf, state_camel;
- char *ret;
-
- /* If emfv->folder or emfv->list hasn't been initialized, do nothing */
- if (!emfv->folder || !emfv->list)
- return;
-
- state_gconf = gconf_value_get_bool (value);
- if ((ret = camel_object_meta_get (emfv->folder, "evolution:thread_list"))) {
- state_camel = (ret[0] != '0');
- g_free (ret);
- if (state_gconf == state_camel)
- return;
- }
-
- if (camel_object_meta_set (emfv->folder, "evolution:thread_list", state_gconf ? "1" : "0"))
- camel_object_state_write (emfv->folder);
- message_list_set_threaded (emfv->list, state_gconf);
- bonobo_ui_component_set_prop (emfv->uic, "/commands/ViewThreaded", "state", state_gconf ? "1" : "0", NULL);
- break; }
- case EMFV_PANED_SIZE: {
- EMFolderBrowser *emfb = (EMFolderBrowser *)emfv;
- int paned_size;
-
- if (!emfv->list_active || !emfb->vpane || !emfv->preview_active)
- return;
-
- paned_size = gconf_value_get_int (value);
- if (paned_size == gtk_paned_get_position (GTK_PANED (emfb->vpane)))
- return;
-
- gtk_paned_set_position (GTK_PANED (emfb->vpane), paned_size);
- break; }
- }
-}
-
-static void
-emfv_setting_setup(EMFolderView *emfv)
-{
- GConfClient *gconf = gconf_client_get_default();
- GConfEntry *entry;
- GError *err = NULL;
- int i;
- char key[64];
-
- if (emfv_setting_key == NULL) {
- emfv_setting_key = g_hash_table_new(g_str_hash, g_str_equal);
- for (i=1;i<EMFV_SETTINGS;i++)
- g_hash_table_insert(emfv_setting_key, (void *)emfv_display_keys[i-1], GINT_TO_POINTER(i));
- }
-
- gconf_client_add_dir(gconf, "/apps/evolution/mail/display", GCONF_CLIENT_PRELOAD_NONE, NULL);
-
- for (i=1;err == NULL && i<EMFV_SETTINGS;i++) {
- sprintf(key, "/apps/evolution/mail/display/%s", emfv_display_keys[i-1]);
- entry = gconf_client_get_entry(gconf, key, NULL, TRUE, &err);
- if (entry) {
- emfv_setting_notify(gconf, 0, entry, emfv);
- gconf_entry_free(entry);
- }
- }
-
- if (err) {
- g_warning("Could not load display settings: %s", err->message);
- g_error_free(err);
- }
-
- emfv->priv->setting_notify_id = gconf_client_notify_add(gconf, "/apps/evolution/mail/display",
- (GConfClientNotifyFunc)emfv_setting_notify,
- emfv, NULL, NULL);
- g_object_unref(gconf);
-}
-
-static void
-emfv_on_url (EMFolderView *emfv, const char *uri, const char *nice_uri)
-{
- if (emfv->statusbar_active) {
- if (emfv->uic) {
- bonobo_ui_component_set_status (emfv->uic, nice_uri, NULL);
- /* Make sure the node keeps existing if nice_url == NULL */
- if (!nice_uri)
- bonobo_ui_component_set_translate (
- emfv->uic, "/", "<status><item name=\"main\"/></status>", NULL);
- }
- }
-}
-
-static void
-emfv_on_url_cb (GObject *emitter, const char *url, EMFolderView *emfv)
-{
- char *nice_url = NULL;
-
- if (url) {
- if (strncmp (url, "mailto:", 7) == 0) {
- CamelInternetAddress *cia = camel_internet_address_new();
- CamelURL *curl;
- char *addr;
-
- curl = camel_url_new(url, NULL);
- camel_address_decode((CamelAddress *)cia, curl->path);
- addr = camel_address_format((CamelAddress *)cia);
- nice_url = g_strdup_printf (_("Click to mail %s"), addr&&addr[0]?addr:(url + 7));
- g_free(addr);
- camel_url_free(curl);
- camel_object_unref(cia);
- } else if (strncmp (url, "callto:", 7) == 0 || strncmp (url, "h323:", 5) == 0 || strncmp (url, "sip:", 4) == 0) {
- CamelInternetAddress *cia = camel_internet_address_new();
- CamelURL *curl;
- char *addr;
-
- curl = camel_url_new(url, NULL);
- camel_address_decode((CamelAddress *)cia, curl->path);
- addr = camel_address_format((CamelAddress *)cia);
- nice_url = g_strdup_printf (_("Click to call %s"), addr&&addr[0]?addr:(url + 7));
- g_free(addr);
- camel_url_free(curl);
- camel_object_unref(cia);
- } else if (!strncmp (url, "##", 2)) {
- nice_url = g_strdup (_("Click to hide/unhide addresses"));
- } else
- nice_url = g_strdup_printf (_("Click to open %s"), url);
}
-
- g_signal_emit (emfv, signals[EMFV_ON_URL], 0, url, nice_url);
-
- g_free (nice_url);
-}
-
-static gboolean
-emfv_on_html_button_released_cb (GtkHTML *html, GdkEventButton *button, EMFolderView *emfv)
-{
- gboolean selected;
-
- selected = gtk_html_command (html, "is-selection-active");
- bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL);
-
- return FALSE;
-}
-
-void
-em_folder_view_show_search_bar (EMFolderView *emfv)
-{
- EMFolderViewClass *class;
-
- g_return_if_fail (EM_IS_FOLDER_VIEW (emfv));
-
- class = EM_FOLDER_VIEW_GET_CLASS (emfv);
- g_return_if_fail (class->show_search_bar != NULL);
-
- class->show_search_bar (emfv);
}
diff --git a/mail/em-folder-view.h b/mail/em-folder-view.h
index 3a7a153131..f55fda2c81 100644
--- a/mail/em-folder-view.h
+++ b/mail/em-folder-view.h
@@ -25,6 +25,7 @@
#include <gtk/gtk.h>
#include "mail/em-popup.h"
+#include "message-list.h"
/* Standard GObject macros */
#define EM_TYPE_FOLDER_VIEW \
@@ -47,7 +48,6 @@
G_BEGIN_DECLS
-struct _MessageList;
struct _EMFormatHTMLDisplay;
struct _CamelFolder;
struct _CamelMedium;
@@ -80,7 +80,7 @@ struct _EMFolderView {
struct _EMFolderViewPrivate *priv;
- struct _MessageList *list;
+ MessageList *list;
struct _EMFormatHTMLDisplay *preview;
@@ -142,6 +142,9 @@ GtkWidget *em_folder_view_new(void);
#define em_folder_view_set_folder_uri(emfv, uri) EM_FOLDER_VIEW_GET_CLASS (emfv)->set_folder_uri((emfv), (uri))
#define em_folder_view_set_message(emfv, uid, nomarkseen) EM_FOLDER_VIEW_GET_CLASS (emfv)->set_message((emfv), (uid), (nomarkseen))
+void em_folder_view_select_next_message(EMFolderView *emfv, int count, gboolean always_can_previous);
+void em_folder_view_message_reply(EMFolderView *emfv, int mode);
+
EMPopupTargetSelect *em_folder_view_get_popup_target(EMFolderView *emfv, EMPopup *emp, int on_display);
int em_folder_view_mark_selected(EMFolderView *emfv, guint32 mask, guint32 set);
diff --git a/mail/em-format-hook.h b/mail/em-format-hook.h
index 08d99dd63c..6fed1b1088 100644
--- a/mail/em-format-hook.h
+++ b/mail/em-format-hook.h
@@ -28,7 +28,7 @@
#include "libedataserver/e-msgport.h"
#include "e-util/e-plugin.h"
-#include "mail/em-format.h"
+#include "em-format/em-format.h"
#ifdef __cplusplus
extern "C" {
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 8d25923658..1cfe836e76 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -73,12 +73,12 @@
#include "mail-config.h"
+#include "e-mail-display.h"
#include "e-mail-attachment-bar.h"
#include "em-format-html-display.h"
#include "em-icon-stream.h"
#include "em-utils.h"
#include "em-popup.h"
-#include "e-icon-entry.h"
#include "widgets/misc/e-attachment-button.h"
#include "widgets/misc/e-attachment-view.h"
@@ -94,17 +94,53 @@
#define d(x)
+#define EM_FORMAT_HTML_DISPLAY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_FORMAT_HTML_DISPLAY, EMFormatHTMLDisplayPrivate))
+
struct _EMFormatHTMLDisplayPrivate {
GtkWidget *attachment_view; /* weak reference */
};
-static int efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormatHTMLDisplay *efh);
-static void efhd_html_link_clicked (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd);
-static void efhd_html_on_url (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd);
+struct _smime_pobject {
+ EMFormatHTMLPObject object;
+
+ int signature;
+ CamelCipherValidity *valid;
+ GtkWidget *widget;
+};
+
+/* TODO: move the dialogue elsehwere */
+/* FIXME: also in em-format-html.c */
+static const struct {
+ const char *icon, *shortdesc, *description;
+} smime_sign_table[5] = {
+ { "stock_signature-bad", N_("Unsigned"), N_("This message is not signed. There is no guarantee that this message is authentic.") },
+ { "stock_signature-ok", N_("Valid signature"), N_("This message is signed and is valid meaning that it is very likely that this message is authentic.") },
+ { "stock_signature-bad", N_("Invalid signature"), N_("The signature of this message cannot be verified, it may have been altered in transit.") },
+ { "stock_signature", N_("Valid signature, but cannot verify sender"), N_("This message is signed with a valid signature, but the sender of the message cannot be verified.") },
+ { "stock_signature-bad", N_("Signature exists, but need public key"), N_("This message is signed with a signature, but there is no corresponding public key.") },
+
+};
+
+static const struct {
+ const char *icon, *shortdesc, *description;
+} smime_encrypt_table[4] = {
+ { "stock_lock-broken", N_("Unencrypted"), N_("This message is not encrypted. Its content may be viewed in transit across the Internet.") },
+ { "stock_lock-ok", N_("Encrypted, weak"), N_("This message is encrypted, but with a weak encryption algorithm. It would be difficult, but not impossible for an outsider to view the content of this message in a practical amount of time.") },
+ { "stock_lock-ok", N_("Encrypted"), N_("This message is encrypted. It would be difficult for an outsider to view the content of this message.") },
+ { "stock_lock-ok", N_("Encrypted, strong"), N_("This message is encrypted, with a strong encryption algorithm. It would be very difficult for an outsider to view the content of this message in a practical amount of time.") },
+};
+
+static const char *smime_sign_colour[5] = {
+ "", " bgcolor=\"#88bb88\"", " bgcolor=\"#bb8888\"", " bgcolor=\"#e8d122\"",""
+};
static void efhd_attachment_frame(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri);
static gboolean efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject);
static void efhd_message_add_bar(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info);
+static gboolean efhd_attachment_button (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject);
+static gboolean efhd_attachment_optional (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *object);
struct _attach_puri {
EMFormatPURI puri;
@@ -117,7 +153,6 @@ struct _attach_puri {
GtkWidget *forward, *down;
/* currently no way to correlate this data to the frame :( */
GtkHTML *frame;
- CamelStream *output;
unsigned int shown:1;
/* Embedded Frame */
@@ -141,463 +176,14 @@ struct _attach_puri {
};
-static void efhd_iframe_created(GtkHTML *html, GtkHTML *iframe, EMFormatHTMLDisplay *efh);
-/*static void efhd_url_requested(GtkHTML *html, const char *url, GtkHTMLStream *handle, EMFormatHTMLDisplay *efh);
- static gboolean efhd_object_requested(GtkHTML *html, GtkHTMLEmbedded *eb, EMFormatHTMLDisplay *efh);*/
-
static void efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info);
-static const EMFormatHandler *efhd_find_handler(EMFormat *emf, const char *mime_type);
-static void efhd_format_clone(EMFormat *, CamelFolder *folder, const char *, CamelMimeMessage *msg, EMFormat *);
-static void efhd_format_error(EMFormat *emf, CamelStream *stream, const char *txt);
-static void efhd_format_source(EMFormat *, CamelStream *, CamelMimePart *);
-static void efhd_format_attachment(EMFormat *, CamelStream *, CamelMimePart *, const char *, const EMFormatHandler *);
-static void efhd_format_optional(EMFormat *, CamelStream *, CamelMimePart *, CamelStream *);
-static void efhd_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid);
-
static void efhd_builtin_init(EMFormatHTMLDisplayClass *efhc);
-enum {
- EFHD_LINK_CLICKED,
- EFHD_POPUP_EVENT,
- EFHD_ON_URL,
- EFHD_LAST_SIGNAL
-};
-
-static guint efhd_signals[EFHD_LAST_SIGNAL] = { 0 };
-
-static EMFormatHTMLClass *efhd_parent;
-static EMFormatClass *efhd_format_class;
-
-static void
-efhd_gtkhtml_realise(GtkHTML *html, EMFormatHTMLDisplay *efhd)
-{
- GtkStyle *style;
-
- /* FIXME: does this have to be re-done every time we draw? */
-
- /* My favorite thing to do... muck around with colors so we respect people's stupid themes.
- However, we only do this if we are rendering to the screen -- we ignore the theme
- when we are printing. */
- style = gtk_widget_get_style((GtkWidget *)html);
- if (style) {
- int state = GTK_WIDGET_STATE(html);
- gushort r, g, b;
-
- r = style->fg[state].red >> 8;
- g = style->fg[state].green >> 8;
- b = style->fg[state].blue >> 8;
-
- efhd->formathtml.header_colour = ((r<<16) | (g<< 8) | b) & 0xffffff;
-
- r = style->bg[state].red >> 8;
- g = style->bg[state].green >> 8;
- b = style->bg[state].blue >> 8;
-
- efhd->formathtml.body_colour = ((r<<16) | (g<< 8) | b) & 0xffffff;
-
- r = style->dark[state].red >> 8;
- g = style->dark[state].green >> 8;
- b = style->dark[state].blue >> 8;
-
- efhd->formathtml.frame_colour = ((r<<16) | (g<< 8) | b) & 0xffffff;
-
- r = style->base[GTK_STATE_NORMAL].red >> 8;
- g = style->base[GTK_STATE_NORMAL].green >> 8;
- b = style->base[GTK_STATE_NORMAL].blue >> 8;
-
- efhd->formathtml.content_colour = ((r<<16) | (g<< 8) | b) & 0xffffff;
-
- r = style->text[state].red >> 8;
- g = style->text[state].green >> 8;
- b = style->text[state].blue >> 8;
-
- efhd->formathtml.text_colour = ((r<<16) | (g<< 8) | b) & 0xffffff;
-#undef DARKER
- }
-}
-
-static void
-efhd_gtkhtml_style_set(GtkHTML *html, GtkStyle *old, EMFormatHTMLDisplay *efhd)
-{
- efhd_gtkhtml_realise(html, efhd);
- em_format_redraw((EMFormat *)efhd);
-}
-
-static void
-efhd_init(GObject *o)
-{
- EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)o;
-#define efh ((EMFormatHTML *)efhd)
-
- efhd->priv = g_malloc0(sizeof(*efhd->priv));
-
- g_signal_connect(efh->html, "realize", G_CALLBACK(efhd_gtkhtml_realise), o);
- g_signal_connect(efh->html, "style-set", G_CALLBACK(efhd_gtkhtml_style_set), o);
- /* we want to convert url's etc */
- efh->text_html_flags |= CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
-#undef efh
-
- efhd->nobar = getenv("EVOLUTION_NO_BAR") != NULL;
-}
+static gpointer parent_class;
static void
-efhd_finalise(GObject *o)
-{
- EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)o;
-
- /* check pending stuff */
-
- g_free(efhd->priv);
-
- ((GObjectClass *)efhd_parent)->finalize(o);
-}
-
-static gboolean
-efhd_bool_accumulator(GSignalInvocationHint *ihint, GValue *out, const GValue *in, void *data)
-{
- gboolean val = g_value_get_boolean(in);
-
- g_value_set_boolean(out, val);
-
- return !val;
-}
-
-static void
-efhd_class_init(GObjectClass *klass)
-{
- ((EMFormatClass *)klass)->find_handler = efhd_find_handler;
- ((EMFormatClass *)klass)->format_clone = efhd_format_clone;
- ((EMFormatClass *)klass)->format_error = efhd_format_error;
- ((EMFormatClass *)klass)->format_source = efhd_format_source;
- ((EMFormatClass *)klass)->format_attachment = efhd_format_attachment;
- ((EMFormatClass *)klass)->format_optional = efhd_format_optional;
- ((EMFormatClass *)klass)->format_secure = efhd_format_secure;
-
- klass->finalize = efhd_finalise;
-
- efhd_signals[EFHD_LINK_CLICKED] =
- g_signal_new("link_clicked",
- G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(EMFormatHTMLDisplayClass, link_clicked),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- efhd_signals[EFHD_POPUP_EVENT] =
- g_signal_new("popup_event",
- G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(EMFormatHTMLDisplayClass, popup_event),
- efhd_bool_accumulator, NULL,
- e_marshal_BOOLEAN__BOXED_POINTER_POINTER,
- G_TYPE_BOOLEAN, 3,
- GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE,
- G_TYPE_POINTER, G_TYPE_POINTER);
-
- efhd_signals[EFHD_ON_URL] =
- g_signal_new("on_url",
- G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(EMFormatHTMLDisplayClass, on_url),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
-
- efhd_builtin_init((EMFormatHTMLDisplayClass *)klass);
-}
-
-GType
-em_format_html_display_get_type (void)
-{
- static GType type = 0;
-
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(EMFormatHTMLDisplayClass),
- NULL, NULL,
- (GClassInitFunc)efhd_class_init,
- NULL, NULL,
- sizeof(EMFormatHTMLDisplay), 0,
- (GInstanceInitFunc)efhd_init
- };
- efhd_parent = g_type_class_ref(em_format_html_get_type());
- efhd_format_class = g_type_class_ref(em_format_get_type());
- type = g_type_register_static(em_format_html_get_type(), "EMFormatHTMLDisplay", &info, 0);
- }
-
- return type;
-}
-
-static gboolean
-efhd_scroll_event(GtkWidget *w, GdkEventScroll *event, EMFormatHTMLDisplay *efhd)
-{
- if(event->state & GDK_CONTROL_MASK)
- {
- if(event->direction == GDK_SCROLL_UP)
- {
- gtk_html_zoom_in (efhd->formathtml.html);
- }
- else if(event->direction == GDK_SCROLL_DOWN)
- {
- gtk_html_zoom_out (efhd->formathtml.html);
- }
- return TRUE;
- }
- return FALSE;
-}
-
-EMFormatHTMLDisplay *em_format_html_display_new(void)
-{
- EMFormatHTMLDisplay *efhd;
-
- efhd = g_object_new(em_format_html_display_get_type(), 0);
-
- g_signal_connect(efhd->formathtml.html, "iframe_created", G_CALLBACK(efhd_iframe_created), efhd);
- g_signal_connect(efhd->formathtml.html, "link_clicked", G_CALLBACK(efhd_html_link_clicked), efhd);
- g_signal_connect(efhd->formathtml.html, "on_url", G_CALLBACK(efhd_html_on_url), efhd);
- g_signal_connect(efhd->formathtml.html, "button_press_event", G_CALLBACK(efhd_html_button_press_event), efhd);
- g_signal_connect(efhd->formathtml.html,"scroll_event", G_CALLBACK(efhd_scroll_event), efhd);
-
- return efhd;
-}
-
-void em_format_html_display_goto_anchor(EMFormatHTMLDisplay *efhd, const char *name)
-{
- printf("FIXME: go to anchor '%s'\n", name);
-}
-
-void em_format_html_display_set_animate(EMFormatHTMLDisplay *efhd, gboolean state)
-{
- efhd->animate = state;
- gtk_html_set_animate(((EMFormatHTML *)efhd)->html, state);
-}
-
-void em_format_html_display_set_caret_mode(EMFormatHTMLDisplay *efhd, gboolean state)
-{
- efhd->caret_mode = state;
- gtk_html_set_caret_mode(((EMFormatHTML *)efhd)->html, state);
-}
-
-void
-em_format_html_display_cut (EMFormatHTMLDisplay *efhd)
-{
- gtk_html_cut (((EMFormatHTML *) efhd)->html);
-}
-
-void
-em_format_html_display_copy (EMFormatHTMLDisplay *efhd)
-{
- gtk_html_copy (((EMFormatHTML *) efhd)->html);
-}
-
-void
-em_format_html_display_paste (EMFormatHTMLDisplay *efhd)
-{
- gtk_html_paste (((EMFormatHTML *) efhd)->html, FALSE);
-}
-
-void
-em_format_html_display_zoom_in (EMFormatHTMLDisplay *efhd)
-{
- gtk_html_zoom_in (((EMFormatHTML *) efhd)->html);
-}
-
-void
-em_format_html_display_zoom_out (EMFormatHTMLDisplay *efhd)
-{
- gtk_html_zoom_out (((EMFormatHTML *) efhd)->html);
-}
-
-void
-em_format_html_display_zoom_reset (EMFormatHTMLDisplay *efhd)
-{
- gtk_html_zoom_reset (((EMFormatHTML *) efhd)->html);
-}
-
-/* ********************************************************************** */
-
-static void
-efhd_iframe_created(GtkHTML *html, GtkHTML *iframe, EMFormatHTMLDisplay *efh)
-{
- d(printf("Iframe created %p ... \n", iframe));
-
- g_signal_connect(iframe, "button_press_event", G_CALLBACK (efhd_html_button_press_event), efh);
-
- return;
-}
-
-static void
-efhd_get_uri_puri (GtkWidget *html, GdkEventButton *event, EMFormatHTMLDisplay *efhd, char **uri, EMFormatPURI **puri)
-{
- char *url, *img_url;
-
- g_return_if_fail (html != NULL);
- g_return_if_fail (GTK_IS_HTML (html));
- g_return_if_fail (efhd != NULL);
-
- if (event) {
- url = gtk_html_get_url_at (GTK_HTML (html), event->x, event->y);
- img_url = gtk_html_get_image_src_at (GTK_HTML (html), event->x, event->y);
- } else {
- url = gtk_html_get_cursor_url (GTK_HTML (html));
- img_url = gtk_html_get_cursor_image_src (GTK_HTML (html));
- }
-
- if (img_url) {
- if (!(strstr (img_url, "://") || g_ascii_strncasecmp (img_url, "cid:", 4) == 0)) {
- char *u = g_filename_to_uri (img_url, NULL, NULL);
- g_free (img_url);
- img_url = u;
- }
- }
-
- if (puri) {
- if (url)
- *puri = em_format_find_puri ((EMFormat *)efhd, url);
-
- if (!*puri && img_url)
- *puri = em_format_find_puri ((EMFormat *)efhd, img_url);
- }
-
- if (uri) {
- *uri = NULL;
- if (img_url && g_ascii_strncasecmp (img_url, "cid:", 4) != 0) {
- if (url)
- *uri = g_strdup_printf ("%s\n%s", url, img_url);
- else {
- *uri = img_url;
- img_url = NULL;
- }
- } else {
- *uri = url;
- url = NULL;
- }
- }
-
- g_free (url);
- g_free (img_url);
-}
-
-static int
-efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormatHTMLDisplay *efhd)
-{
- char *uri = NULL;
- EMFormatPURI *puri = NULL;
- gboolean res = FALSE;
-
- if (event->button != 3)
- return FALSE;
-
- d(printf("popup button pressed\n"));
-
- efhd_get_uri_puri (widget, event, efhd, &uri, &puri);
-
- if (uri && !strncmp (uri, "##", 2)) {
- g_free (uri);
- return TRUE;
- }
-
- g_signal_emit((GtkObject *)efhd, efhd_signals[EFHD_POPUP_EVENT], 0, event, uri, puri?puri->part:NULL, &res);
-
- g_free (uri);
-
- return res;
-}
-
-gboolean
-em_format_html_display_popup_menu (EMFormatHTMLDisplay *efhd)
-{
- GtkHTML *html;
- char *uri = NULL;
- EMFormatPURI *puri = NULL;
- gboolean res = FALSE;
-
- html = efhd->formathtml.html;
-
- efhd_get_uri_puri (GTK_WIDGET (html), NULL, efhd, &uri, &puri);
-
- g_signal_emit ((GtkObject *)efhd, efhd_signals[EFHD_POPUP_EVENT], 0, NULL, uri, puri?puri->part:NULL, &res);
-
- g_free (uri);
-
- return res;
-}
-
-static void
-efhd_html_link_clicked (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd)
-{
- d(printf("link clicked event '%s'\n", url));
- if (url && !strncmp(url, "##", 2)) {
- if (!strcmp (url, "##TO##"))
- if (!(((EMFormatHTML *) efhd)->header_wrap_flags & EM_FORMAT_HTML_HEADER_TO))
- ((EMFormatHTML *) efhd)->header_wrap_flags |= EM_FORMAT_HTML_HEADER_TO;
- else
- ((EMFormatHTML *) efhd)->header_wrap_flags &= ~EM_FORMAT_HTML_HEADER_TO;
- else if (!strcmp (url, "##CC##"))
- if (!(((EMFormatHTML *) efhd)->header_wrap_flags & EM_FORMAT_HTML_HEADER_CC))
- ((EMFormatHTML *) efhd)->header_wrap_flags |= EM_FORMAT_HTML_HEADER_CC;
- else
- ((EMFormatHTML *) efhd)->header_wrap_flags &= ~EM_FORMAT_HTML_HEADER_CC;
- else if (!strcmp (url, "##BCC##")) {
- if (!(((EMFormatHTML *) efhd)->header_wrap_flags & EM_FORMAT_HTML_HEADER_BCC))
- ((EMFormatHTML *) efhd)->header_wrap_flags |= EM_FORMAT_HTML_HEADER_BCC;
- else
- ((EMFormatHTML *) efhd)->header_wrap_flags &= ~EM_FORMAT_HTML_HEADER_BCC;
- }
- em_format_redraw((EMFormat *)efhd);
- } else
- g_signal_emit((GObject *)efhd, efhd_signals[EFHD_LINK_CLICKED], 0, url);
-}
-
-static void
-efhd_html_on_url (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd)
-{
- d(printf("on_url event '%s'\n", url));
-
- g_signal_emit((GObject *)efhd, efhd_signals[EFHD_ON_URL], 0, url);
-}
-
-/* ********************************************************************** */
-
-/* TODO: move the dialogue elsehwere */
-/* FIXME: also in em-format-html.c */
-static const struct {
- const char *icon, *shortdesc, *description;
-} smime_sign_table[5] = {
- { "stock_signature-bad", N_("Unsigned"), N_("This message is not signed. There is no guarantee that this message is authentic.") },
- { "stock_signature-ok", N_("Valid signature"), N_("This message is signed and is valid meaning that it is very likely that this message is authentic.") },
- { "stock_signature-bad", N_("Invalid signature"), N_("The signature of this message cannot be verified, it may have been altered in transit.") },
- { "stock_signature", N_("Valid signature, but cannot verify sender"), N_("This message is signed with a valid signature, but the sender of the message cannot be verified.") },
- { "stock_signature-bad", N_("Signature exists, but need public key"), N_("This message is signed with a signature, but there is no corresponding public key.") },
-
-};
-
-static const struct {
- const char *icon, *shortdesc, *description;
-} smime_encrypt_table[4] = {
- { "stock_lock-broken", N_("Unencrypted"), N_("This message is not encrypted. Its content may be viewed in transit across the Internet.") },
- { "stock_lock-ok", N_("Encrypted, weak"), N_("This message is encrypted, but with a weak encryption algorithm. It would be difficult, but not impossible for an outsider to view the content of this message in a practical amount of time.") },
- { "stock_lock-ok", N_("Encrypted"), N_("This message is encrypted. It would be difficult for an outsider to view the content of this message.") },
- { "stock_lock-ok", N_("Encrypted, strong"), N_("This message is encrypted, with a strong encryption algorithm. It would be very difficult for an outsider to view the content of this message in a practical amount of time.") },
-};
-
-static const char *smime_sign_colour[5] = {
- "", " bgcolor=\"#88bb88\"", " bgcolor=\"#bb8888\"", " bgcolor=\"#e8d122\"",""
-};
-
-struct _smime_pobject {
- EMFormatHTMLPObject object;
-
- int signature;
- CamelCipherValidity *valid;
- GtkWidget *widget;
-};
-
-static void
-efhd_xpkcs7mime_free(EMFormatHTMLPObject *o)
+efhd_xpkcs7mime_free (EMFormatHTMLPObject *o)
{
struct _smime_pobject *po = (struct _smime_pobject *)o;
@@ -607,21 +193,18 @@ efhd_xpkcs7mime_free(EMFormatHTMLPObject *o)
}
static void
-efhd_xpkcs7mime_info_response(GtkWidget *w, guint button, struct _smime_pobject *po)
+efhd_xpkcs7mime_info_response (GtkWidget *widget,
+ guint button,
+ struct _smime_pobject *po)
{
- gtk_widget_destroy(w);
+ gtk_widget_destroy (widget);
po->widget = NULL;
}
#ifdef HAVE_NSS
static void
-efhd_xpkcs7mime_viewcert_foad(GtkWidget *w, guint button, struct _smime_pobject *po)
-{
- gtk_widget_destroy(w);
-}
-
-static void
-efhd_xpkcs7mime_viewcert_clicked(GtkWidget *button, struct _smime_pobject *po)
+efhd_xpkcs7mime_viewcert_clicked (GtkWidget *button,
+ struct _smime_pobject *po)
{
CamelCipherCertInfo *info = g_object_get_data((GObject *)button, "e-cert-info");
ECertDB *db = e_cert_db_peek();
@@ -638,7 +221,7 @@ efhd_xpkcs7mime_viewcert_clicked(GtkWidget *button, struct _smime_pobject *po)
/* oddly enough certificate_viewer_show doesn't ... */
gtk_widget_show(w);
- g_signal_connect(w, "response", G_CALLBACK(efhd_xpkcs7mime_viewcert_foad), po);
+ g_signal_connect(w, "response", G_CALLBACK(gtk_widget_destroy), NULL);
if (w && po->widget)
gtk_window_set_transient_for((GtkWindow *)w, (GtkWindow *)po->widget);
@@ -651,7 +234,9 @@ efhd_xpkcs7mime_viewcert_clicked(GtkWidget *button, struct _smime_pobject *po)
#endif
static void
-efhd_xpkcs7mime_add_cert_table(GtkWidget *vbox, CamelDList *certlist, struct _smime_pobject *po)
+efhd_xpkcs7mime_add_cert_table (GtkWidget *vbox,
+ CamelDList *certlist,
+ struct _smime_pobject *po)
{
CamelCipherCertInfo *info = (CamelCipherCertInfo *)certlist->head;
GtkTable *table = (GtkTable *)gtk_table_new(camel_dlist_length(certlist), 2, FALSE);
@@ -710,7 +295,8 @@ efhd_xpkcs7mime_add_cert_table(GtkWidget *vbox, CamelDList *certlist, struct _sm
}
static void
-efhd_xpkcs7mime_validity_clicked(GtkWidget *button, EMFormatHTMLPObject *pobject)
+efhd_xpkcs7mime_validity_clicked (GtkWidget *button,
+ EMFormatHTMLPObject *pobject)
{
struct _smime_pobject *po = (struct _smime_pobject *)pobject;
GladeXML *xml;
@@ -721,10 +307,9 @@ efhd_xpkcs7mime_validity_clicked(GtkWidget *button, EMFormatHTMLPObject *pobject
/* FIXME: window raise? */
return;
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- "mail-dialogs.glade",
- NULL);
- xml = glade_xml_new(gladefile, "message_security_dialog", NULL);
+ gladefile = g_build_filename (
+ EVOLUTION_GLADEDIR, "mail-dialogs.glade", NULL);
+ xml = glade_xml_new (gladefile, "message_security_dialog", NULL);
g_free (gladefile);
po->widget = glade_xml_get_widget(xml, "message_security_dialog");
@@ -800,9 +385,12 @@ efhd_xpkcs7mime_validity_clicked(GtkWidget *button, EMFormatHTMLPObject *pobject
}
static gboolean
-efhd_xpkcs7mime_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject)
+efhd_xpkcs7mime_button (EMFormatHTML *efh,
+ GtkHTMLEmbedded *eb,
+ EMFormatHTMLPObject *pobject)
{
- GtkWidget *icon, *button;
+ GtkWidget *container;
+ GtkWidget *widget;
struct _smime_pobject *po = (struct _smime_pobject *)pobject;
const char *icon_name;
@@ -812,25 +400,171 @@ efhd_xpkcs7mime_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
else
icon_name = smime_encrypt_table[po->valid->encrypt.status].icon;
- icon = gtk_image_new_from_icon_name (
- icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
- gtk_widget_show(icon);
+ container = GTK_WIDGET (eb);
- button = gtk_button_new();
- g_signal_connect(button, "clicked", G_CALLBACK(efhd_xpkcs7mime_validity_clicked), pobject);
+ widget = gtk_button_new ();
+ g_signal_connect (
+ widget, "clicked",
+ G_CALLBACK (efhd_xpkcs7mime_validity_clicked), pobject);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
- gtk_container_add((GtkContainer *)button, icon);
- gtk_widget_show(button);
- gtk_container_add((GtkContainer *)eb, button);
+ widget = gtk_image_new_from_icon_name (
+ icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ gtk_widget_show (widget);
return TRUE;
}
static void
-efhd_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid)
+efhd_format_clone (EMFormat *emf,
+ CamelFolder *folder,
+ const gchar *uid,
+ CamelMimeMessage *msg,
+ EMFormat *src)
+{
+ if (emf != src)
+ EM_FORMAT_HTML (emf)->header_wrap_flags = 0;
+
+ /* Chain up to parent's format_clone() method. */
+ EM_FORMAT_CLASS (parent_class)->
+ format_clone (emf, folder, uid, msg, src);
+}
+
+static void
+efhd_format_attachment (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *part,
+ const gchar *mime_type,
+ const EMFormatHandler *handle)
+{
+ char *classid, *text, *html;
+ struct _attach_puri *info;
+
+ classid = g_strdup_printf ("attachment%s", emf->part_id->str);
+ info = (struct _attach_puri *) em_format_add_puri (
+ emf, sizeof (*info), classid, part, efhd_attachment_frame);
+ em_format_html_add_pobject (
+ EM_FORMAT_HTML (emf), sizeof (EMFormatHTMLPObject),
+ classid, part, efhd_attachment_button);
+ info->handle = handle;
+ info->shown = em_format_is_inline (
+ emf, info->puri.part_id, info->puri.part, handle);
+ info->snoop_mime_type = emf->snoop_mime_type;
+ info->attachment = e_attachment_new ();
+ e_attachment_set_mime_part (info->attachment, info->puri.part);
+
+ if (emf->valid) {
+ info->sign = emf->valid->sign.status;
+ info->encrypt = emf->valid->encrypt.status;
+ }
+
+ camel_stream_write_string (
+ stream, EM_FORMAT_HTML_VPAD
+ "<table cellspacing=0 cellpadding=0><tr><td>"
+ "<table width=10 cellspacing=0 cellpadding=0>"
+ "<tr><td></td></tr></table></td>");
+
+ camel_stream_printf (
+ stream, "<td><object classid=\"%s\"></object></td>", classid);
+
+ camel_stream_write_string (
+ stream, "<td><table width=3 cellspacing=0 cellpadding=0>"
+ "<tr><td></td></tr></table></td><td><font size=-1>");
+
+ /* output some info about it */
+ /* FIXME: should we look up mime_type from object again? */
+ text = em_format_describe_part (part, mime_type);
+ html = camel_text_to_html (
+ text, EM_FORMAT_HTML (emf)->text_html_flags &
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
+ camel_stream_write_string (stream, html);
+ g_free (html);
+ g_free (text);
+
+ camel_stream_write_string (
+ stream, "</font></td></tr><tr></table>\n"
+ EM_FORMAT_HTML_VPAD);
+
+ if (handle && info->shown)
+ handle->handler (emf, stream, part, handle);
+
+ g_free (classid);
+}
+
+static void
+efhd_format_optional (EMFormat *emf,
+ CamelStream *fstream,
+ CamelMimePart *part,
+ CamelStream *mstream)
{
- /* Note: We call EMFormatClass directly, not EMFormatHTML, our parent */
- efhd_format_class->format_secure(emf, stream, part, valid);
+ char *classid, *html;
+ struct _attach_puri *info;
+ CamelStream *stream;
+
+ if (CAMEL_IS_STREAM_FILTER (fstream) && ((CamelStreamFilter *) fstream)->source)
+ stream = ((CamelStreamFilter *) fstream)->source;
+ else
+ stream = fstream;
+
+ classid = g_strdup_printf ("optional%s", emf->part_id->str);
+ info = (struct _attach_puri *) em_format_add_puri (
+ emf, sizeof (*info), classid, part, efhd_attachment_frame);
+ em_format_html_add_pobject (
+ EM_FORMAT_HTML (emf), sizeof (EMFormatHTMLPObject),
+ classid, part, efhd_attachment_optional);
+ info->handle = em_format_find_handler (emf, "text/plain");
+ info->shown = FALSE;
+ info->snoop_mime_type = "text/plain";
+ info->attachment = e_attachment_new ();
+ e_attachment_set_mime_part (info->attachment, info->puri.part);
+ info->mstream = (CamelStreamMem *) mstream;
+ if (emf->valid) {
+ info->sign = emf->valid->sign.status;
+ info->encrypt = emf->valid->encrypt.status;
+ }
+
+ camel_stream_write_string (
+ stream, EM_FORMAT_HTML_VPAD
+ "<table cellspacing=0 cellpadding=0><tr><td>"
+ "<h3><font size=-1 color=red>");
+
+ html = camel_text_to_html (
+ _("Evolution cannot render this email as it is too "
+ "large to process. You can view it unformatted or "
+ "with an external text editor."),
+ EM_FORMAT_HTML (emf)->text_html_flags &
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
+ camel_stream_write_string (stream, html);
+ camel_stream_write_string (
+ stream, "</font></h3></td></tr></table>\n");
+ camel_stream_write_string (
+ stream, "<table cellspacing=0 cellpadding=0><tr>");
+ camel_stream_printf (
+ stream, "<td><object classid=\"%s\"></object>"
+ "</td></tr></table>", classid);
+
+ g_free(html);
+
+ camel_stream_write_string (
+ stream, EM_FORMAT_HTML_VPAD);
+
+ g_free (classid);
+}
+
+static void
+efhd_format_secure (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *part,
+ CamelCipherValidity *valid)
+{
+ EMFormatClass *format_class;
+
+ format_class = g_type_class_peek (EM_TYPE_FORMAT);
+ format_class->format_secure (emf, stream, part, valid);
if (emf->valid == valid
&& (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE
@@ -838,24 +572,45 @@ efhd_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Came
char *classid;
struct _smime_pobject *pobj;
- camel_stream_printf (stream, "<table border=0 width=\"100%%\" cellpadding=3 cellspacing=0%s><tr>",
- smime_sign_colour[valid->sign.status]);
-
- classid = g_strdup_printf("smime:///em-format-html/%s/icon/signed", emf->part_id->str);
- pobj = (struct _smime_pobject *)em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(*pobj), classid, part, efhd_xpkcs7mime_button);
+ camel_stream_printf (
+ stream, "<table border=0 width=\"100%%\" "
+ "cellpadding=3 cellspacing=0%s><tr>",
+ smime_sign_colour[valid->sign.status]);
+
+ classid = g_strdup_printf (
+ "smime:///em-format-html/%s/icon/signed",
+ emf->part_id->str);
+ pobj = (struct _smime_pobject *) em_format_html_add_pobject (
+ EM_FORMAT_HTML (emf), sizeof (*pobj),
+ classid, part, efhd_xpkcs7mime_button);
pobj->valid = camel_cipher_validity_clone(valid);
pobj->object.free = efhd_xpkcs7mime_free;
- camel_stream_printf(stream, "<td valign=center><object classid=\"%s\"></object></td><td width=100%% valign=center>", classid);
- g_free(classid);
+ camel_stream_printf (
+ stream, "<td valign=center><object classid=\"%s\">"
+ "</object></td><td width=100%% valign=center>",
+ classid);
+ g_free (classid);
+
if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) {
- camel_stream_printf (stream, "%s", _(smime_sign_table[valid->sign.status].shortdesc));
+ const gchar *desc;
+ gint status;
+
+ status = valid->sign.status;
+ desc = smime_sign_table[status].shortdesc;
+ camel_stream_printf (stream, "%s", gettext (desc));
}
if (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE) {
+ const gchar *desc;
+ gint status;
+
if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) {
camel_stream_printf (stream, "<br>");
}
- camel_stream_printf (stream, "%s", _(smime_encrypt_table[valid->encrypt.status].shortdesc));
+
+ status = valid->encrypt.status;
+ desc = smime_encrypt_table[status].shortdesc;
+ camel_stream_printf (stream, "%s", gettext (desc));
}
camel_stream_printf(stream, "</td></tr></table>");
@@ -863,6 +618,80 @@ efhd_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Came
}
static void
+efhd_class_init (EMFormatHTMLDisplayClass *class)
+{
+ EMFormatClass *format_class;
+ EMFormatHTMLClass *format_html_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMFormatHTMLDisplayPrivate));
+
+ format_class = EM_FORMAT_CLASS (class);
+ format_class->format_clone = efhd_format_clone;
+ format_class->format_attachment = efhd_format_attachment;
+ format_class->format_optional = efhd_format_optional;
+ format_class->format_secure = efhd_format_secure;
+
+ format_html_class = EM_FORMAT_HTML_CLASS (class);
+ format_html_class->html_widget_type = E_TYPE_MAIL_DISPLAY;
+
+ efhd_builtin_init (class);
+}
+
+static void
+efhd_init (EMFormatHTMLDisplay *efhd)
+{
+ GtkHTML *html;
+
+ html = EM_FORMAT_HTML (efhd)->html;
+
+ efhd->priv = EM_FORMAT_HTML_DISPLAY_GET_PRIVATE (efhd);
+
+ e_mail_display_set_formatter (
+ E_MAIL_DISPLAY (html), EM_FORMAT_HTML (efhd));
+
+ /* we want to convert url's etc */
+ EM_FORMAT_HTML (efhd)->text_html_flags |=
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
+}
+
+GType
+em_format_html_display_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMFormatHTMLDisplayClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) efhd_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMFormatHTMLDisplay),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) efhd_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ EM_TYPE_FORMAT_HTML, "EMFormatHTMLDisplay",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+EMFormatHTMLDisplay *
+em_format_html_display_new (void)
+{
+ return g_object_new (EM_TYPE_FORMAT_HTML_DISPLAY, NULL);
+}
+
+/* ********************************************************************** */
+
+static void
efhd_image(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *handle)
{
char *classid;
@@ -925,20 +754,6 @@ efhd_builtin_init(EMFormatHTMLDisplayClass *efhc)
em_format_class_add_handler((EMFormatClass *)efhc, &type_builtin_table[i]);
}
-static const EMFormatHandler *
-efhd_find_handler(EMFormat *emf, const char *mime_type)
-{
- return ((EMFormatClass *) efhd_parent)->find_handler (emf, mime_type);
-}
-
-static void efhd_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMimeMessage *msg, EMFormat *src)
-{
- if (emf != src)
- ((EMFormatHTML *) emf)->header_wrap_flags = 0;
-
- ((EMFormatClass *)efhd_parent)->format_clone(emf, folder, uid, msg, src);
-}
-
static void
efhd_write_image(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
{
@@ -950,7 +765,8 @@ efhd_write_image(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
camel_stream_close(stream);
}
-static void efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info)
+static void
+efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info)
{
const char *flag, *comp, *due;
time_t date;
@@ -1009,17 +825,6 @@ static void efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePar
camel_stream_printf(stream, "</td></tr></table>");
}
-/* TODO: if these aren't going to do anything should remove */
-static void efhd_format_error(EMFormat *emf, CamelStream *stream, const char *txt)
-{
- ((EMFormatClass *)efhd_parent)->format_error(emf, stream, txt);
-}
-
-static void efhd_format_source(EMFormat *emf, CamelStream *stream, CamelMimePart *part)
-{
- ((EMFormatClass *)efhd_parent)->format_source(emf, stream, part);
-}
-
/* ********************************************************************** */
/* Checks on the widget whether it can be processed, based on the state of EMFormatHTML.
@@ -1447,38 +1252,35 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
return TRUE;
}
-/* not used currently */
-/* frame source callback */
static void
-efhd_attachment_frame(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri)
+efhd_attachment_frame (EMFormat *emf,
+ CamelStream *stream,
+ EMFormatPURI *puri)
{
struct _attach_puri *info = (struct _attach_puri *)puri;
- if (info->shown) {
- d(printf("writing to frame content, handler is '%s'\n", info->handle->mime_type));
- info->handle->handler(emf, stream, info->puri.part, info->handle);
- camel_stream_close(stream);
- } else {
- /* FIXME: this is leaked if the object is closed without showing it
- NB: need a virtual puri_free method? */
- info->output = stream;
- camel_object_ref(stream);
- }
+ if (info->shown)
+ info->handle->handler (
+ emf, stream, info->puri.part, info->handle);
+
+ camel_stream_close (stream);
}
static void
efhd_bar_resize (EMFormatHTML *efh,
GtkAllocation *event)
{
- EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *) efh;
+ EMFormatHTMLDisplayPrivate *priv;
GtkWidget *widget;
gint width;
+ priv = EM_FORMAT_HTML_DISPLAY_GET_PRIVATE (efh);
+
widget = GTK_WIDGET (efh->html);
width = widget->allocation.width - 12;
if (width > 0) {
- widget = efhd->priv->attachment_view;
+ widget = priv->attachment_view;
gtk_widget_set_size_request (widget, width, -1);
}
}
@@ -1488,12 +1290,14 @@ efhd_add_bar (EMFormatHTML *efh,
GtkHTMLEmbedded *eb,
EMFormatHTMLPObject *pobject)
{
- EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *) efh;
+ EMFormatHTMLDisplayPrivate *priv;
GtkWidget *widget;
+ priv = EM_FORMAT_HTML_DISPLAY_GET_PRIVATE (efh);
+
widget = e_mail_attachment_bar_new ();
gtk_container_add (GTK_CONTAINER (eb), widget);
- efhd->priv->attachment_view = widget;
+ priv->attachment_view = widget;
gtk_widget_hide (widget);
g_signal_connect_swapped (
@@ -1512,7 +1316,7 @@ efhd_message_add_bar (EMFormat *emf,
const char *classid = "attachment-bar";
em_format_html_add_pobject (
- (EMFormatHTML *) emf,
+ EM_FORMAT_HTML (emf),
sizeof (EMFormatHTMLPObject),
classid, part, efhd_add_bar);
@@ -1521,63 +1325,6 @@ efhd_message_add_bar (EMFormat *emf,
}
static void
-efhd_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const char *mime_type, const EMFormatHandler *handle)
-{
- char *classid, *text, *html;
- struct _attach_puri *info;
-
- classid = g_strdup_printf ("attachment%s", emf->part_id->str);
- info = (struct _attach_puri *)em_format_add_puri (
- emf, sizeof (*info), classid, part, efhd_attachment_frame);
- em_format_html_add_pobject (
- (EMFormatHTML *) emf, sizeof (EMFormatHTMLPObject),
- classid, part, efhd_attachment_button);
- info->handle = handle;
- info->shown = em_format_is_inline (
- emf, info->puri.part_id, info->puri.part, handle);
- info->snoop_mime_type = emf->snoop_mime_type;
- info->attachment = e_attachment_new ();
- e_attachment_set_mime_part (info->attachment, info->puri.part);
-
- if (emf->valid) {
- info->sign = emf->valid->sign.status;
- info->encrypt = emf->valid->encrypt.status;
- }
-
- camel_stream_write_string (
- stream, EM_FORMAT_HTML_VPAD
- "<table cellspacing=0 cellpadding=0><tr><td>"
- "<table width=10 cellspacing=0 cellpadding=0>"
- "<tr><td></td></tr></table></td>");
-
- camel_stream_printf (
- stream, "<td><object classid=\"%s\"></object></td>", classid);
-
- camel_stream_write_string (
- stream, "<td><table width=3 cellspacing=0 cellpadding=0>"
- "<tr><td></td></tr></table></td><td><font size=-1>");
-
- /* output some info about it */
- /* FIXME: should we look up mime_type from object again? */
- text = em_format_describe_part (part, mime_type);
- html = camel_text_to_html (
- text, ((EMFormatHTML *)emf)->text_html_flags &
- CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
- camel_stream_write_string (stream, html);
- g_free (html);
- g_free (text);
-
- camel_stream_write_string (
- stream, "</font></td></tr><tr></table>\n"
- EM_FORMAT_HTML_VPAD);
-
- if (handle && info->shown)
- handle->handler(emf, stream, part, handle);
-
- g_free(classid);
-}
-
-static void
efhd_optional_button_show (GtkWidget *widget, GtkWidget *w)
{
GtkWidget *label = g_object_get_data (G_OBJECT (widget), "text-label");
@@ -1690,50 +1437,3 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb
return TRUE;
}
-static void
-efhd_format_optional(EMFormat *emf, CamelStream *fstream, CamelMimePart *part, CamelStream *mstream)
-{
- char *classid, *html;
- struct _attach_puri *info;
- CamelStream *stream;
-
- if (CAMEL_IS_STREAM_FILTER (fstream) && ((CamelStreamFilter *) fstream)->source)
- stream = ((CamelStreamFilter *) fstream)->source;
- else
- stream = fstream;
-
- classid = g_strdup_printf("optional%s", emf->part_id->str);
- info = (struct _attach_puri *)em_format_add_puri(emf, sizeof(*info), classid, part, efhd_attachment_frame);
- em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_attachment_optional);
- info->handle = em_format_find_handler(emf, "text/plain");
- info->shown = FALSE;
- info->snoop_mime_type = "text/plain";
- info->attachment = e_attachment_new ();
- e_attachment_set_mime_part (info->attachment, info->puri.part);
- info->mstream = (CamelStreamMem *)mstream;
- if (emf->valid) {
- info->sign = emf->valid->sign.status;
- info->encrypt = emf->valid->encrypt.status;
- }
-
- camel_stream_write_string(stream,
- EM_FORMAT_HTML_VPAD
- "<table cellspacing=0 cellpadding=0><tr><td><h3><font size=-1 color=red>");
-
- html = camel_text_to_html(_("Evolution cannot render this email as it is too large to process. You can view it unformatted or with an external text editor."), ((EMFormatHTML *)emf)->text_html_flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
- camel_stream_write_string(stream, html);
- camel_stream_write_string(stream,
- "</font></h3></td></tr></table>\n");
- camel_stream_write_string(stream,
- "<table cellspacing=0 cellpadding=0>"
- "<tr>");
- camel_stream_printf(stream, "<td><object classid=\"%s\"></object></td></tr></table>", classid);
-
- g_free(html);
-
- camel_stream_write_string(stream,
-/* "</font></h2></td></tr></table>\n" */
- EM_FORMAT_HTML_VPAD);
-
- g_free(classid);
-}
diff --git a/mail/em-format-html-display.h b/mail/em-format-html-display.h
index bd0ea0edd3..4626598cb5 100644
--- a/mail/em-format-html-display.h
+++ b/mail/em-format-html-display.h
@@ -53,70 +53,20 @@ typedef struct _EMFormatHTMLDisplayClass EMFormatHTMLDisplayClass;
typedef struct _EMFormatHTMLDisplayPrivate EMFormatHTMLDisplayPrivate;
struct _EMFormatHTMLDisplay {
- EMFormatHTML formathtml;
-
+ EMFormatHTML parent;
EMFormatHTMLDisplayPrivate *priv;
struct _ESearchingTokenizer *search_tok;
-
- unsigned int animate:1;
- unsigned int caret_mode:1;
- unsigned int nobar:1;
};
-#define EM_FORMAT_HTML_DISPLAY_SEARCH_PRIMARY (0)
-#define EM_FORMAT_HTML_DISPLAY_SEARCH_SECONDARY (1)
-#define EM_FORMAT_HTML_DISPLAY_SEARCH_ICASE (1<<8)
-
struct _EMFormatHTMLDisplayClass {
- EMFormatHTMLClass formathtml_class;
-
- /* a link clicked normally */
- void (*link_clicked)(EMFormatHTMLDisplay *efhd, const char *uri);
- /* a part or a link button pressed event */
- int (*popup_event)(EMFormatHTMLDisplay *efhd, GdkEventButton *event, const char *uri, struct _CamelMimePart *part);
- /* the mouse is over a link */
- void (*on_url)(EMFormatHTMLDisplay *efhd, const char *uri);
+ EMFormatHTMLClass parent_class;
};
GType em_format_html_display_get_type (void);
EMFormatHTMLDisplay *
em_format_html_display_new (void);
-void em_format_html_display_goto_anchor
- (EMFormatHTMLDisplay *efhd,
- const char *name);
-
-void em_format_html_display_set_animate
- (EMFormatHTMLDisplay *efhd,
- gboolean state);
-void em_format_html_display_set_caret_mode
- (EMFormatHTMLDisplay *efhd,
- gboolean state);
-
-void em_format_html_display_set_search
- (EMFormatHTMLDisplay *efhd,
- int type,
- GSList *strings);
-void em_format_html_display_search (EMFormatHTMLDisplay *efhd);
-void em_format_html_display_search_with
- (EMFormatHTMLDisplay *efhd,
- char *word);
-void em_format_html_display_search_close
- (EMFormatHTMLDisplay *efhd);
-
-void em_format_html_display_cut (EMFormatHTMLDisplay *efhd);
-void em_format_html_display_copy (EMFormatHTMLDisplay *efhd);
-void em_format_html_display_paste (EMFormatHTMLDisplay *efhd);
-
-void em_format_html_display_zoom_in (EMFormatHTMLDisplay *efhd);
-void em_format_html_display_zoom_out (EMFormatHTMLDisplay *efhd);
-void em_format_html_display_zoom_reset
- (EMFormatHTMLDisplay *efhd);
-
-gboolean em_format_html_display_popup_menu
- (EMFormatHTMLDisplay *efhd);
-
G_END_DECLS
#endif /* EM_FORMAT_HTML_DISPLAY_H */
diff --git a/mail/em-format-html-print.c b/mail/em-format-html-print.c
index ef1bbb13c4..88bcb10dac 100644
--- a/mail/em-format-html-print.c
+++ b/mail/em-format-html-print.c
@@ -38,22 +38,27 @@
static gpointer parent_class = NULL;
static void
-efhp_finalize (GObject *o)
+efhp_finalize (GObject *object)
{
- EMFormatHTMLPrint *efhp = (EMFormatHTMLPrint *)o;
+ EMFormatHTMLPrint *efhp = (EMFormatHTMLPrint *)object;
gtk_widget_destroy (efhp->window);
if (efhp->source != NULL)
g_object_unref (efhp->source);
- ((GObjectClass *) parent_class)->finalize (o);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-efhp_class_init (GObjectClass *class)
+efhp_class_init (EMFormatHTMLPrintClass *class)
{
+ GObjectClass *object_class;
+
parent_class = g_type_class_peek_parent (class);
- class->finalize = efhp_finalize;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = efhp_finalize;
}
static void
@@ -93,7 +98,7 @@ em_format_html_print_get_type (void)
};
type = g_type_register_static (
- em_format_html_get_type (), "EMFormatHTMLPrint",
+ EM_TYPE_FORMAT_HTML, "EMFormatHTMLPrint",
&type_info, 0);
}
@@ -101,7 +106,8 @@ em_format_html_print_get_type (void)
}
EMFormatHTMLPrint *
-em_format_html_print_new (EMFormatHTML *source, GtkPrintOperationAction action)
+em_format_html_print_new (EMFormatHTML *source,
+ GtkPrintOperationAction action)
{
EMFormatHTMLPrint *efhp;
@@ -210,9 +216,7 @@ emfhp_got_message (CamelFolder *folder, const char *uid,
return;
}
- if (efhp->source != NULL)
- ((EMFormatHTML *)efhp)->load_http =
- efhp->source->load_http_now;
+ em_format_html_load_images (EM_FORMAT_HTML (efhp));
g_signal_connect (
efhp, "complete", G_CALLBACK (emfhp_complete), efhp);
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index aa82851bc9..6bc4a79794 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -48,7 +48,6 @@
#include "e-util/e-util.h"
#include <gtkhtml/gtkhtml.h>
-#include <gtkhtml/gtkhtml-embedded.h>
#include <gtkhtml/gtkhtml-stream.h>
#include <glib/gi18n.h>
@@ -74,7 +73,6 @@
#include <libedataserver/e-msgport.h>
-#include "mail-component.h"
#include "mail-config.h"
#include "mail-mt.h"
@@ -84,6 +82,10 @@
#define d(x)
+#define EM_FORMAT_HTML_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_FORMAT_HTML, EMFormatHTMLPrivate))
+
#define EFM_MESSAGE_START_ANAME "evolution#message#start"
#define EFH_MESSAGE_START "<A name=\"" EFM_MESSAGE_START_ANAME "\"></A>"
@@ -104,6 +106,27 @@ struct _EMFormatHTMLPrivate {
EDList pending_jobs;
GMutex *lock;
+
+ GdkColor colors[EM_FORMAT_HTML_NUM_COLOR_TYPES];
+ MailConfigHTTPMode image_loading_policy;
+
+ guint load_images_now : 1;
+ guint only_local_photos : 1;
+ guint show_sender_photo : 1;
+};
+
+enum {
+ PROP_0,
+ PROP_BODY_COLOR,
+ PROP_CITATION_COLOR,
+ PROP_CONTENT_COLOR,
+ PROP_FRAME_COLOR,
+ PROP_HEADER_COLOR,
+ PROP_IMAGE_LOADING_POLICY,
+ PROP_MARK_CITATIONS,
+ PROP_ONLY_LOCAL_PHOTOS,
+ PROP_SHOW_SENDER_PHOTO,
+ PROP_TEXT_COLOR
};
static void efh_url_requested(GtkHTML *html, const char *url, GtkHTMLStream *handle, EMFormatHTML *efh);
@@ -112,67 +135,243 @@ static void efh_gtkhtml_destroy(GtkHTML *html, EMFormatHTML *efh);
static void efh_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info);
-static void efh_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMimeMessage *msg, EMFormat *emfsource);
-static void efh_format_error(EMFormat *emf, CamelStream *stream, const char *txt);
-static void efh_format_source(EMFormat *, CamelStream *, CamelMimePart *);
-static void efh_format_attachment(EMFormat *, CamelStream *, CamelMimePart *, const char *, const EMFormatHandler *);
static void efh_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid);
-static gboolean efh_busy(EMFormat *);
static void efh_builtin_init(EMFormatHTMLClass *efhc);
static void efh_write_image(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri);
-static EMFormatClass *efh_parent;
+static gpointer parent_class;
static CamelDataCache *emfh_http_cache;
#define EMFH_HTTP_CACHE_PATH "http"
+/* Sigh, this is so we have a cancellable, async rendering thread */
+struct _format_msg {
+ MailMsg base;
+
+ EMFormatHTML *format;
+ EMFormat *format_source;
+ EMHTMLStream *estream;
+ CamelFolder *folder;
+ char *uid;
+ CamelMimeMessage *message;
+};
+
+static gchar *
+efh_format_desc (struct _format_msg *m)
+{
+ return g_strdup(_("Formatting message"));
+}
+
static void
-efh_free_cache(struct _EMFormatHTMLCache *efhc)
+efh_format_exec (struct _format_msg *m)
{
- if (efhc->textmp)
- camel_object_unref(efhc->textmp);
- g_free(efhc);
+ struct _EMFormatHTMLJob *job;
+ struct _EMFormatPURITree *puri_level;
+ int cancelled = FALSE;
+ CamelURL *base;
+
+ if (m->format->html == NULL)
+ return;
+
+ camel_stream_printf (
+ (CamelStream *)m->estream,
+ "<!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"
+ "<body bgcolor =\"#%06x\" text=\"#%06x\" marginwidth=6 marginheight=6>\n",
+ e_color_to_value (
+ &m->format->priv->colors[
+ EM_FORMAT_HTML_COLOR_BODY]),
+ e_color_to_value (
+ &m->format->priv->colors[
+ EM_FORMAT_HTML_COLOR_HEADER]));
+
+ /* <insert top-header stuff here> */
+
+ if (((EMFormat *)m->format)->mode == EM_FORMAT_SOURCE) {
+ em_format_format_source((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message);
+ } else {
+ const EMFormatHandler *handle;
+
+ handle = em_format_find_handler((EMFormat *)m->format, "x-evolution/message/prefix");
+ if (handle)
+ handle->handler((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message, handle);
+ handle = em_format_find_handler((EMFormat *)m->format, "x-evolution/message/rfc822");
+ if (handle)
+ handle->handler((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message, handle);
+ }
+
+ camel_stream_flush((CamelStream *)m->estream);
+
+ puri_level = ((EMFormat *)m->format)->pending_uri_level;
+ base = ((EMFormat *)m->format)->base;
+
+ do {
+ /* now dispatch any added tasks ... */
+ g_mutex_lock(m->format->priv->lock);
+ while ((job = (struct _EMFormatHTMLJob *)e_dlist_remhead(&m->format->priv->pending_jobs))) {
+ g_mutex_unlock(m->format->priv->lock);
+
+ /* This is an implicit check to see if the gtkhtml has been destroyed */
+ if (!cancelled)
+ cancelled = m->format->html == NULL;
+
+ /* Now do an explicit check for user cancellation */
+ if (!cancelled)
+ cancelled = camel_operation_cancel_check(NULL);
+
+ /* call jobs even if cancelled, so they can clean up resources */
+ ((EMFormat *)m->format)->pending_uri_level = job->puri_level;
+ if (job->base)
+ ((EMFormat *)m->format)->base = job->base;
+ job->callback(job, cancelled);
+ ((EMFormat *)m->format)->base = base;
+
+ /* clean up the job */
+ camel_object_unref(job->stream);
+ if (job->base)
+ camel_url_free(job->base);
+ g_free(job);
+
+ g_mutex_lock(m->format->priv->lock);
+ }
+ g_mutex_unlock(m->format->priv->lock);
+
+ if (m->estream) {
+ /* Closing this base stream can queue more jobs, so we need
+ to check the list again after we've finished */
+ d(printf("out of jobs, closing root stream\n"));
+ camel_stream_write_string((CamelStream *)m->estream, "</body>\n</html>\n");
+ camel_stream_close((CamelStream *)m->estream);
+ camel_object_unref(m->estream);
+ m->estream = NULL;
+ }
+
+ /* e_dlist_empty is atomic and doesn't need locking */
+ } while (!e_dlist_empty(&m->format->priv->pending_jobs));
+
+ d(printf("out of jobs, done\n"));
+
+ ((EMFormat *)m->format)->pending_uri_level = puri_level;
}
static void
-efh_init(GObject *o)
+efh_format_done (struct _format_msg *m)
{
- EMFormatHTML *efh = (EMFormatHTML *)o;
+ d(printf("formatting finished\n"));
- efh->priv = g_malloc0(sizeof(*efh->priv));
+ m->format->priv->format_id = -1;
+ m->format->priv->load_images_now = FALSE;
+ m->format->state = EM_FORMAT_HTML_STATE_NONE;
+ g_signal_emit_by_name(m->format, "complete");
+}
- e_dlist_init(&efh->pending_object_list);
- e_dlist_init(&efh->priv->pending_jobs);
- efh->priv->lock = g_mutex_new();
- efh->priv->format_id = -1;
- efh->priv->text_inline_parts = g_hash_table_new_full (
- g_str_hash, g_str_equal,
- (GDestroyNotify) NULL,
- (GDestroyNotify) efh_free_cache);
+static void
+efh_format_free (struct _format_msg *m)
+{
+ d(printf("formatter freed\n"));
+ g_object_unref(m->format);
+ if (m->estream) {
+ camel_stream_close((CamelStream *)m->estream);
+ camel_object_unref(m->estream);
+ }
+ if (m->folder)
+ camel_object_unref(m->folder);
+ g_free(m->uid);
+ if (m->message)
+ camel_object_unref(m->message);
+ if (m->format_source)
+ g_object_unref(m->format_source);
+}
- efh->html = (GtkHTML *)gtk_html_new();
- gtk_html_set_blocking(efh->html, FALSE);
- gtk_html_set_caret_first_focus_anchor (efh->html, EFM_MESSAGE_START_ANAME);
- g_object_ref_sink(efh->html);
-
- gtk_html_set_default_content_type(efh->html, "text/html; charset=utf-8");
- gtk_html_set_editable(efh->html, FALSE);
-
- g_signal_connect(efh->html, "destroy", G_CALLBACK(efh_gtkhtml_destroy), efh);
- g_signal_connect(efh->html, "url_requested", G_CALLBACK(efh_url_requested), efh);
- g_signal_connect(efh->html, "object_requested", G_CALLBACK(efh_object_requested), efh);
-
- efh->body_colour = 0xeeeeee;
- efh->header_colour = 0xeeeeee;
- efh->text_colour = 0;
- efh->frame_colour = 0x3f3f3f;
- efh->content_colour = 0xffffff;
- efh->text_html_flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES
- | CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
- efh->show_icon = TRUE;
- efh->state = EM_FORMAT_HTML_STATE_NONE;
+static MailMsgInfo efh_format_info = {
+ sizeof (struct _format_msg),
+ (MailMsgDescFunc) efh_format_desc,
+ (MailMsgExecFunc) efh_format_exec,
+ (MailMsgDoneFunc) efh_format_done,
+ (MailMsgFreeFunc) efh_format_free
+};
+
+static gboolean
+efh_format_timeout(struct _format_msg *m)
+{
+ GtkHTMLStream *hstream;
+ EMFormatHTML *efh = m->format;
+ struct _EMFormatHTMLPrivate *p = efh->priv;
+
+ if (m->format->html == NULL) {
+ mail_msg_unref(m);
+ return FALSE;
+ }
+
+ d(printf("timeout called ...\n"));
+ if (p->format_id != -1) {
+ d(printf(" still waiting for cancellation to take effect, waiting ...\n"));
+ return TRUE;
+ }
+
+ g_return_val_if_fail (e_dlist_empty(&p->pending_jobs), FALSE);
+
+ d(printf(" ready to go, firing off format thread\n"));
+
+ /* call super-class to kick it off */
+ EM_FORMAT_CLASS (parent_class)->format_clone (
+ EM_FORMAT (efh), m->folder, m->uid,
+ m->message, m->format_source);
+ em_format_html_clear_pobject(m->format);
+
+ /* FIXME: method off EMFormat? */
+ if (((EMFormat *)efh)->valid) {
+ camel_cipher_validity_free(((EMFormat *)efh)->valid);
+ ((EMFormat *)efh)->valid = NULL;
+ ((EMFormat *)efh)->valid_parent = NULL;
+ }
+
+ if (m->message == NULL) {
+ hstream = gtk_html_begin(efh->html);
+ gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK);
+ mail_msg_unref(m);
+ p->last_part = NULL;
+ } else {
+ efh->state = EM_FORMAT_HTML_STATE_RENDERING;
+
+ if (p->last_part != m->message) {
+ hstream = gtk_html_begin (efh->html);
+ gtk_html_stream_printf (hstream, "<h5>%s</h5>", _("Formatting Message..."));
+ gtk_html_stream_close (hstream, GTK_HTML_STREAM_OK);
+ }
+
+ hstream = NULL;
+ m->estream = (EMHTMLStream *)em_html_stream_new(efh->html, hstream);
+
+ if (p->last_part == m->message) {
+ em_html_stream_set_flags (m->estream,
+ GTK_HTML_BEGIN_KEEP_SCROLL | GTK_HTML_BEGIN_KEEP_IMAGES
+ | GTK_HTML_BEGIN_BLOCK_UPDATES | GTK_HTML_BEGIN_BLOCK_IMAGES);
+ } else {
+ /* clear cache of inline-scanned text parts */
+ g_hash_table_remove_all(p->text_inline_parts);
+
+ p->last_part = m->message;
+ }
+
+ efh->priv->format_id = m->base.seq;
+ mail_msg_unordered_push (m);
+ }
+
+ efh->priv->format_timeout_id = 0;
+ efh->priv->format_timeout_msg = NULL;
+
+ return FALSE;
+}
+
+static void
+efh_free_cache(struct _EMFormatHTMLCache *efhc)
+{
+ if (efhc->textmp)
+ camel_object_unref(efhc->textmp);
+ g_free(efhc);
}
static void
@@ -189,8 +388,8 @@ efh_gtkhtml_destroy(GtkHTML *html, EMFormatHTML *efh)
if (efh->priv->format_id != -1)
mail_msg_cancel(efh->priv->format_id);
- if (efh->html) {
- g_object_unref(efh->html);
+ if (efh->html != NULL) {
+ g_object_unref (efh->html);
efh->html = NULL;
}
}
@@ -207,124 +406,720 @@ efh_insert_cache(EMFormatHTML *efh, const char *partid)
return efhc;
}
+static void
+efh_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_BODY_COLOR:
+ em_format_html_set_color (
+ EM_FORMAT_HTML (object),
+ EM_FORMAT_HTML_COLOR_BODY,
+ g_value_get_boxed (value));
+ return;
+
+ case PROP_CITATION_COLOR:
+ em_format_html_set_color (
+ EM_FORMAT_HTML (object),
+ EM_FORMAT_HTML_COLOR_CITATION,
+ g_value_get_boxed (value));
+ return;
+
+ case PROP_CONTENT_COLOR:
+ em_format_html_set_color (
+ EM_FORMAT_HTML (object),
+ EM_FORMAT_HTML_COLOR_CONTENT,
+ g_value_get_boxed (value));
+ return;
+
+ case PROP_FRAME_COLOR:
+ em_format_html_set_color (
+ EM_FORMAT_HTML (object),
+ EM_FORMAT_HTML_COLOR_FRAME,
+ g_value_get_boxed (value));
+ return;
+
+ case PROP_HEADER_COLOR:
+ em_format_html_set_color (
+ EM_FORMAT_HTML (object),
+ EM_FORMAT_HTML_COLOR_HEADER,
+ g_value_get_boxed (value));
+ return;
+
+ case PROP_IMAGE_LOADING_POLICY:
+ em_format_html_set_image_loading_policy (
+ EM_FORMAT_HTML (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_MARK_CITATIONS:
+ em_format_html_set_mark_citations (
+ EM_FORMAT_HTML (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_ONLY_LOCAL_PHOTOS:
+ em_format_html_set_only_local_photos (
+ EM_FORMAT_HTML (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_SHOW_SENDER_PHOTO:
+ em_format_html_set_show_sender_photo (
+ EM_FORMAT_HTML (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_TEXT_COLOR:
+ em_format_html_set_color (
+ EM_FORMAT_HTML (object),
+ EM_FORMAT_HTML_COLOR_TEXT,
+ g_value_get_boxed (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
static void
-efh_finalise(GObject *o)
+efh_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- EMFormatHTML *efh = (EMFormatHTML *)o;
+ GdkColor color;
+
+ switch (property_id) {
+ case PROP_BODY_COLOR:
+ em_format_html_get_color (
+ EM_FORMAT_HTML (object),
+ EM_FORMAT_HTML_COLOR_BODY,
+ &color);
+ g_value_set_boxed (value, &color);
+ return;
+
+ case PROP_CITATION_COLOR:
+ em_format_html_get_color (
+ EM_FORMAT_HTML (object),
+ EM_FORMAT_HTML_COLOR_CITATION,
+ &color);
+ g_value_set_boxed (value, &color);
+ return;
+
+ case PROP_CONTENT_COLOR:
+ em_format_html_get_color (
+ EM_FORMAT_HTML (object),
+ EM_FORMAT_HTML_COLOR_CONTENT,
+ &color);
+ g_value_set_boxed (value, &color);
+ return;
+
+ case PROP_FRAME_COLOR:
+ em_format_html_get_color (
+ EM_FORMAT_HTML (object),
+ EM_FORMAT_HTML_COLOR_FRAME,
+ &color);
+ g_value_set_boxed (value, &color);
+ return;
+
+ case PROP_HEADER_COLOR:
+ em_format_html_get_color (
+ EM_FORMAT_HTML (object),
+ EM_FORMAT_HTML_COLOR_HEADER,
+ &color);
+ g_value_set_boxed (value, &color);
+ return;
+
+ case PROP_IMAGE_LOADING_POLICY:
+ g_value_set_int (
+ value,
+ em_format_html_get_image_loading_policy (
+ EM_FORMAT_HTML (object)));
+ return;
+
+ case PROP_MARK_CITATIONS:
+ g_value_set_boolean (
+ value, em_format_html_get_mark_citations (
+ EM_FORMAT_HTML (object)));
+ return;
+
+ case PROP_ONLY_LOCAL_PHOTOS:
+ g_value_set_boolean (
+ value, em_format_html_get_only_local_photos (
+ EM_FORMAT_HTML (object)));
+ return;
+
+ case PROP_SHOW_SENDER_PHOTO:
+ g_value_set_boolean (
+ value, em_format_html_get_show_sender_photo (
+ EM_FORMAT_HTML (object)));
+ return;
+
+ case PROP_TEXT_COLOR:
+ em_format_html_get_color (
+ EM_FORMAT_HTML (object),
+ EM_FORMAT_HTML_COLOR_TEXT,
+ &color);
+ g_value_set_boxed (value, &color);
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+efh_finalize (GObject *object)
+{
+ EMFormatHTML *efh = EM_FORMAT_HTML (object);
/* FIXME: check for leaked stuff */
- em_format_html_clear_pobject(efh);
+ em_format_html_clear_pobject (efh);
+ efh_gtkhtml_destroy (efh->html, efh);
+
+ g_hash_table_destroy (efh->priv->text_inline_parts);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+efh_format_clone (EMFormat *emf,
+ CamelFolder *folder,
+ const gchar *uid,
+ CamelMimeMessage *msg,
+ EMFormat *emfsource)
+{
+ EMFormatHTML *efh = EM_FORMAT_HTML (emf);
+ struct _format_msg *m;
+
+ /* How to sub-class ? Might need to adjust api ... */
+
+ if (efh->html == NULL)
+ return;
+
+ d(printf("efh_format called\n"));
+ if (efh->priv->format_timeout_id != 0) {
+ d(printf(" timeout for last still active, removing ...\n"));
+ g_source_remove(efh->priv->format_timeout_id);
+ efh->priv->format_timeout_id = 0;
+ mail_msg_unref(efh->priv->format_timeout_msg);
+ efh->priv->format_timeout_msg = NULL;
+ }
+
+ if (emfsource != NULL)
+ g_object_ref (emfsource);
+
+ if (folder != NULL)
+ camel_object_ref (folder);
+
+ if (msg != NULL)
+ camel_object_ref (msg);
+
+ m = mail_msg_new (&efh_format_info);
+ m->format = g_object_ref (emf);
+ m->format_source = emfsource;
+ m->folder = folder;
+ m->uid = g_strdup (uid);
+ m->message = msg;
+
+ if (efh->priv->format_id == -1) {
+ d(printf(" idle, forcing format\n"));
+ efh_format_timeout (m);
+ } else {
+ d(printf(" still busy, cancelling and queuing wait\n"));
+ /* cancel and poll for completion */
+ mail_msg_cancel (efh->priv->format_id);
+ efh->priv->format_timeout_msg = m;
+ efh->priv->format_timeout_id = g_timeout_add (
+ 100, (GSourceFunc) efh_format_timeout, m);
+ }
+}
+
+static void
+efh_format_error (EMFormat *emf,
+ CamelStream *stream,
+ const gchar *txt)
+{
+ gchar *html;
+
+ html = camel_text_to_html (
+ txt, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
+ camel_stream_printf (
+ stream, "<em><font color=\"red\">%s</font></em><br>", html);
+ g_free (html);
+}
+
+static void
+efh_format_source (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *part)
+{
+ CamelStreamFilter *filtered_stream;
+ CamelMimeFilter *filter;
+ CamelDataWrapper *dw = (CamelDataWrapper *) part;
+
+ filtered_stream = camel_stream_filter_new_with_stream (stream);
+
+ filter = camel_mime_filter_tohtml_new (
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
+ CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT, 0);
+ camel_stream_filter_add (filtered_stream, filter);
+ camel_object_unref (filter);
+
+ camel_stream_write_string (stream, "<table><tr><td><tt>");
+ em_format_format_text (emf, (CamelStream *) filtered_stream, dw);
+ camel_object_unref (filtered_stream);
+
+ camel_stream_write_string(stream, "</tt></td></tr></table>");
+}
+
+static void
+efh_format_attachment (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *part,
+ const gchar *mime_type,
+ const EMFormatHandler *handle)
+{
+ char *text, *html;
- efh_gtkhtml_destroy(efh->html, efh);
+ /* we display all inlined attachments only */
- g_hash_table_destroy(efh->priv->text_inline_parts);
+ /* this could probably be cleaned up ... */
+ camel_stream_write_string (
+ stream,
+ "<table border=1 cellspacing=0 cellpadding=0><tr><td>"
+ "<table width=10 cellspacing=0 cellpadding=0>"
+ "<tr><td></td></tr></table></td>"
+ "<td><table width=3 cellspacing=0 cellpadding=0>"
+ "<tr><td></td></tr></table></td><td><font size=-1>\n");
- g_free(efh->priv);
+ /* output some info about it */
+ text = em_format_describe_part(part, mime_type);
+ html = camel_text_to_html (
+ text, ((EMFormatHTML *)emf)->text_html_flags &
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
+ camel_stream_write_string (stream, html);
+ g_free (html);
+ g_free (text);
- ((GObjectClass *)efh_parent)->finalize(o);
+ camel_stream_write_string (stream, "</font></td></tr><tr></table>");
+
+ if (handle && em_format_is_inline (emf, emf->part_id->str, part, handle))
+ handle->handler (emf, stream, part, handle);
}
+static gboolean
+efh_busy (EMFormat *emf)
+{
+ EMFormatHTMLPrivate *priv;
+
+ priv = EM_FORMAT_HTML_GET_PRIVATE (emf);
+
+ return (priv->format_id != -1);
+}
static void
-efh_base_init(EMFormatHTMLClass *efhklass)
+efh_base_init (EMFormatHTMLClass *class)
{
- efh_builtin_init(efhklass);
+ efh_builtin_init (class);
}
static void
-efh_class_init(GObjectClass *klass)
+efh_class_init (EMFormatHTMLClass *class)
{
- ((EMFormatClass *)klass)->format_clone = efh_format_clone;
- ((EMFormatClass *)klass)->format_error = efh_format_error;
- ((EMFormatClass *)klass)->format_source = efh_format_source;
- ((EMFormatClass *)klass)->format_attachment = efh_format_attachment;
- ((EMFormatClass *)klass)->format_secure = efh_format_secure;
- ((EMFormatClass *)klass)->busy = efh_busy;
-
- klass->finalize = efh_finalise;
+ GObjectClass *object_class;
+ EMFormatClass *format_class;
+ gchar *pathname;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMFormatHTMLPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = efh_set_property;
+ object_class->get_property = efh_get_property;
+ object_class->finalize = efh_finalize;
+
+ format_class = EM_FORMAT_CLASS (class);
+ format_class->format_clone = efh_format_clone;
+ format_class->format_error = efh_format_error;
+ format_class->format_source = efh_format_source;
+ format_class->format_attachment = efh_format_attachment;
+ format_class->format_secure = efh_format_secure;
+ format_class->busy = efh_busy;
+
+ class->html_widget_type = GTK_TYPE_HTML;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_BODY_COLOR,
+ g_param_spec_boxed (
+ "body-color",
+ "Body Color",
+ NULL,
+ GDK_TYPE_COLOR,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CITATION_COLOR,
+ g_param_spec_boxed (
+ "citation-color",
+ "Citation Color",
+ NULL,
+ GDK_TYPE_COLOR,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CONTENT_COLOR,
+ g_param_spec_boxed (
+ "content-color",
+ "Content Color",
+ NULL,
+ GDK_TYPE_COLOR,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FRAME_COLOR,
+ g_param_spec_boxed (
+ "frame-color",
+ "Frame Color",
+ NULL,
+ GDK_TYPE_COLOR,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_HEADER_COLOR,
+ g_param_spec_boxed (
+ "header-color",
+ "Header Color",
+ NULL,
+ GDK_TYPE_COLOR,
+ G_PARAM_READWRITE));
+
+ /* FIXME Make this a proper enum property. */
+ g_object_class_install_property (
+ object_class,
+ PROP_IMAGE_LOADING_POLICY,
+ g_param_spec_int (
+ "image-loading-policy",
+ "Image Loading Policy",
+ NULL,
+ 0,
+ G_MAXINT,
+ MAIL_CONFIG_HTTP_ALWAYS,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MARK_CITATIONS,
+ g_param_spec_boolean (
+ "mark-citations",
+ "Mark Citations",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ONLY_LOCAL_PHOTOS,
+ g_param_spec_boolean (
+ "only-local-photos",
+ "Only Local Photos",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHOW_SENDER_PHOTO,
+ g_param_spec_boolean (
+ "show-sender-photo",
+ "Show Sender Photo",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_TEXT_COLOR,
+ g_param_spec_boxed (
+ "text-color",
+ "Text Color",
+ NULL,
+ GDK_TYPE_COLOR,
+ G_PARAM_READWRITE));
+
+ /* cache expiry - 2 hour access, 1 day max */
+ pathname = g_build_filename (
+ e_get_user_data_dir (), "cache", NULL);
+ emfh_http_cache = camel_data_cache_new (pathname, 0, NULL);
+ if (emfh_http_cache) {
+ camel_data_cache_set_expire_age(emfh_http_cache, 24*60*60);
+ camel_data_cache_set_expire_access(emfh_http_cache, 2*60*60);
+ }
+ g_free (pathname);
+}
+
+static void
+efh_init (EMFormatHTML *efh,
+ EMFormatHTMLClass *class)
+{
+ GtkHTML *html;
+ GdkColor *color;
+
+ efh->priv = EM_FORMAT_HTML_GET_PRIVATE (efh);
+
+ e_dlist_init(&efh->pending_object_list);
+ e_dlist_init(&efh->priv->pending_jobs);
+ efh->priv->lock = g_mutex_new();
+ efh->priv->format_id = -1;
+ efh->priv->text_inline_parts = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) NULL,
+ (GDestroyNotify) efh_free_cache);
+
+ html = g_object_new (class->html_widget_type, NULL);
+ efh->html = g_object_ref_sink (html);
+
+ gtk_html_set_blocking (html, FALSE);
+ gtk_html_set_caret_first_focus_anchor (html, EFM_MESSAGE_START_ANAME);
+ gtk_html_set_default_content_type (html, "text/html; charset=utf-8");
+ gtk_html_set_editable (html, FALSE);
+
+ g_signal_connect (
+ html, "url-requested",
+ G_CALLBACK (efh_url_requested), efh);
+ g_signal_connect (
+ html, "object-requested",
+ G_CALLBACK (efh_object_requested), efh);
+
+ color = &efh->priv->colors[EM_FORMAT_HTML_COLOR_BODY];
+ gdk_color_parse ("#eeeeee", color);
+
+ color = &efh->priv->colors[EM_FORMAT_HTML_COLOR_CONTENT];
+ gdk_color_parse ("#ffffff", color);
+
+ color = &efh->priv->colors[EM_FORMAT_HTML_COLOR_FRAME];
+ gdk_color_parse ("#3f3f3f", color);
+
+ color = &efh->priv->colors[EM_FORMAT_HTML_COLOR_HEADER];
+ gdk_color_parse ("#eeeeee", color);
+
+ color = &efh->priv->colors[EM_FORMAT_HTML_COLOR_TEXT];
+ gdk_color_parse ("#000000", color);
+
+ efh->text_html_flags =
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
+ CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
+ efh->show_icon = TRUE;
+ efh->state = EM_FORMAT_HTML_STATE_NONE;
+
+ g_signal_connect_swapped (
+ efh, "notify::mark-citations",
+ G_CALLBACK (em_format_redraw), NULL);
}
GType
-em_format_html_get_type(void)
+em_format_html_get_type (void)
{
static GType type = 0;
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(EMFormatHTMLClass),
- (GBaseInitFunc)efh_base_init, NULL,
- (GClassInitFunc)efh_class_init,
- NULL, NULL,
- sizeof(EMFormatHTML), 0,
- (GInstanceInitFunc)efh_init
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMFormatHTMLClass),
+ (GBaseInitFunc) efh_base_init,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) efh_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMFormatHTML),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) efh_init,
+ NULL /* value_table */
};
- const char *base_directory = e_get_user_data_dir ();
- char *path;
-
- /* Trigger creation of mail component. */
- mail_component_peek ();
-
- efh_parent = g_type_class_ref(em_format_get_type());
- type = g_type_register_static(em_format_get_type(), "EMFormatHTML", &info, 0);
- /* cache expiry - 2 hour access, 1 day max */
- path = alloca(strlen(base_directory)+16);
- sprintf(path, "%s/cache", base_directory);
- emfh_http_cache = camel_data_cache_new(path, 0, NULL);
- if (emfh_http_cache) {
- camel_data_cache_set_expire_age(emfh_http_cache, 24*60*60);
- camel_data_cache_set_expire_access(emfh_http_cache, 2*60*60);
- }
+ type = g_type_register_static (
+ em_format_get_type(), "EMFormatHTML",
+ &type_info, G_TYPE_FLAG_ABSTRACT);
}
return type;
}
-EMFormatHTML *em_format_html_new(void)
+void
+em_format_html_load_images (EMFormatHTML *efh)
{
- EMFormatHTML *efh;
+ g_return_if_fail (EM_IS_FORMAT_HTML (efh));
- efh = g_object_new(em_format_html_get_type(), NULL);
+ if (efh->priv->image_loading_policy == MAIL_CONFIG_HTTP_ALWAYS)
+ return;
- return efh;
+ /* This will remain set while we're still
+ * rendering the same message, then it wont be. */
+ efh->priv->load_images_now = TRUE;
+ em_format_redraw (EM_FORMAT (efh));
}
-/* force loading of http images */
-void em_format_html_load_http(EMFormatHTML *emfh)
+void
+em_format_html_get_color (EMFormatHTML *efh,
+ EMFormatHTMLColorType type,
+ GdkColor *color)
{
- if (emfh->load_http == MAIL_CONFIG_HTTP_ALWAYS)
- return;
+ GdkColor *format_color;
+
+ g_return_if_fail (EM_IS_FORMAT_HTML (efh));
+ g_return_if_fail (type < EM_FORMAT_HTML_NUM_COLOR_TYPES);
+ g_return_if_fail (color != NULL);
- /* This will remain set while we're still rendering the same message, then it wont be */
- emfh->load_http_now = TRUE;
- d(printf("redrawing with images forced on\n"));
- em_format_redraw((EMFormat *)emfh);
+ format_color = &efh->priv->colors[type];
+
+ color->red = format_color->red;
+ color->green = format_color->green;
+ color->blue = format_color->blue;
}
void
-em_format_html_set_load_http(EMFormatHTML *emfh, int style)
+em_format_html_set_color (EMFormatHTML *efh,
+ EMFormatHTMLColorType type,
+ const GdkColor *color)
{
- if (emfh->load_http != style) {
- emfh->load_http = style;
- em_format_redraw((EMFormat *)emfh);
+ GdkColor *format_color;
+ const gchar *property_name;
+
+ g_return_if_fail (EM_IS_FORMAT_HTML (efh));
+ g_return_if_fail (type < EM_FORMAT_HTML_NUM_COLOR_TYPES);
+ g_return_if_fail (color != NULL);
+
+ format_color = &efh->priv->colors[type];
+
+ if (gdk_color_equal (color, format_color))
+ return;
+
+ format_color->red = color->red;
+ format_color->green = color->green;
+ format_color->blue = color->blue;
+
+ switch (type) {
+ case EM_FORMAT_HTML_COLOR_BODY:
+ property_name = "body-color";
+ break;
+ case EM_FORMAT_HTML_COLOR_CITATION:
+ property_name = "citation-color";
+ break;
+ case EM_FORMAT_HTML_COLOR_CONTENT:
+ property_name = "content-color";
+ break;
+ case EM_FORMAT_HTML_COLOR_FRAME:
+ property_name = "frame-color";
+ break;
+ case EM_FORMAT_HTML_COLOR_HEADER:
+ property_name = "header-color";
+ break;
+ case EM_FORMAT_HTML_COLOR_TEXT:
+ property_name = "text-color";
+ break;
+ default:
+ g_return_if_reached ();
}
+
+ g_object_notify (G_OBJECT (efh), property_name);
+}
+
+MailConfigHTTPMode
+em_format_html_get_image_loading_policy (EMFormatHTML *efh)
+{
+ g_return_val_if_fail (EM_IS_FORMAT_HTML (efh), 0);
+
+ return efh->priv->image_loading_policy;
}
void
-em_format_html_set_mark_citations(EMFormatHTML *emfh, int state, guint32 citation_colour)
+em_format_html_set_image_loading_policy (EMFormatHTML *efh,
+ MailConfigHTTPMode policy)
{
- if (emfh->mark_citations ^ state || emfh->citation_colour != citation_colour) {
- emfh->mark_citations = state;
- emfh->citation_colour = citation_colour;
+ g_return_if_fail (EM_IS_FORMAT_HTML (efh));
- if (state)
- emfh->text_html_flags |= CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
- else
- emfh->text_html_flags &= ~CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
+ if (policy == efh->priv->image_loading_policy)
+ return;
- em_format_redraw((EMFormat *)emfh);
- }
+ efh->priv->image_loading_policy = policy;
+
+ g_object_notify (G_OBJECT (efh), "image-loading-policy");
+}
+
+gboolean
+em_format_html_get_mark_citations (EMFormatHTML *efh)
+{
+ guint32 flags;
+
+ g_return_val_if_fail (EM_IS_FORMAT_HTML (efh), FALSE);
+
+ flags = efh->text_html_flags;
+
+ return ((flags & CAMEL_MIME_FILTER_TOHTML_MARK_CITATION) != 0);
+}
+
+void
+em_format_html_set_mark_citations (EMFormatHTML *efh,
+ gboolean mark_citations)
+{
+ g_return_if_fail (EM_IS_FORMAT_HTML (efh));
+
+ if (mark_citations)
+ efh->text_html_flags |=
+ CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
+ efh->text_html_flags &=
+ ~CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
+
+ g_object_notify (G_OBJECT (efh), "mark-citations");
+}
+
+gboolean
+em_format_html_get_only_local_photos (EMFormatHTML *efh)
+{
+ g_return_val_if_fail (EM_IS_FORMAT_HTML (efh), FALSE);
+
+ return efh->priv->only_local_photos;
+}
+
+void
+em_format_html_set_only_local_photos (EMFormatHTML *efh,
+ gboolean only_local_photos)
+{
+ g_return_if_fail (EM_IS_FORMAT_HTML (efh));
+
+ efh->priv->only_local_photos = only_local_photos;
+
+ g_object_notify (G_OBJECT (efh), "only-local-photos");
+}
+
+gboolean
+em_format_html_get_show_sender_photo (EMFormatHTML *efh)
+{
+ g_return_val_if_fail (EM_IS_FORMAT_HTML (efh), FALSE);
+
+ return efh->priv->show_sender_photo;
+}
+
+void
+em_format_html_set_show_sender_photo (EMFormatHTML *efh,
+ gboolean show_sender_photo)
+{
+ g_return_if_fail (EM_IS_FORMAT_HTML (efh));
+
+ efh->priv->show_sender_photo = show_sender_photo;
+
+ g_object_notify (G_OBJECT (efh), "show-sender-photo");
}
CamelMimePart *
@@ -482,13 +1277,15 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, int cancelled)
instream = cistream = camel_data_cache_get(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL);
if (instream == NULL) {
+ MailConfigHTTPMode policy;
char *proxy;
+ policy = em_format_html_get_image_loading_policy (job->format);
- if (!(job->format->load_http_now
- || job->format->load_http == MAIL_CONFIG_HTTP_ALWAYS
- || (job->format->load_http == MAIL_CONFIG_HTTP_SOMETIMES
- && em_utils_in_addressbook((CamelInternetAddress *)camel_mime_message_get_from(job->format->format.message), FALSE)))) {
+ if (!(job->format->priv->load_images_now
+ || policy == MAIL_CONFIG_HTTP_ALWAYS
+ || (policy == MAIL_CONFIG_HTTP_SOMETIMES
+ && em_utils_in_addressbook((CamelInternetAddress *)camel_mime_message_get_from(job->format->parent.message), FALSE)))) {
/* TODO: Ideally we would put the http requests into another queue and only send them out
if the user selects 'load images', when they do. The problem is how to maintain this
state with multiple renderings, and how to adjust the thread dispatch/setup routine to handle it */
@@ -677,7 +1474,11 @@ static const char *smime_sign_colour[4] = {
static void
efh_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid)
{
- efh_parent->format_secure(emf, stream, part, valid);
+ EMFormatClass *format_class;
+
+ format_class = EM_FORMAT_GET_CLASS (emf);
+ g_return_if_fail (format_class->format_secure != NULL);
+ format_class->format_secure (emf, stream, part, valid);
/* To explain, if the validity is the same, then we are the
base validity and now have a combined sign/encrypt validity
@@ -731,6 +1532,7 @@ efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo
CamelContentType *type;
const char *format;
guint32 flags;
+ guint32 rgb;
int i, count, len;
struct _EMFormatHTMLCache *efhc;
@@ -787,8 +1589,10 @@ efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo
camel_content_type_unref(ct);
}
+ rgb = e_color_to_value (
+ &efh->priv->colors[EM_FORMAT_HTML_COLOR_CITATION]);
filtered_stream = camel_stream_filter_new_with_stream(stream);
- html_filter = camel_mime_filter_tohtml_new(flags, efh->citation_colour);
+ html_filter = camel_mime_filter_tohtml_new(flags, rgb);
camel_stream_filter_add(filtered_stream, html_filter);
camel_object_unref(html_filter);
@@ -804,9 +1608,17 @@ efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo
type = camel_mime_part_get_content_type(newpart);
if (camel_content_type_is (type, "text", "*") && !camel_content_type_is(type, "text", "calendar")) {
- camel_stream_printf (stream,
- "<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n",
- efh->frame_colour & 0xffffff, efh->content_colour & 0xffffff, efh->text_colour & 0xffffff);
+ camel_stream_printf (
+ stream, "<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n",
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_FRAME]),
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_CONTENT]),
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_TEXT]));
camel_stream_write_string(stream, "<tt>\n" EFH_MESSAGE_START);
em_format_format_text((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)newpart);
camel_stream_flush((CamelStream *)filtered_stream);
@@ -844,9 +1656,17 @@ efh_text_enriched(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, E
camel_stream_filter_add(filtered_stream, enriched);
camel_object_unref(enriched);
- camel_stream_printf (stream,
- "<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n" EFH_MESSAGE_START,
- efh->frame_colour & 0xffffff, efh->content_colour & 0xffffff, efh->text_colour & 0xffffff);
+ camel_stream_printf (
+ stream, "<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n" EFH_MESSAGE_START,
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_FRAME]),
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_CONTENT]),
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_TEXT]));
em_format_format_text((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part);
@@ -881,10 +1701,18 @@ efh_text_html(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFor
EMFormatPURI *puri;
char *cid = NULL;
- camel_stream_printf (stream,
- "<div style=\"border: solid #%06x 1px; background-color: #%06x; color: #%06x;\">\n"
- "<!-- text/html -->\n" EFH_MESSAGE_START,
- efh->frame_colour & 0xffffff, efh->content_colour & 0xffffff, efh->text_colour & 0xffffff);
+ camel_stream_printf (
+ stream, "<div style=\"border: solid #%06x 1px; background-color: #%06x; color: #%06x;\">\n"
+ "<!-- text/html -->\n" EFH_MESSAGE_START,
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_FRAME]),
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_CONTENT]),
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_TEXT]));
/* TODO: perhaps we don't need to calculate this anymore now base is handled better */
/* calculate our own location string so add_puri doesn't do it
@@ -1021,9 +1849,17 @@ efh_message_deliverystatus(EMFormatHTML *efh, CamelStream *stream, CamelMimePart
guint32 rgb = 0x737373;
/* Yuck, this is copied from efh_text_plain */
- camel_stream_printf (stream,
- "<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n",
- efh->frame_colour & 0xffffff, efh->content_colour & 0xffffff, efh->text_colour & 0xffffff);
+ camel_stream_printf (
+ stream, "<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n",
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_FRAME]),
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_CONTENT]),
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_TEXT]));
filtered_stream = camel_stream_filter_new_with_stream(stream);
html_filter = camel_mime_filter_tohtml_new(efh->text_html_flags, rgb);
@@ -1215,284 +2051,17 @@ static EMFormatHandler type_builtin_table[] = {
static void
efh_builtin_init(EMFormatHTMLClass *efhc)
{
- int i;
-
- for (i=0;i<sizeof(type_builtin_table)/sizeof(type_builtin_table[0]);i++)
- em_format_class_add_handler((EMFormatClass *)efhc, &type_builtin_table[i]);
-}
-
-/* ********************************************************************** */
+ EMFormatClass *efc;
+ gint ii;
-/* Sigh, this is so we have a cancellable, async rendering thread */
-struct _format_msg {
- MailMsg base;
+ efc = (EMFormatClass *) efhc;
- EMFormatHTML *format;
- EMFormat *format_source;
- EMHTMLStream *estream;
- CamelFolder *folder;
- char *uid;
- CamelMimeMessage *message;
-};
-
-static gchar *
-efh_format_desc (struct _format_msg *m)
-{
- return g_strdup(_("Formatting message"));
+ for (ii = 0; ii < G_N_ELEMENTS (type_builtin_table); ii++)
+ em_format_class_add_handler (
+ efc, &type_builtin_table[ii]);
}
-static void
-efh_format_exec (struct _format_msg *m)
-{
- struct _EMFormatHTMLJob *job;
- struct _EMFormatPURITree *puri_level;
- int cancelled = FALSE;
- CamelURL *base;
-
- if (m->format->html == NULL)
- return;
-
- camel_stream_printf((CamelStream *)m->estream,
- "<!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"
- "<body bgcolor =\"#%06x\" text=\"#%06x\" marginwidth=6 marginheight=6>\n",
- m->format->body_colour & 0xffffff,
- m->format->header_colour & 0xffffff);
-
- /* <insert top-header stuff here> */
-
- if (((EMFormat *)m->format)->mode == EM_FORMAT_SOURCE) {
- em_format_format_source((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message);
- } else {
- const EMFormatHandler *handle;
-
- handle = em_format_find_handler((EMFormat *)m->format, "x-evolution/message/prefix");
- if (handle)
- handle->handler((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message, handle);
- handle = em_format_find_handler((EMFormat *)m->format, "x-evolution/message/rfc822");
- if (handle)
- handle->handler((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message, handle);
- handle = em_format_find_handler((EMFormat *)m->format, "x-evolution/message/post-header-closure");
- if (handle && !((EMFormat *)m->format)->print)
- handle->handler((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message, handle);
-
- }
-
- camel_stream_flush((CamelStream *)m->estream);
-
- puri_level = ((EMFormat *)m->format)->pending_uri_level;
- base = ((EMFormat *)m->format)->base;
-
- do {
- /* now dispatch any added tasks ... */
- g_mutex_lock(m->format->priv->lock);
- while ((job = (struct _EMFormatHTMLJob *)e_dlist_remhead(&m->format->priv->pending_jobs))) {
- g_mutex_unlock(m->format->priv->lock);
-
- /* This is an implicit check to see if the gtkhtml has been destroyed */
- if (!cancelled)
- cancelled = m->format->html == NULL;
-
- /* Now do an explicit check for user cancellation */
- if (!cancelled)
- cancelled = camel_operation_cancel_check(NULL);
-
- /* call jobs even if cancelled, so they can clean up resources */
- ((EMFormat *)m->format)->pending_uri_level = job->puri_level;
- if (job->base)
- ((EMFormat *)m->format)->base = job->base;
- job->callback(job, cancelled);
- ((EMFormat *)m->format)->base = base;
-
- /* clean up the job */
- camel_object_unref(job->stream);
- if (job->base)
- camel_url_free(job->base);
- g_free(job);
-
- g_mutex_lock(m->format->priv->lock);
- }
- g_mutex_unlock(m->format->priv->lock);
-
- if (m->estream) {
- /* Closing this base stream can queue more jobs, so we need
- to check the list again after we've finished */
- d(printf("out of jobs, closing root stream\n"));
- camel_stream_write_string((CamelStream *)m->estream, "</body>\n</html>\n");
- camel_stream_close((CamelStream *)m->estream);
- camel_object_unref(m->estream);
- m->estream = NULL;
- }
-
- /* e_dlist_empty is atomic and doesn't need locking */
- } while (!e_dlist_empty(&m->format->priv->pending_jobs));
-
- d(printf("out of jobs, done\n"));
-
- ((EMFormat *)m->format)->pending_uri_level = puri_level;
-}
-
-static void
-efh_format_done (struct _format_msg *m)
-{
- d(printf("formatting finished\n"));
-
- m->format->load_http_now = FALSE;
- m->format->priv->format_id = -1;
- m->format->state = EM_FORMAT_HTML_STATE_NONE;
- g_signal_emit_by_name(m->format, "complete");
-}
-
-static void
-efh_format_free (struct _format_msg *m)
-{
- d(printf("formatter freed\n"));
- g_object_unref(m->format);
- if (m->estream) {
- camel_stream_close((CamelStream *)m->estream);
- camel_object_unref(m->estream);
- }
- if (m->folder)
- camel_object_unref(m->folder);
- g_free(m->uid);
- if (m->message)
- camel_object_unref(m->message);
- if (m->format_source)
- g_object_unref(m->format_source);
-}
-
-static MailMsgInfo efh_format_info = {
- sizeof (struct _format_msg),
- (MailMsgDescFunc) efh_format_desc,
- (MailMsgExecFunc) efh_format_exec,
- (MailMsgDoneFunc) efh_format_done,
- (MailMsgFreeFunc) efh_format_free
-};
-
-static gboolean
-efh_format_timeout(struct _format_msg *m)
-{
- GtkHTMLStream *hstream;
- EMFormatHTML *efh = m->format;
- struct _EMFormatHTMLPrivate *p = efh->priv;
-
- if (m->format->html == NULL) {
- mail_msg_unref(m);
- return FALSE;
- }
-
- d(printf("timeout called ...\n"));
- if (p->format_id != -1) {
- d(printf(" still waiting for cancellation to take effect, waiting ...\n"));
- return TRUE;
- }
-
- g_return_val_if_fail (e_dlist_empty(&p->pending_jobs), FALSE);
-
- d(printf(" ready to go, firing off format thread\n"));
-
- /* call super-class to kick it off */
- efh_parent->format_clone((EMFormat *)efh, m->folder, m->uid, m->message, m->format_source);
- em_format_html_clear_pobject(m->format);
-
- /* FIXME: method off EMFormat? */
- if (((EMFormat *)efh)->valid) {
- camel_cipher_validity_free(((EMFormat *)efh)->valid);
- ((EMFormat *)efh)->valid = NULL;
- ((EMFormat *)efh)->valid_parent = NULL;
- }
-
- if (m->message == NULL) {
- hstream = gtk_html_begin(efh->html);
- gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK);
- mail_msg_unref(m);
- p->last_part = NULL;
- } else {
- efh->state = EM_FORMAT_HTML_STATE_RENDERING;
-
- if (p->last_part != m->message) {
- hstream = gtk_html_begin (efh->html);
- gtk_html_stream_printf (hstream, "<h5>%s</h5>", _("Formatting Message..."));
- gtk_html_stream_close (hstream, GTK_HTML_STREAM_OK);
- }
-
- hstream = NULL;
- m->estream = (EMHTMLStream *)em_html_stream_new(efh->html, hstream);
-
- if (p->last_part == m->message) {
- em_html_stream_set_flags (m->estream,
- GTK_HTML_BEGIN_KEEP_SCROLL | GTK_HTML_BEGIN_KEEP_IMAGES
- | GTK_HTML_BEGIN_BLOCK_UPDATES | GTK_HTML_BEGIN_BLOCK_IMAGES);
- } else {
- /* clear cache of inline-scanned text parts */
- g_hash_table_remove_all(p->text_inline_parts);
-
- p->last_part = m->message;
- }
-
- efh->priv->format_id = m->base.seq;
- mail_msg_unordered_push (m);
- }
-
- efh->priv->format_timeout_id = 0;
- efh->priv->format_timeout_msg = NULL;
-
- return FALSE;
-}
-
-static void efh_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMimeMessage *msg, EMFormat *emfsource)
-{
- EMFormatHTML *efh = (EMFormatHTML *)emf;
- struct _format_msg *m;
-
- /* How to sub-class ? Might need to adjust api ... */
-
- if (efh->html == NULL)
- return;
-
- d(printf("efh_format called\n"));
- if (efh->priv->format_timeout_id != 0) {
- d(printf(" timeout for last still active, removing ...\n"));
- g_source_remove(efh->priv->format_timeout_id);
- efh->priv->format_timeout_id = 0;
- mail_msg_unref(efh->priv->format_timeout_msg);
- efh->priv->format_timeout_msg = NULL;
- }
-
- m = mail_msg_new(&efh_format_info);
- m->format = (EMFormatHTML *)emf;
- g_object_ref(emf);
- m->format_source = emfsource;
- if (emfsource)
- g_object_ref(emfsource);
- m->folder = folder;
- if (folder)
- camel_object_ref(folder);
- m->uid = g_strdup(uid);
- m->message = msg;
- if (msg)
- camel_object_ref(msg);
-
- if (efh->priv->format_id == -1) {
- d(printf(" idle, forcing format\n"));
- efh_format_timeout(m);
- } else {
- d(printf(" still busy, cancelling and queuing wait\n"));
- /* cancel and poll for completion */
- mail_msg_cancel(efh->priv->format_id);
- efh->priv->format_timeout_msg = m;
- efh->priv->format_timeout_id = g_timeout_add(100, (GSourceFunc)efh_format_timeout, m);
- }
-}
-
-static void efh_format_error(EMFormat *emf, CamelStream *stream, const char *txt)
-{
- char *html;
-
- html = camel_text_to_html (txt, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL|CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
- camel_stream_printf(stream, "<em><font color=\"red\">%s</font></em><br>", html);
- g_free(html);
-}
+/* ********************************************************************** */
static void
efh_format_text_header (EMFormatHTML *emfh, CamelStream *stream, const char *label, const char *value, guint32 flags)
@@ -1859,10 +2428,12 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part)
charset = camel_iconv_charset_name(charset);
if (!efh->simple_headers)
- camel_stream_printf(stream,
- "<font color=\"#%06x\">\n"
- "<table cellpadding=\"0\" width=\"100%%\">",
- efh->header_colour & 0xffffff);
+ camel_stream_printf (
+ stream, "<font color=\"#%06x\">\n"
+ "<table cellpadding=\"0\" width=\"100%%\">",
+ e_color_to_value (
+ &efh->priv->colors[
+ EM_FORMAT_HTML_COLOR_HEADER]));
hdr_charset = emf->charset ? emf->charset : emf->default_charset;
@@ -1944,7 +2515,8 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part)
face = !g_ascii_strcasecmp (h->name, "Face");
while (header) {
- if (emf->show_photo && !photo_name && !g_ascii_strcasecmp (header->name, "From"))
+ if (em_format_html_get_show_sender_photo (efh) &&
+ !photo_name && !g_ascii_strcasecmp (header->name, "From"))
photo_name = header->value;
if (!mailer_shown && mailer && (!g_ascii_strcasecmp (header->name, "X-Mailer") ||
@@ -2002,10 +2574,12 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part)
if (photo_name) {
char *classid;
CamelMimePart *photopart;
+ gboolean only_local_photo;
cia = camel_internet_address_new();
camel_address_decode((CamelAddress *) cia, (const char *) photo_name);
- photopart = em_utils_contact_photo (cia, emf->photo_local);
+ only_local_photo = em_format_html_get_only_local_photos (efh);
+ photopart = em_utils_contact_photo (cia, only_local_photo);
if (photopart) {
contact_has_photo = TRUE;
@@ -2063,7 +2637,8 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part)
}
}
-static void efh_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
+static void
+efh_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
{
const EMFormatHandler *handle;
@@ -2095,57 +2670,3 @@ static void efh_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart
emf->valid = save;
emf->valid_parent = save_parent;
}
-
-static void efh_format_source(EMFormat *emf, CamelStream *stream, CamelMimePart *part)
-{
- CamelStreamFilter *filtered_stream;
- CamelMimeFilter *html_filter;
- CamelDataWrapper *dw = (CamelDataWrapper *)part;
-
- filtered_stream = camel_stream_filter_new_with_stream ((CamelStream *) stream);
- html_filter = camel_mime_filter_tohtml_new (CAMEL_MIME_FILTER_TOHTML_CONVERT_NL
- | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES
- | CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT, 0);
- camel_stream_filter_add(filtered_stream, html_filter);
- camel_object_unref(html_filter);
-
- camel_stream_write_string((CamelStream *)stream, "<table><tr><td><tt>");
- em_format_format_text(emf, (CamelStream *)filtered_stream, dw);
- camel_object_unref(filtered_stream);
-
- camel_stream_write_string(stream, "</tt></td></tr></table>");
-}
-
-static void
-efh_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const char *mime_type, const EMFormatHandler *handle)
-{
- char *text, *html;
-
- /* we display all inlined attachments only */
-
- /* this could probably be cleaned up ... */
- camel_stream_write_string(stream,
- "<table border=1 cellspacing=0 cellpadding=0><tr><td>"
- "<table width=10 cellspacing=0 cellpadding=0>"
- "<tr><td></td></tr></table></td>"
- "<td><table width=3 cellspacing=0 cellpadding=0>"
- "<tr><td></td></tr></table></td><td><font size=-1>\n");
-
- /* output some info about it */
- text = em_format_describe_part(part, mime_type);
- html = camel_text_to_html(text, ((EMFormatHTML *)emf)->text_html_flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
- camel_stream_write_string(stream, html);
- g_free(html);
- g_free(text);
-
- camel_stream_write_string(stream, "</font></td></tr><tr></table>");
-
- if (handle && em_format_is_inline(emf, emf->part_id->str, part, handle))
- handle->handler(emf, stream, part, handle);
-}
-
-static gboolean
-efh_busy(EMFormat *emf)
-{
- return (((EMFormatHTML *)emf)->priv->format_id != -1);
-}
diff --git a/mail/em-format-html.h b/mail/em-format-html.h
index eb8aec96e9..3293318104 100644
--- a/mail/em-format-html.h
+++ b/mail/em-format-html.h
@@ -22,13 +22,13 @@
*/
/*
- Concrete class for formatting mails to html
+ Abstract class for formatting mails to html
*/
#ifndef EM_FORMAT_HTML_H
#define EM_FORMAT_HTML_H
-#include <mail/em-format.h>
+#include <em-format/em-format.h>
#include <mail/mail-config.h>
#include <camel/camel-medium.h>
#include <camel/camel-mime-part.h>
@@ -73,6 +73,16 @@ typedef enum {
EM_FORMAT_HTML_STATE_RENDERING
} EMFormatHTMLState;
+typedef enum {
+ EM_FORMAT_HTML_COLOR_BODY, /* header area background */
+ EM_FORMAT_HTML_COLOR_CITATION, /* citation font color */
+ EM_FORMAT_HTML_COLOR_CONTENT, /* message area background */
+ EM_FORMAT_HTML_COLOR_FRAME, /* frame around message area */
+ EM_FORMAT_HTML_COLOR_HEADER, /* header font color */
+ EM_FORMAT_HTML_COLOR_TEXT, /* message font color */
+ EM_FORMAT_HTML_NUM_COLOR_TYPES
+} EMFormatHTMLColorType;
+
/* A HTMLJob will be executed in another thread, in sequence.
It's job is to write to its stream, close it if successful,
then exit. */
@@ -196,8 +206,7 @@ struct _EMFormatHTMLPObject {
* multipart/related objects and inline images.
**/
struct _EMFormatHTML {
- EMFormat format;
-
+ EMFormat parent;
EMFormatHTMLPrivate *priv;
GtkHTML *html;
@@ -207,15 +216,6 @@ struct _EMFormatHTML {
GSList *headers;
guint32 text_html_flags; /* default flags for text to html conversion */
- guint32 body_colour; /* header box colour */
- guint32 header_colour;
- guint32 text_colour;
- guint32 frame_colour;
- guint32 content_colour;
- guint32 citation_colour;
- unsigned int load_http:2;
- unsigned int load_http_now:1;
- unsigned int mark_citations:1;
unsigned int simple_headers:1; /* simple header format, no box/table */
unsigned int hide_headers:1; /* no headers at all */
unsigned int show_icon:1; /* show an icon when the sender used Evo */
@@ -225,19 +225,40 @@ struct _EMFormatHTML {
};
struct _EMFormatHTMLClass {
- EMFormatClass format_class;
+ EMFormatClass parent_class;
+
+ GType html_widget_type;
};
GType em_format_html_get_type (void);
-EMFormatHTML * em_format_html_new (void);
-void em_format_html_load_http (EMFormatHTML *efh);
-
-void em_format_html_set_load_http (EMFormatHTML *efh,
- int style);
+void em_format_html_load_images (EMFormatHTML *efh);
+void em_format_html_get_color (EMFormatHTML *efh,
+ EMFormatHTMLColorType type,
+ GdkColor *color);
+void em_format_html_set_color (EMFormatHTML *efh,
+ EMFormatHTMLColorType type,
+ const GdkColor *color);
+MailConfigHTTPMode
+ em_format_html_get_image_loading_policy
+ (EMFormatHTML *efh);
+void em_format_html_set_image_loading_policy
+ (EMFormatHTML *efh,
+ MailConfigHTTPMode policy);
+gboolean em_format_html_get_mark_citations
+ (EMFormatHTML *efh);
void em_format_html_set_mark_citations
(EMFormatHTML *efh,
- int state,
- guint32 citation_colour);
+ gboolean mark_citations);
+gboolean em_format_html_get_only_local_photos
+ (EMFormatHTML *efh);
+void em_format_html_set_only_local_photos
+ (EMFormatHTML *efh,
+ gboolean only_local_photos);
+gboolean em_format_html_get_show_sender_photo
+ (EMFormatHTML *efh);
+void em_format_html_set_show_sender_photo
+ (EMFormatHTML *efh,
+ gboolean show_sender_photo);
/* retrieves a pseudo-part icon wrapper for a file */
CamelMimePart * em_format_html_file_part (EMFormatHTML *efh,
@@ -261,7 +282,6 @@ EMFormatHTMLPObject *
void em_format_html_remove_pobject (EMFormatHTML *efh,
EMFormatHTMLPObject *pobject);
void em_format_html_clear_pobject (EMFormatHTML *efh);
-
EMFormatHTMLJob *
em_format_html_job_new (EMFormatHTML *efh,
void (*callback)(EMFormatHTMLJob *job, int cancelled),
diff --git a/mail/em-html-stream.c b/mail/em-html-stream.c
index a1615d2d6a..c39e705b91 100644
--- a/mail/em-html-stream.c
+++ b/mail/em-html-stream.c
@@ -27,84 +27,39 @@
#endif
#include <stdio.h>
-#include <gtkhtml/gtkhtml.h>
-#include <gtkhtml/gtkhtml-stream.h>
#include <gtk/gtk.h>
#include "em-html-stream.h"
#define d(x)
-static void em_html_stream_class_init (EMHTMLStreamClass *klass);
-static void em_html_stream_init (CamelObject *object);
-static void em_html_stream_finalize (CamelObject *object);
-
-static ssize_t emhs_sync_write(CamelStream *stream, const char *buffer, size_t n);
-static int emhs_sync_close(CamelStream *stream);
-static int emhs_sync_flush(CamelStream *stream);
-
static EMSyncStreamClass *parent_class = NULL;
-CamelType
-em_html_stream_get_type (void)
-{
- static CamelType type = CAMEL_INVALID_TYPE;
-
- if (type == CAMEL_INVALID_TYPE) {
- parent_class = (EMSyncStreamClass *)em_sync_stream_get_type();
- type = camel_type_register (em_sync_stream_get_type(),
- "EMHTMLStream",
- sizeof (EMHTMLStream),
- sizeof (EMHTMLStreamClass),
- (CamelObjectClassInitFunc) em_html_stream_class_init,
- NULL,
- (CamelObjectInitFunc) em_html_stream_init,
- (CamelObjectFinalizeFunc) em_html_stream_finalize);
- }
-
- return type;
-}
-
-static void
-em_html_stream_class_init (EMHTMLStreamClass *klass)
-{
- ((EMSyncStreamClass *)klass)->sync_write = emhs_sync_write;
- ((EMSyncStreamClass *)klass)->sync_flush = emhs_sync_flush;
- ((EMSyncStreamClass *)klass)->sync_close = emhs_sync_close;
-}
-
-static void
-em_html_stream_init (CamelObject *object)
-{
- /*EMHTMLStream *emhs = (EMHTMLStream *)object;*/
-}
-
static void
-emhs_cleanup(EMHTMLStream *emhs)
+emhs_cleanup (EMHTMLStream *emhs)
{
if (emhs->sync.cancel && emhs->html_stream)
- gtk_html_stream_close (emhs->html_stream, GTK_HTML_STREAM_ERROR);
+ gtk_html_stream_close (
+ emhs->html_stream, GTK_HTML_STREAM_ERROR);
+
emhs->html_stream = NULL;
emhs->sync.cancel = TRUE;
- g_signal_handler_disconnect(emhs->html, emhs->destroy_id);
- g_object_unref(emhs->html);
+ g_signal_handler_disconnect (emhs->html, emhs->destroy_id);
+ g_object_unref (emhs->html);
emhs->html = NULL;
}
static void
-em_html_stream_finalize (CamelObject *object)
+emhs_gtkhtml_destroy (GtkHTML *html,
+ EMHTMLStream *emhs)
{
- EMHTMLStream *emhs = (EMHTMLStream *)object;
-
- d(printf("%p: finalising stream\n", object));
- if (emhs->html_stream) {
- d(printf("%p: html stream still open - error\n", object));
- /* set 'in finalise' flag */
- camel_stream_close((CamelStream *)emhs);
- }
+ emhs->sync.cancel = TRUE;
+ emhs_cleanup (emhs);
}
static ssize_t
-emhs_sync_write(CamelStream *stream, const char *buffer, size_t n)
+emhs_sync_write (CamelStream *stream,
+ const char *buffer,
+ size_t n)
{
EMHTMLStream *emhs = EM_HTML_STREAM (stream);
@@ -112,9 +67,10 @@ emhs_sync_write(CamelStream *stream, const char *buffer, size_t n)
return -1;
if (emhs->html_stream == NULL)
- emhs->html_stream = gtk_html_begin_full (emhs->html, NULL, NULL, emhs->flags);
+ emhs->html_stream = gtk_html_begin_full (
+ emhs->html, NULL, NULL, emhs->flags);
- gtk_html_stream_write(emhs->html_stream, buffer, n);
+ gtk_html_stream_write (emhs->html_stream, buffer, n);
return (ssize_t) n;
}
@@ -133,48 +89,93 @@ emhs_sync_flush(CamelStream *stream)
}
static int
-emhs_sync_close(CamelStream *stream)
+emhs_sync_close (CamelStream *stream)
{
EMHTMLStream *emhs = (EMHTMLStream *)stream;
if (emhs->html_stream == NULL)
return -1;
- gtk_html_stream_close(emhs->html_stream, GTK_HTML_STREAM_OK);
- emhs_cleanup(emhs);
+ gtk_html_stream_close (emhs->html_stream, GTK_HTML_STREAM_OK);
+ emhs_cleanup (emhs);
return 0;
}
static void
-emhs_gtkhtml_destroy(struct _GtkHTML *html, EMHTMLStream *emhs)
+em_html_stream_class_init (EMHTMLStreamClass *class)
{
- d(printf("%p: emhs gtkhtml destroy\n", emhs));
- emhs->sync.cancel = TRUE;
- emhs_cleanup(emhs);
+ EMSyncStreamClass *sync_stream_class;
+
+ parent_class = (EMSyncStreamClass *)em_sync_stream_get_type();
+
+ sync_stream_class = EM_SYNC_STREAM_CLASS (class);
+ sync_stream_class->sync_write = emhs_sync_write;
+ sync_stream_class->sync_flush = emhs_sync_flush;
+ sync_stream_class->sync_close = emhs_sync_close;
+}
+
+static void
+em_html_stream_init (EMHTMLStream *emhs)
+{
+}
+
+static void
+em_html_stream_finalize (EMHTMLStream *emhs)
+{
+ if (emhs->html_stream) {
+ /* set 'in finalise' flag */
+ camel_stream_close (CAMEL_STREAM (emhs));
+ }
+}
+
+CamelType
+em_html_stream_get_type (void)
+{
+ static CamelType type = CAMEL_INVALID_TYPE;
+
+ if (G_UNLIKELY (type == CAMEL_INVALID_TYPE)) {
+ type = camel_type_register (
+ em_sync_stream_get_type(),
+ "EMHTMLStream",
+ sizeof (EMHTMLStream),
+ sizeof (EMHTMLStreamClass),
+ (CamelObjectClassInitFunc) em_html_stream_class_init,
+ NULL,
+ (CamelObjectInitFunc) em_html_stream_init,
+ (CamelObjectFinalizeFunc) em_html_stream_finalize);
+ }
+
+ return type;
}
/* TODO: Could pass NULL for html_stream, and do a gtk_html_begin
on first data -> less flashing */
CamelStream *
-em_html_stream_new(struct _GtkHTML *html, struct _GtkHTMLStream *html_stream)
+em_html_stream_new (GtkHTML *html,
+ GtkHTMLStream *html_stream)
{
EMHTMLStream *new;
+ g_return_val_if_fail (GTK_IS_HTML (html), NULL);
+
new = EM_HTML_STREAM (camel_object_new (EM_HTML_STREAM_TYPE));
new->html_stream = html_stream;
- new->html = html;
+ new->html = g_object_ref (html);
new->flags = 0;
- g_object_ref(html);
- new->destroy_id = g_signal_connect(html, "destroy", G_CALLBACK(emhs_gtkhtml_destroy), new);
+ new->destroy_id = g_signal_connect (
+ html, "destroy",
+ G_CALLBACK (emhs_gtkhtml_destroy), new);
- em_sync_stream_set_buffer_size(&new->sync, 8192);
+ em_sync_stream_set_buffer_size (&new->sync, 8192);
- return (CamelStream *)new;
+ return CAMEL_STREAM (new);
}
void
em_html_stream_set_flags (EMHTMLStream *emhs, GtkHTMLBeginFlags flags)
{
+ g_return_if_fail (EM_IS_HTML_STREAM (emhs));
+
emhs->flags = flags;
}
diff --git a/mail/em-html-stream.h b/mail/em-html-stream.h
index 86baa5cfa6..7bf79470dd 100644
--- a/mail/em-html-stream.h
+++ b/mail/em-html-stream.h
@@ -24,44 +24,47 @@
#ifndef EM_HTML_STREAM_H
#define EM_HTML_STREAM_H
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+#include <gtkhtml/gtkhtml.h>
+#include <gtkhtml/gtkhtml-stream.h>
+#include <mail/em-sync-stream.h>
-#define EM_HTML_STREAM_TYPE (em_html_stream_get_type ())
-#define EM_HTML_STREAM(obj) (CAMEL_CHECK_CAST((obj), EM_HTML_STREAM_TYPE, EMHTMLStream))
-#define EM_HTML_STREAM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), EM_HTML_STREAM_TYPE, EMHTMLStreamClass))
-#define EM_IS_HTML_STREAM(o) (CAMEL_CHECK_TYPE((o), EM_HTML_STREAM_TYPE))
+#define EM_HTML_STREAM_TYPE \
+ (em_html_stream_get_type ())
+#define EM_HTML_STREAM(obj) \
+ (CAMEL_CHECK_CAST \
+ ((obj), EM_HTML_STREAM_TYPE, EMHTMLStream))
+#define EM_HTML_STREAM_CLASS(cls) \
+ (CAMEL_CHECK_CLASS_CAST \
+ ((cls), EM_HTML_STREAM_TYPE, EMHTMLStreamClass))
+#define EM_IS_HTML_STREAM(obj) \
+ (CAMEL_CHECK_TYPE \
+ ((obj), EM_HTML_STREAM_TYPE))
-struct _GtkHTML;
-struct _GtkHTMLStream;
+G_BEGIN_DECLS
-#include "mail/em-sync-stream.h"
+typedef struct _EMHTMLStream EMHTMLStream;
+typedef struct _EMHTMLStreamClass EMHTMLStreamClass;
-typedef struct _EMHTMLStream {
+struct _EMHTMLStream {
EMSyncStream sync;
guint destroy_id;
- struct _GtkHTML *html;
- struct _GtkHTMLStream *html_stream;
+ GtkHTML *html;
+ GtkHTMLStream *html_stream;
GtkHTMLBeginFlags flags;
-} EMHTMLStream;
+};
-typedef struct {
+struct _EMHTMLStreamClass {
EMSyncStreamClass parent_class;
-} EMHTMLStreamClass;
+};
+CamelType em_html_stream_get_type (void);
+CamelStream * em_html_stream_new (GtkHTML *html,
+ GtkHTMLStream *html_stream);
+void em_html_stream_set_flags (EMHTMLStream *emhs,
+ GtkHTMLBeginFlags flags);
-CamelType em_html_stream_get_type (void);
-
-/* the html_stream is closed when we are finalised (with an error), or closed (ok) */
-CamelStream *em_html_stream_new(struct _GtkHTML *html, struct _GtkHTMLStream *html_stream);
-void em_html_stream_set_flags (EMHTMLStream *emhs, GtkHTMLBeginFlags flags);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* EM_HTML_STREAM_H */
diff --git a/mail/em-inline-filter.c b/mail/em-inline-filter.c
index ffe9f676b3..26ae580dc8 100644
--- a/mail/em-inline-filter.c
+++ b/mail/em-inline-filter.c
@@ -32,6 +32,7 @@
#include <camel/camel-stream-mem.h>
#include "em-utils.h"
+#include "em-format/em-format.h"
#define d(x)
@@ -176,7 +177,7 @@ emif_add_part(EMInlineFilter *emif, const char *data, int len)
/* pre-snoop the mime type of unknown objects, and poke and hack it into place */
if (camel_content_type_is(dw->mime_type, "application", "octet-stream")
- && (mimetype = em_utils_snoop_type(part))
+ && (mimetype = em_format_snoop_type(part))
&& strcmp(mimetype, "application/octet-stream") != 0) {
camel_data_wrapper_set_mime_type(dw, mimetype);
camel_mime_part_set_content_type(part, mimetype);
diff --git a/mail/em-mailer-prefs.c b/mail/em-mailer-prefs.c
index 27f27ca721..5123d3d49a 100644
--- a/mail/em-mailer-prefs.c
+++ b/mail/em-mailer-prefs.c
@@ -25,15 +25,15 @@
#endif
#include <string.h>
+#include <glib/gi18n-lib.h>
#include "em-mailer-prefs.h"
-#include "em-format.h"
+#include "em-format/em-format.h"
#include <camel/camel-iconv.h>
#include <gtkhtml/gtkhtml-properties.h>
#include <libxml/tree.h>
#include "misc/e-charset-picker.h"
-#include <bonobo/bonobo-generic-factory.h>
#include <glade/glade.h>
@@ -41,9 +41,10 @@
#include "libedataserverui/e-cell-renderer-color.h"
+#include "e-util/e-binding.h"
#include "e-util/e-util-private.h"
-#include "e-util/e-util-labels.h"
+#include "e-mail-label-manager.h"
#include "mail-config.h"
#include "em-junk-hook.h"
#include "em-config.h"
@@ -51,7 +52,7 @@
static void em_mailer_prefs_class_init (EMMailerPrefsClass *class);
static void em_mailer_prefs_init (EMMailerPrefs *dialog);
-static void em_mailer_prefs_dispose (GObject *obj);
+static void em_mailer_prefs_finalize (GObject *object);
static GtkVBoxClass *parent_class = NULL;
@@ -127,7 +128,7 @@ em_mailer_prefs_class_init (EMMailerPrefsClass *klass)
object_class = (GObjectClass *) klass;
parent_class = g_type_class_ref (gtk_vbox_get_type ());
- object_class->dispose = em_mailer_prefs_dispose;
+ object_class->finalize = em_mailer_prefs_finalize;
}
static void
@@ -137,15 +138,10 @@ em_mailer_prefs_init (EMMailerPrefs *preferences)
}
static void
-em_mailer_prefs_dispose (GObject *obj)
+em_mailer_prefs_finalize (GObject *obj)
{
EMMailerPrefs *prefs = (EMMailerPrefs *) obj;
- if (prefs->header_list_store) {
- g_object_unref (prefs->header_list_store);
- prefs->header_list_store = NULL;
- }
-
g_object_unref (prefs->gui);
if (prefs->labels_change_notify_id) {
@@ -154,157 +150,48 @@ em_mailer_prefs_dispose (GObject *obj)
prefs->labels_change_notify_id = 0;
}
- ((GObjectClass *)(parent_class))->dispose (obj);
+ ((GObjectClass *)(parent_class))->finalize (obj);
}
-
-static void
-color_button_set_color (GtkColorButton *color_button, const gchar *spec)
+static gboolean
+mark_seen_timeout_transform (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
{
- GdkColor color;
+ gdouble v_double;
+
+ /* Shell Settings (int) -> Spin Button (double) */
+ v_double = (gdouble) g_value_get_int (src_value);
+ g_value_set_double (dst_value, v_double / 1000.0);
- if (gdk_color_parse (spec, &color))
- gtk_color_button_set_color (color_button, &color);
+ return TRUE;
}
-static void
-citation_color_set (GtkColorButton *color_button, EMMailerPrefs *prefs)
+static gboolean
+mark_seen_timeout_reverse_transform (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
{
- GdkColor color;
- gchar spec[16];
+ gdouble v_double;
- gtk_color_button_get_color (color_button, &color);
- g_snprintf (spec, sizeof (spec), "#%04x%04x%04x",
- color.red, color.green, color.blue);
+ /* Spin Button (double) -> Shell Settings (int) */
+ v_double = g_value_get_double (src_value);
+ g_value_set_int (dst_value, v_double * 1000);
- gconf_client_set_string (prefs->gconf,
- "/apps/evolution/mail/display/citation_colour",
- spec, NULL);
+ return TRUE;
}
enum {
- LABEL_LIST_COLUMN_COLOR,
- LABEL_LIST_COLUMN_TAG,
- LABEL_LIST_COLUMN_NAME
-};
-
-enum {
JH_LIST_COLUMN_NAME,
JH_LIST_COLUMN_VALUE
};
-static void
-label_sensitive_buttons (EMMailerPrefs *prefs)
-{
- gboolean can_remove = FALSE, have_selected = FALSE, locked;
-
- g_return_if_fail (prefs);
-
- /* it's not sensitive if it's locked for updates */
- locked = !GTK_WIDGET_IS_SENSITIVE (prefs->label_tree);
-
- if (!locked) {
- GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (prefs->label_tree));
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- gchar *tag = NULL;
-
- gtk_tree_model_get (model, &iter, LABEL_LIST_COLUMN_TAG, &tag, -1);
-
- can_remove = tag && !e_util_labels_is_system (tag);
- have_selected = TRUE;
-
- g_free (tag);
- }
- }
-
- gtk_widget_set_sensitive (prefs->label_remove, !locked && can_remove);
- gtk_widget_set_sensitive (prefs->label_edit, !locked && have_selected);
-}
-
-static void
-label_tree_cursor_changed (GtkWidget *widget, gpointer user_data)
-{
- label_sensitive_buttons (user_data);
-}
-
-static void
-label_tree_refill (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
-{
- EMMailerPrefs *prefs = (EMMailerPrefs *)user_data;
- GSList *labels, *l;
- GtkTreeSelection *selection;
- GtkListStore *store;
- GtkTreeModel *model;
- GtkTreeIter last_iter;
- gchar *last_path = NULL;
-
- g_return_if_fail (prefs != NULL);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (prefs->label_tree));
- if (gtk_tree_selection_get_selected (selection, &model, &last_iter))
- last_path = gtk_tree_model_get_string_from_iter (model, &last_iter);
-
- store = GTK_LIST_STORE (model);
- gtk_list_store_clear (store);
-
- /* cannot use mail-config cache here, because it's (or can be) updated later than this function call */
- labels = e_util_labels_parse (client);
-
- for (l = labels; l; l = l->next) {
- GdkColor color;
- GtkTreeIter iter;
- EUtilLabel *label = l->data;
-
- if (label->colour)
- gdk_color_parse (label->colour, &color);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (
- store, &iter,
- LABEL_LIST_COLUMN_COLOR, label->colour ? &color : NULL,
- LABEL_LIST_COLUMN_NAME, label->name,
- LABEL_LIST_COLUMN_TAG, label->tag,
- -1);
- }
-
- if (last_path) {
- gint children;
-
- children = gtk_tree_model_iter_n_children (model, NULL);
- if (children > 0) {
- GtkTreePath *path;
-
- if (!gtk_tree_model_get_iter_from_string (model, &last_iter, last_path))
- gtk_tree_model_iter_nth_child (model, &last_iter, NULL, children - 1);
-
- path = gtk_tree_model_get_path (model, &last_iter);
- if (path) {
- GtkTreeViewColumn *focus_col = gtk_tree_view_get_column (GTK_TREE_VIEW (prefs->label_tree), LABEL_LIST_COLUMN_NAME);
-
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (prefs->label_tree), path, focus_col, FALSE);
- gtk_tree_view_row_activated (GTK_TREE_VIEW (prefs->label_tree), path, focus_col);
- gtk_tree_path_free (path);
- }
- }
-
- g_free (last_path);
- }
-
- label_sensitive_buttons (prefs);
- e_util_labels_free (labels);
-}
-
static void
jh_tree_refill (EMMailerPrefs *prefs)
{
- GtkListStore *store;
+ GtkListStore *store = prefs->junk_header_list_store;
GSList *l, *cjh = gconf_client_get_list (prefs->gconf, "/apps/evolution/mail/junk/custom_header", GCONF_VALUE_STRING, NULL);
- store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (prefs->junk_header_tree)));
gtk_list_store_clear (store);
for (l = cjh; l; l = l->next) {
@@ -422,126 +309,28 @@ jh_remove_cb (GtkWidget *widget, gpointer user_data)
}
-static gboolean
-init_junk_tree (GtkTreeView *jh_tree, EMMailerPrefs *prefs)
+static GtkListStore *
+init_junk_tree (GtkWidget *label_tree, EMMailerPrefs *prefs)
{
GtkListStore *store;
GtkCellRenderer *renderer;
gint col;
- g_return_val_if_fail (jh_tree != NULL, FALSE);
- g_return_val_if_fail (prefs != NULL, FALSE);
+ g_return_val_if_fail (label_tree != NULL, NULL);
+ g_return_val_if_fail (prefs != NULL, NULL);
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
- gtk_tree_view_set_model (GTK_TREE_VIEW (jh_tree), GTK_TREE_MODEL (store));
- g_object_unref (store);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (label_tree), GTK_TREE_MODEL (store));
renderer = gtk_cell_renderer_text_new ();
- col = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (jh_tree), -1, _("Header"), renderer, "text", JH_LIST_COLUMN_NAME, NULL);
+ col = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (label_tree), -1, _("Header"), renderer, "text", JH_LIST_COLUMN_NAME, NULL);
g_object_set (G_OBJECT (renderer), "editable", TRUE, NULL);
renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (jh_tree), -1, _("Contains Value"), renderer, "text", JH_LIST_COLUMN_VALUE, NULL);
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (label_tree), -1, _("Contains Value"), renderer, "text", JH_LIST_COLUMN_VALUE, NULL);
g_object_set (G_OBJECT (renderer), "editable", TRUE, NULL);
- jh_tree_refill (prefs);
-
- return TRUE;
-}
-
-static gboolean
-init_label_tree (GtkWidget *label_tree, EMMailerPrefs *prefs, gboolean locked)
-{
- GtkListStore *store;
- GtkCellRenderer *renderer;
- gint col;
-
- g_return_val_if_fail (label_tree != NULL, FALSE);
- g_return_val_if_fail (prefs != NULL, FALSE);
-
- store = gtk_list_store_new (3, GDK_TYPE_COLOR, G_TYPE_STRING, G_TYPE_STRING);
- gtk_tree_view_set_model (GTK_TREE_VIEW (label_tree), GTK_TREE_MODEL (store));
- g_object_unref (store);
-
- renderer = e_cell_renderer_color_new ();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (label_tree), -1, _("Color"), renderer, "color", LABEL_LIST_COLUMN_COLOR, NULL);
-
- renderer = gtk_cell_renderer_text_new ();
- col = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (label_tree), -1, _("Tag"), renderer, "text", LABEL_LIST_COLUMN_TAG, NULL);
- g_object_set (G_OBJECT (renderer), "editable", FALSE, NULL);
- gtk_tree_view_column_set_visible (gtk_tree_view_get_column (GTK_TREE_VIEW (label_tree), col - 1), FALSE);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (label_tree), -1, _("Name"), renderer, "text", LABEL_LIST_COLUMN_NAME, NULL);
- g_object_set (G_OBJECT (renderer), "editable", FALSE, NULL);
-
- if (!locked)
- g_signal_connect (label_tree, "cursor-changed", G_CALLBACK (label_tree_cursor_changed), prefs);
-
- label_tree_refill (NULL, 0, NULL, prefs);
-
- prefs->labels_change_notify_id = gconf_client_notify_add (prefs->gconf, E_UTIL_LABELS_GCONF_KEY, label_tree_refill, prefs, NULL, NULL);
-
- return TRUE;
-}
-
-static void
-label_add_cb (GtkWidget *widget, gpointer user_data)
-{
- char *tag;
-
- tag = e_util_labels_add_with_dlg (GTK_WINDOW (gtk_widget_get_toplevel (widget)), NULL);
-
- g_free (tag);
-}
-
-static void
-label_remove_cb (GtkWidget *widget, gpointer user_data)
-{
- EMMailerPrefs *prefs = user_data;
- GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- g_return_if_fail (prefs != NULL);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (prefs->label_tree));
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- gchar *tag = NULL;
-
- gtk_tree_model_get (model, &iter, LABEL_LIST_COLUMN_TAG, &tag, -1);
-
- if (tag && !e_util_labels_is_system (tag))
- e_util_labels_remove (tag);
-
- g_free (tag);
- }
-}
-
-static void
-label_edit_cb (GtkWidget *widget, gpointer user_data)
-{
- EMMailerPrefs *prefs = user_data;
- GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- g_return_if_fail (prefs != NULL);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (prefs->label_tree));
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- gchar *tag = NULL;
-
- gtk_tree_model_get (model, &iter, LABEL_LIST_COLUMN_TAG, &tag, -1);
-
- if (tag) {
- char *str = e_util_labels_add_with_dlg (GTK_WINDOW (gtk_widget_get_toplevel (widget)), tag);
-
- g_free (str);
- }
-
- g_free (tag);
- }
+ return store;
}
static void
@@ -726,80 +515,6 @@ emmp_header_entry_changed (GtkWidget *entry, gpointer user_data)
}
static void
-mark_seen_timeout_changed (GtkSpinButton *spin, EMMailerPrefs *prefs)
-{
- int timeout;
-
- timeout = (int) (gtk_spin_button_get_value (prefs->timeout) * 1000.0);
- gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/mark_seen_timeout", timeout, NULL);
-}
-
-static void
-address_compress_count_changed (GtkSpinButton *spin, EMMailerPrefs *prefs)
-{
- int count;
-
- count = (int) gtk_spin_button_get_value (prefs->address_count);
-
- gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/address_count", count, NULL);
-}
-
-static void
-mlimit_count_changed (GtkSpinButton *spin, EMMailerPrefs *prefs)
-{
- int count;
-
- count = (int) gtk_spin_button_get_value (prefs->mlimit_count);
-
- gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/message_text_part_limit", count, NULL);
-}
-
-static void
-spin_button_init (EMMailerPrefs *prefs, GtkSpinButton *spin, const char *key, float div, GCallback value_changed)
-{
- GError *err = NULL;
- double min, max;
- char *mkey, *p;
- int val;
-
- gtk_spin_button_get_range (spin, &min, &max);
-
- mkey = g_alloca (strlen (key) + 5);
- p = g_stpcpy (mkey, key);
- *p++ = '_';
-
- /* see if the admin locked down the min value */
- strcpy (p, "min");
- val = gconf_client_get_int (prefs->gconf, mkey, &err);
- if (err == NULL)
- g_clear_error (&err);
- else
- min = (1.0 * val) / div;
-
- /* see if the admin locked down the max value */
- strcpy (p, "max");
- val = gconf_client_get_int (prefs->gconf, mkey, &err);
- if (err == NULL)
- g_clear_error (&err);
- else
- max = (1.0 * val) / div;
-
- gtk_spin_button_set_range (spin, min, max);
-
- /* get the value */
- val = gconf_client_get_int (prefs->gconf, key, NULL);
- gtk_spin_button_set_value (spin, (1.0 * val) / div);
-
- if (value_changed) {
- g_object_set_data ((GObject *) spin, "key", (void *) key);
- g_signal_connect (spin, "value-changed", value_changed, prefs);
- }
-
- if (!gconf_client_key_is_writable (prefs->gconf, key, NULL))
- gtk_widget_set_sensitive ((GtkWidget *) spin, FALSE);
-}
-
-static void
toggle_button_toggled (GtkToggleButton *toggle, EMMailerPrefs *prefs)
{
const char *key;
@@ -809,16 +524,6 @@ toggle_button_toggled (GtkToggleButton *toggle, EMMailerPrefs *prefs)
}
static void
-photo_toggle_changed (GtkToggleButton *toggle, EMMailerPrefs *prefs)
-{
- toggle_button_toggled (toggle, prefs);
- if (gtk_toggle_button_get_active (toggle))
- gtk_widget_set_sensitive ((GtkWidget *) prefs->photo_local, TRUE);
- else
- gtk_widget_set_sensitive ((GtkWidget *) prefs->photo_local, FALSE);
-}
-
-static void
junk_book_lookup_button_toggled (GtkToggleButton *toggle, EMMailerPrefs *prefs)
{
toggle_button_toggled (toggle, prefs);
@@ -843,30 +548,6 @@ custom_junk_button_toggled (GtkToggleButton *toggle, EMMailerPrefs *prefs)
}
static void
-custom_font_changed (GtkToggleButton *toggle, EMMailerPrefs *prefs)
-{
- gboolean use_custom;
-
- use_custom = !gtk_toggle_button_get_active (toggle);
-
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->font_fixed), use_custom);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->font_variable), use_custom);
-
- gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/display/fonts/use_custom", use_custom, NULL);
-}
-
-static void
-font_changed (GtkFontButton *font_button, EMMailerPrefs *prefs)
-{
- const gchar *key;
- const gchar *font_name;
-
- key = g_object_get_data (G_OBJECT (font_button), "key");
- font_name = gtk_font_button_get_font_name (font_button);
- gconf_client_set_string (prefs->gconf, key, font_name, NULL);
-}
-
-static void
toggle_button_init (EMMailerPrefs *prefs, GtkToggleButton *toggle, int not, const char *key, GCallback toggled)
{
gboolean bool;
@@ -921,74 +602,78 @@ charset_menu_init (EMMailerPrefs *prefs)
}
static void
-trash_days_changed (GtkComboBox *combobox, EMMailerPrefs *prefs)
+trash_days_activate (GtkWidget *item, EMMailerPrefs *prefs)
{
- int idx;
-
- idx = gtk_combo_box_get_active (combobox);
- g_return_if_fail (idx >= 0 && idx < G_N_ELEMENTS (empty_trash_frequency));
+ int days;
- gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/trash/empty_on_exit_days", empty_trash_frequency [idx].days, NULL);
+ days = GPOINTER_TO_INT (g_object_get_data ((GObject *) item, "days"));
+ gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/trash/empty_on_exit_days", days, NULL);
}
static void
emmp_empty_trash_init (EMMailerPrefs *prefs)
{
int locked, days, hist = 0, i;
-
- toggle_button_init (prefs, prefs->empty_trash, FALSE,
- "/apps/evolution/mail/trash/empty_on_exit",
- G_CALLBACK (toggle_button_toggled));
+ GtkWidget *menu, *item;
days = gconf_client_get_int(prefs->gconf, "/apps/evolution/mail/trash/empty_on_exit_days", NULL);
-
- gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (prefs->empty_trash_days)));
+ menu = gtk_menu_new();
for (i = 0; i < G_N_ELEMENTS (empty_trash_frequency); i++) {
if (days >= empty_trash_frequency[i].days)
hist = i;
- gtk_combo_box_append_text (prefs->empty_trash_days, _(empty_trash_frequency[i].label));
+ item = gtk_menu_item_new_with_label (_(empty_trash_frequency[i].label));
+ g_object_set_data ((GObject *) item, "days", GINT_TO_POINTER (empty_trash_frequency[i].days));
+ g_signal_connect (item, "activate", G_CALLBACK (trash_days_activate), prefs);
+
+ gtk_widget_show (item);
+ gtk_menu_shell_append((GtkMenuShell *)menu, item);
}
- g_signal_connect (prefs->empty_trash_days, "changed", G_CALLBACK (trash_days_changed), prefs);
- gtk_combo_box_set_active (prefs->empty_trash_days, hist);
+ gtk_widget_show(menu);
+ gtk_option_menu_set_menu((GtkOptionMenu *)prefs->empty_trash_days, menu);
+ gtk_option_menu_set_history((GtkOptionMenu *)prefs->empty_trash_days, hist);
locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/trash/empty_on_exit_days", NULL);
gtk_widget_set_sensitive ((GtkWidget *) prefs->empty_trash_days, !locked);
}
static void
-junk_days_changed (GtkComboBox *combobox, EMMailerPrefs *prefs)
+junk_days_activate (GtkWidget *item, EMMailerPrefs *prefs)
{
- int idx;
-
- idx = gtk_combo_box_get_active (combobox);
- g_return_if_fail (idx >= 0 && idx < G_N_ELEMENTS (empty_trash_frequency));
+ int days;
- gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", empty_trash_frequency[idx].days, NULL);
+ days = GPOINTER_TO_INT (g_object_get_data ((GObject *) item, "days"));
+ gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", days, NULL);
}
static void
emmp_empty_junk_init (EMMailerPrefs *prefs)
{
int locked, days, hist = 0, i;
+ GtkWidget *menu, *item;
toggle_button_init (prefs, prefs->empty_junk, FALSE,
"/apps/evolution/mail/junk/empty_on_exit",
G_CALLBACK (toggle_button_toggled));
days = gconf_client_get_int(prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", NULL);
-
- gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (prefs->empty_junk_days)));
+ menu = gtk_menu_new();
for (i = 0; i < G_N_ELEMENTS (empty_trash_frequency); i++) {
if (days >= empty_trash_frequency[i].days)
hist = i;
- gtk_combo_box_append_text (prefs->empty_junk_days, _(empty_trash_frequency[i].label));
+ item = gtk_menu_item_new_with_label (_(empty_trash_frequency[i].label));
+ g_object_set_data ((GObject *) item, "days", GINT_TO_POINTER (empty_trash_frequency[i].days));
+ g_signal_connect (item, "activate", G_CALLBACK (junk_days_activate), prefs);
+
+ gtk_widget_show (item);
+ gtk_menu_shell_append((GtkMenuShell *)menu, item);
}
- g_signal_connect (prefs->empty_junk_days, "changed", G_CALLBACK (junk_days_changed), prefs);
- gtk_combo_box_set_active (prefs->empty_junk_days, hist);
+ gtk_widget_show(menu);
+ gtk_option_menu_set_menu((GtkOptionMenu *)prefs->empty_junk_days, menu);
+ gtk_option_menu_set_history((GtkOptionMenu *)prefs->empty_junk_days, hist);
locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", NULL);
gtk_widget_set_sensitive ((GtkWidget *) prefs->empty_junk_days, !locked);
@@ -1148,15 +833,18 @@ create_combo_text_widget (void) {
}
static void
-em_mailer_prefs_construct (EMMailerPrefs *prefs)
+em_mailer_prefs_construct (EMMailerPrefs *prefs,
+ EShell *shell)
{
GSList *header_config_list, *header_add_list, *p;
+ EShellSettings *shell_settings;
GHashTable *default_header_hash;
GtkWidget *toplevel;
+ GtkWidget *container;
+ GtkWidget *widget;
GtkTreeSelection *selection;
GtkCellRenderer *renderer;
GtkTreeIter iter;
- char *font, *buf;
GladeXML *gui;
gboolean locked;
int val, i;
@@ -1165,6 +853,8 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
GSList *l;
char *gladefile;
+ shell_settings = e_shell_get_shell_settings (shell);
+
gladefile = g_build_filename (EVOLUTION_GLADEDIR,
"mail-config.glade",
NULL);
@@ -1190,96 +880,119 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
/* General tab */
/* Message Display */
- prefs->timeout_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkMarkTimeout"));
- toggle_button_init (prefs, prefs->timeout_toggle, FALSE,
- "/apps/evolution/mail/display/mark_seen",
- G_CALLBACK (toggle_button_toggled));
-
- prefs->timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinMarkTimeout"));
- spin_button_init (prefs, prefs->timeout,
- "/apps/evolution/mail/display/mark_seen_timeout",
- 1000.0, G_CALLBACK (mark_seen_timeout_changed));
-
- prefs->mlimit_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "mlimit_checkbutton"));
- toggle_button_init (prefs, prefs->mlimit_toggle, FALSE,
- "/apps/evolution/mail/display/force_message_limit",
- G_CALLBACK (toggle_button_toggled));
-
- prefs->magic_spacebar = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "magic_spacebar_checkbox"));
- toggle_button_init (prefs, prefs->magic_spacebar, FALSE,
- "/apps/evolution/mail/display/magic_spacebar",
- G_CALLBACK (toggle_button_toggled));
-
- prefs->mlimit_count = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "mlimit_spin"));
- spin_button_init (prefs, prefs->mlimit_count,
- "/apps/evolution/mail/display/message_text_part_limit",
- 1, G_CALLBACK (mlimit_count_changed));
-
- prefs->address_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "address_checkbox"));
- toggle_button_init (prefs, prefs->address_toggle, FALSE,
- "/apps/evolution/mail/display/address_compress",
- G_CALLBACK (toggle_button_toggled));
-
- prefs->address_count = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "address_spin"));
- spin_button_init (prefs, prefs->address_count,
- "/apps/evolution/mail/display/address_count",
- 1, G_CALLBACK (address_compress_count_changed));
+ widget = glade_xml_get_widget (gui, "chkMarkTimeout");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-mark-seen",
+ G_OBJECT (widget), "active");
+
+ /* The "mark seen" timeout requires special transform functions
+ * because we display the timeout value to the user in seconds
+ * but store the settings value in milliseconds. */
+ widget = glade_xml_get_widget (gui, "spinMarkTimeout");
+ prefs->timeout = GTK_SPIN_BUTTON (widget);
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-mark-seen",
+ G_OBJECT (widget), "sensitive");
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "mail-mark-seen-timeout",
+ G_OBJECT (widget), "value",
+ mark_seen_timeout_transform,
+ mark_seen_timeout_reverse_transform,
+ NULL, NULL);
+
+ widget = glade_xml_get_widget (gui, "mlimit_checkbutton");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-force-message-limit",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "mlimit_spin");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-force-message-limit",
+ G_OBJECT (widget), "sensitive");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-message-text-part-limit",
+ G_OBJECT (widget), "value");
+
+ widget = glade_xml_get_widget (gui, "address_checkbox");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-address-compress",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "address_spin");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-address-compress",
+ G_OBJECT (widget), "sensitive");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-address-count",
+ G_OBJECT (widget), "value");
+
+ widget = glade_xml_get_widget (gui, "magic_spacebar_checkbox");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-magic-spacebar",
+ G_OBJECT (widget), "active");
prefs->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset"));
charset_menu_init (prefs);
- prefs->citation_highlight = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkHighlightCitations"));
- toggle_button_init (prefs, prefs->citation_highlight, FALSE,
- "/apps/evolution/mail/display/mark_citations",
- G_CALLBACK (toggle_button_toggled));
-
- prefs->citation_color = GTK_COLOR_BUTTON (glade_xml_get_widget (gui, "colorButtonHighlightCitations"));
- buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/citation_colour", NULL);
- color_button_set_color (prefs->citation_color, buf ? buf : "#737373");
- g_signal_connect (prefs->citation_color, "color-set", G_CALLBACK (citation_color_set), prefs);
- if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/citation_colour", NULL))
- gtk_widget_set_sensitive ((GtkWidget *) prefs->citation_color, FALSE);
- g_free (buf);
-
- prefs->enable_search_folders = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEnableSearchFolders"));
- toggle_button_init (prefs, prefs->enable_search_folders, FALSE,
- "/apps/evolution/mail/display/enable_vfolders",
- G_CALLBACK (toggle_button_toggled));
+ widget = glade_xml_get_widget (gui, "chkHighlightCitations");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-mark-citations",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "colorButtonHighlightCitations");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-mark-citations",
+ G_OBJECT (widget), "sensitive");
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "mail-citation-color",
+ G_OBJECT (widget), "color",
+ e_binding_transform_string_to_color,
+ e_binding_transform_color_to_string,
+ NULL, NULL);
+
+ widget = glade_xml_get_widget (gui, "chkEnableSearchFolders");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-enable-search-folders",
+ G_OBJECT (widget), "active");
/* Deleting Mail */
- prefs->empty_trash = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEmptyTrashOnExit"));
- prefs->empty_trash_days = GTK_COMBO_BOX (glade_xml_get_widget (gui, "comboboxEmptyTrashDays"));
+ widget = glade_xml_get_widget (gui, "chkEmptyTrashOnExit");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-empty-trash-on-exit",
+ G_OBJECT (widget), "active");
+
+ prefs->empty_trash_days = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuEmptyTrashDays"));
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-empty-trash-on-exit",
+ G_OBJECT (prefs->empty_trash_days), "sensitive");
emmp_empty_trash_init (prefs);
- prefs->confirm_expunge = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkConfirmExpunge"));
- toggle_button_init (prefs, prefs->confirm_expunge, FALSE,
- "/apps/evolution/mail/prompts/expunge",
- G_CALLBACK (toggle_button_toggled));
-
- /* Mail Fonts */
- font = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL);
- prefs->font_fixed = GTK_FONT_BUTTON (glade_xml_get_widget (gui, "FontFixed"));
- gtk_font_button_set_font_name (prefs->font_fixed, font);
- g_free (font);
- g_object_set_data ((GObject *) prefs->font_fixed, "key", (gpointer) "/apps/evolution/mail/display/fonts/monospace");
- g_signal_connect (prefs->font_fixed, "font-set", G_CALLBACK (font_changed), prefs);
- if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL))
- gtk_widget_set_sensitive ((GtkWidget *) prefs->font_fixed, FALSE);
-
- font = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/fonts/variable", NULL);
- prefs->font_variable = GTK_FONT_BUTTON (glade_xml_get_widget (gui, "FontVariable"));
- gtk_font_button_set_font_name (prefs->font_variable, font);
- g_free (font);
- g_object_set_data ((GObject *) prefs->font_variable, "key", (gpointer) "/apps/evolution/mail/display/fonts/variable");
- g_signal_connect (prefs->font_variable, "font-set", G_CALLBACK (font_changed), prefs);
- if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/fonts/variable", NULL))
- gtk_widget_set_sensitive ((GtkWidget *) prefs->font_variable, FALSE);
-
- prefs->font_share = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radFontUseSame"));
- toggle_button_init (prefs, prefs->font_share, TRUE,
- "/apps/evolution/mail/display/fonts/use_custom",
- G_CALLBACK (custom_font_changed));
- custom_font_changed (prefs->font_share, prefs);
+ widget = glade_xml_get_widget (gui, "chkConfirmExpunge");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-confirm-expunge",
+ G_OBJECT (widget), "active");
+
+ /* Mail Fonts */
+ widget = glade_xml_get_widget (gui, "radFontUseSame");
+ e_mutual_binding_new_with_negation (
+ G_OBJECT (shell_settings), "mail-use-custom-fonts",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "FontFixed");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-font-monospace",
+ G_OBJECT (widget), "font-name");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-use-custom-fonts",
+ G_OBJECT (widget), "sensitive");
+
+ widget = glade_xml_get_widget (gui, "FontVariable");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-font-variable",
+ G_OBJECT (widget), "font-name");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-use-custom-fonts",
+ G_OBJECT (widget), "sensitive");
/* HTML Mail tab */
@@ -1306,49 +1019,40 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
g_signal_connect (prefs->images_sometimes, "toggled", G_CALLBACK (http_images_changed), prefs);
g_signal_connect (prefs->images_always, "toggled", G_CALLBACK (http_images_changed), prefs);
- prefs->show_animated = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkShowAnimatedImages"));
- toggle_button_init (prefs, prefs->show_animated, FALSE,
- "/apps/evolution/mail/display/animate_images",
- G_CALLBACK (toggle_button_toggled));
+ widget = glade_xml_get_widget (gui, "chkShowAnimatedImages");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-show-animated-images",
+ G_OBJECT (widget), "active");
- prefs->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML"));
- toggle_button_init (prefs, prefs->prompt_unwanted_html, FALSE,
- "/apps/evolution/mail/prompts/unwanted_html",
- G_CALLBACK (toggle_button_toggled));
-
- /* Labels... */
- locked = !gconf_client_key_is_writable (prefs->gconf, E_UTIL_LABELS_GCONF_KEY, NULL);
- prefs->label_add = glade_xml_get_widget (gui, "labelAdd");
- prefs->label_edit = glade_xml_get_widget (gui, "labelEdit");
- prefs->label_remove = glade_xml_get_widget (gui, "labelRemove");
- prefs->label_tree = glade_xml_get_widget (gui, "labelTree");
+ widget = glade_xml_get_widget (gui, "chkPromptWantHTML");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-confirm-unwanted-html",
+ G_OBJECT (widget), "active");
- gtk_widget_set_sensitive (prefs->label_add, !locked);
- gtk_widget_set_sensitive (prefs->label_remove, !locked);
- gtk_widget_set_sensitive (prefs->label_edit, !locked);
- gtk_widget_set_sensitive (prefs->label_tree, !locked);
+ container = glade_xml_get_widget (gui, "labels-alignment");
+ widget = e_mail_label_manager_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ gtk_widget_show (widget);
- init_label_tree (prefs->label_tree, prefs, locked);
-
- if (!locked) {
- g_signal_connect (G_OBJECT (prefs->label_add), "clicked", G_CALLBACK (label_add_cb), prefs);
- g_signal_connect (G_OBJECT (prefs->label_remove), "clicked", G_CALLBACK (label_remove_cb), prefs);
- g_signal_connect (G_OBJECT (prefs->label_edit), "clicked", G_CALLBACK (label_edit_cb), prefs);
- }
+ e_binding_new (
+ G_OBJECT (shell_settings), "mail-label-list-store",
+ G_OBJECT (widget), "list-store");
/* headers */
locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/headers", NULL);
- prefs->photo_show= GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "photo_show"));
- toggle_button_init (prefs, prefs->photo_show, FALSE,
- "/apps/evolution/mail/display/sender_photo",
- G_CALLBACK (photo_toggle_changed));
- prefs->photo_local = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "photo_local"));
- toggle_button_init (prefs, prefs->photo_local, FALSE,
- "/apps/evolution/mail/display/photo_local",
- G_CALLBACK (toggle_button_toggled));
- if (!gtk_toggle_button_get_active (prefs->photo_show))
- gtk_widget_set_sensitive ((GtkWidget *) prefs->photo_local, FALSE);
+ widget = glade_xml_get_widget (gui, "photo_show");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-show-sender-photo",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "photo_local");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-show-sender-photo",
+ G_OBJECT (widget), "sensitive");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-only-local-photos",
+ G_OBJECT (widget), "active");
/* always de-sensitised until the user types something in the entry */
prefs->add_header = GTK_BUTTON (glade_xml_get_widget (gui, "cmdHeadersAdd"));
@@ -1455,13 +1159,13 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
g_slist_free (header_add_list);
/* Junk prefs */
- prefs->check_incoming = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkCheckIncomingMail"));
- toggle_button_init (prefs, prefs->check_incoming, FALSE,
- "/apps/evolution/mail/junk/check_incoming",
- G_CALLBACK (toggle_button_toggled));
+ widget = glade_xml_get_widget (gui, "chkCheckIncomingMail");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-check-for-junk",
+ G_OBJECT (widget), "active");
prefs->empty_junk = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "junk_empty_check"));
- prefs->empty_junk_days = GTK_COMBO_BOX (glade_xml_get_widget (gui, "junk_empty_combobox"));
+ prefs->empty_junk_days = GTK_OPTION_MENU (glade_xml_get_widget (gui, "junk_empty_combo"));
emmp_empty_junk_init (prefs);
prefs->default_junk_plugin = GTK_COMBO_BOX (glade_xml_get_widget (gui, "default_junk_plugin"));
@@ -1485,7 +1189,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
junk_book_lookup_button_toggled (prefs->junk_book_lookup, prefs);
- init_junk_tree ((GtkTreeView *)prefs->junk_header_tree, prefs);
+ prefs->junk_header_list_store = init_junk_tree ((GtkWidget *)prefs->junk_header_tree, prefs);
toggle_button_init (prefs, prefs->junk_header_check, FALSE,
"/apps/evolution/mail/junk/check_custom_header",
G_CALLBACK (custom_junk_button_toggled));
@@ -1503,14 +1207,18 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
}
GtkWidget *
-em_mailer_prefs_new (void)
+em_mailer_prefs_new (EShell *shell)
{
EMMailerPrefs *new;
- new = (EMMailerPrefs *) g_object_new (em_mailer_prefs_get_type (), NULL);
- em_mailer_prefs_construct (new);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+
+ new = g_object_new (EM_TYPE_MAILER_PREFS, NULL);
+
+ /* FIXME Kill this function. */
+ em_mailer_prefs_construct (new, shell);
- return (GtkWidget *) new;
+ return GTK_WIDGET (new);
}
diff --git a/mail/em-mailer-prefs.h b/mail/em-mailer-prefs.h
index 10503a8461..fddc7cd4e1 100644
--- a/mail/em-mailer-prefs.h
+++ b/mail/em-mailer-prefs.h
@@ -20,36 +20,34 @@
*
*/
-#ifndef __EM_MAILER_PREFS_H__
-#define __EM_MAILER_PREFS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+#ifndef EM_MAILER_PREFS_H
+#define EM_MAILER_PREFS_H
#include <gtk/gtk.h>
-#include <shell/Evolution.h>
-
-struct _ESignature;
-struct _GtkToggleButton;
-struct _GtkOptionMenu;
-struct _GtkComboBox;
-struct _GdkPixbuf;
-struct _GtkWidget;
-struct _GladeXML;
-struct _GtkFileChooserbutton;
-struct _GtkFontButton;
-struct _GConfClient;
-struct _GtkButton;
-struct _GtkTreeView;
-struct _GtkWindow;
-
-#define EM_MAILER_PREFS_TYPE (em_mailer_prefs_get_type ())
-#define EM_MAILER_PREFS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EM_MAILER_PREFS_TYPE, EMMailerPrefs))
-#define EM_MAILER_PREFS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EM_MAILER_PREFS_TYPE, EMMailerPrefsClass))
-#define EM_IS_MAILER_PREFS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EM_MAILER_PREFS_TYPE))
-#define EM_IS_MAILER_PREFS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EM_MAILER_PREFS_TYPE))
+#include <glade/glade.h>
+#include <gconf/gconf-client.h>
+#include <shell/e-shell.h>
+
+/* Standard GObject macros */
+#define EM_TYPE_MAILER_PREFS \
+ (em_mailer_prefs_get_type ())
+#define EM_MAILER_PREFS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_TYPE_MAILER_PREFS, EMMailerPrefs))
+#define EM_MAILER_PREFS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_TYPE_MAILER_PREFS, EMMailerPrefsClass))
+#define EM_IS_MAILER_PREFS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_TYPE_MAILER_PREFS))
+#define EM_IS_MAILER_PREFS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EM_TYPE_MAILER_PREFS))
+#define EM_MAILER_PREFS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_TYPE_MAILER_PREFS))
+
+G_BEGIN_DECLS
typedef struct _EMMailerPrefs EMMailerPrefs;
typedef struct _EMMailerPrefsClass EMMailerPrefsClass;
@@ -64,25 +62,14 @@ struct _EMMailerPrefsHeader {
struct _EMMailerPrefs {
GtkVBox parent_object;
- GNOME_Evolution_Shell shell;
-
- struct _GladeXML *gui;
- struct _GConfClient *gconf;
+ GladeXML *gui;
+ GConfClient *gconf;
/* General tab */
/* Message Display */
- struct _GtkToggleButton *timeout_toggle;
- struct _GtkSpinButton *timeout;
- struct _GtkToggleButton *address_toggle;
- struct _GtkSpinButton *address_count;
- struct _GtkToggleButton *mlimit_toggle;
- struct _GtkSpinButton *mlimit_count;
- struct _GtkOptionMenu *charset;
- struct _GtkToggleButton *citation_highlight;
- struct _GtkColorButton *citation_color;
- struct _GtkToggleButton *enable_search_folders;
- struct _GtkToggleButton *magic_spacebar;
+ GtkSpinButton *timeout;
+ GtkOptionMenu *charset;
/* Deleting Mail */
struct _GtkToggleButton *empty_trash;
@@ -90,75 +77,65 @@ struct _EMMailerPrefs {
struct _GtkToggleButton *confirm_expunge;
/* HTML Mail tab */
- struct _GtkFontButton *font_variable;
- struct _GtkFontButton *font_fixed;
- struct _GtkToggleButton *font_share;
+ GtkFontButton *font_variable;
+ GtkFontButton *font_fixed;
+ GtkToggleButton *font_share;
/* Loading Images */
- struct _GtkToggleButton *images_always;
- struct _GtkToggleButton *images_sometimes;
- struct _GtkToggleButton *images_never;
+ GtkToggleButton *images_always;
+ GtkToggleButton *images_sometimes;
+ GtkToggleButton *images_never;
- struct _GtkToggleButton *show_animated;
- struct _GtkToggleButton *autodetect_links;
- struct _GtkToggleButton *prompt_unwanted_html;
+ GtkToggleButton *autodetect_links;
/* Labels and Colours tab */
- struct _GtkWidget *label_add;
- struct _GtkWidget *label_edit;
- struct _GtkWidget *label_remove;
- struct _GtkWidget *label_tree;
+ GtkWidget *label_add;
+ GtkWidget *label_edit;
+ GtkWidget *label_remove;
+ GtkWidget *label_tree;
+ GtkListStore *label_list_store;
guint labels_change_notify_id; /* mail_config's notify id */
/* Headers tab */
- struct _GtkButton *add_header;
- struct _GtkButton *remove_header;
- struct _GtkEntry *entry_header;
- struct _GtkTreeView *header_list;
- struct _GtkListStore *header_list_store;
- struct _GtkToggleButton *photo_show;
- struct _GtkToggleButton *photo_local;
+ GtkButton *add_header;
+ GtkButton *remove_header;
+ GtkEntry *entry_header;
+ GtkTreeView *header_list;
+ GtkListStore *header_list_store;
/* Junk prefs */
- struct _GtkToggleButton *check_incoming;
- struct _GtkToggleButton *empty_junk;
- struct _GtkComboBox *empty_junk_days;
-
- struct _GtkToggleButton *sa_local_tests_only;
- struct _GtkToggleButton *sa_use_daemon;
- struct _GtkComboBox *default_junk_plugin;
- struct _GtkLabel *plugin_status;
- struct _GtkImage *plugin_image;
-
- struct _GtkToggleButton *junk_header_check;
- struct _GtkTreeView *junk_header_tree;
- struct _GtkButton *junk_header_add;
- struct _GtkButton *junk_header_remove;
- struct _GtkToggleButton *junk_book_lookup;
- struct _GtkToggleButton *junk_lookup_local_only;
+ GtkToggleButton *empty_junk;
+ GtkComboBox *empty_junk_days;
+
+ GtkToggleButton *sa_local_tests_only;
+ GtkToggleButton *sa_use_daemon;
+ GtkComboBox *default_junk_plugin;
+ GtkLabel *plugin_status;
+ GtkImage *plugin_image;
+
+ GtkToggleButton *junk_header_check;
+ GtkTreeView *junk_header_tree;
+ GtkListStore *junk_header_list_store;
+ GtkButton *junk_header_add;
+ GtkButton *junk_header_remove;
+ GtkToggleButton *junk_book_lookup;
+ GtkToggleButton *junk_lookup_local_only;
};
struct _EMMailerPrefsClass {
GtkVBoxClass parent_class;
-
- /* signals */
-
};
-GType em_mailer_prefs_get_type (void);
-GtkWidget * create_combo_text_widget (void);
-
-struct _GtkWidget *em_mailer_prefs_new (void);
+GType em_mailer_prefs_get_type (void);
+GtkWidget * create_combo_text_widget (void);
-EMMailerPrefsHeader *em_mailer_prefs_header_from_xml(const char *xml);
-char *em_mailer_prefs_header_to_xml(EMMailerPrefsHeader *header);
-void em_mailer_prefs_header_free(EMMailerPrefsHeader *header);
+GtkWidget * em_mailer_prefs_new (EShell *shell);
-/* needed by global config */
-#define EM_MAILER_PREFS_CONTROL_ID "OAFIID:GNOME_Evolution_Mail_MailerPrefs_ConfigControl:" BASE_VERSION
+EMMailerPrefsHeader *
+ em_mailer_prefs_header_from_xml (const gchar *xml);
+gchar * em_mailer_prefs_header_to_xml (EMMailerPrefsHeader *header);
+void em_mailer_prefs_header_free (EMMailerPrefsHeader *header);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
-#endif /* __EM_MAILER_PREFS_H__ */
+#endif /* EM_MAILER_PREFS_H */
diff --git a/mail/em-message-browser.c b/mail/em-message-browser.c
deleted file mode 100644
index 9299f3754f..0000000000
--- a/mail/em-message-browser.c
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-#ifdef G_OS_WIN32
-/* Work around 'DATADIR' and 'interface' lossage in <windows.h> */
-#define DATADIR crap_DATADIR
-#include <windows.h>
-#undef DATADIR
-#undef interface
-#endif
-
-#include <gdk/gdkkeysyms.h>
-
-#include <gconf/gconf-client.h>
-
-#include <camel/camel-folder.h>
-
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-window.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-ui-component.h>
-#include <bonobo/bonobo-ui-util.h>
-
-#include "e-util/e-util-private.h"
-
-#include "e-mail-search-bar.h"
-#include "em-format-html-display.h"
-#include "em-message-browser.h"
-#include "em-menu.h"
-
-#include "evolution-shell-component-utils.h" /* Pixmap stuff, sigh */
-
-#define EM_MESSAGE_BROWSER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE \
- ((obj), EM_TYPE_MESSAGE_BROWSER, EMMessageBrowserPrivate))
-
-#define DEFAULT_WIDTH 600
-#define DEFAULT_HEIGHT 400
-
-struct _EMMessageBrowserPrivate {
- GtkWidget *preview; /* container for message display */
- GtkWidget *search_bar;
-};
-
-static gpointer parent_class;
-static GtkAllocation window_size = { 0, 0, 0, 0 };
-
-static void
-emmb_close (BonoboUIComponent *uid,
- gpointer data,
- const gchar *path)
-{
- EMMessageBrowser *emmb = data;
- GtkWidget *toplevel;
-
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (emmb));
- gtk_widget_destroy (toplevel);
-}
-
-static BonoboUIVerb emmb_verbs[] = {
- BONOBO_UI_UNSAFE_VERB ("MessageBrowserClose", emmb_close),
- BONOBO_UI_VERB_END
-};
-
-static void
-emmb_set_message (EMFolderView *emfv,
- const gchar *uid,
- gint nomarkseen)
-{
- EMMessageBrowser *emmb = EM_MESSAGE_BROWSER (emfv);
- EMFolderViewClass *folder_view_class;
- CamelMessageInfo *info;
-
- /* Chain up to parent's set_message() method. */
- folder_view_class = EM_FOLDER_VIEW_CLASS (parent_class);
- folder_view_class->set_message (emfv, uid, nomarkseen);
-
- if (uid == NULL) {
- gtk_widget_destroy (GTK_WIDGET (emfv));
- return;
- }
-
- info = camel_folder_get_message_info (emfv->folder, uid);
-
- if (info != NULL) {
- gtk_window_set_title (
- GTK_WINDOW (emmb->window),
- camel_message_info_subject (info));
- camel_folder_free_message_info (emfv->folder, info);
- }
-
- /* Well we don't know if it got displayed (yet) ... but whatever ... */
- if (!nomarkseen)
- camel_folder_set_message_flags (
- emfv->folder, uid,
- CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
-}
-
-static void
-emmb_activate (EMFolderView *emfv,
- BonoboUIComponent *uic,
- gint state)
-{
- EMFolderViewClass *folder_view_class;
-
- folder_view_class = EM_FOLDER_VIEW_CLASS (parent_class);
-
- if (state) {
- /* Chain up to parent's activate() method. */
- folder_view_class->activate (emfv, uic, state);
-
- bonobo_ui_component_add_verb_list_with_data (
- uic, emmb_verbs, emfv);
- bonobo_ui_component_set_prop(
- uic, "/commands/EditPaste", "sensitive", "0", NULL);
- } else {
- const BonoboUIVerb *verb;
-
- for (verb = &emmb_verbs[0]; verb->cname; verb++)
- bonobo_ui_component_remove_verb (uic, verb->cname);
-
- /* Chain up to parent's activate() method. */
- folder_view_class->activate (emfv, uic, state);
- }
-}
-
-static void
-emmb_list_message_selected_cb (struct _MessageList *ml,
- const gchar *uid,
- EMMessageBrowser *emmb)
-{
- EMFolderView *emfv = EM_FOLDER_VIEW (emmb);
- CamelMessageInfo *info;
-
- if (uid == NULL)
- return;
-
- info = camel_folder_get_message_info (emfv->folder, uid);
- if (info == NULL)
- return;
-
- gtk_window_set_title (
- GTK_WINDOW (emmb->window),
- camel_message_info_subject (info));
- gtk_widget_grab_focus (
- GTK_WIDGET (emfv->preview->formathtml.html));
-
- camel_folder_free_message_info (emfv->folder, info);
-}
-
-static void
-emmb_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GConfClient *client;
-
- /* FIXME Have GConfBridge handle this. */
-
- /* save to in-memory variable for current session access */
- window_size = *allocation;
-
- /* save the setting across sessions */
- client = gconf_client_get_default ();
- gconf_client_set_int (
- client, "/apps/evolution/mail/message_window/width",
- window_size.width, NULL);
- gconf_client_set_int (
- client, "/apps/evolution/mail/message_window/height",
- window_size.height, NULL);
- g_object_unref (client);
-}
-
-static int
-emmb_key_press_event_cb (EMMessageBrowser *emmb,
- GdkEventKey *event)
-{
- if (event->keyval == GDK_Escape) {
- GtkWidget *toplevel;
-
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (emmb));
- gtk_widget_destroy (toplevel);
- g_signal_stop_emission_by_name (emmb, "key-press-event");
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-emmb_destroy (GtkObject *gtk_object)
-{
- EMFolderView *emfv = EM_FOLDER_VIEW (gtk_object);
-
- if (emfv->list) {
- gtk_widget_destroy (GTK_WIDGET (emfv->list));
- emfv->list = NULL;
- }
-
- /* Chain up to parent's destroy() method. */
- GTK_OBJECT_CLASS (parent_class)->destroy (gtk_object);
-}
-
-static void
-emmb_show_search_bar (EMFolderView *folder_view)
-{
- EMMessageBrowser *browser = EM_MESSAGE_BROWSER (folder_view);
-
- gtk_widget_show (browser->priv->search_bar);
-}
-
-static void
-emmb_class_init (EMMessageBrowserClass *class)
-{
- GtkObjectClass *gtk_object_class;
- EMFolderViewClass *folder_view_class;
-
- parent_class = g_type_class_peek_parent (class);
- g_type_class_add_private (class, sizeof (EMMessageBrowserPrivate));
-
- gtk_object_class = GTK_OBJECT_CLASS (class);
- gtk_object_class->destroy = emmb_destroy;
-
- folder_view_class = EM_FOLDER_VIEW_CLASS (class);
- folder_view_class->update_message_style = FALSE;
- folder_view_class->set_message = emmb_set_message;
- folder_view_class->activate = emmb_activate;
- folder_view_class->show_search_bar = emmb_show_search_bar;
-}
-
-static void
-emmb_init (EMMessageBrowser *emmb)
-{
- EMFolderView *emfv = EM_FOLDER_VIEW (emmb);
- GtkWidget *container;
- GtkWidget *widget;
- gchar *filename;
-
- emmb->priv = EM_MESSAGE_BROWSER_GET_PRIVATE (emmb);
-
- emfv->preview_active = TRUE;
-
- g_slist_foreach (emfv->ui_files, (GFunc) g_free, NULL);
- g_slist_free (emfv->ui_files);
- emfv->ui_files = NULL;
-
- filename = g_build_filename (
- EVOLUTION_UIDIR, "evolution-mail-messagedisplay.xml", NULL);
- emfv->ui_files = g_slist_append (emfv->ui_files, filename);
-
- filename = g_build_filename (
- EVOLUTION_UIDIR, "evolution-mail-message.xml", NULL);
- emfv->ui_files = g_slist_append (emfv->ui_files, filename);
-
- gtk_box_set_spacing (GTK_BOX (emmb), 1);
-
- container = GTK_WIDGET (emmb);
-
- widget = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (
- GTK_SCROLLED_WINDOW (widget),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (
- GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
- gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
- emmb->priv->preview = widget;
- gtk_widget_show (widget);
-
- widget = e_mail_search_bar_new (emfv->preview->formathtml.html);
- gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- emmb->priv->search_bar = widget;
- gtk_widget_hide (widget);
-
- g_signal_connect_swapped (
- widget, "changed",
- G_CALLBACK (em_format_redraw), emfv->preview);
-
- container = emmb->priv->preview;
-
- widget = GTK_WIDGET (emfv->preview->formathtml.html);
- gtk_container_add (GTK_CONTAINER (container), widget);
- gtk_widget_show (widget);
-
- /** @HookPoint-EMMenu: Standalone Message View Menu
- * @Id: org.gnome.evolution.mail.messagebrowser
- * @Class: org.gnome.evolution.mail.bonobomenu:1.0
- * @Target: EMMenuTargetSelect
- *
- * The main menu of standalone message viewer.
- */
- EM_FOLDER_VIEW (emmb)->menu =
- em_menu_new ("org.gnome.evolution.mail.messagebrowser");
-}
-
-GType
-em_message_browser_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMMessageBrowserClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) emmb_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMMessageBrowser),
- 0, /* n_preallocs */
- (GInstanceInitFunc) emmb_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- EM_TYPE_FOLDER_VIEW, "EMMessageBrowser",
- &type_info, 0);
- }
-
- return type;
-}
-
-GtkWidget *
-em_message_browser_new (void)
-{
- return g_object_new (EM_TYPE_MESSAGE_BROWSER, NULL);
-}
-
-GtkWidget *
-em_message_browser_window_new (void)
-{
- EMMessageBrowser *emmb;
- BonoboUIContainer *uicont;
- BonoboUIComponent *uic;
-
- emmb = (EMMessageBrowser *) em_message_browser_new ();
- gtk_widget_show (GTK_WIDGET (emmb));
-
- /* FIXME: title set elsewhere? */
- emmb->window = g_object_new (
- BONOBO_TYPE_WINDOW, "title", "Evolution", NULL);
- bonobo_window_set_contents (
- BONOBO_WINDOW (emmb->window), GTK_WIDGET (emmb));
-
- uic = bonobo_ui_component_new_default ();
- uicont = bonobo_window_get_ui_container (BONOBO_WINDOW (emmb->window));
- bonobo_ui_component_set_container (uic, BONOBO_OBJREF (uicont), NULL);
-
- em_folder_view_activate (EM_FOLDER_VIEW (emmb), uic, TRUE);
-
- if (window_size.width == 0) {
- /* initialize @window_size with the previous session's size */
-
- /* FIXME Have GConfBridge handle this. */
-
- GConfClient *client;
- GError *error = NULL;
-
- client = gconf_client_get_default ();
-
- window_size.width = gconf_client_get_int (
- client, "/apps/evolution/mail/message_window/width",
- &error);
- if (error != NULL) {
- window_size.width = DEFAULT_WIDTH;
- g_clear_error (&error);
- }
-
- window_size.height = gconf_client_get_int (
- client, "/apps/evolution/mail/message_window/height",
- &error);
- if (error != NULL) {
- window_size.height = DEFAULT_HEIGHT;
- g_clear_error (&error);
- }
-
- g_object_unref (client);
- }
-
- gtk_window_set_default_size (
- GTK_WINDOW (emmb->window),
- window_size.width, window_size.height);
-
- g_signal_connect (
- emmb->window, "size-allocate",
- G_CALLBACK (emmb_window_size_allocate), NULL);
- g_signal_connect (
- EM_FOLDER_VIEW (emmb)->list, "message_selected",
- G_CALLBACK (emmb_list_message_selected_cb), emmb);
- g_signal_connect (
- emmb, "key-press-event",
- G_CALLBACK (emmb_key_press_event_cb), NULL);
-
- /* cleanup? */
-
- return GTK_WIDGET (emmb);
-}
diff --git a/mail/em-message-browser.h b/mail/em-message-browser.h
deleted file mode 100644
index d394adc9ba..0000000000
--- a/mail/em-message-browser.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef EM_MESSAGE_BROWSER_H
-#define EM_MESSAGE_BROWSER_H
-
-#include <gtk/gtk.h>
-#include "em-folder-view.h"
-
-/* Standard GObject macros */
-#define EM_TYPE_MESSAGE_BROWSER \
- (em_message_browser_get_type ())
-#define EM_MESSAGE_BROWSER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST \
- ((obj), EM_TYPE_MESSAGE_BROWSER, EMMessageBrowser))
-#define EM_MESSAGE_BROWSER_CLASS(cls) \
- (G_TYPE_CHECK_CLASS_CAST \
- ((cls), EM_TYPE_MESSAGE_BROWSER, EMMessageBrowserClass))
-#define EM_IS_MESSAGE_BROWSER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE \
- ((obj), EM_TYPE_MESSAGE_BROWSER))
-#define EM_IS_MESSAGE_BROWSER_CLASS(cls) \
- (G_TYPE_CHECK_CLASS_TYPE \
- ((cls), EM_TYPE_MESSAGE_BROWSER))
-#define EM_MESSAGE_BROWSER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS \
- ((obj), EM_TYPE_MESSAGE_BROWSER, EMMessageBrowserClass))
-
-G_BEGIN_DECLS
-
-typedef struct _EMMessageBrowser EMMessageBrowser;
-typedef struct _EMMessageBrowserClass EMMessageBrowserClass;
-typedef struct _EMMessageBrowserPrivate EMMessageBrowserPrivate;
-
-struct _EMMessageBrowser {
- EMFolderView parent;
-
- /* container, if setup */
- GtkWidget *window;
-
- EMMessageBrowserPrivate *priv;
-};
-
-struct _EMMessageBrowserClass {
- EMFolderViewClass parent_class;
-};
-
-GType em_message_browser_get_type (void);
-
-GtkWidget * em_message_browser_new (void);
-
-/* Also sets up a bonobo container window w/ docks and so on. */
-GtkWidget * em_message_browser_window_new (void);
-
-G_END_DECLS
-
-#endif /* EM_MESSAGE_BROWSER_H */
diff --git a/mail/em-network-prefs.c b/mail/em-network-prefs.c
index b0c51ed863..f892849fae 100644
--- a/mail/em-network-prefs.c
+++ b/mail/em-network-prefs.c
@@ -32,8 +32,6 @@
#include "em-network-prefs.h"
-#include <bonobo/bonobo-generic-factory.h>
-
#include <gdk/gdkkeysyms.h>
#include <gconf/gconf-client.h>
#include <glade/glade.h>
diff --git a/mail/em-network-prefs.h b/mail/em-network-prefs.h
index 3d933a7acc..bd4e9e7c8e 100644
--- a/mail/em-network-prefs.h
+++ b/mail/em-network-prefs.h
@@ -20,30 +20,37 @@
*
*/
-#ifndef __EM_NETWORK_PREFS_H__
-#define __EM_NETWORK_PREFS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+#ifndef EM_NETWORK_PREFS_H
+#define EM_NETWORK_PREFS_H
#include <gtk/gtk.h>
-
-#define EM_NETWORK_PREFS_TYPE (em_network_prefs_get_type ())
-#define EM_NETWORK_PREFS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EM_NETWORK_PREFS_TYPE, EMNetworkPrefs))
-#define EM_NETWORK_PREFS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EM_NETWORK_PREFS_TYPE, EMNetworkPrefsClass))
-#define EM_IS_NETWORK_PREFS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EM_NETWORK_PREFS_TYPE))
-#define EM_IS_NETWORK_PREFS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EM_NETWORK_PREFS_TYPE))
+#include <glade/glade.h>
+#include <gconf/gconf-client.h>
+
+/* Standard GObject macros */
+#define EM_TYPE_NETWORK_PREFS \
+ (em_network_prefs_get_type ())
+#define EM_NETWORK_PREFS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_TYPE_NETWORK_PREFS, EMNetworkPrefs))
+#define EM_NETWORK_PREFS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_TYPE_NETWORK_PREFS, EMNetworkPrefsClass))
+#define EM_IS_NETWORK_PREFS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_TYPE_NETWORK_PREFS))
+#define EM_IS_NETWORK_PREFS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EM_TYPE_NETWORK_PREFS))
+#define EM_NETWORK_PREFS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_TYPE_NETWORK_PREFS, EMNetworkPrefsClass))
+
+G_BEGIN_DECLS
typedef struct _EMNetworkPrefs EMNetworkPrefs;
typedef struct _EMNetworkPrefsClass EMNetworkPrefsClass;
-struct _GtkToggleButton;
-struct _GtkEntry;
-struct _GladeXML;
-struct _GConfClient;
-
typedef enum {
NETWORK_PROXY_SYS_SETTINGS,
NETWORK_PROXY_DIRECT_CONNECTION,
@@ -51,66 +58,47 @@ typedef enum {
NETWORK_PROXY_AUTOCONFIG
} NetworkConfigProxyType;
-
struct _EMNetworkPrefs {
GtkVBox parent_object;
- struct _GConfClient *gconf;
+ GConfClient *gconf;
- struct _GladeXML *gui;
+ GladeXML *gui;
/* Default Behavior */
- struct _GtkToggleButton *sys_proxy;
- struct _GtkToggleButton *no_proxy;
- struct _GtkToggleButton *manual_proxy;
-#if 0
- struct _GtkToggleButton *auto_proxy;
-#endif
- struct _GtkToggleButton *use_auth;
-
- struct _GtkEntry *http_host;
- struct _GtkEntry *https_host;
- struct _GtkEntry *ignore_hosts;
-#if 0
- struct _GtkEntry *auto_proxy_url;
-#endif
- struct _GtkEntry *auth_user;
- struct _GtkEntry *auth_pwd;
-
- struct _GtkLabel *lbl_http_host;
- struct _GtkLabel *lbl_http_port;
- struct _GtkLabel *lbl_https_host;
- struct _GtkLabel *lbl_https_port;
- struct _GtkLabel *lbl_ignore_hosts;
- struct _GtkLabel *lbl_auth_user;
- struct _GtkLabel *lbl_auth_pwd;
-
- struct _GtkSpinButton *http_port;
- struct _GtkSpinButton *https_port;
-#if 0
- struct _GtkLabel *lbl_socks_host;
- struct _GtkEntry *socks_host;
- struct _GtkLabel *lbl_socks_port;
- struct _GtkSpinButton *socks_port;
-#endif
+ GtkToggleButton *sys_proxy;
+ GtkToggleButton *no_proxy;
+ GtkToggleButton *manual_proxy;
+ GtkToggleButton *use_auth;
+
+ GtkEntry *http_host;
+ GtkEntry *https_host;
+ GtkEntry *socks_host;
+ GtkEntry *ignore_hosts;
+ GtkEntry *auth_user;
+ GtkEntry *auth_pwd;
+
+ GtkLabel *lbl_http_host;
+ GtkLabel *lbl_http_port;
+ GtkLabel *lbl_https_host;
+ GtkLabel *lbl_https_port;
+ GtkLabel *lbl_socks_host;
+ GtkLabel *lbl_socks_port;
+ GtkLabel *lbl_ignore_hosts;
+ GtkLabel *lbl_auth_user;
+ GtkLabel *lbl_auth_pwd;
+
+ GtkSpinButton *http_port;
+ GtkSpinButton *https_port;
};
struct _EMNetworkPrefsClass {
GtkVBoxClass parent_class;
-
- /* signals */
-
};
-GType em_network_prefs_get_type (void);
-
-struct _GtkWidget *em_network_prefs_new (void);
-
-/* needed by global config */
-#define EM_NETWORK_PREFS_CONTROL_ID "OAFIID:GNOME_Evolution_Mail_NetworkPrefs_ConfigControl:" BASE_VERSION
+GType em_network_prefs_get_type (void);
+GtkWidget * em_network_prefs_new (void);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
-#endif /* __EM_NETWORK_PREFS_H__ */
+#endif /* EM_NETWORK_PREFS_H */
diff --git a/mail/em-popup.c b/mail/em-popup.c
index ad738fca57..38c0f7e40b 100644
--- a/mail/em-popup.c
+++ b/mail/em-popup.c
@@ -55,8 +55,6 @@
#include <e-util/e-util.h>
#include "e-attachment.h"
-static void emp_standard_menu_factory(EPopup *emp, void *data);
-
static GObjectClass *emp_parent;
static void
@@ -110,8 +108,6 @@ emp_class_init(GObjectClass *klass)
{
klass->finalize = emp_finalise;
((EPopupClass *)klass)->target_free = emp_target_free;
-
- e_popup_class_add_factory((EPopupClass *)klass, NULL, emp_standard_menu_factory, NULL);
}
GType
@@ -353,419 +349,6 @@ done:
/* ********************************************************************** */
-static void
-emp_part_popup_saveas(EPopup *ep, EPopupItem *item, void *data)
-{
- EPopupTarget *t = ep->target;
- CamelMimePart *part = NULL;
-
- part = ((EMPopupTargetPart *) t)->part;
-
- em_utils_save_part(ep->target->widget, _("Save As..."), part);
-}
-
-static void
-emp_part_popup_set_background(EPopup *ep, EPopupItem *item, void *data)
-{
- EPopupTarget *t = ep->target;
- GConfClient *gconf;
- char *str, *filename, *path, *extension;
- unsigned int i=1;
- CamelMimePart *part = NULL;
-
- part = ((EMPopupTargetPart *) t)->part;
-
- if (!part)
- return;
-
- filename = g_strdup(camel_mime_part_get_filename(part));
-
- /* if filename is blank, create a default filename based on MIME type */
- if (!filename || !filename[0]) {
- CamelContentType *ct;
-
- ct = camel_mime_part_get_content_type(part);
- g_free (filename);
- filename = g_strdup_printf (_("untitled_image.%s"), ct->subtype);
- }
-
- e_filename_make_safe(filename);
-
- path = g_build_filename(g_get_home_dir(), ".gnome2", "wallpapers", filename, NULL);
-
- extension = strrchr(filename, '.');
- if (extension)
- *extension++ = 0;
-
- /* if file exists, stick a (number) on the end */
- while (g_file_test(path, G_FILE_TEST_EXISTS)) {
- char *name;
- name = g_strdup_printf(extension?"%s (%d).%s":"%s (%d)", filename, i++, extension);
- g_free(path);
- path = g_build_filename(g_get_home_dir(), ".gnome2", "wallpapers", name, NULL);
- g_free(name);
- }
-
- g_free(filename);
-
- if (em_utils_save_part_to_file(ep->target->widget, path, part)) {
- gconf = gconf_client_get_default();
-
- /* if the filename hasn't changed, blank the filename before
- * setting it so that gconf detects a change and updates it */
- if ((str = gconf_client_get_string(gconf, "/desktop/gnome/background/picture_filename", NULL)) != NULL
- && strcmp (str, path) == 0) {
- gconf_client_set_string(gconf, "/desktop/gnome/background/picture_filename", "", NULL);
- }
-
- g_free (str);
- gconf_client_set_string(gconf, "/desktop/gnome/background/picture_filename", path, NULL);
-
- /* if GNOME currently doesn't display a picture, set to "wallpaper"
- * display mode, otherwise leave it alone */
- if ((str = gconf_client_get_string(gconf, "/desktop/gnome/background/picture_options", NULL)) == NULL
- || strcmp(str, "none") == 0) {
- gconf_client_set_string(gconf, "/desktop/gnome/background/picture_options", "wallpaper", NULL);
- }
-
- gconf_client_suggest_sync(gconf, NULL);
-
- g_free(str);
- g_object_unref(gconf);
- }
-
- g_free(path);
-}
-
-static void
-emp_part_popup_reply_sender(EPopup *ep, EPopupItem *item, void *data)
-{
- EPopupTarget *t = ep->target;
- CamelMimeMessage *message;
- CamelMimePart *part;
-
- part = ((EMPopupTargetPart *) t)->part;
-
- message = (CamelMimeMessage *)camel_medium_get_content_object((CamelMedium *)part);
- em_utils_reply_to_message(NULL, NULL, message, REPLY_MODE_SENDER, NULL);
-}
-
-static void
-emp_part_popup_reply_list (EPopup *ep, EPopupItem *item, void *data)
-{
- EPopupTarget *t = ep->target;
- CamelMimeMessage *message;
- CamelMimePart *part;
-
- part = ((EMPopupTargetPart *) t)->part;
-
- message = (CamelMimeMessage *)camel_medium_get_content_object((CamelMedium *)part);
- em_utils_reply_to_message(NULL, NULL, message, REPLY_MODE_LIST, NULL);
-}
-
-static void
-emp_part_popup_reply_all (EPopup *ep, EPopupItem *item, void *data)
-{
- EPopupTarget *t = ep->target;
- CamelMimeMessage *message;
- CamelMimePart *part;
-
- part = ((EMPopupTargetPart *) t)->part;
-
- message = (CamelMimeMessage *)camel_medium_get_content_object((CamelMedium *)part);
- em_utils_reply_to_message(NULL, NULL, message, REPLY_MODE_ALL, NULL);
-}
-
-static void
-emp_part_popup_forward (EPopup *ep, EPopupItem *item, void *data)
-{
- EPopupTarget *t = ep->target;
- CamelMimeMessage *message;
- CamelMimePart *part;
-
- part = ((EMPopupTargetPart *) t)->part;
-
- /* TODO: have a emfv specific override so we can get the parent folder uri */
- message = (CamelMimeMessage *)camel_medium_get_content_object((CamelMedium *) part);
- em_utils_forward_message(message, NULL);
-}
-
-static EMPopupItem emp_standard_object_popups[] = {
- { E_POPUP_ITEM, (gchar *) "00.part.00", (gchar *) N_("_Save As..."), emp_part_popup_saveas, NULL, (gchar *) "document-save-as", 0 },
- { E_POPUP_ITEM, (gchar *) "00.part.10", (gchar *) N_("Set as _Background"), emp_part_popup_set_background, NULL, NULL, EM_POPUP_PART_IMAGE },
- { E_POPUP_BAR, (gchar *) "10.part", NULL, NULL, NULL, NULL, EM_POPUP_PART_MESSAGE },
- { E_POPUP_ITEM, (gchar *) "10.part.00", (gchar *) N_("_Reply to sender"), emp_part_popup_reply_sender, NULL, (gchar *) "mail-reply-sender" , EM_POPUP_PART_MESSAGE },
- { E_POPUP_ITEM, (gchar *) "10.part.01", (gchar *) N_("Reply to _List"), emp_part_popup_reply_list, NULL, NULL, EM_POPUP_PART_MESSAGE},
- { E_POPUP_ITEM, (gchar *) "10.part.03", (gchar *) N_("Reply to _All"), emp_part_popup_reply_all, NULL, (gchar *) "mail-reply-all", EM_POPUP_PART_MESSAGE},
- { E_POPUP_BAR, (gchar *) "20.part", NULL, NULL, NULL, NULL, EM_POPUP_PART_MESSAGE },
- { E_POPUP_ITEM, (gchar *) "20.part.00", (gchar *) N_("_Forward"), emp_part_popup_forward, NULL, (gchar *) "mail-forward", EM_POPUP_PART_MESSAGE },
-};
-
-static const EPopupItem emp_standard_part_apps_bar = { E_POPUP_BAR, (gchar *) "99.object" };
-
-/* ********************************************************************** */
-
-static void
-emp_uri_popup_link_open(EPopup *ep, EPopupItem *item, void *data)
-{
- EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target;
-
- /* FIXME Pass a parent window. */
- e_show_uri (NULL, t->uri);
-}
-
-static void
-emp_uri_popup_address_send(EPopup *ep, EPopupItem *item, void *data)
-{
- EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target;
-
- /* TODO: have an emfv specific override to get the from uri */
- em_utils_compose_new_message_with_mailto(t->uri, NULL);
-}
-
-static void
-emp_uri_popup_address_add(EPopup *ep, EPopupItem *item, void *data)
-{
- EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target;
- CamelURL *url;
-
- url = camel_url_new(t->uri, NULL);
- if (url == NULL) {
- g_warning("cannot parse url '%s'", t->uri);
- return;
- }
-
- if (url->path && url->path[0])
- em_utils_add_address(ep->target->widget, url->path);
-
- camel_url_free(url);
-}
-
-static EPopupItem emp_standard_uri_popups[] = {
- { E_POPUP_ITEM, (gchar *) "00.uri.00", (gchar *) N_("_Open Link in Browser"), emp_uri_popup_link_open, NULL, NULL, EM_POPUP_URI_HTTP },
- { E_POPUP_ITEM, (gchar *) "00.uri.10", (gchar *) N_("_Send New Message To..."), emp_uri_popup_address_send, NULL, (gchar *) "mail-message-new", EM_POPUP_URI_MAILTO },
- { E_POPUP_ITEM, (gchar *) "00.uri.20", (gchar *) N_("_Add to Address Book"), emp_uri_popup_address_add, NULL, (gchar *) "contact-new", EM_POPUP_URI_MAILTO },
-};
-
-/* ********************************************************************** */
-
-#define LEN(x) (sizeof(x)/sizeof(x[0]))
-
-static void
-emp_apps_open_in(EPopup *ep, EPopupItem *item, void *data)
-{
- char *path;
- EPopupTarget *target = ep->target;
- CamelMimePart *part;
-
- part = ((EMPopupTargetPart *) target)->part;
-
- path = em_utils_temp_save_part(target->widget, part, TRUE);
- if (path) {
- GAppInfo *app = item->user_data;
- GList *uris = NULL;
- GError *error = NULL;
-
- if (g_app_info_supports_files (app)) {
- GFile *file = g_file_new_for_path (path);
-
- uris = g_list_append (uris, file);
- g_app_info_launch (app, uris, NULL, &error);
- g_object_unref (file);
- } else {
- char *uri;
-
- uri = e_util_filename_to_uri (path);
- uris = g_list_append (uris, uri);
-
- g_app_info_launch_uris (app, uris, NULL, &error);
- g_free (uri);
- }
-
- if (error) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
-
- g_list_free (uris);
- g_free (path);
- }
-}
-
-static void
-emp_apps_popup_free(EPopup *ep, GSList *free_list, void *data)
-{
- while (free_list) {
- GSList *n = free_list->next;
- EPopupItem *item = free_list->data;
-
- if (item->user_data && item->activate == emp_apps_open_in)
- g_object_unref (item->user_data);
-
- g_free(item->path);
- g_free(item->label);
- g_free(item);
- g_slist_free_1(free_list);
-
- free_list = n;
- }
-}
-
-static void
-emp_standard_items_free(EPopup *ep, GSList *items, void *data)
-{
- g_slist_free(items);
-}
-
-static void
-emp_add_vcard (EPopup *ep, EPopupItem *item, void *data)
-{
- EPopupTarget *target = ep->target;
- CamelMimePart *part;
- CamelDataWrapper *content;
- CamelStreamMem *mem;
-
-
- part = ((EMPopupTargetPart *) target)->part;
-
- if (!part)
- return;
-
- content = camel_medium_get_content_object (CAMEL_MEDIUM (part));
- mem = CAMEL_STREAM_MEM (camel_stream_mem_new ());
-
- if (camel_data_wrapper_decode_to_stream (content, CAMEL_STREAM (mem)) == -1 ||
- !mem->buffer->data)
- g_warning ("Read part's content failed!");
- else {
- GString *vcard = g_string_new_len ((const gchar *) mem->buffer->data, mem->buffer->len);
-
- em_utils_add_vcard (target->widget, vcard->str);
-
- g_string_free (vcard, TRUE);
- }
-
- camel_object_unref (mem);
-}
-
-static void
-emp_standard_menu_factory(EPopup *emp, void *data)
-{
- int i, len;
- EPopupItem *items;
- GSList *menus = NULL;
- GList *apps = NULL;
- char *mime_type = NULL;
- const char *filename = NULL;
-
- switch (emp->target->type) {
-#if 0
- case EM_POPUP_TARGET_SELECT:
- return;
- items = emp_standard_select_popups;
- len = LEN(emp_standard_select_popups);
- break;
-#endif
- case EM_POPUP_TARGET_URI: {
- /*EMPopupTargetURI *t = (EMPopupTargetURI *)target;*/
-
- items = emp_standard_uri_popups;
- len = LEN(emp_standard_uri_popups);
- break; }
- case EM_POPUP_TARGET_PART: {
- EMPopupTargetPart *t = (EMPopupTargetPart *)emp->target;
- mime_type = camel_data_wrapper_get_mime_type((CamelDataWrapper *)t->part);
- filename = camel_mime_part_get_filename(t->part);
-
- items = emp_standard_object_popups;
- len = LEN(emp_standard_object_popups);
- break; }
- default:
- items = NULL;
- len = 0;
- }
-
- if (mime_type) {
- gchar *cp;
-
- /* GIO expects lowercase MIME types. */
- for (cp = mime_type; *cp != '\0'; cp++)
- *cp = g_ascii_tolower (*cp);
-
- cp = g_content_type_from_mime_type (mime_type);
- apps = g_app_info_get_all_for_type (cp ? cp : mime_type);
- g_free (cp);
-
- if (apps == NULL || strcmp (mime_type, "application/octet-stream") == 0) {
- if (filename != NULL) {
- gchar *name_type;
-
- name_type = e_util_guess_mime_type (filename, FALSE);
- cp = g_content_type_from_mime_type (name_type);
- /* show alternative apps first */
- apps = g_list_concat (g_app_info_get_all_for_type (cp ? cp : name_type), apps);
- g_free (cp);
- g_free (name_type);
- }
- }
-
- if (apps) {
- GString *label = g_string_new("");
- GSList *open_menus = NULL;
- GList *l;
-
- menus = g_slist_prepend(menus, (void *)&emp_standard_part_apps_bar);
-
- for (l = apps, i = 0; l; l = l->next, i++) {
- GAppInfo *app = l->data;
- EPopupItem *item;
-
- item = g_malloc0(sizeof(*item));
- item->type = E_POPUP_ITEM;
- item->path = g_strdup_printf("99.object.%02d", i);
- item->label = g_strdup_printf(_("Open in %s..."), g_app_info_get_name (app));
- item->activate = emp_apps_open_in;
- item->user_data = app;
-
- open_menus = g_slist_prepend(open_menus, item);
- }
-
- if (open_menus)
- e_popup_add_items(emp, open_menus, NULL, emp_apps_popup_free, NULL);
-
- g_string_free(label, TRUE);
- g_list_free(apps);
- }
-
- if (g_ascii_strcasecmp (mime_type, "text/x-vcard") == 0||
- g_ascii_strcasecmp (mime_type, "text/vcard") == 0) {
- EPopupItem *item;
-
- item = g_malloc0 (sizeof (*item));
- item->type = E_POPUP_ITEM;
- item->path = (gchar *) "00.00.vcf.00"; /* make it first item */
- item->label = _("_Add to Address Book");
- item->activate = emp_add_vcard;
- item->user_data = NULL;
- item->image = (gchar *) "contact-new";
-
- e_popup_add_items (emp, g_slist_append (NULL, item), NULL, NULL, NULL);
- }
-
- g_free (mime_type);
- }
-
- for (i=0;i<len;i++) {
- if ((items[i].visible & emp->target->mask) == 0)
- menus = g_slist_prepend(menus, &items[i]);
- }
-
- if (menus)
- e_popup_add_items(emp, menus, NULL, emp_standard_items_free, NULL);
-}
-
-/* ********************************************************************** */
-
/* Popup menu plugin handler */
/*
diff --git a/mail/em-search-context.c b/mail/em-search-context.c
index ac03d40a80..7bc43a18be 100644
--- a/mail/em-search-context.c
+++ b/mail/em-search-context.c
@@ -33,35 +33,40 @@
#include "filter/filter-option.h"
#include "filter/filter-int.h"
-static FilterElement *em_search_new_element(RuleContext *rc, const char *type);
+static gpointer parent_class;
-static RuleContextClass *parent_class = NULL;
-
-static void
-em_search_context_finalise (GObject *obj)
+static FilterElement *
+search_context_new_element (RuleContext *context,
+ const gchar *type)
{
- G_OBJECT_CLASS (parent_class)->finalize (obj);
+ if (strcmp (type, "system-flag") == 0)
+ return (FilterElement *) filter_option_new ();
+
+ if (strcmp (type, "score") == 0)
+ return (FilterElement *) filter_int_new_type ("score", -3, 3);
+
+ /* Chain up to parent's new_element() method. */
+ return RULE_CONTEXT_CLASS (parent_class)->new_element (context, type);
}
static void
-em_search_context_class_init (EMSearchContextClass *klass)
+search_context_class_init (EMSearchContextClass *class)
{
- parent_class = g_type_class_ref (RULE_TYPE_CONTEXT);
+ RuleContextClass *rule_context_class;
- ((GObjectClass *)klass)->finalize = em_search_context_finalise;
- ((RuleContextClass *)klass)->new_element = em_search_new_element;
+ parent_class = g_type_class_peek_parent (class);
+
+ rule_context_class = RULE_CONTEXT_CLASS (class);
+ rule_context_class->new_element = search_context_new_element;
}
static void
-em_search_context_init (EMSearchContext *vc)
+search_context_init (EMSearchContext *vc)
{
- rule_context_add_part_set ((RuleContext *)vc, "partset", filter_part_get_type (),
- rule_context_add_part, rule_context_next_part);
-
- rule_context_add_rule_set ((RuleContext *)vc, "ruleset", filter_rule_get_type (),
- rule_context_add_rule, rule_context_next_rule);
+ RuleContext *rule_context;
- ((RuleContext *)vc)->flags = RULE_CONTEXT_THREADING | RULE_CONTEXT_GROUPING;
+ rule_context = RULE_CONTEXT (vc);
+ rule_context->flags = RULE_CONTEXT_THREADING | RULE_CONTEXT_GROUPING;
}
GType
@@ -69,46 +74,29 @@ em_search_context_get_type (void)
{
static GType type = 0;
- if (!type) {
- static const GTypeInfo info = {
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
sizeof (EMSearchContextClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) em_search_context_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) search_context_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
sizeof (EMSearchContext),
- 0, /* n_preallocs */
- (GInstanceInitFunc) em_search_context_init,
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) search_context_init,
+ NULL /* value_table */
};
- type = g_type_register_static (RULE_TYPE_CONTEXT, "EMSearchContext", &info, 0);
+ type = g_type_register_static (
+ RULE_TYPE_CONTEXT, "EMSearchContext", &type_info, 0);
}
return type;
}
-/**
- * em_search_context_new:
- *
- * Create a new EMSearchContext object.
- *
- * Return value: A new #EMSearchContext object.
- **/
-EMSearchContext *
+RuleContext *
em_search_context_new (void)
{
- return (EMSearchContext *) g_object_new (EM_SEARCH_TYPE_CONTEXT, NULL, NULL);
-}
-
-static FilterElement *
-em_search_new_element(RuleContext *rc, const char *type)
-{
- if (!strcmp (type, "system-flag")) {
- return (FilterElement *) filter_option_new ();
- } else if (!strcmp (type, "score")) {
- return (FilterElement *) filter_int_new_type("score", -3, 3);
- } else {
- return parent_class->new_element(rc, type);
- }
+ return g_object_new (EM_SEARCH_TYPE_CONTEXT, NULL);
}
diff --git a/mail/em-search-context.h b/mail/em-search-context.h
index 47dc6ea86a..d8b890270c 100644
--- a/mail/em-search-context.h
+++ b/mail/em-search-context.h
@@ -22,31 +22,46 @@
*
*/
-#ifndef _EM_SEARCH_CONTEXT_H
-#define _EM_SEARCH_CONTEXT_H
+#ifndef EM_SEARCH_CONTEXT_H
+#define EM_SEARCH_CONTEXT_H
-#include "filter/rule-context.h"
+#include <filter/rule-context.h>
-#define EM_SEARCH_TYPE_CONTEXT (em_search_context_get_type ())
-#define EM_SEARCH_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EM_SEARCH_TYPE_CONTEXT, EMSearchContext))
-#define EM_SEARCH_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EM_SEARCH_TYPE_CONTEXT, EMSearchContextClass))
-#define IS_EM_SEARCH_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EM_SEARCH_TYPE_CONTEXT))
-#define IS_EM_SEARCH_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EM_SEARCH_TYPE_CONTEXT))
-#define EM_SEARCH_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EM_SEARCH_TYPE_CONTEXT, EMSearchContextClass))
+/* Standard GObject macros */
+#define EM_SEARCH_TYPE_CONTEXT \
+ (em_search_context_get_type ())
+#define EM_SEARCH_CONTEXT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_SEARCH_TYPE_CONTEXT, EMSearchContext))
+#define EM_SEARCH_CONTEXT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_SEARCH_TYPE_CONTEXT, EMSearchContextClass))
+#define EM_IS_SEARCH_CONTEXT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_SEARCH_TYPE_CONTEXT))
+#define EM_IS_SEARCH_CONTEXT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EM_SEARCH_TYPE_CONTEXT))
+#define EM_SEARCH_CONTEXT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_SEARCH_TYPE_CONTEXT, EMSearchContextClass))
+
+G_BEGIN_DECLS
typedef struct _EMSearchContext EMSearchContext;
typedef struct _EMSearchContextClass EMSearchContextClass;
struct _EMSearchContext {
- RuleContext parent_object;
+ RuleContext parent;
};
struct _EMSearchContextClass {
RuleContextClass parent_class;
};
-GType em_search_context_get_type (void);
+GType em_search_context_get_type (void);
+RuleContext * em_search_context_new (void);
-EMSearchContext *em_search_context_new (void);
+G_END_DECLS
-#endif /* ! _EM_SEARCH_CONTEXT_H */
+#endif /* EM_SEARCH_CONTEXT_H */
diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c
index 25c447d62e..338ec4ccfd 100644
--- a/mail/em-subscribe-editor.c
+++ b/mail/em-subscribe-editor.c
@@ -35,8 +35,9 @@
#include "camel/camel-exception.h"
#include "camel/camel-store.h"
#include "camel/camel-session.h"
-#include "libedataserver/e-account-list.h"
#include "libedataserver/e-msgport.h"
+
+#include "e-util/e-account-utils.h"
#include "e-util/e-util-private.h"
#include "em-subscribe-editor.h"
@@ -821,7 +822,8 @@ window_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
g_object_unref (gconf);
}
-GtkDialog *em_subscribe_editor_new(void)
+GtkWidget *
+em_subscribe_editor_new(void)
{
EMSubscribeEditor *se;
EAccountList *accounts;
@@ -896,7 +898,7 @@ GtkDialog *em_subscribe_editor_new(void)
1, TRUE,
-1);
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
for (iter = e_list_get_iterator ((EList *) accounts);
e_iterator_is_valid (iter);
e_iterator_next (iter)) {
@@ -946,5 +948,5 @@ GtkDialog *em_subscribe_editor_new(void)
gtk_window_set_default_size ((GtkWindow *) se->dialog, window_size.width, window_size.height);
g_signal_connect (se->dialog, "size-allocate", G_CALLBACK (window_size_allocate), NULL);
- return se->dialog;
+ return GTK_WIDGET (se->dialog);
}
diff --git a/mail/em-subscribe-editor.h b/mail/em-subscribe-editor.h
index 36710ec0c5..d10d68bbb8 100644
--- a/mail/em-subscribe-editor.h
+++ b/mail/em-subscribe-editor.h
@@ -23,6 +23,6 @@
#include <gtk/gtk.h>
-GtkDialog *em_subscribe_editor_new(void);
+GtkWidget *em_subscribe_editor_new(void);
#endif /* ! _EM_SUBSCRIBE_EDITOR_H */
diff --git a/mail/em-utils.c b/mail/em-utils.c
index ba180e5011..9b2786904a 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -56,7 +56,6 @@
#include <gio/gio.h>
-#include "mail-component.h"
#include "mail-mt.h"
#include "mail-ops.h"
#include "mail-tools.h"
@@ -69,10 +68,10 @@
#include "e-util/e-util.h"
#include "e-util/e-util-private.h"
#include "e-util/e-mktemp.h"
-#include "libedataserver/e-account-list.h"
+#include "e-util/e-account-utils.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-error.h"
-
+#include "widgets/misc/e-alert-activity.h"
#include "em-utils.h"
#include "em-composer-utils.h"
@@ -80,11 +79,10 @@
#include "em-format-quote.h"
#include "em-account-editor.h"
#include "e-attachment.h"
-#include "e-activity-handler.h"
-static void emu_save_part_done (CamelMimePart *part, char *name, int done, void *data);
+#include "e-mail-shell-backend.h"
-extern struct _CamelSession *session;
+static void emu_save_part_done (CamelMimePart *part, char *name, int done, void *data);
#define d(x)
@@ -194,20 +192,24 @@ druid_destroy_cb (gpointer user_data, GObject *deadbeef)
* otherwise.
**/
gboolean
-em_utils_configure_account (GtkWidget *parent)
+em_utils_configure_account (GtkWindow *parent)
{
EMAccountEditor *emae;
+ EAccountList *account_list;
+
+ g_return_val_if_fail (GTK_IS_WINDOW (parent), FALSE);
emae = em_account_editor_new(NULL, EMAE_DRUID, "org.gnome.evolution.mail.config.accountDruid");
- if (parent != NULL)
- e_dialog_set_transient_for((GtkWindow *)emae->editor, parent);
+ gtk_window_set_transient_for (GTK_WINDOW (emae->editor), parent);
g_object_weak_ref((GObject *)emae->editor, (GWeakNotify) druid_destroy_cb, NULL);
gtk_widget_show(emae->editor);
gtk_grab_add(emae->editor);
gtk_main();
- return mail_config_is_configured();
+ account_list = e_get_account_list ();
+
+ return (e_list_length ((EList *) account_list) > 0);
}
/**
@@ -224,16 +226,19 @@ em_utils_configure_account (GtkWidget *parent)
* or %FALSE otherwise.
**/
gboolean
-em_utils_check_user_can_send_mail (GtkWidget *parent)
+em_utils_check_user_can_send_mail (GtkWindow *parent)
{
+ EAccountList *account_list;
EAccount *account;
- if (!mail_config_is_configured ()) {
+ account_list = e_get_account_list ();
+
+ if (e_list_length ((EList *) account_list) == 0) {
if (!em_utils_configure_account (parent))
return FALSE;
}
- if (!(account = mail_config_get_default_account ()))
+ if (!(account = e_get_default_account ()))
return FALSE;
/* Check for a transport */
@@ -250,14 +255,18 @@ static GtkWidget *filter_editor = NULL;
static void
em_filter_editor_response (GtkWidget *dialog, int button, gpointer user_data)
{
+ EShellBackend *shell_backend;
EMFilterContext *fc;
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
if (button == GTK_RESPONSE_OK) {
+ const gchar *data_dir;
char *user;
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
fc = g_object_get_data ((GObject *) dialog, "context");
- user = g_strdup_printf ("%s/filters.xml",
- mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_strdup_printf ("%s/filters.xml", data_dir);
rule_context_save ((RuleContext *) fc, user);
g_free (user);
}
@@ -284,7 +293,8 @@ static EMFilterSource em_filter_source_element_names[] = {
void
em_utils_edit_filters (GtkWidget *parent)
{
- const char *base_directory = mail_component_peek_base_directory (mail_component_peek ());
+ EShellBackend *shell_backend;
+ const gchar *data_dir;
char *user, *system;
EMFilterContext *fc;
@@ -293,8 +303,11 @@ em_utils_edit_filters (GtkWidget *parent)
return;
}
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+
fc = em_filter_context_new ();
- user = g_strdup_printf ("%s/filters.xml", base_directory);
+ user = g_build_filename (data_dir, "filters.xml", NULL);
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
rule_context_load ((RuleContext *) fc, system, user);
g_free (user);
@@ -385,12 +398,14 @@ emu_save_get_filename_for_part (CamelMimePart *part)
* Saves a mime part to disk (prompting the user for filename).
**/
void
-em_utils_save_part (GtkWidget *parent, const char *prompt, CamelMimePart *part)
+em_utils_save_part (GtkWindow *parent, const char *prompt, CamelMimePart *part)
{
GtkWidget *file_chooser;
const gchar *utf8_filename;
gchar *uri = NULL, *filename;
+ g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent));
+
utf8_filename = emu_save_get_filename_for_part (part);
filename = g_filename_from_utf8 (utf8_filename, -1, NULL, NULL, NULL);
em_filename_make_safe (filename);
@@ -500,12 +515,14 @@ get_unique_file_names (GSList *parts)
}
void
-em_utils_save_parts (GtkWidget *parent, const gchar *prompt, GSList *parts)
+em_utils_save_parts (GtkWindow *parent, const gchar *prompt, GSList *parts)
{
GtkWidget *file_chooser;
gchar *path_uri;
GSList *iter, *file_names, *iter_file;
+ g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent));
+
file_chooser = e_file_get_save_filesel (
parent, prompt, NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
@@ -556,7 +573,7 @@ exit:
* Returns %TRUE if saving succeeded, %FALSE otherwise
**/
gboolean
-em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePart *part)
+em_utils_save_part_to_file(GtkWindow *parent, const char *filename, CamelMimePart *part)
{
int done;
char *dirname;
@@ -567,7 +584,7 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar
dirname = g_path_get_dirname(filename);
if (g_mkdir_with_parents(dirname, 0777) == -1) {
- GtkWidget *w = e_error_new((GtkWindow *)parent, "mail:no-create-path", filename, g_strerror(errno), NULL);
+ GtkWidget *w = e_error_new(parent, "mail:no-create-path", filename, g_strerror(errno), NULL);
g_free(dirname);
em_utils_show_error_silent (w);
return FALSE;
@@ -576,13 +593,13 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar
if (g_access(filename, F_OK) == 0) {
if (g_access(filename, W_OK) != 0) {
- e_error_run((GtkWindow *)parent, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, filename, NULL);
+ e_error_run(parent, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, filename, NULL);
return FALSE;
}
}
if (g_stat(filename, &st) != -1 && !S_ISREG(st.st_mode)) {
- GtkWidget *w = e_error_new((GtkWindow *)parent, "mail:no-write-path-notfile", filename, NULL);
+ GtkWidget *w = e_error_new(parent, "mail:no-write-path-notfile", filename, NULL);
em_utils_show_error_silent (w);
return FALSE;
}
@@ -635,13 +652,14 @@ emu_save_messages_response(GtkWidget *filesel, int response, struct _save_messag
* user for filename).
**/
void
-em_utils_save_messages (GtkWidget *parent, CamelFolder *folder, GPtrArray *uids)
+em_utils_save_messages (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids)
{
struct _save_messages_data *data;
GtkWidget *filesel;
char *filename = NULL;
CamelMessageInfo *info = NULL;
+ g_return_if_fail (GTK_IS_WINDOW (parent));
g_return_if_fail (CAMEL_IS_FOLDER (folder));
g_return_if_fail (uids != NULL);
@@ -681,7 +699,7 @@ emu_add_address_cb(BonoboListener *listener, const char *name, const CORBA_any *
/* one of email or vcard should be always NULL, never both of them */
static void
-emu_add_address_or_vcard (struct _GtkWidget *parent, const char *email, const char *vcard)
+emu_add_address_or_vcard (GtkWindow *parent, const char *email, const char *vcard)
{
GtkWidget *win;
GtkWidget *control;
@@ -704,14 +722,7 @@ emu_add_address_or_vcard (struct _GtkWidget *parent, const char *email, const ch
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title((GtkWindow *)win, _("Add address"));
- if (parent && !GTK_IS_WINDOW (parent)) {
- parent = gtk_widget_get_toplevel (parent);
- if (!parent || !(GTK_WIDGET_TOPLEVEL (parent)))
- parent = NULL;
- }
-
- if (parent)
- gtk_window_set_transient_for((GtkWindow *)win, ((GtkWindow *)parent));
+ gtk_window_set_transient_for((GtkWindow *)win, parent);
gtk_window_set_position((GtkWindow *)win, GTK_WIN_POS_CENTER_ON_PARENT);
gtk_window_set_type_hint((GtkWindow *)win, GDK_WINDOW_TYPE_HINT_DIALOG);
@@ -742,8 +753,10 @@ emu_add_address_or_vcard (struct _GtkWidget *parent, const char *email, const ch
* Add address @email to the addressbook.
**/
void
-em_utils_add_address (struct _GtkWidget *parent, const char *email)
+em_utils_add_address (GtkWindow *parent, const char *email)
{
+ g_return_if_fail (GTK_IS_WINDOW (parent));
+
emu_add_address_or_vcard (parent, email, NULL);
}
@@ -752,8 +765,10 @@ em_utils_add_address (struct _GtkWidget *parent, const char *email)
* Adds whole vCard to the addressbook.
**/
void
-em_utils_add_vcard (struct _GtkWidget *parent, const char *vcard)
+em_utils_add_vcard (GtkWindow *parent, const char *vcard)
{
+ g_return_if_fail (GTK_IS_WINDOW (parent));
+
emu_add_address_or_vcard (parent, NULL, vcard);
}
@@ -820,19 +835,18 @@ tag_editor_response (GtkWidget *dialog, int button, struct ted_t *ted)
* @folder and @uids.
**/
void
-em_utils_flag_for_followup (GtkWidget *parent, CamelFolder *folder, GPtrArray *uids)
+em_utils_flag_for_followup (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids)
{
GtkWidget *editor;
struct ted_t *ted;
int i;
+ g_return_if_fail (GTK_IS_WINDOW (parent));
g_return_if_fail (CAMEL_IS_FOLDER (folder));
g_return_if_fail (uids != NULL);
editor = (GtkWidget *) message_tag_followup_new ();
-
- if (parent != NULL)
- e_dialog_set_transient_for ((GtkWindow *) editor, parent);
+ gtk_window_set_transient_for (GTK_WINDOW (editor), parent);
camel_object_ref (folder);
@@ -884,10 +898,11 @@ em_utils_flag_for_followup (GtkWidget *parent, CamelFolder *folder, GPtrArray *u
* @folder and @uids.
**/
void
-em_utils_flag_for_followup_clear (GtkWidget *parent, CamelFolder *folder, GPtrArray *uids)
+em_utils_flag_for_followup_clear (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids)
{
int i;
+ g_return_if_fail (GTK_IS_WINDOW (parent));
g_return_if_fail (CAMEL_IS_FOLDER (folder));
g_return_if_fail (uids != NULL);
@@ -918,11 +933,12 @@ em_utils_flag_for_followup_clear (GtkWidget *parent, CamelFolder *folder, GPtrAr
* Flag-for-Followup.
**/
void
-em_utils_flag_for_followup_completed (GtkWidget *parent, CamelFolder *folder, GPtrArray *uids)
+em_utils_flag_for_followup_completed (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids)
{
char *now;
int i;
+ g_return_if_fail (GTK_IS_WINDOW (parent));
g_return_if_fail (CAMEL_IS_FOLDER (folder));
g_return_if_fail (uids != NULL);
@@ -1378,19 +1394,23 @@ em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part, gboolean mode)
gboolean
em_utils_folder_is_templates (CamelFolder *folder, const char *uri)
{
+ CamelFolder *local_templates_folder;
EAccountList *accounts;
EAccount *account;
EIterator *iter;
int is = FALSE;
char *templates_uri;
- if (folder == mail_component_get_folder (NULL, MAIL_COMPONENT_FOLDER_TEMPLATES))
+ local_templates_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_TEMPLATES);
+
+ if (folder == local_templates_folder)
return TRUE;
- if (uri == NULL)
+ if (folder == NULL || uri == NULL)
return FALSE;
- accounts = mail_config_get_accounts();
+ accounts = e_get_account_list ();
iter = e_list_get_iterator ((EList *)accounts);
while (e_iterator_is_valid (iter)) {
account = (EAccount *)e_iterator_get (iter);
@@ -1425,19 +1445,23 @@ em_utils_folder_is_templates (CamelFolder *folder, const char *uri)
gboolean
em_utils_folder_is_drafts(CamelFolder *folder, const char *uri)
{
+ CamelFolder *local_drafts_folder;
EAccountList *accounts;
EAccount *account;
EIterator *iter;
int is = FALSE;
char *drafts_uri;
- if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS))
+ local_drafts_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
+
+ if (folder == local_drafts_folder)
return TRUE;
- if (uri == NULL)
+ if (folder == NULL || uri == NULL)
return FALSE;
- accounts = mail_config_get_accounts();
+ accounts = e_get_account_list ();
iter = e_list_get_iterator((EList *)accounts);
while (e_iterator_is_valid(iter)) {
account = (EAccount *)e_iterator_get(iter);
@@ -1472,19 +1496,23 @@ em_utils_folder_is_drafts(CamelFolder *folder, const char *uri)
gboolean
em_utils_folder_is_sent(CamelFolder *folder, const char *uri)
{
+ CamelFolder *local_sent_folder;
EAccountList *accounts;
EAccount *account;
EIterator *iter;
int is = FALSE;
char *sent_uri;
- if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT))
+ local_sent_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_SENT);
+
+ if (folder == local_sent_folder)
return TRUE;
- if (uri == NULL)
+ if (folder == NULL || uri == NULL)
return FALSE;
- accounts = mail_config_get_accounts();
+ accounts = e_get_account_list ();
iter = e_list_get_iterator((EList *)accounts);
while (e_iterator_is_valid(iter)) {
account = (EAccount *)e_iterator_get(iter);
@@ -1519,8 +1547,13 @@ em_utils_folder_is_sent(CamelFolder *folder, const char *uri)
gboolean
em_utils_folder_is_outbox(CamelFolder *folder, const char *uri)
{
+ CamelFolder *local_outbox_folder;
+
+ local_outbox_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
+
/* <Highlander>There can be only one.</Highlander> */
- return folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX);
+ return folder == local_outbox_folder;
}
/**
@@ -1595,53 +1628,6 @@ em_utils_get_proxy_uri (const char *pUri)
}
/**
- * em_utils_part_to_html:
- * @part:
- *
- * Converts a mime part's contents into html text. If @credits is given,
- * then it will be used as an attribution string, and the
- * content will be cited. Otherwise no citation or attribution
- * will be performed.
- *
- * Return Value: The part in displayable html format.
- **/
-char *
-em_utils_part_to_html(CamelMimePart *part, ssize_t *len, EMFormat *source)
-{
- EMFormatQuote *emfq;
- CamelStreamMem *mem;
- GByteArray *buf;
- char *text;
-
- buf = g_byte_array_new ();
- mem = (CamelStreamMem *) camel_stream_mem_new ();
- camel_stream_mem_set_byte_array (mem, buf);
-
- emfq = em_format_quote_new(NULL, (CamelStream *)mem, 0);
- ((EMFormat *) emfq)->composer = TRUE;
- em_format_set_session((EMFormat *)emfq, session);
- if (source) {
- /* copy over things we can, other things are internal, perhaps need different api than 'clone' */
- if (source->default_charset)
- em_format_set_default_charset((EMFormat *)emfq, source->default_charset);
- if (source->charset)
- em_format_set_default_charset((EMFormat *)emfq, source->charset);
- }
- em_format_part((EMFormat *) emfq, (CamelStream *)mem, part);
- g_object_unref(emfq);
-
- camel_stream_write((CamelStream *) mem, "", 1);
- camel_object_unref(mem);
-
- text = (char *)buf->data;
- if (len)
- *len = buf->len-1;
- g_byte_array_free (buf, FALSE);
-
- return text;
-}
-
-/**
* em_utils_message_to_html:
* @message:
* @credits:
@@ -1669,7 +1655,6 @@ em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32
emfq = em_format_quote_new(credits, (CamelStream *)mem, flags);
((EMFormat *) emfq)->composer = TRUE;
- em_format_set_session((EMFormat *)emfq, session);
if (!source) {
GConfClient *gconf;
@@ -1743,7 +1728,7 @@ em_utils_empty_trash (GtkWidget *parent)
camel_exception_init (&ex);
/* expunge all remote stores */
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
iter = e_list_get_iterator ((EList *) accounts);
while (e_iterator_is_valid (iter)) {
account = (EAccount *) e_iterator_get (iter);
@@ -1912,7 +1897,7 @@ char *em_uri_to_camel(const char *euri)
uid = g_strdup(eurl->host);
}
- accounts = mail_config_get_accounts();
+ accounts = e_get_account_list ();
account = e_account_list_find(accounts, E_ACCOUNT_FIND_UID, uid);
g_free(uid);
@@ -2297,94 +2282,12 @@ em_utils_contact_photo (struct _CamelInternetAddress *cia, gboolean local)
return part;
}
-/**
- * em_utils_snoop_type:
- * @part:
- *
- * Tries to snoop the mime type of a part.
- *
- * Return value: NULL if unknown (more likely application/octet-stream).
- **/
-const char *
-em_utils_snoop_type(CamelMimePart *part)
-{
- /* cache is here only to be able still return const char * */
- static GHashTable *types_cache = NULL;
-
- const char *filename;
- char *name_type = NULL, *magic_type = NULL, *res, *tmp;
- CamelDataWrapper *dw;
-
- filename = camel_mime_part_get_filename (part);
- if (filename != NULL)
- name_type = e_util_guess_mime_type (filename, FALSE);
-
- dw = camel_medium_get_content_object((CamelMedium *)part);
- if (!camel_data_wrapper_is_offline(dw)) {
- CamelStreamMem *mem = (CamelStreamMem *)camel_stream_mem_new();
-
- if (camel_data_wrapper_decode_to_stream(dw, (CamelStream *)mem) > 0) {
- char *ct = g_content_type_guess (filename, mem->buffer->data, mem->buffer->len, NULL);
-
- if (ct)
- magic_type = g_content_type_get_mime_type (ct);
-
- g_free (ct);
- }
- camel_object_unref(mem);
- }
-
- d(printf("snooped part, magic_type '%s' name_type '%s'\n", magic_type, name_type));
-
- /* If gvfs doesn't recognize the data by magic, but it
- * contains English words, it will call it text/plain. If the
- * filename-based check came up with something different, use
- * that instead and if it returns "application/octet-stream"
- * try to do better with the filename check.
- */
-
- if (magic_type) {
- if (name_type
- && (!strcmp(magic_type, "text/plain")
- || !strcmp(magic_type, "application/octet-stream")))
- res = name_type;
- else
- res = magic_type;
- } else
- res = name_type;
-
-
- if (res != name_type)
- g_free (name_type);
-
- if (res != magic_type)
- g_free (magic_type);
-
- if (!types_cache)
- types_cache = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) NULL);
-
- if (res) {
- tmp = g_hash_table_lookup (types_cache, res);
- if (tmp) {
- g_free (res);
- res = tmp;
- } else {
- g_hash_table_insert (types_cache, res, res);
- }
- }
-
- return res;
-
- /* We used to load parts to check their type, we dont anymore,
- see bug #11778 for some discussion */
-}
-
void
em_utils_clear_get_password_canceled_accounts_flag (void)
{
EAccountList *accounts;
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
if (accounts) {
EIterator *iter;
@@ -2405,25 +2308,69 @@ em_utils_clear_get_password_canceled_accounts_flag (void)
}
-static void error_response(GtkObject *o, int button, void *data)
-{
- gtk_widget_destroy((GtkWidget *)o);
-}
-
void
em_utils_show_error_silent (GtkWidget *widget)
{
- EActivityHandler *handler = mail_component_peek_activity_handler (mail_component_peek ());
- if(!g_object_get_data ((GObject *) widget, "response-handled"))
- g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL);
- e_activity_handler_make_error (handler, "mail", E_LOG_ERROR, widget);
+ EShellBackend *shell_backend;
+ EActivity *activity;
+
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
+ activity = e_alert_activity_new_warning (widget);
+ e_shell_backend_add_activity (shell_backend, activity);
+ g_object_unref (activity);
+
+ if (g_object_get_data (G_OBJECT (widget), "response-handled") == NULL)
+ g_signal_connect (
+ widget, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
}
void
em_utils_show_info_silent (GtkWidget *widget)
{
- EActivityHandler *handler = mail_component_peek_activity_handler (mail_component_peek ());
- if(!g_object_get_data ((GObject *) widget, "response-handled"))
- g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL);
- e_activity_handler_make_error (handler, "mail", E_LOG_WARNINGS, widget);
+ EShellBackend *shell_backend;
+ EActivity *activity;
+
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
+ activity = e_alert_activity_new_info (widget);
+ e_shell_backend_add_activity (shell_backend, activity);
+ g_object_unref (activity);
+
+ if (g_object_get_data (G_OBJECT (widget), "response-handled") == NULL)
+ g_signal_connect (
+ widget, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
+}
+
+gchar *
+em_utils_url_unescape_amp (const gchar *url)
+{
+ gchar *buff;
+ int i, j, amps;
+
+ if (!url)
+ return NULL;
+
+ amps = 0;
+ for (i = 0; url [i]; i++) {
+ if (url [i] == '&' && strncmp (url + i, "&amp;", 5) == 0)
+ amps++;
+ }
+
+ buff = g_strdup (url);
+
+ if (!amps)
+ return buff;
+
+ for (i = 0, j = 0; url [i]; i++, j++) {
+ buff [j] = url [i];
+
+ if (url [i] == '&' && strncmp (url + i, "&amp;", 5) == 0)
+ i += 4;
+ }
+ buff [j] = 0;
+
+ return buff;
}
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 1b60205168..dd04f40ec3 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -23,79 +23,70 @@
#ifndef __EM_UTILS_H__
#define __EM_UTILS_H__
-#include <glib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
+#include <gtk/gtk.h>
#include <sys/types.h>
+#include <camel/camel-exception.h>
+#include <camel/camel-folder.h>
+#include <camel/camel-internet-address.h>
+#include <camel/camel-mime-message.h>
+#include <camel/camel-mime-part.h>
+#include <camel/camel-stream.h>
+
+G_BEGIN_DECLS
-struct _GtkWidget;
-struct _GtkWindow;
-struct _CamelFolder;
-struct _CamelInternetAddress;
-struct _CamelStream;
-struct _CamelMimeMessage;
-struct _CamelMimePart;
-struct _GtkSelectionData;
-struct _GtkAdjustment;
-struct _CamelException;
struct _EMFormat;
-gboolean em_utils_prompt_user(struct _GtkWindow *parent, const char *promptkey, const char *tag, const char *arg0, ...);
+gboolean em_utils_prompt_user(GtkWindow *parent, const char *promptkey, const char *tag, const char *arg0, ...);
GPtrArray *em_utils_uids_copy (GPtrArray *uids);
void em_utils_uids_free (GPtrArray *uids);
-gboolean em_utils_configure_account (struct _GtkWidget *parent);
-gboolean em_utils_check_user_can_send_mail (struct _GtkWidget *parent);
+gboolean em_utils_configure_account (GtkWindow *parent);
+gboolean em_utils_check_user_can_send_mail (GtkWindow *parent);
-void em_utils_edit_filters (struct _GtkWidget *parent);
+void em_utils_edit_filters (GtkWidget *parent);
void em_filename_make_safe (gchar *string);
-void em_utils_edit_vfolders (struct _GtkWidget *parent);
+void em_utils_edit_vfolders (GtkWidget *parent);
-void em_utils_save_part(struct _GtkWidget *parent, const char *prompt, struct _CamelMimePart *part);
-gboolean em_utils_save_part_to_file(struct _GtkWidget *parent, const char *filename, struct _CamelMimePart *part);
-void em_utils_save_messages (struct _GtkWidget *parent, struct _CamelFolder *folder, GPtrArray *uids);
+void em_utils_save_part(GtkWindow *parent, const char *prompt, CamelMimePart *part);
+gboolean em_utils_save_part_to_file(GtkWindow *parent, const char *filename, CamelMimePart *part);
+void em_utils_save_messages (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids);
-void em_utils_add_address(struct _GtkWidget *parent, const char *email);
-void em_utils_add_vcard(struct _GtkWidget *parent, const char *vcard);
+void em_utils_add_address(GtkWindow *parent, const char *email);
+void em_utils_add_vcard(GtkWindow *parent, const char *vcard);
-void em_utils_flag_for_followup (struct _GtkWidget *parent, struct _CamelFolder *folder, GPtrArray *uids);
-void em_utils_flag_for_followup_clear (struct _GtkWidget *parent, struct _CamelFolder *folder, GPtrArray *uids);
-void em_utils_flag_for_followup_completed (struct _GtkWidget *parent, struct _CamelFolder *folder, GPtrArray *uids);
+void em_utils_flag_for_followup (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids);
+void em_utils_flag_for_followup_clear (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids);
+void em_utils_flag_for_followup_completed (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids);
/* This stuff that follows probably doesn't belong here, then again, the stuff above probably belongs elsewhere */
-void em_utils_selection_set_mailbox(struct _GtkSelectionData *data, struct _CamelFolder *folder, GPtrArray *uids);
-void em_utils_selection_get_mailbox(struct _GtkSelectionData *data, struct _CamelFolder *folder);
-void em_utils_selection_get_message(struct _GtkSelectionData *data, struct _CamelFolder *folder);
-/* FIXME: be nice if these also worked on struct _CamelFolder's, no easy way to get uri from folder yet tho */
-void em_utils_selection_set_uidlist(struct _GtkSelectionData *data, const char *uri, GPtrArray *uids);
-void em_utils_selection_get_uidlist(struct _GtkSelectionData *data, struct _CamelFolder *dest, int move, struct _CamelException *ex);
-void em_utils_selection_set_urilist(struct _GtkSelectionData *data, struct _CamelFolder *folder, GPtrArray *uids);
-void em_utils_selection_get_urilist(struct _GtkSelectionData *data, struct _CamelFolder *folder);
+void em_utils_selection_set_mailbox(GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids);
+void em_utils_selection_get_mailbox(GtkSelectionData *data, CamelFolder *folder);
+void em_utils_selection_get_message(GtkSelectionData *data, CamelFolder *folder);
+/* FIXME: be nice if these also worked on CamelFolder's, no easy way to get uri from folder yet tho */
+void em_utils_selection_set_uidlist(GtkSelectionData *data, const char *uri, GPtrArray *uids);
+void em_utils_selection_get_uidlist(GtkSelectionData *data, CamelFolder *dest, int move, CamelException *ex);
+void em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids);
+void em_utils_selection_get_urilist(GtkSelectionData *data, CamelFolder *folder);
-char *em_utils_temp_save_part(struct _GtkWidget *parent, struct _CamelMimePart *part, gboolean mode);
-void em_utils_save_parts (struct _GtkWidget *parent, const char *prompt, GSList * parts);
+char *em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part, gboolean mode);
+void em_utils_save_parts (GtkWindow *parent, const char *prompt, GSList * parts);
-gboolean em_utils_folder_is_drafts(struct _CamelFolder *folder, const char *uri);
-gboolean em_utils_folder_is_templates(struct _CamelFolder *folder, const char *uri);
-gboolean em_utils_folder_is_sent(struct _CamelFolder *folder, const char *uri);
-gboolean em_utils_folder_is_outbox(struct _CamelFolder *folder, const char *uri);
+gboolean em_utils_folder_is_drafts(CamelFolder *folder, const char *uri);
+gboolean em_utils_folder_is_templates(CamelFolder *folder, const char *uri);
+gboolean em_utils_folder_is_sent(CamelFolder *folder, const char *uri);
+gboolean em_utils_folder_is_outbox(CamelFolder *folder, const char *uri);
-void em_utils_adjustment_page(struct _GtkAdjustment *adj, gboolean down);
+void em_utils_adjustment_page(GtkAdjustment *adj, gboolean down);
char *em_utils_get_proxy_uri (const char *uri);
/* FIXME: should this have an override charset? */
-char *em_utils_part_to_html(struct _CamelMimePart *part, ssize_t *len, struct _EMFormat *source);
-char *em_utils_message_to_html(struct _CamelMimeMessage *msg, const char *credits, guint32 flags, ssize_t *len, struct _EMFormat *source, const char *append);
+char *em_utils_message_to_html(CamelMimeMessage *msg, const char *credits, guint32 flags, ssize_t *len, struct _EMFormat *source, const char *append);
-void em_utils_expunge_folder (struct _GtkWidget *parent, struct _CamelFolder *folder);
-void em_utils_empty_trash (struct _GtkWidget *parent);
+void em_utils_expunge_folder (GtkWidget *parent, CamelFolder *folder);
+void em_utils_empty_trash (GtkWidget *parent);
/* returns the folder name portion of an URI */
char *em_utils_folder_name_from_uri (const char *uri);
@@ -105,20 +96,19 @@ char *em_uri_from_camel (const char *curi);
char *em_uri_to_camel (const char *euri);
/* Run errors silently on the status bar */
-void em_utils_show_error_silent (struct _GtkWidget *widget);
-void em_utils_show_info_silent (struct _GtkWidget *widget);
+void em_utils_show_error_silent (GtkWidget *widget);
+void em_utils_show_info_silent (GtkWidget *widget);
/* is this address in the addressbook? caches results */
-gboolean em_utils_in_addressbook (struct _CamelInternetAddress *addr, gboolean local_only);
-struct _CamelMimePart *em_utils_contact_photo (struct _CamelInternetAddress *addr, gboolean local);
-
-const char *em_utils_snoop_type(struct _CamelMimePart *part);
+gboolean em_utils_in_addressbook (CamelInternetAddress *addr, gboolean local_only);
+CamelMimePart *em_utils_contact_photo (CamelInternetAddress *addr, gboolean local);
/* clears flag 'get_password_canceled' at every known accounts, so if needed, get_password will show dialog */
void em_utils_clear_get_password_canceled_accounts_flag (void);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+/* Unescapes &amp; back to a real & in URIs */
+gchar *em_utils_url_unescape_amp (const gchar *url);
+
+G_END_DECLS
#endif /* __EM_UTILS_H__ */
diff --git a/mail/em-vfolder-editor.c b/mail/em-vfolder-editor.c
index dcc6f03e75..9a18c69a3a 100644
--- a/mail/em-vfolder-editor.c
+++ b/mail/em-vfolder-editor.c
@@ -99,7 +99,7 @@ em_vfolder_editor_get_type (void)
*
* Return value: A new #EMVFolderEditor object.
**/
-EMVFolderEditor *
+GtkWidget *
em_vfolder_editor_new (EMVFolderContext *vc)
{
EMVFolderEditor *ve = (EMVFolderEditor *) g_object_new (em_vfolder_editor_get_type(), NULL);
@@ -116,7 +116,7 @@ em_vfolder_editor_new (EMVFolderContext *vc)
gtk_widget_hide(glade_xml_get_widget (gui, "filter_source"));
g_object_unref (gui);
- return ve;
+ return GTK_WIDGET (ve);
}
static FilterRule *
diff --git a/mail/em-vfolder-editor.h b/mail/em-vfolder-editor.h
index 58bcd566a1..550f7cd2d3 100644
--- a/mail/em-vfolder-editor.h
+++ b/mail/em-vfolder-editor.h
@@ -47,6 +47,6 @@ struct _EMVFolderEditorClass {
GType em_vfolder_editor_get_type (void);
-EMVFolderEditor *em_vfolder_editor_new (EMVFolderContext *vc);
+GtkWidget *em_vfolder_editor_new (EMVFolderContext *vc);
#endif /* ! _EM_VFOLDER_EDITOR_H */
diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c
index 03f46afff8..b8ef41fda8 100644
--- a/mail/em-vfolder-rule.c
+++ b/mail/em-vfolder-rule.c
@@ -37,10 +37,11 @@
#include "mail/em-utils.h"
#include "mail/em-folder-tree.h"
#include "mail/em-folder-selector.h"
-#include "mail/mail-component.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
+#include "e-mail-shell-backend.h"
+
#define d(x)
static int validate(FilterRule *);
@@ -505,9 +506,11 @@ static void
source_add(GtkWidget *widget, struct _source_data *data)
{
EMFolderTree *emft;
+ EMFolderTreeModel *model;
GtkWidget *dialog;
- emft =(EMFolderTree *)em_folder_tree_new_with_model(mail_component_peek_tree_model(mail_component_peek()));
+ model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend);
+ emft =(EMFolderTree *)em_folder_tree_new_with_model (model);
em_folder_tree_set_excluded(emft, EMFT_EXCLUDE_NOSELECT);
dialog = em_folder_selector_new(emft, EM_FOLDER_SELECTOR_CAN_CREATE, _("Select Folder"), NULL, _("_Add"));
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in
index fbc23eb746..e0895c330c 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -374,6 +374,20 @@
</schema>
<schema>
+ <key>/schema/apps/evolution/mail/display/show_all_headers</key>
+ <applyto>/apps/evolution/mail/display/show_all_headers</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Show all message headers</short>
+ <long>
+ Show all the headers when viewing a messages.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/evolution/mail/display/headers</key>
<applyto>/apps/evolution/mail/display/headers</applyto>
<owner>evolution-mail</owner>
@@ -576,16 +590,19 @@
</schema>
<schema>
- <key>/schemas/apps/evolution/mail/display/show_wide</key>
- <applyto>/apps/evolution/mail/display/show_wide</applyto>
+ <key>/schemas/apps/evolution/mail/display/layout</key>
+ <applyto>/apps/evolution/mail/display/layout</applyto>
<owner>evolution-mail</owner>
- <type>bool</type>
- <default>false</default>
+ <type>int</type>
+ <default>0</default>
<locale name="C">
- <short>Use side-by-side or wide layout</short>
- <long>
- If the &quot;Preview&quot; pane is on, then show it side-by-side rather than vertically.
- </long>
+ <short>Layout style</short>
+ <long>
+ The layout style determines where to place the preview pane
+ in relation to the message list. "0" (Classic View) places
+ the preview pane below the message list. "1" (Vertical View)
+ places the preview pane next to the message list.
+ </long>
</locale>
</schema>
@@ -750,29 +767,41 @@
</locale>
</schema>
- <!-- Message Window -->
+ <!-- Mail Browser -->
<schema>
- <key>/schemas/apps/evolution/mail/message_window/width</key>
- <applyto>/apps/evolution/mail/message_window/width</applyto>
+ <key>/schemas/apps/evolution/mail/mail_browser_width</key>
+ <applyto>/apps/evolution/mail/mail_browser_width</applyto>
<owner>evolution-mail</owner>
<type>int</type>
<default>600</default>
<locale name="C">
- <short>Message Window default width</short>
- <long>Default width of the message window.</long>
+ <short>Mail browser width</short>
+ <long>Default width of the mail browser window.</long>
</locale>
</schema>
<schema>
- <key>/schemas/apps/evolution/mail/message_window/height</key>
- <applyto>/apps/evolution/mail/message_window/height</applyto>
+ <key>/schemas/apps/evolution/mail/mail_browser_height</key>
+ <applyto>/apps/evolution/mail/mail_browser_height</applyto>
<owner>evolution-mail</owner>
<type>int</type>
<default>400</default>
<locale name="C">
- <short>Message Window default height</short>
- <long>Default height of the message window.</long>
+ <short>Mail browser height</short>
+ <long>Default height of the mail browser window.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/evolution/mail/mail_browser_maximized</key>
+ <applyto>/apps/evolution/mail/mail_browser_maximized</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Mail browser maximized</short>
+ <long>Default maximized state of the mail browser window.</long>
</locale>
</schema>
diff --git a/mail/evolution-module-mail.c b/mail/evolution-module-mail.c
new file mode 100644
index 0000000000..97bc953c41
--- /dev/null
+++ b/mail/evolution-module-mail.c
@@ -0,0 +1,59 @@
+/*
+ * evolution-module-mail.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-shell-backend.h"
+#include "e-mail-shell-content.h"
+#include "e-mail-shell-sidebar.h"
+#include "e-mail-shell-view.h"
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+const gchar * g_module_check_init (GModule *module);
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ /* Register dynamically loaded types. */
+
+ e_mail_shell_backend_register_type (type_module);
+ e_mail_shell_content_register_type (type_module);
+ e_mail_shell_sidebar_register_type (type_module);
+ e_mail_shell_view_register_type (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}
+
+G_MODULE_EXPORT const gchar *
+g_module_check_init (GModule *module)
+{
+ /* FIXME Until mail is split into a module library and a
+ * reusable shared library, prevent the module from
+ * being unloaded. Unloading the module resets all
+ * static variables, which screws up foo_get_type()
+ * functions among other things. */
+ g_module_make_resident (module);
+
+ return NULL;
+}
diff --git a/mail/filtertypes.xml b/mail/filtertypes.xml
index f2f69c4c06..a93b887271 100644
--- a/mail/filtertypes.xml
+++ b/mail/filtertypes.xml
@@ -636,7 +636,7 @@
</option>
</input>
<input type="optionlist" name="versus">
- <dynamic func="e_util_labels_get_filter_options"/>
+ <dynamic func="e_mail_labels_get_filter_options"/>
</input>
</part>
@@ -923,7 +923,7 @@
<title>Set Label</title>
<code>(set-label ${label})</code>
<input type="optionlist" name="label">
- <dynamic func="e_util_labels_get_filter_options"/>
+ <dynamic func="e_mail_labels_get_filter_options"/>
</input>
</part>
<part name="colour">
diff --git a/mail/importers/Makefile.am b/mail/importers/Makefile.am
deleted file mode 100644
index 9029d705a0..0000000000
--- a/mail/importers/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = $(top_builddir)/win32/libevolution-mail.la
-endif
-
-privsolib_LTLIBRARIES = libevolution-mail-importers.la
-
-INCLUDES = -I.. \
- -I$(srcdir)/.. \
- -I$(top_srcdir) \
- -DG_LOG_DOMAIN=\"evolution-mail-importer\" \
- -DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \
- $(IMPORTERS_CFLAGS)
-
-libevolution_mail_importers_la_SOURCES = \
- mail-importer.c \
- mail-importer.h \
- elm-importer.c \
- pine-importer.c \
- evolution-mbox-importer.c
-
-libevolution_mail_importers_la_LDFLAGS = $(NO_UNDEFINED)
-
-libevolution_mail_importers_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/filter/libfilter.la \
- $(IMPORTERS_LIBS)
-
--include $(top_srcdir)/git.mk
diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c
index f42afec151..ff6c7dd13b 100644
--- a/mail/importers/evolution-mbox-importer.c
+++ b/mail/importers/evolution-mbox-importer.c
@@ -40,9 +40,8 @@
#include <camel/camel-exception.h>
+#include "mail/e-mail-shell-backend.h"
#include "mail/em-folder-selection-button.h"
-
-#include "mail/mail-component.h"
#include "mail/mail-mt.h"
#include "mail-importer.h"
@@ -73,15 +72,21 @@ static GtkWidget *
mbox_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im)
{
GtkWidget *hbox, *w;
+ EMFolderTreeModel *model;
+ const gchar *local_inbox_folder_uri;
+
+ local_inbox_folder_uri = e_mail_shell_backend_get_folder_uri (
+ global_mail_shell_backend, E_MAIL_FOLDER_INBOX);
+ model = e_mail_shell_backend_get_folder_tree_model (
+ global_mail_shell_backend);
hbox = gtk_hbox_new(FALSE, 0);
w = gtk_label_new(_("Destination folder:"));
gtk_box_pack_start((GtkBox *)hbox, w, FALSE, TRUE, 6);
- w = em_folder_selection_button_new(_("Select folder"), _("Select folder to import into"));
- em_folder_selection_button_set_selection((EMFolderSelectionButton *)w,
- mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_INBOX));
+ w = em_folder_selection_button_new(model, _("Select folder"), _("Select folder to import into"));
+ em_folder_selection_button_set_selection((EMFolderSelectionButton *)w, local_inbox_folder_uri);
g_signal_connect(w, "selected", G_CALLBACK(folder_selected), target);
gtk_box_pack_start((GtkBox *)hbox, w, FALSE, TRUE, 6);
diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c
index 29a2dddd97..e56ca01dcd 100644
--- a/mail/importers/mail-importer.c
+++ b/mail/importers/mail-importer.c
@@ -36,7 +36,6 @@
#include <glib.h>
#include <glib/gstdio.h>
-#include <gmodule.h>
#include <glib/gi18n.h>
#include <camel/camel-folder.h>
#include <camel/camel-store.h>
@@ -48,8 +47,8 @@
#include "e-util/e-util-private.h"
#include "mail/mail-mt.h"
-#include "mail/mail-component.h"
#include "mail/mail-tools.h"
+#include "mail/e-mail-shell-backend.h"
#include "mail-importer.h"
@@ -203,7 +202,8 @@ import_mbox_exec (struct _import_mbox_msg *m)
}
if (m->uri == NULL || m->uri[0] == 0)
- folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_INBOX);
+ folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_INBOX);
else
folder = mail_tool_uri_to_folder(m->uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex);
@@ -357,9 +357,11 @@ struct _import_folders_data {
static void
import_folders_rec(struct _import_folders_data *m, const char *filepath, const char *folderparent)
{
+ EShellBackend *shell_backend;
GDir *dir;
const char *d;
struct stat st;
+ const gchar *data_dir;
char *filefull, *foldersub, *uri, *utf8_filename;
const char *folder;
@@ -367,6 +369,9 @@ import_folders_rec(struct _import_folders_data *m, const char *filepath, const c
if (dir == NULL)
return;
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+
utf8_filename = g_filename_to_utf8 (filepath, -1, NULL, NULL, NULL);
camel_operation_start(NULL, _("Scanning %s"), utf8_filename);
g_free (utf8_filename);
@@ -395,9 +400,9 @@ import_folders_rec(struct _import_folders_data *m, const char *filepath, const c
break;
}
/* FIXME: need a better way to get default store location */
- uri = g_strdup_printf("mbox:%s/local#%s", mail_component_peek_base_directory(NULL), folder);
+ uri = g_strdup_printf("mbox:%s/local#%s", data_dir, folder);
} else {
- uri = g_strdup_printf("mbox:%s/local#%s/%s", mail_component_peek_base_directory(NULL), folderparent, folder);
+ uri = g_strdup_printf("mbox:%s/local#%s/%s", data_dir, folderparent, folder);
}
printf("importing to uri %s\n", uri);
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index 53a0411f08..f195ebf5d1 100644
--- a/mail/mail-autofilter.c
+++ b/mail/mail-autofilter.c
@@ -32,7 +32,6 @@
#include "mail-vfolder.h"
#include "mail-autofilter.h"
-#include "mail-component.h"
#include "em-utils.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
@@ -49,6 +48,8 @@
#include <camel/camel-internet-address.h>
#include <camel/camel-mime-message.h>
+#include "e-mail-shell-backend.h"
+
#define d(x)
static void
@@ -345,15 +346,19 @@ filter_rule_from_message (EMFilterContext *context, CamelMimeMessage *msg, int f
void
filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flags)
{
+ EShellBackend *shell_backend;
EMFilterContext *fc;
+ const gchar *data_dir;
char *user, *system;
FilterRule *rule;
g_return_if_fail (msg != NULL);
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
fc = em_filter_context_new ();
- user = g_strdup_printf ("%s/filters.xml",
- mail_component_peek_base_directory (mail_component_peek ()));
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ user = g_build_filename (data_dir, "filters.xml", NULL);
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
rule_context_load ((RuleContext *)fc, system, user);
g_free (system);
@@ -370,7 +375,9 @@ filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flag
void
mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri)
{
+ EShellBackend *shell_backend;
EMFilterContext *fc;
+ const gchar *data_dir;
char *user, *system;
GList *changed;
char *eolduri, *enewuri;
@@ -378,8 +385,11 @@ mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri
eolduri = em_uri_from_camel(olduri);
enewuri = em_uri_from_camel(newuri);
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
fc = em_filter_context_new ();
- user = g_strdup_printf ("%s/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ user = g_build_filename (data_dir, "filters.xml", NULL);
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
rule_context_load ((RuleContext *)fc, system, user);
g_free (system);
@@ -402,15 +412,20 @@ mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri
void
mail_filter_delete_uri(CamelStore *store, const char *uri)
{
+ EShellBackend *shell_backend;
EMFilterContext *fc;
+ const gchar *data_dir;
char *user, *system;
GList *deleted;
char *euri;
euri = em_uri_from_camel(uri);
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
fc = em_filter_context_new ();
- user = g_strdup_printf ("%s/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ user = g_build_filename (data_dir, "filters.xml", NULL);
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
rule_context_load ((RuleContext *)fc, system, user);
g_free (system);
diff --git a/mail/mail-component-factory.c b/mail/mail-component-factory.c
deleted file mode 100644
index 268f0b5e3c..0000000000
--- a/mail/mail-component-factory.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mail-component.h"
-#include "em-account-prefs.h"
-#include "em-mailer-prefs.h"
-#include "em-composer-prefs.h"
-#include "em-network-prefs.h"
-
-#include "mail-config-factory.h"
-#include "mail-config.h"
-#include "mail-mt.h"
-
-#include "em-popup.h"
-#include "em-menu.h"
-#include "em-event.h"
-#include "em-config.h"
-#include "em-format-hook.h"
-#include "em-junk-hook.h"
-#include "em-format-html-display.h"
-
-#include "importers/mail-importer.h"
-#include "e-util/e-import.h"
-
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo/bonobo-shlib-factory.h>
-
-#include <string.h>
-
-/* TODO: clean up these definitions */
-
-#define FACTORY_ID "OAFIID:GNOME_Evolution_Mail_Factory:" BASE_VERSION
-#define COMPONENT_ID "OAFIID:GNOME_Evolution_Mail_Component:" BASE_VERSION
-#define FOLDER_INFO_ID "OAFIID:GNOME_Evolution_FolderInfo:" BASE_VERSION
-
-static BonoboObject *
-factory(BonoboGenericFactory *factory, const char *component_id, void *closure)
-{
- BonoboObject *o;
-
- if (strcmp (component_id, COMPONENT_ID) == 0) {
- MailComponent *component = mail_component_peek ();
-
- bonobo_object_ref (BONOBO_OBJECT (component));
- return BONOBO_OBJECT (component);
- } else if (strcmp (component_id, EM_ACCOUNT_PREFS_CONTROL_ID) == 0
- || strcmp (component_id, EM_MAILER_PREFS_CONTROL_ID) == 0
- || strcmp (component_id, EM_COMPOSER_PREFS_CONTROL_ID) == 0
- || strcmp (component_id, EM_NETWORK_PREFS_CONTROL_ID) == 0) {
- return mail_config_control_factory_cb (factory, component_id, CORBA_OBJECT_NIL);
- }
-
- o = mail_importer_factory_cb(factory, component_id, NULL);
- if (o == NULL)
- g_warning (FACTORY_ID ": Don't know what to do with %s", component_id);
-
- return o;
-}
-
-static Bonobo_Unknown
-make_factory (PortableServer_POA poa, const char *iid, gpointer impl_ptr, CORBA_Environment *ev)
-{
- static int init = 0;
-
- if (!init) {
- EImportClass *klass;
-
- init = 1;
-
- mail_config_init();
- mail_msg_init();
-
- e_plugin_hook_register_type(em_popup_hook_get_type());
- e_plugin_hook_register_type(em_menu_hook_get_type());
- e_plugin_hook_register_type(em_config_hook_get_type());
-
- em_format_hook_register_type(em_format_get_type());
- em_format_hook_register_type(em_format_html_get_type());
- em_format_hook_register_type(em_format_html_display_get_type());
- em_junk_hook_register_type(emj_get_type());
-
- e_plugin_hook_register_type(em_format_hook_get_type());
- e_plugin_hook_register_type(em_event_hook_get_type());
- e_plugin_hook_register_type(em_junk_hook_get_type());
-
- klass = g_type_class_ref(e_import_get_type());
- e_import_class_add_importer(klass, mbox_importer_peek(), NULL, NULL);
- e_import_class_add_importer(klass, elm_importer_peek(), NULL, NULL);
- e_import_class_add_importer(klass, pine_importer_peek(), NULL, NULL);
- }
-
- return bonobo_shlib_factory_std (FACTORY_ID, poa, impl_ptr, factory, NULL, ev);
-}
-
-static BonoboActivationPluginObject plugin_list[] = {
- { FACTORY_ID, make_factory},
- { NULL }
-};
-
-const BonoboActivationPlugin Bonobo_Plugin_info = {
- plugin_list, "Evolution Mail component factory"
-};
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 698cc940f8..7cf42f63a6 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -37,7 +37,7 @@
#include <libedataserver/e-data-server-util.h>
#include "em-utils.h"
#include "em-composer-utils.h"
-#include "em-format.h"
+#include "em-format/em-format.h"
#include "em-folder-tree.h"
#include "em-folder-browser.h"
#include "em-message-browser.h"
@@ -99,35 +99,6 @@
#define d(x)
-static void create_local_item_cb(EUserCreatableItemsHandler *handler, const char *item_type_name, void *data);
-static void view_changed_timeout_remove (EComponentView *component_view);
-
-#define MAIL_COMPONENT_DEFAULT(mc) if (mc == NULL) mc = mail_component_peek();
-
-extern int camel_application_is_exiting;
-
-#define PARENT_TYPE evolution_component_get_type ()
-static BonoboObjectClass *parent_class = NULL;
-const char *x_mailer = "Evolution " VERSION SUB_VERSION " " VERSION_COMMENT;
-#define OFFLINE 0
-#define ONLINE 1
-
-struct _store_info {
- CamelStore *store;
- char *name;
-
- /* we keep a reference to these so they remain around for the session */
- CamelFolder *vtrash;
- CamelFolder *vjunk;
-
- /* for setup only */
- void (*done)(CamelStore *store, CamelFolderInfo *info, void *data);
- void *done_data;
-
- int ref_count:31;
- guint removed:1;
-};
-
struct _MailComponentPrivate {
GMutex *lock;
@@ -158,305 +129,6 @@ struct _MailComponentPrivate {
guint mail_sync_in_progress; /* is greater than 0 if still waiting to finish sync on some store */
};
-/* indexed by _mail_component_folder_t */
-static struct {
- const gchar *name;
- char *uri;
- CamelFolder *folder;
-} mc_default_folders[] = {
- /* translators: standard local mailbox names */
- { N_("Inbox"), },
- { N_("Drafts"), },
- { N_("Outbox"), },
- { N_("Sent"), },
- { N_("Templates"), },
- { "Inbox", }, /* 'always local' inbox */
-};
-
-static struct _store_info *
-store_info_new(CamelStore *store, const char *name)
-{
- struct _store_info *si;
-
- si = g_malloc0(sizeof(*si));
- si->ref_count = 1;
- if (name == NULL)
- si->name = camel_service_get_name((CamelService *)store, TRUE);
- else
- si->name = g_strdup(name);
- si->store = store;
- camel_object_ref(store);
- /* If these are vfolders then they need to be opened now,
- * otherwise they wont keep track of all folders */
- if ((store->flags & CAMEL_STORE_VTRASH) != 0)
- si->vtrash = camel_store_get_trash(store, NULL);
- if ((store->flags & CAMEL_STORE_VJUNK) != 0)
- si->vjunk = camel_store_get_junk(store, NULL);
-
- return si;
-}
-
-static void
-store_info_ref(struct _store_info *si)
-{
- si->ref_count++;
-}
-
-static void
-store_info_unref(struct _store_info *si)
-{
- if (si->ref_count > 1) {
- si->ref_count--;
- return;
- }
-
- if (si->vtrash)
- camel_object_unref(si->vtrash);
- if (si->vjunk)
- camel_object_unref(si->vjunk);
- camel_object_unref(si->store);
- g_free(si->name);
- g_free(si);
-}
-
-static gboolean
-mc_add_store_done(CamelStore *store, CamelFolderInfo *info, void *data)
-{
- struct _store_info *si = data;
-
- if (si->done)
- si->done(store, info, si);
-
- if (!si->removed) {
- /* let the counters know about the already opened junk/trash folders */
- if (si->vtrash)
- mail_note_folder(si->vtrash);
- if (si->vjunk)
- mail_note_folder(si->vjunk);
- }
-
- store_info_unref(si);
-
- return TRUE;
-}
-
-/* Utility functions. */
-static void
-mc_add_store(MailComponent *component, CamelStore *store, const char *name, void (*done)(CamelStore *store, CamelFolderInfo *info, void *data))
-{
- struct _store_info *si;
-
- MAIL_COMPONENT_DEFAULT(component);
-
- si = store_info_new(store, name);
- si->done = done;
- g_hash_table_insert(component->priv->store_hash, store, si);
- em_folder_tree_model_add_store(component->priv->model, store, si->name);
- store_info_ref(si);
- mail_note_store(store, NULL, mc_add_store_done, si);
-}
-
-static void
-mc_add_local_store_done(CamelStore *store, CamelFolderInfo *info, void *data)
-{
- /*MailComponent *mc = data;*/
- int i;
-
- for (i=0;i<sizeof(mc_default_folders)/sizeof(mc_default_folders[0]);i++) {
- if (mc_default_folders[i].folder)
- mail_note_folder(mc_default_folders[i].folder);
- }
-}
-
-static void
-mc_add_local_store(CamelStore *store, const char *name, MailComponent *mc)
-{
- mc_add_store(mc, store, name, mc_add_local_store_done);
- camel_object_unref(store);
- g_object_unref(mc);
-}
-
-static void
-mc_setup_local_store(MailComponent *mc)
-{
- MailComponentPrivate *p = mc->priv;
- CamelURL *url;
- char *tmp;
- CamelException ex;
- int i;
-
- g_mutex_lock(p->lock);
- if (p->local_store != NULL) {
- g_mutex_unlock(p->lock);
- return;
- }
-
- camel_exception_init(&ex);
-
- url = camel_url_new("mbox:", NULL);
- tmp = g_build_filename (p->base_directory, "local", NULL);
- camel_url_set_path(url, tmp);
- g_free(tmp);
- tmp = camel_url_to_string(url, 0);
- p->local_store = (CamelStore *)camel_session_get_service(session, tmp, CAMEL_PROVIDER_STORE, &ex);
- g_free(tmp);
- if (p->local_store == NULL)
- goto fail;
-
- for (i=0;i<sizeof(mc_default_folders)/sizeof(mc_default_folders[0]);i++) {
- /* FIXME: should this uri be account relative? */
- camel_url_set_fragment(url, mc_default_folders[i].name);
- mc_default_folders[i].uri = camel_url_to_string(url, 0);
- mc_default_folders[i].folder = camel_store_get_folder(p->local_store, mc_default_folders[i].name,
- CAMEL_STORE_FOLDER_CREATE, &ex);
- camel_exception_clear(&ex);
- }
-
- camel_url_free(url);
- g_mutex_unlock(p->lock);
-
- g_object_ref(mc);
- camel_object_ref(p->local_store);
- mail_async_event_emit(p->async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)mc_add_local_store, p->local_store, _("On This Computer"), mc);
-
- return;
-fail:
- g_mutex_unlock(p->lock);
-
- g_warning("Could not setup local store/folder: %s", ex.desc);
-
- camel_url_free(url);
- camel_exception_clear(&ex);
-}
-
-static void
-load_accounts (MailComponent *component, EAccountList *accounts)
-{
- EIterator *iter;
-
- /* Load each service (don't connect!). Check its provider and
- * see if this belongs in the shell's folder list. If so, add
- * it.
- */
-
- iter = e_list_get_iterator ((EList *) accounts);
- while (e_iterator_is_valid (iter)) {
- EAccountService *service;
- EAccount *account;
- const char *name;
-
- account = (EAccount *) e_iterator_get (iter);
- service = account->source;
- name = account->name;
-
- /* HACK: mbox url's are handled by the local store setup above,
- any that come through as account sources are really movemail sources! */
- if (account->enabled
- && service->url != NULL
- && service->url[0]
- && strncmp(service->url, "mbox:", 5) != 0)
- mail_component_load_store_by_uri (component, service->url, name);
-
- e_iterator_next (iter);
- }
-
- g_object_unref (iter);
-}
-
-static void
-setup_search_context (MailComponent *component)
-{
- MailComponentPrivate *priv = component->priv;
-
- if (priv->search_context == NULL) {
- char *user = g_build_filename(component->priv->base_directory, "searches.xml", NULL);
- char *system = g_build_filename (EVOLUTION_PRIVDATADIR, "searchtypes.xml", NULL);
-
- priv->search_context = (RuleContext *)em_search_context_new ();
- g_object_set_data_full (G_OBJECT (priv->search_context), "user", user, g_free);
- g_object_set_data_full (G_OBJECT (priv->search_context), "system", system, g_free);
- rule_context_load (priv->search_context, system, user);
- }
-}
-
-static void
-mc_startup(MailComponent *mc)
-{
- static int started = 0;
- GConfClient *gconf;
-
- if (started)
- return;
- started = 1;
-
- mc_setup_local_store(mc);
- load_accounts(mc, mail_config_get_accounts());
-
- gconf = mail_config_get_gconf_client();
-
- if (gconf_client_get_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", NULL))
- vfolder_load_storage();
-}
-
-static void
-folder_selected_cb (EMFolderTree *emft, const char *path, const char *uri, guint32 flags, EMFolderView *view)
-{
- EMFolderTreeModel *model;
-
- if ((flags & CAMEL_FOLDER_NOSELECT) || !path) {
- em_folder_view_set_folder (view, NULL, NULL);
- } else {
- model = em_folder_tree_get_model (emft);
- em_folder_tree_model_set_selected (model, uri);
- em_folder_tree_model_save_state (model);
-
- em_folder_view_set_folder_uri (view, uri);
- }
-}
-
-static int
-check_autosave(void *data)
-{
- e_msg_composer_check_autosave(NULL);
-
- return FALSE;
-}
-
-static void
-view_control_activate_cb (BonoboControl *control, gboolean activate, EMFolderView *view)
-{
- BonoboUIComponent *uic;
- static int recover = 0;
-
- uic = bonobo_control_get_ui_component (control);
- g_return_if_fail (uic != NULL);
-
- if (activate) {
- Bonobo_UIContainer container;
-
- container = bonobo_control_get_remote_ui_container (control, NULL);
- bonobo_ui_component_set_container (uic, container, NULL);
- bonobo_object_release_unref (container, NULL);
-
- g_return_if_fail (container == bonobo_ui_component_get_container(uic));
- g_return_if_fail (container != CORBA_OBJECT_NIL);
-
- em_folder_view_activate (view, uic, activate);
- e_user_creatable_items_handler_activate(g_object_get_data((GObject *)view, "e-creatable-items-handler"), uic);
- } else {
- em_folder_view_activate (view, uic, activate);
- bonobo_ui_component_unset_container (uic, NULL);
- }
-
- /* This is a weird place to put it, but createControls does it too early.
- I also think we should wait to do it until we actually visit the mailer.
- The delay is arbitrary - without it it shows up before the main window */
- if (!recover) {
- recover = 1;
- g_timeout_add(1000, check_autosave, NULL);
- }
-}
-
/* GObject methods. */
static void
@@ -469,8 +141,6 @@ impl_dispose (GObject *object)
priv->mail_sync_id = 0;
}
- view_changed_timeout_remove ((EComponentView *)object);
-
if (priv->activity_handler != NULL) {
g_object_unref (priv->activity_handler);
priv->activity_handler = NULL;
@@ -523,157 +193,6 @@ view_on_url (GObject *emitter, const char *url, const char *nice_url, MailCompon
}
static void
-view_changed(EMFolderView *emfv, EComponentView *component_view)
-{
- EInfoLabel *el = g_object_get_data((GObject *)component_view, "info-label");
- CORBA_Environment ev;
-
- CORBA_exception_init(&ev);
-
- if (emfv->folder) {
- char *name, *title;
- const char *use_name; /* will contain localized name, if necessary */
- guint32 visible, unread, deleted, junked, junked_not_deleted;
- GPtrArray *selected;
- GString *tmp = g_string_new("");
-
- camel_object_get(emfv->folder, NULL,
- CAMEL_FOLDER_NAME, &name,
- CAMEL_FOLDER_DELETED, &deleted,
- CAMEL_FOLDER_VISIBLE, &visible,
- CAMEL_FOLDER_JUNKED, &junked,
- CAMEL_FOLDER_JUNKED_NOT_DELETED, &junked_not_deleted,
- CAMEL_FOLDER_UNREAD, &unread, NULL);
-
- selected = message_list_get_selected(emfv->list);
-
- /* This is so that if any of these are
- * shared/reused, we fallback to the standard
- * display behaviour */
- if (selected->len > 1)
- g_string_append_printf(tmp, ngettext ("%d selected, ", "%d selected, ", selected->len), selected->len);
-
- if (CAMEL_IS_VTRASH_FOLDER(emfv->folder)) {
- if (((CamelVTrashFolder *)emfv->folder)->type == CAMEL_VTRASH_FOLDER_TRASH) {
- g_string_append_printf(tmp, ngettext ("%d deleted", "%d deleted", deleted), deleted);
- } else {
- guint32 num = junked_not_deleted;
-
- if (!emfv->hide_deleted)
- num = junked;
-
- g_string_append_printf (tmp, ngettext ("%d junk", "%d junk", num), num);
- }
- } else if (em_utils_folder_is_drafts(emfv->folder, emfv->folder_uri)) {
- g_string_append_printf(tmp, ngettext ("%d draft", "%d drafts", visible), visible);
- } else if (em_utils_folder_is_sent(emfv->folder, emfv->folder_uri)) {
- g_string_append_printf(tmp, ngettext ("%d sent", "%d sent", visible), visible);
- } else if (em_utils_folder_is_outbox(emfv->folder, emfv->folder_uri)) {
- g_string_append_printf(tmp, ngettext ("%d unsent", "%d unsent", visible), visible);
- /* HACK: hardcoded inbox or maildir '.' folder */
- } else {
- if (!emfv->hide_deleted)
- visible += deleted - junked + junked_not_deleted;
- if (unread && selected->len <= 1)
- g_string_append_printf(tmp, ngettext ("%d unread, ", "%d unread, ", unread), unread);
- g_string_append_printf(tmp, ngettext ("%d total", "%d total", visible), visible);
- }
-
- message_list_free_uids(emfv->list, selected);
-
- if (emfv->folder->parent_store == mail_component_peek_local_store(NULL)
- && (!strcmp (name, "Drafts") || !strcmp (name, "Inbox")
- || !strcmp (name, "Outbox") || !strcmp (name, "Sent") || !strcmp (name, "Templates")))
- use_name = _(name);
- else if (!strcmp (name, "INBOX"))
- use_name = _("Inbox");
- else
- use_name = name;
-
- e_info_label_set_info (el, use_name, tmp->str);
- title = g_strdup_printf ("%s (%s)", use_name, tmp->str);
- e_component_view_set_title(component_view, title);
- g_free(title);
-
- g_string_free(tmp, TRUE);
- camel_object_free(emfv->folder, CAMEL_FOLDER_NAME, name);
- } else {
- e_info_label_set_info(el, _("Mail"), "");
- e_component_view_set_title(component_view, _("Mail"));
- }
-}
-
-static void
-view_changed_timeout_remove (EComponentView *component_view)
-{
- gpointer v;
- EInfoLabel *el;
- EMFolderView *emfv;
-
- v = g_object_get_data((GObject *)component_view, "view-changed-timeout");
- if (v) {
- g_source_remove(GPOINTER_TO_INT(v));
- g_object_set_data((GObject *)component_view, "view-changed-timeout", NULL);
-
- el = g_object_get_data((GObject *)component_view, "info-label");
- emfv = g_object_get_data((GObject *)el, "folderview");
- g_object_unref(el);
- g_object_unref(emfv);
- }
-}
-
-static int
-view_changed_timeout(void *d)
-{
- EComponentView *component_view = d;
- EInfoLabel *el = g_object_get_data((GObject *)component_view, "info-label");
- EMFolderView *emfv = g_object_get_data((GObject *)el, "folderview");
-
- view_changed(emfv, component_view);
-
- g_object_set_data((GObject *)component_view, "view-changed-timeout", NULL);
-
- g_object_unref(el);
- g_object_unref(emfv);
-
- return 0;
-}
-
-static void
-view_changed_cb(EMFolderView *emfv, EComponentView *component_view)
-{
- MailComponent *mc = mail_component_peek ();
- void *v;
- EInfoLabel *el = g_object_get_data((GObject *)component_view, "info-label");
-
- v = g_object_get_data((GObject *)component_view, "view-changed-timeout");
-
- if (mc->priv->quit_state != -1) {
- if (v) {
- g_source_remove(GPOINTER_TO_INT(v));
- g_object_set_data((GObject *)component_view, "view-changed-timeout", NULL);
- g_object_unref (emfv);
- g_object_unref (el);
- }
-
- return;
-
- }
- /* This can get called 3 times every cursor move, so
- we don't need to/want to run it immediately */
-
- /* NB: we should have a 'view' struct/object to manage this crap, but this'll do for now */
- if (v) {
- g_source_remove(GPOINTER_TO_INT(v));
- } else {
- g_object_ref(emfv);
- g_object_ref(el);
- }
-
- g_object_set_data((GObject *)component_view, "view-changed-timeout", GINT_TO_POINTER(g_timeout_add(250, view_changed_timeout, component_view)));
-}
-
-static void
disable_folder_tree (gpointer *emfb, GtkWidget *widget)
{
gtk_widget_set_sensitive (widget, FALSE);
@@ -737,60 +256,60 @@ impl_createView (PortableServer_Servant servant,
em_folder_browser_suppress_message_selection (
(EMFolderBrowser *) view_widget);
- tree_widget = (GtkWidget *) em_folder_tree_new_with_model (priv->model);
- em_folder_tree_set_excluded ((EMFolderTree *) tree_widget, 0);
- em_folder_tree_enable_drag_and_drop ((EMFolderTree *) tree_widget);
-
- if ((uri = em_folder_tree_model_get_selected (priv->model))) {
- gboolean expanded;
-
- expanded = em_folder_tree_model_get_expanded_uri (priv->model, uri);
- em_folder_tree_set_selected ((EMFolderTree *) tree_widget, uri, FALSE);
- em_folder_view_set_folder_uri ((EMFolderView *) view_widget, uri);
-
- if (!expanded)
- em_folder_tree_model_set_expanded_uri (priv->model, uri, expanded);
-
- g_free (uri);
- }
+// tree_widget = (GtkWidget *) em_folder_tree_new_with_model (priv->model);
+// em_folder_tree_set_excluded ((EMFolderTree *) tree_widget, 0);
+// em_folder_tree_enable_drag_and_drop ((EMFolderTree *) tree_widget);
+
+// if ((uri = em_folder_tree_model_get_selected (priv->model))) {
+// gboolean expanded;
+//
+// expanded = em_folder_tree_model_get_expanded_uri (priv->model, uri);
+// em_folder_tree_set_selected ((EMFolderTree *) tree_widget, uri, FALSE);
+// em_folder_view_set_folder_uri ((EMFolderView *) view_widget, uri);
+//
+// if (!expanded)
+// em_folder_tree_model_set_expanded_uri (priv->model, uri, expanded);
+//
+// g_free (uri);
+// }
em_format_set_session ((EMFormat *) ((EMFolderView *) view_widget)->preview, session);
g_signal_connect (view_widget, "on-url", G_CALLBACK (view_on_url), mail_component);
em_folder_view_set_statusbar ((EMFolderView*)view_widget, FALSE);
- statusbar_widget = e_task_bar_new ();
- e_activity_handler_attach_task_bar (priv->activity_handler, E_TASK_BAR (statusbar_widget));
+// statusbar_widget = e_task_bar_new ();
+// e_activity_handler_attach_task_bar (priv->activity_handler, E_TASK_BAR (statusbar_widget));
gtk_widget_show (tree_widget);
gtk_widget_show (view_widget);
gtk_widget_show (statusbar_widget);
- vbox = gtk_vbox_new(FALSE, 0);
- info = e_info_label_new("evolution-mail");
- e_info_label_set_info((EInfoLabel *)info, _("Mail"), "");
- gtk_box_pack_start((GtkBox *)vbox, info, FALSE, TRUE, 0);
- gtk_box_pack_start((GtkBox *)vbox, tree_widget, TRUE, TRUE, 0);
+// vbox = gtk_vbox_new(FALSE, 0);
+// info = e_info_label_new("evolution-mail");
+// e_info_label_set_info((EInfoLabel *)info, _("Mail"), "");
+// gtk_box_pack_start((GtkBox *)vbox, info, FALSE, TRUE, 0);
+// gtk_box_pack_start((GtkBox *)vbox, tree_widget, TRUE, TRUE, 0);
gtk_widget_show(info);
gtk_widget_show(vbox);
- component_view = e_component_view_new(parent, "mail", vbox, view_widget, statusbar_widget);
-
- g_object_set_data((GObject *)component_view, "info-label", info);
-
- g_object_set_data_full((GObject *)view_widget, "e-creatable-items-handler",
- e_user_creatable_items_handler_new("mail", create_local_item_cb, tree_widget),
- (GDestroyNotify)g_object_unref);
+// component_view = e_component_view_new(parent, "mail", vbox, view_widget, statusbar_widget);
+//
+// g_object_set_data((GObject *)component_view, "info-label", info);
+//
+// g_object_set_data_full((GObject *)view_widget, "e-creatable-items-handler",
+// e_user_creatable_items_handler_new("mail", create_local_item_cb, tree_widget),
+// (GDestroyNotify)g_object_unref);
g_signal_connect (component_view->view_control, "activate", G_CALLBACK (view_control_activate_cb), view_widget);
- g_signal_connect (tree_widget, "folder-selected", G_CALLBACK (folder_selected_cb), view_widget);
+// g_signal_connect (tree_widget, "folder-selected", G_CALLBACK (folder_selected_cb), view_widget);
g_signal_connect((EMFolderBrowser *)view_widget, "account_search_cleared", G_CALLBACK (enable_folder_tree), tree_widget);
g_signal_connect(((EMFolderBrowser *)view_widget), "account_search_activated", G_CALLBACK (disable_folder_tree), tree_widget);
- g_signal_connect(view_widget, "changed", G_CALLBACK(view_changed_cb), component_view);
- g_signal_connect(view_widget, "loaded", G_CALLBACK(view_changed_cb), component_view);
+// g_signal_connect(view_widget, "changed", G_CALLBACK(view_changed_cb), component_view);
+// g_signal_connect(view_widget, "loaded", G_CALLBACK(view_changed_cb), component_view);
g_object_set_data((GObject*)info, "folderview", view_widget);
g_object_set_data((GObject*)view_widget, "foldertree", tree_widget);
@@ -858,11 +377,14 @@ static CORBA_boolean
impl_quit(PortableServer_Servant servant, CORBA_Environment *ev)
{
MailComponent *mc = MAIL_COMPONENT(bonobo_object_from_servant(servant));
+ EAccountList *account_list;
if (mc->priv->quit_state == -1)
mc->priv->quit_state = MC_QUIT_START;
- mail_config_prune_proxies ();
+ account_list = e_get_account_list ();
+ e_account_list_prune_proxies (account_list);
+
switch (mc->priv->quit_state) {
case MC_QUIT_START: {
int now = time(NULL)/60/60/24, days;
@@ -915,323 +437,6 @@ impl_quit(PortableServer_Servant servant, CORBA_Environment *ev)
return TRUE;
}
-static GNOME_Evolution_CreatableItemTypeList *
-impl__get_userCreatableItems (PortableServer_Servant servant, CORBA_Environment *ev)
-{
- GNOME_Evolution_CreatableItemTypeList *list = GNOME_Evolution_CreatableItemTypeList__alloc ();
-
- list->_length = 2;
- list->_maximum = list->_length;
- list->_buffer = GNOME_Evolution_CreatableItemTypeList_allocbuf (list->_length);
-
- CORBA_sequence_set_release (list, FALSE);
-
- list->_buffer[0].id = (char *) "message";
- list->_buffer[0].description = _("New Mail Message");
- list->_buffer[0].menuDescription = (char *) C_("New", "_Mail Message");
- list->_buffer[0].tooltip = _("Compose a new mail message");
- list->_buffer[0].menuShortcut = 'm';
- list->_buffer[0].iconName = (char *) "mail-message-new";
- list->_buffer[0].type = GNOME_Evolution_CREATABLE_OBJECT;
-
- list->_buffer[1].id = (char *) "folder";
- list->_buffer[1].description = _("New Mail Folder");
- list->_buffer[1].menuDescription = (char *) C_("New", "Mail _Folder");
- list->_buffer[1].tooltip = _("Create a new mail folder");
- list->_buffer[1].menuShortcut = '\0';
- list->_buffer[1].iconName = (char *) "folder-new";
- list->_buffer[1].type = GNOME_Evolution_CREATABLE_FOLDER;
-
- return list;
-}
-
-static int
-create_item(const char *type, EMFolderTreeModel *model, const char *uri, gpointer tree)
-{
- if (strcmp(type, "message") == 0) {
- if (!em_utils_check_user_can_send_mail(NULL))
- return 0;
-
- em_utils_compose_new_message(uri);
- } else if (strcmp(type, "folder") == 0) {
- em_folder_utils_create_folder (NULL, tree, NULL);
- } else
- return -1;
-
- return 0;
-}
-
-static void
-create_local_item_cb(EUserCreatableItemsHandler *handler, const char *item_type_name, void *data)
-{
- EMFolderTree *tree = data;
- char *uri = em_folder_tree_get_selected_uri(tree);
-
- create_item(item_type_name, em_folder_tree_get_model(tree), uri, (gpointer) tree);
- g_free(uri);
-}
-
-static void
-impl_requestCreateItem (PortableServer_Servant servant,
- const CORBA_char *item_type_name,
- CORBA_Environment *ev)
-{
- MailComponent *mc = MAIL_COMPONENT(bonobo_object_from_servant(servant));
-
- if (create_item(item_type_name, mc->priv->model, NULL, NULL) == -1) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Component_UnknownType, NULL);
- }
-}
-
-static void
-handleuri_got_folder(char *uri, CamelFolder *folder, void *data)
-{
- CamelURL *url = data;
- EMMessageBrowser *emmb;
-
- if (folder != NULL) {
- const char *reply = camel_url_get_param(url, "reply");
- const char *forward = camel_url_get_param(url, "forward");
- int mode;
-
- if (reply) {
-
- if (!strcmp(reply, "all"))
- mode = REPLY_MODE_ALL;
- else if (!strcmp(reply, "list"))
- mode = REPLY_MODE_LIST;
- else /* if "sender" or anything else */
- mode = REPLY_MODE_SENDER;
-
- em_utils_reply_to_message(folder, camel_url_get_param(url, "uid"), NULL, mode, NULL);
- } else if (forward) {
- GPtrArray *uids;
- const char* uid;
-
- uid = camel_url_get_param(url, "uid");
- if (uid == NULL)
- g_warning("Could not forward the message. UID is NULL.");
- else {
- uids = g_ptr_array_new();
- g_ptr_array_add(uids, g_strdup(uid));
-
- if (!strcmp(forward, "attached"))
- em_utils_forward_attached(folder, uids, uri);
- else if (!strcmp(forward, "inline"))
- em_utils_forward_inline(folder, uids, uri);
- else if (!strcmp(forward, "quoted"))
- em_utils_forward_quoted(folder, uids, uri);
- else { /* Just the default forward */
- em_utils_forward_messages(folder, uids, uri);
- }
- }
- } else {
- emmb = (EMMessageBrowser *)em_message_browser_window_new();
- /*message_list_set_threaded(((EMFolderView *)emmb)->list, emfv->list->threaded);*/
- /* FIXME: session needs to be passed easier than this */
- em_format_set_session((EMFormat *)((EMFolderView *)emmb)->preview, session);
- em_folder_view_set_folder((EMFolderView *)emmb, folder, uri);
- em_folder_view_set_message((EMFolderView *)emmb, camel_url_get_param(url, "uid"), FALSE);
- gtk_widget_show(emmb->window);
- }
- } else {
- g_warning("Couldn't open folder '%s'", uri);
- }
- camel_url_free(url);
-}
-
-static void
-impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environment *ev)
-{
- if (!strncmp (uri, "mailto:", 7)) {
- if (!em_utils_check_user_can_send_mail(NULL))
- return;
-
- em_utils_compose_new_message_with_mailto (uri, NULL);
- } else if (!strncmp(uri, "email:", 6)) {
- CamelURL *url = camel_url_new(uri, NULL);
-
- if (camel_url_get_param(url, "uid") != NULL) {
- char *curi = em_uri_to_camel(uri);
-
- mail_get_folder(curi, 0, handleuri_got_folder, url, mail_msg_unordered_push);
- g_free(curi);
- } else {
- g_warning("email uri's must include a uid parameter");
- camel_url_free(url);
- }
- }
-}
-
-static void
-impl_sendAndReceive (PortableServer_Servant servant, CORBA_Environment *ev)
-{
- em_utils_clear_get_password_canceled_accounts_flag ();
- mail_send_receive ();
-}
-
-static void
-impl_upgradeFromVersion (PortableServer_Servant servant, const short major, const short minor, const short revision, CORBA_Environment *ev)
-{
- MailComponent *component;
- CamelException ex;
-
- component = mail_component_peek ();
-
- camel_exception_init (&ex);
- if (em_migrate (e_get_user_data_dir (), major, minor, revision, &ex) == -1) {
- GNOME_Evolution_Component_UpgradeFailed *failedex;
-
- failedex = GNOME_Evolution_Component_UpgradeFailed__alloc();
- failedex->what = CORBA_string_dup(_("Failed upgrading Mail settings or folders."));
- failedex->why = CORBA_string_dup(ex.desc);
- CORBA_exception_set(ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UpgradeFailed, failedex);
- }
-
- camel_exception_clear (&ex);
-}
-
-static void
-mc_sync_store_done (CamelStore *store, void *data)
-{
- MailComponent *mc = (MailComponent *) data;
-
- mc->priv->mail_sync_in_progress--;
-}
-
-static void
-mc_sync_store (gpointer key, gpointer value, gpointer user_data)
-{
- MailComponent *mc = (MailComponent *) user_data;
-
- mc->priv->mail_sync_in_progress++;
-
- if (!camel_application_is_exiting)
- mail_sync_store (CAMEL_STORE (key), FALSE, mc_sync_store_done, mc);
- else
- mc_sync_store_done (CAMEL_STORE (key), mc);
-}
-
-static gboolean
-call_mail_sync (gpointer user_data)
-{
- MailComponent *mc = (MailComponent *)user_data;
-
- if (camel_application_is_exiting)
- return FALSE;
-
- if (!mc->priv->mail_sync_in_progress && session && camel_session_is_online (session))
- mail_component_stores_foreach (mc, mc_sync_store, mc);
-
- return !camel_application_is_exiting;
-}
-
-struct _setline_data {
- GNOME_Evolution_Listener listener;
- CORBA_boolean status;
- int pending;
-};
-
-static void
-setline_done(CamelStore *store, void *data)
-{
- struct _setline_data *sd = data;
-
- g_return_if_fail (sd->pending > 0);
-
- sd->pending--;
- if (sd->pending == 0) {
- CORBA_Environment ev = { NULL };
-
- GNOME_Evolution_Listener_complete(sd->listener, &ev);
- CORBA_exception_free(&ev);
- CORBA_Object_release(sd->listener, &ev);
- CORBA_exception_free(&ev);
- if (!sd->status)
- camel_session_set_online(session, sd->status);
- g_free(sd);
- }
-}
-
-static void
-setline_check(void *key, void *value, void *data)
-{
- CamelService *service = key;
- struct _setline_data *sd = data;
-
- if (CAMEL_IS_DISCO_STORE(service)
- || CAMEL_IS_OFFLINE_STORE(service)) {
- sd->pending++;
- mail_store_set_offline((CamelStore *)service, !sd->status, setline_done, sd);
- }
-}
-
-int
-status_check (GNOME_Evolution_ShellState shell_state)
-{
- int status = 0;
-
- switch (shell_state)
- {
- case GNOME_Evolution_USER_OFFLINE:
- status = OFFLINE;
- if (em_utils_prompt_user (NULL, "/apps/evolution/mail/prompts/quick_offline", "mail:ask-quick-offline", NULL))
- break;
- case GNOME_Evolution_FORCED_OFFLINE:
- /*Network is down so change network state on the camel session*/
- status = OFFLINE;
- /* Cancel all operations as they wont happen anyway cos Network is down*/
- mail_cancel_all ();
- camel_session_set_network_state (session, FALSE);
- break;
- case GNOME_Evolution_USER_ONLINE:
- camel_session_set_network_state (session, TRUE);
- status = ONLINE;
- }
-
- return status;
-}
-
-static void
-impl_setLineStatus(PortableServer_Servant servant, GNOME_Evolution_ShellState shell_state, GNOME_Evolution_Listener listener, CORBA_Environment *ev)
-{
- struct _setline_data *sd;
- int status = status_check(shell_state);
-
- /* This will dis/enable further auto-mail-check action. */
- /* FIXME: If send/receive active, wait for it to finish? */
- if (status)
- camel_session_set_online(session, status);
-
- sd = g_malloc0(sizeof(*sd));
- sd->status = status;
- sd->listener = CORBA_Object_duplicate(listener, ev);
- if (ev->_major == CORBA_NO_EXCEPTION)
- mail_component_stores_foreach(mail_component_peek(), setline_check, sd);
- else
- CORBA_exception_free(ev);
-
- if (sd->pending == 0) {
- if (sd->listener) {
- CORBA_Object_release(sd->listener, ev);
- CORBA_exception_free(ev);
- }
-
- g_free(sd);
-
- if (!status)
- camel_session_set_online(session, status);
- GNOME_Evolution_Listener_complete(listener, ev);
- }
-}
-
-static void
-impl_mail_test(PortableServer_Servant servant, CORBA_Environment *ev)
-{
- printf("*** Testing mail interface!! ***\n");
-}
-
/* Initialization. */
static void
@@ -1252,25 +457,22 @@ mail_component_class_init (MailComponentClass *class)
epv->createView = impl_createView;
epv->requestQuit = impl_requestQuit;
epv->quit = impl_quit;
- epv->_get_userCreatableItems = impl__get_userCreatableItems;
- epv->requestCreateItem = impl_requestCreateItem;
- epv->handleURI = impl_handleURI;
- epv->sendAndReceive = impl_sendAndReceive;
- epv->upgradeFromVersion = impl_upgradeFromVersion;
- epv->setLineStatus = impl_setLineStatus;
+// epv->_get_userCreatableItems = impl__get_userCreatableItems;
+// epv->requestCreateItem = impl_requestCreateItem;
+// epv->handleURI = impl_handleURI;
+// epv->sendAndReceive = impl_sendAndReceive;
+// epv->upgradeFromVersion = impl_upgradeFromVersion;
+// epv->setLineStatus = impl_setLineStatus;
- mepv->test = impl_mail_test;
-
- /* Register attachment handler types. */
- e_attachment_handler_mail_get_type ();
+// mepv->test = impl_mail_test;
}
-static void
-store_hash_free (struct _store_info *si)
-{
- si->removed = 1;
- store_info_unref(si);
-}
+//static void
+//store_hash_free (struct _store_info *si)
+//{
+// si->removed = 1;
+// store_info_unref(si);
+//}
static void
mail_component_init (MailComponent *component)
@@ -1283,318 +485,42 @@ mail_component_init (MailComponent *component)
priv->lock = g_mutex_new();
priv->quit_state = -1;
- /* FIXME This is used as both a filename and URI path throughout
- * the mail code. Need to clean this up; maybe provide a
- * mail_component_get_base_uri() function. */
- priv->base_directory = g_build_filename (e_get_user_data_dir (), "mail", NULL);
-#ifdef G_OS_WIN32
- {
- char *p = priv->base_directory;
- while ((p = strchr(p, '\\')))
- *p++ = '/';
- }
-#endif
-
- if (g_mkdir_with_parents (e_get_user_data_dir (), 0777) == -1 && errno != EEXIST)
- abort ();
-
- priv->model = em_folder_tree_model_new (e_get_user_data_dir ());
+// /* FIXME This is used as both a filename and URI path throughout
+// * the mail code. Need to clean this up; maybe provide a
+// * mail_component_get_base_uri() function. */
+// priv->base_directory = g_build_filename (e_get_user_data_dir (), "mail", NULL);
+//#ifdef G_OS_WIN32
+// {
+// char *p = priv->base_directory;
+// while ((p = strchr(p, '\\')))
+// *p++ = '/';
+// }
+//#endif
+
+// if (g_mkdir_with_parents (e_get_user_data_dir (), 0777) == -1 && errno != EEXIST)
+// abort ();
+
+// priv->model = em_folder_tree_model_new (e_get_user_data_dir ());
priv->logger = e_logger_create ("mail");
priv->activity_handler = e_activity_handler_new ();
e_activity_handler_set_logger (priv->activity_handler, priv->logger);
e_activity_handler_set_error_flush_time (priv->activity_handler, mail_config_get_error_timeout ()*1000);
- mail_session_init (e_get_user_data_dir ());
-
- priv->async_event = mail_async_event_new();
- priv->store_hash = g_hash_table_new_full (
- NULL, NULL,
- (GDestroyNotify) NULL,
- (GDestroyNotify) store_hash_free);
-
- mail_autoreceive_init (session);
-
- priv->mail_sync_in_progress = 0;
- if (g_getenv("CAMEL_FLUSH_CHANGES"))
- priv->mail_sync_id = g_timeout_add_seconds (mail_config_get_sync_timeout (), call_mail_sync, component);
- else
- priv->mail_sync_id = 0;
-}
-
-/* Public API. */
-MailComponent *
-mail_component_peek (void)
-{
- static MailComponent *component = NULL;
-
- if (component == NULL)
- component = g_object_new(mail_component_get_type(), NULL);
-
- return component;
-}
-
-const char *
-mail_component_peek_base_directory (MailComponent *component)
-{
- MAIL_COMPONENT_DEFAULT(component);
-
- return component->priv->base_directory;
-}
-
-RuleContext *
-mail_component_peek_search_context (MailComponent *component)
-{
- MAIL_COMPONENT_DEFAULT(component);
-
- setup_search_context(component);
-
- return component->priv->search_context;
-}
-
-EActivityHandler *
-mail_component_peek_activity_handler (MailComponent *component)
-{
- MAIL_COMPONENT_DEFAULT(component);
-
- return component->priv->activity_handler;
-}
-
-struct _CamelSession *mail_component_peek_session(MailComponent *component)
-{
- MAIL_COMPONENT_DEFAULT(component);
-
- return session;
-}
-
-void
-mail_component_add_store (MailComponent *component, CamelStore *store, const char *name)
-{
- mc_add_store(component, store, name, NULL);
-}
-
-/**
- * mail_component_load_store_by_uri:
- * @component: mail component
- * @uri: uri of store
- * @name: name of store (used for display purposes)
- *
- * Return value: Pointer to the newly added CamelStore. The caller is supposed
- * to ref the object if it wants to store it.
- **/
-CamelStore *
-mail_component_load_store_by_uri (MailComponent *component, const char *uri, const char *name)
-{
- CamelException ex;
- CamelStore *store;
- CamelProvider *prov;
-
- MAIL_COMPONENT_DEFAULT(component);
-
- camel_exception_init (&ex);
-
- /* Load the service (don't connect!). Check its provider and
- * see if this belongs in the shell's folder list. If so, add
- * it.
- */
-
- prov = camel_provider_get(uri, &ex);
- if (prov == NULL) {
- /* EPFIXME: real error dialog */
- g_warning ("couldn't get service %s: %s\n", uri,
- camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
- return NULL;
- }
-
- if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE))
- return NULL;
-
- store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex);
- if (store == NULL) {
- /* EPFIXME: real error dialog */
- g_warning ("couldn't get service %s: %s\n", uri,
- camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
- return NULL;
- }
-
- mail_component_add_store(component, store, name);
- camel_object_unref (store);
-
- return store;
-}
-
-static void
-store_disconnect (CamelStore *store, void *event_data, void *user_data)
-{
- camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL);
- camel_object_unref (store);
-}
-
-void
-mail_component_remove_store (MailComponent *component, CamelStore *store)
-{
- MailComponentPrivate *priv;
-
- MAIL_COMPONENT_DEFAULT(component);
-
- priv = component->priv;
-
- /* Because the store_hash holds a reference to each store
- * used as a key in it, none of them will ever be gc'ed, meaning
- * any call to camel_session_get_{service,store} with the same
- * URL will always return the same object. So this works.
- */
-
- if (g_hash_table_lookup (priv->store_hash, store) == NULL)
- return;
-
- camel_object_ref (store);
- g_hash_table_remove (priv->store_hash, store);
-
- /* so i guess potentially we could have a race, add a store while one
- being removed. ?? */
- mail_note_store_remove (store);
-
- em_folder_tree_model_remove_store (priv->model, store);
-
- mail_async_event_emit (priv->async_event, MAIL_ASYNC_THREAD, (MailAsyncFunc) store_disconnect, store, NULL, NULL);
-}
-
-void
-mail_component_remove_store_by_uri (MailComponent *component, const char *uri)
-{
- CamelProvider *prov;
- CamelStore *store;
-
- MAIL_COMPONENT_DEFAULT(component);
-
- if (!(prov = camel_provider_get(uri, NULL)))
- return;
-
- if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE))
- return;
-
- store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL);
- if (store != NULL) {
- mail_component_remove_store (component, store);
- camel_object_unref (store);
- }
-}
-
-int
-mail_component_get_store_count (MailComponent *component)
-{
- MAIL_COMPONENT_DEFAULT(component);
-
- return g_hash_table_size (component->priv->store_hash);
-}
-
-/* need to map from internal struct to external api */
-struct _store_foreach_data {
- GHFunc func;
- void *data;
-};
-
-static void
-mc_stores_foreach(CamelStore *store, struct _store_info *si, struct _store_foreach_data *data)
-{
- data->func((void *)store, (void *)si->name, data->data);
-}
-
-void
-mail_component_stores_foreach (MailComponent *component, GHFunc func, void *user_data)
-{
- struct _store_foreach_data data = { func, user_data };
-
- MAIL_COMPONENT_DEFAULT(component);
-
- g_hash_table_foreach (component->priv->store_hash, (GHFunc)mc_stores_foreach, &data);
-}
-
-void
-mail_component_remove_folder (MailComponent *component, CamelStore *store, const char *path)
-{
- MAIL_COMPONENT_DEFAULT(component);
-
- /* FIXME: implement me. but first, am I really even needed? */
-}
-
-EMFolderTreeModel *
-mail_component_peek_tree_model (MailComponent *component)
-{
- MAIL_COMPONENT_DEFAULT(component);
-
- return component->priv->model;
-}
-
-CamelStore *
-mail_component_peek_local_store (MailComponent *mc)
-{
- MAIL_COMPONENT_DEFAULT (mc);
- mc_setup_local_store (mc);
-
- return mc->priv->local_store;
-}
+// mail_session_init (e_get_user_data_dir ());
-/**
- * mail_component_get_folder:
- * @mc:
- * @id:
- *
- * Get a standard/default folder by id. This call is thread-safe.
- *
- * Return value:
- **/
-struct _CamelFolder *
-mail_component_get_folder(MailComponent *mc, enum _mail_component_folder_t id)
-{
- g_return_val_if_fail (id <= MAIL_COMPONENT_FOLDER_LOCAL_INBOX, NULL);
+// priv->async_event = mail_async_event_new();
+// priv->store_hash = g_hash_table_new_full (
+// NULL, NULL,
+// (GDestroyNotify) NULL,
+// (GDestroyNotify) store_hash_free);
- MAIL_COMPONENT_DEFAULT(mc);
- mc_setup_local_store(mc);
+// mail_autoreceive_init (session);
- return mc_default_folders[id].folder;
-}
-
-/**
- * mail_component_get_folder_uri:
- * @mc:
- * @id:
- *
- * Get a standard/default folder's uri. This call is thread-safe.
- *
- * Return value:
- **/
-const char *
-mail_component_get_folder_uri(MailComponent *mc, enum _mail_component_folder_t id)
-{
- g_return_val_if_fail (id <= MAIL_COMPONENT_FOLDER_LOCAL_INBOX, NULL);
-
- MAIL_COMPONENT_DEFAULT(mc);
- mc_setup_local_store(mc);
-
- return mc_default_folders[id].uri;
-}
-
-/**
- * mail_indicate_new_mail
- * Indicates new mail in a shell window.
- * @param have_new_mail TRUE when have new mail, false otherwise.
- **/
-void
-mail_indicate_new_mail (gboolean have_new_mail)
-{
- const char *icon = NULL;
- MailComponent *mc = mail_component_peek ();
-
- g_return_if_fail (mc != NULL);
-
- if (have_new_mail)
- icon = "mail-unread";
-
- if (mc->priv->component_view)
- e_component_view_set_button_icon (mc->priv->component_view, icon);
+// priv->mail_sync_in_progress = 0;
+// if (g_getenv("CAMEL_FLUSH_CHANGES"))
+// priv->mail_sync_id = g_timeout_add_seconds (mail_config_get_sync_timeout (), call_mail_sync, component);
+// else
+// priv->mail_sync_id = 0;
}
void
@@ -1605,5 +531,3 @@ mail_component_show_logger (gpointer top)
eni_show_logger(logger, top, MAILER_ERROR_TIME_OUT_KEY, MAILER_ERROR_LEVEL_KEY);
}
-
-BONOBO_TYPE_FUNC_FULL (MailComponent, GNOME_Evolution_MailComponent, PARENT_TYPE, mail_component)
diff --git a/mail/mail-component.h b/mail/mail-component.h
index 9af5caa40f..09b19f4c4f 100644
--- a/mail/mail-component.h
+++ b/mail/mail-component.h
@@ -71,8 +71,6 @@ const char *mail_component_peek_base_directory (MailComponent *componen
struct _RuleContext *mail_component_peek_search_context (MailComponent *component);
struct _EActivityHandler *mail_component_peek_activity_handler (MailComponent *component);
-struct _CamelSession *mail_component_peek_session(MailComponent *);
-
void mail_component_add_store (MailComponent *component,
struct _CamelStore *store,
const char *name);
diff --git a/mail/mail-config-factory.c b/mail/mail-config-factory.c
deleted file mode 100644
index f89383580c..0000000000
--- a/mail/mail-config-factory.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include "em-account-prefs.h"
-#include "em-composer-prefs.h"
-#include "em-mailer-prefs.h"
-#include "em-network-prefs.h"
-
-#include "mail-config-factory.h"
-
-#define CONFIG_CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ConfigControlFactory:" BASE_VERSION
-
-BonoboObject *
-mail_config_control_factory_cb (BonoboGenericFactory *factory, const char *component_id, void *user_data)
-{
- GNOME_Evolution_Shell shell = (GNOME_Evolution_Shell) user_data;
- EvolutionConfigControl *control;
- GtkWidget *prefs = NULL;
-
- if (!strcmp (component_id, EM_ACCOUNT_PREFS_CONTROL_ID)) {
- prefs = em_account_prefs_new (shell);
- } else if (!strcmp (component_id, EM_MAILER_PREFS_CONTROL_ID)) {
- prefs = em_mailer_prefs_new ();
- } else if (!strcmp (component_id, EM_COMPOSER_PREFS_CONTROL_ID)) {
- prefs = em_composer_prefs_new ();
- } else if (!strcmp (component_id, EM_NETWORK_PREFS_CONTROL_ID)) {
- prefs = em_network_prefs_new ();
- } else {
- g_return_val_if_reached(NULL);
- }
-
- gtk_widget_show_all (prefs);
-
- control = evolution_config_control_new (prefs);
-
- return BONOBO_OBJECT (control);
-}
diff --git a/mail/mail-config.c b/mail/mail-config.c
index bcf8dd7854..59bab65785 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -37,10 +37,7 @@
#include <gtk/gtk.h>
#include <glib/gstdio.h>
-
-#ifndef G_OS_WIN32
-#include <sys/wait.h>
-#endif
+#include <glib/gi18n-lib.h>
#include <gtkhtml/gtkhtml.h>
#include <glade/glade.h>
@@ -48,19 +45,11 @@
#include <libxml/tree.h>
#include <libxml/parser.h>
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-context.h>
-#include <bonobo/bonobo-moniker-util.h>
-#include <bonobo/bonobo-exception.h>
-
#include <libedataserver/e-data-server-util.h>
#include <e-util/e-util.h>
#include <misc/e-gui-utils.h>
-#include "e-util/e-util-labels.h"
-
-#include <libedataserver/e-account-list.h>
-#include <e-util/e-signature-list.h>
+#include "e-util/e-account-utils.h"
+#include "e-util/e-signature-utils.h"
#include <camel/camel-service.h>
#include <camel/camel-stream-mem.h>
@@ -70,22 +59,18 @@
#include <libedataserverui/e-passwords.h>
-#include "mail-component.h"
#include "mail-session.h"
#include "mail-config.h"
#include "mail-mt.h"
#include "mail-tools.h"
+#include "e-mail-shell-backend.h"
+
typedef struct {
GConfClient *gconf;
- gboolean corrupt;
-
char *gtkrc;
- EAccountList *accounts;
- ESignatureList *signatures;
-
GSList *labels;
gboolean address_compress;
@@ -110,18 +95,6 @@ extern int camel_header_param_encode_filenames_in_rfc_2047;
static MailConfig *config = NULL;
static guint config_write_timeout = 0;
-void
-mail_config_save_accounts (void)
-{
- e_account_list_save (config->accounts);
-}
-
-void
-mail_config_save_signatures (void)
-{
- e_signature_list_save (config->signatures);
-}
-
static void
config_clear_mime_types (void)
{
@@ -215,33 +188,6 @@ config_write_style (void)
}
static void
-config_clear_labels (void)
-{
- if (!config)
- return;
-
- e_util_labels_free (config->labels);
- config->labels = NULL;
-}
-
-static void
-config_cache_labels (GConfClient *client)
-{
- if (!config)
- return;
-
- config->labels = e_util_labels_parse (client);
-}
-
-static void
-gconf_labels_changed (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
-{
- config_clear_labels ();
- config_cache_labels (client);
-}
-
-static void
gconf_style_changed (GConfClient *client, guint cnxn_id,
GConfEntry *entry, gpointer user_data)
{
@@ -368,9 +314,6 @@ mail_config_init (void)
mail_config_clear ();
- config->accounts = e_account_list_new (config->gconf);
- config->signatures = e_signature_list_new (config->gconf);
-
gtk_rc_parse (config->gtkrc);
/* Composer Configuration */
@@ -473,18 +416,6 @@ mail_config_init (void)
gconf_client_notify_add (
config->gconf, key, func, NULL, NULL, NULL);
- /* Label Configuration */
-
- gconf_client_add_dir (
- config->gconf, E_UTIL_LABELS_GCONF_KEY,
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-
- gconf_client_notify_add (
- config->gconf, E_UTIL_LABELS_GCONF_KEY,
- gconf_labels_changed, NULL, NULL, NULL);
-
- config_cache_labels (config->gconf);
-
/* MIME Type Configuration */
gconf_client_add_dir (
@@ -549,17 +480,6 @@ mail_config_clear (void)
if (!config)
return;
- if (config->accounts) {
- g_object_unref (config->accounts);
- config->accounts = NULL;
- }
-
- if (config->signatures) {
- g_object_unref (config->signatures);
- config->signatures = NULL;
- }
-
- config_clear_labels ();
config_clear_mime_types ();
}
@@ -567,11 +487,17 @@ mail_config_clear (void)
void
mail_config_write (void)
{
+ EAccountList *account_list;
+ ESignatureList *signature_list;
+
if (!config)
return;
- e_account_list_save (config->accounts);
- e_signature_list_save (config->signatures);
+ account_list = e_get_account_list ();
+ signature_list = e_get_signature_list ();
+
+ e_account_list_save (account_list);
+ e_signature_list_save (signature_list);
gconf_client_suggest_sync (config->gconf, NULL);
}
@@ -579,6 +505,7 @@ mail_config_write (void)
void
mail_config_write_on_exit (void)
{
+ EAccountList *account_list;
EAccount *account;
EIterator *iter;
@@ -592,7 +519,8 @@ mail_config_write_on_exit (void)
/* then we make sure the ones we want to remember are in the
session cache */
- iter = e_list_get_iterator ((EList *) config->accounts);
+ account_list = e_get_account_list ();
+ iter = e_list_get_iterator ((EList *) account_list);
while (e_iterator_is_valid (iter)) {
char *passwd;
@@ -621,7 +549,7 @@ mail_config_write_on_exit (void)
e_passwords_clear_passwords ("Mail");
/* then we remember them */
- iter = e_list_get_iterator ((EList *) config->accounts);
+ iter = e_list_get_iterator ((EList *) account_list);
while (e_iterator_is_valid (iter)) {
account = (EAccount *) e_iterator_get (iter);
@@ -655,18 +583,6 @@ mail_config_get_gconf_client (void)
return config->gconf;
}
-gboolean
-mail_config_is_configured (void)
-{
- return e_list_length ((EList *) config->accounts) > 0;
-}
-
-gboolean
-mail_config_is_corrupt (void)
-{
- return config->corrupt;
-}
-
int
mail_config_get_address_count (void)
{
@@ -734,74 +650,16 @@ mail_config_get_enable_magic_spacebar ()
return config->magic_spacebar;
}
-/**
- * mail_config_get_labels
- *
- * @return list of known labels, each member data is EUtilLabel structure.
- * Returned list should not be freed, neither data inside it.
- **/
-GSList *
-mail_config_get_labels (void)
-{
- return config->labels;
-}
-
const char **
mail_config_get_allowable_mime_types (void)
{
return (const char **) config->mime_types->pdata;
}
-gboolean
-mail_config_find_account (EAccount *account)
-{
- EAccount *acnt;
- EIterator *iter;
-
- iter = e_list_get_iterator ((EList *) config->accounts);
- while (e_iterator_is_valid (iter)) {
- acnt = (EAccount *) e_iterator_get (iter);
- if (acnt == account) {
- g_object_unref (iter);
- return TRUE;
- }
-
- e_iterator_next (iter);
- }
-
- g_object_unref (iter);
-
- return FALSE;
-}
-
-EAccount *
-mail_config_get_default_account (void)
-{
- if (config == NULL)
- mail_config_init ();
-
- if (!config->accounts)
- return NULL;
-
- /* should probably return const */
- return (EAccount *)e_account_list_get_default(config->accounts);
-}
-
-EAccount *
-mail_config_get_account_by_name (const char *account_name)
-{
- return (EAccount *)e_account_list_find(config->accounts, E_ACCOUNT_FIND_NAME, account_name);
-}
-
-EAccount *
-mail_config_get_account_by_uid (const char *uid)
-{
- return (EAccount *) e_account_list_find (config->accounts, E_ACCOUNT_FIND_UID, uid);
-}
-
static EAccount *
mc_get_account_by (const char *given_url, const char * (get_url_string)(EAccount *account))
{
+ EAccountList *account_list;
EAccount *account = NULL;
EIterator *iter;
CamelURL *url;
@@ -816,7 +674,8 @@ mc_get_account_by (const char *given_url, const char * (get_url_string)(EAccount
provider = camel_provider_get (given_url, NULL);
g_return_val_if_fail (provider != NULL && provider->url_equal != NULL, NULL);
- iter = e_list_get_iterator ((EList *) config->accounts);
+ account_list = e_get_account_list ();
+ iter = e_list_get_iterator ((EList *) account_list);
while (account == NULL && e_iterator_is_valid (iter)) {
CamelURL *account_url;
const char *account_url_string;
@@ -878,77 +737,21 @@ mail_config_get_account_by_transport_url (const char *transport_url)
return mc_get_account_by (transport_url, get_transport_url_string);
}
-int
-mail_config_has_proxies (EAccount *account)
-{
- return e_account_list_account_has_proxies (config->accounts, account);
-}
-
-void
-mail_config_remove_account_proxies (EAccount *account)
-{
- e_account_list_remove_account_proxies (config->accounts, account);
-}
-
-void
-mail_config_prune_proxies (void)
-{
- e_account_list_prune_proxies (config->accounts);
-}
-
-EAccountList *
-mail_config_get_accounts (void)
-{
- if (config == NULL)
- mail_config_init ();
-
- return config->accounts;
-}
-
-void
-mail_config_add_account (EAccount *account)
-{
- e_account_list_add(config->accounts, account);
- mail_config_save_accounts ();
-}
-
-void
-mail_config_remove_account (EAccount *account)
-{
- e_account_list_remove(config->accounts, account);
- mail_config_save_accounts ();
-}
-
-void
-mail_config_set_default_account (EAccount *account)
-{
- e_account_list_set_default(config->accounts, account);
-}
-
-EAccountIdentity *
-mail_config_get_default_identity (void)
-{
- EAccount *account;
-
- account = mail_config_get_default_account ();
- if (account)
- return account->id;
- else
- return NULL;
-}
-
EAccountService *
mail_config_get_default_transport (void)
{
+ EAccountList *account_list;
EAccount *account;
EIterator *iter;
- account = mail_config_get_default_account ();
+ account_list = e_get_account_list ();
+ account = e_get_default_account ();
+
if (account && account->enabled && account->transport && account->transport->url && account->transport->url[0])
return account->transport;
/* return the first account with a transport? */
- iter = e_list_get_iterator ((EList *) config->accounts);
+ iter = e_list_get_iterator ((EList *) account_list);
while (e_iterator_is_valid (iter)) {
account = (EAccount *) e_iterator_get (iter);
@@ -969,17 +772,21 @@ mail_config_get_default_transport (void)
static char *
uri_to_evname (const char *uri, const char *prefix)
{
- const char *base_directory = mail_component_peek_base_directory (mail_component_peek ());
+ EShellBackend *shell_backend;
+ const gchar *data_dir;
char *safe;
char *tmp;
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+
safe = g_strdup (uri);
e_filename_make_safe (safe);
/* blah, easiest thing to do */
if (prefix[0] == '*')
- tmp = g_strdup_printf ("%s/%s%s.xml", base_directory, prefix + 1, safe);
+ tmp = g_strdup_printf ("%s/%s%s.xml", data_dir, prefix + 1, safe);
else
- tmp = g_strdup_printf ("%s/%s%s", base_directory, prefix, safe);
+ tmp = g_strdup_printf ("%s/%s%s", data_dir, prefix, safe);
g_free (safe);
return tmp;
}
@@ -987,6 +794,7 @@ uri_to_evname (const char *uri, const char *prefix)
void
mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new)
{
+ EAccountList *account_list;
EAccount *account;
EIterator *iter;
int i, work = 0;
@@ -999,7 +807,8 @@ mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new)
"*views/custom_view-",
NULL };
- iter = e_list_get_iterator ((EList *) config->accounts);
+ account_list = e_get_account_list ();
+ iter = e_list_get_iterator ((EList *) account_list);
while (e_iterator_is_valid (iter)) {
account = (EAccount *) e_iterator_get (iter);
@@ -1040,26 +849,33 @@ mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new)
void
mail_config_uri_deleted (GCompareFunc uri_cmp, const char *uri)
{
+ EAccountList *account_list;
EAccount *account;
EIterator *iter;
int work = 0;
+ const gchar *local_drafts_folder_uri;
+ const gchar *local_sent_folder_uri;
+
/* assumes these can't be removed ... */
- const char *default_sent_folder_uri = mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_SENT);
- const char *default_drafts_folder_uri = mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_DRAFTS);
+ local_drafts_folder_uri = e_mail_shell_backend_get_folder_uri (
+ global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
+ local_sent_folder_uri = e_mail_shell_backend_get_folder_uri (
+ global_mail_shell_backend, E_MAIL_FOLDER_SENT);
- iter = e_list_get_iterator ((EList *) config->accounts);
+ account_list = e_get_account_list ();
+ iter = e_list_get_iterator ((EList *) account_list);
while (e_iterator_is_valid (iter)) {
account = (EAccount *) e_iterator_get (iter);
if (account->sent_folder_uri && uri_cmp (account->sent_folder_uri, uri)) {
g_free (account->sent_folder_uri);
- account->sent_folder_uri = g_strdup (default_sent_folder_uri);
+ account->sent_folder_uri = g_strdup (local_sent_folder_uri);
work = 1;
}
if (account->drafts_folder_uri && uri_cmp (account->drafts_folder_uri, uri)) {
g_free (account->drafts_folder_uri);
- account->drafts_folder_uri = g_strdup (default_drafts_folder_uri);
+ account->drafts_folder_uri = g_strdup (local_drafts_folder_uri);
work = 1;
}
@@ -1091,115 +907,22 @@ mail_config_folder_to_safe_url (CamelFolder *folder)
char *
mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
{
+ EShellBackend *shell_backend;
char *url, *basename, *filename;
- const char *evolution_dir;
+ const gchar *config_dir;
- evolution_dir = mail_component_peek_base_directory (mail_component_peek ());
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+ config_dir = e_shell_backend_get_config_dir (shell_backend);
url = mail_config_folder_to_safe_url (folder);
basename = g_strdup_printf ("%s%s", prefix, url);
- filename = g_build_filename (evolution_dir, "config", basename, NULL);
+ filename = g_build_filename (config_dir, basename, NULL);
g_free (basename);
g_free (url);
return filename;
}
-ESignatureList *
-mail_config_get_signatures (void)
-{
- return config->signatures;
-}
-
-static char *
-get_new_signature_filename (void)
-{
- const char *base_directory;
- char *filename, *id;
- struct stat st;
- int i;
-
- base_directory = e_get_user_data_dir ();
- filename = g_build_filename (base_directory, "signatures", NULL);
- if (g_lstat (filename, &st)) {
- if (errno == ENOENT) {
- if (g_mkdir (filename, 0700))
- g_warning ("Fatal problem creating %s directory.", filename);
- } else
- g_warning ("Fatal problem with %s directory.", filename);
- }
- g_free (filename);
-
- filename = g_malloc (strlen (base_directory) + sizeof ("/signatures/signature-") + 12);
- id = g_stpcpy (filename, base_directory);
- id = g_stpcpy (id, "/signatures/signature-");
-
- for (i = 0; i < (INT_MAX - 1); i++) {
- sprintf (id, "%d", i);
- if (g_lstat (filename, &st) == -1 && errno == ENOENT) {
- int fd;
-
- fd = g_creat (filename, 0600);
- if (fd >= 0) {
- close (fd);
- return filename;
- }
- }
- }
-
- g_free (filename);
-
- return NULL;
-}
-
-
-ESignature *
-mail_config_signature_new (const char *filename, gboolean script, gboolean html)
-{
- ESignature *sig;
-
- sig = e_signature_new ();
- sig->name = g_strdup (_("Unnamed"));
- sig->script = script;
- sig->html = html;
-
- if (filename == NULL)
- sig->filename = get_new_signature_filename ();
- else
- sig->filename = g_strdup (filename);
-
- return sig;
-}
-
-ESignature *
-mail_config_get_signature_by_uid (const char *uid)
-{
- return (ESignature *) e_signature_list_find (config->signatures, E_SIGNATURE_FIND_UID, uid);
-}
-
-ESignature *
-mail_config_get_signature_by_name (const char *name)
-{
- return (ESignature *) e_signature_list_find (config->signatures, E_SIGNATURE_FIND_NAME, name);
-}
-
-void
-mail_config_add_signature (ESignature *signature)
-{
- e_signature_list_add (config->signatures, signature);
- mail_config_save_signatures ();
-}
-
-void
-mail_config_remove_signature (ESignature *signature)
-{
- if (signature->filename && !signature->script)
- g_unlink (signature->filename);
-
- e_signature_list_remove (config->signatures, signature);
- mail_config_save_signatures ();
-}
-
void
mail_config_reload_junk_headers (void)
{
@@ -1230,131 +953,3 @@ mail_config_get_lookup_book_local_only (void)
return config->book_lookup_local_only;
}
-
-gboolean
-mail_config_scripts_disabled (void)
-{
- if (config == NULL)
- mail_config_init ();
-
- return config->scripts_disabled;
-}
-
-char *
-mail_config_signature_run_script (const char *script)
-{
-#ifndef G_OS_WIN32
- int result, status;
- int in_fds[2];
- pid_t pid;
-
- if (mail_config_scripts_disabled ())
- return NULL;
-
- if (pipe (in_fds) == -1) {
- g_warning ("Failed to create pipe to '%s': %s", script, g_strerror (errno));
- return NULL;
- }
-
- if (!(pid = fork ())) {
- /* child process */
- int maxfd, i;
-
- close (in_fds [0]);
- if (dup2 (in_fds[1], STDOUT_FILENO) < 0)
- _exit (255);
- close (in_fds [1]);
-
- setsid ();
-
- maxfd = sysconf (_SC_OPEN_MAX);
- for (i = 3; i < maxfd; i++) {
- if (i != STDIN_FILENO && i != STDOUT_FILENO && i != STDERR_FILENO)
- fcntl (i, F_SETFD, FD_CLOEXEC);
- }
-
- execlp("/bin/sh", "/bin/sh", "-c", script, NULL);
- g_warning ("Could not execute %s: %s\n", script, g_strerror (errno));
- _exit (255);
- } else if (pid < 0) {
- g_warning ("Failed to create create child process '%s': %s", script, g_strerror (errno));
- close (in_fds [0]);
- close (in_fds [1]);
- return NULL;
- } else {
- CamelStreamFilter *filtered_stream;
- CamelStreamMem *memstream;
- CamelMimeFilter *charenc;
- CamelStream *stream;
- GByteArray *buffer;
- char *charset;
- char *content;
-
- /* parent process */
- close (in_fds[1]);
-
- stream = camel_stream_fs_new_with_fd (in_fds[0]);
-
- memstream = (CamelStreamMem *) camel_stream_mem_new ();
- buffer = g_byte_array_new ();
- camel_stream_mem_set_byte_array (memstream, buffer);
-
- camel_stream_write_to_stream (stream, (CamelStream *) memstream);
- camel_object_unref (stream);
-
- /* signature scripts are supposed to generate UTF-8 content, but because users
- are known to not ever read the manual... we try to do our best if the
- content isn't valid UTF-8 by assuming that the content is in the user's
- preferred charset. */
- if (!g_utf8_validate ((char *)buffer->data, buffer->len, NULL)) {
- stream = (CamelStream *) memstream;
- memstream = (CamelStreamMem *) camel_stream_mem_new ();
- camel_stream_mem_set_byte_array (memstream, g_byte_array_new ());
-
- filtered_stream = camel_stream_filter_new_with_stream (stream);
- camel_object_unref (stream);
-
- charset = gconf_client_get_string (config->gconf, "/apps/evolution/mail/composer/charset", NULL);
- if (charset && *charset) {
- if ((charenc = (CamelMimeFilter *) camel_mime_filter_charset_new_convert (charset, "utf-8"))) {
- camel_stream_filter_add (filtered_stream, charenc);
- camel_object_unref (charenc);
- }
- }
- g_free (charset);
-
- camel_stream_write_to_stream ((CamelStream *) filtered_stream, (CamelStream *) memstream);
- camel_object_unref (filtered_stream);
- g_byte_array_free (buffer, TRUE);
-
- buffer = memstream->buffer;
- }
-
- camel_object_unref (memstream);
-
- g_byte_array_append (buffer, (const unsigned char *)"", 1);
- content = (char *)buffer->data;
- g_byte_array_free (buffer, FALSE);
-
- /* wait for the script process to terminate */
- result = waitpid (pid, &status, 0);
-
- if (result == -1 && errno == EINTR) {
- /* child process is hanging... */
- kill (pid, SIGTERM);
- sleep (1);
- result = waitpid (pid, &status, WNOHANG);
- if (result == 0) {
- /* ...still hanging, set phasers to KILL */
- kill (pid, SIGKILL);
- sleep (1);
- result = waitpid (pid, &status, WNOHANG);
- }
- }
-
- return content;
- }
-#else
- return NULL;
-#endif
-}
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index f435b95a63..0124d086a3 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -1,9671 +1,5649 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
+<?xml version="1.0"?>
<glade-interface>
-<requires lib="gnome"/>
-
-<widget class="GtkWindow" id="account_druid">
- <property name="title" translatable="yes">Evolution Account Assistant</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="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
-
- <child>
- <widget class="GnomeDruid" id="druid">
- <property name="border_width">4</property>
- <property name="visible">True</property>
- <property name="show_help">False</property>
-
- <child>
- <widget class="GnomeDruidPageEdge" id="start_page">
- <property name="visible">True</property>
- <property name="position">GNOME_EDGE_START</property>
- <property name="title" translatable="yes">Mail Configuration</property>
- <property name="text" translatable="yes">Welcome to the Evolution Mail Configuration Assistant.
-
-Click &quot;Forward&quot; to begin. </property>
- </widget>
- </child>
-
- <child>
- <widget class="GnomeDruidPageStandard" id="identity_page">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Identity</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="druid_identity_vbox">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="identity_help">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Please enter your name and email address below. The &quot;optional&quot; fields below do not need to be filled in, unless you wish to include this information in email you send.</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GnomeDruidPageStandard" id="source_page">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Receiving Email</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="druid_source_vbox">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="extra_help">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Please select among the following options</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GnomeDruidPageStandard" id="transport_page">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Sending Email</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="druid_transport_vbox">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="transport_help">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Please enter information about the way you will send mail. If you are not sure, ask your system administrator or Internet Service Provider.</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GnomeDruidPageStandard" id="management_page">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Account Management</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="druid_management_vbox">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="management_help">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Please enter a descriptive name for this account in the space below.
+ <requires lib="gnome"/>
+ <!-- interface-requires gnome 2301.3464 -->
+ <!-- interface-requires gtk+ 2.16 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <widget class="GtkWindow" id="account_druid">
+ <property name="title" translatable="yes">Evolution Account Assistant</property>
+ <child>
+ <widget class="GnomeDruid" id="druid">
+ <property name="visible">True</property>
+ <property name="border_width">4</property>
+ <child>
+ <widget class="GnomeDruidPageEdge" id="start_page">
+ <property name="visible">True</property>
+ <property name="position">Edge Start</property>
+ <property name="title" translatable="yes">Mail Configuration</property>
+ <property name="text" translatable="yes">Welcome to the Evolution Mail Configuration Assistant.
+
+Click "Forward" to begin. </property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GnomeDruidPageStandard" id="identity_page">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Identity</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="druid_identity_vbox">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="identity_help">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Please enter your name and email address below. The "optional" fields below do not need to be filled in, unless you wish to include this information in email you send.</property>
+ <property name="wrap">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GnomeDruidPageStandard" id="source_page">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Receiving Email</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="druid_source_vbox">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="extra_help">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Please select among the following options</property>
+ <property name="wrap">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GnomeDruidPageStandard" id="transport_page">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Sending Email</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="druid_transport_vbox">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="transport_help">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Please enter information about the way you will send mail. If you are not sure, ask your system administrator or Internet Service Provider.</property>
+ <property name="wrap">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GnomeDruidPageStandard" id="management_page">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Account Management</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="druid_management_vbox">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="management_help">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Please enter a descriptive name for this account in the space below.
This name will be used for display purposes only.</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GnomeDruidPageEdge" id="finish_page">
- <property name="visible">True</property>
- <property name="position">GNOME_EDGE_FINISH</property>
- <property name="title" translatable="yes">Done</property>
- <property name="text" translatable="yes">Congratulations, your mail configuration is complete.
+ <property name="wrap">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GnomeDruidPageEdge" id="finish_page">
+ <property name="visible">True</property>
+ <property name="position">Edge Finish</property>
+ <property name="title" translatable="yes">Done</property>
+ <property name="text" translatable="yes">Congratulations, your mail configuration is complete.
You are now ready to send and receive email
using Evolution.
-Click &quot;Apply&quot; to save your settings.</property>
- </widget>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkWindow" id="account_editor">
- <property name="title" translatable="yes">Account Editor</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="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
-
- <child>
- <widget class="GtkNotebook" id="account_editor_notebook">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="show_tabs">True</property>
- <property name="show_border">True</property>
- <property name="tab_pos">GTK_POS_TOP</property>
- <property name="scrollable">False</property>
- <property name="enable_popup">False</property>
-
- <child>
- <widget class="GtkVBox" id="vboxIdentityBorder">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkVBox" id="management_frame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label470">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Account Information&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox172">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label568">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table12">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="account_vbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="management_description_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Type the name by which you would like to refer to this account.
-For example: &quot;Work&quot; or &quot;Personal&quot;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hboxIdentityName">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="management_name_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Name:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</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>
- <property name="mnemonic_widget">management_name</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="management_name">
- <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">*</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>
- </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">0</property>
- <property name="right_attach">1</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>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="identity_required_frame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label464">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Required Information&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox170">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label569">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table10">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="identity_required_table">
- <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">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkEntry" id="identity_address">
- <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">*</property>
- <property name="activates_default">False</property>
- <accessibility>
- <atkrelation target="identity_address_label" type="labelled-by"/>
- <atkrelation target="label464" type="labelled-by"/>
- </accessibility>
- </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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="identity_address_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Email _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">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">identity_address</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="identity_full_name_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Full Nam_e:</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>
- <property name="mnemonic_widget">identity_full_name</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkEntry" id="identity_full_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">*</property>
- <property name="activates_default">False</property>
- <accessibility>
- <atkrelation target="label464" type="labelled-by"/>
- <atkrelation target="identity_full_name_label" type="labelled-by"/>
- </accessibility>
- </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>
- </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>
- </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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="identity_optional_frame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label466">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Optional Information&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox171">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label570">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="identity_optional_table">
- <property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="sigLabel">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Signat_ure:</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>
- <property name="mnemonic_widget">signature_dropdown</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox169">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="Custom" id="signature_dropdown">
- <property name="visible">True</property>
- <property name="creation_function">em_account_editor_dropdown_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Mon, 06 Sep 2004 01:00:22 GMT</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="sigAddNew">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Add Ne_w Signature...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <signal name="clicked" handler="sigAddNewClicked"/>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
- </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="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="identity_organization">
- <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">*</property>
- <property name="activates_default">False</property>
- <accessibility>
- <atkrelation target="identity_organization_label" type="labelled-by"/>
- <atkrelation target="label466" type="labelled-by"/>
- </accessibility>
- </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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="identity_organization_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Or_ganization:</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>
- <property name="mnemonic_widget">identity_organization</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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="GtkEntry" id="identity_reply_to">
- <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">*</property>
- <property name="activates_default">False</property>
- <accessibility>
- <atkrelation target="label466" type="labelled-by"/>
- <atkrelation target="reply_to_label" type="labelled-by"/>
- </accessibility>
- </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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="reply_to_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Re_ply-To:</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">identity_reply_to</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkCheckButton" id="management_default">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Make this my default account</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</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_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>
- <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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label31">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Identity</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vboxSourceBorder">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkVBox" id="source_vbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkTable" id="source_type_table">
- <property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="source_type_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Server _Type: </property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</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">source_type_dropdown</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="label442">
- <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_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="source_description">
- <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">True</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</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="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="Custom" id="source_type_dropdown">
- <property name="visible">True</property>
- <property name="creation_function">em_account_editor_dropdown_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 29 Jul 2004 05:31:24 GMT</property>
- </widget>
- <packing>
- <property name="left_attach">1</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"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHSeparator" id="hseparator2">
- <property name="visible">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="source_frame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label472">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Configuration&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox173">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label565">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table13">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="table4">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="source_host_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Server:</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>
- <property name="mnemonic_widget">source_host</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="source_user_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">User_name:</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>
- <property name="mnemonic_widget">source_user</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkEntry" id="source_host">
- <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">*</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">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="source_user">
- <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">*</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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="source_path_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Path:</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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="GtkFileChooserButton" id="source_path_entry">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Mailbox location</property>
- <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
- <property name="local_only">True</property>
- <property name="show_hidden">False</property>
- <property name="do_overwrite_confirmation">False</property>
- <property name="width_chars">-1</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"></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>
- </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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="source_security_frame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label515">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Security&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="mnemonic_widget">source_auth_dropdown</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox201">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label567">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox181">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkHBox" id="source_ssl_hbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="lblSourceUseSSL">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Use Secure Connection:</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">source_use_ssl</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="Custom" id="source_use_ssl">
- <property name="visible">True</property>
- <property name="creation_function">em_account_editor_ssl_selector_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 03 Aug 2004 07:22:52 GMT</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>
-
- <child>
- <widget class="GtkHBox" id="source_ssl_disabled">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="stock">gtk-dialog-warning</property>
- <property name="icon_size">4</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="label514">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;SSL is not supported in this build of Evolution&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
- </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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="source_auth_frame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label474">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;_Authentication Type&lt;/span&gt;</property>
- <property name="use_underline">True</property>
- <property name="use_markup">True</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>
- <property name="mnemonic_widget">source_auth_dropdown</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox174">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label566">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox179">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkHBox" id="hbox199">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="Custom" id="source_auth_dropdown">
- <property name="visible">True</property>
- <property name="creation_function">em_account_editor_dropdown_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 29 Jul 2004 08:38:30 GMT</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="source_check_supported">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes"> Ch_eck for Supported Types </property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">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="GtkCheckButton" id="source_remember_password">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">Note: you will not be prompted for a password until you connect for the first time</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Re_member password</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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>
- </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">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>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label33">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Receiving Email</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vboxTransportBorder">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkVBox" id="transport_vbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkTable" id="transport_type_table">
- <property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="transport_type_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Server _Type: </property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">transport_type_dropdown</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="label50">
- <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_RIGHT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
- </packing>
- </child>
-
- <child>
- <widget class="Custom" id="transport_type_dropdown">
- <property name="visible">True</property>
- <property name="creation_function">em_account_editor_dropdown_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 29 Jul 2004 05:42:00 GMT</property>
- </widget>
- <packing>
- <property name="left_attach">1</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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="transport_description">
- <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">True</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</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="x_options">fill</property>
- <property name="y_options"></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="GtkHSeparator" id="hseparator3">
- <property name="visible">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="transport_frame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkVBox" id="transport_server_frame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label476">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Server Configuration&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox175">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label562">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table15">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox12">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="table6">
- <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">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="transport_host_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Server:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</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">transport_host</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkEntry" id="transport_host">
- <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">*</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">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></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="GtkCheckButton" id="transport_needs_auth">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ser_ver requires authentication</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="left_attach">0</property>
- <property name="right_attach">1</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>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="transport_security_frame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label517">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Security&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox203">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label564">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox183">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkHBox" id="transport_ssl_hbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="lblTransportUseSSL">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Use Secure Connection:</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">transport_use_ssl</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="Custom" id="transport_use_ssl">
- <property name="visible">True</property>
- <property name="creation_function">em_account_editor_ssl_selector_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 03 Aug 2004 07:23:50 GMT</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="transport_ssl_disabled">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-dialog-warning</property>
- <property name="icon_size">4</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="transport_ssl_disabled_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;SSL is not supported in this build of Evolution&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
- </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>
-
- <child>
- <widget class="GtkVBox" id="transport_auth_frame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label478">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Authentication&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox176">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label563">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table16">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox61">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="table31">
- <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">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="transport_auth_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">T_ype: </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">transport_auth_dropdown</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="transport_user_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">User_name:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</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">transport_user</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkEntry" id="transport_user">
- <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">*</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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox195">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="Custom" id="transport_auth_dropdown">
- <property name="visible">True</property>
- <property name="creation_function">em_account_editor_dropdown_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 29 Jul 2004 08:37:13 GMT</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="transport_check_supported">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ch_eck for Supported Types </property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFixed" id="fixed5">
- <property name="visible">True</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">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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="transport_remember_password">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Remember _password</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="left_attach">0</property>
- <property name="right_attach">1</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>
- <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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label34">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Sending Mail</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vboxFoldersBorder">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkVBox" id="folders_frame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label482">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Sent and Draft Messages&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox177">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label560">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table17">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox184">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="folders_table">
- <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">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="drafts_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Drafts _Folder:</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>
- <property name="mnemonic_widget">drafts_button</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="sent_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Sent _Messages Folder:</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>
- <property name="mnemonic_widget">sent_button</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="Custom" id="sent_button">
- <property name="visible">True</property>
- <property name="creation_function">em_account_editor_folder_selector_button_new</property>
- <property name="string1">Select Sent Folder</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 14 Dec 2004 17:07:09 GMT</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="Custom" id="drafts_button">
- <property name="visible">True</property>
- <property name="creation_function">em_account_editor_folder_selector_button_new</property>
- <property name="string1">Select Drafts Folder</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 14 Dec 2004 17:07:02 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="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFixed" id="fixed9">
- <property name="visible">True</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="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFixed" id="fixed8">
- <property name="visible">True</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="GtkHBox" id="hbox216">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkButton" id="default_folders_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-revert-to-saved</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFixed" id="fixed12">
- <property name="visible">True</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">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</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="left_attach">0</property>
- <property name="right_attach">1</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>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="frame2">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label484">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Composing Messages&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox178">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label561">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table18">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="table8">
- <property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkVBox" id="vbox186">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkCheckButton" id="always_cc">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Alway_s carbon-copy (cc) to:</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkHBox" id="hbox210">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label522">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">12</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table32">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox187">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkEntry" id="cc_addrs">
- <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">*</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>
- </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>
- </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="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox188">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkCheckButton" id="always_bcc">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Always _blind carbon-copy (bcc) to:</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkHBox" id="hbox211">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label523">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">12</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table33">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox189">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkEntry" id="bcc_addrs">
- <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">*</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>
- </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>
- </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="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>
- <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>
- </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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox205">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label578">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Message Receipts&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox231">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label581">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox232">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label583">
- <property name="visible">True</property>
- <property name="label" translatable="yes">S_end message receipts:</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">receipt_policy_dropdown</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkComboBox" id="receipt_policy_dropdown">
- <property name="visible">True</property>
- <property name="items" translatable="yes"></property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
- </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">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>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label35">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Defaults</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vboxSecurityBorder">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkVBox" id="pgp_frame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label486">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Pretty Good Privacy (PGP/GPG)&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox179">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label558">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table19">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vboxPGP">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkHBox" id="hbox63">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="pgp_key_id_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">PGP/GPG _Key ID:</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>
- <property name="mnemonic_widget">pgp_key</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="pgp_key">
- <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">*</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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="pgp_always_sign">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Al_ways sign outgoing messages when using this account</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkCheckButton" id="pgp_no_imip_sign">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Do not sign meeting requests (for Outlook compatibility)</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkCheckButton" id="pgp_encrypt_to_self">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Always encrypt to _myself when sending encrypted messages</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">True</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="GtkCheckButton" id="pgp_always_trust">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Always _trust keys in my keyring when encrypting</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="left_attach">0</property>
- <property name="right_attach">1</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>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="smime_vbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label519">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Secure MIME (S/MIME)&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox206">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label559">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="smime_table">
- <property name="visible">True</property>
- <property name="n_rows">6</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkEntry" id="smime_sign_key">
- <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">*</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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="smime_encrypt_key">
- <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">*</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">5</property>
- <property name="bottom_attach">6</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="smime_encrypt_to_self">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Also encrypt to sel_f when sending encrypted messages</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">3</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="smime_encrypt_default">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Encrypt out_going messages (by default)</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">0</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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="smime_sign_default">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Digitally sign o_utgoing messages (by default)</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">0</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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHSeparator" id="hseparator3">
- <property name="visible">True</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_padding">6</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label470">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Encry_ption certificate:</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>
- <property name="mnemonic_widget">smime_encrypt_key</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label469">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Sig_ning certificate:</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>
- <property name="mnemonic_widget">smime_sign_key</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkHBox" id="hbox208">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="smime_encrypt_key_select">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment28">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox175">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image3">
- <property name="visible">True</property>
- <property name="stock">gtk-open</property>
- <property name="icon_size">4</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="button98">
- <property name="visible">True</property>
- <property name="label" translatable="yes">S_elect...</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="smime_encrypt_key_clear">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment35">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox230">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image10">
- <property name="visible">True</property>
- <property name="stock">gtk-clear</property>
- <property name="icon_size">4</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="label577">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Clea_r</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox209">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="smime_sign_key_select">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment29">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox176">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image4">
- <property name="visible">True</property>
- <property name="stock">gtk-open</property>
- <property name="icon_size">4</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="label472">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Select...</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="smime_sign_key_clear">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment34">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox229">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image9">
- <property name="visible">True</property>
- <property name="stock">gtk-clear</property>
- <property name="icon_size">4</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="label576">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Cle_ar</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">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>
- <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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblSecurity">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Security</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkWindow" id="accounts_tab">
- <property name="title" translatable="yes">Email Accounts</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="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
-
- <child>
- <widget class="GtkHBox" id="toplevel">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="Custom" id="etableMailAccounts">
- <property name="visible">True</property>
- <property name="creation_function">em_account_prefs_treeview_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Wed, 29 Oct 2003 17:47:08 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vboxMailFunctions">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkVButtonBox" id="vbuttonboxMailAccounts">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_START</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="cmdAccountAdd">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-add</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="cmdAccountEdit">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment33">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox224">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image8">
- <property name="visible">True</property>
- <property name="stock">gtk-properties</property>
- <property name="icon_size">4</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="label557">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Edit</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="cmdAccountDelete">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-delete</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="cmdAccountDefault">
- <property name="width_request">89</property>
- <property name="height_request">36</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">De_fault</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </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">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkWindow" id="preferences_tab">
- <property name="title" translatable="yes">Mail Preferences</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="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
-
- <child>
- <widget class="GtkNotebook" id="preferences_toplevel">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="show_tabs">True</property>
- <property name="show_border">True</property>
- <property name="tab_pos">GTK_POS_TOP</property>
- <property name="scrollable">True</property>
- <property name="enable_popup">False</property>
-
- <child>
- <widget class="GtkVBox" id="vboxGeneral">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkVBox" id="FontsFrame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label492">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Message Fonts&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox182">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label540">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table22">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vboxMessageFonts">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkCheckButton" id="radFontUseSame">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Use the same fonts as other applications</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkTable" id="tblScreen">
- <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">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="lblScreenVariable">
- <property name="visible">True</property>
- <property name="label" translatable="yes">S_tandard Font:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</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">FontVariable</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkFontButton" id="FontFixed">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="title" translatable="yes">Select HTML fixed width font</property>
- <property name="show_style">True</property>
- <property name="show_size">True</property>
- <property name="use_font">False</property>
- <property name="use_size">False</property>
- <property name="focus_on_click">True</property>
- <signal name="font_set" handler="changed"/>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFontButton" id="FontVariable">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="title" translatable="yes">Select HTML variable width font</property>
- <property name="show_style">True</property>
- <property name="show_size">True</property>
- <property name="use_font">False</property>
- <property name="use_size">False</property>
- <property name="focus_on_click">True</property>
- <signal name="font_set" handler="changed"/>
- </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>
-
- <child>
- <widget class="GtkLabel" id="label444">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Fix_ed width Font:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_RIGHT</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">FontFixed</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
- <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">1</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>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="MessageDisplayFrame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label494">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Message Display&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox183">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label541">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table23">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vboxMessageDisplay">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkHBox" id="hboxReadTimeout">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkCheckButton" id="chkMarkTimeout">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Mark messages as read after</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkSpinButton" id="spinMarkTimeout">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">1</property>
- <property name="numeric">True</property>
- <property name="update_policy">GTK_UPDATE_IF_VALID</property>
- <property name="snap_to_ticks">False</property>
- <property name="wrap">False</property>
- <property name="adjustment">1.5 0 10 1 1 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="lblSeconds">
- <property name="visible">True</property>
- <property name="label" translatable="yes">seconds</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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="hbox234">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">4</property>
-
- <child>
- <widget class="GtkCheckButton" id="mlimit_checkbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Do not format messages when text si_ze exceeds</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkSpinButton" id="mlimit_spin">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">False</property>
- <property name="update_policy">GTK_UPDATE_ALWAYS</property>
- <property name="snap_to_ticks">False</property>
- <property name="wrap">False</property>
- <property name="adjustment">0 0 30000 1 10 0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label585">
- <property name="visible">True</property>
- <property name="label" translatable="yes">KB</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox233">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkCheckButton" id="address_checkbox">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Shrink To / Cc / Bcc headers to </property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkSpinButton" id="address_spin">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">False</property>
- <property name="update_policy">GTK_UPDATE_ALWAYS</property>
- <property name="snap_to_ticks">False</property>
- <property name="wrap">False</property>
- <property name="adjustment">5 1 100 1 10 0</property>
- </widget>
- <packing>
- <property name="padding">2</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label584">
- <property name="visible">True</property>
- <property name="label" translatable="yes">addresses</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">2</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>
-
- <child>
- <widget class="GtkCheckButton" id="magic_spacebar_checkbox">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Enable Magic S_pacebar</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkHBox" id="hboxHighlightColor">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkCheckButton" id="chkHighlightCitations">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Highlight _quotations with</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">True</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="GtkColorButton" id="colorButtonHighlightCitations">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="use_alpha">False</property>
- <property name="title" translatable="yes">Pick a color</property>
- <property name="focus_on_click">True</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="lblColor">
- <property name="visible">True</property>
- <property name="label" translatable="yes">color</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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="hboxDefaultCharset">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="lblDefaultCharset">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Default character e_ncoding:</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">omenuCharset</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkOptionMenu" id="omenuCharset">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget26">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget27">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Baltic (ISO-8859-13)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget28">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Baltic (ISO-8859-4)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </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="hboxEnableSearchFolders">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkCheckButton" id="chkEnableSearchFolders">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Enable Sea_rch Folders</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">True</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="GtkLabel" id="lblEnableSFRestart">
- <property name="visible">True</property>
- <property name="label" translatable="yes">(Note: Requires restart of the application)</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
- </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>
- </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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="DeleteMailFrame">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label496">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Delete Mail&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox184">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label542">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table24">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vboxDeletingMail">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkHBox" id="hbox220">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">4</property>
-
- <child>
- <widget class="GtkCheckButton" id="chkEmptyTrashOnExit">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Empty trash folders on e_xit</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkComboBox" id="comboboxEmptyTrashDays">
- <property name="visible">True</property>
- <property name="items" translatable="yes">a
-b</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">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="GtkCheckButton" id="chkConfirmExpunge">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Confirm _when expunging a folder</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="left_attach">0</property>
- <property name="right_attach">1</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>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblGeneral">
- <property name="visible">True</property>
- <property name="label" translatable="yes">General</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vboxHtmlMail">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label530">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;General&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox215">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label538">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox173">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkCheckButton" id="chkShowAnimatedImages">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes" comments="If enabled, show animation; if disabled, only display a static image without any animation">_Show image animations</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkCheckButton" id="chkPromptWantHTML">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Prompt on sending HTML mail to contacts that do not want them</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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">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>
-
- <child>
- <widget class="GtkVBox" id="vboxLoadingImages">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label500">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Loading Images&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox186">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label539">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox190">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkRadioButton" id="radImagesNever">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Never load images from the Internet</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="radImagesSometimes">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Load images in messages from contacts</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radImagesNever</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="radImagesAlways">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Always load images from the Internet</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radImagesNever</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblHtmlMail">
- <property name="visible">True</property>
- <property name="label" translatable="yes">HTML Messages</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="frameColours">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label502">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Labels&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox187">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label537">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox242">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkVBox" id="vbox209">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow50">
- <property name="visible">True</property>
- <property name="can_focus">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="labelTree">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">True</property>
- <property name="rules_hint">False</property>
- <property name="reorderable">False</property>
- <property name="enable_search">True</property>
- <property name="fixed_height_mode">False</property>
- <property name="hover_selection">False</property>
- <property name="hover_expand">False</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="GtkLabel" id="label589">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Note: Underscore in the label name is used as mnemonic identifier in menu.</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">10</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="vbox208">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkButton" id="labelAdd">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-add</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">False</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="labelEdit">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-edit</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="labelRemove">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-remove</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="padding">6</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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblColours">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Labels</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vboxHeaderTab">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox206">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">3</property>
-
- <child>
- <widget class="GtkHBox" id="hbox238">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label587">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Sender Photograph&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox206">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox239">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkCheckButton" id="photo_show">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Show the photograph of sender in the message preview</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">10</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>
-
- <child>
- <widget class="GtkHBox" id="hbox240">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkCheckButton" id="photo_local">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">S_earch for sender photograph only in local address books</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">10</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="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>
-
- <child>
- <widget class="GtkLabel" id="label524">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Displayed Message _Headers&lt;/span&gt;</property>
- <property name="use_underline">True</property>
- <property name="use_markup">True</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>
- <property name="mnemonic_widget">txtHeaders</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox212">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label536">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox199">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkEntry" id="txtHeaders">
- <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">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow49">
- <property name="visible">True</property>
- <property name="can_focus">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="treeHeaders">
- <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>
- <property name="fixed_height_mode">False</property>
- <property name="hover_selection">False</property>
- <property name="hover_expand">False</property>
- <accessibility>
- <atkproperty name="AtkObject::accessible_name" translatable="yes">Mail Headers Table</atkproperty>
- </accessibility>
- </widget>
- </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>
-
- <child>
- <widget class="GtkVBox" id="vbox200">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="cmdHeadersAdd">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-add</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="cmdHeadersRemove">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-remove</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">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">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>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblHeaders">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Headers</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox161">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox192">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label526">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;General&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table34">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="n_rows">9</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">3</property>
- <property name="column_spacing">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox235">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label586">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Default junk plugin:</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">default_junk_plugin</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">6</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="Custom" id="default_junk_plugin">
- <property name="visible">True</property>
- <property name="creation_function">create_combo_text_widget</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 23 Mar 2007 09:28:55 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- <property name="x_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="chkCheckIncomingMail">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">Checks incoming mail messages to be Junk</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Check incoming _messages for junk</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</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">4</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox236">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">3</property>
-
- <child>
- <widget class="GtkImage" id="plugin_image">
- <property name="visible">True</property>
- <property name="icon_size">4</property>
- <property name="icon_name">gtk-info</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="plugin_status">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
- <property name="x_padding">15</property>
- <property name="x_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox237">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">4</property>
-
- <child>
- <widget class="GtkCheckButton" id="junk_empty_check">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Delete junk messages on e_xit</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkComboBox" id="junk_empty_combobox">
- <property name="visible">True</property>
- <property name="items" translatable="yes">a
-b</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">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="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">4</property>
- <property name="x_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="junk_header_check">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Check cu_stom headers for junk</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</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">4</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox243">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow51">
- <property name="visible">True</property>
- <property name="can_focus">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="junk_header_tree">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">True</property>
- <property name="rules_hint">False</property>
- <property name="reorderable">False</property>
- <property name="enable_search">True</property>
- <property name="fixed_height_mode">False</property>
- <property name="hover_selection">False</property>
- <property name="hover_expand">False</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="GtkVButtonBox" id="vbuttonbox26">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkButton" id="junk_header_add">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-add</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="junk_header_remove">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-remove</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </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">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_padding">22</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="lookup_book">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Do not mar_k messages as junk if sender is in my address book</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</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">4</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="junk_lookup_local_only">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Lookup in local address book only</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_padding">25</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox244">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkImage" id="image11">
- <property name="visible">True</property>
- <property name="stock">gtk-info</property>
- <property name="icon_size">4</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">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label590">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Option is ignored if a match for custom junk headers is found.</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</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>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox195">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">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="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label473">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Junk</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkWindow" id="composer_tab">
- <property name="title" translatable="yes">Message Composer</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="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
-
- <child>
- <widget class="GtkNotebook" id="composer_toplevel">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="show_tabs">True</property>
- <property name="show_border">True</property>
- <property name="tab_pos">GTK_POS_TOP</property>
- <property name="scrollable">False</property>
- <property name="enable_popup">False</property>
-
- <child>
- <widget class="GtkVBox" id="vboxGeneral">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">18</property>
-
- <child>
- <widget class="GtkVBox" id="frameBehavior">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label504">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Default Behavior&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox189">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label505">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">12</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table28">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vboxBehavior">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child>
- <widget class="GtkCheckButton" id="chkSendHTML">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Format messages in _HTML</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkCheckButton" id="chkAutoSmileys">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Automatically insert _emoticon images</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkCheckButton" id="chkRequestReceipt">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Always request rea_d receipt</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkCheckButton" id="chkReplyStartBottom">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Start _typing at the bottom on replying</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkCheckButton" id="chkOutlookFilenames">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Encode file names in an Outlook/GMail way</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkTable" id="tableForwardsReplies">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="lblReplyStyle">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Reply style:</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkAlignment" id="alignment25">
- <property name="visible">True</property>
- <property name="xalign">7.45058015283e-09</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">1</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hboxReplyStyle">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkComboBox" id="comboboxReplyStyle">
- <property name="visible">True</property>
- <property name="items" translatable="yes">Attachment
-Inline (Outlook style)
-Quoted
-Do not quote</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
- </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">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hboxForwardStyle">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkComboBox" id="comboboxForwardStyle">
- <property name="visible">True</property>
- <property name="items" translatable="yes">Attachment
+Click "Apply" to save your settings.</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkWindow" id="account_editor">
+ <property name="title" translatable="yes">Account Editor</property>
+ <child>
+ <widget class="GtkNotebook" id="account_editor_notebook">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">12</property>
+ <child>
+ <widget class="GtkVBox" id="vboxIdentityBorder">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkVBox" id="management_frame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label470">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Account Information&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox172">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label568">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table12">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="account_vbox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="management_description_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Type the name by which you would like to refer to this account.
+For example: "Work" or "Personal"</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hboxIdentityName">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="management_name_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Name:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">right</property>
+ <property name="mnemonic_widget">management_name</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="management_name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="identity_required_frame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label464">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Required Information&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox170">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label569">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table10">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkTable" id="identity_required_table">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkEntry" id="identity_address">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <accessibility>
+ <atkrelation type="labelled-by" target="identity_address_label"/>
+ <atkrelation type="labelled-by" target="label464"/>
+ </accessibility>
+ </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"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="identity_address_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Email _Address:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">identity_address</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="identity_full_name_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Full Nam_e:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">identity_full_name</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="identity_full_name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <accessibility>
+ <atkrelation type="labelled-by" target="label464"/>
+ <atkrelation type="labelled-by" target="identity_full_name_label"/>
+ </accessibility>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="identity_optional_frame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label466">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Optional Information&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox171">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label570">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="identity_optional_table">
+ <property name="visible">True</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="sigLabel">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Signat_ure:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">signature_dropdown</property>
+ </widget>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox169">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="Custom" id="signature_dropdown">
+ <property name="visible">True</property>
+ <property name="creation_function">em_account_editor_dropdown_new</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="sigAddNew">
+ <property name="label" translatable="yes">Add Ne_w Signature...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="sigAddNewClicked"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </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="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="identity_organization">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <accessibility>
+ <atkrelation type="labelled-by" target="identity_organization_label"/>
+ <atkrelation type="labelled-by" target="label466"/>
+ </accessibility>
+ </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"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="identity_organization_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Or_ganization:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">identity_organization</property>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="identity_reply_to">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <accessibility>
+ <atkrelation type="labelled-by" target="label466"/>
+ <atkrelation type="labelled-by" target="reply_to_label"/>
+ </accessibility>
+ </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"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="reply_to_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Re_ply-To:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">identity_reply_to</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="management_default">
+ <property name="label" translatable="yes">_Make this my default account</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label31">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Identity</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vboxSourceBorder">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkVBox" id="source_vbox">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkTable" id="source_type_table">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="source_type_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Server _Type: </property>
+ <property name="use_underline">True</property>
+ <property name="justify">right</property>
+ <property name="mnemonic_widget">source_type_dropdown</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label442">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Description:</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="source_description">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">description</property>
+ <property name="wrap">True</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="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Custom" id="source_type_dropdown">
+ <property name="visible">True</property>
+ <property name="creation_function">em_account_editor_dropdown_new</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator2">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="source_frame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label472">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Configuration&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox173">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label565">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table13">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkTable" id="table4">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="source_host_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Server:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">source_host</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="source_user_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">User_name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">source_user</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="source_host">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="source_user">
+ <property name="visible">True</property>
+ <property name="can_focus">True</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"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="source_path_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Path:</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFileChooserButton" id="source_path_entry">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Mailbox location</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"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="source_security_frame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label515">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Security&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ <property name="mnemonic_widget">source_auth_dropdown</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox201">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label567">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox181">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkHBox" id="source_ssl_hbox">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="lblSourceUseSSL">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Use Secure Connection:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">source_use_ssl</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Custom" id="source_use_ssl">
+ <property name="visible">True</property>
+ <property name="creation_function">em_account_editor_ssl_selector_new</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="source_ssl_disabled">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-warning</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label514">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;b&gt;SSL is not supported in this build of Evolution&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="source_auth_frame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label474">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;_Authentication Type&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">source_auth_dropdown</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox174">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label566">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox179">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkHBox" id="hbox199">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="Custom" id="source_auth_dropdown">
+ <property name="visible">True</property>
+ <property name="creation_function">em_account_editor_dropdown_new</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="source_check_supported">
+ <property name="label" translatable="yes"> Ch_eck for Supported Types </property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="source_remember_password">
+ <property name="label" translatable="yes">Re_member password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip" translatable="yes">Note: you will not be prompted for a password until you connect for the first time</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label33">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Receiving Email</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vboxTransportBorder">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkVBox" id="transport_vbox">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkTable" id="transport_type_table">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="transport_type_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Server _Type: </property>
+ <property name="use_underline">True</property>
+ <property name="justify">right</property>
+ <property name="mnemonic_widget">transport_type_dropdown</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label50">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Description:</property>
+ <property name="justify">right</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Custom" id="transport_type_dropdown">
+ <property name="visible">True</property>
+ <property name="creation_function">em_account_editor_dropdown_new</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="transport_description">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">description</property>
+ <property name="wrap">True</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="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator3">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="transport_frame">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkVBox" id="transport_server_frame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label476">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Server Configuration&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox175">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label562">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table15">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vbox12">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkTable" id="table6">
+ <property name="visible">True</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="transport_host_label">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Server:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">right</property>
+ <property name="mnemonic_widget">transport_host</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="transport_host">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="transport_needs_auth">
+ <property name="label" translatable="yes">Ser_ver requires authentication</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="transport_security_frame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label517">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Security&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox203">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label564">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox183">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkHBox" id="transport_ssl_hbox">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="lblTransportUseSSL">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Use Secure Connection:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">transport_use_ssl</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Custom" id="transport_use_ssl">
+ <property name="visible">True</property>
+ <property name="creation_function">em_account_editor_ssl_selector_new</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="transport_ssl_disabled">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-warning</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="transport_ssl_disabled_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;b&gt;SSL is not supported in this build of Evolution&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="transport_auth_frame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label478">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Authentication&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox176">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label563">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table16">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vbox61">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkTable" id="table31">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="transport_auth_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">T_ype: </property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">transport_auth_dropdown</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="transport_user_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">User_name:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">right</property>
+ <property name="mnemonic_widget">transport_user</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="transport_user">
+ <property name="visible">True</property>
+ <property name="can_focus">True</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"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox195">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="Custom" id="transport_auth_dropdown">
+ <property name="visible">True</property>
+ <property name="creation_function">em_account_editor_dropdown_new</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="transport_check_supported">
+ <property name="label" translatable="yes">Ch_eck for Supported Types </property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFixed" id="fixed5">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="transport_remember_password">
+ <property name="label" translatable="yes">Remember _password</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label34">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Sending Mail</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vboxFoldersBorder">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkVBox" id="folders_frame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label482">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Sent and Draft Messages&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox177">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label560">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table17">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vbox184">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkTable" id="folders_table">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="drafts_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Drafts _Folder:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">drafts_button</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="sent_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Sent _Messages Folder:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">sent_button</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Custom" id="sent_button">
+ <property name="visible">True</property>
+ <property name="creation_function">em_account_editor_folder_selector_button_new</property>
+ <property name="string1">Select Sent Folder</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Custom" id="drafts_button">
+ <property name="visible">True</property>
+ <property name="creation_function">em_account_editor_folder_selector_button_new</property>
+ <property name="string1">Select Drafts Folder</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFixed" id="fixed9">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFixed" id="fixed8">
+ <property name="visible">True</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">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox216">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkButton" id="default_folders_button">
+ <property name="label">gtk-revert-to-saved</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFixed" id="fixed12">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </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>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="frame2">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label484">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Composing Messages&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox178">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label561">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table18">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkTable" id="table8">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkVBox" id="vbox186">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="always_cc">
+ <property name="label" translatable="yes">Alway_s carbon-copy (cc) to:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox210">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label522">
+ <property name="visible">True</property>
+ <property name="xpad">12</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table32">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vbox187">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkEntry" id="cc_addrs">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox188">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="always_bcc">
+ <property name="label" translatable="yes">Always _blind carbon-copy (bcc) to:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox211">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label523">
+ <property name="visible">True</property>
+ <property name="xpad">12</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table33">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vbox189">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkEntry" id="bcc_addrs">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox205">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label578">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Message Receipts&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox231">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label581">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox232">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label583">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">S_end message receipts:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">receipt_policy_dropdown</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="receipt_policy_dropdown">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes"></property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label35">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Defaults</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vboxSecurityBorder">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkVBox" id="pgp_frame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label486">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Pretty Good Privacy (PGP/GPG)&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox179">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label558">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table19">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vboxPGP">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkHBox" id="hbox63">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="pgp_key_id_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">PGP/GPG _Key ID:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">pgp_key</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="pgp_key">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="pgp_always_sign">
+ <property name="label" translatable="yes">Al_ways sign outgoing messages when using this account</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="pgp_no_imip_sign">
+ <property name="label" translatable="yes">_Do not sign meeting requests (for Outlook compatibility)</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="pgp_encrypt_to_self">
+ <property name="label" translatable="yes">Always encrypt to _myself when sending encrypted messages</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="pgp_always_trust">
+ <property name="label" translatable="yes">Always _trust keys in my keyring when encrypting</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="smime_vbox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label519">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Secure MIME (S/MIME)&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox206">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label559">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="smime_table">
+ <property name="visible">True</property>
+ <property name="n_rows">6</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkEntry" id="smime_sign_key">
+ <property name="visible">True</property>
+ <property name="can_focus">True</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"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="smime_encrypt_key">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="smime_encrypt_to_self">
+ <property name="label" translatable="yes">Also encrypt to sel_f when sending encrypted messages</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="right_attach">3</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="smime_encrypt_default">
+ <property name="label" translatable="yes">Encrypt out_going messages (by default)</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="right_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="smime_sign_default">
+ <property name="label" translatable="yes">Digitally sign o_utgoing messages (by default)</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator1">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ <property name="y_padding">6</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Encry_ption certificate:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">smime_encrypt_key</property>
+ </widget>
+ <packing>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label469">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Sig_ning certificate:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">smime_sign_key</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox208">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkButton" id="smime_encrypt_key_select">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment28">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-open</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="button98">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">S_elect...</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="smime_encrypt_key_clear">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment35">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox230">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image10">
+ <property name="visible">True</property>
+ <property name="stock">gtk-clear</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label577">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Clea_r</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox209">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkButton" id="smime_sign_key_select">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment29">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-open</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Select...</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="smime_sign_key_clear">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment34">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox229">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image9">
+ <property name="visible">True</property>
+ <property name="stock">gtk-clear</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label576">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Cle_ar</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </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">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblSecurity">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Security</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="position">4</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkWindow" id="preferences_tab">
+ <property name="title" translatable="yes">Mail Preferences</property>
+ <child>
+ <widget class="GtkNotebook" id="preferences_toplevel">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="scrollable">True</property>
+ <child>
+ <widget class="GtkVBox" id="vboxGeneral">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkVBox" id="FontsFrame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label492">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Message Fonts&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox182">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label540">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table22">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vboxMessageFonts">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="radFontUseSame">
+ <property name="label" translatable="yes">_Use the same fonts as other applications</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="tblScreen">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="lblScreenVariable">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">S_tandard Font:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">right</property>
+ <property name="mnemonic_widget">FontVariable</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFontButton" id="FontFixed">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="title" translatable="yes">Select HTML fixed width font</property>
+ <signal name="font_set" handler="changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFontButton" id="FontVariable">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="title" translatable="yes">Select HTML variable width font</property>
+ <signal name="font_set" handler="changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label444">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Fix_ed width Font:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">right</property>
+ <property name="mnemonic_widget">FontFixed</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="MessageDisplayFrame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label494">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Message Display&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox183">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label541">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table23">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vboxMessageDisplay">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkHBox" id="hboxReadTimeout">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="chkMarkTimeout">
+ <property name="label" translatable="yes">_Mark messages as read after</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spinMarkTimeout">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">1.5 0 10 1 1 0</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">if-valid</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblSeconds">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">seconds</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox234">
+ <property name="visible">True</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkCheckButton" id="mlimit_checkbutton">
+ <property name="label" translatable="yes">Do not format messages when text si_ze exceeds</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="mlimit_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">0 0 30000 1 10 0</property>
+ <property name="climb_rate">1</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label585">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">KB</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox233">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkCheckButton" id="address_checkbox">
+ <property name="label" translatable="yes">_Shrink To / Cc / Bcc headers to </property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="address_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">5 1 100 1 10 0</property>
+ <property name="climb_rate">1</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">2</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label584">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">addresses</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">2</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="magic_spacebar_checkbox">
+ <property name="label" translatable="yes">Enable Magic S_pacebar</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hboxHighlightColor">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="chkHighlightCitations">
+ <property name="label" translatable="yes">Highlight _quotations with</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkColorButton" id="colorButtonHighlightCitations">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="title" translatable="yes">Pick a color</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblColor">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">color</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hboxDefaultCharset">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="lblDefaultCharset">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Default character e_ncoding:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">omenuCharset</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkOptionMenu" id="omenuCharset">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hboxEnableSearchFolders">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="chkEnableSearchFolders">
+ <property name="label" translatable="yes">Enable Sea_rch Folders</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblEnableSFRestart">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">(Note: Requires restart of the application)</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="DeleteMailFrame">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label496">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Delete Mail&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox184">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label542">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table24">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vboxDeletingMail">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkHBox" id="hbox220">
+ <property name="visible">True</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkCheckButton" id="chkEmptyTrashOnExit">
+ <property name="label" translatable="yes">Empty trash folders on e_xit</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkOptionMenu" id="omenuEmptyTrashDays">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="chkConfirmExpunge">
+ <property name="label" translatable="yes">Confirm _when expunging a folder</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblGeneral">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">General</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vboxHtmlMail">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label530">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;General&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox215">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label538">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox173">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="chkShowAnimatedImages">
+ <property name="label" translatable="yes" comments="If enabled, show animation; if disabled, only display a static image without any animation">_Show image animations</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="chkPromptWantHTML">
+ <property name="label" translatable="yes">_Prompt on sending HTML mail to contacts that do not want them</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vboxLoadingImages">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label500">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Loading Images&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox186">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label539">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox190">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkRadioButton" id="radImagesNever">
+ <property name="label" translatable="yes">_Never load images from the Internet</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radImagesSometimes">
+ <property name="label" translatable="yes">_Load images in messages from contacts</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radImagesNever</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radImagesAlways">
+ <property name="label" translatable="yes">_Always load images from the Internet</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radImagesNever</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblHtmlMail">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">HTML Messages</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="frameColours">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label502">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Labels&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="labels-alignment">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblColours">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Labels</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vboxHeaderTab">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkVBox" id="vbox206">
+ <property name="visible">True</property>
+ <property name="spacing">3</property>
+ <child>
+ <widget class="GtkHBox" id="hbox238">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label587">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Sender Photograph&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkHBox" id="hbox239">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkCheckButton" id="photo_show">
+ <property name="label" translatable="yes">_Show the photograph of sender in the message preview</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">10</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox240">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkCheckButton" id="photo_local">
+ <property name="label" translatable="yes">S_earch for sender photograph only in local address books</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">10</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label524">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Displayed Message _Headers&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtHeaders</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox212">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label536">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox199">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkEntry" id="txtHeaders">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow49">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <widget class="GtkTreeView" id="treeHeaders">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <accessibility>
+ <atkproperty name="AtkObject::accessible-name" translatable="yes">Mail Headers Table</atkproperty>
+ </accessibility>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox200">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkButton" id="cmdHeadersAdd">
+ <property name="label">gtk-add</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="cmdHeadersRemove">
+ <property name="label">gtk-remove</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblHeaders">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Headers</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox161">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkVBox" id="vbox192">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label526">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;General&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table34">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="n_rows">9</property>
+ <property name="row_spacing">3</property>
+ <child>
+ <widget class="GtkHBox" id="hbox235">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label586">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Default junk plugin:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">default_junk_plugin</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">6</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Custom" id="default_junk_plugin">
+ <property name="visible">True</property>
+ <property name="creation_function">create_combo_text_widget</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="chkCheckIncomingMail">
+ <property name="label" translatable="yes">Check incoming _messages for junk</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip" translatable="yes">Checks incoming mail messages to be Junk</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ <property name="x_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox236">
+ <property name="visible">True</property>
+ <property name="spacing">3</property>
+ <child>
+ <widget class="GtkImage" id="plugin_image">
+ <property name="visible">True</property>
+ <property name="icon_name">gtk-info</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="plugin_status">
+ <property name="visible">True</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="x_padding">15</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox237">
+ <property name="visible">True</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkCheckButton" id="junk_empty_check">
+ <property name="label" translatable="yes">Delete junk messages on e_xit</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkOptionMenu" id="junk_empty_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="x_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="junk_header_check">
+ <property name="label" translatable="yes">Check cu_stom headers for junk</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ <property name="x_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox243">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow51">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <widget class="GtkTreeView" id="junk_header_tree">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVButtonBox" id="vbuttonbox26">
+ <property name="visible">True</property>
+ <property name="layout_style">spread</property>
+ <child>
+ <widget class="GtkButton" id="junk_header_add">
+ <property name="label">gtk-add</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="junk_header_remove">
+ <property name="label">gtk-remove</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_padding">22</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="lookup_book">
+ <property name="label" translatable="yes">Do not mar_k messages as junk if sender is in my address book</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ <property name="x_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="junk_lookup_local_only">
+ <property name="label" translatable="yes">_Lookup in local address book only</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ <property name="x_padding">25</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox244">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkImage" id="image11">
+ <property name="visible">True</property>
+ <property name="stock">gtk-info</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label590">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Option is ignored if a match for custom junk headers is found.</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox195">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label473">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Junk</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="position">4</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkWindow" id="composer_tab">
+ <property name="title" translatable="yes">Message Composer</property>
+ <child>
+ <widget class="GtkNotebook" id="composer_toplevel">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <widget class="GtkVBox" id="vboxGeneral1">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">18</property>
+ <child>
+ <widget class="GtkVBox" id="frameBehavior">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label504">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Default Behavior&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox189">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label505">
+ <property name="visible">True</property>
+ <property name="xpad">12</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table28">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vboxBehavior">
+ <property name="visible">True</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkCheckButton" id="chkSendHTML">
+ <property name="label" translatable="yes">Format messages in _HTML</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="chkAutoSmileys">
+ <property name="label" translatable="yes">Automatically insert _emoticon images</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="chkRequestReceipt">
+ <property name="label" translatable="yes">Always request rea_d receipt</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="chkReplyStartBottom">
+ <property name="label" translatable="yes">Start _typing at the bottom on replying</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="chkOutlookFilenames">
+ <property name="label" translatable="yes">Encode file names in an Outlook/GMail way</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="tableForwardsReplies">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="lblReplyStyle">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Reply style:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkOptionMenu" id="omenuCharset1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_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="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblForwardStyle">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Forward style:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblCharset">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">C_haracter set:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">omenuCharset1</property>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="comboboxForwardStyle">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Attachment
Inline
Quoted</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">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="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>
-
- <child>
- <widget class="GtkOptionMenu" id="omenuCharset1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget41">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget42">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Baltic (ISO-8859-13)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkMenuItem" id="convertwidget43">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Baltic (ISO-8859-4)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </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="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblForwardStyle">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Forward style:</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="lblCharset">
- <property name="visible">True</property>
- <property name="label" translatable="yes">C_haracter set:</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">omenuCharset1</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox241">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkVBox" id="vbox207">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child>
- <widget class="GtkLabel" id="label588">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Top Posting Option&lt;/b&gt; (Not Recommended)</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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.479999989271</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</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="chkTopSignature">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Keep Signature above the original message on replying</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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>
- <placeholder/>
- </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="left_attach">0</property>
- <property name="right_attach">1</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>
-
- <child>
- <widget class="GtkLabel" id="label506">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Alerts&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox190">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label507">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">12</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table29">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vboxAlerts">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkCheckButton" id="chkPromptEmptySubject">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Prompt when sending messages with an empty subject line</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkCheckButton" id="chkPromptBccOnly">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Pr_ompt when sending messages with only Bcc recipients defined</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="left_attach">0</property>
- <property name="right_attach">1</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">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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblGeneral">
- <property name="visible">True</property>
- <property name="label" translatable="yes">General</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vboxSignatures">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkVBox" id="vbox201">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label548">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Sig_natures&lt;/b&gt;</property>
- <property name="use_underline">True</property>
- <property name="use_markup">True</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>
- <property name="mnemonic_widget">listSignatures</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hboxSignatures">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label550">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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="label549">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow46">
- <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="listSignatures">
- <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>
- <property name="fixed_height_mode">False</property>
- <property name="hover_selection">False</property>
- <property name="hover_expand">False</property>
- <accessibility>
- <atkproperty name="AtkObject::accessible_name" translatable="yes">Signatures Table</atkproperty>
- </accessibility>
- </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="vboxSignatureButtons">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">3</property>
-
- <child>
- <widget class="GtkVButtonBox" id="vbuttonbox25">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_START</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="cmdSignatureAdd">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-add</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="cmdSignatureAddScript">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <signal name="clicked" handler="cmdSignatureAddScriptClicked"/>
-
- <child>
- <widget class="GtkAlignment" id="alignment32">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox223">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image7">
- <property name="visible">True</property>
- <property name="stock">gtk-execute</property>
- <property name="icon_size">4</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="label554">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Add _Script</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="cmdSignatureEdit">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment31">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox222">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image6">
- <property name="visible">True</property>
- <property name="stock">gtk-properties</property>
- <property name="icon_size">4</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="label553">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Edit</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="cmdSignatureDelete">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-remove</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </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">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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox202">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label551">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Preview&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox162">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label552">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolled-sig">
- <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>
- <placeholder/>
- </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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblSignatures">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Signatures</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vboxSpellChecking">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkVBox" id="vbox196">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label534">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;_Languages&lt;/b&gt;</property>
- <property name="use_underline">True</property>
- <property name="use_markup">True</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>
- <property name="mnemonic_widget">listSpellCheckLanguage</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox218">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label555">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox197">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox178">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkHBox" id="hbox192">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkHBox" id="hboxLanguages">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow48">
- <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="listSpellCheckLanguage">
- <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>
- <property name="fixed_height_mode">False</property>
- <property name="hover_selection">False</property>
- <property name="hover_expand">False</property>
- <accessibility>
- <atkproperty name="AtkObject::accessible_name" translatable="yes">Languages Table</atkproperty>
- </accessibility>
- </widget>
- </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>
-
- <child>
- <widget class="GtkHBox" id="hboxImageAndHelp">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkImage" id="pixmapSpellInfo">
- <property name="visible">True</property>
- <property name="stock">gtk-dialog-info</property>
- <property name="icon_size">4</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0</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">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblSpellChecking">
- <property name="visible">True</property>
- <property name="label" translatable="yes">The list of languages here reflects only the languages for which you have a dictionary installed.</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </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">False</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>
- <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>
-
- <child>
- <widget class="GtkVBox" id="frameSpellChecking">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label508">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Options&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox191">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label556">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vboxOptions">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkCheckButton" id="chkEnableSpellChecking">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Check spelling while I _type</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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="GtkHBox" id="hboxSpellCheckColor">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="lblSpellCheckColor">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Color for _misspelled words:</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">colorButtonSpellCheckColor</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkColorButton" id="colorButtonSpellCheckColor">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="use_alpha">False</property>
- <property name="title" translatable="yes">Pick a color</property>
- <property name="focus_on_click">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">False</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>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label450">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Spell Checking</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkWindow" id="font_tab">
- <property name="title" translatable="yes">Font Properties</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="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
-
- <child>
- <widget class="GtkVBox" id="toplevel">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <placeholder/>
- </child>
-
- <child>
- <widget class="GtkVBox" id="frame4">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label512">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Printed Fonts&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox194">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label513">
- <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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">12</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="tblPrint">
- <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">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="lblPrintVariable">
- <property name="visible">True</property>
- <property name="label" translatable="yes">V_ariable-width:</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">print_variable</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="lblPrintFixed">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Fi_xed-width:</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">print_fixed</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkFontButton" id="print_fixed">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="title" translatable="yes">Select HTML fixed width font for printing</property>
- <property name="show_style">True</property>
- <property name="show_size">True</property>
- <property name="use_font">False</property>
- <property name="use_size">False</property>
- <property name="focus_on_click">True</property>
- <signal name="font_set" handler="changed"/>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFontButton" id="print_variable">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="title" translatable="yes">Select HTML variable width font for printing</property>
- <property name="show_style">True</property>
- <property name="show_size">True</property>
- <property name="use_font">False</property>
- <property name="use_size">False</property>
- <property name="focus_on_click">True</property>
- <signal name="font_set" handler="changed"/>
- </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="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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkDialog" id="add_script_signature">
- <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="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
- <property name="has_separator">False</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</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="button_add_script_add">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">0</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment30">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox221">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image5">
- <property name="visible">True</property>
- <property name="stock">gtk-add</property>
- <property name="icon_size">4</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="label547">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Add Signature</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button_add_script_cancel">
- <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="focus_on_click">True</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="GtkVBox" id="vbox160">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkVBox" id="vbox_add_script_signature">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkHBox" id="hboxImageAndHelp">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkImage" id="pixmap1">
- <property name="visible">True</property>
- <property name="stock">gtk-dialog-info</property>
- <property name="icon_size">6</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label456">
- <property name="visible">True</property>
- <property name="label" translatable="yes">The output of this script will be used as your
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="comboboxReplyStyle">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Attachment
+Inline (Outlook style)
+Quoted
+Do Not Quote</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>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox241">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vbox207">
+ <property name="visible">True</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkLabel" id="label588">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.47999998927116394</property>
+ <property name="label" translatable="yes">&lt;b&gt;Top Posting Option&lt;/b&gt; (Not Recommended)</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="chkTopSignature">
+ <property name="label" translatable="yes">_Keep Signature above the original message on replying</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label506">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Alerts&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox190">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label507">
+ <property name="visible">True</property>
+ <property name="xpad">12</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table29">
+ <property name="visible">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vboxAlerts">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="chkPromptEmptySubject">
+ <property name="label" translatable="yes">_Prompt when sending messages with an empty subject line</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="chkPromptBccOnly">
+ <property name="label" translatable="yes">Pr_ompt when sending messages with only Bcc recipients defined</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblGeneral1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">General</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vboxSignatures">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkVBox" id="vbox201">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label548">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;b&gt;Sig_natures&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignSignatures">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox202">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label551">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;b&gt;Preview&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox162">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label552">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolled-sig">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblSignatures">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Signatures</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vboxSpellChecking">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkVBox" id="vbox196">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label534">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;b&gt;_Languages&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">listSpellCheckLanguage</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox218">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label555">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox197">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkVBox" id="vbox178">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkHBox" id="hbox192">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkHBox" id="hboxLanguages">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow48">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <widget class="GtkTreeView" id="listSpellCheckLanguage">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <accessibility>
+ <atkproperty name="AtkObject::accessible-name" translatable="yes">Languages Table</atkproperty>
+ </accessibility>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hboxImageAndHelp">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkImage" id="pixmapSpellInfo">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ <property name="stock">gtk-dialog-info</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblSpellChecking">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">The list of languages here reflects only the languages for which you have a dictionary installed.</property>
+ <property name="wrap">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="frameSpellChecking">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label508">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Options&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox191">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkLabel" id="label556">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vboxOptions">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="chkEnableSpellChecking">
+ <property name="label" translatable="yes">Check spelling while I _type</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hboxSpellCheckColor">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="lblSpellCheckColor">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Color for _misspelled words:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">colorButtonSpellCheckColor</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkColorButton" id="colorButtonSpellCheckColor">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="title" translatable="yes">Pick a color</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label450">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Spell Checking</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkWindow" id="font_tab">
+ <property name="title" translatable="yes">Font Properties</property>
+ <child>
+ <widget class="GtkVBox" id="toplevel1">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="frame4">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label512">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Printed Fonts&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox194">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label513">
+ <property name="visible">True</property>
+ <property name="xpad">12</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="tblPrint">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="lblPrintVariable">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">V_ariable-width:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">print_variable</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblPrintFixed">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Fi_xed-width:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">print_fixed</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFontButton" id="print_fixed">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="title" translatable="yes">Select HTML fixed width font for printing</property>
+ <signal name="font_set" handler="changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFontButton" id="print_variable">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="title" translatable="yes">Select HTML variable width font for printing</property>
+ <signal name="font_set" handler="changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkDialog" id="add_script_signature">
+ <property name="type_hint">normal</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkVBox" id="vbox160">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkVBox" id="vbox_add_script_signature">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkHBox" id="hboxImageAndHelp1">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkImage" id="pixmap1">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ <property name="stock">gtk-dialog-info</property>
+ <property name="icon-size">6</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label456">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">The output of this script will be used as your
signature. The name you specify will be used
for display purposes only. </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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="tblNameScript">
- <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">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label459">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Name:</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_add_script_name</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="label460">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Script:</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">filechooserbutton_add_script</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkEntry" id="entry_add_script_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">*</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">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFileChooserButton" id="filechooserbutton_add_script">
- <property name="visible">True</property>
- <property name="title" translatable="yes"></property>
- <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
- <property name="local_only">True</property>
- <property name="show_hidden">False</property>
- <property name="do_overwrite_confirmation">False</property>
- <property name="width_chars">-1</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <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">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>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkWindow" id="network_prefs_tab">
- <property name="visible">True</property>
- <property name="title" translatable="yes">window1</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="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
-
- <child>
- <widget class="GtkNotebook" id="network_preferences_toplevel">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="show_tabs">True</property>
- <property name="show_border">True</property>
- <property name="tab_pos">GTK_POS_TOP</property>
- <property name="scrollable">False</property>
- <property name="enable_popup">False</property>
-
- <child>
- <widget class="GtkVBox" id="vboxGeneral">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">18</property>
-
- <child>
- <widget class="GtkVBox" id="frameProxy">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label76">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Proxy Settings&lt;/span&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vboxProxy">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child>
- <widget class="GtkRadioButton" id="rdoSysSettings">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Use system defaults</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="rdoNoProxy">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Direct connection to the Internet</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">rdoSysSettings</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="rdoManualProxy">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Manual proxy configuration:</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">rdoSysSettings</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkAlignment" id="alignment27">
- <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>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">24</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkVBox" id="vbox18">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="table8">
- <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>
-
- <child>
- <widget class="GtkLabel" id="lblHttpHost">
- <property name="visible">True</property>
- <property name="label" translatable="yes">H_TTP Proxy:</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>
- <property name="mnemonic_widget">txtHttpHost</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="lblHttpsHost">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Secure HTTP Proxy:</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>
- <property name="mnemonic_widget">txtHttpsHost</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="lblIgnoreHosts">
- <property name="visible">True</property>
- <property name="label" translatable="yes">No _Proxy for:</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>
- <property name="mnemonic_widget">txtIgnoreHosts</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="txtHttpHost">
- <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">*</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">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="txtHttpsHost">
- <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">*</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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblHttpPort">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Port:</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblHttpsPort">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Port:</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkSpinButton" id="spnHttpPort">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">False</property>
- <property name="update_policy">GTK_UPDATE_ALWAYS</property>
- <property name="snap_to_ticks">False</property>
- <property name="wrap">False</property>
- <property name="adjustment">0 0 65535 1 10 0</property>
- </widget>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkSpinButton" id="spnHttpsPort">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">False</property>
- <property name="update_policy">GTK_UPDATE_ALWAYS</property>
- <property name="snap_to_ticks">False</property>
- <property name="wrap">False</property>
- <property name="adjustment">0 0 65535 1 10 0</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="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="txtIgnoreHosts">
- <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">*</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">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options"></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="GtkCheckButton" id="chkUseAuth">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Use Authe_ntication</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</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">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkAlignment" id="alignment26">
- <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>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">24</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkTable" id="table11">
- <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">6</property>
-
- <child>
- <widget class="GtkLabel" id="lblAuthUser">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Us_ername:</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>
- <property name="mnemonic_widget">txtAuthUser</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkLabel" id="lblAuthPwd">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Pass_word:</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>
- <property name="mnemonic_widget">txtAuthPwd</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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>
-
- <child>
- <widget class="GtkEntry" id="txtAuthUser">
- <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">*</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">0</property>
- <property name="bottom_attach">1</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="txtAuthPwd">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">False</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</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>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
- </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="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="lblGeneral">
- <property name="visible">True</property>
- <property name="label" translatable="yes">General</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
+ <property name="wrap">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="tblNameScript">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label459">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Name:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">entry_add_script_name</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label460">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Script:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">filechooserbutton_add_script</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="entry_add_script_name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFileChooserButton" id="filechooserbutton_add_script">
+ <property name="visible">True</property>
+ <property name="title" translatable="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_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <widget class="GtkButton" id="button_add_script_add">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment30">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox221">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="stock">gtk-add</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label547">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Add Signature</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_add_script_cancel">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkWindow" id="network_prefs_tab">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">window1</property>
+ <child>
+ <widget class="GtkNotebook" id="network_preferences_toplevel">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <widget class="GtkVBox" id="vboxGeneral2">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">18</property>
+ <child>
+ <widget class="GtkVBox" id="frameProxy">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label76">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;span weight="bold"&gt;Proxy Settings&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vboxProxy">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkRadioButton" id="rdoSysSettings">
+ <property name="label" translatable="yes">_Use system defaults</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="rdoNoProxy">
+ <property name="label" translatable="yes">_Direct connection to the Internet</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">rdoSysSettings</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="rdoManualProxy">
+ <property name="label" translatable="yes">_Manual proxy configuration:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">rdoSysSettings</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment27">
+ <property name="visible">True</property>
+ <property name="left_padding">24</property>
+ <child>
+ <widget class="GtkVBox" id="vbox18">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">4</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="lblHttpHost">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">H_TTP Proxy:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtHttpHost</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblHttpsHost">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Secure HTTP Proxy:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtHttpsHost</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblSocksHost">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">S_OCKS Host:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtSocksHost</property>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblIgnoreHosts">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">No _Proxy for:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtIgnoreHosts</property>
+ </widget>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="txtHttpHost">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="txtHttpsHost">
+ <property name="visible">True</property>
+ <property name="can_focus">True</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"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="txtSocksHost">
+ <property name="visible">True</property>
+ <property name="can_focus">True</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"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblHttpPort">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Port:</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblHttpsPort">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Port:</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">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblSocksPort">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Port:</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">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spnHttpPort">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">0 0 65535 1 10 0</property>
+ <property name="climb_rate">1</property>
+ </widget>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spnHttpsPort">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">0 0 65535 1 10 0</property>
+ <property name="climb_rate">1</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="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spnSocksPort">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">0 0 65535 1 10 0</property>
+ <property name="climb_rate">1</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="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="txtIgnoreHosts">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="chkUseAuth">
+ <property name="label" translatable="yes">Use Authe_ntication</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment26">
+ <property name="visible">True</property>
+ <property name="left_padding">24</property>
+ <child>
+ <widget class="GtkTable" id="table11">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">3</property>
+ <child>
+ <widget class="GtkLabel" id="lblAuthUser">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Us_ername:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtAuthUser</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblAuthPwd">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Pass_word:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtAuthPwd</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="txtAuthUser">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="txtAuthPwd">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="visibility">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>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="rdoAutoConfig">
+ <property name="label" translatable="yes">_Automatic proxy configuration URL:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">rdoSysSettings</property>
+ </widget>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment36">
+ <property name="visible">True</property>
+ <property name="left_padding">24</property>
+ <child>
+ <widget class="GtkEntry" id="txtAutoConfigUrl">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lblGeneral2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">General</property>
+ </widget>
+ <packing>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
</glade-interface>
diff --git a/mail/mail-config.h b/mail/mail-config.h
index aea5c5da94..87628dcfcb 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -23,10 +23,9 @@
#ifndef MAIL_CONFIG_H
#define MAIL_CONFIG_H
-#include <glib.h>
#include <glib-object.h>
-
-#include "camel/camel-provider.h" /* can't forward-declare enums, bah */
+#include <camel/camel-folder.h>
+#include <camel/camel-provider.h>
struct _EAccount;
struct _EAccountList;
@@ -38,21 +37,7 @@ struct _ESignatureList;
struct _GConfClient;
struct _GtkWindow;
-struct _CamelFolder;
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-typedef struct _MailConfigSignature {
- int id;
- char *name;
- char *filename;
- char *script;
- gboolean html;
-} MailConfigSignature;
-
+G_BEGIN_DECLS
typedef enum {
MAIL_CONFIG_HTTP_NEVER,
@@ -96,61 +81,27 @@ void mail_config_write_on_exit (void);
struct _GConfClient *mail_config_get_gconf_client (void);
/* General Accessor functions */
-gboolean mail_config_is_configured (void);
-gboolean mail_config_is_corrupt (void);
-
-GSList *mail_config_get_labels (void);
-
const char **mail_config_get_allowable_mime_types (void);
void mail_config_service_set_save_passwd (struct _EAccountService *service, gboolean save_passwd);
/* accounts */
-gboolean mail_config_find_account (struct _EAccount *account);
-struct _EAccount *mail_config_get_default_account (void);
-struct _EAccount *mail_config_get_account_by_name (const char *account_name);
-struct _EAccount *mail_config_get_account_by_uid (const char *uid);
struct _EAccount *mail_config_get_account_by_source_url (const char *url);
struct _EAccount *mail_config_get_account_by_transport_url (const char *url);
-struct _EAccountList *mail_config_get_accounts (void);
-void mail_config_add_account (struct _EAccount *account);
-void mail_config_remove_account (struct _EAccount *account);
-void mail_config_set_default_account (struct _EAccount *account);
int mail_config_get_address_count (void);
int mail_config_get_message_limit (void);
gboolean mail_config_get_enable_magic_spacebar (void);
-void mail_config_remove_account_proxies (struct _EAccount *account);
-void mail_config_prune_proxies (void);
-int mail_config_has_proxies (struct _EAccount *account);
-
-struct _EAccountIdentity *mail_config_get_default_identity (void);
struct _EAccountService *mail_config_get_default_transport (void);
-void mail_config_save_accounts (void);
-
-/* signatures */
-struct _ESignature *mail_config_signature_new (const char *filename, gboolean script, gboolean html);
-struct _ESignature *mail_config_get_signature_by_uid (const char *uid);
-struct _ESignature *mail_config_get_signature_by_name (const char *name);
-
-struct _ESignatureList *mail_config_get_signatures (void);
-void mail_config_add_signature (struct _ESignature *signature);
-void mail_config_remove_signature (struct _ESignature *signature);
-
-void mail_config_save_signatures (void);
-
-char *mail_config_signature_run_script (const char *script);
-
-
/* uri's got changed by the store, etc */
void mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new);
void mail_config_uri_deleted (GCompareFunc uri_cmp, const char *uri);
/* static utility functions */
-char *mail_config_folder_to_cachename (struct _CamelFolder *folder, const char *prefix);
-char *mail_config_folder_to_safe_url (struct _CamelFolder *folder);
+char *mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix);
+char *mail_config_folder_to_safe_url (CamelFolder *folder);
guint mail_config_get_error_timeout (void);
guint mail_config_get_error_level (void);
@@ -160,14 +111,8 @@ void mail_config_reload_junk_headers (void);
gboolean mail_config_get_lookup_book (void);
gboolean mail_config_get_lookup_book_local_only (void);
-gboolean mail_config_scripts_disabled (void);
-
GType evolution_mail_config_get_type (void);
-gboolean evolution_mail_config_factory_init (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* MAIL_CONFIG_H */
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index a84dfcbf74..23b85acc7f 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -39,7 +39,6 @@
#include <libgnome/gnome-sound.h>
#include <glib/gi18n.h>
-#include <bonobo/bonobo-exception.h>
#include <camel/camel-store.h>
#include <camel/camel-folder.h>
#include <camel/camel-vtrash-folder.h>
@@ -50,12 +49,12 @@
#include <libedataserver/e-data-server-util.h>
#include <libedataserver/e-msgport.h>
#include "e-util/e-util.h"
+#include "shell/e-shell.h"
#include "mail-mt.h"
#include "mail-folder-cache.h"
#include "mail-ops.h"
#include "mail-session.h"
-#include "mail-component.h"
#include "mail-tools.h"
/* For notifications of changes */
@@ -110,6 +109,8 @@ struct _folder_update {
};
struct _store_info {
+ EMailShellBackend *mail_shell_backend;
+
GHashTable *folders; /* by full_name */
GHashTable *folders_uri; /* by uri */
@@ -150,14 +151,14 @@ free_update(struct _folder_update *up)
}
static void
-real_flush_updates(void *o, void *event_data, void *data)
+real_flush_updates (EMailShellBackend *mail_shell_backend)
{
- struct _MailComponent *component;
+ EShell *shell;
struct _EMFolderTreeModel *model;
struct _folder_update *up;
- component = mail_component_peek ();
- model = mail_component_peek_tree_model (component);
+ shell = e_shell_backend_get_shell (E_SHELL_BACKEND (mail_shell_backend));
+ model = e_mail_shell_backend_get_folder_tree_model (mail_shell_backend);
LOCK(info_lock);
while ((up = (struct _folder_update *)e_dlist_remhead(&updates))) {
@@ -196,7 +197,9 @@ real_flush_updates(void *o, void *event_data, void *data)
t->name = em_folder_tree_model_get_folder_name (model, up->store, up->full_name);
if (t->new > 0)
- mail_indicate_new_mail (TRUE);
+ e_shell_event (
+ shell, "mail-icon",
+ (gpointer) "mail-unread");
/** @Event: folder.changed
* @Title: Folder changed
@@ -208,6 +211,19 @@ real_flush_updates(void *o, void *event_data, void *data)
e_event_emit((EEvent *)e, "folder.changed", (EEventTarget *)t);
}
+ if (CAMEL_IS_VEE_STORE (up->store) && !up->remove) {
+ /* Normally the vfolder store takes care of the folder_opened event itself,
+ but we add folder to the noting system later, thus we do not know about
+ search folders to update them in a tree, thus ensure their changes will
+ be tracked correctly. */
+ CamelFolder *folder = camel_store_get_folder (up->store, up->full_name, 0, NULL);
+
+ if (folder) {
+ mail_note_folder (folder);
+ camel_object_unref (folder);
+ }
+ }
+
free_update(up);
LOCK(info_lock);
@@ -217,10 +233,13 @@ real_flush_updates(void *o, void *event_data, void *data)
}
static void
-flush_updates(void)
+flush_updates (EMailShellBackend *shell_backend)
{
if (update_id == -1 && !e_dlist_empty(&updates))
- update_id = mail_async_event_emit(mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)real_flush_updates, NULL, NULL, NULL);
+ update_id = mail_async_event_emit (
+ mail_async_event, MAIL_ASYNC_GUI,
+ (MailAsyncFunc) real_flush_updates,
+ shell_backend, NULL, NULL);
}
static void
@@ -233,7 +252,7 @@ unset_folder_info(struct _folder_info *mfi, int delete, int unsub)
if (mfi->folder) {
CamelFolder *folder = mfi->folder;
- camel_object_unhook_event(folder, "folder_changed", folder_changed, NULL);
+ camel_object_unhook_event(folder, "folder_changed", folder_changed, mfi->store_info->mail_shell_backend);
camel_object_unhook_event(folder, "renamed", folder_renamed, NULL);
camel_object_unhook_event(folder, "finalize", folder_finalised, NULL);
}
@@ -250,7 +269,7 @@ unset_folder_info(struct _folder_info *mfi, int delete, int unsub)
up->uri = g_strdup(mfi->uri);
e_dlist_addtail(&updates, (EDListNode *)up);
- flush_updates();
+ flush_updates(mfi->store_info->mail_shell_backend);
}
}
@@ -288,21 +307,32 @@ static void
update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info)
{
struct _folder_update *up;
+ EMailShellBackend *mail_shell_backend;
CamelFolder *folder;
+ CamelFolder *local_drafts;
+ CamelFolder *local_outbox;
+ CamelFolder *local_sent;
int unread = -1;
int deleted;
+ mail_shell_backend = mfi->store_info->mail_shell_backend;
+ local_drafts = e_mail_shell_backend_get_folder (
+ mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
+ local_outbox = e_mail_shell_backend_get_folder (
+ mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
+ local_sent = e_mail_shell_backend_get_folder (
+ mail_shell_backend, E_MAIL_FOLDER_SENT);
+
folder = mfi->folder;
if (folder) {
d(printf("update 1 folder '%s'\n", folder->full_name));
if ((count_trash && (CAMEL_IS_VTRASH_FOLDER (folder)))
- || folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX)
- || folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS)
- || (count_sent && folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT))) {
+ || folder == local_drafts
+ || folder == local_outbox
+ || (count_sent && folder == local_sent)) {
d(printf(" total count\n"));
unread = camel_folder_get_message_count (folder);
- if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX)
- || folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS)) {
+ if (folder == local_drafts || folder == local_outbox) {
guint32 junked = 0;
if ((deleted = camel_folder_get_deleted_message_count (folder)) > 0)
@@ -336,7 +366,7 @@ update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info)
up->uri = g_strdup(mfi->uri);
camel_object_ref(up->store);
e_dlist_addtail(&updates, (EDListNode *)up);
- flush_updates();
+ flush_updates(mail_shell_backend);
}
static void
@@ -370,7 +400,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si)
up->add = TRUE;
e_dlist_addtail(&updates, (EDListNode *)up);
- flush_updates();
+ flush_updates(si->mail_shell_backend);
}
}
@@ -393,8 +423,12 @@ static void
folder_changed (CamelObject *o, gpointer event_data, gpointer user_data)
{
static time_t last_newmail = 0;
+ EMailShellBackend *mail_shell_backend = user_data;
CamelFolderChangeInfo *changes = event_data;
CamelFolder *folder = (CamelFolder *)o;
+ CamelFolder *local_drafts;
+ CamelFolder *local_outbox;
+ CamelFolder *local_sent;
CamelStore *store = folder->parent_store;
CamelMessageInfo *info;
struct _store_info *si;
@@ -405,10 +439,17 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data)
d(printf("folder '%s' changed\n", folder->full_name));
+ local_drafts = e_mail_shell_backend_get_folder (
+ mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
+ local_outbox = e_mail_shell_backend_get_folder (
+ mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
+ local_sent = e_mail_shell_backend_get_folder (
+ mail_shell_backend, E_MAIL_FOLDER_SENT);
+
if (!CAMEL_IS_VEE_FOLDER(folder)
- && folder != mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX)
- && folder != mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS)
- && folder != mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT)
+ && folder != local_drafts
+ && folder != local_outbox
+ && folder != local_sent
&& changes && (changes->uid_added->len > 0)) {
/* for each added message, check to see that it is
brand new, not junk and not already deleted */
@@ -500,7 +541,7 @@ void mail_note_folder(CamelFolder *folder)
UNLOCK(info_lock);
- camel_object_hook_event(folder, "folder_changed", folder_changed, NULL);
+ camel_object_hook_event(folder, "folder_changed", folder_changed, si->mail_shell_backend);
camel_object_hook_event(folder, "renamed", folder_renamed, NULL);
camel_object_hook_event(folder, "finalize", folder_finalised, NULL);
}
@@ -593,9 +634,11 @@ folder_to_url(CamelStore *store, const char *full_name)
static void
rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, CamelFolderInfo *fi)
{
+ EShellBackend *shell_backend;
char *old, *olduri, *oldfile, *newuri, *newfile;
struct _folder_info *mfi;
struct _folder_update *up;
+ const gchar *config_dir;
up = g_malloc0(sizeof(*up));
@@ -642,7 +685,7 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase,
up->add = TRUE;
e_dlist_addtail(&updates, (EDListNode *)up);
- flush_updates();
+ flush_updates(si->mail_shell_backend);
#if 0
if (fi->sibling)
rename_folders(si, oldbase, newbase, fi->sibling, folders);
@@ -651,17 +694,19 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase,
#endif
/* rename the meta-data we maintain ourselves */
+ shell_backend = E_SHELL_BACKEND (si->mail_shell_backend);
+ config_dir = e_shell_backend_get_config_dir (shell_backend);
olduri = folder_to_url(si->store, old);
e_filename_make_safe(olduri);
newuri = folder_to_url(si->store, fi->full_name);
e_filename_make_safe(newuri);
- oldfile = g_strdup_printf("%s/config/custom_view-%s.xml", mail_component_peek_base_directory(NULL), olduri);
- newfile = g_strdup_printf("%s/config/custom_view-%s.xml", mail_component_peek_base_directory(NULL), newuri);
+ oldfile = g_strdup_printf("%s/custom_view-%s.xml", config_dir, olduri);
+ newfile = g_strdup_printf("%s/custom_view-%s.xml", config_dir, newuri);
g_rename(oldfile, newfile);
g_free(oldfile);
g_free(newfile);
- oldfile = g_strdup_printf("%s/config/current_view-%s.xml", mail_component_peek_base_directory(NULL), olduri);
- newfile = g_strdup_printf("%s/config/current_view-%s.xml", mail_component_peek_base_directory(NULL), newuri);
+ oldfile = g_strdup_printf("%s/current_view-%s.xml", config_dir, olduri);
+ newfile = g_strdup_printf("%s/current_view-%s.xml", config_dir, newuri);
g_rename(oldfile, newfile);
g_free(oldfile);
g_free(newfile);
@@ -765,6 +810,8 @@ mail_note_store_remove(CamelStore *store)
if (si) {
g_hash_table_remove(stores, store);
+ g_object_unref(si->mail_shell_backend);
+
camel_object_unhook_event(store, "folder_opened", store_folder_opened, NULL);
camel_object_unhook_event(store, "folder_created", store_folder_created, NULL);
camel_object_unhook_event(store, "folder_deleted", store_folder_deleted, NULL);
@@ -917,7 +964,7 @@ store_online_cb (CamelStore *store, void *data)
}
void
-mail_note_store(CamelStore *store, CamelOperation *op,
+mail_note_store(EMailShellBackend *mail_shell_backend, CamelStore *store, CamelOperation *op,
gboolean (*done)(CamelStore *store, CamelFolderInfo *info, void *data), void *data)
{
struct _store_info *si;
@@ -926,6 +973,7 @@ mail_note_store(CamelStore *store, CamelOperation *op,
guint timeout;
int hook = 0;
+ g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend));
g_return_if_fail (CAMEL_IS_STORE(store));
g_return_if_fail (mail_in_main_thread());
@@ -945,6 +993,7 @@ mail_note_store(CamelStore *store, CamelOperation *op,
d(printf("Noting a new store: %p: %s\n", store, camel_url_to_string(((CamelService *)store)->url, 0)));
si = g_malloc0(sizeof(*si));
+ si->mail_shell_backend = g_object_ref (mail_shell_backend);
si->folders = g_hash_table_new(g_str_hash, g_str_equal);
si->folders_uri = g_hash_table_new(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->hash_folder_name,
CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name);
@@ -1054,7 +1103,7 @@ mail_folder_cache_get_folder_info_flags (CamelFolder *folder, int *flags)
if (stores == NULL)
return FALSE;
- fi.url = camel_url_new(uri, NULL);
+ fi.url = camel_url_new (uri, NULL);
LOCK(info_lock);
g_hash_table_foreach(stores, (GHFunc)storeinfo_find_folder_info, &fi);
diff --git a/mail/mail-folder-cache.h b/mail/mail-folder-cache.h
index 932f5c3f78..d7bd82dbaf 100644
--- a/mail/mail-folder-cache.h
+++ b/mail/mail-folder-cache.h
@@ -28,12 +28,14 @@
#include <camel/camel-store.h>
+#include "e-mail-shell-backend.h"
+
/* Add a store whose folders should appear in the shell
The folders are scanned from the store, and/or added at
runtime via the folder_created event.
The 'done' function returns if we can free folder info. */
void
-mail_note_store (CamelStore *store, CamelOperation *op,
+mail_note_store (EMailShellBackend *mail_shell_backend, CamelStore *store, CamelOperation *op,
gboolean (*done) (CamelStore *store, CamelFolderInfo *info, void *data),
void *data);
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index ed7e257fba..90119cc55a 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -37,14 +37,14 @@
#include "misc/e-gui-utils.h"
#include "e-util/e-error.h"
#include "e-util/e-icon-factory.h"
-
-#include "e-activity-handler.h"
+#include "widgets/misc/e-alert-activity.h"
#include "mail-config.h"
-#include "mail-component.h"
#include "mail-session.h"
#include "mail-mt.h"
+#include "e-mail-shell-backend.h"
+
/*#define MALLOC_CHECK*/
#define LOG_OPS
#define LOG_LOCKS
@@ -65,7 +65,7 @@ static void mail_operation_status(struct _CamelOperation *op, const char *what,
struct _MailMsgPrivate {
int activity_state; /* sigh sigh sigh, we need to keep track of the state external to the
pointer itself for locking/race conditions */
- int activity_id;
+ EActivity *activity;
GtkWidget *error;
gboolean cancelable;
};
@@ -140,19 +140,21 @@ mail_msg_new (MailMsgInfo *info)
}
static void
-end_event_callback (CamelObject *o, void *event_data, void *error)
+end_event_callback (CamelObject *o, EActivity *activity, void *error)
{
- MailComponent *component;
- EActivityHandler *activity_handler;
- guint activity_id = GPOINTER_TO_INT (event_data);
-
- component = mail_component_peek ();
- activity_handler = mail_component_peek_activity_handler (component);
- if (!error) {
- e_activity_handler_operation_finished (activity_handler, activity_id);
+ EShellBackend *shell_backend;
+
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
+ if (error == NULL) {
+ e_activity_complete (activity);
+ g_object_unref (activity);
} else {
- d(printf("Yahooooo, we got it nonintrusively\n"));
- e_activity_handler_operation_set_error (activity_handler, activity_id, error);
+ if (activity != NULL)
+ g_object_unref (activity);
+ activity = e_alert_activity_new_warning (error);
+ e_shell_backend_add_activity (shell_backend, activity);
+ g_object_unref (activity);
}
}
@@ -184,6 +186,9 @@ checkmem(void *p)
static void
mail_msg_free (MailMsg *mail_msg)
{
+ if (mail_msg->priv->activity != NULL)
+ g_object_unref (mail_msg->priv->activity);
+
if (mail_msg->cancel != NULL) {
camel_operation_mute (mail_msg->cancel);
camel_operation_unref (mail_msg->cancel);
@@ -210,7 +215,7 @@ void
mail_msg_unref (gpointer msg)
{
MailMsg *mail_msg = msg;
- gint activity_id;
+ EActivity *activity = NULL;
GtkWidget *error = NULL;
g_return_if_fail (mail_msg != NULL);
@@ -254,24 +259,21 @@ mail_msg_unref (gpointer msg)
MAIL_MT_UNLOCK(mail_msg_lock);
return;
} else {
- activity_id = mail_msg->priv->activity_id;
+ activity = mail_msg->priv->activity;
+ if (activity != NULL)
+ g_object_ref (activity);
error = mail_msg->priv->error;
- if (error && !activity_id) {
- e_activity_handler_make_error (mail_component_peek_activity_handler (mail_component_peek ()), "mail", E_LOG_ERROR, error);
- printf("Making error\n");
- }
-
}
MAIL_MT_UNLOCK(mail_msg_lock);
mail_msg_free (mail_msg);
- if (activity_id != 0)
+ if (activity != NULL)
mail_async_event_emit (
mail_async_event, MAIL_ASYNC_GUI,
(MailAsyncFunc) end_event_callback,
- NULL, GINT_TO_POINTER (activity_id), error);
+ NULL, activity, error);
}
/* hash table of ops->dialogue of active errors */
@@ -939,7 +941,7 @@ struct _op_status_msg {
static void
op_status_exec (struct _op_status_msg *m)
{
- EActivityHandler *activity_handler = mail_component_peek_activity_handler (mail_component_peek ());
+ EShellBackend *shell_backend;
MailMsg *msg;
MailMsgPrivate *data;
char *out, *p, *o, c;
@@ -947,6 +949,8 @@ op_status_exec (struct _op_status_msg *m)
g_return_if_fail (mail_in_main_thread ());
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
MAIL_MT_LOCK (mail_msg_lock);
msg = g_hash_table_lookup (mail_msg_active_table, m->data);
@@ -970,7 +974,7 @@ op_status_exec (struct _op_status_msg *m)
pc = m->pc;
- if (data->activity_id == 0) {
+ if (data->activity == NULL) {
char *what;
/* its being created/removed? well leave it be */
@@ -990,28 +994,39 @@ op_status_exec (struct _op_status_msg *m)
what = g_strdup("");
}
- data->activity_id = e_activity_handler_cancelable_operation_started (activity_handler, "evolution-mail", what, TRUE, (void (*) (gpointer)) camel_operation_cancel, msg->cancel);
+ data->activity = e_activity_new (what);
+ e_activity_set_allow_cancel (data->activity, TRUE);
+ e_activity_set_percent (data->activity, 0.0);
+ e_shell_backend_add_activity (shell_backend, data->activity);
+
+ g_signal_connect_swapped (
+ data->activity, "cancelled",
+ G_CALLBACK (camel_operation_cancel),
+ msg->cancel);
g_free (what);
MAIL_MT_LOCK (mail_msg_lock);
if (data->activity_state == 3) {
- int activity_id = data->activity_id;
+ EActivity *activity;
+
+ activity = g_object_ref (data->activity);
MAIL_MT_UNLOCK (mail_msg_lock);
mail_msg_free (msg);
- if (activity_id != 0)
- mail_async_event_emit (mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) end_event_callback,
- NULL, GINT_TO_POINTER (activity_id), NULL);
+ if (activity != 0)
+ mail_async_event_emit (
+ mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) end_event_callback,
+ NULL, activity, NULL);
} else {
data->activity_state = 2;
MAIL_MT_UNLOCK (mail_msg_lock);
}
return;
}
- } else if (data->activity_id != 0) {
+ } else if (data->activity != NULL) {
MAIL_MT_UNLOCK (mail_msg_lock);
- e_activity_handler_operation_progressing (activity_handler, data->activity_id, out, (double)(pc/100.0));
+ e_activity_set_percent (data->activity, pc / 100.0);
} else {
MAIL_MT_UNLOCK (mail_msg_lock);
}
@@ -1064,6 +1079,5 @@ set_stop (int sensitive)
if (last == sensitive)
return;
- /*bonobo_ui_component_set_prop (uic, "/commands/MailStop", "sensitive", sensitive ? "1" : "0", NULL);*/
last = sensitive;
}
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 4f310db812..d1116395b6 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -57,11 +57,11 @@
#include <libedataserver/e-data-server-util.h>
#include "e-util/e-util.h"
+#include "e-util/e-account-utils.h"
#include "e-util/e-util-private.h"
#include "em-filter-rule.h"
#include "em-utils.h"
-#include "mail-component.h"
#include "mail-config.h"
#include "mail-mt.h"
#include "mail-ops.h"
@@ -69,6 +69,8 @@
#include "mail-tools.h"
#include "mail-vfolder.h"
+#include "e-mail-shell-backend.h"
+
#define w(x)
#define d(x)
@@ -244,8 +246,11 @@ static char *
uid_cachename_hack (CamelStore *store)
{
CamelURL *url = CAMEL_SERVICE (store)->url;
+ EShellBackend *shell_backend;
char *encoded_url, *filename;
- const char *evolution_dir;
+ const gchar *data_dir;
+
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
encoded_url = g_strdup_printf ("%s%s%s@%s", url->user,
url->authmech ? ";auth=" : "",
@@ -253,8 +258,8 @@ uid_cachename_hack (CamelStore *store)
url->host);
e_filename_make_safe (encoded_url);
- evolution_dir = mail_component_peek_base_directory (mail_component_peek ());
- filename = g_build_filename (evolution_dir, "pop", encoded_url, "uid-cache", NULL);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ filename = g_build_filename (data_dir, "pop", encoded_url, "uid-cache", NULL);
g_free (encoded_url);
return filename;
@@ -275,9 +280,11 @@ fetch_mail_exec (struct _fetch_mail_msg *m)
if (m->cancel)
camel_operation_register (m->cancel);
- if ((fm->destination = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_LOCAL_INBOX)) == NULL)
+ fm->destination = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_LOCAL_INBOX);
+ if (fm->destination == NULL)
goto fail;
- camel_object_ref(fm->destination);
+ camel_object_ref (fm->destination);
/* FIXME: this should support keep_on_server too, which would then perform a spool
access thingy, right? problem is matching raw messages to uid's etc. */
@@ -473,9 +480,9 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination,
char *name;
name = g_strstrip(g_strdup(tmp));
- if ((account = mail_config_get_account_by_uid(name))
+ if ((account = e_get_account_by_uid (name))
/* 'old' x-evolution-account stored the name, how silly */
- || (account = mail_config_get_account_by_name(name))) {
+ || (account = e_get_account_by_name (name))) {
if (account->transport && account->transport->url)
transport_url = g_strdup (account->transport->url);
@@ -579,7 +586,8 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination,
}
if (!folder) {
- folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT);
+ folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_SENT);
camel_object_ref(folder);
}
@@ -592,7 +600,8 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination,
if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL)
goto exit;
- sent_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT);
+ sent_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_SENT);
if (folder != sent_folder) {
const char *name;
@@ -687,13 +696,16 @@ report_status (struct _send_queue_msg *m, enum camel_filter_status_t status, int
static void
send_queue_exec (struct _send_queue_msg *m)
{
- CamelFolder *sent_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT);
+ CamelFolder *sent_folder;
GPtrArray *uids, *send_uids = NULL;
CamelException ex;
int i, j;
d(printf("sending queue\n"));
+ sent_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_SENT);
+
if (!(uids = camel_folder_get_uids (m->queue)))
return;
@@ -1269,7 +1281,8 @@ struct _get_quota_msg {
CamelFolder *folder;
CamelFolderQuotaInfo *quota;
- void (*done) (CamelFolder *folder, CamelFolderQuotaInfo *quota, void *data);
+ void (*done) (CamelFolder *folder, const gchar *folder_uri, CamelFolderQuotaInfo *quota, void *data);
+ gchar *folder_uri;
void *data;
};
@@ -1289,7 +1302,7 @@ static void
get_quota_done (struct _get_quota_msg *m)
{
if (m->done)
- m->done (m->folder, m->quota, m->data);
+ m->done (m->folder, m->folder_uri, m->quota, m->data);
}
static void
@@ -1299,6 +1312,7 @@ get_quota_free (struct _get_quota_msg *m)
camel_object_unref (m->folder);
if (m->quota)
camel_folder_quota_info_free (m->quota);
+ g_free (m->folder_uri);
}
static MailMsgInfo get_quota_info = {
@@ -1311,7 +1325,8 @@ static MailMsgInfo get_quota_info = {
int
mail_get_folder_quota (CamelFolder *folder,
- void (*done)(CamelFolder *folder, CamelFolderQuotaInfo *quota, void *data),
+ const gchar *folder_uri,
+ void (*done)(CamelFolder *folder, const gchar *uri, CamelFolderQuotaInfo *quota, void *data),
void *data, MailMsgDispatchFunc dispatch)
{
struct _get_quota_msg *m;
@@ -1321,6 +1336,7 @@ mail_get_folder_quota (CamelFolder *folder,
m = mail_msg_new (&get_quota_info);
m->folder = folder;
+ m->folder_uri = g_strdup (folder_uri);
m->data = data;
m->done = done;
@@ -1749,15 +1765,18 @@ empty_trash_desc (struct _empty_trash_msg *m)
static void
empty_trash_exec (struct _empty_trash_msg *m)
{
- const char *evolution_dir;
+ EShellBackend *shell_backend;
+ const gchar *data_dir;
CamelFolder *trash;
char *uri;
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
if (m->account) {
trash = mail_tool_get_trash (m->account->source->url, FALSE, &m->base.ex);
} else {
- evolution_dir = mail_component_peek_base_directory (mail_component_peek ());
- uri = g_strdup_printf ("mbox:%s/local", evolution_dir);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ uri = g_strdup_printf ("mbox:%s/local", data_dir);
trash = mail_tool_get_trash (uri, TRUE, &m->base.ex);
g_free (uri);
}
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index 39905fb06c..55816ca24b 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -74,7 +74,8 @@ int mail_get_folder (const char *uri, guint32 flags,
/* get quota information for a folder */
int mail_get_folder_quota (CamelFolder *folder,
- void (*done)(CamelFolder *folder, CamelFolderQuotaInfo *quota, void *data),
+ const gchar *folder_uri,
+ void (*done)(CamelFolder *folder, const gchar *folder_uri, CamelFolderQuotaInfo *quota, void *data),
void *data, MailMsgDispatchFunc dispatch);
/* and for a store */
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index be834bb0d3..a463bb835b 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -38,7 +38,6 @@
#include "camel/camel-store.h"
#include "mail-mt.h"
-#include "mail-component.h"
#include "mail-config.h"
#include "mail-session.h"
#include "mail-tools.h"
@@ -46,7 +45,12 @@
#include "mail-send-recv.h"
#include "mail-folder-cache.h"
#include "em-event.h"
-#include <e-util/gconf-bridge.h>
+
+#include "shell/e-shell.h"
+#include "e-util/e-account-utils.h"
+#include "e-util/gconf-bridge.h"
+
+#include "e-mail-shell-backend.h"
#define d(x)
@@ -160,7 +164,8 @@ setup_send_data(void)
g_str_hash, g_str_equal,
(GDestroyNotify) NULL,
(GDestroyNotify) free_folder_info);
- data->inbox = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_LOCAL_INBOX);
+ data->inbox = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_LOCAL_INBOX);
camel_object_ref(data->inbox);
data->active = g_hash_table_new_full (
g_str_hash, g_str_equal,
@@ -360,7 +365,10 @@ get_receive_type(const char *url)
}
static struct _send_data *
-build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destination)
+build_dialog (GtkWindow *parent,
+ EAccountList *accounts,
+ CamelFolder *outbox,
+ const gchar *destination)
{
GtkDialog *gd;
GtkWidget *table;
@@ -380,7 +388,10 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati
EIterator *iter;
EMEventTargetSendReceive *target;
- gd = (GtkDialog *)(send_recv_dialog = gtk_dialog_new_with_buttons(_("Send & Receive Mail"), NULL, GTK_DIALOG_NO_SEPARATOR, NULL));
+ send_recv_dialog = gtk_dialog_new_with_buttons (
+ _("Send & Receive Mail"), parent,
+ GTK_DIALOG_NO_SEPARATOR, NULL);
+ gd = GTK_DIALOG (send_recv_dialog);
gtk_window_set_modal ((GtkWindow *) gd, FALSE);
gconf_bridge_bind_window_size (
@@ -679,8 +690,13 @@ receive_done (const gchar *uri, void *data)
/* if we've been called to run again - run again */
if (info->type == SEND_SEND && info->state == SEND_ACTIVE && info->again) {
+ CamelFolder *local_outbox_folder;
+
+ local_outbox_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
+
info->again = 0;
- mail_send_queue (mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX),
+ mail_send_queue (local_outbox_folder,
info->uri,
FILTER_SOURCE_OUTGOING,
info->cancel,
@@ -892,14 +908,14 @@ receive_update_got_store (char *uri, CamelStore *store, void *data)
struct _send_info *info = data;
if (store) {
- mail_note_store(store, info->cancel, receive_update_got_folderinfo, info);
+ mail_note_store(global_mail_shell_backend, store, info->cancel, receive_update_got_folderinfo, info);
} else {
receive_done("", info);
}
}
GtkWidget *
-mail_send_receive (void)
+mail_send_receive (GtkWindow *parent)
{
CamelFolder *outbox_folder;
struct _send_data *data;
@@ -918,14 +934,16 @@ mail_send_receive (void)
if (!camel_session_is_online (session))
return send_recv_dialog;
- account = mail_config_get_default_account ();
+ account = e_get_default_account ();
if (!account || !account->transport->url)
return send_recv_dialog;
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
- outbox_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX);
- data = build_dialog (accounts, outbox_folder, account->transport->url);
+ outbox_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
+ data = build_dialog (
+ parent, accounts, outbox_folder, account->transport->url);
scan = data->infos;
while (scan) {
struct _send_info *info = scan->data;
@@ -1052,16 +1070,16 @@ auto_account_changed(EAccountList *eal, EAccount *ea, void *dummy)
}
static void
-auto_online(CamelObject *o, void *ed, void *d)
+auto_online (EShell *shell)
{
EIterator *iter;
EAccountList *accounts;
struct _auto_data *info;
- if (!GPOINTER_TO_INT(ed))
+ if (!e_shell_get_online (shell))
return;
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
for (iter = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(iter);e_iterator_next(iter)) {
info = g_object_get_data((GObject *)e_iterator_get(iter), "mail-autoreceive");
if (info && info->timeout_id)
@@ -1072,15 +1090,20 @@ auto_online(CamelObject *o, void *ed, void *d)
/* call to setup initial, and after changes are made to the config */
/* FIXME: Need a cleanup funciton for when object is deactivated */
void
-mail_autoreceive_init (CamelSession *session)
+mail_autoreceive_init (EShellBackend *shell_backend,
+ CamelSession *session)
{
EAccountList *accounts;
EIterator *iter;
+ EShell *shell;
+
+ g_return_if_fail (E_IS_SHELL_BACKEND (shell_backend));
+ g_return_if_fail (CAMEL_IS_SESSION (session));
if (auto_active)
return;
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
auto_active = g_hash_table_new(g_str_hash, g_str_equal);
g_signal_connect(accounts, "account-added", G_CALLBACK(auto_account_added), NULL);
@@ -1090,7 +1113,13 @@ mail_autoreceive_init (CamelSession *session)
for (iter = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(iter);e_iterator_next(iter))
auto_account_added(accounts, (EAccount *)e_iterator_get(iter), NULL);
- camel_object_hook_event (session, "online", auto_online, NULL);
+ shell = e_shell_backend_get_shell (shell_backend);
+
+ auto_online (shell);
+
+ g_signal_connect (
+ shell, "notify::online",
+ G_CALLBACK (auto_online), NULL);
}
/* we setup the download info's in a hashtable, if we later need to build the gui, we insert
@@ -1145,7 +1174,8 @@ mail_receive_uri (const gchar *uri, gboolean keep_on_server)
break;
case SEND_SEND:
/* todo, store the folder in info? */
- outbox_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX);
+ outbox_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
mail_send_queue (outbox_folder, info->uri,
FILTER_SOURCE_OUTGOING,
info->cancel,
@@ -1207,7 +1237,8 @@ mail_send (void)
g_hash_table_insert (data->active, (gpointer) SEND_URI_KEY, info);
/* todo, store the folder in info? */
- outbox_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX);
+ outbox_folder = e_mail_shell_backend_get_folder (
+ global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
mail_send_queue (outbox_folder, info->uri,
FILTER_SOURCE_OUTGOING,
info->cancel,
diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h
index a31abe79ed..02be2ce2e0 100644
--- a/mail/mail-send-recv.h
+++ b/mail/mail-send-recv.h
@@ -25,20 +25,22 @@
#include <gtk/gtk.h>
#include <camel/camel-session.h>
+#include <shell/e-shell-backend.h>
G_BEGIN_DECLS
/* send/receive all uri's */
-GtkWidget * mail_send_receive (void);
+GtkWidget * mail_send_receive (GtkWindow *parent);
/* receive a single uri */
-void mail_receive_uri (const gchar *uri,
+void mail_receive_uri (const gchar *uri,
gboolean keep_on_server);
void mail_send (void);
/* setup auto receive stuff */
-void mail_autoreceive_init (CamelSession *session);
+void mail_autoreceive_init (EShellBackend *shell_backend,
+ CamelSession *session);
G_END_DECLS
diff --git a/mail/mail-session.c b/mail/mail-session.c
index d9e34ccff4..bab6a67729 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -42,15 +42,16 @@
#include <camel/camel-filter-driver.h>
#include <camel/camel-i18n.h>
+#include "e-util/e-util.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
#include "e-account-combo-box.h"
+#include "shell/e-shell.h"
#include "em-composer-utils.h"
#include "em-filter-context.h"
#include "em-filter-rule.h"
#include "em-utils.h"
-#include "mail-component.h"
#include "mail-config.h"
#include "mail-mt.h"
#include "mail-ops.h"
@@ -82,6 +83,7 @@ typedef struct _MailSessionClass {
} MailSessionClass;
+static EMailShellBackend *session_mail_shell_backend;
static CamelSessionClass *ms_parent_class;
static char *get_password(CamelSession *session, CamelService *service, const char *domain, const char *prompt, const char *item, guint32 flags, CamelException *ex);
@@ -501,15 +503,19 @@ session_system_beep (CamelFilterDriver *driver, gpointer user_data)
static CamelFilterDriver *
main_get_filter_driver (CamelSession *session, const char *type, CamelException *ex)
{
+ EShellBackend *shell_backend;
CamelFilterDriver *driver;
FilterRule *rule = NULL;
+ const gchar *data_dir;
char *user, *system;
GConfClient *gconf;
RuleContext *fc;
gconf = mail_config_get_gconf_client ();
+ shell_backend = E_SHELL_BACKEND (session_mail_shell_backend);
- user = g_strdup_printf ("%s/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ user = g_build_filename (data_dir, "filters.xml", NULL);
system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL);
fc = (RuleContext *) em_filter_context_new ();
rule_context_load (fc, system, user);
@@ -702,12 +708,22 @@ mail_session_check_junk_notify (GConfClient *gconf, guint id, GConfEntry *entry,
}
void
-mail_session_init (const char *base_directory)
+mail_session_init (EMailShellBackend *mail_shell_backend)
{
- char *camel_dir;
+ EShell *shell;
+ EShellBackend *shell_backend;
GConfClient *gconf;
+ gboolean online;
+ const gchar *data_dir;
- if (camel_init (base_directory, TRUE) != 0)
+ session_mail_shell_backend = mail_shell_backend;
+
+ shell_backend = E_SHELL_BACKEND (mail_shell_backend);
+ shell = e_shell_backend_get_shell (shell_backend);
+ online = e_shell_get_online (shell);
+
+ data_dir = e_get_user_data_dir ();
+ if (camel_init (data_dir, TRUE) != 0)
exit (0);
camel_provider_init();
@@ -716,8 +732,8 @@ mail_session_init (const char *base_directory)
e_account_combo_box_set_session (session); /* XXX Don't ask... */
e_account_writable(NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD); /* Init the EAccount Setup */
- camel_dir = g_strdup_printf ("%s/mail", base_directory);
- camel_session_construct (session, camel_dir);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ camel_session_construct (session, data_dir);
gconf = mail_config_get_gconf_client ();
gconf_client_add_dir (gconf, "/apps/evolution/mail/junk", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
@@ -727,10 +743,8 @@ mail_session_init (const char *base_directory)
session, NULL, NULL);
session->junk_plugin = NULL;
- /* The shell will tell us to go online. */
- camel_session_set_online ((CamelSession *) session, FALSE);
+ camel_session_set_online ((CamelSession *) session, online);
mail_config_reload_junk_headers ();
- g_free (camel_dir);
}
void
@@ -773,13 +787,6 @@ mail_session_set_interactive (gboolean interactive)
}
void
-mail_session_forget_passwords (BonoboUIComponent *uih, void *user_data,
- const char *path)
-{
- e_passwords_forget_passwords ();
-}
-
-void
mail_session_flush_filter_log (void)
{
MailSession *ms = (MailSession *) session;
diff --git a/mail/mail-session.h b/mail/mail-session.h
index 60d6b9ab2a..764ee0f710 100644
--- a/mail/mail-session.h
+++ b/mail/mail-session.h
@@ -24,15 +24,12 @@
#define MAIL_SESSION_H
#include <glib.h>
-#include <bonobo/bonobo-ui-component.h>
#include <camel/camel-session.h>
+#include <mail/e-mail-shell-backend.h>
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+G_BEGIN_DECLS
-void mail_session_init (const char *base_directory);
+void mail_session_init (EMailShellBackend *mail_shell_backend);
void mail_session_shutdown (void);
gboolean mail_session_get_interactive (void);
void mail_session_set_interactive (gboolean interactive);
@@ -42,8 +39,6 @@ gboolean mail_session_accept_dialog (const char *prompt, const char *key,
gboolean async);
char *mail_session_get_password (const char *url);
void mail_session_add_password (const char *url, const char *passwd);
-void mail_session_forget_passwords (BonoboUIComponent *uih, void *user_data,
- const char *path);
void mail_session_remember_password (const char *url);
void mail_session_forget_password (const char *key);
@@ -57,8 +52,6 @@ void mail_session_set_junk_headers (const char **name, const char **value, int l
extern CamelSession *session;
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
-#endif /* ! MAIL_SESSION_H */
+#endif /* MAIL_SESSION_H */
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index a256e7e107..1dc96f702e 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -51,7 +51,6 @@
#include "em-utils.h"
#include "em-vfolder-context.h"
#include "em-vfolder-rule.h"
-#include "mail-component.h"
#include "mail-config.h"
#include "mail-folder-cache.h"
#include "mail-mt.h"
@@ -59,6 +58,8 @@
#include "mail-tools.h"
#include "mail-vfolder.h"
+#include "e-mail-shell-backend.h"
+
/* **************************************** */
CamelFolder *
@@ -106,7 +107,9 @@ mail_tool_get_trash (const gchar *url, int connect, CamelException *ex)
static char *
mail_tool_get_local_movemail_path (const unsigned char *uri, CamelException *ex)
{
+ EShellBackend *shell_backend;
unsigned char *safe_uri, *c;
+ const gchar *data_dir;
char *path, *full;
struct stat st;
@@ -115,7 +118,10 @@ mail_tool_get_local_movemail_path (const unsigned char *uri, CamelException *ex)
if (strchr("/:;=|%&#!*^()\\, ", *c) || !isprint((int) *c))
*c = '_';
- path = g_strdup_printf("%s/spool", mail_component_peek_base_directory(NULL));
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ path = g_build_filename (data_dir, "spool", NULL);
+
if (g_stat(path, &st) == -1 && g_mkdir_with_parents(path, 0777) == -1) {
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create spool directory `%s': %s"),
path, g_strerror(errno));
diff --git a/mail/mail-types.h b/mail/mail-types.h
deleted file mode 100644
index 6acbeaf43a..0000000000
--- a/mail/mail-types.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef MAIL_TYPES_H
-#define MAIL_TYPES_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-
-typedef struct _FolderBrowser FolderBrowser;
-typedef struct _MessageBrowser MessageBrowser;
-typedef struct _SubscribeDialog SubscribeDialog;
-typedef struct _MessageList MessageList;
-typedef struct _MailDisplay MailDisplay;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* MAIL_TYPES_H */
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index aab8625807..6be803b70b 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -31,10 +31,11 @@
#include <camel/camel-vee-folder.h>
#include <camel/camel-vee-store.h>
#include <camel/camel-vtrash-folder.h>
+#include <libedataserver/e-account-list.h>
-#include "libedataserver/e-account-list.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
+#include "e-util/e-account-utils.h"
#include "em-folder-tree-model.h"
#include "em-utils.h"
@@ -42,7 +43,6 @@
#include "em-vfolder-editor.h"
#include "em-vfolder-rule.h"
#include "mail-autofilter.h"
-#include "mail-component.h"
#include "mail-config.h"
#include "mail-folder-cache.h"
#include "mail-mt.h"
@@ -50,6 +50,8 @@
#include "mail-tools.h"
#include "mail-vfolder.h"
+#include "e-mail-shell-backend.h"
+
#define d(x) /* (printf("%s:%s: ", G_STRLOC, G_STRFUNC), (x))*/
static EMVFolderContext *context; /* context remains open all time */
@@ -224,7 +226,7 @@ vfolder_adduri_desc (struct _adduri_msg *m)
else
uid = g_strdup_printf("%s@%s", url->user, url->host);
- account = e_account_list_find(mail_config_get_accounts(), E_ACCOUNT_FIND_UID, uid);
+ account = e_get_account_by_uid (uid);
g_free(uid);
if (account != NULL)
loc = account->name;
@@ -337,21 +339,31 @@ uri_is_ignore(CamelStore *store, const char *uri)
EAccountList *accounts;
EAccount *account;
EIterator *iter;
+ const gchar *local_drafts_folder_uri;
+ const gchar *local_outbox_folder_uri;
+ const gchar *local_sent_folder_uri;
int found = FALSE;
+ local_drafts_folder_uri = e_mail_shell_backend_get_folder_uri (
+ global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS);
+ local_outbox_folder_uri = e_mail_shell_backend_get_folder_uri (
+ global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX);
+ local_sent_folder_uri = e_mail_shell_backend_get_folder_uri (
+ global_mail_shell_backend, E_MAIL_FOLDER_SENT);
+
d(printf("checking '%s' against:\n %s\n %s\n %s\n", uri,
- mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_OUTBOX),
- mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_SENT),
- mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_DRAFTS)));
+ local_outbox_folder_uri,
+ local_sent_folder_uri,
+ local_drafts_folder_uri));
- found = camel_store_folder_uri_equal(store, mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_OUTBOX), uri)
- || camel_store_folder_uri_equal(store, mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_SENT), uri)
- || camel_store_folder_uri_equal(store, mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_DRAFTS), uri);
+ found = camel_store_folder_uri_equal(store, local_outbox_folder_uri, uri)
+ || camel_store_folder_uri_equal(store, local_sent_folder_uri, uri)
+ || camel_store_folder_uri_equal(store, local_drafts_folder_uri, uri);
if (found)
return found;
- accounts = mail_config_get_accounts ();
+ accounts = e_get_account_list ();
iter = e_list_get_iterator ((EList *) accounts);
while (e_iterator_is_valid (iter)) {
char *curi;
@@ -522,6 +534,7 @@ done:
void
mail_vfolder_delete_uri(CamelStore *store, const char *curi)
{
+ EShellBackend *shell_backend;
FilterRule *rule;
const char *source;
CamelVeeFolder *vf;
@@ -538,6 +551,8 @@ mail_vfolder_delete_uri(CamelStore *store, const char *curi)
g_return_if_fail (mail_in_main_thread());
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
changed = g_string_new ("");
LOCK();
@@ -592,13 +607,14 @@ done:
if (changed->str[0]) {
GtkWidget *dialog;
+ const gchar *data_dir;
char *user;
dialog = e_error_new(NULL, "mail:vfolder-updated", changed->str, uri, NULL);
em_utils_show_info_silent (dialog);
- user = g_strdup_printf ("%s/vfolders.xml",
- mail_component_peek_base_directory (mail_component_peek ()));
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ user = g_build_filename (data_dir, "vfolders.xml", NULL);
rule_context_save ((RuleContext *) context, user);
g_free (user);
}
@@ -612,6 +628,7 @@ done:
void
mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto)
{
+ EShellBackend *shell_backend;
FilterRule *rule;
const char *source;
CamelVeeFolder *vf;
@@ -625,6 +642,8 @@ mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto)
g_return_if_fail (mail_in_main_thread());
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
from = em_uri_from_camel(cfrom);
to = em_uri_from_camel(cto);
@@ -661,10 +680,12 @@ mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto)
UNLOCK();
if (changed) {
+ const gchar *data_dir;
char *user;
d(printf("Vfolders updated from renamed folder\n"));
- user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ user = g_build_filename (data_dir, "vfolders.xml", NULL);
rule_context_save((RuleContext *)context, user);
g_free(user);
}
@@ -785,21 +806,12 @@ static void context_rule_added(RuleContext *ctx, FilterRule *rule)
static void context_rule_removed(RuleContext *ctx, FilterRule *rule)
{
- char *path;
-
gpointer key, folder = NULL;
d(printf("rule removed; %s\n", rule->name));
/* TODO: remove from folder info cache? */
- /* FIXME: is this even necessary? if we remove the folder from
- * the CamelStore, the tree should pick it up auto-magically
- * because it listens to CamelStore events... */
- path = g_strdup_printf("/%s", rule->name);
- mail_component_remove_folder (mail_component_peek (), vfolder_store, path);
- g_free(path);
-
LOCK();
if (g_hash_table_lookup_extended (vfolder_hash, rule->name, &key, &folder)) {
g_hash_table_remove (vfolder_hash, key);
@@ -826,6 +838,7 @@ store_folder_created(CamelObject *o, void *event_data, void *data)
static void
store_folder_deleted(CamelObject *o, void *event_data, void *data)
{
+ EShellBackend *shell_backend;
CamelStore *store = (CamelStore *)o;
CamelFolderInfo *info = event_data;
FilterRule *rule;
@@ -834,6 +847,8 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data)
d(printf("Folder deleted: %s\n", info->name));
store = store;
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
/* Warning not thread safe, but might be enough */
LOCK();
@@ -841,6 +856,8 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data)
/* delete it from our list */
rule = rule_context_find_rule((RuleContext *)context, info->full_name, NULL);
if (rule) {
+ const gchar *data_dir;
+
/* We need to stop listening to removed events, otherwise we'll try and remove it again */
g_signal_handlers_disconnect_matched(context, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, 0,
0, NULL, context_rule_removed, context);
@@ -848,7 +865,8 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data)
g_object_unref(rule);
g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context);
- user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ user = g_build_filename (data_dir, "vfolders.xml", NULL);
rule_context_save((RuleContext *)context, user);
g_free(user);
} else {
@@ -861,12 +879,15 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data)
static void
store_folder_renamed(CamelObject *o, void *event_data, void *data)
{
+ EShellBackend *shell_backend;
CamelRenameInfo *info = event_data;
FilterRule *rule;
char *user;
gpointer key, folder;
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
/* This should be more-or-less thread-safe */
d(printf("Folder renamed to '%s' from '%s'\n", info->new->full_name, info->old_base));
@@ -875,6 +896,8 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data)
LOCK();
d(printf("Changing folder name in hash table to '%s'\n", info->new->full_name));
if (g_hash_table_lookup_extended (vfolder_hash, info->old_base, &key, &folder)) {
+ const gchar *data_dir;
+
g_hash_table_remove (vfolder_hash, key);
g_free (key);
g_hash_table_insert (vfolder_hash, g_strdup(info->new->full_name), folder);
@@ -891,7 +914,8 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data)
filter_rule_set_name(rule, info->new->full_name);
g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder);
- user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ user = g_build_filename (data_dir, "vfolders.xml", NULL);
rule_context_save((RuleContext *)context, user);
g_free(user);
@@ -908,11 +932,15 @@ vfolder_load_storage(void)
/* lock for loading storage, it is safe to call it more than once */
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+ EShellBackend *shell_backend;
+ const gchar *data_dir;
char *user, *storeuri;
FilterRule *rule;
char *xmlfile;
GConfClient *gconf;
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
pthread_mutex_lock (&lock);
if (vfolder_hash) {
@@ -926,7 +954,8 @@ vfolder_load_storage(void)
pthread_mutex_unlock (&lock);
/* first, create the vfolder store, and set it up */
- storeuri = g_strdup_printf("vfolder:%s/vfolder", mail_component_peek_base_directory (mail_component_peek ()));
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ storeuri = g_strdup_printf("vfolder:%s/vfolder", data_dir);
vfolder_store = camel_session_get_store(session, storeuri, NULL);
if (vfolder_store == NULL) {
g_warning("Cannot open vfolder store - no vfolders available");
@@ -943,7 +972,7 @@ vfolder_load_storage(void)
d(printf("got store '%s' = %p\n", storeuri, vfolder_store));
/* load our rules */
- user = g_strdup_printf ("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ user = g_build_filename (data_dir, "vfolders.xml", NULL);
context = em_vfolder_context_new ();
xmlfile = g_build_filename (EVOLUTION_PRIVDATADIR, "vfoldertypes.xml", NULL);
@@ -958,7 +987,8 @@ vfolder_load_storage(void)
g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context);
/* load store to mail component */
- mail_component_load_store_by_uri (mail_component_peek (), storeuri, _("Search Folders"));
+ e_mail_shell_backend_load_store_by_uri (
+ global_mail_shell_backend, storeuri, _("Search Folders"));
/* and setup the rules we have */
rule = NULL;
@@ -982,66 +1012,73 @@ vfolder_load_storage(void)
void
vfolder_revert(void)
{
+ EShellBackend *shell_backend;
+ const gchar *data_dir;
char *user;
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
d(printf("vfolder_revert\n"));
- user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ user = g_build_filename (data_dir, "vfolders.xml", NULL);
rule_context_revert((RuleContext *)context, user);
g_free(user);
}
-static GtkWidget *vfolder_editor = NULL;
-
-static void
-em_vfolder_editor_response (GtkWidget *dialog, int button, void *data)
+void
+vfolder_edit (EShellView *shell_view)
{
- char *user;
+ EShellBackend *shell_backend;
+ EShellWindow *shell_window;
+ GtkWidget *dialog;
+ const gchar *data_dir;
+ gchar *filename;
- user = g_strdup_printf ("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
- switch(button) {
- case GTK_RESPONSE_OK:
- rule_context_save((RuleContext *)context, user);
- break;
- default:
- rule_context_revert((RuleContext *)context, user);
- }
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
- vfolder_editor = NULL;
-
- gtk_widget_destroy(dialog);
-
- g_free (user);
-}
-
-void
-vfolder_edit (void)
-{
- if (vfolder_editor) {
- gdk_window_raise (GTK_WIDGET (vfolder_editor)->window);
- return;
- }
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ filename = g_build_filename (data_dir, "vfolders.xml", NULL);
/* ensures vfolder is running */
vfolder_load_storage ();
- vfolder_editor = GTK_WIDGET (em_vfolder_editor_new (context));
- gtk_window_set_title (GTK_WINDOW (vfolder_editor), _("Search Folders"));
- g_signal_connect(vfolder_editor, "response", G_CALLBACK(em_vfolder_editor_response), NULL);
+ dialog = em_vfolder_editor_new (context);
+ gtk_window_set_title (
+ GTK_WINDOW (dialog), _("Search Folders"));
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog), GTK_WINDOW (shell_window));
- gtk_widget_show (vfolder_editor);
+ switch (gtk_dialog_run (GTK_DIALOG (dialog))) {
+ case GTK_RESPONSE_OK:
+ rule_context_save ((RuleContext *) context, filename);
+ break;
+ default:
+ rule_context_revert ((RuleContext *) context, filename);
+ break;
+ }
+
+ gtk_widget_destroy (dialog);
}
static void
edit_rule_response(GtkWidget *w, int button, void *data)
{
+ EShellBackend *shell_backend;
+
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
if (button == GTK_RESPONSE_OK) {
+ const gchar *data_dir;
char *user;
FilterRule *rule = g_object_get_data (G_OBJECT (w), "rule");
FilterRule *orig = g_object_get_data (G_OBJECT (w), "orig");
filter_rule_copy(orig, rule);
- user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ user = g_build_filename (data_dir, "vfolders.xml", NULL);
rule_context_save((RuleContext *)context, user);
g_free(user);
}
@@ -1097,7 +1134,12 @@ vfolder_edit_rule(const char *uri)
static void
new_rule_clicked(GtkWidget *w, int button, void *data)
{
+ EShellBackend *shell_backend;
+
+ shell_backend = E_SHELL_BACKEND (global_mail_shell_backend);
+
if (button == GTK_RESPONSE_OK) {
+ const gchar *data_dir;
char *user;
FilterRule *rule = g_object_get_data((GObject *)w, "rule");
@@ -1114,7 +1156,8 @@ new_rule_clicked(GtkWidget *w, int button, void *data)
g_object_ref(rule);
rule_context_add_rule((RuleContext *)context, rule);
- user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
+ data_dir = e_shell_backend_get_data_dir (shell_backend);
+ user = g_build_filename (data_dir, "vfolders.xml", NULL);
rule_context_save((RuleContext *)context, user);
g_free(user);
}
diff --git a/mail/mail-vfolder.h b/mail/mail-vfolder.h
index 002541371f..1c7ad0d150 100644
--- a/mail/mail-vfolder.h
+++ b/mail/mail-vfolder.h
@@ -22,6 +22,8 @@
#ifndef _MAIL_VFOLDER_H
#define _MAIL_VFOLDER_H
+#include <shell/e-shell-view.h>
+
struct _CamelStore;
struct _FilterPart;
struct _FilterRule;
@@ -32,7 +34,7 @@ struct _CamelInternetAddress;
void vfolder_load_storage(void);
void vfolder_revert(void);
-void vfolder_edit (void);
+void vfolder_edit (EShellView *shell_view);
void vfolder_edit_rule(const char *name);
struct _FilterPart *vfolder_create_part (const char *name);
struct _FilterRule *vfolder_clone_rule (struct _FilterRule *in);
diff --git a/mail/message-list.c b/mail/message-list.c
index 09f080cae0..8d84e4ae8c 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -50,10 +50,12 @@
#include "e-util/e-profile-event.h"
#include "e-util/e-util-private.h"
#include "e-util/e-util.h"
-#include "e-util/e-util-labels.h"
#include "misc/e-gui-utils.h"
+#include "shell/e-shell.h"
+#include "shell/e-shell-settings.h"
+
#include "table/e-cell-checkbox.h"
#include "table/e-cell-hbox.h"
#include "table/e-cell-date.h"
@@ -67,6 +69,7 @@
#include "table/e-cell-vbox.h"
#include "table/e-cell-hbox.h"
+#include "e-mail-label-list-store.h"
#include "em-popup.h"
#include "em-utils.h"
#include "mail-config.h"
@@ -97,6 +100,10 @@
#define d(x)
#define t(x)
+#define MESSAGE_LIST_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), MESSAGE_LIST_TYPE, MessageListPrivate))
+
struct _MLSelection {
GPtrArray *uids;
CamelFolder *folder;
@@ -106,6 +113,8 @@ struct _MLSelection {
struct _MessageListPrivate {
GtkWidget *invisible; /* 4 selection */
+ EShellBackend *shell_backend;
+
struct _MLSelection clipboard;
gboolean destroyed;
@@ -113,6 +122,11 @@ struct _MessageListPrivate {
gboolean any_row_changed; /* save state before regen list when this is set to true */
};
+enum {
+ PROP_0,
+ PROP_SHELL_BACKEND
+};
+
static struct {
const gchar *target;
GdkAtom atom;
@@ -809,7 +823,7 @@ message_list_invert_selection (MessageList *message_list)
void
message_list_copy(MessageList *ml, gboolean cut)
{
- struct _MessageListPrivate *p = ml->priv;
+ MessageListPrivate *p = ml->priv;
GPtrArray *uids;
clear_selection(ml, &p->clipboard);
@@ -1222,52 +1236,123 @@ sanitize_recipients (const gchar *string)
}
static int
-get_all_labels (CamelMessageInfo *msg_info, char **label_str, gboolean get_tags)
-{
+get_all_labels (MessageList *message_list,
+ CamelMessageInfo *msg_info,
+ gchar **label_str,
+ gboolean get_tags)
+{
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EShellSettings *shell_settings;
+ EMailLabelListStore *store;
+ GtkTreeIter iter;
GString *str;
- const char *old_label;
+ const gchar *property_name;
+ const gchar *old_label;
+ gchar *new_label;
int count = 0;
const CamelFlag *flag;
- GSList *labels;
- labels = mail_config_get_labels ();
+ shell_backend = message_list_get_shell_backend (message_list);
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ property_name = "mail-label-list-store";
+ store = e_shell_settings_get_object (shell_settings, property_name);
+
str = g_string_new ("");
for (flag = camel_message_info_user_flags (msg_info); flag; flag = flag->next) {
- const char *name = e_util_labels_get_name (labels, flag->name);
+ gchar *item;
- if (name) {
- if (str->len)
- g_string_append (str, ", ");
+ if (!e_mail_label_list_store_lookup (store, flag->name, &iter))
+ continue;
- if (get_tags)
- name = flag->name;
+ if (get_tags)
+ item = e_mail_label_list_store_get_tag (store, &iter);
+ else
+ item = e_mail_label_list_store_get_name (store, &iter);
- g_string_append (str, name);
- count++;
- }
+ if (str->len)
+ g_string_append (str, ", ");
+
+ g_string_append (str, item);
+ count++;
+
+ g_free (item);
}
- old_label = e_util_labels_get_new_tag (camel_message_info_user_tag (msg_info, "label"));
+ old_label = camel_message_info_user_tag (msg_info, "label");
+ if (old_label == NULL)
+ goto exit;
- if (old_label != NULL) {
- const char *name = NULL;
+ /* Convert old-style labels ("<name>") to "$Label<name>". */
+ new_label = g_alloca (strlen (old_label) + 10);
+ g_stpcpy (g_stpcpy (new_label, "$Label"), old_label);
+
+ if (e_mail_label_list_store_lookup (store, new_label, &iter)) {
+ gchar *name = NULL;
if (str->len)
g_string_append (str, ", ");
if (!get_tags)
- name = e_util_labels_get_name (labels, old_label);
+ name = e_mail_label_list_store_get_name (store, &iter);
g_string_append (str, (get_tags || !name) ? old_label : name);
- ++count;
+ count++;
+
+ g_free (name);
}
+exit:
*label_str = g_string_free (str, FALSE);
+ g_object_unref (store);
+
return count;
}
+static const gchar *
+get_label_color (MessageList *message_list,
+ const gchar *tag)
+{
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EShellSettings *shell_settings;
+ EMailLabelListStore *store;
+ GtkTreeIter iter;
+ GdkColor color;
+ const gchar *property_name;
+ const gchar *interned = NULL;
+ gchar *color_spec;
+
+ /* FIXME get_all_labels() should return an array of tree iterators,
+ * not strings. Now we just have to lookup the tag again. */
+
+ shell_backend = message_list_get_shell_backend (message_list);
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ property_name = "mail-label-list-store";
+ store = e_shell_settings_get_object (shell_settings, property_name);
+
+ if (!e_mail_label_list_store_lookup (store, tag, &iter))
+ goto exit;
+
+ e_mail_label_list_store_get_color (store, &iter, &color);
+
+ /* XXX Hack to avoid returning an allocated string. */
+ color_spec = gdk_color_to_string (&color);
+ interned = g_intern_string (color_spec);
+ g_free (color_spec);
+
+exit:
+ g_object_unref (store);
+
+ return interned;
+}
+
static const char *
get_trimmed_subject (CamelMessageInfo *info)
{
@@ -1469,9 +1554,8 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
completed = camel_message_info_user_tag(msg_info, "completed-on");
followup = camel_message_info_user_tag(msg_info, "follow-up");
if (colour == NULL) {
- if ((n = get_all_labels (msg_info, &labels_string, TRUE)) == 1) {
-
- colour = e_util_labels_get_color_str (mail_config_get_labels (), labels_string);
+ if ((n = get_all_labels (message_list, msg_info, &labels_string, TRUE)) == 1) {
+ colour = get_label_color (message_list, labels_string);
} else if (camel_message_info_flags(msg_info) & CAMEL_MESSAGE_FLAGGED) {
/* FIXME: extract from the important.xpm somehow. */
colour = "#A7453E";
@@ -1550,7 +1634,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
cleansed_str = g_string_new ("");
- if (get_all_labels (msg_info, &str, FALSE)) {
+ if (get_all_labels (message_list, msg_info, &str, FALSE)) {
int i;
for (i = 0; str[i] != '\0'; ++i) {
if (str[i] != '_') {
@@ -1946,7 +2030,7 @@ ml_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint ti
static gboolean
ml_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, MessageList *ml)
{
- struct _MessageListPrivate *p = ml->priv;
+ MessageListPrivate *p = ml->priv;
clear_selection(ml, &p->clipboard);
@@ -2241,13 +2325,25 @@ on_model_row_changed (ETableModel *model, int row, MessageList *ml)
/*
* GObject::init
*/
+
+static void
+message_list_set_shell_backend (MessageList *message_list,
+ EShellBackend *shell_backend)
+{
+ g_return_if_fail (message_list->priv->shell_backend == NULL);
+
+ message_list->priv->shell_backend = g_object_ref (shell_backend);
+}
+
static void
message_list_init (MessageList *message_list)
{
- struct _MessageListPrivate *p;
+ MessageListPrivate *p;
GtkAdjustment *adjustment;
GdkAtom matom;
+ message_list->priv = MESSAGE_LIST_GET_PRIVATE (message_list);
+
adjustment = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, G_MAXDOUBLE, 0.0, 0.0, 0.0);
gtk_scrolled_window_set_vadjustment ((GtkScrolledWindow *) message_list, adjustment);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (message_list), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
@@ -2276,7 +2372,7 @@ message_list_init (MessageList *message_list)
message_list->regen_lock = g_mutex_new ();
/* TODO: Should this only get the selection if we're realised? */
- p = message_list->priv = g_malloc0(sizeof(*message_list->priv));
+ p = message_list->priv;
p->invisible = gtk_invisible_new();
p->destroyed = FALSE;
g_object_ref_sink(p->invisible);
@@ -2297,7 +2393,7 @@ static void
message_list_destroy(GtkObject *object)
{
MessageList *message_list = MESSAGE_LIST (object);
- struct _MessageListPrivate *p = message_list->priv;
+ MessageListPrivate *p = message_list->priv;
p->destroyed = TRUE;
@@ -2349,14 +2445,65 @@ message_list_destroy(GtkObject *object)
message_list->seen_id = 0;
}
+ /* Chain up to parent's destroy() method. */
GTK_OBJECT_CLASS (message_list_parent_class)->destroy(object);
}
static void
-message_list_finalise (GObject *object)
+message_list_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHELL_BACKEND:
+ message_list_set_shell_backend (
+ MESSAGE_LIST (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+message_list_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHELL_BACKEND:
+ g_value_set_object (
+ value, message_list_get_shell_backend (
+ MESSAGE_LIST (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+message_list_dispose (GObject *object)
+{
+ MessageListPrivate *priv;
+
+ priv = MESSAGE_LIST_GET_PRIVATE (object);
+
+ if (priv->shell_backend != NULL) {
+ g_object_unref (priv->shell_backend);
+ priv->shell_backend = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (message_list_parent_class)->dispose (object);
+}
+
+static void
+message_list_finalize (GObject *object)
{
MessageList *message_list = MESSAGE_LIST (object);
- struct _MessageListPrivate *p = message_list->priv;
+ MessageListPrivate *priv = message_list->priv;
g_hash_table_destroy (message_list->normalised_hash);
@@ -2386,10 +2533,9 @@ message_list_finalise (GObject *object)
g_free(message_list->folder_uri);
message_list->folder_uri = NULL;
- clear_selection(message_list, &p->clipboard);
-
- g_free(p);
+ clear_selection(message_list, &priv->clipboard);
+ /* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (message_list_parent_class)->finalize (object);
}
@@ -2397,17 +2543,36 @@ message_list_finalise (GObject *object)
* GObjectClass::init
*/
static void
-message_list_class_init (MessageListClass *message_list_class)
+message_list_class_init (MessageListClass *class)
{
- GObjectClass *object_class = (GObjectClass *) message_list_class;
- GtkObjectClass *gtkobject_class = (GtkObjectClass *) message_list_class;
+ GObjectClass *object_class;
+ GtkObjectClass *gtk_object_class;
int i;
for (i=0;i<sizeof(ml_drag_info)/sizeof(ml_drag_info[0]);i++)
ml_drag_info[i].atom = gdk_atom_intern(ml_drag_info[i].target, FALSE);
- object_class->finalize = message_list_finalise;
- gtkobject_class->destroy = message_list_destroy;
+ g_type_class_add_private (class, sizeof (MessageListPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = message_list_set_property;
+ object_class->get_property = message_list_get_property;
+ object_class->dispose = message_list_dispose;
+ object_class->finalize = message_list_finalize;
+
+ gtk_object_class = GTK_OBJECT_CLASS (class);
+ gtk_object_class->destroy = message_list_destroy;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_BACKEND,
+ g_param_spec_object (
+ "shell-backend",
+ _("Shell Backend"),
+ _("The mail shell backend"),
+ E_TYPE_SHELL_BACKEND,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
message_list_signals[MESSAGE_SELECTED] =
g_signal_new ("message_selected",
@@ -2560,19 +2725,30 @@ message_list_construct (MessageList *message_list)
* Returns a new message-list widget.
**/
GtkWidget *
-message_list_new (void)
+message_list_new (EShellBackend *shell_backend)
{
MessageList *message_list;
+ g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), NULL);
+
message_list = MESSAGE_LIST (g_object_new(message_list_get_type (),
"hadjustment", NULL,
"vadjustment", NULL,
+ "shell-backend", shell_backend,
NULL));
message_list_construct (message_list);
return GTK_WIDGET (message_list);
}
+EShellBackend *
+message_list_get_shell_backend (MessageList *message_list)
+{
+ g_return_val_if_fail (IS_MESSAGE_LIST (message_list), NULL);
+
+ return message_list->priv->shell_backend;
+}
+
static void
clear_info(char *key, ETreePath *node, MessageList *ml)
{
@@ -4068,9 +4244,8 @@ regen_list_exec (struct _regen_list_msg *m)
if ((!is_deleted || (is_deleted && !m->hidedel)) && (!is_junk || (is_junk && !m->hidejunk)))
g_ptr_array_add (uids, (gpointer) camel_pstring_strdup (looking_for));
-
- camel_folder_free_message_info (m->folder, looking_info);
}
+
}
}
}
diff --git a/mail/message-list.h b/mail/message-list.h
index 4d0866fe20..4288568d4f 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -28,6 +28,9 @@
#include <table/e-table-simple.h>
#include <table/e-tree-scrolled.h>
+#include <camel/camel-folder.h>
+#include <shell/e-shell-backend.h>
+
#ifdef __cplusplus
extern "C" {
#pragma }
@@ -85,11 +88,13 @@ enum {
#define ML_HIDE_SAME (2147483646)
typedef struct _MessageList MessageList;
+typedef struct _MessageListClass MessageListClass;
+typedef struct _MessageListPrivate MessageListPrivate;
struct _MessageList {
ETreeScrolled parent;
- struct _MessageListPrivate *priv;
+ MessageListPrivate *priv;
/* The table */
ETreeModel *model;
@@ -165,14 +170,14 @@ struct _MessageList {
struct _MailAsyncEvent *async_event;
};
-typedef struct {
+struct _MessageListClass {
ETreeScrolledClass parent_class;
/* signals - select a message */
void (*message_selected) (MessageList *ml, const char *uid);
void (*message_list_built) (MessageList *ml);
void (*message_list_scrolled) (MessageList *ml);
-} MessageListClass;
+};
typedef enum {
MESSAGE_LIST_SELECT_NEXT = 0,
@@ -182,7 +187,8 @@ typedef enum {
} MessageListSelectDirection;
GType message_list_get_type (void);
-GtkWidget *message_list_new (void);
+GtkWidget *message_list_new (EShellBackend *shell_backend);
+EShellBackend *message_list_get_shell_backend (MessageList *message_list);
void message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder, const char *uri, gboolean outgoing);
void message_list_freeze(MessageList *ml);
diff --git a/mail/message-tag-followup.c b/mail/message-tag-followup.c
index 827fc6813a..ddbb6492f9 100644
--- a/mail/message-tag-followup.c
+++ b/mail/message-tag-followup.c
@@ -293,6 +293,11 @@ construct (MessageTagEditor *editor)
gtk_widget_reparent (widget, GTK_DIALOG (editor)->vbox);
gtk_box_set_child_packing (GTK_BOX (GTK_DIALOG (editor)->vbox), widget, TRUE, TRUE, 6, GTK_PACK_START);
+ widget = glade_xml_get_widget (gui, "pixmap");
+ gtk_image_set_from_icon_name (
+ GTK_IMAGE (widget), "stock_mail-flag-for-followup",
+ GTK_ICON_SIZE_DIALOG);
+
followup->message_list = GTK_TREE_VIEW (glade_xml_get_widget (gui, "message_list"));
model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_view_set_model (followup->message_list, (GtkTreeModel *) model);
diff --git a/mail/searchtypes.xml b/mail/searchtypes.xml
index 83941d875c..ba349993f7 100644
--- a/mail/searchtypes.xml
+++ b/mail/searchtypes.xml
@@ -569,7 +569,7 @@
</option>
</input>
<input type="optionlist" name="versus">
- <dynamic func="e_util_labels_get_filter_options"/>
+ <dynamic func="e_mail_labels_get_filter_options"/>
</input>
</part>
diff --git a/mail/vfoldertypes.xml b/mail/vfoldertypes.xml
index 11ed7cc0af..9fd117b67d 100644
--- a/mail/vfoldertypes.xml
+++ b/mail/vfoldertypes.xml
@@ -569,7 +569,7 @@
</option>
</input>
<input type="optionlist" name="versus">
- <dynamic func="e_util_labels_get_filter_options"/>
+ <dynamic func="e_mail_labels_get_filter_options"/>
</input>
</part>
diff --git a/plugins/attachment-reminder/Makefile.am b/plugins/attachment-reminder/Makefile.am
index 97e1abc696..edfe538d3a 100644
--- a/plugins/attachment-reminder/Makefile.am
+++ b/plugins/attachment-reminder/Makefile.am
@@ -22,9 +22,13 @@ plugin_LTLIBRARIES = liborg-gnome-evolution-attachment-reminder.la
liborg_gnome_evolution_attachment_reminder_la_SOURCES = attachment-reminder.c
liborg_gnome_evolution_attachment_reminder_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
liborg_gnome_evolution_attachment_reminder_la_LIBADD = \
+ $(top_builddir)/composer/libcomposer.la \
+ $(top_builddir)/shell/libeshell.la \
+ $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \
+ $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
- $(top_builddir)/mail/libevolution-mail.la \
+ $(top_builddir)/mail/libevolution-module-mail.la \
$(EVOLUTION_MAIL_LIBS)
schemadir = $(GCONF_SCHEMA_FILE_DIR)
diff --git a/plugins/audio-inline/Makefile.am b/plugins/audio-inline/Makefile.am
index 73e0b988d6..c17876d622 100644
--- a/plugins/audio-inline/Makefile.am
+++ b/plugins/audio-inline/Makefile.am
@@ -10,8 +10,9 @@ plugin_LTLIBRARIES = liborg-gnome-audio-inline.la
liborg_gnome_audio_inline_la_SOURCES = audio-inline.c
liborg_gnome_audio_inline_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
-liborg_gnome_audio_inline_la_LIBADD = \
- $(GSTREAMER_LIBS) \
+liborg_gnome_audio_inline_la_LIBADD = \
+ $(top_builddir)/mail/libevolution-module-mail.la \
+ $(GSTREAMER_LIBS) \
$(EVOLUTION_MAIL_LIBS)
EXTRA_DIST = org-gnome-audio-inline.eplug.xml
diff --git a/plugins/audio-inline/org-gnome-audio-inline.eplug.xml b/plugins/audio-inline/org-gnome-audio-inline.eplug.xml
index 14ad280740..1e853df10b 100644
--- a/plugins/audio-inline/org-gnome-audio-inline.eplug.xml
+++ b/plugins/audio-inline/org-gnome-audio-inline.eplug.xml
@@ -4,33 +4,94 @@
type="shlib"
id="org.gnome.evolution.plugin.audioInline"
location="@PLUGINDIR@/liborg-gnome-audio-inline@SOEXT@"
- _name="Audio Inline">
+ _name="Inline Audio">
- <_description>Play audio attachments directly from Evolution.</_description>
<author name="Radek Doulík" email="rodo@novell.com"/>
+ <_description>
+ Play audio attachments directly in mail messages.
+ </_description>
<hook class="org.gnome.evolution.mail.format:1.0">
<group id="EMFormatHTMLDisplay">
- <item mime_type="audio/ac3" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/x-ac3" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/basic" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/mpeg" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/x-mpeg" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/mpeg3" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/x-mpeg3" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/mp3" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/x-mp3" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/mp4" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/flac" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/x-flac" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/mod" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/x-mod" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/x-wav" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/microsoft-wav" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/x-wma" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="audio/x-ms-wma" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="application/ogg" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
- <item mime_type="application/x-ogg" format="org_gnome_audio_inline_format" flags="inline_disposition"/>
+ <item
+ mime_type="audio/ac3"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/x-ac3"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/basic"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/mpeg"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/x-mpeg"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/mpeg3"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/x-mpeg3"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/mp3"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/x-mp3"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/mp4"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/flac"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/x-flac"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/mod"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/x-mod"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/x-wav"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/microsoft-wav"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/x-wma"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="audio/x-ms-wma"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item
+ mime_type="application/ogg"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
+ <item mime_type="application/x-ogg"
+ format="org_gnome_audio_inline_format"
+ flags="inline_disposition"/>
</group>
</hook>
diff --git a/plugins/bbdb/Makefile.am b/plugins/bbdb/Makefile.am
index 1bf7604e92..ac42633ed6 100644
--- a/plugins/bbdb/Makefile.am
+++ b/plugins/bbdb/Makefile.am
@@ -14,6 +14,9 @@ liborg_gnome_evolution_bbdb_la_SOURCES = bbdb.c bbdb.h gaimbuddies.c
liborg_gnome_evolution_bbdb_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
liborg_gnome_evolution_bbdb_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/composer/libcomposer.la \
+ $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \
+ $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \
$(EVOLUTION_ADDRESSBOOK_LIBS)
EXTRA_DIST = org-gnome-evolution-bbdb.eplug.xml
diff --git a/plugins/bogo-junk-plugin/Makefile.am b/plugins/bogo-junk-plugin/Makefile.am
index 5dc0cc626c..afa24a0d71 100644
--- a/plugins/bogo-junk-plugin/Makefile.am
+++ b/plugins/bogo-junk-plugin/Makefile.am
@@ -11,8 +11,10 @@ plugin_LTLIBRARIES = liborg-gnome-bogo-junk-plugin.la
liborg_gnome_bogo_junk_plugin_la_SOURCES = bf-junk-filter.c
liborg_gnome_bogo_junk_plugin_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
liborg_gnome_bogo_junk_plugin_la_LIBADD = \
- $(GNOME_PLATFORM_LIBS) \
- $(top_builddir)/e-util/libeutil.la
+ $(top_builddir)/mail/libevolution-module-mail.la \
+ $(top_builddir)/e-util/libeutil.la \
+ $(EVOLUTION_MAIL_LIBS) \
+ $(GNOME_PLATFORM_LIBS)
schemadir = $(GCONF_SCHEMA_FILE_DIR)
schema_in_files = bogo-junk-plugin.schemas.in
diff --git a/plugins/calendar-weather/Makefile.am b/plugins/calendar-weather/Makefile.am
index 0e43fa1717..4404dedcde 100644
--- a/plugins/calendar-weather/Makefile.am
+++ b/plugins/calendar-weather/Makefile.am
@@ -1,5 +1,4 @@
eds_datadir = `pkg-config --variable=privdatadir evolution-data-server-1.2`
-weatherdatadir = $(datadir)/evolution/$(BASE_VERSION)/weather
INCLUDES = \
-I$(top_srcdir) \
@@ -12,15 +11,6 @@ INCLUDES = \
@EVO_PLUGIN_RULE@
-weatherdata_DATA = \
- category_weather_cloudy_16.png \
- category_weather_fog_16.png \
- category_weather_partly_cloudy_16.png \
- category_weather_rain_16.png \
- category_weather_snow_16.png \
- category_weather_sun_16.png \
- category_weather_tstorm_16.png
-
plugin_DATA = org-gnome-calendar-weather.eplug
plugin_LTLIBRARIES = liborg-gnome-calendar-weather.la
diff --git a/plugins/calendar-weather/calendar-weather.c b/plugins/calendar-weather/calendar-weather.c
index 9354cbb0b1..b636bcee86 100644
--- a/plugins/calendar-weather/calendar-weather.c
+++ b/plugins/calendar-weather/calendar-weather.c
@@ -51,8 +51,8 @@ int
e_plugin_lib_enable (EPluginLib *epl, int enable)
{
GList *l;
- gboolean found = FALSE;
- const char *tmp;
+ const gchar *tmp;
+ gint ii;
static struct {
const char *description;
@@ -74,24 +74,21 @@ e_plugin_lib_enable (EPluginLib *epl, int enable)
/* Add the categories icons if we don't have them. */
for (l = e_categories_get_list (); l; l = g_list_next (l)) {
- if (!strcmp ((const char *)l->data, tmp)) {
- found = TRUE;
- break;
- }
+ if (!strcmp ((const char *)l->data, tmp))
+ goto exit;
}
- if (!found) {
- int i;
-
- for (i = 0; categories[i].description; i++) {
- char *filename;
+ for (ii = 0; categories[ii].description; ii++) {
+ char *filename;
- filename = e_icon_factory_get_icon_filename (categories[i].icon_name, GTK_ICON_SIZE_MENU);
- e_categories_add (_(categories[i].description), NULL, filename, FALSE);
- g_free (filename);
- }
+ filename = e_icon_factory_get_icon_filename (
+ categories[ii].icon_name, GTK_ICON_SIZE_MENU);
+ e_categories_add (
+ _(categories[ii].description), NULL, filename, FALSE);
+ g_free (filename);
}
+exit:
return 0;
}
diff --git a/plugins/calendar-weather/category_weather_cloudy_16.png b/plugins/calendar-weather/category_weather_cloudy_16.png
deleted file mode 100644
index ddb3ba7c59..0000000000
--- a/plugins/calendar-weather/category_weather_cloudy_16.png
+++ /dev/null
Binary files differ
diff --git a/plugins/calendar-weather/category_weather_fog_16.png b/plugins/calendar-weather/category_weather_fog_16.png
deleted file mode 100644
index 23e4e2f1d4..0000000000
--- a/plugins/calendar-weather/category_weather_fog_16.png
+++ /dev/null
Binary files differ
diff --git a/plugins/calendar-weather/category_weather_partly_cloudy_16.png b/plugins/calendar-weather/category_weather_partly_cloudy_16.png
deleted file mode 100644
index 472feaa654..0000000000
--- a/plugins/calendar-weather/category_weather_partly_cloudy_16.png
+++ /dev/null
Binary files differ
diff --git a/plugins/calendar-weather/category_weather_rain_16.png b/plugins/calendar-weather/category_weather_rain_16.png
deleted file mode 100644
index e00d5e1c82..0000000000
--- a/plugins/calendar-weather/category_weather_rain_16.png
+++ /dev/null
Binary files differ
diff --git a/plugins/calendar-weather/category_weather_snow_16.png b/plugins/calendar-weather/category_weather_snow_16.png
deleted file mode 100644
index 5e95985f5f..0000000000
--- a/plugins/calendar-weather/category_weather_snow_16.png
+++ /dev/null
Binary files differ
diff --git a/plugins/calendar-weather/category_weather_sun_16.png b/plugins/calendar-weather/category_weather_sun_16.png
deleted file mode 100644
index 780c61c23c..0000000000
--- a/plugins/calendar-weather/category_weather_sun_16.png
+++ /dev/null
Binary files differ
diff --git a/plugins/calendar-weather/category_weather_tstorm_16.png b/plugins/calendar-weather/category_weather_tstorm_16.png
deleted file mode 100644
index b2af092b53..0000000000
--- a/plugins/calendar-weather/category_weather_tstorm_16.png
+++ /dev/null
Binary files differ
diff --git a/plugins/email-custom-header/Makefile.am b/plugins/email-custom-header/Makefile.am
index 6d3b6b8967..c9467fe925 100644
--- a/plugins/email-custom-header/Makefile.am
+++ b/plugins/email-custom-header/Makefile.am
@@ -23,8 +23,7 @@ liborg_gnome_email_custom_header_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
$(top_builddir)/mail/libevolution-mail.la \
- $(EVOLUTION_MAIL_LIBS) \
- $(NO_UNDEFINED_REQUIRED_LIBS)
+ $(EVOLUTION_MAIL_LIBS)
liborg_gnome_email_custom_header_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c
index 7b065e0de5..31039bcf44 100644
--- a/plugins/email-custom-header/email-custom-header.c
+++ b/plugins/email-custom-header/email-custom-header.c
@@ -550,13 +550,13 @@ destroy_compo_data (gpointer data)
static void action_email_custom_header_cb (GtkAction *action, EMsgComposer *composer)
{
- GtkUIManager *manager;
+ GtkUIManager *ui_manager;
GtkWidget *menuitem;
CustomHeaderOptionsDialog *dialog = NULL;
EmailCustomHeaderWindow *new_email_custom_header_window = NULL;
- manager = gtkhtml_editor_get_ui_manager (GTKHTML_EDITOR (composer));
- menuitem = gtk_ui_manager_get_widget (manager, "/main-menu/insert-menu/insert-menu-top/Custom Header");
+ ui_manager = gtkhtml_editor_get_ui_manager (GTKHTML_EDITOR (composer));
+ menuitem = gtk_ui_manager_get_widget (ui_manager, "/main-menu/insert-menu/insert-menu-top/Custom Header");
new_email_custom_header_window = g_object_get_data ((GObject *) composer, "compowindow");
diff --git a/plugins/external-editor/Makefile.am b/plugins/external-editor/Makefile.am
index 4373b81ee5..76234e3533 100644
--- a/plugins/external-editor/Makefile.am
+++ b/plugins/external-editor/Makefile.am
@@ -1,11 +1,3 @@
-if OS_WIN32
-NO_UNDEFINED_REQUIRED_LIBS = \
- $(EVOLUTION_MAIL_LIBS) \
- $(GNOME_PLATFORM_LIBS) \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/mail/libevolution-mail.la
-endif
-
INCLUDES = \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
-DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \
@@ -35,8 +27,15 @@ liborg_gnome_external_editor_la_SOURCES = \
liborg_gnome_external_editor_la_LDFLAGS = \
-module -avoid-version $(NO_UNDEFINED)
-liborg_gnome_external_editor_la_LIBADD = \
- $(NO_UNDEFINED_REQUIRED_LIBS)
+liborg_gnome_external_editor_la_LIBADD = \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/composer/libcomposer.la \
+ $(top_builddir)/shell/libeshell.la \
+ $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \
+ $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \
+ $(top_builddir)/mail/libevolution-module-mail.la \
+ $(EVOLUTION_MAIL_LIBS) \
+ $(GNOME_PLATFORM_LIBS)
schemadir = $(GCONF_SCHEMA_FILE_DIR)
schema_in_files = apps-evolution-external-editor.schemas.in
diff --git a/plugins/face/Makefile.am b/plugins/face/Makefile.am
index 59cf66e93e..6ac6dd9850 100644
--- a/plugins/face/Makefile.am
+++ b/plugins/face/Makefile.am
@@ -22,8 +22,7 @@ liborg_gnome_face_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
$(top_builddir)/mail/libevolution-mail.la \
- $(EVOLUTION_MAIL_LIBS) \
- $(NO_UNDEFINED_REQUIRED_LIBS)
+ $(EVOLUTION_MAIL_LIBS)
liborg_gnome_face_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
diff --git a/plugins/groupwise-features/Makefile.am b/plugins/groupwise-features/Makefile.am
index c72cc89850..57b37fd522 100644
--- a/plugins/groupwise-features/Makefile.am
+++ b/plugins/groupwise-features/Makefile.am
@@ -1,7 +1,3 @@
-if OS_WIN32
-NO_UNDEFINED_REQUIRED_LIBS = $(top_builddir)/mail/libevolution-mail.la
-endif
-
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/widgets \
@@ -45,7 +41,6 @@ liborg_gnome_groupwise_features_la_LIBADD= \
$(top_builddir)/calendar/gui/libevolution-calendar.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
$(top_builddir)/filter/libfilter.la \
- $(NO_UNDEFINED_REQUIRED_LIBS) \
$(EVOLUTION_CALENDAR_LIBS) \
$(EVOLUTION_MAIL_LIBS) \
$(CAMEL_GROUPWISE_LIBS)
diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c
index ebcf068bf0..94435bf983 100644
--- a/plugins/groupwise-features/proxy-login.c
+++ b/plugins/groupwise-features/proxy-login.c
@@ -43,6 +43,7 @@
#include <e-util/e-error.h>
#include <e-util/e-icon-factory.h>
#include <e-util/e-util-private.h>
+#include <e-util/e-account-utils.h>
#include <e-gw-container.h>
#include <e-gw-connection.h>
@@ -304,7 +305,7 @@ proxy_login_cb (GtkDialog *dialog, gint state)
static void
proxy_soap_login (char *email)
{
- EAccountList *accounts = mail_config_get_accounts();
+ EAccountList *accounts = e_get_account_list ();
EAccount *srcAccount;
EAccount *dstAccount;
EGwConnection *proxy_cnc, *cnc;
diff --git a/plugins/imap-features/Makefile.am b/plugins/imap-features/Makefile.am
index 69b94ffbb1..cf7dbd79c9 100644
--- a/plugins/imap-features/Makefile.am
+++ b/plugins/imap-features/Makefile.am
@@ -1,7 +1,3 @@
-if OS_WIN32
-NO_UNDEFINED_REQUIRED_LIBS = $(top_builddir)/mail/libevolution-mail.la
-endif
-
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/mail \
@@ -18,8 +14,9 @@ plugin_LTLIBRARIES = liborg-gnome-imap-features.la
liborg_gnome_imap_features_la_SOURCES = \
imap-headers.c
-liborg_gnome_imap_features_la_LIBADD= \
- $(NO_UNDEFINED_REQUIRED_LIBS) \
+liborg_gnome_imap_features_la_LIBADD= \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/mail/libevolution-module-mail.la \
$(EVOLUTION_MAIL_LIBS)
diff --git a/plugins/imap-features/imap-headers.c b/plugins/imap-features/imap-headers.c
index c33a02bdef..7fa7d4685d 100644
--- a/plugins/imap-features/imap-headers.c
+++ b/plugins/imap-features/imap-headers.c
@@ -31,8 +31,7 @@
#include <gtk/gtk.h>
-#include <libedataserver/e-account.h>
-#include <libedataserver/e-account-list.h>
+#include "e-util/e-account-utils.h"
#include <camel/camel-url.h>
#include <camel/camel-exception.h>
@@ -84,7 +83,7 @@ imap_headers_commit (EPlugin *efp, EConfigHookItemFactoryData *data)
if (g_str_has_prefix (account->source->url, "imap://") ||
(use_imap && g_str_has_prefix (account->source->url, "groupwise://"))) {
EAccount *temp = NULL;
- EAccountList *accounts = mail_config_get_accounts ();
+ EAccountList *accounts = e_get_account_list ();
CamelURL *url = NULL;
CamelException ex;
GtkTreeModel *model;
diff --git a/plugins/ipod-sync/Makefile.am b/plugins/ipod-sync/Makefile.am
index 570683442e..218dd933dd 100644
--- a/plugins/ipod-sync/Makefile.am
+++ b/plugins/ipod-sync/Makefile.am
@@ -16,7 +16,7 @@ liborg_gnome_ipod_sync_evolution_la_SOURCES = \
format-handler.h \
evolution-ipod-sync.h
-liborg_gnome_ipod_sync_evolution_la_LDFLAGS = -module -avoid-version
+liborg_gnome_ipod_sync_evolution_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
liborg_gnome_ipod_sync_evolution_la_LIBADD = \
$(EVOLUTION_CALENDAR_LIBS)
diff --git a/plugins/mail-account-disable/ChangeLog b/plugins/mail-account-disable/ChangeLog
deleted file mode 100644
index 86dc9a4897..0000000000
--- a/plugins/mail-account-disable/ChangeLog
+++ /dev/null
@@ -1,62 +0,0 @@
-2008-10-03 Sankar P <psankar@novell.com>
-
-License Changes
-
- * mail-account-disable.c:
-
-2007-11-18 Gilles Dartiguelongue <gdartigu@svn.gnome.org>
-
- ** Fix bug #495875
-
- * mail-account-disable.c:
- right click menu reordering
-
-2007-04-02 Sankar P <psankar@novell.com>
-
- * Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr>
-
- * org-gnome-mail-account-disable.eplug.xml:
- Cleanup.
- Fixes part of #301149
-
-2006-08-21 Matthew Barnes <mbarnes@redhat.com>
-
- * mail-account-disable.c:
- "Disable" did not work for "On This Computer" - fixes bug 350901.
-
-2006-01-06 Simon Zheng <simon.zheng@sun.com>
-
- * mail-account-disable.c:
- use libedataserver/e-account-list.h instead of e-util/e-account-list.h.
- use libedataserver/e-account.h instead of e-util/e-account.h.
-
-2005-12-12 Harish Krishnaswamy <kharish@novell.com>
-
- * Makefile.am: Fix make-clean issues.
-
-2005-08-23 Not Zed <NotZed@Ximian.com>
-
- * Makefile.am: Remove the special case for win32, its a bug on all
- platforms, silly.
-
- * mail-account-disable.c (mail_account_disable): make signature
- match usage.
-
-2005-07-13 Tor Lillqvist <tml@novell.com>
-
- * Makefile.am (INCLUDES): Remove duplicated line.
- (LDFLAGS): Use NO_UNDEFINED.
- (LIBADD): Link with the required libraries, but let's do it only
- on Win32.
-
- * org-gnome-mail-account-disable.eplug.xml: Use SOEXT.
-
-2005-07-12 Vivek Jain <jvivek@novell.com>
-
- have a ChangeLog and transfer the changelog entry from the main
- ChangeLog
- (2005-07-10 Shreyas Srinivasan <sshreyas@novell.com>)
-
- * plugins/mail-account-disable/*: Plugin to add Disable/ Proxy
- Logout to a store menu on right click.
-
diff --git a/plugins/mail-account-disable/Makefile.am b/plugins/mail-account-disable/Makefile.am
deleted file mode 100644
index 5616f273ea..0000000000
--- a/plugins/mail-account-disable/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_builddir)/mail \
- $(EVOLUTION_MAIL_CFLAGS) \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\"
-
-@EVO_PLUGIN_RULE@
-
-plugin_DATA = org-gnome-mail-account-disable.eplug
-plugin_LTLIBRARIES = libmail-account-disable.la
-
-libmail_account_disable_la_SOURCES = mail-account-disable.c
-libmail_account_disable_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
-libmail_account_disable_la_LIBADD = $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/mail/libevolution-mail.la \
- $(EVOLUTION_MAIL_LIBS)
-
-EXTRA_DIST = org-gnome-mail-account-disable.eplug.xml
-
-BUILT_SOURCES = $(plugin_DATA)
-CLEANFILES = $(BUILT_SOURCES)
-
--include $(top_srcdir)/git.mk
diff --git a/plugins/mail-account-disable/mail-account-disable.c b/plugins/mail-account-disable/mail-account-disable.c
deleted file mode 100644
index d03e97d0f8..0000000000
--- a/plugins/mail-account-disable/mail-account-disable.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Shreyas Srinivasan <sshreyas@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <string.h>
-#include <mail/mail-component.h>
-#include <mail/em-folder-selector.h>
-#include <mail/em-popup.h>
-#include <mail/em-account-editor.h>
-#include <mail/mail-config.h>
-#include <libedataserver/e-account.h>
-#include <libedataserver/e-account-list.h>
-
-#define ACCOUNT_DISABLE 0
-#define PROXY_LOGOUT 1
-
-void mail_account_disable (EPopup *ep, EPopupItem *p, void *data);
-void org_gnome_create_mail_account_disable (EPlugin *ep, EMPopupTargetFolder *t);
-
-static EPopupItem popup_items[] = {
- { E_POPUP_ITEM, (gchar *) "40.emc.04", (gchar *) N_("_Disable"), mail_account_disable, NULL, NULL, 0, EM_POPUP_FOLDER_STORE },
- { E_POPUP_ITEM, (gchar *) "40.emc.04", (gchar *) N_("Proxy _Logout"), mail_account_disable, NULL, NULL, 0, EM_POPUP_FOLDER_STORE }
-};
-
-static void
-popup_free (EPopup *ep, GSList *items, void *data)
-{
- g_slist_free (items);
-}
-
-void
-mail_account_disable (EPopup *ep, EPopupItem *p, void *data)
-{
- MailComponent *component;
- EAccount *account = data;
-
- g_assert (account != NULL);
-
- component = mail_component_peek ();
-
- if (mail_config_has_proxies (account))
- mail_config_remove_account_proxies (account);
-
- account->enabled = !account->enabled;
- e_account_list_change (mail_config_get_accounts (), account);
- mail_component_remove_store_by_uri (component, account->source->url);
-
- if (account->parent_uid)
- mail_config_remove_account (account);
-
- mail_config_save_accounts();
-}
-
-void
-org_gnome_create_mail_account_disable (EPlugin *ep, EMPopupTargetFolder *t)
-{
- EAccount *account;
- GSList *menus = NULL;
-
- account = mail_config_get_account_by_source_url (t->uri);
-
- if (account == NULL)
- return;
-
- if (g_strrstr (t->uri,"groupwise://") && account->parent_uid) {
- popup_items[PROXY_LOGOUT].label = _(popup_items [PROXY_LOGOUT].label);
- menus = g_slist_prepend (menus, &popup_items [PROXY_LOGOUT]);
- }
- else {
- popup_items[ACCOUNT_DISABLE].label = _(popup_items [ACCOUNT_DISABLE].label);
- menus = g_slist_prepend (menus, &popup_items [ACCOUNT_DISABLE]);
- }
-
- e_popup_add_items (t->target.popup, menus, NULL, popup_free, account);
-}
-
diff --git a/plugins/mail-account-disable/org-gnome-mail-account-disable.eplug.xml b/plugins/mail-account-disable/org-gnome-mail-account-disable.eplug.xml
deleted file mode 100644
index 535a87a314..0000000000
--- a/plugins/mail-account-disable/org-gnome-mail-account-disable.eplug.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<e-plugin-list>
- <e-plugin
- id="org.gnome.mail.account.disable"
- type="shlib"
- domain="@GETTEXT_PACKAGE@"
- _name="Disable Account"
- location="@PLUGINDIR@/libmail-account-disable@SOEXT@">
- <_description>Disable an account by right-clicking on it in the folder tree.</_description>
- <author name="Shreyas Srinivasan" email="sshreyas@novell.com"/>
-
- <hook class="org.gnome.evolution.mail.popup:1.0">
- <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder"
- factory="org_gnome_create_mail_account_disable">
- </menu>
- </hook>
- </e-plugin>
-</e-plugin-list>
diff --git a/plugins/mail-notification/Makefile.am b/plugins/mail-notification/Makefile.am
index 4228a90be5..629697f7d1 100644
--- a/plugins/mail-notification/Makefile.am
+++ b/plugins/mail-notification/Makefile.am
@@ -1,12 +1,6 @@
-if OS_WIN32
-NO_UNDEFINED_REQUIRED_LIBS = \
- $(top_builddir)/mail/libevolution-mail.la \
- $(top_builddir)/e-util/libeutil.la \
- $(GNOME_PLATFORM_LIBS)
-endif
-
INCLUDES = \
-I$(top_srcdir) \
+ -I$(top_srcdir)/widgets \
$(EVOLUTION_MAIL_CFLAGS) \
$(LIBNOTIFY_CFLAGS)
@@ -24,9 +18,11 @@ plugin_LTLIBRARIES = liborg-gnome-mail-notification.la
liborg_gnome_mail_notification_la_SOURCES = mail-notification.c
liborg_gnome_mail_notification_la_LDFLAGS = \
-module -avoid-version $(NO_UNDEFINED)
-liborg_gnome_mail_notification_la_LIBADD = \
- $(LIBNOTIFY_LIBS) \
- $(NO_UNDEFINED_REQUIRED_LIBS)
+liborg_gnome_mail_notification_la_LIBADD = \
+ $(LIBNOTIFY_LIBS) \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/mail/libevolution-module-mail.la \
+ $(GNOME_PLATFORM_LIBS)
if ENABLE_DBUS
liborg_gnome_mail_notification_la_LDFLAGS += $(NMN_LIBS)
diff --git a/plugins/mark-all-read/Makefile.am b/plugins/mark-all-read/Makefile.am
index 724277826c..f3db1bdc6c 100644
--- a/plugins/mark-all-read/Makefile.am
+++ b/plugins/mark-all-read/Makefile.am
@@ -11,7 +11,8 @@ liborg_gnome_mark_all_read_la_SOURCES = mark-all-read.c
liborg_gnome_mark_all_read_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
liborg_gnome_mark_all_read_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/mail/libevolution-mail.la \
+ $(top_builddir)/mail/libevolution-module-mail.la \
+ $(top_builddir)/shell/libeshell.la \
$(EVOLUTION_MAIL_LIBS)
EXTRA_DIST = org-gnome-mark-all-read.eplug.xml
diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c
index dfcf75937b..8b62add8e7 100644
--- a/plugins/mark-all-read/mark-all-read.c
+++ b/plugins/mark-all-read/mark-all-read.c
@@ -28,20 +28,27 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <e-util/e-config.h>
-#include <mail/em-popup.h>
+#include <e-util/e-plugin-ui.h>
+#include <mail/e-mail-shell-sidebar.h>
+#include <mail/em-folder-tree.h>
#include <mail/mail-ops.h>
#include <mail/mail-mt.h>
#include <camel/camel-vee-folder.h>
#include "e-util/e-error.h"
+#include <shell/e-shell-sidebar.h>
+#include <shell/e-shell-window.h>
+#include <shell/e-shell-window-actions.h>
+
#define PRIMARY_TEXT \
N_("Also mark messages in subfolders?")
#define SECONDARY_TEXT \
N_("Do you want to mark messages as read in the current folder " \
"only, or in the current folder as well as all subfolders?")
-void org_gnome_mark_all_read (EPlugin *ep, EMPopupTargetFolder *target);
+gboolean e_plugin_ui_init (GtkUIManager *ui_manager,
+ EShellView *shell_view);
+
static void mar_got_folder (char *uri, CamelFolder *folder, void *data);
static void mar_all_sub_folders (CamelStore *store, CamelFolderInfo *fi, CamelException *ex);
@@ -190,16 +197,6 @@ prompt_user (void)
return response;
}
-void
-org_gnome_mark_all_read (EPlugin *ep, EMPopupTargetFolder *t)
-{
- if (t->uri == NULL) {
- return;
- }
-
- mail_get_folder(t->uri, 0, mar_got_folder, NULL, mail_msg_unordered_push);
-}
-
static void
mark_all_as_read (CamelFolder *folder)
{
@@ -270,3 +267,52 @@ mar_all_sub_folders (CamelStore *store, CamelFolderInfo *fi, CamelException *ex)
fi = fi->next;
}
}
+
+static void
+action_mail_mark_read_recursive_cb (GtkAction *action,
+ EShellView *shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EShellSidebar *shell_sidebar;
+ EMFolderTree *folder_tree;
+ const gchar *folder_uri;
+
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ g_return_if_fail (E_IS_MAIL_SHELL_SIDEBAR (shell_sidebar));
+
+ mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+ g_return_if_fail (folder_uri != NULL);
+
+ mail_get_folder (
+ folder_uri, 0, mar_got_folder, NULL, mail_msg_unordered_push);
+}
+
+static GtkActionEntry entries[] = {
+
+ { "mail-mark-read-recursive",
+ "mail-mark-read",
+ N_("Mark Me_ssages as Read"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_mail_mark_read_recursive_cb) }
+};
+
+gboolean
+e_plugin_ui_init (GtkUIManager *ui_manager,
+ EShellView *shell_view)
+{
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ action_group = E_SHELL_WINDOW_ACTION_GROUP_SHELL (shell_window);
+
+ /* Add actions to the "shell" action group. */
+ gtk_action_group_add_actions (
+ action_group, entries,
+ G_N_ELEMENTS (entries), shell_view);
+
+ return TRUE;
+}
diff --git a/plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml b/plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml
index 356b8a5793..a254e1e4db 100644
--- a/plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml
+++ b/plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml
@@ -1,18 +1,21 @@
<?xml version="1.0"?>
<e-plugin-list>
- <e-plugin
- id="org.gnome.evolution.mail.folder.mark_all_read"
- type="shlib"
- domain="@GETTEXT_PACKAGE@"
- _name="Mark All Read"
- location="@PLUGINDIR@/liborg-gnome-mark-all-read@SOEXT@">
- <author name="Chenthill Palanisamy" email="pchenthill@novell.com"/>
- <_description>Mark all messages in a folder as read.</_description>
+ <e-plugin id="org.gnome.evolution.mail.folder.mark_all_read"
+ type="shlib"
+ domain="@GETTEXT_PACKAGE@"
+ _name="Mark All Read"
+ location="@PLUGINDIR@/liborg-gnome-mark-all-read@SOEXT@">
+ <author name="Chenthill Palanisamy" email="pchenthill@novell.com"/>
+ <_description>Mark all messages in a folder as read.</_description>
- <hook class="org.gnome.evolution.mail.popup:1.0">
- <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder">
- <item type="item" path="30.emc.01" icon="mail-mark-read" _label="Mark Me_ssages as Read" activate="org_gnome_mark_all_read" enable="folder" visible="folder"/>
- </menu>
- </hook>
- </e-plugin>
+ <hook class="org.gnome.evolution.ui:1.0">
+ <ui-manager id="org.gnome.evolution.mail">
+ <popup name="mail-folder-popup">
+ <placeholder name="mail-folder-popup-actions">
+ <menuitem action="mail-mark-read-recursive"/>
+ </placeholder>
+ </popup>
+ </ui-manager>
+ </hook>
+ </e-plugin>
</e-plugin-list>
diff --git a/plugins/mono/Makefile.am b/plugins/mono/Makefile.am
index f98e8be2ab..6404920982 100644
--- a/plugins/mono/Makefile.am
+++ b/plugins/mono/Makefile.am
@@ -9,7 +9,7 @@ plugin_DATA = org-gnome-evolution-mono.eplug
plugin_LTLIBRARIES = liborg-gnome-evolution-mono.la
liborg_gnome_evolution_mono_la_SOURCES = mono-plugin.c mono-plugin.h
-liborg_gnome_evolution_mono_la_LDFLAGS = -module -avoid-version
+liborg_gnome_evolution_mono_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
liborg_gnome_evolution_mono_la_LIBADD = \
$(E_UTIL_LIBS) \
$(MONO_LIBS)
diff --git a/plugins/plugin-manager/Makefile.am b/plugins/plugin-manager/Makefile.am
index 645581e11d..ab3c2ceb98 100644
--- a/plugins/plugin-manager/Makefile.am
+++ b/plugins/plugin-manager/Makefile.am
@@ -4,18 +4,18 @@ INCLUDES = \
@EVO_PLUGIN_RULE@
-plugin_DATA = org-gnome-plugin-manager.eplug org-gnome-plugin-manager.xml
+plugin_DATA = org-gnome-plugin-manager.eplug
plugin_LTLIBRARIES = liborg-gnome-plugin-manager.la
liborg_gnome_plugin_manager_la_SOURCES = plugin-manager.c
liborg_gnome_plugin_manager_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
liborg_gnome_plugin_manager_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/shell/libeshell.la \
$(EVOLUTION_MAIL_LIBS)
-EXTRA_DIST = \
- org-gnome-plugin-manager.eplug.xml \
- org-gnome-plugin-manager.xml
+EXTRA_DIST = \
+ org-gnome-plugin-manager.eplug.xml
BUILT_SOURCES = org-gnome-plugin-manager.eplug
diff --git a/plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml b/plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml
index 406f19b648..da270764a0 100644
--- a/plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml
+++ b/plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml
@@ -6,18 +6,19 @@
location="@PLUGINDIR@/liborg-gnome-plugin-manager@SOEXT@"
_name="Plugin Manager"
system_plugin="true">
- <_description>Manage your Evolution plugins.</_description>
<author name="Michael Zucchi" email="notzed@ximian.com"/>
- <hook class="org.gnome.evolution.shell.bonobomenu:1.0">
- <menu id="org.gnome.evolution.shell" target="shell">
- <!-- the path to the bonobo menu description -->
- <ui file="@PLUGINDIR@/org-gnome-plugin-manager.xml"/>
- <item
- type="item"
- verb="EPluginManagerManage"
- path="/commands/EPluginManagerManage"
- activate="org_gnome_plugin_manager_manage"/>
- </menu>
+ <_description>Manage your Evolution plugins.</_description>
+
+ <hook class="org.gnome.evolution.ui:1.0">
+ <ui-manager id="org.gnome.evolution.shell">
+ <menubar name="main-menu">
+ <menu action="edit-menu">
+ <placeholder name="administrative-actions">
+ <menuitem action="plugin-manager"/>
+ </placeholder>
+ </menu>
+ </menubar>
+ </ui-manager>
</hook>
</e-plugin>
</e-plugin-list>
diff --git a/plugins/plugin-manager/org-gnome-plugin-manager.xml b/plugins/plugin-manager/org-gnome-plugin-manager.xml
deleted file mode 100644
index 3f74a2dd4c..0000000000
--- a/plugins/plugin-manager/org-gnome-plugin-manager.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<Root>
- <commands>
- <cmd name="EPluginManagerManage" _label="_Plugins"
- _tip="Enable and disable plugins"/>
- </commands>
-
- <menu>
- <submenu name="Edit">
- <placeholder name="PluginManagerPlaceholder">
- <menuitem name="EPluginManagerManage" verb=""/>
- </placeholder>
- </submenu>
-
- </menu>
-</Root>
diff --git a/plugins/plugin-manager/plugin-manager.c b/plugins/plugin-manager/plugin-manager.c
index 54d166065b..7a669668a7 100644
--- a/plugins/plugin-manager/plugin-manager.c
+++ b/plugins/plugin-manager/plugin-manager.c
@@ -32,7 +32,8 @@
#include <stdio.h>
#include "e-util/e-plugin.h"
-#include "shell/es-menu.h"
+#include "shell/e-shell-window.h"
+#include "shell/e-shell-window-actions.h"
#define d(S) (S)
@@ -61,7 +62,6 @@ static struct {
typedef struct _Manager Manager;
struct _Manager {
- GtkDialog *dialog;
GtkTreeView *treeview;
GtkTreeModel *model;
@@ -75,13 +75,13 @@ struct _Manager {
};
/* for tracking if we're shown */
-static GtkDialog *dialog;
static GtkWidget *notebook;
static GtkWidget *configure_page;
static gint last_selected_page;
static gulong switch_page_handler_id;
-void org_gnome_plugin_manager_manage(void *ep, ESMenuTargetShell *t);
+gboolean e_plugin_ui_init (GtkUIManager *ui_manager,
+ EShellWindow *shell_window);
static void
eppm_set_label (GtkLabel *l, const char *v)
@@ -221,19 +221,15 @@ eppm_free (void *data)
}
static void
-eppm_response (GtkDialog *w, int button, Manager *m)
-{
- gtk_widget_destroy (GTK_WIDGET (w));
- dialog = NULL;
-}
-
-void
-org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t)
+action_plugin_manager_cb (GtkAction *action,
+ EShellWindow *shell_window)
{
Manager *m;
int i;
+ GtkWidget *dialog;
GtkWidget *hbox, *w;
GtkWidget *overview_page;
+ GtkWidget *content_area;
GtkListStore *store;
GtkTreeSelection *selection;
GtkCellRenderer *renderer;
@@ -241,26 +237,23 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t)
char *string;
GtkWidget *subvbox;
- if (dialog) {
- gtk_window_present (GTK_WINDOW (dialog));
- return;
- }
-
m = g_malloc0 (sizeof (*m));
/* Setup the ui */
- m->dialog = GTK_DIALOG (gtk_dialog_new_with_buttons (_("Plugin Manager"),
- GTK_WINDOW (gtk_widget_get_toplevel (t->target.widget)),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
- NULL));
+ dialog = gtk_dialog_new_with_buttons (
+ _("Plugin Manager"),
+ GTK_WINDOW (shell_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
- gtk_window_set_default_size (GTK_WINDOW (m->dialog), 640, 400);
- g_object_set (G_OBJECT (m->dialog), "has_separator", FALSE, NULL);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 640, 400);
+ g_object_set (dialog, "has_separator", FALSE, NULL);
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
- gtk_box_pack_start (GTK_BOX (m->dialog->vbox), hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);
string = g_strdup_printf ("<i>%s</i>", _("Note: Some changes will not take effect until restart"));
@@ -272,7 +265,7 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t)
gtk_widget_show (w);
g_free (string);
- gtk_box_pack_start (GTK_BOX (m->dialog->vbox), w, FALSE, TRUE, 6);
+ gtk_box_pack_start (GTK_BOX (content_area), w, FALSE, TRUE, 6);
notebook = gtk_notebook_new ();
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE);
@@ -423,24 +416,34 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t)
atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (m->treeview)), _("Plugin"));
- g_object_set_data_full (G_OBJECT (m->dialog), "plugin-manager", m, eppm_free);
- g_signal_connect (m->dialog, "response", G_CALLBACK (eppm_response), m);
-
- dialog = m->dialog;
+ gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_show (GTK_WIDGET (m->dialog));
+ gtk_widget_destroy (dialog);
+ eppm_free (m);
}
-int e_plugin_lib_enable (EPluginLib *ep, int enable);
+static GtkActionEntry entries[] = {
-int
-e_plugin_lib_enable (EPluginLib *ep, int enable)
+ { "plugin-manager",
+ NULL,
+ N_("_Plugins"),
+ NULL,
+ N_("Enable and disable plugins"),
+ G_CALLBACK (action_plugin_manager_cb) }
+};
+
+gboolean
+e_plugin_ui_init (GtkUIManager *ui_manager,
+ EShellWindow *shell_window)
{
- if (enable) {
- } else {
- /* This plugin can't be disabled ... */
- return -1;
- }
+ GtkActionGroup *action_group;
+
+ action_group = E_SHELL_WINDOW_ACTION_GROUP_SHELL (shell_window);
+
+ /* Add actions to the "shell" action group. */
+ gtk_action_group_add_actions (
+ action_group, entries,
+ G_N_ELEMENTS (entries), shell_window);
- return 0;
+ return TRUE;
}
diff --git a/plugins/profiler/Makefile.am b/plugins/profiler/Makefile.am
index 037219c5ed..4a8a45910b 100644
--- a/plugins/profiler/Makefile.am
+++ b/plugins/profiler/Makefile.am
@@ -10,7 +10,7 @@ plugin_DATA = org-gnome-evolution-profiler.eplug
plugin_LTLIBRARIES = liborg-gnome-evolution-profiler.la
liborg_gnome_evolution_profiler_la_SOURCES = profiler.c
-liborg_gnome_evolution_profiler_la_LDFLAGS = -module -avoid-version
+liborg_gnome_evolution_profiler_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
EXTRA_DIST = org-gnome-evolution-profiler.eplug.xml
diff --git a/plugins/pst-import/Makefile.am b/plugins/pst-import/Makefile.am
index 0bb5fe43e1..b4b4f482aa 100644
--- a/plugins/pst-import/Makefile.am
+++ b/plugins/pst-import/Makefile.am
@@ -1,11 +1,3 @@
-if OS_WIN32
-NO_UNDEFINED_REQUIRED_LIBS = \
- $(top_builddir)/mail/libevolution-mail.la \
- $(top_builddir)/e-util/libeutil.la \
- $(EVOLUTION_CALENDAR_LIBS) \
- $(EVOLUTION_MAIL_LIBS)
-endif
-
INCLUDES = \
-I$(EVOLUTION_SOURCE) \
-I$(top_srcdir) \
@@ -24,7 +16,6 @@ liborg_gnome_pst_import_la_SOURCES = pst-importer.c
liborg_gnome_pst_import_la_LDFLAGS = \
-module -avoid-version $(NO_UNDEFINED)
liborg_gnome_pst_import_la_LIBADD = \
- $(NO_UNDEFINED_REQUIRED_LIBS) \
$(LIBPST_LIBS)
EXTRA_DIST = org-gnome-pst-import.eplug.xml
diff --git a/plugins/python/Makefile.am b/plugins/python/Makefile.am
index 77441e0e9b..51cc65dcc2 100644
--- a/plugins/python/Makefile.am
+++ b/plugins/python/Makefile.am
@@ -9,7 +9,7 @@ plugin_DATA = org-gnome-evolution-python.eplug
plugin_LTLIBRARIES = liborg-gnome-evolution-python.la
liborg_gnome_evolution_python_la_SOURCES = python-plugin-loader.c python-plugin-loader.h
-liborg_gnome_evolution_python_la_LDFLAGS = -module -avoid-version
+liborg_gnome_evolution_python_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
liborg_gnome_evolution_python_la_LIBADD = \
-lpthread -ldl -lutil -lm \
$(PY_LIBS) \
diff --git a/plugins/python/example/Makefile.am b/plugins/python/example/Makefile.am
index b3530d841c..a57ed573c1 100644
--- a/plugins/python/example/Makefile.am
+++ b/plugins/python/example/Makefile.am
@@ -9,9 +9,6 @@ plugin_DATA = \
org-gnome-hello-python-ui.xml \
org-gnome-hello-python.eplug
-liborg_gnome_py_plug_test_la_LIBADD= \
- $(NO_UNDEFINED_REQUIRED_LIBS)
-
liborg_gnome_py_plug_test_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
errordir = $(privdatadir)/errors
diff --git a/plugins/sa-junk-plugin/Makefile.am b/plugins/sa-junk-plugin/Makefile.am
index 4e44fa5c3b..dfbddb45e3 100644
--- a/plugins/sa-junk-plugin/Makefile.am
+++ b/plugins/sa-junk-plugin/Makefile.am
@@ -10,6 +10,11 @@ plugin_LTLIBRARIES = liborg-gnome-sa-junk-plugin.la
liborg_gnome_sa_junk_plugin_la_SOURCES = em-junk-filter.c
liborg_gnome_sa_junk_plugin_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
+liborg_gnome_sa_junk_plugin_la_LIBADD = \
+ $(top_builddir)/mail/libevolution-module-mail.la \
+ $(top_builddir)/e-util/libeutil.la \
+ $(EVOLUTION_MAIL_LIBS) \
+ $(GNOME_PLATFORM_LIBS)
BUILT_SOURCES = $(plugin_DATA) $(error_DATA)
diff --git a/plugins/select-one-source/ChangeLog b/plugins/select-one-source/ChangeLog
deleted file mode 100644
index 0534fee906..0000000000
--- a/plugins/select-one-source/ChangeLog
+++ /dev/null
@@ -1,64 +0,0 @@
-2008-10-13 Suman Manjunath <msuman@novell.com>
-
- ** Fix for bug #424818 (bugzilla.novell.com)
-
- * mark-calendar-offline.c: Removed this unused PoC file. The
- corresponding plugin has also been integrated into the main code.
-
-2008-08-27 Sankar P <psankar@novell.com>
-
-License Changes
-
- * mark-calendar-offline.c:
- * select-one-source.c:
-
-2008-08-12 Bharath Acharya <abharath@novell.com>
-
- * Makefile.am: Use NO_UNDEFINED. Link with more libraries. To generate
- dlls on Windows.
-
-2007-11-11 Gilles Dartiguelongue <gdartigu@svn.gnome.org>
-
- ** Fix bug #495872
-
- * org-gnome-select-one-source.eplug.xml:
- add right-click menu item for memo component
-
-2007-04-02 Sankar P <psankar@novell.com>
-
- * Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr>
-
- * org-gnome-select-one-source.eplug.xml:
- Cleanup.
- Fixes part of #301149
-
-2006-02-13 Karsten Bräckelmann <guenther@rudersport.de>
-
- * org-gnome-select-one-source.eplug.xml:
- Fix mnemonics to be consistent. Fixes bug #330934.
-
-2005-12-12 Harish Krishnaswamy <kharish@novell.com>
-
- * Makefile.am: Fix make-clean issues.
-
-2005-05-06 Not Zed <NotZed@Ximian.com>
-
- * Makefile.am:
- * org-gnome-select-one-source.eplug.xml: s/.in/.xml/ & i18n.
-
-2005-02-24 Björn Torkelsson <torkel@acc.umu.se>
-
- * org-gnome-select-one-source.eplug.in: Fixed description and
- added author.
- Added xml tag.
-
-2004-11-01 JP Rosevear <jpr@novell.com>
-
- * Makefile.am: dist .eplug.in file
-
-2004-10-20 JP Rosevear <jpr@novell.com>
-
- * select-one-source.c: implement a plugin that allows the user to
- limit the displayed task lists or calendars to the current
- calendar or task list
-
diff --git a/plugins/select-one-source/Makefile.am b/plugins/select-one-source/Makefile.am
deleted file mode 100644
index 8c872f23a5..0000000000
--- a/plugins/select-one-source/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-INCLUDES = \
- -I$(top_srcdir) \
- $(EVOLUTION_CALENDAR_CFLAGS)
-
-@EVO_PLUGIN_RULE@
-
-plugin_DATA = org-gnome-select-one-source.eplug
-plugin_LTLIBRARIES = liborg-gnome-select-one-source.la
-
-liborg_gnome_select_one_source_la_SOURCES = select-one-source.c
-liborg_gnome_select_one_source_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
-liborg_gnome_select_one_source_la_LIBADD = \
- $(EVOLUTION_CALENDAR_LIBS)
-
-EXTRA_DIST = org-gnome-select-one-source.eplug.xml
-
-BUILT_SOURCES = $(plugin_DATA)
-CLEANFILES = $(BUILT_SOURCES)
-
--include $(top_srcdir)/git.mk
diff --git a/plugins/select-one-source/org-gnome-select-one-source.eplug.xml b/plugins/select-one-source/org-gnome-select-one-source.eplug.xml
deleted file mode 100644
index 12a3d03a88..0000000000
--- a/plugins/select-one-source/org-gnome-select-one-source.eplug.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<e-plugin-list>
- <e-plugin id="org.gnome.evolution.select_one_source" type="shlib"
- _name="Select One Source"
- location="@PLUGINDIR@/liborg-gnome-select-one-source@SOEXT@">
- <author name="JP Rosevear" email="jpr@novell.com"/>
- <_description>Quickly select a single calendar or task list for viewing.</_description>
-
- <hook class="org.gnome.evolution.calendar.popup:1.0">
- <menu id="org.gnome.evolution.tasks.source.popup" target="source">
- <item type="item" path="25.select_one_source" _label="Show _only this Task List" icon="stock_check-filled" activate="org_gnome_select_one_source"/>
- </menu>
- <menu id="org.gnome.evolution.memos.source.popup" target="source">
- <item type="item" path="25.select_one_source" _label="Show _only this Memo List" icon="stock_check-filled" activate="org_gnome_select_one_source"/>
- </menu>
- <menu id="org.gnome.evolution.calendar.source.popup" target="source">
- <item type="item" path="25.select_one_source" _label="Show _only this Calendar" icon="stock_check-filled" activate="org_gnome_select_one_source"/>
- </menu>
- </hook>
- </e-plugin>
-</e-plugin-list>
diff --git a/plugins/select-one-source/select-one-source.c b/plugins/select-one-source/select-one-source.c
deleted file mode 100644
index c211814151..0000000000
--- a/plugins/select-one-source/select-one-source.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-/* This is prototype code only, this may, or may not, use undocumented
- * unstable or private internal function calls. */
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <libedataserver/e-source.h>
-#include <libedataserverui/e-source-selector.h>
-#include <calendar/gui/e-cal-popup.h>
-
-void org_gnome_select_one_source (EPlugin *ep, ECalPopupTargetSource *target);
-
-void
-org_gnome_select_one_source (EPlugin *ep, ECalPopupTargetSource *target)
-{
- GSList *selection, *l;
- ESource *primary_source;
-
- selection = e_source_selector_get_selection (target->selector);
- primary_source = e_source_selector_peek_primary_selection (target->selector);
-
- for (l = selection; l; l = l->next) {
- ESource *source = l->data;
-
- if (source != primary_source)
- e_source_selector_unselect_source (target->selector, source);
- }
-
- e_source_selector_select_source (target->selector, primary_source);
-
- e_source_selector_free_selection (selection);
-}
diff --git a/plugins/tnef-attachments/Makefile.am b/plugins/tnef-attachments/Makefile.am
index 6ea2ce1f3e..d473f15af0 100644
--- a/plugins/tnef-attachments/Makefile.am
+++ b/plugins/tnef-attachments/Makefile.am
@@ -1,11 +1,3 @@
-if OS_WIN32
-NO_UNDEFINED_REQUIRED_LIBS = \
- $(EVOLUTION_MAIL_LIBS) \
- $(GNOME_PLATFORM_LIBS) \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/mail/libevolution-mail.la
-endif
-
INCLUDES = \
-I$(top_srcdir) \
-DGETTEXT_PACKAGE="\"$(GETTEXT_PACKAGE)\"" \
@@ -21,7 +13,9 @@ plugin_LTLIBRARIES = liborg-gnome-tnef-attachments.la
liborg_gnome_tnef_attachments_la_SOURCES = tnef-plugin.c
liborg_gnome_tnef_attachments_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
liborg_gnome_tnef_attachments_la_LIBADD = \
- $(NO_UNDEFINED_REQUIRED_LIBS) \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/em-format/libemformat.la \
+ $(EVOLUTION_MAIL_LIBS) \
-lytnef
EXTRA_DIST = org-gnome-tnef-attachments.eplug.xml
diff --git a/plugins/tnef-attachments/tnef-plugin.c b/plugins/tnef-attachments/tnef-plugin.c
index ae0dc378da..9b4f4cae6a 100644
--- a/plugins/tnef-attachments/tnef-plugin.c
+++ b/plugins/tnef-attachments/tnef-plugin.c
@@ -46,7 +46,7 @@
#include <camel/camel-multipart.h>
#include <camel/camel-stream-fs.h>
-#include <mail/em-format.h>
+#include <em-format/em-format.h>
#include <mail/em-format-hook.h>
#include <mail/em-utils.h>
#include <e-util/e-error.h>
@@ -160,7 +160,7 @@ org_gnome_format_tnef(void *ep, EMFormatHookTarget *t)
camel_medium_set_content_object((CamelMedium *)part, content);
camel_object_unref(content);
- type = em_utils_snoop_type(part);
+ type = em_format_snoop_type(part);
if (type)
camel_data_wrapper_set_mime_type((CamelDataWrapper *)part, type);
diff --git a/plugins/vcard-inline/Makefile.am b/plugins/vcard-inline/Makefile.am
index 781eb53bd4..f3c20d1c59 100644
--- a/plugins/vcard-inline/Makefile.am
+++ b/plugins/vcard-inline/Makefile.am
@@ -11,10 +11,17 @@ plugin_LTLIBRARIES = liborg-gnome-vcard-inline.la
liborg_gnome_vcard_inline_la_SOURCES = vcard-inline.c
liborg_gnome_vcard_inline_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
liborg_gnome_vcard_inline_la_LIBADD = \
- $(EVOLUTION_ADDRESSBOOK_LIBS)
+ $(top_builddir)/mail/libevolution-module-mail.la \
+ $(top_builddir)/addressbook/util/libeabutil.la \
+ $(top_builddir)/addressbook/gui/widgets/libeabwidgets.la \
+ $(top_builddir)/addressbook/gui/merging/libeabbookmerging.la \
+ $(top_builddir)/addressbook/printing/libecontactprint.la \
+ $(EVOLUTION_ADDRESSBOOK_LIBS) \
$(EVOLUTION_MAIL_LIBS)
EXTRA_DIST = org-gnome-vcard-inline.eplug.xml
BUILT_SOURCES = $(plugin_DATA)
CLEANFILES = $(BUILT_SOURCES)
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c
index fa0077f807..96ce0e3f9c 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -29,9 +29,9 @@
#include <camel/camel-stream-mem.h>
#include <gtkhtml/gtkhtml-embedded.h>
-#include "addressbook/gui/component/addressbook.h"
#include "addressbook/gui/merging/eab-contact-merging.h"
#include "addressbook/gui/widgets/eab-contact-display.h"
+#include "addressbook/util/addressbook.h"
#include "addressbook/util/eab-book-util.h"
#include "mail/em-format-hook.h"
#include "mail/em-format-html.h"
@@ -46,7 +46,6 @@ struct _VCardInlinePObject {
GList *contact_list;
GtkWidget *contact_display;
GtkWidget *message_label;
- EABContactDisplayRenderMode mode;
};
static gint org_gnome_vcard_inline_classid;
@@ -145,25 +144,23 @@ org_gnome_vcard_inline_toggle_cb (VCardInlinePObject *vcard_object,
GtkButton *button)
{
EABContactDisplay *contact_display;
+ EABContactDisplayMode mode;
const gchar *label;
contact_display = EAB_CONTACT_DISPLAY (vcard_object->contact_display);
+ mode = eab_contact_display_get_mode (contact_display);
/* Toggle between "full" and "compact" modes. */
- if (vcard_object->mode == EAB_CONTACT_DISPLAY_RENDER_NORMAL) {
- vcard_object->mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT;
+ if (mode == EAB_CONTACT_DISPLAY_RENDER_NORMAL) {
+ mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT;
label = _("Show Full vCard");
} else {
- vcard_object->mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL;
+ mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL;
label = _("Show Compact vCard");
}
+ eab_contact_display_set_mode (contact_display, mode);
gtk_button_set_label (button, label);
-
- eab_contact_display_render (
- EAB_CONTACT_DISPLAY (vcard_object->contact_display),
- E_CONTACT (vcard_object->contact_list->data),
- vcard_object->mode);
}
static gboolean
@@ -175,11 +172,16 @@ org_gnome_vcard_inline_embed (EMFormatHTML *format,
GtkWidget *button_box;
GtkWidget *container;
GtkWidget *widget;
+ EContact *contact;
guint length;
vcard_object = (VCardInlinePObject *) object;
length = g_list_length (vcard_object->contact_list);
- g_return_val_if_fail (length > 0, FALSE);
+
+ if (vcard_object->contact_list != NULL)
+ contact = E_CONTACT (vcard_object->contact_list->data);
+ else
+ contact = NULL;
container = GTK_WIDGET (embedded);
@@ -199,15 +201,15 @@ org_gnome_vcard_inline_embed (EMFormatHTML *format,
button_box = widget;
widget = eab_contact_display_new ();
+ eab_contact_display_set_contact (
+ EAB_CONTACT_DISPLAY (widget), contact);
+ eab_contact_display_set_mode (
+ EAB_CONTACT_DISPLAY (widget),
+ EAB_CONTACT_DISPLAY_RENDER_COMPACT);
gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
vcard_object->contact_display = g_object_ref (widget);
gtk_widget_show (widget);
- eab_contact_display_render (
- EAB_CONTACT_DISPLAY (vcard_object->contact_display),
- E_CONTACT (vcard_object->contact_list->data),
- vcard_object->mode);
-
widget = gtk_label_new (NULL);
gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
vcard_object->message_label = g_object_ref (widget);
@@ -276,7 +278,6 @@ org_gnome_vcard_inline_format (void *ep, EMFormatHookTarget *target)
camel_object_ref (target->part);
- vcard_object->mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT;
vcard_object->object.free = org_gnome_vcard_inline_pobject_free;
org_gnome_vcard_inline_decode (vcard_object, target->part);
diff --git a/po/ChangeLog b/po/ChangeLog
index 288d6506bd..721636a83f 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog
@@ -99,12 +99,10 @@
* or.po: Updated Oriya Translation.
-<<<<<<< .mine
2009-03-16 Manoj Kumar Giri <mgiri@redhat.com>
* or.po: Updated Oriya Translation.
-=======
2009-03-16 Dwayne Bailey <dwayne@translate.org.za>
* af.po: Fix msgfmt errors
@@ -115,7 +113,6 @@
Fixes bug #575466.
* LINGUAS: Added af.
->>>>>>> .r37444
2009-03-15 Daniel Nylander <po@danielnylander.se>
* sv.po: Updated Swedish translation.
@@ -413,9 +410,9 @@
* es.po: Updated Spanish translation.
-2009-02-06 Clytie Siddall <clytie@riverland.net.au>
+2009-02-06 Clytie Siddall <clytie@riverland.net.au>
- * vi.po: Updated Vietnamese translation
+ * vi.po Updated Vietnamese translation
2009-02-05 Sweta Kothari <swkothar@redhat.com>
diff --git a/po/LINGUAS b/po/LINGUAS
index 7bfdedbcd0..992042f3c9 100644
--- a/po/LINGUAS
+++ b/po/LINGUAS
@@ -6,7 +6,6 @@ ar
as
ast
az
-be
be@latin
bg
bn
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9a07bfc58a..2dd31891f4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,35 +1,17 @@
# List of source files containing translatable strings.
# Please keep this list in alphabetic order.
-a11y/addressbook/ea-addressbook-view.c
-a11y/addressbook/ea-minicard-view.c
-a11y/addressbook/ea-minicard.c
-a11y/calendar/ea-cal-view-event.c
-a11y/calendar/ea-cal-view.c
-a11y/calendar/ea-day-view-main-item.c
-a11y/calendar/ea-day-view.c
-a11y/calendar/ea-gnome-calendar.c
-a11y/calendar/ea-jump-button.c
-a11y/calendar/ea-week-view-main-item.c
-a11y/calendar/ea-week-view.c
-a11y/e-table/gal-a11y-e-cell-popup.c
-a11y/e-table/gal-a11y-e-cell-text.c
-a11y/e-table/gal-a11y-e-cell-toggle.c
-a11y/e-table/gal-a11y-e-cell-tree.c
-a11y/e-table/gal-a11y-e-cell.c
-a11y/e-table/gal-a11y-e-table-click-to-add.c
-a11y/e-table/gal-a11y-e-table-column-header.c
-a11y/widgets/ea-calendar-item.c
-a11y/widgets/ea-combo-button.c
addressbook/addressbook.error.xml
addressbook/conduit/address-conduit.c
-addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in
-addressbook/gui/component/addressbook-component.c
addressbook/gui/component/addressbook-config.c
-addressbook/gui/component/addressbook-migrate.c
-addressbook/gui/component/addressbook-view.c
-addressbook/gui/component/addressbook.c
addressbook/gui/component/apps_evolution_addressbook.schemas.in
addressbook/gui/component/autocompletion-config.c
+addressbook/gui/component/e-book-shell-backend.c
+addressbook/gui/component/e-book-shell-content.c
+addressbook/gui/component/e-book-shell-migrate.c
+addressbook/gui/component/e-book-shell-sidebar.c
+addressbook/gui/component/e-book-shell-view-actions.c
+addressbook/gui/component/e-book-shell-view.c
+addressbook/gui/component/eab-composer-util.c
addressbook/gui/component/ldap-config.glade
addressbook/gui/contact-editor/contact-editor.glade
addressbook/gui/contact-editor/e-contact-editor-fullname.c
@@ -42,6 +24,9 @@ addressbook/gui/contact-list-editor/e-contact-list-editor.c
addressbook/gui/merging/eab-contact-commit-duplicate-detected.glade
addressbook/gui/merging/eab-contact-duplicate-detected.glade
addressbook/gui/merging/eab-contact-merging.c
+addressbook/gui/widgets/a11y/ea-addressbook-view.c
+addressbook/gui/widgets/a11y/ea-minicard-view.c
+addressbook/gui/widgets/a11y/ea-minicard.c
addressbook/gui/widgets/addresstypes.xml
addressbook/gui/widgets/e-addressbook-model.c
addressbook/gui/widgets/e-addressbook-reflow-adapter.c
@@ -54,7 +39,6 @@ addressbook/gui/widgets/e-minicard-view.c
addressbook/gui/widgets/e-minicard.c
addressbook/gui/widgets/eab-contact-display.c
addressbook/gui/widgets/eab-gui-util.c
-addressbook/gui/widgets/eab-popup-control.c
addressbook/gui/widgets/gal-view-factory-minicard.c
addressbook/importers/evolution-csv-importer.c
addressbook/importers/evolution-ldif-importer.c
@@ -64,12 +48,21 @@ addressbook/printing/test-print.c
addressbook/tools/evolution-addressbook-export-list-cards.c
addressbook/tools/evolution-addressbook-export-list-folders.c
addressbook/tools/evolution-addressbook-export.c
+addressbook/util/addressbook.c
calendar/calendar.error.xml
calendar/common/authentication.c
calendar/conduits/calendar/calendar-conduit.c
calendar/conduits/memo/memo-conduit.c
calendar/conduits/todo/todo-conduit.c
calendar/gui/GNOME_Evolution_Calendar.server.in.in
+calendar/gui/a11y/ea-cal-view-event.c
+calendar/gui/a11y/ea-cal-view.c
+calendar/gui/a11y/ea-day-view-main-item.c
+calendar/gui/a11y/ea-day-view.c
+calendar/gui/a11y/ea-gnome-calendar.c
+calendar/gui/a11y/ea-jump-button.c
+calendar/gui/a11y/ea-week-view-main-item.c
+calendar/gui/a11y/ea-week-view.c
calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in
calendar/gui/alarm-notify/alarm-notify-dialog.c
calendar/gui/alarm-notify/alarm-notify.glade
@@ -82,8 +75,6 @@ calendar/gui/calendar-commands.c
calendar/gui/calendar-component.c
calendar/gui/calendar-view-factory.c
calendar/gui/caltypes.xml
-calendar/gui/comp-editor-factory.c
-calendar/gui/control-factory.c
calendar/gui/dialogs/alarm-dialog.c
calendar/gui/dialogs/alarm-dialog.glade
calendar/gui/dialogs/alarm-list-dialog.c
@@ -122,7 +113,6 @@ calendar/gui/dialogs/task-page.c
calendar/gui/dialogs/task-page.glade
calendar/gui/e-alarm-list.c
calendar/gui/e-attachment-handler-calendar.c
-calendar/gui/e-cal-component-memo-preview.c
calendar/gui/e-cal-component-preview.c
calendar/gui/e-cal-list-view.c
calendar/gui/e-cal-list-view.etspec
@@ -156,9 +146,7 @@ calendar/gui/goto-dialog.glade
calendar/gui/goto.c
calendar/gui/itip-utils.c
calendar/gui/memos-component.c
-calendar/gui/memos-control.c
calendar/gui/memotypes.xml
-calendar/gui/migration.c
calendar/gui/misc.c
calendar/gui/print.c
calendar/gui/tasks-component.c
@@ -166,9 +154,32 @@ calendar/gui/tasks-control.c
calendar/gui/tasktypes.xml
calendar/gui/weekday-picker.c
calendar/importers/icalendar-importer.c
+calendar/module/e-cal-shell-backend.c
+calendar/module/e-cal-shell-content.c
+calendar/module/e-cal-shell-migrate.c
+calendar/module/e-cal-shell-sidebar.c
+calendar/module/e-cal-shell-view-actions.c
+calendar/module/e-cal-shell-view-memopad.c
+calendar/module/e-cal-shell-view-private.c
+calendar/module/e-cal-shell-view-taskpad.c
+calendar/module/e-cal-shell-view.c
+calendar/module/e-memo-shell-backend.c
+calendar/module/e-memo-shell-content.c
+calendar/module/e-memo-shell-migrate.c
+calendar/module/e-memo-shell-sidebar.c
+calendar/module/e-memo-shell-view-actions.c
+calendar/module/e-memo-shell-view-private.c
+calendar/module/e-memo-shell-view.c
+calendar/module/e-task-shell-backend.c
+calendar/module/e-task-shell-content.c
+calendar/module/e-task-shell-migrate.c
+calendar/module/e-task-shell-sidebar.c
+calendar/module/e-task-shell-view-actions.c
+calendar/module/e-task-shell-view-private.c
+calendar/module/e-task-shell-view.c
calendar/zones.h
-composer/e-composer-autosave.c
composer/e-composer-actions.c
+composer/e-composer-autosave.c
composer/e-composer-header-table.c
composer/e-composer-name-header.c
composer/e-composer-post-header.c
@@ -181,14 +192,16 @@ e-util/e-categories-config.c
e-util/e-dialog-utils.c
e-util/e-error.c
e-util/e-logger.c
+e-util/e-module.c
e-util/e-non-intrusive-error-dialog.c
e-util/e-non-intrusive-error-dialog.h
e-util/e-plugin.c
e-util/e-print.c
e-util/e-system.error.xml
e-util/e-util.c
-e-util/e-util-labels.c
e-util/gconf-bridge.c
+em-format/em-format-quote.c
+em-format/em-format.c
filter/filter-datespec.c
filter/filter-file.c
filter/filter-input.c
@@ -202,7 +215,21 @@ filter/rule-editor.c
mail/GNOME_Evolution_Mail.server.in.in
mail/e-attachment-handler-mail.c
mail/e-mail-attachment-bar.c
+mail/e-mail-browser.c
+mail/e-mail-display.c
+mail/e-mail-label-dialog.c
+mail/e-mail-label-list-store.c
+mail/e-mail-label-manager.c
+mail/e-mail-label-tree-view.c
+mail/e-mail-reader-utils.c
+mail/e-mail-reader.c
mail/e-mail-search-bar.c
+mail/e-mail-shell-backend.c
+mail/e-mail-shell-content.c
+mail/e-mail-shell-migrate.c
+mail/e-mail-shell-view-actions.c
+mail/e-mail-shell-view-private.c
+mail/e-mail-shell-view.c
mail/em-account-editor.c
mail/em-account-prefs.c
mail/em-composer-prefs.c
@@ -222,11 +249,8 @@ mail/em-folder-view.c
mail/em-format-html-display.c
mail/em-format-html-print.c
mail/em-format-html.c
-mail/em-format-quote.c
-mail/em-format.c
mail/em-junk-hook.c
mail/em-mailer-prefs.c
-mail/em-migrate.c
mail/em-popup.c
mail/em-subscribe-editor.c
mail/em-utils.c
@@ -241,14 +265,12 @@ mail/mail-autofilter.c
mail/mail-component.c
mail/mail-config.c
mail/mail-config.glade
-mail/mail-crypto.c
mail/mail-dialogs.glade
mail/mail-folder-cache.c
mail/mail-mt.c
mail/mail-ops.c
mail/mail-send-recv.c
mail/mail-session.c
-mail/mail-signature-editor.c
mail/mail-tools.c
mail/mail-vfolder.c
mail/mail.error.xml
@@ -261,8 +283,8 @@ plugins/addressbook-file/org-gnome-addressbook-file.eplug.xml
plugins/attachment-reminder/apps-evolution-attachment-reminder.schemas.in
plugins/attachment-reminder/attachment-reminder.c
plugins/attachment-reminder/attachment-reminder.glade
-plugins/attachment-reminder/org-gnome-evolution-attachment-reminder.eplug.xml
plugins/attachment-reminder/org-gnome-attachment-reminder.error.xml
+plugins/attachment-reminder/org-gnome-evolution-attachment-reminder.eplug.xml
plugins/audio-inline/org-gnome-audio-inline.eplug.xml
plugins/backup-restore/backup-restore.c
plugins/backup-restore/backup.c
@@ -287,11 +309,11 @@ plugins/default-mailer/org-gnome-default-mailer.eplug.xml
plugins/default-mailer/org-gnome-default-mailer.error.xml
plugins/default-source/default-source.c
plugins/default-source/org-gnome-default-source.eplug.xml
+plugins/email-custom-header/apps_evolution_email_custom_header.schemas.in
plugins/email-custom-header/email-custom-header.c
plugins/email-custom-header/email-custom-header.glade
-plugins/email-custom-header/org-gnome-email-custom-header.glade
plugins/email-custom-header/org-gnome-email-custom-header.eplug.xml
-plugins/email-custom-header/apps_evolution_email_custom_header.schemas.in
+plugins/email-custom-header/org-gnome-email-custom-header.glade
plugins/exchange-operations/e-foreign-folder-dialog.glade
plugins/exchange-operations/exchange-account-setup.c
plugins/exchange-operations/exchange-calendar.c
@@ -322,15 +344,15 @@ plugins/exchange-operations/org-gnome-exchange-tasks-subscription.xml
plugins/exchange-operations/org-gnome-folder-permissions.xml
plugins/exchange-operations/org-gnome-folder-subscription.xml
plugins/external-editor/apps-evolution-external-editor.schemas.in
+plugins/external-editor/external-editor.c
plugins/external-editor/org-gnome-external-editor.eplug.xml
plugins/external-editor/org-gnome-external-editor.error.xml
-plugins/external-editor/external-editor.c
plugins/face/face.c
plugins/face/org-gnome-face.eplug.xml
plugins/folder-unsubscribe/folder-unsubscribe.c
plugins/folder-unsubscribe/org-gnome-mail-folder-unsubscribe.eplug.xml
-plugins/google-account-setup/google-source.c
plugins/google-account-setup/google-contacts-source.c
+plugins/google-account-setup/google-source.c
plugins/google-account-setup/org-gnome-evolution-google.eplug.xml
plugins/groupwise-account-setup/camel-gw-listener.c
plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml
@@ -342,8 +364,8 @@ plugins/groupwise-features/mail-retract.c
plugins/groupwise-features/org-gnome-compose-send-options.xml
plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml
plugins/groupwise-features/org-gnome-mail-retract.error.xml
-plugins/groupwise-features/org-gnome-proxy.error.xml
plugins/groupwise-features/org-gnome-proxy-login.error.xml
+plugins/groupwise-features/org-gnome-proxy.error.xml
plugins/groupwise-features/org-gnome-shared-folder.error.xml
plugins/groupwise-features/process-meeting.c
plugins/groupwise-features/properties.glade
@@ -368,8 +390,6 @@ plugins/itip-formatter/itip-formatter.c
plugins/itip-formatter/itip-view.c
plugins/itip-formatter/org-gnome-itip-formatter.eplug.xml
plugins/itip-formatter/org-gnome-itip-formatter.error.xml
-plugins/mail-account-disable/mail-account-disable.c
-plugins/mail-account-disable/org-gnome-mail-account-disable.eplug.xml
plugins/mail-notification/apps-evolution-mail-notification.schemas.in
plugins/mail-notification/mail-notification.c
plugins/mail-notification/org-gnome-mail-notification.eplug.xml
@@ -383,7 +403,6 @@ plugins/mark-all-read/mark-all-read.c
plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml
plugins/mono/org-gnome-evolution-mono.eplug.xml
plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml
-plugins/plugin-manager/org-gnome-plugin-manager.xml
plugins/plugin-manager/plugin-manager.c
plugins/prefer-plain/org-gnome-prefer-plain.eplug.xml
plugins/prefer-plain/prefer-plain.c
@@ -407,38 +426,36 @@ plugins/save-calendar/ical-format.c
plugins/save-calendar/org-gnome-save-calendar.eplug.xml
plugins/save-calendar/rdf-format.c
plugins/save-calendar/save-calendar.c
-plugins/select-one-source/org-gnome-select-one-source.eplug.xml
plugins/startup-wizard/org-gnome-evolution-startup-wizard.eplug.xml
plugins/startup-wizard/startup-wizard.c
plugins/subject-thread/org-gnome-subject-thread.eplug.xml
plugins/subject-thread/subject-thread.c
plugins/templates/apps-evolution-template-placeholders.schemas.in
+plugins/templates/org-gnome-templates.eplug.xml
plugins/templates/templates.c
plugins/templates/templates.glade
-plugins/templates/org-gnome-templates.eplug.xml
plugins/tnef-attachments/org-gnome-tnef-attachments.eplug.xml
plugins/vcard-inline/org-gnome-vcard-inline.eplug.xml
plugins/vcard-inline/vcard-inline.c
plugins/webdav-account-setup/org-gnome-evolution-webdav.eplug.xml
plugins/webdav-account-setup/webdav-contacts-source.c
shell/GNOME_Evolution_Shell.server.in.in
-shell/test/GNOME_Evolution_Test.server.in.in
shell/apps_evolution_shell.schemas.in
-shell/e-active-connection-dialog.glade
-shell/e-component-registry.c
shell/e-config-upgrade.c
+shell/e-shell-backend.c
+shell/e-shell-content.c
shell/e-shell-importer.c
-shell/e-shell-settings-dialog.c
+shell/e-shell-migrate.c
+shell/e-shell-switcher.c
shell/e-shell-view.c
-shell/e-shell-window-commands.c
+shell/e-shell-window-actions.c
+shell/e-shell-window-private.c
shell/e-shell-window.c
shell/e-shell.c
-shell/e-user-creatable-items-handler.c
-shell/evolution-shell-component-utils.c
-shell/test/evolution-test-component.c
shell/import.glade
shell/main.c
shell/shell.error.xml
+shell/test/e-test-shell-backend.c
smime/gui/ca-trust-dialog.c
smime/gui/cert-trust-dialog.c
smime/gui/certificate-manager.c
@@ -450,14 +467,10 @@ smime/lib/e-cert-db.c
smime/lib/e-cert.c
smime/lib/e-pkcs12.c
tools/killev.c
-ui/evolution-addressbook.xml
-ui/evolution-calendar.xml
ui/evolution-mail-global.xml
ui/evolution-mail-list.xml
ui/evolution-mail-message.xml
ui/evolution-mail-messagedisplay.xml
-ui/evolution-memos.xml
-ui/evolution-tasks.xml
ui/evolution.xml
views/addressbook/galview.xml
views/calendar/galview.xml
@@ -473,10 +486,14 @@ widgets/menus/gal-view-factory-etable.c
widgets/menus/gal-view-instance-save-as-dialog.c
widgets/menus/gal-view-instance-save-as-dialog.glade
widgets/menus/gal-view-instance.c
-widgets/menus/gal-view-menus.c
widgets/menus/gal-view-new-dialog.c
widgets/menus/gal-view-new-dialog.glade
-widgets/misc/e-attachment.c
+widgets/misc/a11y/ea-calendar-item.c
+widgets/misc/e-account-manager.c
+widgets/misc/e-account-tree-view.c
+widgets/misc/e-action-combo-box.c
+widgets/misc/e-activity-proxy.c
+widgets/misc/e-activity.c
widgets/misc/e-attachment-dialog.c
widgets/misc/e-attachment-handler-image.c
widgets/misc/e-attachment-handler-sendto.c
@@ -485,12 +502,11 @@ widgets/misc/e-attachment-paned.c
widgets/misc/e-attachment-store.c
widgets/misc/e-attachment-tree-view.c
widgets/misc/e-attachment-view.c
+widgets/misc/e-attachment.c
widgets/misc/e-calendar-item.c
widgets/misc/e-calendar.c
widgets/misc/e-canvas-background.c
widgets/misc/e-canvas-vbox.c
-widgets/misc/e-cell-date-edit.c
-widgets/misc/e-cell-percent.c
widgets/misc/e-charset-picker.c
widgets/misc/e-dateedit.c
widgets/misc/e-filter-bar.c
@@ -499,17 +515,32 @@ widgets/misc/e-image-chooser.c
widgets/misc/e-map.c
widgets/misc/e-online-button.c
widgets/misc/e-pilot-settings.c
-widgets/misc/e-reflow.c
+widgets/misc/e-popup-action.c
+widgets/misc/e-preferences-window.c
widgets/misc/e-search-bar.c
+widgets/misc/e-search-bar.c.BASE.11732.c
+widgets/misc/e-search-bar.c.LOCAL.11732.c
+widgets/misc/e-search-bar.c.REMOTE.11732.c
widgets/misc/e-selection-model-array.c
widgets/misc/e-selection-model.c
widgets/misc/e-send-options.c
widgets/misc/e-send-options.glade
widgets/misc/e-signature-combo-box.c
-widgets/misc/e-task-widget.c
+widgets/misc/e-signature-editor.c
+widgets/misc/e-signature-manager.c
+widgets/misc/e-signature-script-dialog.c
widgets/misc/e-url-entry.c
+widgets/table/a11y/gal-a11y-e-cell-popup.c
+widgets/table/a11y/gal-a11y-e-cell-text.c
+widgets/table/a11y/gal-a11y-e-cell-toggle.c
+widgets/table/a11y/gal-a11y-e-cell-tree.c
+widgets/table/a11y/gal-a11y-e-cell.c
+widgets/table/a11y/gal-a11y-e-table-click-to-add.c
+widgets/table/a11y/gal-a11y-e-table-column-header.c
widgets/table/e-cell-combo.c
+widgets/table/e-cell-date-edit.c
widgets/table/e-cell-date.c
+widgets/table/e-cell-percent.c
widgets/table/e-cell-pixbuf.c
widgets/table/e-cell-text.c
widgets/table/e-table-click-to-add.c
diff --git a/po/be.po b/po/be.po
index 6032564129..794f2c360d 100644
--- a/po/be.po
+++ b/po/be.po
@@ -3924,7 +3924,7 @@ msgstr "Запыт адраснай кнігі..."
#, c-format
msgid "There is one other contact."
msgid_plural "There are %d other contacts."
-msgstr[0] "Тут адзін іншы кантакт."
+msgstr[0] "Тут %d адзін іншы кантакт."
msgstr[1] "Тут %d іншыя кантакты."
msgstr[2] "Тут %d іншых кантактаў."
@@ -6448,7 +6448,7 @@ msgstr "Укладзенае паведамленьне - %s"
#, c-format
msgid "Attached message"
msgid_plural "%d attached messages"
-msgstr[0] "Укладзенае паведамленьне"
+msgstr[0] "%d укладзенае паведамленьне"
msgstr[1] "%d укладзеныя паведамленьні"
msgstr[2] "%d укладзеных паведамленьняў"
@@ -8084,7 +8084,7 @@ msgstr "Так. (Комплекснае паўтарэньне)"
#, c-format
msgid "Every day"
msgid_plural "Every %d days"
-msgstr[0] "Штодзень"
+msgstr[0] "%d Штодзень"
msgstr[1] "Кожныя %d дні"
msgstr[2] "Кожныя %d дзён"
@@ -8092,7 +8092,7 @@ msgstr[2] "Кожныя %d дзён"
#, c-format
msgid "Every week"
msgid_plural "Every %d weeks"
-msgstr[0] "Штотыдзень"
+msgstr[0] "%d Штотыдзень"
msgstr[1] "Кожныя %d тыдні"
msgstr[2] "Кожныя %d тыдняў"
@@ -8100,7 +8100,7 @@ msgstr[2] "Кожныя %d тыдняў"
#, c-format
msgid "Every week on "
msgid_plural "Every %d weeks on "
-msgstr[0] "Штотыдзень на "
+msgstr[0] "%d Штотыдзень на "
msgstr[1] "Кожныя %d тыдні на "
msgstr[2] "Кожныя %d тыдняў на "
@@ -8123,7 +8123,7 @@ msgstr "%s %s"
#, c-format
msgid "every month"
msgid_plural "every %d months"
-msgstr[0] "штомесяц"
+msgstr[0] "%d штомесяц"
msgstr[1] "кожныя %d месяцы"
msgstr[2] "кожны %d месяцаў"
@@ -8131,7 +8131,7 @@ msgstr[2] "кожны %d месяцаў"
#, c-format
msgid "Every year"
msgid_plural "Every %d years"
-msgstr[0] "Штогод"
+msgstr[0] "%d Штогод"
msgstr[1] "Кожныя %d гады"
msgstr[2] "Кожныя %d год"
@@ -11744,7 +11744,7 @@ msgstr ""
#, c-format
msgid "1 second ago"
msgid_plural "%d seconds ago"
-msgstr[0] "1 сэкунда таму"
+msgstr[0] "%d сэкунда таму"
msgstr[1] "%d сэкунды таму"
msgstr[2] "%d сэкундаў таму"
@@ -11760,7 +11760,7 @@ msgstr[2] ""
#, c-format
msgid "1 minute ago"
msgid_plural "%d minutes ago"
-msgstr[0] "1 хвіліна таму"
+msgstr[0] "%d хвіліна таму"
msgstr[1] "%d хвіліны таму"
msgstr[2] "%d хвілінаў таму"
@@ -11776,7 +11776,7 @@ msgstr[2] "Я зараз на працы"
#, c-format
msgid "1 hour ago"
msgid_plural "%d hours ago"
-msgstr[0] "1 гадзіна таму"
+msgstr[0] "%d гадзіна таму"
msgstr[1] "%d гадзіны таму"
msgstr[2] "%d гадзінаў таму"
@@ -11792,7 +11792,7 @@ msgstr[2] ""
#, c-format
msgid "1 day ago"
msgid_plural "%d days ago"
-msgstr[0] "1 дзень таму"
+msgstr[0] "%d дзень таму"
msgstr[1] "%d дені таму"
msgstr[2] "%d дзень таму"
@@ -11808,7 +11808,7 @@ msgstr[2] "Я зараз на працы"
#, c-format
msgid "1 week ago"
msgid_plural "%d weeks ago"
-msgstr[0] "1 тыдзень таму"
+msgstr[0] "%d тыдзень таму"
msgstr[1] "%d тыдні таму"
msgstr[2] "%d тыдняў таму"
@@ -11824,7 +11824,7 @@ msgstr[2] ""
#, c-format
msgid "1 month ago"
msgid_plural "%d months ago"
-msgstr[0] "1 месяц таму"
+msgstr[0] "%d месяц таму"
msgstr[1] "%d месяцы таму"
msgstr[2] "%d месяцаў таму"
@@ -11840,7 +11840,7 @@ msgstr[2] "Я зараз на працы"
#, c-format
msgid "1 year ago"
msgid_plural "%d years ago"
-msgstr[0] "1 год таму"
+msgstr[0] "%d год таму"
msgstr[1] "%d годы таму"
msgstr[2] "%d гадоў таму"
diff --git a/po/mai.po b/po/mai.po
index 9a7d10a31d..9a7d10a31d 100755..100644
--- a/po/mai.po
+++ b/po/mai.po
diff --git a/shell/Evolution-Component.idl b/shell/Evolution-Component.idl
deleted file mode 100644
index ccf806ff91..0000000000
--- a/shell/Evolution-Component.idl
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Interface for the Evolution components.
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 2003 Ximian, Inc.
- */
-
-#ifndef _GNOME_EVOLUTION_COMPONENT_IDL
-#define _GNOME_EVOLUTION_COMPONENT_IDL
-
-#include <Bonobo.idl>
-
-#ifndef __evolution_shell_COMPILATION
-#ifdef __ORBIT_IDL__
-%{
-#pragma include_defs shell/evolution-component.h
-%}
-#pragma inhibit push
-#endif
-#endif
-
-module GNOME {
-module Evolution {
- enum CreatableItem {
- CREATABLE_OBJECT,
- CREATABLE_FOLDER
- };
- enum ShellState {
- USER_OFFLINE,
- FORCED_OFFLINE,
- USER_ONLINE
- };
-
- /* A type of item that the component can create when asked by the user,
- e.g. a mail message or an appointment. */
- struct CreatableItemType {
- string id;
- string description;
- string menuDescription;
- string tooltip;
- char menuShortcut;
- string iconName;
- CreatableItem type;
- };
- typedef sequence <CreatableItemType> CreatableItemTypeList;
-
- interface ComponentView : Bonobo::Unknown {
- void getControls (out Bonobo::Control sidebar_control,
- out Bonobo::Control view_control,
- out Bonobo::Control statusbar_control);
- };
-
- interface Listener : Bonobo::Unknown {
- /* Indicate the change of state is complete */
- void complete();
- };
-
- interface Component : Bonobo::Unknown {
- exception Failed {};
- exception UnknownType {};
- /* We don't know about the old version we're upgrading from */
- exception UnsupportedVersion {};
- /* We encountered a non-recoverable, fatal error, explain why */
- exception UpgradeFailed {
- string what;
- string why;
- };
-
- /*** Upgrade path. ***/
-
- void upgradeFromVersion (in short major, in short minor, in short revision)
- raises (UnsupportedVersion, UpgradeFailed);
-
- /*** Basic functionality. ***/
- ComponentView createView(in ShellView parent,
- in boolean select_item)
- raises (Failed);
-
-
- /* Check if the component can quit.
- Do not perform any quit-related tasks however.
- May be called multiple times, depending on user interaction. */
- boolean requestQuit ();
-
- /* Ask the component to quit. Returns TRUE when the
- component has completed any closing-down tasks, and
- is ready to exit(). This will be called repeatedly
- at intervals until it returns TRUE. */
- boolean quit ();
-
- /* Notify the component of whether the shell is currently
- running in interactive mode or not. (I.e. basically,
- whether there are any Evolution windows on the screen.)
- @new_view_xid is an X Window ID ("None" if @now_interactive
- is FALSE) */
- void interactive (in boolean now_interactive,
- in unsigned long new_view_xid);
-
-
- /*** The following stuff is needed to build the "New" toolbar
- item as well as the "File -> New" submenu. ***/
-
- /* List of creatable items. */
- readonly attribute CreatableItemTypeList userCreatableItems;
-
- /* Pop up a new editing dialog for the item with the specified
- @item_type_name. */
- void requestCreateItem (in string item_type_name)
- raises (UnknownType, Failed);
-
-
- /*** URI handling (e.g. for the command-line, "evolution
- mailto:foo@bar.org") ***/
- void handleURI (in string uri);
-
-
- /*** Send/receive. ***/
-
- void sendAndReceive ();
-
- /* Set the online status of the component asynchronously */
-
- void setLineStatus(in ShellState shell_state, in Listener listener);
- };
-
-};
-};
-
-#ifndef __evolution_shell_COMPILATION
-#ifdef __ORBIT_IDL__
-#pragma inhibit pop
-#endif
-#endif
-#endif /* _GNOME_EVOLUTION_COMPONENT_IDL */
diff --git a/shell/Evolution-ConfigControl.idl b/shell/Evolution-ConfigControl.idl
deleted file mode 100644
index 901932d209..0000000000
--- a/shell/Evolution-ConfigControl.idl
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Additional interfaces for the Controls used in configuration dialogs.
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 2002 Ximian, Inc.
- */
-
-#ifndef _GNOME_EVOLUTION_CONFIGCONTROL_IDL
-#define _GNOME_EVOLUTION_CONFIGCONTROL_IDL
-
-module GNOME {
-module Evolution {
- interface ConfigControl : Bonobo::Unknown {
- /* The actual Control. */
- readonly attribute Bonobo::Control control;
-
- /* Get the event source for this control. */
- readonly attribute Bonobo::EventSource eventSource;
- };
-}; /* module Evolution */
-}; /* module GNOME */
-
-#endif
diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl
deleted file mode 100644
index d39ec8edeb..0000000000
--- a/shell/Evolution-Shell.idl
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Interface for the Evolution shell.
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 2000, 2001 Ximian, Inc.
- */
-
-#ifndef _GNOME_EVOLUTION_SHELL_IDL
-#define _GNOME_EVOLUTION_SHELL_IDL
-
-#include <Bonobo.idl>
-
-#ifndef __evolution_shell_COMPILATION
-#ifdef __ORBIT_IDL__
-%{
-#pragma include_defs shell/evolution-component.h
-%}
-#pragma inhibit push
-#endif
-#endif
-
-module GNOME {
-module Evolution {
-
-
- interface ShellView : Bonobo::Unknown {
- /* Should really use a ComponentView i guess */
- void setTitle(in string component, in string title);
- void setComponent(in string component);
- void setButtonIcon(in string component, in string iconName);
- };
-
- interface Shell : Bonobo::Unknown {
- exception Busy {};
- exception ComponentNotFound {};
- exception InternalError {};
- exception InvalidURI {};
- exception NotFound {};
- exception NotReady {};
- exception UnsupportedSchema {};
-
- /**
- * createNewWindow:
- * @component_id: id or alias of the component to display in the new window.
- *
- */
- ShellView createNewWindow (in string component_id)
- raises (NotReady, ComponentNotFound, UnsupportedSchema, InternalError);
-
- /**
- * handleURI:
- * @uri: URI to handle
- *
- * This handles the specified URI. It is different from
- * `::createNewView' as it doesn't necessarily imply creating a
- * new ShellView. (For example, a `mailto:' URI will invoke
- * the message composer.)
- */
- void handleURI (in string uri)
- raises (NotReady, ComponentNotFound, NotFound, UnsupportedSchema, InvalidURI, InternalError);
-
- /**
- * setLineStatus:
- *
- * Set the shell into on-line or off-line mode.
- */
- void setLineStatus (in boolean online)
- raises (NotReady);
-
- /*
- * Lookup a component by id.
- */
- /*Component findComponent(in string id)
- raises (NotReady, ComponentNotFound);*/
- };
-};
-};
-
-#ifndef __evolution_shell_COMPILATION
-#ifdef __ORBIT_IDL__
-#pragma inhibit pop
-#endif
-#endif
-#endif /* _GNOME_EVOLUTION_SHELL_IDL */
diff --git a/shell/Evolution.idl b/shell/Evolution.idl
deleted file mode 100644
index 059d017444..0000000000
--- a/shell/Evolution.idl
+++ /dev/null
@@ -1,20 +0,0 @@
-/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * CORBA interface for the Evolution shell.
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 2000, 2001 Ximian, Inc.
- */
-
-#ifndef _GNOME_EVOLUTION_IDL
-#define _GNOME_EVOLUTION_IDL
-
-#include <Bonobo.idl>
-
-#include <Evolution-ConfigControl.idl>
-#include <Evolution-Shell.idl>
-#include <Evolution-Component.idl>
-
-#endif
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 6d47f6e933..07409baf9e 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -3,7 +3,9 @@ SUBDIRS = . test
endif
INCLUDES = \
+ -I$(top_srcdir)/e-util \
-I$(top_srcdir)/widgets \
+ -I$(top_srcdir)/widgets/menus \
-I$(top_srcdir)/widgets/misc \
-I$(top_srcdir) \
-I$(top_srcdir)/shell \
@@ -11,8 +13,11 @@ INCLUDES = \
-DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
+ -DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_HELPDIR=\""$(evolutionhelpdir)"\" \
+ -DEVOLUTION_MODULEDIR=\""$(moduledir)"\" \
+ -DEVOLUTION_RULEDIR=\""$(privdatadir)"\" \
-DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \
-DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \
-DPREFIX=\""$(prefix)"\" \
@@ -25,32 +30,6 @@ INCLUDES = \
noinst_PROGRAMS = evolution
-# Shell CORBA stuff
-
-IDLS = \
- Evolution-ConfigControl.idl \
- Evolution-Component.idl \
- Evolution-Shell.idl \
- Evolution.idl
-
-IDL_GENERATED_H = \
- Evolution.h
-
-IDL_GENERATED_C = \
- Evolution-common.c \
- Evolution-skels.c \
- Evolution-stubs.c
-
-idl_defines = \
- -D__evolution_shell_COMPILATION
-
-IDL_GENERATED = $(IDL_GENERATED_H) $(IDL_GENERATED_C)
-
-$(IDL_GENERATED_H): $(IDLS)
- $(ORBIT_IDL) -I $(srcdir) $(idl_defines) $(IDL_INCLUDES) $(srcdir)/Evolution.idl
-
-$(IDL_GENERATED_C): $(IDL_GENERATED_H)
-
if NM_SUPPORT
NM_SUPPORT_FILES = e-shell-nm.c
endif
@@ -72,10 +51,6 @@ $(DATASERVER_IDL_GENERATED_H): $(DATASERVER_IDL)
$(DATASERVER_IDL_GENERATED_C): $(DATASERVER_IDL_GENERATED_H)
-# IDL install
-
-idl_DATA = $(IDLS)
-
# Shell library
privsolib_LTLIBRARIES = \
@@ -84,31 +59,48 @@ privsolib_LTLIBRARIES = \
eshellincludedir = $(privincludedir)/shell
eshellinclude_HEADERS = \
- Evolution.h \
- e-component-view.h \
- e-user-creatable-items-handler.h \
- evolution-config-control.h \
- evolution-component.h \
- evolution-listener.h \
- evolution-shell-component-utils.h \
- es-event.h \
- es-menu.h
+ e-shell.h \
+ e-shell-backend.h \
+ e-shell-common.h \
+ e-shell-content.h \
+ e-shell-settings.h \
+ e-shell-sidebar.h \
+ e-shell-switcher.h \
+ e-shell-taskbar.h \
+ e-shell-view.h \
+ e-shell-window.h \
+ es-event.h
libeshell_la_SOURCES = \
+ $(NM_SUPPORT_FILES) \
$(IDL_GENERATED) \
- e-component-view.c \
- evolution-component.c \
- evolution-listener.c \
- e-user-creatable-items-handler.c \
- evolution-config-control.c \
- evolution-shell-component-utils.c \
- $(eshellinclude_HEADERS)
+ e-shell.c \
+ e-shell-backend.c \
+ e-shell-content.c \
+ e-shell-settings.c \
+ e-shell-sidebar.c \
+ e-shell-switcher.c \
+ e-shell-taskbar.c \
+ e-shell-view.c \
+ e-shell-window.c \
+ e-shell-window-private.c \
+ e-shell-window-private.h \
+ $(eshellinclude_HEADERS) \
+ e-shell-importer.c \
+ e-shell-importer.h \
+ e-shell-migrate.c \
+ e-shell-migrate.h \
+ e-shell-window-actions.h \
+ e-shell-window-actions.c \
+ es-event.c
libeshell_la_LDFLAGS = $(NO_UNDEFINED)
libeshell_la_LIBADD = \
$(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/filter/libfilter.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/widgets/menus/libmenus.la \
$(SHELL_LIBS)
# Evolution executable
@@ -119,35 +111,14 @@ endif
evolution_SOURCES = \
$(DATASERVER_IDL_GENERATED) \
- $(NM_SUPPORT_FILES) \
- e-component-registry.c \
- e-component-registry.h \
e-config-upgrade.c \
e-config-upgrade.h \
- e-corba-config-page.c \
- e-corba-config-page.h \
- e-shell.c \
- e-shell.h \
- e-shell-constants.h \
- e-shell-importer.c \
- e-shell-importer.h \
- e-shell-settings-dialog.c \
- e-shell-settings-dialog.h \
- e-shell-window-commands.c \
- e-shell-window-commands.h \
- e-shell-window.c \
- e-shell-window.h \
- e-shell-view.c \
- e-shell-view.h \
- e-sidebar.c \
- e-sidebar.h \
- es-event.c \
- es-menu.c \
main.c
evolution_LDADD = \
libeshell.la \
$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la \
+ $(top_builddir)/widgets/menus/libmenus.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
$(top_builddir)/e-util/libeutil.la \
$(TZDIALOG_LIBS) \
@@ -160,17 +131,11 @@ endif
# Misc stuff
-server_in_files = GNOME_Evolution_Shell.server.in.in
-server_DATA = $(server_in_files:.server.in.in=.server)
-@EVO_SERVER_RULE@
-@INTLTOOL_SERVER_RULE@
-
error_DATA = shell.error
errordir = $(privdatadir)/errors
@EVO_PLUGIN_RULE@
glade_DATA = \
- e-active-connection-dialog.glade \
import.glade
# GConf schemas
@@ -228,8 +193,6 @@ endif
# Extra dist stuff
EXTRA_DIST = \
- $(IDLS) \
- $(server_in_files) \
shell.error.xml \
$(glade_DATA) \
$(schema_in_files) \
@@ -255,7 +218,7 @@ evolution.pure: evolution
endif
-BUILT_SOURCES = $(IDL_GENERATED) $(server_DATA) $(DATASERVER_IDL_GENERATED) $(error_DATA)
+BUILT_SOURCES = $(server_DATA) $(DATASERVER_IDL_GENERATED) $(error_DATA)
CLEANFILES = $(BUILT_SOURCES)
DISTCLEANFILES = $(schema_DATA)
diff --git a/shell/apps_evolution_shell.schemas.in b/shell/apps_evolution_shell.schemas.in
index c5c6276c25..c908de65e5 100644
--- a/shell/apps_evolution_shell.schemas.in
+++ b/shell/apps_evolution_shell.schemas.in
@@ -99,8 +99,8 @@
<!-- View defaults -->
<schema>
- <key>/schemas/apps/evolution/shell/view_defaults/width</key>
- <applyto>/apps/evolution/shell/view_defaults/width</applyto>
+ <key>/schemas/apps/evolution/shell/view_defaults/window_width</key>
+ <applyto>/apps/evolution/shell/view_defaults/window_width</applyto>
<owner>evolution</owner>
<type>int</type>
<default>640</default>
@@ -111,8 +111,8 @@
</schema>
<schema>
- <key>/schemas/apps/evolution/shell/view_defaults/height</key>
- <applyto>/apps/evolution/shell/view_defaults/height</applyto>
+ <key>/schemas/apps/evolution/shell/view_defaults/window_height</key>
+ <applyto>/apps/evolution/shell/view_defaults/window_height</applyto>
<owner>evolution</owner>
<type>int</type>
<default>480</default>
@@ -123,20 +123,8 @@
</schema>
<schema>
- <key>/schemas/apps/evolution/shell/view_defaults/maximized</key>
- <applyto>/apps/evolution/shell/view_defaults/maximized</applyto>
- <owner>evolution</owner>
- <type>bool</type>
- <default>TRUE</default>
- <locale name="C">
- <short>Default window state</short>
- <long>Whether or not the window should be maximized.</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/evolution/shell/view_defaults/maximized</key>
- <applyto>/apps/evolution/shell/view_defaults/maximized</applyto>
+ <key>/schemas/apps/evolution/shell/view_defaults/window_maximized</key>
+ <applyto>/apps/evolution/shell/view_defaults/window_maximized</applyto>
<owner>evolution</owner>
<type>bool</type>
<default>TRUE</default>
diff --git a/shell/e-active-connection-dialog.glade b/shell/e-active-connection-dialog.glade
deleted file mode 100644
index 534a7948f7..0000000000
--- a/shell/e-active-connection-dialog.glade
+++ /dev/null
@@ -1,193 +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="active_connection_dialog">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Active Connections</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
- <property name="modal">False</property>
- <property name="default_width">256</property>
- <property name="default_height">192</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">False</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox2">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area2">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="cancelbutton1">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="okbutton1">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox2">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Active Connections&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label2">
- <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.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="GtkVBox" id="vbox3">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_NEVER</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="active_connection_treeview">
- <property name="visible">True</property>
- <property name="headers_visible">True</property>
- <property name="rules_hint">False</property>
- <property name="reorderable">False</property>
- <property name="enable_search">True</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="GtkLabel" id="instruction_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Click OK to close these connections and go offline</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="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>
- </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>
-
-</glade-interface>
diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c
deleted file mode 100644
index 18092979d2..0000000000
--- a/shell/e-component-registry.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-component-registry.h"
-
-#include <glib/gi18n.h>
-
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-exception.h>
-
-#include <string.h>
-#include <stdlib.h>
-
-struct _EComponentRegistryPrivate {
- GSList *infos;
-
- guint init:1;
-};
-
-G_DEFINE_TYPE (EComponentRegistry, e_component_registry, G_TYPE_OBJECT)
-
-/* EComponentInfo handling. */
-
-static EComponentInfo *
-component_info_new (const char *id,
- GNOME_Evolution_Component iface,
- const char *alias,
- const char *button_label,
- const char *button_tooltips,
- const char *menu_label,
- const char *menu_accelerator,
- const char *icon_name,
- int sort_order)
-{
- EComponentInfo *info = g_new0 (EComponentInfo, 1);
-
- info->id = g_strdup (id);
- info->iface = bonobo_object_dup_ref(iface, NULL);
- info->alias = g_strdup (alias);
- info->button_label = g_strdup (button_label);
- info->button_tooltips = g_strdup (button_tooltips);
- info->menu_label = g_strdup (menu_label);
- info->menu_accelerator = g_strdup (menu_accelerator);
- info->icon_name = g_strdup (icon_name);
- info->sort_order = sort_order;
-
- return info;
-}
-
-static void
-component_info_free (EComponentInfo *info)
-{
- g_free (info->id);
- g_free (info->alias);
- g_free (info->button_label);
- g_free (info->button_tooltips);
- g_free (info->menu_label);
- g_free (info->menu_accelerator);
-
- if (info->iface != NULL)
- bonobo_object_release_unref (info->iface, NULL);
-
- g_slist_foreach (info->uri_schemas, (GFunc) g_free, NULL);
- g_slist_free (info->uri_schemas);
-
- g_free (info);
-}
-
-static int
-component_info_compare_func (EComponentInfo *a,
- EComponentInfo *b)
-{
- if (a->sort_order != b->sort_order)
- return a->sort_order - b->sort_order;
-
- return strcmp (a->button_label, b->button_label);
-}
-
-
-/* Utility methods. */
-
-static void
-set_schemas (EComponentInfo *component_info,
- Bonobo_ServerInfo *server_info)
-{
- Bonobo_ActivationProperty *property = bonobo_server_info_prop_find (server_info, "evolution:uri_schemas");
- Bonobo_StringList *list;
- int i;
-
- if (property == NULL)
- return;
-
- if (property->v._d != Bonobo_ACTIVATION_P_STRINGV) {
- CORBA_free (property);
- return;
- }
-
- list = & property->v._u.value_stringv;
-
- for (i = 0; i < list->_length; i ++)
- component_info->uri_schemas = g_slist_prepend (component_info->uri_schemas, g_strdup (list->_buffer [i]));
-
- CORBA_free (property);
-}
-
-static void
-query_components (EComponentRegistry *registry)
-{
- Bonobo_ServerInfoList *info_list;
- const gchar * const *language_names;
- CORBA_Environment ev;
- GSList *languages = NULL;
- char *query;
- int i;
-
- if (registry->priv->init)
- return;
-
- registry->priv->init = TRUE;
-
- CORBA_exception_init (&ev);
- query = g_strdup_printf ("repo_ids.has ('IDL:GNOME/Evolution/Component:%s')", BASE_VERSION);
- info_list = bonobo_activation_query (query, NULL, &ev);
- g_free (query);
-
- if (BONOBO_EX (&ev)) {
- char *ex_text = bonobo_exception_get_text (&ev);
- g_warning ("Cannot query for components: %s\n", ex_text);
- g_free (ex_text);
- CORBA_exception_free (&ev);
- return;
- }
-
- language_names = g_get_language_names ();
- while (*language_names != NULL)
- languages = g_slist_append (languages, (gpointer)(*language_names++));
-
- for (i = 0; i < info_list->_length; i++) {
- const char *id;
- const char *label;
- const char *menu_label;
- const char *menu_accelerator;
- const char *alias;
- const char *icon_name;
- const char *sort_order_string;
- const char *tooltips;
- EComponentInfo *info;
- int sort_order;
- GNOME_Evolution_Component iface;
-
- id = info_list->_buffer[i].iid;
- iface = bonobo_activation_activate_from_id ((char *)id, 0, NULL, &ev);
- if (BONOBO_EX (&ev) || iface == CORBA_OBJECT_NIL) {
- char *ex_text = bonobo_exception_get_text (&ev);
-
- g_warning("Cannot activate '%s': %s\n", id, ex_text);
- g_free(ex_text);
- CORBA_exception_free(&ev);
- CORBA_exception_init(&ev);
- continue;
- }
-
- label = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_label", languages);
-
- tooltips = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_tooltips", languages);
-
- menu_label = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:menu_label", languages);
-
- menu_accelerator = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:menu_accelerator", languages);
-
- alias = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:component_alias", NULL);
-
- icon_name = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_icon", NULL);
-
- sort_order_string = bonobo_server_info_prop_lookup (& info_list->_buffer[i],
- "evolution:button_sort_order", NULL);
- if (sort_order_string == NULL)
- sort_order = 0;
- else
- sort_order = atoi (sort_order_string);
-
- info = component_info_new (id, iface, alias, label, tooltips, menu_label,
- menu_accelerator, icon_name, sort_order);
- set_schemas (info, & info_list->_buffer [i]);
-
- registry->priv->infos = g_slist_prepend (registry->priv->infos, info);
-
- bonobo_object_release_unref(iface, NULL);
- }
- g_slist_free(languages);
-
- CORBA_free (info_list);
- CORBA_exception_free (&ev);
-
- registry->priv->infos = g_slist_sort (registry->priv->infos,
- (GCompareFunc) component_info_compare_func);
-}
-
-
-/* GObject methods. */
-
-static void
-impl_finalize (GObject *object)
-{
- EComponentRegistry *component_registry;
- EComponentRegistryPrivate *priv;
-
- component_registry = E_COMPONENT_REGISTRY (object);
- priv = component_registry->priv;
-
- g_slist_foreach (priv->infos, (GFunc) component_info_free, NULL);
- g_free (priv);
-
- (* G_OBJECT_CLASS (e_component_registry_parent_class)->finalize) (object);
-}
-
-
-static void
-e_component_registry_class_init (EComponentRegistryClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = impl_finalize;
-}
-
-
-static void
-e_component_registry_init (EComponentRegistry *registry)
-{
- registry->priv = g_new0 (EComponentRegistryPrivate, 1);
-}
-
-
-EComponentRegistry *
-e_component_registry_new (void)
-{
- return g_object_new (e_component_registry_get_type (), NULL);
-}
-
-
-GSList *
-e_component_registry_peek_list (EComponentRegistry *registry)
-{
- g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), NULL);
-
- query_components(registry);
-
- return registry->priv->infos;
-}
-
-
-EComponentInfo *
-e_component_registry_peek_info (EComponentRegistry *registry,
- enum _EComponentRegistryField field,
- const char *key)
-{
- GSList *p, *q;
-
- g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), NULL);
-
- query_components(registry);
-
- for (p = registry->priv->infos; p != NULL; p = p->next) {
- EComponentInfo *info = p->data;
-
- switch (field) {
- case ECR_FIELD_ID:
- if (info->id && (strcmp (info->id, key) == 0))
- return info;
- break;
- case ECR_FIELD_ALIAS:
- if (info->alias && (strcmp (info->alias, key) == 0))
- return info;
- break;
- case ECR_FIELD_SCHEMA:
- for (q = info->uri_schemas; q != NULL; q = q->next)
- if (strcmp((char *)q->data, key) == 0)
- return info;
- break;
- }
- }
-
- return NULL;
-}
-
-GNOME_Evolution_Component
-e_component_registry_activate (EComponentRegistry *registry,
- const char *id,
- CORBA_Environment *ev)
-{
- EComponentInfo *info;
-
- g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), CORBA_OBJECT_NIL);
-
- info = e_component_registry_peek_info (registry, ECR_FIELD_ID, id);
- if (info == NULL) {
- g_warning ("%s - Unknown id \"%s\"", G_STRFUNC, id);
- return CORBA_OBJECT_NIL;
- }
-
- /* it isn't in the registry unless it is already activated */
- return bonobo_object_dup_ref (info->iface, NULL);
-}
diff --git a/shell/e-component-registry.h b/shell/e-component-registry.h
deleted file mode 100644
index 927fcf0120..0000000000
--- a/shell/e-component-registry.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef __E_COMPONENT_REGISTRY_H__
-#define __E_COMPONENT_REGISTRY_H__
-
-
-#include "Evolution.h"
-
-#include <glib-object.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-
-#define E_TYPE_COMPONENT_REGISTRY (e_component_registry_get_type ())
-#define E_COMPONENT_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_COMPONENT_REGISTRY, EComponentRegistry))
-#define E_COMPONENT_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_COMPONENT_REGISTRY, EComponentRegistryClass))
-#define E_IS_COMPONENT_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_COMPONENT_REGISTRY))
-#define E_IS_COMPONENT_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_COMPONENT_REGISTRY))
-
-
-typedef struct _EComponentRegistry EComponentRegistry;
-typedef struct _EComponentRegistryPrivate EComponentRegistryPrivate;
-typedef struct _EComponentRegistryClass EComponentRegistryClass;
-
-struct _EComponentRegistry {
- GObject parent;
-
- EComponentRegistryPrivate *priv;
-};
-
-struct _EComponentRegistryClass {
- GObjectClass parent_class;
-};
-
-enum _EComponentRegistryField {
- ECR_FIELD_ID,
- ECR_FIELD_ALIAS,
- ECR_FIELD_SCHEMA
-};
-
-struct _EComponentInfo {
- char *id;
-
- char *alias;
-
- /* NULL if not activated. */
- GNOME_Evolution_Component iface;
-
- char *button_label;
- char *button_tooltips;
- char *menu_label;
- char *menu_accelerator;
- char *icon_name;
-
- int sort_order;
-
- /* List of URI schemas that this component supports. */
- GSList *uri_schemas; /* <char *> */
-};
-typedef struct _EComponentInfo EComponentInfo;
-
-
-GType e_component_registry_get_type (void);
-EComponentRegistry *e_component_registry_new (void);
-
-GSList *e_component_registry_peek_list (EComponentRegistry *registry);
-EComponentInfo *e_component_registry_peek_info (EComponentRegistry *registry,
- enum _EComponentRegistryField type,
- const char *key);
-
-GNOME_Evolution_Component e_component_registry_activate (EComponentRegistry *registry,
- const char *id,
- CORBA_Environment *ev);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_COMPONENT_REGISTRY_H__ */
diff --git a/shell/e-component-view.c b/shell/e-component-view.c
deleted file mode 100644
index b87078e974..0000000000
--- a/shell/e-component-view.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Helper class for evolution components to setup a view
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-
-#include "e-component-view.h"
-
-#include "bonobo/bonobo-control.h"
-
-static BonoboObjectClass *parent_class = NULL;
-
-static void
-impl_ComponentView_getControls(PortableServer_Servant servant,
- Bonobo_Control *side_control,
- Bonobo_Control *view_control,
- Bonobo_Control *statusbar_control,
- CORBA_Environment *ev)
-{
- EComponentView *ecv = (EComponentView *)bonobo_object_from_servant(servant);
-
- *side_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->side_control), ev);
- *view_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->view_control), ev);
- *statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->statusbar_control), ev);
-}
-
-/* GObject methods. */
-
-static void
-impl_dispose (GObject *object)
-{
- EComponentView *ecv = (EComponentView *)object;
-
- ecv->side_control = NULL;
- ecv->view_control = NULL;
- ecv->statusbar_control = NULL;
-
- ((GObjectClass *)parent_class)->dispose(object);
-}
-
-static void
-impl_finalise (GObject *object)
-{
- EComponentView *ecv = (EComponentView *)object;
-
- g_free(ecv->id);
-
- ((GObjectClass *)parent_class)->finalize(object);
-}
-
-static void
-e_component_view_class_init (EComponentViewClass *klass)
-{
- GObjectClass *object_class;
- POA_GNOME_Evolution_ComponentView__epv *epv;
-
- parent_class = g_type_class_ref(bonobo_object_get_type());
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalise;
-
- epv = & klass->epv;
- epv->getControls = impl_ComponentView_getControls;
-}
-
-static void
-e_component_view_init (EComponentView *shell)
-{
-}
-
-EComponentView *e_component_view_new(GNOME_Evolution_ShellView parent, const char *id, struct _GtkWidget *side, struct _GtkWidget *view, struct _GtkWidget *statusbar)
-{
- EComponentView *new = g_object_new (e_component_view_get_type (), NULL);
- CORBA_Environment ev = { NULL };
-
- new->id = g_strdup(id);
- new->shell_view = CORBA_Object_duplicate(parent, &ev);
- CORBA_exception_free(&ev);
-
- /* FIXME: hook onto destroys */
- new->side_control = bonobo_control_new(side);
- new->view_control = bonobo_control_new(view);
- new->statusbar_control = bonobo_control_new(statusbar);
-
- return new;
-}
-
-EComponentView *e_component_view_new_controls(GNOME_Evolution_ShellView parent, const char *id, BonoboControl *side, BonoboControl *view, BonoboControl *statusbar)
-{
- EComponentView *new = g_object_new (e_component_view_get_type (), NULL);
- CORBA_Environment ev = { NULL };
-
- new->id = g_strdup(id);
- new->shell_view = CORBA_Object_duplicate(parent, &ev);
- CORBA_exception_free(&ev);
-
- /* FIXME: hook onto destroys */
- new->side_control = side;
- new->view_control = view;
- new->statusbar_control = statusbar;
-
- return new;
-}
-
-void
-e_component_view_set_title(EComponentView *ecv, const char *title)
-{
- CORBA_Environment ev = { NULL };
-
- /* save roundtrips, check title is the same */
- GNOME_Evolution_ShellView_setTitle(ecv->shell_view, ecv->id, title, &ev);
- CORBA_exception_free(&ev);
-}
-
-void
-e_component_view_set_button_icon (EComponentView *ecv, const char *iconName)
-{
- CORBA_Environment ev = { NULL };
-
- /* save roundtrips, check title is the same */
- GNOME_Evolution_ShellView_setButtonIcon(ecv->shell_view, ecv->id, iconName, &ev);
- CORBA_exception_free(&ev);
-}
-
-BONOBO_TYPE_FUNC_FULL (EComponentView, GNOME_Evolution_ComponentView, bonobo_object_get_type(), e_component_view)
-
diff --git a/shell/e-component-view.h b/shell/e-component-view.h
deleted file mode 100644
index 51004e489e..0000000000
--- a/shell/e-component-view.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_COMPONENT_VIEW_H_
-#define _E_COMPONENT_VIEW_H_
-
-#include <bonobo/bonobo-object.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-struct _GtkWidget;
-
-typedef struct _EComponentView EComponentView;
-typedef struct _EComponentViewPrivate EComponentViewPrivate;
-typedef struct _EComponentViewClass EComponentViewClass;
-
-#include "Evolution.h"
-
-#define E_TYPE_COMPONENT_VIEW (e_component_view_get_type ())
-#define E_COMPONENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_COMPONENT_VIEW, EComponentView))
-#define E_COMPONENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_COMPONENT_VIEW, EComponentViewClass))
-#define E_IS_COMPONENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_COMPONENT_VIEW))
-#define E_IS_COMPONENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_COMPONENT_VIEW))
-
-struct _EComponentView {
- BonoboObject parent;
-
- EComponentViewPrivate *priv;
-
- char *id;
- GNOME_Evolution_ShellView shell_view;
-
- struct _BonoboControl *side_control;
- struct _BonoboControl *view_control;
- struct _BonoboControl *statusbar_control;
-};
-
-struct _EComponentViewClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_ComponentView__epv epv;
-};
-
-GType e_component_view_get_type(void);
-EComponentView *e_component_view_new(GNOME_Evolution_ShellView shell_view, const char *id, struct _GtkWidget *side, struct _GtkWidget *view, struct _GtkWidget *status);
-EComponentView *e_component_view_new_controls(GNOME_Evolution_ShellView parent, const char *id, struct _BonoboControl *side, struct _BonoboControl *view, struct _BonoboControl *statusbar);
-
-void e_component_view_set_title(EComponentView *ecv, const char *title);
-void e_component_view_set_button_icon (EComponentView *ecv, const char *iconName);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_COMPONENT_VIEW_H_ */
-
diff --git a/shell/e-corba-config-page.c b/shell/e-corba-config-page.c
deleted file mode 100644
index f0fc89298c..0000000000
--- a/shell/e-corba-config-page.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-corba-config-page.h"
-
-#include "Evolution.h"
-
-#include <string.h>
-
-#include <bonobo/bonobo-widget.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-listener.h>
-
-
-struct _ECorbaConfigPagePrivate {
- GNOME_Evolution_ConfigControl config_control_interface;
-};
-
-G_DEFINE_TYPE (ECorbaConfigPage, e_corba_config_page, E_TYPE_CONFIG_PAGE)
-
-/* GObject methods. */
-
-static void
-impl_dispose (GObject *object)
-{
- ECorbaConfigPage *corba_config_page;
- ECorbaConfigPagePrivate *priv;
- CORBA_Environment ev;
-
- corba_config_page = E_CORBA_CONFIG_PAGE (object);
- priv = corba_config_page->priv;
-
- CORBA_exception_init (&ev);
-
- if (priv->config_control_interface != CORBA_OBJECT_NIL) {
- bonobo_object_release_unref (priv->config_control_interface, &ev);
- priv->config_control_interface = CORBA_OBJECT_NIL;
- }
-
- CORBA_exception_free (&ev);
-
- (* G_OBJECT_CLASS (e_corba_config_page_parent_class)->dispose) (object);
-}
-
-static void
-impl_finalize (GObject *object)
-{
- ECorbaConfigPage *corba_config_page;
- ECorbaConfigPagePrivate *priv;
-
- corba_config_page = E_CORBA_CONFIG_PAGE (object);
- priv = corba_config_page->priv;
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (e_corba_config_page_parent_class)->finalize) (object);
-}
-
-/* GTK+ ctors. */
-
-static void
-e_corba_config_page_class_init (ECorbaConfigPageClass *class)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (class);
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
-}
-
-static void
-e_corba_config_page_init (ECorbaConfigPage *corba_config_page)
-{
- ECorbaConfigPagePrivate *priv;
-
- priv = g_new (ECorbaConfigPagePrivate, 1);
- priv->config_control_interface = CORBA_OBJECT_NIL;
-
- corba_config_page->priv = priv;
-}
-
-
-gboolean
-e_corba_config_page_construct (ECorbaConfigPage *corba_config_page,
- GNOME_Evolution_ConfigControl corba_object)
-{
- Bonobo_Control control;
- GtkWidget *control_widget;
- CORBA_Environment ev;
-
- g_return_val_if_fail (E_IS_CORBA_CONFIG_PAGE (corba_config_page), FALSE);
- g_return_val_if_fail (corba_object != CORBA_OBJECT_NIL, FALSE);
-
- CORBA_exception_init (&ev);
-
- control = GNOME_Evolution_ConfigControl__get_control (corba_object, &ev);
- if (BONOBO_EX (&ev)) {
- g_warning ("Can't get control from ::ConfigControl -- %s", BONOBO_EX_REPOID (&ev));
- CORBA_exception_init (&ev);
- return FALSE;
- }
-
- control_widget = bonobo_widget_new_control_from_objref (control, CORBA_OBJECT_NIL);
- gtk_widget_show (control_widget);
- gtk_container_add (GTK_CONTAINER (corba_config_page), control_widget);
-
- /* Notice we *don't* unref the corba_object here as
- bonobo_widget_new_control_from_objref() effectively takes ownership
- for the object that we get from ::__get_control. */
-
- CORBA_exception_free (&ev);
-
- return TRUE;
-}
-
-GtkWidget *
-e_corba_config_page_new_from_objref (GNOME_Evolution_ConfigControl corba_object)
-{
- ECorbaConfigPage *corba_config_page;
-
- g_return_val_if_fail (corba_object != CORBA_OBJECT_NIL, NULL);
- g_return_val_if_fail (corba_object != CORBA_OBJECT_NIL, NULL);
-
- corba_config_page = g_object_new (e_corba_config_page_get_type (), NULL);
- if (! e_corba_config_page_construct (corba_config_page, corba_object)) {
- gtk_widget_destroy (GTK_WIDGET (corba_config_page));
- return NULL;
- }
-
- return GTK_WIDGET (corba_config_page);
-}
diff --git a/shell/e-corba-config-page.h b/shell/e-corba-config-page.h
deleted file mode 100644
index 8f0690ff69..0000000000
--- a/shell/e-corba-config-page.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_CORBA_CONFIG_PAGE_H_
-#define _E_CORBA_CONFIG_PAGE_H_
-
-#include "e-config-page.h"
-
-#include "Evolution.h"
-
-#include <bonobo/bonobo-object.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_CORBA_CONFIG_PAGE (e_corba_config_page_get_type ())
-#define E_CORBA_CONFIG_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CORBA_CONFIG_PAGE, ECorbaConfigPage))
-#define E_CORBA_CONFIG_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CORBA_CONFIG_PAGE, ECorbaConfigPageClass))
-#define E_IS_CORBA_CONFIG_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CORBA_CONFIG_PAGE))
-#define E_IS_CORBA_CONFIG_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CORBA_CONFIG_PAGE))
-
-
-typedef struct _ECorbaConfigPage ECorbaConfigPage;
-typedef struct _ECorbaConfigPagePrivate ECorbaConfigPagePrivate;
-typedef struct _ECorbaConfigPageClass ECorbaConfigPageClass;
-
-struct _ECorbaConfigPage {
- EConfigPage parent;
-
- ECorbaConfigPagePrivate *priv;
-};
-
-struct _ECorbaConfigPageClass {
- EConfigPageClass parent_class;
-};
-
-
-GType e_corba_config_page_get_type (void);
-GtkWidget *e_corba_config_page_new_from_objref (GNOME_Evolution_ConfigControl objref);
-gboolean e_corba_config_page_construct (ECorbaConfigPage *corba_config_page,
- GNOME_Evolution_ConfigControl objref);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_CORBA_CONFIG_PAGE_H_ */
diff --git a/shell/e-shell-backend.c b/shell/e-shell-backend.c
new file mode 100644
index 0000000000..06e1469f58
--- /dev/null
+++ b/shell/e-shell-backend.c
@@ -0,0 +1,458 @@
+/*
+ * e-shell-backend.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-shell-backend.h"
+
+#include <errno.h>
+#include <glib/gi18n.h>
+
+#include "e-util/e-util.h"
+
+#include "e-shell.h"
+#include "e-shell-view.h"
+
+#define E_SHELL_BACKEND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SHELL_BACKEND, EShellBackendPrivate))
+
+struct _EShellBackendPrivate {
+
+ gpointer shell; /* weak pointer */
+
+ /* We keep a reference to corresponding EShellView subclass
+ * since it keeps a reference back to us. This ensures the
+ * subclass is not finalized before we are, otherwise it
+ * would leak its EShellBackend reference. */
+ EShellViewClass *shell_view_class;
+
+ gchar *config_dir;
+ gchar *data_dir;
+
+ guint started : 1;
+};
+
+enum {
+ PROP_0,
+ PROP_SHELL
+};
+
+enum {
+ ACTIVITY_ADDED,
+ LAST_SIGNAL
+};
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+
+static void
+shell_backend_set_shell (EShellBackend *shell_backend,
+ EShell *shell)
+{
+ g_return_if_fail (shell_backend->priv->shell == NULL);
+
+ shell_backend->priv->shell = shell;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_backend),
+ &shell_backend->priv->shell);
+}
+
+static void
+shell_backend_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHELL:
+ shell_backend_set_shell (
+ E_SHELL_BACKEND (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_backend_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHELL:
+ g_value_set_object (
+ value, e_shell_backend_get_shell (
+ E_SHELL_BACKEND (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_backend_dispose (GObject *object)
+{
+ EShellBackendPrivate *priv;
+
+ priv = E_SHELL_BACKEND_GET_PRIVATE (object);
+
+ if (priv->shell_view_class != NULL) {
+ g_type_class_unref (priv->shell_view_class);
+ priv->shell_view_class = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+shell_backend_finalize (GObject *object)
+{
+ EShellBackendPrivate *priv;
+
+ priv = E_SHELL_BACKEND_GET_PRIVATE (object);
+
+ g_free (priv->data_dir);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+shell_backend_class_init (EShellBackendClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EShellBackendPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = shell_backend_set_property;
+ object_class->get_property = shell_backend_get_property;
+ object_class->dispose = shell_backend_dispose;
+ object_class->finalize = shell_backend_finalize;
+
+ /**
+ * EShellBackend:shell
+ *
+ * The #EShell singleton.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL,
+ g_param_spec_object (
+ "shell",
+ _("Shell"),
+ _("The EShell singleton"),
+ E_TYPE_SHELL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * EShellBackend::activity-added
+ * @shell_backend: the #EShellBackend that emitted the signal
+ * @activity: an #EActivity
+ *
+ * Broadcasts a newly added activity.
+ **/
+ signals[ACTIVITY_ADDED] = g_signal_new (
+ "activity-added",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_ACTIVITY);
+}
+
+static void
+shell_backend_init (EShellBackend *shell_backend,
+ EShellBackendClass *class)
+{
+ EShellViewClass *shell_view_class;
+ gchar *dirname;
+
+ shell_backend->priv = E_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+
+ /* Install a reference to ourselves in the corresponding
+ * EShellViewClass structure, */
+ shell_view_class = g_type_class_ref (class->shell_view_type);
+ shell_view_class->shell_backend = g_object_ref (shell_backend);
+ shell_backend->priv->shell_view_class = shell_view_class;
+
+ /* Determine the user data directory for this backend. */
+ shell_backend->priv->data_dir = g_build_filename (
+ e_get_user_data_dir (), class->name, NULL);
+
+ /* Determine the user configuration directory for this backend. */
+ shell_backend->priv->config_dir = g_build_filename (
+ shell_backend->priv->data_dir, "config", NULL);
+
+ /* Create the user configuration directory for this backend,
+ * which should also create the user data directory. */
+ dirname = shell_backend->priv->config_dir;
+ if (g_mkdir_with_parents (dirname, 0777) != 0)
+ g_critical (
+ "Cannot create directory %s: %s",
+ dirname, g_strerror (errno));
+}
+
+GType
+e_shell_backend_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (EShellBackendClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) shell_backend_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EShellBackend),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) shell_backend_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ G_TYPE_OBJECT, "EShellBackend", &type_info, 0);
+ }
+
+ return type;
+}
+
+/**
+ * e_shell_backend_compare:
+ * @shell_backend_a: an #EShellBackend
+ * @shell_backend_b: an #EShellBackend
+ *
+ * Using the <structfield>sort_order</structfield> field from both backends'
+ * #EShellBackendClass, compares @shell_backend_a with @shell_mobule_b and
+ * returns -1, 0 or +1 if @shell_backend_a is found to be less than, equal
+ * to or greater than @shell_backend_b, respectively.
+ *
+ * Returns: -1, 0 or +1, for a less than, equal to or greater than result
+ **/
+gint
+e_shell_backend_compare (EShellBackend *shell_backend_a,
+ EShellBackend *shell_backend_b)
+{
+ gint a = E_SHELL_BACKEND_GET_CLASS (shell_backend_a)->sort_order;
+ gint b = E_SHELL_BACKEND_GET_CLASS (shell_backend_b)->sort_order;
+
+ return (a < b) ? -1 : (a > b);
+}
+
+/**
+ * e_shell_backend_get_config_dir:
+ * @shell_backend: an #EShellBackend
+ *
+ * Returns the absolute path to the configuration directory for
+ * @shell_backend. The string is owned by @shell_backend and should
+ * not be modified or freed.
+ *
+ * Returns: the backend's configuration directory
+ **/
+const gchar *
+e_shell_backend_get_config_dir (EShellBackend *shell_backend)
+{
+ g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), NULL);
+ g_return_val_if_fail (shell_backend->priv->config_dir != NULL, NULL);
+
+ return shell_backend->priv->config_dir;
+}
+
+/**
+ * e_shell_backend_get_data_dir:
+ * @shell_backend: an #EShellBackend
+ *
+ * Returns the absolute path to the data directory for @shell_backend.
+ * The string is owned by @shell_backend and should not be modified or
+ * freed.
+ *
+ * Returns: the backend's data directory
+ **/
+const gchar *
+e_shell_backend_get_data_dir (EShellBackend *shell_backend)
+{
+ g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), NULL);
+ g_return_val_if_fail (shell_backend->priv->data_dir != NULL, NULL);
+
+ return shell_backend->priv->data_dir;
+}
+
+/**
+ * e_shell_backend_get_shell:
+ * @shell_backend: an #EShellBackend
+ *
+ * Returns the #EShell singleton.
+ *
+ * Returns: the #EShell
+ **/
+EShell *
+e_shell_backend_get_shell (EShellBackend *shell_backend)
+{
+ g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), NULL);
+
+ return E_SHELL (shell_backend->priv->shell);
+}
+
+/**
+ * e_shell_backend_add_activity:
+ * @shell_backend: an #EShellBackend
+ * @activity: an #EActivity
+ *
+ * Emits an #EShellBackend::activity-added signal.
+ **/
+void
+e_shell_backend_add_activity (EShellBackend *shell_backend,
+ EActivity *activity)
+{
+ g_return_if_fail (E_IS_SHELL_BACKEND (shell_backend));
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ g_signal_emit (shell_backend, signals[ACTIVITY_ADDED], 0, activity);
+}
+
+/**
+ * e_shell_backend_start:
+ * @shell_backend: an #EShellBackend
+ *
+ * Tells the @shell_backend to begin loading data or running background
+ * tasks which may consume significant resources. This gets called in
+ * reponse to the user switching to the corresponding #EShellView for
+ * the first time. The function is idempotent for each @shell_backend.
+ **/
+void
+e_shell_backend_start (EShellBackend *shell_backend)
+{
+ EShellBackendClass *class;
+
+ g_return_if_fail (E_IS_SHELL_BACKEND (shell_backend));
+
+ if (shell_backend->priv->started)
+ return;
+
+ class = E_SHELL_BACKEND_GET_CLASS (shell_backend);
+
+ if (class->start != NULL)
+ class->start (shell_backend);
+
+ shell_backend->priv->started = TRUE;
+}
+
+/**
+ * e_shell_backend_is_busy:
+ * @shell_backend: an #EShellBackend
+ *
+ * Returns %TRUE if @shell_backend is busy and cannot be shutdown at
+ * present. Each backend must define what "busy" means to them and
+ * determine an appropriate response.
+ *
+ * XXX This function is likely to change or disappear. I'm toying with
+ * the idea of just having it check whether there are any unfinished
+ * #EActivity<!-- -->'s left, so we have a consistent and easily
+ * testable definition of what "busy" means.
+ *
+ * Returns: %TRUE if the backend is busy
+ **/
+gboolean
+e_shell_backend_is_busy (EShellBackend *shell_backend)
+{
+ EShellBackendClass *class;
+
+ g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), FALSE);
+
+ class = E_SHELL_BACKEND_GET_CLASS (shell_backend);
+
+ if (class->is_busy == NULL)
+ return FALSE;
+
+ return class->is_busy (shell_backend);
+}
+
+/**
+ * e_shell_backend_shutdown:
+ * @shell_backend: an #EShellBackend
+ *
+ * Alerts @shell_backend to begin shutdown procedures. If the backend is
+ * busy and cannot immediately shut down, the function returns %FALSE.
+ * A %TRUE response implies @shell_backend has successfully shut down.
+ *
+ * XXX This function is likely to change or disappear. I'm toying with
+ * the idea of just having it check whether there are any unfinished
+ * #EActivity<!-- -->'s left, so we have a consistent and easily
+ * testable definition of what "busy" means.
+ *
+ * Returns: %TRUE if the backend has shut down, %FALSE if the backend is
+ * busy and cannot immediately shut down
+ */
+gboolean
+e_shell_backend_shutdown (EShellBackend *shell_backend)
+{
+ EShellBackendClass *class;
+
+ g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), TRUE);
+
+ class = E_SHELL_BACKEND_GET_CLASS (shell_backend);
+
+ if (class->shutdown == NULL)
+ return TRUE;
+
+ return class->shutdown (shell_backend);
+}
+
+/**
+ * e_shell_migrate:
+ * @shell_backend: an #EShellBackend
+ * @major: major part of version to migrate from
+ * @minor: minor part of version to migrate from
+ * @micro: micro part of version to migrate from
+ * @error: return location for a #GError, or %NULL
+ *
+ * Attempts to migrate data and settings from version %major.%minor.%micro.
+ * Returns %TRUE if the migration was successful or if no action was
+ * necessary. Returns %FALSE and sets %error if the migration failed.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise
+ **/
+gboolean
+e_shell_backend_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error)
+{
+ EShellBackendClass *class;
+
+ g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), TRUE);
+
+ class = E_SHELL_BACKEND_GET_CLASS (shell_backend);
+
+ if (class->migrate == NULL)
+ return TRUE;
+
+ return class->migrate (shell_backend, major, minor, micro, error);
+}
diff --git a/shell/e-shell-backend.h b/shell/e-shell-backend.h
new file mode 100644
index 0000000000..57663d8619
--- /dev/null
+++ b/shell/e-shell-backend.h
@@ -0,0 +1,151 @@
+/*
+ * e-shell-backend.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+/**
+ * SECTION: e-shell-backend
+ * @short_description: dynamically loaded capabilities
+ * @include: shell/e-shell-backend.h
+ **/
+
+#ifndef E_SHELL_BACKEND_H
+#define E_SHELL_BACKEND_H
+
+#include <shell/e-shell-common.h>
+#include <widgets/misc/e-activity.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SHELL_BACKEND \
+ (e_shell_backend_get_type ())
+#define E_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SHELL_BACKEND, EShellBackend))
+#define E_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SHELL_BACKEND, EShellBackendClass))
+#define E_IS_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SHELL_BACKEND))
+#define E_IS_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SHELL_BACKEND))
+#define E_SHELL_BACKEND_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SHELL_BACKEND, EShellBackendClass))
+
+G_BEGIN_DECLS
+
+/* Avoid including <e-shell.h>, because it includes us! */
+struct _EShell;
+
+typedef struct _EShellBackend EShellBackend;
+typedef struct _EShellBackendClass EShellBackendClass;
+typedef struct _EShellBackendPrivate EShellBackendPrivate;
+
+/**
+ * EShellBackend:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
+struct _EShellBackend {
+ GObject parent;
+ EShellBackendPrivate *priv;
+};
+
+/**
+ * EShellBackendClass:
+ * @parent_class: The parent class structure.
+ * @name: The name of the backend. Also becomes the name of
+ * the corresponding #EShellView subclass that the
+ * backend will register.
+ * @aliases: Colon-separated list of aliases that can be used
+ * when referring to a backend by name.
+ * @schemes: Colon-separated list of URI schemes. The #EShell
+ * will forward command-line URIs to the appropriate
+ * backend based on this list.
+ * @sort_order: Used to determine the order of backends listed in
+ * the main menu and in the switcher. See
+ * e_shell_backend_compare().
+ * @shell_view_type: #GType for the corresponding #EShellView subclass.
+ * @start: Method for notifying the backend to begin loading
+ * data and running background tasks. This is called
+ * just before the first instantiation of the
+ * corresponding #EShellView subclass. It allows the
+ * backend to delay initialization steps that consume
+ * significant resources until they are actually needed.
+ * @is_busy: Method for querying whether the backend has operations
+ * in progress that cannot be cancelled or finished
+ * immediately. Returning %TRUE prevents the application
+ * from shutting down.
+ * @shutdown: Method for notifying the backend to begin shutting
+ * down. Returning %FALSE indicates there are still
+ * unfinished operations and the #EShell should check
+ * back shortly.
+ * @migrate: Method for notifying the backend to migrate data and
+ * settings from the given version. Returns %TRUE if the
+ * migration was successful or if no action was necessary.
+ * Returns %FALSE and sets a #GError if the migration
+ * failed.
+ *
+ * #EShellBackendClass contains a number of important settings for subclasses.
+ **/
+struct _EShellBackendClass {
+ GObjectClass parent_class;
+
+ GType shell_view_type;
+
+ const gchar *name;
+ const gchar *aliases;
+ const gchar *schemes;
+ gint sort_order;
+
+ /* Methods */
+ void (*start) (EShellBackend *shell_backend);
+ gboolean (*is_busy) (EShellBackend *shell_backend);
+ gboolean (*shutdown) (EShellBackend *shell_backend);
+ gboolean (*migrate) (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error);
+};
+
+GType e_shell_backend_get_type (void);
+gint e_shell_backend_compare (EShellBackend *shell_backend_a,
+ EShellBackend *shell_backend_b);
+const gchar * e_shell_backend_get_config_dir (EShellBackend *shell_backend);
+const gchar * e_shell_backend_get_data_dir (EShellBackend *shell_backend);
+const gchar * e_shell_backend_get_filename (EShellBackend *shell_backend);
+struct _EShell *e_shell_backend_get_shell (EShellBackend *shell_backend);
+void e_shell_backend_add_activity (EShellBackend *shell_backend,
+ EActivity *activity);
+void e_shell_backend_start (EShellBackend *shell_backend);
+gboolean e_shell_backend_is_busy (EShellBackend *shell_backend);
+gboolean e_shell_backend_shutdown (EShellBackend *shell_backend);
+gboolean e_shell_backend_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* E_SHELL_BACKEND_H */
diff --git a/shell/importer/intelligent.h b/shell/e-shell-common.h
index 5f5f7187f2..7ff35091aa 100644
--- a/shell/importer/intelligent.h
+++ b/shell/e-shell-common.h
@@ -1,4 +1,6 @@
/*
+ * e-shell-common.h
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,16 +15,19 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Kjartan Maraas <kmaraas@gnome.org>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifndef __INTELLIGENT_H__
-#define __INTELLIGENT_H__
-
-void intelligent_importer_init (void);
+#ifndef E_SHELL_COMMON_H
+#define E_SHELL_COMMON_H
+#ifdef HAVE_CONFIG_H
+#include <config.h>
#endif
+
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+
+#endif /* E_SHELL_COMMON_H */
diff --git a/shell/e-shell-constants.h b/shell/e-shell-constants.h
deleted file mode 100644
index 13beed8aec..0000000000
--- a/shell/e-shell-constants.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef E_SHELL_CONSTANTS_H
-#define E_SHELL_CONSTANTS_H
-
-#define E_SHELL_URI_PREFIX "evolution:"
-#define E_SHELL_URI_PREFIX_LEN 10
-
-#define E_SHELL_DEFAULTURI_PREFIX "default:"
-#define E_SHELL_DEFAULTURI_PREFIX_LEN 8
-
-#define E_SHELL_MINI_ICON_SUFFIX "-mini"
-#define E_SHELL_MINI_ICON_SUFFIX_LEN 5
-
-#define E_SHELL_ICON_SIZE 48
-#define E_SHELL_MINI_ICON_SIZE 16
-
-#define E_PATH_SEPARATOR '/'
-#define E_PATH_SEPARATOR_S "/"
-
-#define E_LOCAL_STORAGE_NAME "local"
-#define E_SUMMARY_STORAGE_NAME "summary"
-
-#define E_SUMMARY_URI "evolution:/summary"
-#define E_LOCAL_INBOX_URI "evolution:/local/Inbox"
-#define E_LOCAL_CONTACTS_URI "evolution:/local/Contacts"
-#define E_LOCAL_CALENDAR_URI "evolution:/local/Calendar"
-#define E_LOCAL_TASKS_URI "evolution:/local/Tasks"
-
-#endif
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
new file mode 100644
index 0000000000..b5579088e1
--- /dev/null
+++ b/shell/e-shell-content.c
@@ -0,0 +1,1384 @@
+/*
+ * e-shell-content.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-shell-content.h"
+
+#include <glib/gi18n.h>
+
+#include <filter/rule-editor.h>
+#include <widgets/misc/e-action-combo-box.h>
+#include <widgets/misc/e-icon-entry.h>
+
+#include <e-shell-backend.h>
+#include <e-shell-view.h>
+#include <e-shell-window-actions.h>
+
+#define E_SHELL_CONTENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SHELL_CONTENT, EShellContentPrivate))
+
+struct _EShellContentPrivate {
+
+ gpointer shell_view; /* weak pointer */
+
+ RuleContext *search_context;
+ FilterRule *search_rule;
+ gchar *system_filename;
+ gchar *user_filename;
+
+ /* Container for the following widgets */
+ GtkWidget *search_bar;
+
+ /* Search bar widgets */
+ GtkWidget *filter_label;
+ GtkWidget *filter_combo_box;
+ GtkWidget *search_label;
+ GtkWidget *search_entry;
+ GtkWidget *scope_label;
+ GtkWidget *scope_combo_box;
+
+ GtkStateType search_state;
+};
+
+enum {
+ PROP_0,
+ PROP_FILTER_ACTION,
+ PROP_FILTER_VALUE,
+ PROP_FILTER_VISIBLE,
+ PROP_SEARCH_CONTEXT,
+ PROP_SEARCH_RULE,
+ PROP_SEARCH_TEXT,
+ PROP_SEARCH_VISIBLE,
+ PROP_SCOPE_ACTION,
+ PROP_SCOPE_VALUE,
+ PROP_SCOPE_VISIBLE,
+ PROP_SHELL_VIEW
+};
+
+static gpointer parent_class;
+
+static void
+shell_content_dialog_rule_changed (GtkWidget *dialog,
+ FilterRule *rule)
+{
+ gboolean sensitive;
+
+ sensitive = (rule != NULL) && (rule->parts != NULL);
+
+ gtk_dialog_set_response_sensitive (
+ GTK_DIALOG (dialog), GTK_RESPONSE_OK, sensitive);
+ gtk_dialog_set_response_sensitive (
+ GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, sensitive);
+}
+
+static void
+action_search_execute_cb (GtkAction *action,
+ EShellContent *shell_content)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EIconEntry *icon_entry;
+ GtkStateType visual_state;
+ const gchar *search_text;
+
+ /* EShellView subclasses are responsible for actually
+ * executing the search. This is all cosmetic stuff. */
+
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ icon_entry = E_ICON_ENTRY (shell_content->priv->search_entry);
+ search_text = e_shell_content_get_search_text (shell_content);
+
+ if (search_text != NULL && *search_text != '\0')
+ visual_state = GTK_STATE_SELECTED;
+ else
+ visual_state = GTK_STATE_NORMAL;
+
+ e_icon_entry_set_visual_state (icon_entry, visual_state);
+
+ action = E_SHELL_WINDOW_ACTION_SEARCH_CLEAR (shell_window);
+ gtk_action_set_sensitive (action, TRUE);
+
+ action = E_SHELL_WINDOW_ACTION_SEARCH_SAVE (shell_window);
+ gtk_action_set_sensitive (action, TRUE);
+
+ /* Direct the focus away from the search entry, so that a
+ * focus-in event is required before the text can be changed.
+ * This will reset the entry to the appropriate visual state. */
+ gtk_widget_grab_focus (gtk_bin_get_child (GTK_BIN (shell_content)));
+}
+
+static void
+shell_content_entry_activated_cb (EShellContent *shell_content,
+ GtkWidget *entry)
+{
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ GtkAction *action;
+
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ /* Verify the shell view is active before proceeding. */
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ action = E_SHELL_WINDOW_ACTION_SEARCH_EXECUTE (shell_window);
+ gtk_action_activate (action);
+}
+
+static gboolean
+shell_content_entry_focus_in_cb (EShellContent *shell_content,
+ GdkEventFocus *focus_event,
+ GtkWidget *entry)
+{
+ EIconEntry *icon_entry;
+ GtkStateType visual_state;
+
+ icon_entry = E_ICON_ENTRY (shell_content->priv->search_entry);
+ visual_state = e_icon_entry_get_visual_state (icon_entry);
+
+ if (visual_state == GTK_STATE_INSENSITIVE)
+ gtk_entry_set_text (GTK_ENTRY (entry), "");
+
+ e_icon_entry_set_visual_state (icon_entry, GTK_STATE_NORMAL);
+
+ return FALSE;
+}
+
+static gboolean
+shell_content_entry_focus_out_cb (EShellContent *shell_content,
+ GdkEventFocus *focus_event,
+ GtkWidget *entry)
+{
+ /* FIXME */
+ return FALSE;
+}
+
+static gboolean
+shell_content_entry_key_press_cb (EShellContent *shell_content,
+ GdkEventKey *key_event,
+ GtkWidget *entry)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkAction *action;
+ guint mask;
+
+ mask = gtk_accelerator_get_default_mod_mask ();
+ if ((key_event->state & mask) != GDK_MOD1_MASK)
+ return FALSE;
+
+ if (key_event->keyval != GDK_Down)
+ return FALSE;
+
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ action = E_SHELL_WINDOW_ACTION_SEARCH_OPTIONS (shell_window);
+ gtk_action_activate (action);
+
+ return TRUE;
+}
+
+static void
+shell_content_init_search_context (EShellContent *shell_content)
+{
+ EShellContentClass *shell_content_class;
+ EShellView *shell_view;
+ EShellViewClass *shell_view_class;
+ EShellBackend *shell_backend;
+ RuleContext *context;
+ FilterRule *rule;
+ FilterPart *part;
+ gchar *system_filename;
+ gchar *user_filename;
+
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ g_return_if_fail (shell_view_class->search_rules != NULL);
+
+ shell_content_class = E_SHELL_CONTENT_GET_CLASS (shell_content);
+ g_return_if_fail (shell_content_class->new_search_context != NULL);
+
+ /* The basename for built-in searches is specified in the
+ * shell view class. All built-in search rules live in the
+ * same directory. */
+ system_filename = g_build_filename (
+ EVOLUTION_RULEDIR, shell_view_class->search_rules, NULL);
+
+ /* The filename for custom saved searches is always of
+ * the form "$(shell_backend_data_dir)/searches.xml". */
+ user_filename = g_build_filename (
+ e_shell_backend_get_data_dir (shell_backend),
+ "searches.xml", NULL);
+
+ context = shell_content_class->new_search_context ();
+ rule_context_add_part_set (
+ context, "partset", FILTER_TYPE_PART,
+ rule_context_add_part, rule_context_next_part);
+ rule_context_add_rule_set (
+ context, "ruleset", FILTER_TYPE_RULE,
+ rule_context_add_rule, rule_context_next_rule);
+ rule_context_load (context, system_filename, user_filename);
+
+ /* XXX Not sure why this is necessary. */
+ g_object_set_data_full (
+ G_OBJECT (context), "system",
+ g_strdup (system_filename), g_free);
+ g_object_set_data_full (
+ G_OBJECT (context), "user",
+ g_strdup (user_filename), g_free);
+
+ rule = filter_rule_new ();
+ part = rule_context_next_part (context, NULL);
+ if (part == NULL)
+ g_warning (
+ "Could not load %s search: no parts",
+ e_shell_view_get_name (shell_view));
+ else
+ filter_rule_add_part (rule, filter_part_clone (part));
+
+ shell_content->priv->search_context = context;
+ shell_content->priv->system_filename = system_filename;
+ shell_content->priv->user_filename = user_filename;
+}
+
+static void
+shell_content_set_shell_view (EShellContent *shell_content,
+ EShellView *shell_view)
+{
+ g_return_if_fail (shell_content->priv->shell_view == NULL);
+
+ shell_content->priv->shell_view = shell_view;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_view),
+ &shell_content->priv->shell_view);
+}
+
+static void
+shell_content_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_FILTER_ACTION:
+ e_shell_content_set_filter_action (
+ E_SHELL_CONTENT (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_FILTER_VALUE:
+ e_shell_content_set_filter_value (
+ E_SHELL_CONTENT (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_FILTER_VISIBLE:
+ e_shell_content_set_filter_visible (
+ E_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_SEARCH_RULE:
+ e_shell_content_set_search_rule (
+ E_SHELL_CONTENT (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SEARCH_TEXT:
+ e_shell_content_set_search_text (
+ E_SHELL_CONTENT (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_SEARCH_VISIBLE:
+ e_shell_content_set_search_visible (
+ E_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_SCOPE_ACTION:
+ e_shell_content_set_scope_action (
+ E_SHELL_CONTENT (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SCOPE_VALUE:
+ e_shell_content_set_scope_value (
+ E_SHELL_CONTENT (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_SCOPE_VISIBLE:
+ e_shell_content_set_scope_visible (
+ E_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_SHELL_VIEW:
+ shell_content_set_shell_view (
+ E_SHELL_CONTENT (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_content_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_FILTER_ACTION:
+ g_value_set_object (
+ value, e_shell_content_get_filter_action (
+ E_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_FILTER_VALUE:
+ g_value_set_int (
+ value, e_shell_content_get_filter_value (
+ E_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_FILTER_VISIBLE:
+ g_value_set_boolean (
+ value, e_shell_content_get_filter_visible (
+ E_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_SEARCH_CONTEXT:
+ g_value_set_object (
+ value, e_shell_content_get_search_context (
+ E_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_SEARCH_RULE:
+ g_value_set_object (
+ value, e_shell_content_get_search_rule (
+ E_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_SEARCH_TEXT:
+ g_value_set_string (
+ value, e_shell_content_get_search_text (
+ E_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_SEARCH_VISIBLE:
+ g_value_set_boolean (
+ value, e_shell_content_get_search_visible (
+ E_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_SCOPE_ACTION:
+ g_value_set_object (
+ value, e_shell_content_get_scope_action (
+ E_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_SCOPE_VALUE:
+ g_value_set_int (
+ value, e_shell_content_get_scope_value (
+ E_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_SCOPE_VISIBLE:
+ g_value_set_boolean (
+ value, e_shell_content_get_scope_visible (
+ E_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_SHELL_VIEW:
+ g_value_set_object (
+ value, e_shell_content_get_shell_view (
+ E_SHELL_CONTENT (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_content_dispose (GObject *object)
+{
+ EShellContentPrivate *priv;
+
+ priv = E_SHELL_CONTENT_GET_PRIVATE (object);
+
+ if (priv->shell_view != NULL) {
+ g_object_remove_weak_pointer (
+ G_OBJECT (priv->shell_view), &priv->shell_view);
+ priv->shell_view = NULL;
+ }
+
+ if (priv->filter_label != NULL) {
+ g_object_unref (priv->filter_label);
+ priv->filter_label = NULL;
+ }
+
+ if (priv->filter_combo_box != NULL) {
+ g_object_unref (priv->filter_combo_box);
+ priv->filter_combo_box = NULL;
+ }
+
+ if (priv->search_context != NULL) {
+ g_object_unref (priv->search_context);
+ priv->search_context = NULL;
+ }
+
+ if (priv->search_label != NULL) {
+ g_object_unref (priv->search_label);
+ priv->search_label = NULL;
+ }
+
+ if (priv->search_entry != NULL) {
+ g_object_unref (priv->search_entry);
+ priv->search_entry = NULL;
+ }
+
+ if (priv->scope_label != NULL) {
+ g_object_unref (priv->scope_label);
+ priv->scope_label = NULL;
+ }
+
+ if (priv->scope_combo_box != NULL) {
+ g_object_unref (priv->scope_combo_box);
+ priv->scope_combo_box = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+shell_content_finalize (GObject *object)
+{
+ EShellContentPrivate *priv;
+
+ priv = E_SHELL_CONTENT_GET_PRIVATE (object);
+
+ g_free (priv->system_filename);
+ g_free (priv->user_filename);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+shell_content_constructed (GObject *object)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellContent *shell_content;
+ EIconEntry *icon_entry;
+ GtkSizeGroup *size_group;
+ GtkAction *action;
+ GtkWidget *widget;
+
+ shell_content = E_SHELL_CONTENT (object);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ icon_entry = E_ICON_ENTRY (shell_content->priv->search_entry);
+ size_group = e_shell_view_get_size_group (shell_view);
+
+ action = E_SHELL_WINDOW_ACTION_SEARCH_CLEAR (shell_window);
+ e_icon_entry_add_action_end (icon_entry, action);
+
+ action = E_SHELL_WINDOW_ACTION_SEARCH_EXECUTE (shell_window);
+ g_signal_connect (
+ action, "activate",
+ G_CALLBACK (action_search_execute_cb), shell_content);
+
+ action = E_SHELL_WINDOW_ACTION_SEARCH_OPTIONS (shell_window);
+ e_icon_entry_add_action_start (icon_entry, action);
+
+ widget = shell_content->priv->search_bar;
+ gtk_size_group_add_widget (size_group, widget);
+
+ shell_content_init_search_context (shell_content);
+}
+
+static void
+shell_content_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ EShellContentPrivate *priv;
+ GtkRequisition child_requisition;
+ GtkWidget *child;
+
+ priv = E_SHELL_CONTENT_GET_PRIVATE (widget);
+
+ requisition->width = 0;
+ requisition->height = 0;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ gtk_widget_size_request (child, requisition);
+
+ child = priv->search_bar;
+ gtk_widget_size_request (child, &child_requisition);
+ requisition->width = MAX (requisition->width, child_requisition.width);
+ requisition->height += child_requisition.height;
+}
+
+static void
+shell_content_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ EShellContentPrivate *priv;
+ GtkAllocation child_allocation;
+ GtkRequisition child_requisition;
+ GtkWidget *child;
+
+ priv = E_SHELL_CONTENT_GET_PRIVATE (widget);
+
+ widget->allocation = *allocation;
+
+ child = priv->search_bar;
+ gtk_widget_size_request (child, &child_requisition);
+
+ child_allocation.x = allocation->x;
+ child_allocation.y = allocation->y;
+ child_allocation.width = allocation->width;
+ child_allocation.height = child_requisition.height;
+
+ gtk_widget_size_allocate (child, &child_allocation);
+
+ child_allocation.y += child_requisition.height;
+ child_allocation.height =
+ allocation->height - child_requisition.height;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ if (child != NULL)
+ gtk_widget_size_allocate (child, &child_allocation);
+}
+
+static void
+shell_content_remove (GtkContainer *container,
+ GtkWidget *widget)
+{
+ EShellContentPrivate *priv;
+
+ priv = E_SHELL_CONTENT_GET_PRIVATE (container);
+
+ /* Look in the internal widgets first. */
+
+ if (widget == priv->search_bar) {
+ gtk_widget_unparent (priv->search_bar);
+ gtk_widget_queue_resize (GTK_WIDGET (container));
+ return;
+ }
+
+ /* Chain up to parent's remove() method. */
+ GTK_CONTAINER_CLASS (parent_class)->remove (container, widget);
+}
+
+static void
+shell_content_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
+{
+ EShellContentPrivate *priv;
+
+ priv = E_SHELL_CONTENT_GET_PRIVATE (container);
+
+ if (include_internals)
+ callback (priv->search_bar, callback_data);
+
+ /* Chain up to parent's forall() method. */
+ GTK_CONTAINER_CLASS (parent_class)->forall (
+ container, include_internals, callback, callback_data);
+}
+
+static void
+shell_content_class_init (EShellContentClass *class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+ GtkContainerClass *container_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EShellContentPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = shell_content_set_property;
+ object_class->get_property = shell_content_get_property;
+ object_class->dispose = shell_content_dispose;
+ object_class->finalize = shell_content_finalize;
+ object_class->constructed = shell_content_constructed;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->size_request = shell_content_size_request;
+ widget_class->size_allocate = shell_content_size_allocate;
+
+ container_class = GTK_CONTAINER_CLASS (class);
+ container_class->remove = shell_content_remove;
+ container_class->forall = shell_content_forall;
+
+ class->new_search_context = rule_context_new;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FILTER_ACTION,
+ g_param_spec_object (
+ "filter-action",
+ NULL,
+ NULL,
+ GTK_TYPE_RADIO_ACTION,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FILTER_VALUE,
+ g_param_spec_int (
+ "filter-value",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FILTER_VISIBLE,
+ g_param_spec_boolean (
+ "filter-visible",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SEARCH_CONTEXT,
+ g_param_spec_object (
+ "search-context",
+ NULL,
+ NULL,
+ RULE_TYPE_CONTEXT,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SEARCH_RULE,
+ g_param_spec_object (
+ "search-rule",
+ NULL,
+ NULL,
+ FILTER_TYPE_RULE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SEARCH_TEXT,
+ g_param_spec_string (
+ "search-text",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SEARCH_VISIBLE,
+ g_param_spec_boolean (
+ "search-visible",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SCOPE_ACTION,
+ g_param_spec_object (
+ "scope-action",
+ NULL,
+ NULL,
+ GTK_TYPE_RADIO_ACTION,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SCOPE_VALUE,
+ g_param_spec_int (
+ "scope-value",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SCOPE_VISIBLE,
+ g_param_spec_boolean (
+ "scope-visible",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_VIEW,
+ g_param_spec_object (
+ "shell-view",
+ NULL,
+ NULL,
+ E_TYPE_SHELL_VIEW,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+shell_content_init (EShellContent *shell_content)
+{
+ GtkBox *box;
+ GtkLabel *label;
+ GtkWidget *mnemonic;
+ GtkWidget *widget;
+ EIconEntry *icon_entry;
+
+ shell_content->priv = E_SHELL_CONTENT_GET_PRIVATE (shell_content);
+
+ GTK_WIDGET_SET_FLAGS (shell_content, GTK_NO_WINDOW);
+
+ /*** Build the Search Bar ***/
+
+ widget = gtk_hbox_new (FALSE, 3);
+ gtk_widget_set_parent (widget, GTK_WIDGET (shell_content));
+ shell_content->priv->search_bar = g_object_ref_sink (widget);
+ gtk_widget_show (widget);
+
+ box = GTK_BOX (widget);
+
+ /* Filter Combo Widgets */
+
+ /* Translators: The "Show:" label precedes a combo box that
+ * allows the user to filter the current view. Examples of
+ * items that appear in the combo box are "Unread Messages",
+ * "Important Messages", or "Active Appointments". */
+ widget = gtk_label_new_with_mnemonic (_("Sho_w:"));
+ gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
+ shell_content->priv->filter_label = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ label = GTK_LABEL (widget);
+
+ widget = e_action_combo_box_new ();
+ gtk_label_set_mnemonic_widget (label, widget);
+ gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
+ shell_content->priv->filter_combo_box = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Scope Combo Widgets */
+
+ widget = e_action_combo_box_new ();
+ gtk_box_pack_end (box, widget, FALSE, FALSE, 0);
+ shell_content->priv->scope_combo_box = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ mnemonic = widget;
+
+ /* Translators: This is part of the quick search interface.
+ * example: Search: [_______________] in [ Current Folder ] */
+ widget = gtk_label_new_with_mnemonic (_("i_n"));
+ gtk_label_set_mnemonic_widget (GTK_LABEL (widget), mnemonic);
+ gtk_box_pack_end (box, widget, FALSE, FALSE, 0);
+ shell_content->priv->scope_label = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Search Entry Widgets */
+
+ widget = e_icon_entry_new ();
+ gtk_box_pack_end (box, widget, FALSE, FALSE, 0);
+ shell_content->priv->search_entry = g_object_ref (widget);
+ shell_content->priv->search_state = GTK_STATE_NORMAL;
+ gtk_widget_show (widget);
+
+ icon_entry = E_ICON_ENTRY (widget);
+
+ /* Translators: This is part of the quick search interface.
+ * example: Search: [_______________] in [ Current Folder ] */
+ widget = gtk_label_new_with_mnemonic (_("Sear_ch:"));
+ gtk_box_pack_end (box, widget, FALSE, FALSE, 0);
+ shell_content->priv->search_label = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ label = GTK_LABEL (widget);
+
+ widget = e_icon_entry_get_entry (icon_entry);
+ gtk_label_set_mnemonic_widget (label, widget);
+ g_signal_connect_swapped (
+ widget, "activate",
+ G_CALLBACK (shell_content_entry_activated_cb), shell_content);
+ g_signal_connect_swapped (
+ widget, "focus-in-event",
+ G_CALLBACK (shell_content_entry_focus_in_cb), shell_content);
+ g_signal_connect_swapped (
+ widget, "focus-out-event",
+ G_CALLBACK (shell_content_entry_focus_out_cb), shell_content);
+ g_signal_connect_swapped (
+ widget, "key-press-event",
+ G_CALLBACK (shell_content_entry_key_press_cb), shell_content);
+}
+
+GType
+e_shell_content_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EShellContentClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) shell_content_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EShellContent),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) shell_content_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_BIN, "EShellContent", &type_info, 0);
+ }
+
+ return type;
+}
+
+/**
+ * e_shell_content_new:
+ * @shell_view: an #EShellView
+ *
+ * Creates a new #EShellContent instance belonging to @shell_view.
+ *
+ * Returns: a new #EShellContent instance
+ **/
+GtkWidget *
+e_shell_content_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_SHELL_CONTENT, "shell-view", shell_view, NULL);
+}
+
+/**
+ * e_shell_content_check_state:
+ * @shell_content: an #EShellContent
+ *
+ * #EShellContent subclasses should implement the
+ * <structfield>check_state</structfield> method in #EShellContentClass
+ * to return a set of flags describing the current content selection.
+ * Subclasses are responsible for defining their own flags. This is
+ * primarily used to assist shell views with updating actions (see
+ * e_shell_view_update_actions()).
+ *
+ * Returns: a set of flags describing the current @shell_content selection
+ **/
+guint32
+e_shell_content_check_state (EShellContent *shell_content)
+{
+ EShellContentClass *shell_content_class;
+
+ g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), 0);
+
+ shell_content_class = E_SHELL_CONTENT_GET_CLASS (shell_content);
+ g_return_val_if_fail (shell_content_class->check_state != NULL, 0);
+
+ return shell_content_class->check_state (shell_content);
+}
+
+/**
+ * e_shell_content_get_shell_view:
+ * @shell_content: an #EShellContent
+ *
+ * Returns the #EShellView that was passed to e_shell_content_new().
+ *
+ * Returns: the #EShellView to which @shell_content belongs
+ **/
+EShellView *
+e_shell_content_get_shell_view (EShellContent *shell_content)
+{
+ g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), NULL);
+
+ return E_SHELL_VIEW (shell_content->priv->shell_view);
+}
+
+GtkRadioAction *
+e_shell_content_get_filter_action (EShellContent *shell_content)
+{
+ EActionComboBox *combo_box;
+
+ g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), NULL);
+
+ combo_box = E_ACTION_COMBO_BOX (shell_content->priv->filter_combo_box);
+
+ return e_action_combo_box_get_action (combo_box);
+}
+
+void
+e_shell_content_set_filter_action (EShellContent *shell_content,
+ GtkRadioAction *filter_action)
+{
+ EActionComboBox *combo_box;
+
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ combo_box = E_ACTION_COMBO_BOX (shell_content->priv->filter_combo_box);
+
+ e_action_combo_box_set_action (combo_box, filter_action);
+ g_object_notify (G_OBJECT (shell_content), "filter-action");
+}
+
+gint
+e_shell_content_get_filter_value (EShellContent *shell_content)
+{
+ EActionComboBox *combo_box;
+
+ g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), 0);
+
+ combo_box = E_ACTION_COMBO_BOX (shell_content->priv->filter_combo_box);
+
+ return e_action_combo_box_get_current_value (combo_box);
+}
+
+void
+e_shell_content_set_filter_value (EShellContent *shell_content,
+ gint filter_value)
+{
+ EActionComboBox *combo_box;
+
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ combo_box = E_ACTION_COMBO_BOX (shell_content->priv->filter_combo_box);
+
+ e_action_combo_box_set_current_value (combo_box, filter_value);
+ g_object_notify (G_OBJECT (shell_content), "filter-value");
+}
+
+gboolean
+e_shell_content_get_filter_visible (EShellContent *shell_content)
+{
+ g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), FALSE);
+
+ return GTK_WIDGET_VISIBLE (shell_content->priv->filter_combo_box);
+}
+
+void
+e_shell_content_set_filter_visible (EShellContent *shell_content,
+ gboolean filter_visible)
+{
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ if (filter_visible) {
+ gtk_widget_show (shell_content->priv->filter_label);
+ gtk_widget_show (shell_content->priv->filter_combo_box);
+ } else {
+ gtk_widget_hide (shell_content->priv->filter_label);
+ gtk_widget_hide (shell_content->priv->filter_combo_box);
+ }
+}
+
+void
+e_shell_content_add_filter_separator_before (EShellContent *shell_content,
+ gint action_value)
+{
+ EActionComboBox *combo_box;
+
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ combo_box = E_ACTION_COMBO_BOX (shell_content->priv->filter_combo_box);
+
+ e_action_combo_box_add_separator_before (combo_box, action_value);
+}
+
+void
+e_shell_content_add_filter_separator_after (EShellContent *shell_content,
+ gint action_value)
+{
+ EActionComboBox *combo_box;
+
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ combo_box = E_ACTION_COMBO_BOX (shell_content->priv->filter_combo_box);
+
+ e_action_combo_box_add_separator_after (combo_box, action_value);
+}
+
+RuleContext *
+e_shell_content_get_search_context (EShellContent *shell_content)
+{
+ g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), NULL);
+
+ return shell_content->priv->search_context;
+}
+
+FilterRule *
+e_shell_content_get_search_rule (EShellContent *shell_content)
+{
+ g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), NULL);
+
+ return shell_content->priv->search_rule;
+}
+
+void
+e_shell_content_set_search_rule (EShellContent *shell_content,
+ FilterRule *search_rule)
+{
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ if (search_rule != NULL) {
+ g_return_if_fail (IS_FILTER_RULE (search_rule));
+ g_object_ref (search_rule);
+ }
+
+ if (shell_content->priv->search_rule != NULL)
+ g_object_unref (shell_content->priv->search_rule);
+
+ shell_content->priv->search_rule = search_rule;
+ g_object_notify (G_OBJECT (shell_content), "search-rule");
+}
+
+const gchar *
+e_shell_content_get_search_text (EShellContent *shell_content)
+{
+ EIconEntry *icon_entry;
+ GtkWidget *text_entry;
+
+ g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), NULL);
+
+ if (shell_content->priv->search_state == GTK_STATE_INSENSITIVE)
+ return "";
+
+ icon_entry = E_ICON_ENTRY (shell_content->priv->search_entry);
+ text_entry = e_icon_entry_get_entry (icon_entry);
+
+ return gtk_entry_get_text (GTK_ENTRY (text_entry));
+}
+
+void
+e_shell_content_set_search_text (EShellContent *shell_content,
+ const gchar *search_text)
+{
+ EIconEntry *icon_entry;
+ GtkWidget *text_entry;
+
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ icon_entry = E_ICON_ENTRY (shell_content->priv->search_entry);
+ text_entry = e_icon_entry_get_entry (icon_entry);
+
+ search_text = (search_text != NULL) ? search_text : "";
+ gtk_entry_set_text (GTK_ENTRY (text_entry), search_text);
+ g_object_notify (G_OBJECT (shell_content), "search-text");
+}
+
+gboolean
+e_shell_content_get_search_visible (EShellContent *shell_content)
+{
+ g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), FALSE);
+
+ return GTK_WIDGET_VISIBLE (shell_content->priv->search_entry);
+}
+
+void
+e_shell_content_set_search_visible (EShellContent *shell_content,
+ gboolean search_visible)
+{
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ if (search_visible) {
+ gtk_widget_show (shell_content->priv->search_label);
+ gtk_widget_show (shell_content->priv->search_entry);
+ } else {
+ gtk_widget_hide (shell_content->priv->search_label);
+ gtk_widget_hide (shell_content->priv->search_entry);
+ }
+}
+
+GtkRadioAction *
+e_shell_content_get_scope_action (EShellContent *shell_content)
+{
+ EActionComboBox *combo_box;
+
+ g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), NULL);
+
+ combo_box = E_ACTION_COMBO_BOX (shell_content->priv->scope_combo_box);
+
+ return e_action_combo_box_get_action (combo_box);
+}
+
+void
+e_shell_content_set_scope_action (EShellContent *shell_content,
+ GtkRadioAction *scope_action)
+{
+ EActionComboBox *combo_box;
+
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ combo_box = E_ACTION_COMBO_BOX (shell_content->priv->scope_combo_box);
+
+ e_action_combo_box_set_action (combo_box, scope_action);
+ g_object_notify (G_OBJECT (shell_content), "scope-action");
+}
+
+gint
+e_shell_content_get_scope_value (EShellContent *shell_content)
+{
+ EActionComboBox *combo_box;
+
+ g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), 0);
+
+ combo_box = E_ACTION_COMBO_BOX (shell_content->priv->scope_combo_box);
+
+ return e_action_combo_box_get_current_value (combo_box);
+}
+
+void
+e_shell_content_set_scope_value (EShellContent *shell_content,
+ gint scope_value)
+{
+ EActionComboBox *combo_box;
+
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ combo_box = E_ACTION_COMBO_BOX (shell_content->priv->scope_combo_box);
+
+ e_action_combo_box_set_current_value (combo_box, scope_value);
+ g_object_notify (G_OBJECT (shell_content), "scope-value");
+}
+
+gboolean
+e_shell_content_get_scope_visible (EShellContent *shell_content)
+{
+ g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), FALSE);
+
+ return GTK_WIDGET_VISIBLE (shell_content->priv->scope_combo_box);
+}
+
+void
+e_shell_content_set_scope_visible (EShellContent *shell_content,
+ gboolean scope_visible)
+{
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ if (scope_visible) {
+ gtk_widget_show (shell_content->priv->scope_label);
+ gtk_widget_show (shell_content->priv->scope_combo_box);
+ } else {
+ gtk_widget_hide (shell_content->priv->scope_label);
+ gtk_widget_hide (shell_content->priv->scope_combo_box);
+ }
+
+ g_object_notify (G_OBJECT (shell_content), "scope-visible");
+}
+
+void
+e_shell_content_run_advanced_search_dialog (EShellContent *shell_content)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkAction *action;
+ GtkWidget *dialog;
+ GtkWidget *widget;
+ FilterRule *rule;
+ RuleContext *context;
+ const gchar *user_filename;
+ gint response;
+
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ user_filename = shell_content->priv->user_filename;
+
+ rule = e_shell_content_get_search_rule (shell_content);
+
+ if (rule == NULL)
+ rule = filter_rule_new ();
+ else
+ rule = filter_rule_clone (rule);
+
+ context = e_shell_content_get_search_context (shell_content);
+ widget = filter_rule_get_widget (rule, context);
+ filter_rule_set_source (rule, FILTER_SOURCE_INCOMING);
+
+ dialog = gtk_dialog_new_with_buttons (
+ _("Advanced Search"), GTK_WINDOW (shell_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_SAVE, GTK_RESPONSE_APPLY,
+ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
+
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 7);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 300);
+
+ gtk_box_pack_start (
+ GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 0);
+
+ g_signal_connect_swapped (
+ rule, "changed", G_CALLBACK (
+ shell_content_dialog_rule_changed), dialog);
+
+ shell_content_dialog_rule_changed (dialog, rule);
+
+run:
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ if (response != GTK_RESPONSE_OK && response != GTK_RESPONSE_APPLY)
+ goto exit;
+
+ if (!filter_rule_validate (rule))
+ goto run;
+
+ e_shell_content_set_search_rule (shell_content, rule);
+
+ action = E_SHELL_WINDOW_ACTION_SEARCH_EXECUTE (shell_window);
+ gtk_action_activate (action);
+
+ if (response == GTK_RESPONSE_APPLY) {
+ if (!rule_context_find_rule (context, rule->name, rule->source))
+ rule_context_add_rule (context, rule);
+ rule_context_save (context, user_filename);
+ goto run;
+ }
+
+exit:
+ g_object_unref (rule);
+ gtk_widget_destroy (dialog);
+}
+
+void
+e_shell_content_run_edit_searches_dialog (EShellContent *shell_content)
+{
+ RuleContext *context;
+ RuleEditor *editor;
+ const gchar *user_filename;
+
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ context = e_shell_content_get_search_context (shell_content);
+ user_filename = shell_content->priv->user_filename;
+
+ editor = rule_editor_new (
+ context, FILTER_SOURCE_INCOMING, _("Searches"));
+ gtk_window_set_title (GTK_WINDOW (editor), _("Searches"));
+
+ if (gtk_dialog_run (GTK_DIALOG (editor)) == GTK_RESPONSE_OK)
+ rule_context_save (context, user_filename);
+
+ gtk_widget_destroy (GTK_WIDGET (editor));
+}
+
+void
+e_shell_content_run_save_search_dialog (EShellContent *shell_content)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ GtkWidget *dialog;
+ GtkWidget *widget;
+ FilterRule *rule;
+ RuleContext *context;
+ const gchar *search_text;
+ const gchar *user_filename;
+ gchar *search_name;
+ gint response;
+
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ user_filename = shell_content->priv->user_filename;
+
+ rule = e_shell_content_get_search_rule (shell_content);
+ g_return_if_fail (IS_FILTER_RULE (rule));
+ rule = filter_rule_clone (rule);
+
+ search_text = e_shell_content_get_search_text (shell_content);
+ if (search_text == NULL || *search_text == '\0')
+ search_text = "''";
+
+ search_name = g_strdup_printf ("%s %s", rule->name, search_text);
+ filter_rule_set_name (rule, search_name);
+ g_free (search_name);
+
+ context = e_shell_content_get_search_context (shell_content);
+ widget = filter_rule_get_widget (rule, context);
+ filter_rule_set_source (rule, FILTER_SOURCE_INCOMING);
+
+ dialog = gtk_dialog_new_with_buttons (
+ _("Save Search"), GTK_WINDOW (shell_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
+
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 7);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300);
+
+ gtk_box_pack_start (
+ GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 0);
+
+ g_signal_connect_swapped (
+ rule, "changed", G_CALLBACK (
+ shell_content_dialog_rule_changed), dialog);
+
+ shell_content_dialog_rule_changed (dialog, rule);
+
+run:
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ if (response != GTK_RESPONSE_OK)
+ goto exit;
+
+ if (!filter_rule_validate (rule))
+ goto run;
+
+ rule_context_add_rule (context, rule);
+ rule_context_save (context, user_filename);
+
+exit:
+ g_object_unref (rule);
+ gtk_widget_destroy (dialog);
+}
diff --git a/shell/e-shell-content.h b/shell/e-shell-content.h
new file mode 100644
index 0000000000..2259dbd972
--- /dev/null
+++ b/shell/e-shell-content.h
@@ -0,0 +1,143 @@
+/*
+ * e-shell-content.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+/**
+ * SECTION: e-shell-content
+ * @short_description: the right side of the main window
+ * @include: shell/e-shell-content.h
+ **/
+
+#ifndef E_SHELL_CONTENT_H
+#define E_SHELL_CONTENT_H
+
+#include <shell/e-shell-common.h>
+#include <filter/filter-rule.h>
+#include <filter/rule-context.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SHELL_CONTENT \
+ (e_shell_content_get_type ())
+#define E_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SHELL_CONTENT, EShellContent))
+#define E_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SHELL_CONTENT, EShellContentClass))
+#define E_IS_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SHELL_CONTENT))
+#define E_IS_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), E_TYPE_SHELL_CONTENT))
+#define E_SHELL_CONTENT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SHELL_CONTENT, EShellContentClass))
+
+G_BEGIN_DECLS
+
+/* Avoid including <e-shell-view.h>, because it includes us! */
+struct _EShellView;
+
+typedef struct _EShellContent EShellContent;
+typedef struct _EShellContentClass EShellContentClass;
+typedef struct _EShellContentPrivate EShellContentPrivate;
+
+/**
+ * EShellContent:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
+struct _EShellContent {
+ GtkBin parent;
+ EShellContentPrivate *priv;
+};
+
+struct _EShellContentClass {
+ GtkBinClass parent_class;
+
+ /* Factory Methods */
+ RuleContext * (*new_search_context) (void);
+
+ guint32 (*check_state) (EShellContent *shell_content);
+};
+
+GType e_shell_content_get_type (void);
+GtkWidget * e_shell_content_new (struct _EShellView *shell_view);
+guint32 e_shell_content_check_state (EShellContent *shell_content);
+struct _EShellView *
+ e_shell_content_get_shell_view (EShellContent *shell_content);
+GtkRadioAction *e_shell_content_get_filter_action
+ (EShellContent *shell_content);
+void e_shell_content_set_filter_action
+ (EShellContent *shell_content,
+ GtkRadioAction *filter_action);
+gint e_shell_content_get_filter_value(EShellContent *shell_content);
+void e_shell_content_set_filter_value(EShellContent *shell_content,
+ gint filter_value);
+gboolean e_shell_content_get_filter_visible
+ (EShellContent *shell_content);
+void e_shell_content_set_filter_visible
+ (EShellContent *shell_content,
+ gboolean filter_visible);
+void e_shell_content_add_filter_separator_before
+ (EShellContent *shell_content,
+ gint action_value);
+void e_shell_content_add_filter_separator_after
+ (EShellContent *shell_content,
+ gint action_value);
+RuleContext * e_shell_content_get_search_context
+ (EShellContent *shell_content);
+FilterRule * e_shell_content_get_search_rule (EShellContent *shell_content);
+void e_shell_content_set_search_rule (EShellContent *shell_content,
+ FilterRule *search_rule);
+const gchar * e_shell_content_get_search_text (EShellContent *shell_content);
+void e_shell_content_set_search_text (EShellContent *shell_content,
+ const gchar *search_text);
+gboolean e_shell_content_get_search_visible
+ (EShellContent *shell_content);
+void e_shell_content_set_search_visible
+ (EShellContent *shell_content,
+ gboolean search_visible);
+GtkRadioAction *e_shell_content_get_scope_action(EShellContent *shell_content);
+void e_shell_content_set_scope_action(EShellContent *shell_content,
+ GtkRadioAction *scope_action);
+gint e_shell_content_get_scope_value (EShellContent *shell_content);
+void e_shell_content_set_scope_value (EShellContent *shell_content,
+ gint scope_value);
+gboolean e_shell_content_get_scope_visible
+ (EShellContent *shell_content);
+void e_shell_content_set_scope_visible
+ (EShellContent *shell_content,
+ gboolean scope_visible);
+const gchar * e_shell_content_get_view_id (EShellContent *shell_content);
+void e_shell_content_set_view_id (EShellContent *shell_content,
+ const gchar *view_id);
+void e_shell_content_run_advanced_search_dialog
+ (EShellContent *shell_content);
+void e_shell_content_run_edit_searches_dialog
+ (EShellContent *shell_content);
+void e_shell_content_run_save_search_dialog
+ (EShellContent *shell_content);
+
+G_END_DECLS
+
+#endif /* E_SHELL_CONTENT_H */
diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c
index 74a89cc2ec..84d5d64877 100644
--- a/shell/e-shell-importer.c
+++ b/shell/e-shell-importer.c
@@ -48,7 +48,6 @@
#include "e-shell.h"
#include "e-shell-window.h"
-#include "e-shell-constants.h"
#include "e-shell-importer.h"
@@ -251,29 +250,6 @@ filetype_changed_cb (GtkWidget *combobox, ImportData *data)
filename_changed (data->filepage->filename, data);
}
-#if 0
-static int
-compare_info_name (const void *data1, const void *data2)
-{
- const Bonobo_ServerInfo *info1 = (Bonobo_ServerInfo *)data1;
- const Bonobo_ServerInfo *info2 = (Bonobo_ServerInfo *)data2;
- const char *name1 = get_name_from_component_info (info1);
- const char *name2 = get_name_from_component_info (info2);
-
- /* If we can't find a name for a plug-in, its iid will be used
- * for display. Put such plug-ins at the end of the list since
- * their displayed name won't be really user-friendly
- */
- if (name1 == NULL) {
- return -1;
- }
- if (name2 == NULL) {
- return 1;
- }
- return g_utf8_collate (name1, name2);
-}
-#endif
-
static ImportDialogFilePage *
importer_file_page_new (ImportData *data)
{
diff --git a/shell/e-shell-importer.h b/shell/e-shell-importer.h
index d9dffcfb0b..bd57fbd4f0 100644
--- a/shell/e-shell-importer.h
+++ b/shell/e-shell-importer.h
@@ -20,9 +20,16 @@
*
*/
-#ifndef _E_SHELL_IMPORTER_H_
-#define _E_SHELL_IMPORTER_H_
+#ifndef E_SHELL_IMPORTER_H
+#define E_SHELL_IMPORTER_H
-void e_shell_importer_start_import (EShellWindow *shell_window);
+#include "e-shell-common.h"
+#include "e-shell-window.h"
-#endif
+G_BEGIN_DECLS
+
+void e_shell_importer_start_import (EShellWindow *shell_window);
+
+G_END_DECLS
+
+#endif /* E_SHELL_IMPORTER_H */
diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c
new file mode 100644
index 0000000000..53df4106b4
--- /dev/null
+++ b/shell/e-shell-migrate.c
@@ -0,0 +1,335 @@
+/*
+ * e-shell-migrate.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-shell-migrate.h"
+
+#include <string.h>
+#include <unistd.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <libedataserver/e-xml-utils.h>
+
+#include "e-util/e-bconf-map.h"
+#include "e-util/e-error.h"
+#include "e-util/e-fsutils.h"
+#include "e-util/e-util.h"
+
+#define GCONF_VERSION_KEY "/apps/evolution/version"
+#define GCONF_LAST_VERSION_KEY "/apps/evolution/last_version"
+
+static const gchar *
+shell_migrate_get_old_data_dir (void)
+{
+ static gchar *old_data_dir = NULL;
+
+ if (G_UNLIKELY (old_data_dir == NULL))
+ old_data_dir = g_build_filename (
+ g_get_home_dir (), "evolution", NULL);
+
+ return old_data_dir;
+}
+
+static gboolean
+shell_migrate_attempt (EShell *shell,
+ gint major,
+ gint minor,
+ gint micro)
+{
+ GList *backends;
+ gboolean success = TRUE;
+
+ backends = e_shell_get_shell_backends (shell);
+
+ while (success && backends != NULL) {
+ EShellBackend *shell_backend = backends->data;
+ GError *error = NULL;
+
+ success = e_shell_backend_migrate (
+ shell_backend, major, minor, micro, &error);
+
+ if (error != NULL) {
+ gint response;
+
+ response = e_error_run (
+ NULL, "shell:upgrade-failed",
+ error->message, NULL);
+
+ if (response == GTK_RESPONSE_CANCEL)
+ success = FALSE;
+
+ g_error_free (error);
+ }
+
+ backends = g_list_next (backends);
+ }
+
+ return success;
+}
+
+static void
+shell_migrate_get_version (EShell *shell,
+ gint *major,
+ gint *minor,
+ gint *micro)
+{
+ GConfClient *client;
+ const gchar *key;
+ const gchar *old_data_dir;
+ gchar *string;
+
+ old_data_dir = shell_migrate_get_old_data_dir ();
+
+ key = GCONF_VERSION_KEY;
+ client = e_shell_get_gconf_client (shell);
+ string = gconf_client_get_string (client, key, NULL);
+
+ if (string != NULL) {
+ /* Since 1.4.0 we've kept the version key in GConf. */
+ sscanf (string, "%d.%d.%d", major, minor, micro);
+ g_free (string);
+
+ } else if (!g_file_test (old_data_dir, G_FILE_TEST_IS_DIR)) {
+ /* If the old data directory does not exist,
+ * it must be a new installation. */
+ *major = 0;
+ *minor = 0;
+ *micro = 0;
+
+ } else {
+ xmlDocPtr doc;
+ xmlNodePtr source;
+ gchar *filename;
+
+ filename = g_build_filename (
+ old_data_dir, "config.xmldb", NULL);
+ doc = e_xml_parse_file (filename);
+ g_free (filename);
+
+ if (doc == NULL)
+ return;
+
+ source = e_bconf_get_path (doc, "/Shell");
+ if (source != NULL) {
+ key = "upgrade_from_1_0_to_1_2_performed";
+ string = e_bconf_get_value (source, key);
+ }
+
+ if (string != NULL && *string == '1') {
+ *major = 1;
+ *minor = 2;
+ *micro = 0;
+ } else {
+ *major = 1;
+ *minor = 0;
+ *micro = 0;
+ }
+
+ g_free (string);
+
+ if (doc != NULL)
+ xmlFreeDoc (doc);
+ }
+}
+
+static gint
+shell_migrate_remove_dir (const gchar *root,
+ const gchar *path)
+{
+ GDir *dir;
+ const gchar *basename;
+ gchar *filename;
+ gint result = -1;
+
+ /* Recursively removes a directory and its contents. */
+
+ dir = g_dir_open (path, 0, NULL);
+ if (dir == NULL)
+ return -1;
+
+ while ((basename = g_dir_read_name (dir)) != NULL) {
+ filename = g_build_filename (path, basename, NULL);
+
+ /* Make sure we haven't strayed from the evolution dir. */
+ g_return_val_if_fail (strlen (path) >= strlen (root), -1);
+ g_return_val_if_fail (g_str_has_prefix (path, root), -1);
+
+ if (g_file_test (filename, G_FILE_TEST_IS_DIR)) {
+ if (shell_migrate_remove_dir (root, filename) < 0)
+ goto fail;
+ } else {
+ if (g_unlink (filename) < 0)
+ goto fail;
+ }
+
+ g_free (filename);
+ filename = NULL;
+ }
+
+ result = g_rmdir (path);
+
+fail:
+ g_free (filename);
+ g_dir_close (dir);
+
+ return result;
+}
+
+gboolean
+e_shell_migrate_attempt (EShell *shell)
+{
+ GConfClient *client;
+ const gchar *key;
+ const gchar *old_data_dir;
+ gint major, minor, micro;
+ gint last_major, last_minor, last_micro;
+ gint curr_major, curr_minor, curr_micro;
+ gboolean migrated = FALSE;
+ gchar *string;
+
+ g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+
+ client = e_shell_get_gconf_client (shell);
+ old_data_dir = shell_migrate_get_old_data_dir ();
+
+ if (sscanf (BASE_VERSION, "%d.%d", &curr_major, &curr_minor) != 2) {
+ g_warning ("Could not parse BASE_VERSION (%s)", BASE_VERSION);
+ return TRUE;
+ }
+
+ curr_micro = atoi (UPGRADE_REVISION);
+
+ shell_migrate_get_version (shell, &major, &minor, &micro);
+
+ if (!(curr_major > major ||
+ (curr_major == major && curr_minor > minor) ||
+ (curr_minor == minor && curr_micro > micro)))
+ goto check_old;
+
+ /* If upgrading from < 1.5, we need to copy most data from
+ * ~/evolution to ~/.evolution. Make sure we have the disk
+ * space for it before proceeding. */
+ if (major == 1 && minor < 5) {
+ glong avail;
+ glong usage;
+
+ usage = e_fsutils_usage (old_data_dir);
+ avail = e_fsutils_avail (g_get_home_dir ());
+ if (usage >= 0 && avail >= 0 && avail < usage) {
+ gchar *need;
+ gchar *have;
+
+ need = g_strdup_printf (_("%ld KB"), usage);
+ have = g_strdup_printf (_("%ld KB"), avail);
+
+ e_error_run (
+ NULL, "shell:upgrade-nospace",
+ need, have, NULL);
+
+ g_free (need);
+ g_free (have);
+
+ _exit (EXIT_SUCCESS);
+ }
+ }
+
+ if (!shell_migrate_attempt (shell, major, minor, micro))
+ _exit (EXIT_SUCCESS);
+
+ /* Record a successful migration. */
+ string = g_strdup_printf ("%d.%d.%d", major, minor, micro);
+ gconf_client_set_string (client, GCONF_VERSION_KEY, string, NULL);
+ g_free (string);
+
+ migrated = TRUE;
+
+check_old:
+
+ key = GCONF_LAST_VERSION_KEY;
+
+ /* Try to retrieve the last migrated version from GConf. */
+ string = gconf_client_get_string (client, key, NULL);
+ if (migrated || string == NULL || sscanf (string, "%d.%d.%d",
+ &last_major, &last_minor, &last_micro) != 3) {
+ last_major = major;
+ last_minor = minor;
+ last_micro = micro;
+ }
+ g_free (string);
+
+ /* If the last migrated version was old, check for stuff to remove. */
+ if (last_major == 1 && last_minor < 5 &&
+ g_file_test (old_data_dir, G_FILE_TEST_IS_DIR)) {
+
+ gint response;
+
+ string = g_strdup_printf (
+ "%d.%d.%d", last_major, last_minor, last_micro);
+ response = e_error_run (
+ NULL, "shel:upgrade-remove-1-4", string, NULL);
+ g_free (string);
+
+ switch (response) {
+ case GTK_RESPONSE_OK: /* delete */
+ response = e_error_run (
+ NULL,
+ "shell:upgrade-remove-1-4-confirm",
+ NULL);
+ if (response == GTK_RESPONSE_OK)
+ shell_migrate_remove_dir (
+ old_data_dir, old_data_dir);
+ else
+ break;
+ /* fall through */
+
+ case GTK_RESPONSE_ACCEPT: /* keep */
+ last_major = curr_major;
+ last_minor = curr_minor;
+ last_micro = curr_micro;
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ last_major = curr_major;
+ last_minor = curr_minor;
+ last_micro = curr_micro;
+ }
+
+ string = g_strdup_printf (
+ "%d.%d.%d", last_major, last_minor, last_micro);
+ gconf_client_set_string (client, key, string, NULL);
+ g_free (string);
+
+ return TRUE;
+}
+
+GQuark
+e_shell_migrate_error_quark (void)
+{
+ static GQuark quark = 0;
+
+ if (G_UNLIKELY (quark == 0))
+ quark = g_quark_from_static_string (
+ "e-shell-migrate-error-quark");
+
+ return quark;
+}
diff --git a/mail/mail-crypto.c b/shell/e-shell-migrate.h
index f484e0a5d8..8ebe69709b 100644
--- a/mail/mail-crypto.c
+++ b/shell/e-shell-migrate.h
@@ -1,4 +1,6 @@
/*
+ * e-shell-migrate.h
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,41 +15,38 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Jeffrey Stedfast <fejj@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
+/* This is an EShell extension that handles migrating from older versions. */
-#include <camel/camel-gpg-context.h>
-#include <libedataserver/e-account.h>
+#ifndef E_SHELL_MIGRATE_H
+#define E_SHELL_MIGRATE_H
-#include "mail-crypto.h"
-#include "mail-session.h"
+#include <shell/e-shell-common.h>
+#include <shell/e-shell.h>
/**
- * mail_crypto_get_pgp_cipher_context:
- * @account: Account that will be using this context
+ * E_SHELL_MIGRATE_ERROR:
*
- * Constructs a new GnuPG cipher context with the appropriate
- * options set based on the account provided.
+ * Error domain for migration operations. Errors in this domain will be
+ * from the #EShellMigrateError enumeration. See #GError for information
+ * on error domains.
**/
-CamelCipherContext *
-mail_crypto_get_pgp_cipher_context (EAccount *account)
-{
- CamelCipherContext *cipher;
+#define E_SHELL_MIGRATE_ERROR \
+ (e_shell_migrate_error_quark ())
+
+G_BEGIN_DECLS
+
+/* XXX Need more specific error codes? */
+typedef enum {
+ E_SHELL_MIGRATE_ERROR_FAILED
+} EShellMigrateError;
+
+gboolean e_shell_migrate_attempt (EShell *shell);
+GQuark e_shell_migrate_error_quark (void);
- cipher = camel_gpg_context_new (session);
- if (account)
- camel_gpg_context_set_always_trust ((CamelGpgContext *) cipher, account->pgp_always_trust);
+G_END_DECLS
- return cipher;
-}
+#endif /* E_SHELL_MIGRATE_H */
diff --git a/shell/e-shell-nm.c b/shell/e-shell-nm.c
index f51a565486..581e505111 100644
--- a/shell/e-shell-nm.c
+++ b/shell/e-shell-nm.c
@@ -30,48 +30,40 @@
#include <string.h>
#include <glib.h>
#include <e-shell.h>
-#include <Evolution.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <dbus/dbus-glib.h>
#include <NetworkManager/NetworkManager.h>
-gboolean e_shell_dbus_initialise (EShell *shell);
+static DBusConnection *dbus_connection;
-static DBusConnection *dbus_connection = NULL;
+/* Forward Declaration */
+gboolean e_shell_dbus_initialize (EShell *shell);
static gboolean
-reinit_dbus (gpointer user_data)
+reinit_dbus (EShell *shell)
{
- EShell *shell = user_data;
-
- if (e_shell_dbus_initialise (shell))
- return FALSE;
-
- /* keep trying to re-establish dbus connection */
-
- return TRUE;
+ return !e_shell_dbus_initialize (shell);
}
static DBusHandlerResult
e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED,
- DBusMessage *message, void *user_data)
+ DBusMessage *message,
+ gpointer user_data)
{
- const char *object;
- EShell *shell = user_data;
- GNOME_Evolution_ShellState shell_state;
- EShellLineStatus line_status;
DBusError error = DBUS_ERROR_INIT;
+ EShell *shell = user_data;
+ const gchar *path;
guint32 state;
- object = dbus_message_get_path (message);
+ path = dbus_message_get_path (message);
if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected") &&
- object && !strcmp (object, DBUS_PATH_LOCAL)) {
+ path != NULL && strcmp (path, DBUS_PATH_LOCAL) == 0) {
dbus_connection_unref (dbus_connection);
dbus_connection = NULL;
- g_timeout_add_seconds (3, reinit_dbus, shell);
+ g_timeout_add_seconds (3, (GSourceFunc) reinit_dbus, shell);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -89,24 +81,28 @@ e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED,
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
- line_status = e_shell_get_line_status (shell);
-
- if (line_status == E_SHELL_LINE_STATUS_ONLINE && (state == NM_STATE_ASLEEP || state == NM_STATE_DISCONNECTED)) {
- shell_state = GNOME_Evolution_FORCED_OFFLINE;
- e_shell_set_line_status (shell, shell_state);
- } else if (line_status == E_SHELL_LINE_STATUS_FORCED_OFFLINE && state == NM_STATE_CONNECTED) {
- shell_state = GNOME_Evolution_USER_ONLINE;
- e_shell_set_line_status (shell, shell_state);
+ switch (state) {
+ case NM_STATE_CONNECTED:
+ e_shell_set_network_available (shell, TRUE);
+ break;
+ case NM_STATE_ASLEEP:
+ case NM_STATE_DISCONNECTED:
+ e_shell_set_network_available (shell, FALSE);
+ break;
+ default:
+ break;
}
return DBUS_HANDLER_RESULT_HANDLED;
}
gboolean
-e_shell_dbus_initialise (EShell *shell)
+e_shell_dbus_initialize (EShell *shell)
{
DBusError error = DBUS_ERROR_INIT;
+ g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+
if (dbus_connection != NULL)
return TRUE;
diff --git a/shell/e-shell-settings-dialog.c b/shell/e-shell-settings-dialog.c
deleted file mode 100644
index 291a46c187..0000000000
--- a/shell/e-shell-settings-dialog.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib/gi18n.h>
-
-#include "e-shell-settings-dialog.h"
-
-#include "e-corba-config-page.h"
-#include <e-util/e-icon-factory.h>
-
-#include <bonobo/bonobo-widget.h>
-#include <bonobo/bonobo-exception.h>
-
-#include <bonobo-activation/bonobo-activation.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-struct _EShellSettingsDialogPrivate {
- GHashTable *types;
-};
-
-G_DEFINE_TYPE (EShellSettingsDialog, e_shell_settings_dialog, E_TYPE_MULTI_CONFIG_DIALOG)
-
-
-/* FIXME ugly hack to work around that sizing of invisible widgets is broken
- with Bonobo. */
-
-static void
-set_dialog_size (EShellSettingsDialog *dialog)
-{
- PangoLayout *layout;
- PangoContext *context;
- PangoFontMetrics *metrics;
- int width, height;
-
- layout = gtk_widget_create_pango_layout (GTK_WIDGET (dialog), "M");
- context = pango_layout_get_context (layout);
- metrics = pango_context_get_metrics (context,
- gtk_widget_get_style (GTK_WIDGET (dialog))->font_desc,
- pango_context_get_language (context));
-
- pango_layout_get_pixel_size (layout, &width, NULL);
-
- width *= 60;
- height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics)
- + pango_font_metrics_get_descent (metrics)) * 30;
-
- gtk_window_set_default_size((GtkWindow *)dialog, width, height);
- g_object_unref (layout);
- pango_font_metrics_unref (metrics);
-}
-
-
-/* Page handling. */
-
-struct _Page {
- char *title;
- char *description;
- GdkPixbuf *icon;
- Bonobo_ActivationProperty *type;
- int priority;
- EConfigPage *page_widget;
-};
-typedef struct _Page Page;
-
-static Page *
-page_new (const char *title,
- const char *description,
- GdkPixbuf *icon,
- Bonobo_ActivationProperty *type,
- int priority,
- EConfigPage *page_widget)
-{
- Page *page;
-
- if (icon != NULL)
- g_object_ref (icon);
-
- page = g_new (Page, 1);
- page->title = g_strdup (title);
- page->description = g_strdup (description);
- page->icon = icon;
- page->type = type;
- page->priority = priority;
- page->page_widget = page_widget;
-
- return page;
-}
-
-static void
-page_free (Page *page)
-{
- g_free (page->title);
- g_free (page->description);
-
- if (page->icon != NULL)
- g_object_unref (page->icon);
-
- g_free (page);
-}
-
-static int
-compare_page_func (const void *a,
- const void *b)
-{
- const Page *page_a;
- const Page *page_b;
-
- page_a = (const Page *) a;
- page_b = (const Page *) b;
-
- if (page_a->priority == page_b->priority)
- return strcmp (page_a->title, page_b->title);
-
- return page_a->priority - page_b->priority;
-}
-
-static GList *
-sort_page_list (GList *list)
-{
- return g_list_sort (list, compare_page_func);
-}
-
-static void
-load_pages (EShellSettingsDialog *dialog)
-{
- EShellSettingsDialogPrivate *priv;
- Bonobo_ServerInfoList *control_list;
- const gchar * const *language_names;
- CORBA_Environment ev;
- GSList *languages = NULL;
- GList *page_list;
- GList *p;
- int i, j;
-
- priv = dialog->priv;
-
- CORBA_exception_init (&ev);
-
- control_list = bonobo_activation_query ("repo_ids.has('IDL:GNOME/Evolution/ConfigControl:" BASE_VERSION "')", NULL, &ev);
- if (ev._major != CORBA_NO_EXCEPTION || control_list == NULL) {
- g_warning ("Cannot load configuration pages -- %s", BONOBO_EX_REPOID (&ev));
- CORBA_exception_free (&ev);
- return;
- }
-
- CORBA_exception_free (&ev);
-
- language_names = g_get_language_names ();
- while (*language_names != NULL)
- languages = g_slist_append (languages, (gpointer)(*language_names++));
-
- page_list = NULL;
- for (i = 0; i < control_list->_length; i ++) {
- CORBA_Object corba_object;
- Bonobo_ServerInfo *info;
- const char *title;
- const char *description;
- const char *icon_path;
- const char *priority_string;
- Bonobo_ActivationProperty *type;
- int priority;
- GdkPixbuf *icon;
-
- CORBA_exception_init (&ev);
-
- info = & control_list->_buffer[i];
-
- title = bonobo_server_info_prop_lookup (info, "evolution2:config_item:title", languages);
- description = bonobo_server_info_prop_lookup (info, "evolution2:config_item:description", languages);
- icon_path = bonobo_server_info_prop_lookup (info, "evolution2:config_item:icon_name", NULL);
- type = bonobo_server_info_prop_find (info, "evolution2:config_item:type");
- priority_string = bonobo_server_info_prop_lookup (info, "evolution2: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);
- } else {
- icon = e_icon_factory_get_icon (icon_path, GTK_ICON_SIZE_DIALOG);
- }
- }
-
- if (type != NULL && type->v._d != Bonobo_ACTIVATION_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);
-
- if (! BONOBO_EX (&ev)) {
- Page *page;
-
- page = page_new (title, description, icon, type, priority,
- E_CONFIG_PAGE (e_corba_config_page_new_from_objref (corba_object)));
-
- 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);
- }
-
- if (icon != NULL)
- g_object_unref (icon);
-
- CORBA_exception_free (&ev);
- }
- g_slist_free(languages);
-
- page_list = sort_page_list (page_list);
- for (p = page_list, i = 0; p != NULL; p = p->next, i++) {
- Page *page;
-
- page = (Page *) p->data;
-
- e_multi_config_dialog_add_page (E_MULTI_CONFIG_DIALOG (dialog),
- page->title,
- page->description,
- page->icon,
- page->page_widget);
-
- if (page->type != NULL) {
- Bonobo_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)
- g_hash_table_insert (priv->types, g_strdup (list._buffer[j]),
- GINT_TO_POINTER (i));
- }
- }
-
-
- page_free (page);
- }
-
- g_list_free (page_list);
- CORBA_free (control_list);
-}
-
-
-/* GtkObject methods. */
-
-static void
-impl_finalize (GObject *object)
-{
- EShellSettingsDialog *dialog;
- EShellSettingsDialogPrivate *priv;
-
- dialog = E_SHELL_SETTINGS_DIALOG (object);
- priv = dialog->priv;
-
- g_hash_table_destroy (priv->types);
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (e_shell_settings_dialog_parent_class)->finalize) (object);
-}
-
-
-static void
-e_shell_settings_dialog_class_init (EShellSettingsDialogClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = impl_finalize;
-}
-
-static void
-e_shell_settings_dialog_init (EShellSettingsDialog *dialog)
-{
- EShellSettingsDialogPrivate *priv;
-
- priv = g_new (EShellSettingsDialogPrivate, 1);
- priv->types = g_hash_table_new_full (
- g_str_hash, g_str_equal,
- (GDestroyNotify) g_free,
- (GDestroyNotify) NULL);
-
- dialog->priv = priv;
-
- load_pages (dialog);
- set_dialog_size (dialog);
-
- gtk_window_set_title (GTK_WINDOW (dialog), _("Evolution Preferences"));
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
-}
-
-
-GtkWidget *
-e_shell_settings_dialog_new (void)
-{
- EShellSettingsDialog *new;
-
- new = g_object_new (e_shell_settings_dialog_get_type (), NULL);
-
- return GTK_WIDGET (new);
-}
-
-void
-e_shell_settings_dialog_show_type (EShellSettingsDialog *dialog, const char *type)
-{
- EShellSettingsDialogPrivate *priv;
- gpointer key, value;
- int page;
-
- g_return_if_fail (dialog != NULL);
- g_return_if_fail (E_IS_SHELL_SETTINGS_DIALOG (dialog));
- g_return_if_fail (type != NULL);
-
- priv = dialog->priv;
-
- if (!g_hash_table_lookup_extended (priv->types, type, &key, &value)) {
- char *slash, *supertype;
-
- slash = strchr (type, '/');
- if (slash) {
- supertype = g_strndup (type, slash - type);
- value = g_hash_table_lookup (priv->types, type);
- g_free (supertype);
- } else
- value = NULL;
- }
- page = GPOINTER_TO_INT (value);
-
- e_multi_config_dialog_show_page (E_MULTI_CONFIG_DIALOG (dialog), page);
-}
-
-
diff --git a/shell/e-shell-settings-dialog.h b/shell/e-shell-settings-dialog.h
deleted file mode 100644
index 55cce4a52f..0000000000
--- a/shell/e-shell-settings-dialog.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_SHELL_SETTINGS_DIALOG_H_
-#define _E_SHELL_SETTINGS_DIALOG_H_
-
-#include "e-multi-config-dialog.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_SHELL_SETTINGS_DIALOG (e_shell_settings_dialog_get_type ())
-#define E_SHELL_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SHELL_SETTINGS_DIALOG, EShellSettingsDialog))
-#define E_SHELL_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_SETTINGS_DIALOG, EShellSettingsDialogClass))
-#define E_IS_SHELL_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SHELL_SETTINGS_DIALOG))
-#define E_IS_SHELL_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_SETTINGS_DIALOG))
-
-
-typedef struct _EShellSettingsDialog EShellSettingsDialog;
-typedef struct _EShellSettingsDialogPrivate EShellSettingsDialogPrivate;
-typedef struct _EShellSettingsDialogClass EShellSettingsDialogClass;
-
-struct _EShellSettingsDialog {
- EMultiConfigDialog parent;
-
- EShellSettingsDialogPrivate *priv;
-};
-
-struct _EShellSettingsDialogClass {
- EMultiConfigDialogClass parent_class;
-};
-
-
-GType e_shell_settings_dialog_get_type (void);
-GtkWidget *e_shell_settings_dialog_new (void);
-void e_shell_settings_dialog_show_type (EShellSettingsDialog *dialog,
- const char *type);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_SHELL_SETTINGS_DIALOG_H_ */
diff --git a/shell/e-shell-settings.c b/shell/e-shell-settings.c
new file mode 100644
index 0000000000..0883382ffc
--- /dev/null
+++ b/shell/e-shell-settings.c
@@ -0,0 +1,559 @@
+/*
+ * e-shell-settings.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-shell-settings.h"
+
+#include "e-util/gconf-bridge.h"
+
+#define E_SHELL_SETTINGS_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SHELL_SETTINGS, EShellSettingsPrivate))
+
+struct _EShellSettingsPrivate {
+ GArray *value_array;
+ guint debug : 1;
+};
+
+static GList *instances;
+static guint property_count;
+static gpointer parent_class;
+
+static void
+shell_settings_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EShellSettingsPrivate *priv;
+ GValue *dest_value;
+
+ priv = E_SHELL_SETTINGS_GET_PRIVATE (object);
+
+ dest_value = &g_array_index (
+ priv->value_array, GValue, property_id - 1);
+
+ g_value_copy (value, dest_value);
+ g_object_notify (object, pspec->name);
+
+ if (priv->debug) {
+ gchar *contents;
+
+ contents = g_strdup_value_contents (value);
+ g_debug (
+ "Setting '%s' set to '%s' (%s)",
+ pspec->name, contents, G_VALUE_TYPE_NAME (value));
+ g_free (contents);
+ }
+}
+
+static void
+shell_settings_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EShellSettingsPrivate *priv;
+ GValue *src_value;
+
+ priv = E_SHELL_SETTINGS_GET_PRIVATE (object);
+
+ src_value = &g_array_index (
+ priv->value_array, GValue, property_id - 1);
+
+ g_value_copy (src_value, value);
+}
+
+static void
+shell_settings_finalize (GObject *object)
+{
+ EShellSettingsPrivate *priv;
+ guint ii;
+
+ priv = E_SHELL_SETTINGS_GET_PRIVATE (object);
+
+ for (ii = 0; ii < priv->value_array->len; ii++)
+ g_value_unset (&g_array_index (priv->value_array, GValue, ii));
+
+ g_array_free (priv->value_array, TRUE);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+shell_settings_class_init (EShellSettingsClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EShellSettingsPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = shell_settings_set_property;
+ object_class->get_property = shell_settings_get_property;
+ object_class->finalize = shell_settings_finalize;
+}
+
+static void
+shell_settings_init (EShellSettings *shell_settings,
+ GObjectClass *object_class)
+{
+ GArray *value_array;
+ GParamSpec **pspecs;
+ guint ii;
+
+ instances = g_list_prepend (instances, shell_settings);
+
+ value_array = g_array_new (FALSE, TRUE, sizeof (GValue));
+ g_array_set_size (value_array, property_count);
+
+ shell_settings->priv = E_SHELL_SETTINGS_GET_PRIVATE (shell_settings);
+ shell_settings->priv->value_array = value_array;
+
+ g_object_freeze_notify (G_OBJECT (shell_settings));
+
+ pspecs = g_object_class_list_properties (object_class, NULL);
+ for (ii = 0; ii < property_count; ii++) {
+ GParamSpec *pspec = pspecs[ii];
+ GValue *value;
+
+ value = &g_array_index (value_array, GValue, ii);
+ g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec));
+ g_param_value_set_default (pspec, value);
+ g_object_notify (G_OBJECT (shell_settings), pspec->name);
+ }
+ g_free (pspecs);
+
+ g_object_thaw_notify (G_OBJECT (shell_settings));
+}
+
+GType
+e_shell_settings_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (EShellSettingsClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) shell_settings_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EShellSettings),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) shell_settings_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ G_TYPE_OBJECT, "EShellSettings", &type_info, 0);
+ }
+
+ return type;
+}
+
+/**
+ * e_shell_settings_install_property:
+ * @pspec: a #GParamSpec
+ *
+ * Installs a new class property for #EShellSettings. This is usually
+ * done during initialization of a #EShellBackend or plugin, followed by
+ * a call to e_shell_settings_bind_to_gconf() to bind the property to a
+ * GConf key.
+ **/
+void
+e_shell_settings_install_property (GParamSpec *pspec)
+{
+ static GObjectClass *class = NULL;
+ GList *iter, *next;
+
+ g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+
+ if (G_UNLIKELY (class == NULL))
+ class = g_type_class_ref (E_TYPE_SHELL_SETTINGS);
+
+ if (g_object_class_find_property (class, pspec->name) != NULL) {
+ g_warning (
+ "Settings property \"%s\" already exists",
+ pspec->name);
+ return;
+ }
+
+ for (iter = instances; iter != NULL; iter = iter->next)
+ g_object_freeze_notify (iter->data);
+
+ g_object_class_install_property (class, ++property_count, pspec);
+
+ for (iter = instances; iter != NULL; iter = iter->next) {
+ EShellSettings *shell_settings = iter->data;
+ GArray *value_array;
+ GValue *value;
+
+ value_array = shell_settings->priv->value_array;
+ g_array_set_size (value_array, property_count);
+
+ value = &g_array_index (
+ value_array, GValue, property_count - 1);
+ g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec));
+ g_param_value_set_default (pspec, value);
+ g_object_notify (G_OBJECT (shell_settings), pspec->name);
+ }
+
+ for (iter = instances; iter != NULL; iter = next) {
+ next = iter->next;
+ g_object_thaw_notify (iter->data);
+ }
+}
+
+/**
+ * e_shell_settings_bind_to_gconf:
+ * @shell_settings: an #EShellSettings
+ * @property_name: the name of the property to bind
+ * @gconf_key: the GConf key to bind the property to
+ *
+ * Binds @property_name to @gconf_key, causing them to have the same value
+ * at all times.
+ *
+ * The types of @property_name and @gconf_key should be compatible. Floats
+ * and doubles, and ints, uints, longs, unlongs, int64s, uint64s, chars,
+ * uchars and enums can be matched up. Booleans and strings can only be
+ * matched to their respective types.
+ *
+ * On calling this function, @property_name is initialized to the current
+ * value of @gconf_key.
+ **/
+void
+e_shell_settings_bind_to_gconf (EShellSettings *shell_settings,
+ const gchar *property_name,
+ const gchar *gconf_key)
+{
+ g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings));
+ g_return_if_fail (property_name != NULL);
+ g_return_if_fail (gconf_key != NULL);
+
+ gconf_bridge_bind_property (
+ gconf_bridge_get (), gconf_key,
+ G_OBJECT (shell_settings), property_name);
+}
+
+/**
+ * e_shell_settings_enable_debug:
+ * @shell_settings: an #EShellSettings
+ *
+ * Print a debug message to standard output when a property value changes.
+ **/
+void
+e_shell_settings_enable_debug (EShellSettings *shell_settings)
+{
+ g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings));
+
+ shell_settings->priv->debug = TRUE;
+}
+
+/**
+ * e_shell_settings_get_boolean:
+ * @shell_settings: an #EShellSettings
+ * @property_name: an installed property name
+ *
+ * Return the contents of an #EShellSettings property of type
+ * #G_TYPE_BOOLEAN.
+ *
+ * Returns: boolean contents of @property_name
+ **/
+gboolean
+e_shell_settings_get_boolean (EShellSettings *shell_settings,
+ const gchar *property_name)
+{
+ GObject *object;
+ GValue value = { 0, };
+ gboolean v_boolean;
+
+ g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), FALSE);
+ g_return_val_if_fail (property_name != NULL, FALSE);
+
+ object = G_OBJECT (shell_settings);
+ g_value_init (&value, G_TYPE_BOOLEAN);
+ g_object_get_property (object, property_name, &value);
+ v_boolean = g_value_get_boolean (&value);
+ g_value_unset (&value);
+
+ return v_boolean;
+}
+
+/**
+ * e_shell_settings_set_boolean:
+ * @shell_settings: an #EShellSettings
+ * @property_name: an installed property name
+ * @v_boolean: boolean value to be set
+ *
+ * Sets the contents of an #EShellSettings property of type #G_TYPE_BOOLEAN
+ * to @v_boolean. If @property_name is bound to a GConf key, the GConf key
+ * will also be set to @v_boolean.
+ **/
+void
+e_shell_settings_set_boolean (EShellSettings *shell_settings,
+ const gchar *property_name,
+ gboolean v_boolean)
+{
+ GObject *object;
+ GValue value = { 0, };
+
+ g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings));
+ g_return_if_fail (property_name != NULL);
+
+ object = G_OBJECT (shell_settings);
+ g_value_init (&value, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&value, v_boolean);
+ g_object_set_property (object, property_name, &value);
+ g_value_unset (&value);
+}
+
+/**
+ * e_shell_settings_get_int:
+ * @shell_settings: an #EShellSettings
+ * @property_name: an installed property name
+ *
+ * Returns the contents of an #EShellSettings property of type
+ * #G_TYPE_INT.
+ *
+ * Returns: integer contents of @property_name
+ **/
+gint
+e_shell_settings_get_int (EShellSettings *shell_settings,
+ const gchar *property_name)
+{
+ GObject *object;
+ GValue value = { 0, };
+ gint v_int;
+
+ g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), 0);
+ g_return_val_if_fail (property_name != NULL, 0);
+
+ object = G_OBJECT (shell_settings);
+ g_value_init (&value, G_TYPE_INT);
+ g_object_get_property (object, property_name, &value);
+ v_int = g_value_get_int (&value);
+ g_value_unset (&value);
+
+ return v_int;
+}
+
+/**
+ * e_shell_settings_set_int:
+ * @shell_settings: an #EShellSettings
+ * @property_name: an installed property name
+ * @v_int: integer value to be set
+ *
+ * Sets the contents of an #EShellSettings property of type #G_TYPE_INT
+ * to @v_int. If @property_name is bound to a GConf key, the GConf key
+ * will also be set to @v_int.
+ **/
+void
+e_shell_settings_set_int (EShellSettings *shell_settings,
+ const gchar *property_name,
+ gint v_int)
+{
+ GObject *object;
+ GValue value = { 0, };
+
+ g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings));
+ g_return_if_fail (property_name != NULL);
+
+ object = G_OBJECT (shell_settings);
+ g_value_init (&value, G_TYPE_INT);
+ g_value_set_int (&value, v_int);
+ g_object_set_property (object, property_name, &value);
+ g_value_unset (&value);
+}
+
+/**
+ * e_shell_settings_get_string:
+ * @shell_settings: an #EShellSettings
+ * @property_name: an installed property name
+ *
+ * Returns the contents of an #EShellSettings property of type
+ * #G_TYPE_STRING. The returned string should be freed using g_free().
+ *
+ * Returns: string contents of @property_name
+ **/
+gchar *
+e_shell_settings_get_string (EShellSettings *shell_settings,
+ const gchar *property_name)
+{
+ GObject *object;
+ GValue value = { 0, };
+ gchar *v_string;
+
+ g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL);
+ g_return_val_if_fail (property_name != NULL, NULL);
+
+ object = G_OBJECT (shell_settings);
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (object, property_name, &value);
+ v_string = g_value_dup_string (&value);
+ g_value_unset (&value);
+
+ return v_string;
+}
+
+/**
+ * e_shell_settings_set_string:
+ * @shell_settings: an #EShellSettings
+ * @property_name: an installed property name
+ * @v_string: string to be set
+ *
+ * Sets the contents of an #EShellSettings property of type #G_TYPE_STRING
+ * to @v_string. If @property_name is bound to a GConf key, the GConf key
+ * will also be set to @v_string.
+ **/
+void
+e_shell_settings_set_string (EShellSettings *shell_settings,
+ const gchar *property_name,
+ const gchar *v_string)
+{
+ GObject *object;
+ GValue value = { 0, };
+
+ g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings));
+ g_return_if_fail (property_name != NULL);
+
+ object = G_OBJECT (shell_settings);
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, v_string);
+ g_object_set_property (object, property_name, &value);
+ g_value_unset (&value);
+}
+
+/**
+ * e_shell_settings_get_object:
+ * @shell_settings: an #EShellSettings
+ * @property_name: an installed property name
+ *
+ * Returns the contents of an #EShellSettings property of type
+ * #G_TYPE_OBJECT. The caller owns the reference to the returned
+ * object, and should call g_object_unref() when finished with it.
+ *
+ * Returns: a new reference to the object under @property_name
+ **/
+gpointer
+e_shell_settings_get_object (EShellSettings *shell_settings,
+ const gchar *property_name)
+{
+ GObject *object;
+ GValue value = { 0, };
+ gpointer v_object;
+
+ g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL);
+ g_return_val_if_fail (property_name != NULL, NULL);
+
+ object = G_OBJECT (shell_settings);
+ g_value_init (&value, G_TYPE_OBJECT);
+ g_object_get_property (object, property_name, &value);
+ v_object = g_value_dup_object (&value);
+ g_value_unset (&value);
+
+ return v_object;
+}
+
+/**
+ * e_shell_settings_set_object:
+ * @shell_settings: an #EShellSettings
+ * @property_name: an installed property name
+ * @v_object: object to be set
+ *
+ * Sets the contents of an #EShellSettings property of type #G_TYPE_OBJECT
+ * to @v_object.
+ **/
+void
+e_shell_settings_set_object (EShellSettings *shell_settings,
+ const gchar *property_name,
+ gpointer v_object)
+{
+ GObject *object;
+ GValue value = { 0, };
+
+ g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings));
+ g_return_if_fail (property_name != NULL);
+
+ object = G_OBJECT (shell_settings);
+ g_value_init (&value, G_TYPE_OBJECT);
+ g_value_set_object (&value, v_object);
+ g_object_set_property (object, property_name, &value);
+ g_value_unset (&value);
+}
+
+/**
+ * e_shell_settings_get_pointer:
+ * @shell_settings: an #EShellSettings
+ * @property_name: an installed property name
+ *
+ * Returns the contents of an #EShellSettings property of type
+ * #G_TYPE_POINTER.
+ *
+ * Returns: pointer contents of @property_name
+ **/
+gpointer
+e_shell_settings_get_pointer (EShellSettings *shell_settings,
+ const gchar *property_name)
+{
+ GObject *object;
+ GValue value = { 0, };
+ gpointer v_pointer;
+
+ g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL);
+ g_return_val_if_fail (property_name != NULL, NULL);
+
+ object = G_OBJECT (shell_settings);
+ g_value_init (&value, G_TYPE_POINTER);
+ g_object_get_property (object, property_name, &value);
+ v_pointer = g_value_get_pointer (&value);
+ g_value_unset (&value);
+
+ return v_pointer;
+}
+
+/**
+ * e_shell_settings_set_pointer:
+ * @shell_settings: an #EShellSettings
+ * @property_name: an installed property name
+ * @v_pointer: pointer to be set
+ *
+ * Sets the contents of an #EShellSettings property of type #G_TYPE_POINTER
+ * to @v_pointer.
+ **/
+void
+e_shell_settings_set_pointer (EShellSettings *shell_settings,
+ const gchar *property_name,
+ gpointer v_pointer)
+{
+ GObject *object;
+ GValue value = { 0, };
+
+ g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings));
+ g_return_if_fail (property_name != NULL);
+
+ object = G_OBJECT (shell_settings);
+ g_value_init (&value, G_TYPE_POINTER);
+ g_value_set_pointer (&value, v_pointer);
+ g_object_set_property (object, property_name, &value);
+ g_value_unset (&value);
+}
diff --git a/shell/e-shell-settings.h b/shell/e-shell-settings.h
new file mode 100644
index 0000000000..c400facfd3
--- /dev/null
+++ b/shell/e-shell-settings.h
@@ -0,0 +1,114 @@
+/*
+ * e-shell-settings.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+/**
+ * SECTION: e-shell-settings
+ * @short_description: settings management
+ * @include: shell/e-shell-settings.h
+ **/
+
+#ifndef E_SHELL_SETTINGS_H
+#define E_SHELL_SETTINGS_H
+
+#include <shell/e-shell-common.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SHELL_SETTINGS \
+ (e_shell_settings_get_type ())
+#define E_SHELL_SETTINGS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SHELL_SETTINGS, EShellSettings))
+#define E_SHELL_SETTINGS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SHELL_SETTINGS, EShellSettingsClass))
+#define E_IS_SHELL_SETTINGS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SHELL_SETTINGS))
+#define E_IS_SHELL_SETTINGS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SHELL_SETTINGS))
+#define E_SHELL_SETTINGS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SHELL_SETTINGS, EShellSettingsClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EShellSettings EShellSettings;
+typedef struct _EShellSettingsClass EShellSettingsClass;
+typedef struct _EShellSettingsPrivate EShellSettingsPrivate;
+
+/**
+ * EShellSettings:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
+struct _EShellSettings {
+ GObject parent;
+ EShellSettingsPrivate *priv;
+};
+
+struct _EShellSettingsClass {
+ GObjectClass parent_class;
+};
+
+GType e_shell_settings_get_type (void);
+void e_shell_settings_install_property
+ (GParamSpec *pspec);
+void e_shell_settings_bind_to_gconf (EShellSettings *shell_settings,
+ const gchar *property_name,
+ const gchar *gconf_key);
+void e_shell_settings_enable_debug (EShellSettings *shell_settings);
+
+/* Getters and setters for common EShellSettings property types.
+ * These are more convenient than g_object_get() / g_object_set().
+ * Add more types as needed. If GObject ever adds similar functions,
+ * kill these. */
+
+gboolean e_shell_settings_get_boolean (EShellSettings *shell_settings,
+ const gchar *property_name);
+void e_shell_settings_set_boolean (EShellSettings *shell_settings,
+ const gchar *property_name,
+ gboolean v_boolean);
+gint e_shell_settings_get_int (EShellSettings *shell_settings,
+ const gchar *property_name);
+void e_shell_settings_set_int (EShellSettings *shell_settings,
+ const gchar *property_name,
+ gint v_int);
+gchar * e_shell_settings_get_string (EShellSettings *shell_settings,
+ const gchar *property_name);
+void e_shell_settings_set_string (EShellSettings *shell_settings,
+ const gchar *property_name,
+ const gchar *v_string);
+gpointer e_shell_settings_get_object (EShellSettings *shell_settings,
+ const gchar *property_name);
+void e_shell_settings_set_object (EShellSettings *shell_settings,
+ const gchar *property_name,
+ gpointer v_object);
+gpointer e_shell_settings_get_pointer (EShellSettings *shell_setting,
+ const gchar *property_name);
+void e_shell_settings_set_pointer (EShellSettings *shell_setting,
+ const gchar *property_name,
+ gpointer v_pointer);
+
+G_END_DECLS
+
+#endif /* E_SHELL_SETTINGS_H */
diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c
new file mode 100644
index 0000000000..ad4cb92970
--- /dev/null
+++ b/shell/e-shell-sidebar.c
@@ -0,0 +1,681 @@
+/*
+ * e-shell-sidebar.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-shell-sidebar.h"
+
+#include <e-shell-view.h>
+
+#define E_SHELL_SIDEBAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SHELL_SIDEBAR, EShellSidebarPrivate))
+
+struct _EShellSidebarPrivate {
+
+ gpointer shell_view; /* weak pointer */
+
+ GtkWidget *event_box;
+ GtkWidget *image;
+ GtkWidget *primary_label;
+ GtkWidget *secondary_label;
+ gchar *primary_text;
+ gchar *secondary_text;
+};
+
+enum {
+ PROP_0,
+ PROP_ICON_NAME,
+ PROP_PRIMARY_TEXT,
+ PROP_SECONDARY_TEXT,
+ PROP_SHELL_VIEW
+};
+
+static gpointer parent_class;
+
+static void
+shell_sidebar_set_shell_view (EShellSidebar *shell_sidebar,
+ EShellView *shell_view)
+{
+ g_return_if_fail (shell_sidebar->priv->shell_view == NULL);
+
+ shell_sidebar->priv->shell_view = shell_view;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_view),
+ &shell_sidebar->priv->shell_view);
+}
+
+static void
+shell_sidebar_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ICON_NAME:
+ e_shell_sidebar_set_icon_name (
+ E_SHELL_SIDEBAR (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_PRIMARY_TEXT:
+ e_shell_sidebar_set_primary_text (
+ E_SHELL_SIDEBAR (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_SECONDARY_TEXT:
+ e_shell_sidebar_set_secondary_text (
+ E_SHELL_SIDEBAR (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_SHELL_VIEW:
+ shell_sidebar_set_shell_view (
+ E_SHELL_SIDEBAR (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_sidebar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ICON_NAME:
+ g_value_set_string (
+ value, e_shell_sidebar_get_icon_name (
+ E_SHELL_SIDEBAR (object)));
+ return;
+
+ case PROP_PRIMARY_TEXT:
+ g_value_set_string (
+ value, e_shell_sidebar_get_primary_text (
+ E_SHELL_SIDEBAR (object)));
+ return;
+
+ case PROP_SECONDARY_TEXT:
+ g_value_set_string (
+ value, e_shell_sidebar_get_secondary_text (
+ E_SHELL_SIDEBAR (object)));
+ return;
+
+ case PROP_SHELL_VIEW:
+ g_value_set_object (
+ value, e_shell_sidebar_get_shell_view (
+ E_SHELL_SIDEBAR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_sidebar_dispose (GObject *object)
+{
+ EShellSidebarPrivate *priv;
+
+ priv = E_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ if (priv->shell_view != NULL) {
+ g_object_remove_weak_pointer (
+ G_OBJECT (priv->shell_view), &priv->shell_view);
+ priv->shell_view = NULL;
+ }
+
+ if (priv->image != NULL) {
+ g_object_unref (priv->image);
+ priv->image = NULL;
+ }
+
+ if (priv->event_box != NULL) {
+ g_object_unref (priv->event_box);
+ priv->event_box = NULL;
+ }
+
+ if (priv->primary_label != NULL) {
+ g_object_unref (priv->primary_label);
+ priv->primary_label = NULL;
+ }
+
+ if (priv->secondary_label != NULL) {
+ g_object_unref (priv->secondary_label);
+ priv->secondary_label = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+shell_sidebar_finalize (GObject *object)
+{
+ EShellSidebarPrivate *priv;
+
+ priv = E_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+ g_free (priv->primary_text);
+ g_free (priv->secondary_text);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+shell_sidebar_constructed (GObject *object)
+{
+ EShellView *shell_view;
+ EShellSidebar *shell_sidebar;
+ GtkSizeGroup *size_group;
+ GtkAction *action;
+ GtkWidget *container;
+ GtkWidget *widget;
+ gchar *label;
+ gchar *icon_name;
+
+ shell_sidebar = E_SHELL_SIDEBAR (object);
+ shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ size_group = e_shell_view_get_size_group (shell_view);
+ action = e_shell_view_get_action (shell_view);
+
+ widget = shell_sidebar->priv->event_box;
+ gtk_size_group_add_widget (size_group, widget);
+
+ container = widget;
+
+ widget = gtk_hbox_new (FALSE, 6);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 6);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_image_new ();
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ shell_sidebar->priv->image = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_label_new (NULL);
+ gtk_label_set_ellipsize (GTK_LABEL (widget), PANGO_ELLIPSIZE_END);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ shell_sidebar->priv->primary_label = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_label_new (NULL);
+ gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ shell_sidebar->priv->secondary_label = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_object_get (action, "icon-name", &icon_name, NULL);
+ e_shell_sidebar_set_icon_name (shell_sidebar, icon_name);
+ g_free (icon_name);
+
+ g_object_get (action, "label", &label, NULL);
+ e_shell_sidebar_set_primary_text (shell_sidebar, label);
+ g_free (label);
+}
+
+static void
+shell_sidebar_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ EShellSidebarPrivate *priv;
+ GtkRequisition child_requisition;
+ GtkWidget *child;
+
+ priv = E_SHELL_SIDEBAR_GET_PRIVATE (widget);
+
+ requisition->width = 0;
+ requisition->height = 0;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ gtk_widget_size_request (child, requisition);
+
+ child = priv->event_box;
+ gtk_widget_size_request (child, &child_requisition);
+ requisition->width = MAX (requisition->width, child_requisition.width);
+ requisition->height += child_requisition.height;
+}
+
+static void
+shell_sidebar_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ EShellSidebarPrivate *priv;
+ GtkAllocation child_allocation;
+ GtkRequisition child_requisition;
+ GtkWidget *child;
+
+ priv = E_SHELL_SIDEBAR_GET_PRIVATE (widget);
+
+ widget->allocation = *allocation;
+
+ child = priv->event_box;
+ gtk_widget_size_request (child, &child_requisition);
+
+ child_allocation.x = allocation->x;
+ child_allocation.y = allocation->y;
+ child_allocation.width = allocation->width;
+ child_allocation.height = child_requisition.height;
+
+ gtk_widget_size_allocate (child, &child_allocation);
+
+ child_allocation.y += child_requisition.height;
+ child_allocation.height =
+ allocation->height - child_requisition.height;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ if (child != NULL)
+ gtk_widget_size_allocate (child, &child_allocation);
+}
+
+static void
+shell_sidebar_remove (GtkContainer *container,
+ GtkWidget *widget)
+{
+ EShellSidebarPrivate *priv;
+
+ priv = E_SHELL_SIDEBAR_GET_PRIVATE (container);
+
+ /* Look in the internal widgets first. */
+
+ if (widget == priv->event_box) {
+ gtk_widget_unparent (priv->event_box);
+ gtk_widget_queue_resize (GTK_WIDGET (container));
+ return;
+ }
+
+ /* Chain up to parent's remove() method. */
+ GTK_CONTAINER_CLASS (parent_class)->remove (container, widget);
+}
+
+static void
+shell_sidebar_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
+{
+ EShellSidebarPrivate *priv;
+
+ priv = E_SHELL_SIDEBAR_GET_PRIVATE (container);
+
+ if (include_internals)
+ callback (priv->event_box, callback_data);
+
+ /* Chain up to parent's forall() method. */
+ GTK_CONTAINER_CLASS (parent_class)->forall (
+ container, include_internals, callback, callback_data);
+}
+
+static void
+shell_sidebar_class_init (EShellSidebarClass *class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+ GtkContainerClass *container_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EShellSidebarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = shell_sidebar_set_property;
+ object_class->get_property = shell_sidebar_get_property;
+ object_class->dispose = shell_sidebar_dispose;
+ object_class->finalize = shell_sidebar_finalize;
+ object_class->constructed = shell_sidebar_constructed;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->size_request = shell_sidebar_size_request;
+ widget_class->size_allocate = shell_sidebar_size_allocate;
+
+ container_class = GTK_CONTAINER_CLASS (class);
+ container_class->remove = shell_sidebar_remove;
+ container_class->forall = shell_sidebar_forall;
+
+ /**
+ * EShellSidebar:icon-name
+ *
+ * The named icon is displayed at the top of the sidebar.
+ */
+ g_object_class_install_property (
+ object_class,
+ PROP_ICON_NAME,
+ g_param_spec_string (
+ "icon-name",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * EShellSidebar:primary-text
+ *
+ * The primary text is displayed in bold at the top of the sidebar.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_PRIMARY_TEXT,
+ g_param_spec_string (
+ "primary-text",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * EShellSidebar:secondary-text
+ *
+ * The secondary text is displayed in a smaller font at the top of
+ * the sidebar.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SECONDARY_TEXT,
+ g_param_spec_string (
+ "secondary-text",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * EShellSidebar:shell-view
+ *
+ * The #EShellView to which the sidebar widget belongs.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_VIEW,
+ g_param_spec_object (
+ "shell-view",
+ NULL,
+ NULL,
+ E_TYPE_SHELL_VIEW,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+shell_sidebar_init (EShellSidebar *shell_sidebar)
+{
+ GtkStyle *style;
+ GtkWidget *widget;
+ const GdkColor *color;
+
+ shell_sidebar->priv = E_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
+
+ GTK_WIDGET_SET_FLAGS (shell_sidebar, GTK_NO_WINDOW);
+
+ widget = gtk_event_box_new ();
+ style = gtk_widget_get_style (widget);
+ color = &style->bg[GTK_STATE_ACTIVE];
+ gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color);
+ gtk_widget_set_parent (widget, GTK_WIDGET (shell_sidebar));
+ shell_sidebar->priv->event_box = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Finish initialization once we have a shell view. */
+}
+
+GType
+e_shell_sidebar_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EShellSidebarClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) shell_sidebar_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EShellSidebar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) shell_sidebar_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_BIN, "EShellSidebar", &type_info, 0);
+ }
+
+ return type;
+}
+
+/**
+ * e_shell_sidebar_new:
+ * @shell_view: an #EShellView
+ *
+ * Creates a new #EShellSidebar instance belonging to @shell_view.
+ *
+ * Returns: a new #EShellSidebar instance
+ **/
+GtkWidget *
+e_shell_sidebar_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_SHELL_SIDEBAR,
+ "shell-view", shell_view, NULL);
+}
+
+/**
+ * e_shell_sidebar_check_state:
+ * @shell_sidebar: an #EShellSidebar
+ *
+ * #EShellSidebar subclasses should implement the
+ * <structfield>check_state</structfield> method in #EShellSidebarClass
+ * to return a set of flags describing the current sidebar selection.
+ * Subclasses are responsible for defining their own flags. This is
+ * primarily used to assist shell views with updating actions (see
+ * e_shell_view_update_actions()).
+ *
+ * Returns: a set of flags describing the current @shell_sidebar selection
+ **/
+guint32
+e_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
+{
+ EShellSidebarClass *shell_sidebar_class;
+
+ g_return_val_if_fail (E_IS_SHELL_SIDEBAR (shell_sidebar), 0);
+
+ shell_sidebar_class = E_SHELL_SIDEBAR_GET_CLASS (shell_sidebar);
+ g_return_val_if_fail (shell_sidebar_class->check_state != NULL, 0);
+
+ return shell_sidebar_class->check_state (shell_sidebar);
+}
+
+/**
+ * e_shell_sidebar_get_shell_view:
+ * @shell_sidebar: an #EShellSidebar
+ *
+ * Returns the #EShellView that was passed to e_shell_sidebar_new().
+ *
+ * Returns: the #EShellView to which @shell_sidebar belongs
+ **/
+EShellView *
+e_shell_sidebar_get_shell_view (EShellSidebar *shell_sidebar)
+{
+ g_return_val_if_fail (E_IS_SHELL_SIDEBAR (shell_sidebar), NULL);
+
+ return E_SHELL_VIEW (shell_sidebar->priv->shell_view);
+}
+
+/**
+ * e_shell_sidebar_get_icon_name:
+ * @shell_sidebar: an #EShellSidebar
+ *
+ * Returns the icon name displayed at the top of the sidebar.
+ *
+ * Returns: the icon name for @shell_sidebar
+ **/
+const gchar *
+e_shell_sidebar_get_icon_name (EShellSidebar *shell_sidebar)
+{
+ GtkImage *image;
+ const gchar *icon_name;
+
+ g_return_val_if_fail (E_IS_SHELL_SIDEBAR (shell_sidebar), NULL);
+
+ image = GTK_IMAGE (shell_sidebar->priv->image);
+ gtk_image_get_icon_name (image, &icon_name, NULL);
+
+ return icon_name;
+}
+
+/**
+ * e_shell_sidebar_set_icon_name:
+ *
+ * Sets the icon name displayed at the top of the sidebar.
+ **/
+void
+e_shell_sidebar_set_icon_name (EShellSidebar *shell_sidebar,
+ const gchar *icon_name)
+{
+ GtkImage *image;
+
+ g_return_if_fail (E_IS_SHELL_SIDEBAR (shell_sidebar));
+
+ image = GTK_IMAGE (shell_sidebar->priv->image);
+ gtk_image_set_from_icon_name (image, icon_name, GTK_ICON_SIZE_MENU);
+
+ g_object_notify (G_OBJECT (shell_sidebar), "icon-name");
+}
+
+/**
+ * e_shell_sidebar_get_primary_text:
+ * @shell_sidebar: an #EShellSidebar
+ *
+ * Returns the primary text for @shell_sidebar.
+ *
+ * The primary text is displayed in bold at the top of the sidebar. It
+ * defaults to the shell view's label (as seen on the switcher button),
+ * but typically shows the name of the selected item in the sidebar.
+ *
+ * Returns: the primary text for @shell_sidebar
+ **/
+const gchar *
+e_shell_sidebar_get_primary_text (EShellSidebar *shell_sidebar)
+{
+ g_return_val_if_fail (E_IS_SHELL_SIDEBAR (shell_sidebar), NULL);
+
+ return shell_sidebar->priv->primary_text;
+}
+
+/**
+ * e_shell_sidebar_set_primary_text:
+ * @shell_sidebar: an #EShellSidebar
+ * @primary_text: text to be displayed in a bold font
+ *
+ * Sets the primary text for @shell_sidebar.
+ *
+ * The primary text is displayed in bold at the top of the sidebar. It
+ * defaults to the shell view's label (as seen on the switcher button),
+ * but typically shows the name of the selected item in the sidebar.
+ **/
+void
+e_shell_sidebar_set_primary_text (EShellSidebar *shell_sidebar,
+ const gchar *primary_text)
+{
+ GtkLabel *label;
+ gchar *markup;
+
+ g_return_if_fail (E_IS_SHELL_SIDEBAR (shell_sidebar));
+
+ g_free (shell_sidebar->priv->primary_text);
+ shell_sidebar->priv->primary_text = g_strdup (primary_text);
+
+ if (primary_text == NULL)
+ primary_text = "";
+
+ label = GTK_LABEL (shell_sidebar->priv->primary_label);
+ markup = g_markup_printf_escaped ("<b>%s</b>", primary_text);
+ gtk_label_set_markup (label, markup);
+ g_free (markup);
+
+ gtk_widget_queue_resize (GTK_WIDGET (shell_sidebar));
+ g_object_notify (G_OBJECT (shell_sidebar), "primary-text");
+}
+
+/**
+ * e_shell_sidebar_get_secondary_text:
+ * @shell_sidebar: an #EShellSidebar
+ *
+ * Returns the secondary text for @shell_sidebar.
+ *
+ * The secondary text is displayed in a smaller font at the top of the
+ * sidebar. It typically shows information about the contents of the
+ * selected sidebar item, such as total number of items, number of
+ * selected items, etc.
+ *
+ * Returns: the secondary text for @shell_sidebar
+ **/
+const gchar *
+e_shell_sidebar_get_secondary_text (EShellSidebar *shell_sidebar)
+{
+ g_return_val_if_fail (E_IS_SHELL_SIDEBAR (shell_sidebar), NULL);
+
+ return shell_sidebar->priv->secondary_text;
+}
+
+/**
+ * e_shell_sidebar_set_secondary_text:
+ * @shell_sidebar: an #EShellSidebar
+ * @secondary_text: text to be displayed in a smaller font
+ *
+ * Sets the secondary text for @shell_sidebar.
+ *
+ * The secondary text is displayed in a smaller font at the top of the
+ * sidebar. It typically shows information about the contents of the
+ * selected sidebar item, such as total number of items, number of
+ * selected items, etc.
+ **/
+void
+e_shell_sidebar_set_secondary_text (EShellSidebar *shell_sidebar,
+ const gchar *secondary_text)
+{
+ GtkLabel *label;
+ gchar *markup;
+
+ g_return_if_fail (E_IS_SHELL_SIDEBAR (shell_sidebar));
+
+ g_free (shell_sidebar->priv->secondary_text);
+ shell_sidebar->priv->secondary_text = g_strdup (secondary_text);
+
+ if (secondary_text == NULL)
+ secondary_text = "";
+
+ label = GTK_LABEL (shell_sidebar->priv->secondary_label);
+ markup = g_markup_printf_escaped ("<small>%s</small>", secondary_text);
+ gtk_label_set_markup (label, markup);
+ g_free (markup);
+
+ gtk_widget_queue_resize (GTK_WIDGET (shell_sidebar));
+ g_object_notify (G_OBJECT (shell_sidebar), "secondary-text");
+}
diff --git a/shell/e-shell-sidebar.h b/shell/e-shell-sidebar.h
new file mode 100644
index 0000000000..5999aa9de2
--- /dev/null
+++ b/shell/e-shell-sidebar.h
@@ -0,0 +1,97 @@
+/*
+ * e-shell-sidebar.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+/**
+ * SECTION: e-shell-sidebar
+ * @short_description: the left side of the main window
+ * @include: shell/e-shell-sidebar.h
+ **/
+
+#ifndef E_SHELL_SIDEBAR_H
+#define E_SHELL_SIDEBAR_H
+
+#include <shell/e-shell-common.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SHELL_SIDEBAR \
+ (e_shell_sidebar_get_type ())
+#define E_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SHELL_SIDEBAR, EShellSidebar))
+#define E_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SHELL_SIDEBAR, EShellSidebarClass))
+#define E_IS_SHELL_SIDEBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SHELL_SIDEBAR))
+#define E_IS_SHELL_SIDEBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), E_TYPE_SHELL_SIDEBAR))
+#define E_SHELL_SIDEBAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SHELL_SIDEBAR, EShellSidebarClass))
+
+G_BEGIN_DECLS
+
+/* Avoid including <e-shell-view.h>, because it includes us! */
+struct _EShellView;
+
+typedef struct _EShellSidebar EShellSidebar;
+typedef struct _EShellSidebarClass EShellSidebarClass;
+typedef struct _EShellSidebarPrivate EShellSidebarPrivate;
+
+/**
+ * EShellSidebar:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
+struct _EShellSidebar {
+ GtkBin parent;
+ EShellSidebarPrivate *priv;
+};
+
+struct _EShellSidebarClass {
+ GtkBinClass parent_class;
+
+ guint32 (*check_state) (EShellSidebar *shell_sidebar);
+};
+
+GType e_shell_sidebar_get_type (void);
+GtkWidget * e_shell_sidebar_new (struct _EShellView *shell_view);
+guint32 e_shell_sidebar_check_state (EShellSidebar *shell_sidebar);
+struct _EShellView *
+ e_shell_sidebar_get_shell_view (EShellSidebar *shell_sidebar);
+const gchar * e_shell_sidebar_get_icon_name (EShellSidebar *shell_sidebar);
+void e_shell_sidebar_set_icon_name (EShellSidebar *shell_sidebar,
+ const gchar *icon_name);
+const gchar * e_shell_sidebar_get_primary_text(EShellSidebar *shell_sidebar);
+void e_shell_sidebar_set_primary_text(EShellSidebar *shell_sidebar,
+ const gchar *primary_text);
+const gchar * e_shell_sidebar_get_secondary_text
+ (EShellSidebar *shell_sidebar);
+void e_shell_sidebar_set_secondary_text
+ (EShellSidebar *shell_sidebar,
+ const gchar *secondary_text);
+
+G_END_DECLS
+
+#endif /* E_SHELL_SIDEBAR_H */
diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c
new file mode 100644
index 0000000000..2944aace0e
--- /dev/null
+++ b/shell/e-shell-switcher.c
@@ -0,0 +1,700 @@
+/*
+ * e-shell-switcher.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-shell-switcher.h"
+
+#include <glib/gi18n.h>
+
+#define E_SHELL_SWITCHER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SHELL_SWITCHER, EShellSwitcherPrivate))
+
+#define H_PADDING 6
+#define V_PADDING 6
+
+struct _EShellSwitcherPrivate {
+ GList *proxies;
+ gboolean style_set;
+ GtkToolbarStyle style;
+ GtkSettings *settings;
+ gulong settings_handler_id;
+ gboolean toolbar_visible;
+};
+
+enum {
+ PROP_0,
+ PROP_TOOLBAR_STYLE,
+ PROP_TOOLBAR_VISIBLE
+};
+
+enum {
+ STYLE_CHANGED,
+ LAST_SIGNAL
+};
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+
+static gint
+shell_switcher_layout_actions (EShellSwitcher *switcher)
+{
+ GtkAllocation *allocation;
+ int num_btns = g_list_length (switcher->priv->proxies), btns_per_row;
+ GList **rows, *p;
+ gboolean icons_only;
+ gint row_number;
+ gint max_width = 0;
+ gint max_height = 0;
+ gint row_last;
+ gint x, y;
+ gint i;
+
+ allocation = &GTK_WIDGET (switcher)->allocation;
+ y = allocation->y + allocation->height;
+
+ if (num_btns == 0)
+ return allocation->height;
+
+ icons_only = (switcher->priv->style == GTK_TOOLBAR_ICONS);
+
+ /* Figure out the max width and height. */
+ for (p = switcher->priv->proxies; p != NULL; p = p->next) {
+ GtkWidget *widget = p->data;
+ GtkRequisition requisition;
+
+ gtk_widget_size_request (widget, &requisition);
+ max_height = MAX (max_height, requisition.height);
+ max_width = MAX (max_width, requisition.width);
+ }
+
+ /* Figure out how many rows and columns we'll use. */
+ btns_per_row = MAX (1, allocation->width / (max_width + H_PADDING));
+ if (!icons_only) {
+ /* If using text buttons, we want to try to have a
+ * completely filled-in grid, but if we can't, we want
+ * the odd row to have just a single button. */
+ while (num_btns % btns_per_row > 1)
+ btns_per_row--;
+ }
+
+ /* Assign buttons to rows. */
+ rows = g_new0 (GList *, num_btns / btns_per_row + 1);
+
+ if (!icons_only && num_btns % btns_per_row != 0) {
+ rows[0] = g_list_append (rows[0], switcher->priv->proxies->data);
+
+ p = switcher->priv->proxies->next;
+ row_number = p ? 1 : 0;
+ } else {
+ p = switcher->priv->proxies;
+ row_number = 0;
+ }
+
+ for (; p != NULL; p = p->next) {
+ GtkWidget *widget = p->data;
+
+ if (g_list_length (rows[row_number]) == btns_per_row)
+ row_number++;
+
+ rows[row_number] = g_list_append (rows[row_number], widget);
+ }
+
+ row_last = row_number;
+
+ /* Layout the buttons. */
+ for (i = row_last; i >= 0; i--) {
+ int len, extra_width;
+
+ x = H_PADDING + allocation->x;
+ y -= max_height;
+ len = g_list_length (rows[i]);
+ if (!icons_only)
+ extra_width = (allocation->width - (len * max_width ) - (len * H_PADDING)) / len;
+ else
+ extra_width = 0;
+ for (p = rows [i]; p != NULL; p = p->next) {
+ GtkAllocation child_allocation;
+
+ child_allocation.x = x;
+ child_allocation.y = y;
+ child_allocation.width = max_width + extra_width;
+ child_allocation.height = max_height;
+
+ gtk_widget_size_allocate (GTK_WIDGET (p->data), &child_allocation);
+
+ x += child_allocation.width + H_PADDING;
+ }
+
+ y -= V_PADDING;
+ }
+
+ for (i = 0; i <= row_last; i ++)
+ g_list_free (rows [i]);
+ g_free (rows);
+
+ return y - allocation->y;
+}
+
+static void
+shell_switcher_toolbar_style_changed_cb (EShellSwitcher *switcher)
+{
+ if (!switcher->priv->style_set) {
+ switcher->priv->style_set = TRUE;
+ e_shell_switcher_unset_style (switcher);
+ }
+}
+
+static void
+shell_switcher_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_TOOLBAR_STYLE:
+ e_shell_switcher_set_style (
+ E_SHELL_SWITCHER (object),
+ g_value_get_enum (value));
+ return;
+
+ case PROP_TOOLBAR_VISIBLE:
+ e_shell_switcher_set_visible (
+ E_SHELL_SWITCHER (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_switcher_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_TOOLBAR_STYLE:
+ g_value_set_enum (
+ value, e_shell_switcher_get_style (
+ E_SHELL_SWITCHER (object)));
+ return;
+
+ case PROP_TOOLBAR_VISIBLE:
+ g_value_set_boolean (
+ value, e_shell_switcher_get_visible (
+ E_SHELL_SWITCHER (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_switcher_dispose (GObject *object)
+{
+ EShellSwitcherPrivate *priv;
+
+ priv = E_SHELL_SWITCHER_GET_PRIVATE (object);
+
+ while (priv->proxies != NULL) {
+ GtkWidget *widget = priv->proxies->data;
+ gtk_container_remove (GTK_CONTAINER (object), widget);
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+shell_switcher_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ EShellSwitcherPrivate *priv;
+ GtkWidget *child;
+ GList *iter;
+
+ priv = E_SHELL_SWITCHER_GET_PRIVATE (widget);
+
+ requisition->width = 0;
+ requisition->height = 0;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ if (child != NULL)
+ gtk_widget_size_request (child, requisition);
+
+ if (!priv->toolbar_visible)
+ return;
+
+ for (iter = priv->proxies; iter != NULL; iter = iter->next) {
+ GtkWidget *widget = iter->data;
+ GtkRequisition child_requisition;
+
+ gtk_widget_size_request (widget, &child_requisition);
+
+ child_requisition.width += H_PADDING;
+ child_requisition.height += V_PADDING;
+
+ requisition->width = MAX (
+ requisition->width, child_requisition.width);
+ requisition->height += child_requisition.height;
+ }
+}
+
+static void
+shell_switcher_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ EShellSwitcher *switcher;
+ GtkAllocation child_allocation;
+ GtkWidget *child;
+ gint height;
+
+ switcher = E_SHELL_SWITCHER (widget);
+
+ widget->allocation = *allocation;
+
+ if (switcher->priv->toolbar_visible)
+ height = shell_switcher_layout_actions (switcher);
+ else
+ height = allocation->height;
+
+ child_allocation.x = allocation->x;
+ child_allocation.y = allocation->y;
+ child_allocation.width = allocation->width;
+ child_allocation.height = height;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ if (child != NULL)
+ gtk_widget_size_allocate (child, &child_allocation);
+}
+
+static void
+shell_switcher_screen_changed (GtkWidget *widget,
+ GdkScreen *previous_screen)
+{
+ EShellSwitcherPrivate *priv;
+ GtkSettings *settings;
+
+ priv = E_SHELL_SWITCHER_GET_PRIVATE (widget);
+
+ if (gtk_widget_has_screen (widget))
+ settings = gtk_widget_get_settings (widget);
+ else
+ settings = NULL;
+
+ if (settings == priv->settings)
+ return;
+
+ if (priv->settings != NULL) {
+ g_signal_handler_disconnect (
+ priv->settings, priv->settings_handler_id);
+ g_object_unref (priv->settings);
+ }
+
+ if (settings != NULL) {
+ priv->settings = g_object_ref (settings);
+ priv->settings_handler_id = g_signal_connect_swapped (
+ settings, "notify::gtk-toolbar-style",
+ G_CALLBACK (shell_switcher_toolbar_style_changed_cb),
+ widget);
+ } else
+ priv->settings = NULL;
+
+ shell_switcher_toolbar_style_changed_cb (E_SHELL_SWITCHER (widget));
+}
+
+static void
+shell_switcher_remove (GtkContainer *container,
+ GtkWidget *widget)
+{
+ EShellSwitcherPrivate *priv;
+ GList *link;
+
+ priv = E_SHELL_SWITCHER_GET_PRIVATE (container);
+
+ /* Look in the internal widgets first. */
+
+ link = g_list_find (priv->proxies, widget);
+ if (link != NULL) {
+ GtkWidget *widget = link->data;
+
+ gtk_widget_unparent (widget);
+ priv->proxies = g_list_delete_link (priv->proxies, link);
+ gtk_widget_queue_resize (GTK_WIDGET (container));
+ return;
+ }
+
+ /* Chain up to parent's remove() method. */
+ GTK_CONTAINER_CLASS (parent_class)->remove (container, widget);
+}
+
+static void
+shell_switcher_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
+{
+ EShellSwitcherPrivate *priv;
+
+ priv = E_SHELL_SWITCHER_GET_PRIVATE (container);
+
+ if (include_internals)
+ g_list_foreach (
+ priv->proxies, (GFunc) callback, callback_data);
+
+ /* Chain up to parent's forall() method. */
+ GTK_CONTAINER_CLASS (parent_class)->forall (
+ container, include_internals, callback, callback_data);
+}
+
+static void
+shell_switcher_style_changed (EShellSwitcher *switcher,
+ GtkToolbarStyle style)
+{
+ if (switcher->priv->style == style)
+ return;
+
+ switcher->priv->style = style;
+
+ g_list_foreach (
+ switcher->priv->proxies,
+ (GFunc) gtk_tool_item_toolbar_reconfigured, NULL);
+
+ gtk_widget_queue_resize (GTK_WIDGET (switcher));
+ g_object_notify (G_OBJECT (switcher), "toolbar-style");
+}
+
+static GtkIconSize
+shell_switcher_get_icon_size (GtkToolShell *shell)
+{
+ return GTK_ICON_SIZE_LARGE_TOOLBAR;
+}
+
+static GtkOrientation
+shell_switcher_get_orientation (GtkToolShell *shell)
+{
+ return GTK_ORIENTATION_HORIZONTAL;
+}
+
+static GtkToolbarStyle
+shell_switcher_get_style (GtkToolShell *shell)
+{
+ return e_shell_switcher_get_style (E_SHELL_SWITCHER (shell));
+}
+
+static GtkReliefStyle
+shell_switcher_get_relief_style (GtkToolShell *shell)
+{
+ return GTK_RELIEF_NORMAL;
+}
+
+static void
+shell_switcher_class_init (EShellSwitcherClass *class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+ GtkContainerClass *container_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EShellSwitcherPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = shell_switcher_set_property;
+ object_class->get_property = shell_switcher_get_property;
+ object_class->dispose = shell_switcher_dispose;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->size_request = shell_switcher_size_request;
+ widget_class->size_allocate = shell_switcher_size_allocate;
+ widget_class->screen_changed = shell_switcher_screen_changed;
+
+ container_class = GTK_CONTAINER_CLASS (class);
+ container_class->remove = shell_switcher_remove;
+ container_class->forall = shell_switcher_forall;
+
+ class->style_changed = shell_switcher_style_changed;
+
+ /**
+ * EShellSwitcher:toolbar-style
+ *
+ * The switcher's toolbar style.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_TOOLBAR_STYLE,
+ g_param_spec_enum (
+ "toolbar-style",
+ _("Toolbar Style"),
+ _("The switcher's toolbar style"),
+ GTK_TYPE_TOOLBAR_STYLE,
+ E_SHELL_SWITCHER_DEFAULT_TOOLBAR_STYLE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ /**
+ * EShellSwitcher:toolbar-visible
+ *
+ * Whether the switcher is visible.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_TOOLBAR_VISIBLE,
+ g_param_spec_boolean (
+ "toolbar-visible",
+ _("Toolbar Visible"),
+ _("Whether the switcher is visible"),
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ /**
+ * EShellSwitcher::style-changed
+ * @switcher: the #EShellSwitcher which emitted the signal
+ * @style: the new #GtkToolbarStyle of the switcher
+ *
+ * Emitted when the style of the switcher changes.
+ **/
+ signals[STYLE_CHANGED] = g_signal_new (
+ "style-changed",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EShellSwitcherClass, style_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__ENUM,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_TOOLBAR_STYLE);
+}
+
+static void
+shell_switcher_init (EShellSwitcher *switcher)
+{
+ switcher->priv = E_SHELL_SWITCHER_GET_PRIVATE (switcher);
+
+ GTK_WIDGET_SET_FLAGS (switcher, GTK_NO_WINDOW);
+}
+
+static void
+shell_switcher_tool_shell_iface_init (GtkToolShellIface *iface)
+{
+ iface->get_icon_size = shell_switcher_get_icon_size;
+ iface->get_orientation = shell_switcher_get_orientation;
+ iface->get_style = shell_switcher_get_style;
+ iface->get_relief_style = shell_switcher_get_relief_style;
+}
+
+GType
+e_shell_switcher_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EShellSwitcherClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) shell_switcher_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EShellSwitcher),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) shell_switcher_init,
+ NULL /* value_table */
+ };
+
+ static const GInterfaceInfo tool_shell_info = {
+ (GInterfaceInitFunc) shell_switcher_tool_shell_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL /* interface_data */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_BIN, "EShellSwitcher", &type_info, 0);
+
+ g_type_add_interface_static (
+ type, GTK_TYPE_TOOL_SHELL, &tool_shell_info);
+ }
+
+ return type;
+}
+
+/**
+ * e_shell_switcher_new:
+ *
+ * Creates a new #EShellSwitcher instance.
+ *
+ * Returns: a new #EShellSwitcher instance
+ **/
+GtkWidget *
+e_shell_switcher_new (void)
+{
+ return g_object_new (E_TYPE_SHELL_SWITCHER, NULL);
+}
+
+/**
+ * e_shell_switcher_add_action:
+ * @switcher: an #EShellSwitcher
+ * @action: a #GtkAction
+ *
+ * Adds a button to @switcher that proxies for @action. Switcher buttons
+ * appear in the order they were added.
+ *
+ * #EShellWindow adds switcher actions in the order given by the
+ * <structfield>sort_order</structfield> field in #EShellBackendClass.
+ **/
+void
+e_shell_switcher_add_action (EShellSwitcher *switcher,
+ GtkAction *action)
+{
+ GtkWidget *widget;
+
+ g_return_if_fail (E_IS_SHELL_SWITCHER (switcher));
+ g_return_if_fail (GTK_IS_ACTION (action));
+
+ g_object_ref (action);
+ widget = gtk_action_create_tool_item (action);
+ gtk_tool_item_set_is_important (GTK_TOOL_ITEM (widget), TRUE);
+ gtk_widget_show (widget);
+
+ switcher->priv->proxies = g_list_append (
+ switcher->priv->proxies, widget);
+
+ gtk_widget_set_parent (widget, GTK_WIDGET (switcher));
+ gtk_widget_queue_resize (GTK_WIDGET (switcher));
+}
+
+/**
+ * e_shell_switcher_get_style:
+ * @switcher: an #EShellSwitcher
+ *
+ * Returns whether @switcher has text, icons or both.
+ *
+ * Returns: the current style of @shell
+ **/
+GtkToolbarStyle
+e_shell_switcher_get_style (EShellSwitcher *switcher)
+{
+ g_return_val_if_fail (
+ E_IS_SHELL_SWITCHER (switcher),
+ E_SHELL_SWITCHER_DEFAULT_TOOLBAR_STYLE);
+
+ return switcher->priv->style;
+}
+
+/**
+ * e_shell_switcher_set_style:
+ * @switcher: an #EShellSwitcher
+ * @style: the new style for @switcher
+ *
+ * Alters the view of @switcher to display either icons only, text only,
+ * or both.
+ **/
+void
+e_shell_switcher_set_style (EShellSwitcher *switcher,
+ GtkToolbarStyle style)
+{
+ g_return_if_fail (E_IS_SHELL_SWITCHER (switcher));
+
+ switcher->priv->style_set = TRUE;
+ g_signal_emit (switcher, signals[STYLE_CHANGED], 0, style);
+}
+
+/**
+ * e_shell_switcher_unset_style:
+ * @switcher: an #EShellSwitcher
+ *
+ * Unsets a switcher style set with e_shell_switcher_set_style(), so
+ * that user preferences will be used to determine the switcher style.
+ **/
+void
+e_shell_switcher_unset_style (EShellSwitcher *switcher)
+{
+ GtkSettings *settings;
+ GtkToolbarStyle style;
+
+ g_return_if_fail (E_IS_SHELL_SWITCHER (switcher));
+
+ if (!switcher->priv->style_set)
+ return;
+
+ settings = switcher->priv->settings;
+ if (settings != NULL)
+ g_object_get (settings, "gtk-toolbar-style", &style, NULL);
+ else
+ style = E_SHELL_SWITCHER_DEFAULT_TOOLBAR_STYLE;
+
+ if (style == GTK_TOOLBAR_BOTH)
+ style = GTK_TOOLBAR_BOTH_HORIZ;
+
+ if (style != switcher->priv->style)
+ g_signal_emit (switcher, signals[STYLE_CHANGED], 0, style);
+
+ switcher->priv->style_set = FALSE;
+}
+
+/**
+ * e_shell_switcher_get_visible:
+ * @switcher: an #EShellSwitcher
+ *
+ * Returns %TRUE if the switcher buttons are visible.
+ *
+ * Note that switcher button visibility is different than
+ * @switcher<!-- -->'s GTK_VISIBLE flag, since #EShellSwitcher
+ * is actually a container widget for #EShellSidebar.
+ *
+ * Returns: %TRUE if the switcher buttons are visible
+ **/
+gboolean
+e_shell_switcher_get_visible (EShellSwitcher *switcher)
+{
+ g_return_val_if_fail (E_IS_SHELL_SWITCHER (switcher), FALSE);
+
+ return switcher->priv->toolbar_visible;
+}
+
+/**
+ * e_shell_switcher_set_visible:
+ * @switcher: an #EShellSwitcher
+ * @visible: whether the switcher buttons should be visible
+ *
+ * Sets the switcher button visiblity to @visible.
+ *
+ * Note that switcher button visibility is different than
+ * @switcher<!-- -->'s GTK_VISIBLE flag, since #EShellSwitcher
+ * is actually a container widget for #EShellSidebar.
+ **/
+void
+e_shell_switcher_set_visible (EShellSwitcher *switcher,
+ gboolean visible)
+{
+ GList *iter;
+
+ g_return_if_fail (E_IS_SHELL_SWITCHER (switcher));
+
+ switcher->priv->toolbar_visible = visible;
+
+ for (iter = switcher->priv->proxies; iter != NULL; iter = iter->next)
+ g_object_set (iter->data, "visible", visible, NULL);
+
+ gtk_widget_queue_resize (GTK_WIDGET (switcher));
+
+ g_object_notify (G_OBJECT (switcher), "toolbar-visible");
+}
diff --git a/shell/e-shell-switcher.h b/shell/e-shell-switcher.h
new file mode 100644
index 0000000000..1cc644595b
--- /dev/null
+++ b/shell/e-shell-switcher.h
@@ -0,0 +1,92 @@
+/*
+ * e-shell-switcher.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+/**
+ * SECTION: e-shell-switcher
+ * @short_description: buttons for switching views
+ * @include: shell/e-shell-switcher.h
+ **/
+
+#ifndef E_SHELL_SWITCHER_H
+#define E_SHELL_SWITCHER_H
+
+#include <e-shell-common.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SHELL_SWITCHER \
+ (e_shell_switcher_get_type ())
+#define E_SHELL_SWITCHER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SHELL_SWITCHER, EShellSwitcher))
+#define E_SHELL_SWITCHER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SHELL_SWITCHER, EShellSwitcherClass))
+#define E_IS_SHELL_SWITCHER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SHELL_SWITCHER))
+#define E_IS_SHELL_SWITCHER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), E_TYPE_SHELL_SWITCHER))
+#define E_SHELL_SWITCHER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SHELL_SWITCHER, EShellSwitcherClass))
+
+#define E_SHELL_SWITCHER_DEFAULT_TOOLBAR_STYLE GTK_TOOLBAR_BOTH_HORIZ
+
+G_BEGIN_DECLS
+
+typedef struct _EShellSwitcher EShellSwitcher;
+typedef struct _EShellSwitcherClass EShellSwitcherClass;
+typedef struct _EShellSwitcherPrivate EShellSwitcherPrivate;
+
+/**
+ * EShellSwitcher:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
+struct _EShellSwitcher {
+ GtkBin parent;
+ EShellSwitcherPrivate *priv;
+};
+
+struct _EShellSwitcherClass {
+ GtkBinClass parent_class;
+
+ void (*style_changed) (EShellSwitcher *switcher,
+ GtkToolbarStyle style);
+};
+
+GType e_shell_switcher_get_type (void);
+GtkWidget * e_shell_switcher_new (void);
+void e_shell_switcher_add_action (EShellSwitcher *switcher,
+ GtkAction *action);
+GtkToolbarStyle e_shell_switcher_get_style (EShellSwitcher *switcher);
+void e_shell_switcher_set_style (EShellSwitcher *switcher,
+ GtkToolbarStyle style);
+void e_shell_switcher_unset_style (EShellSwitcher *switcher);
+gboolean e_shell_switcher_get_visible (EShellSwitcher *switcher);
+void e_shell_switcher_set_visible (EShellSwitcher *switcher,
+ gboolean visible);
+
+G_END_DECLS
+
+#endif /* E_SHELL_SWITCHER_H */
diff --git a/shell/e-shell-taskbar.c b/shell/e-shell-taskbar.c
new file mode 100644
index 0000000000..61f27fbc79
--- /dev/null
+++ b/shell/e-shell-taskbar.c
@@ -0,0 +1,421 @@
+/*
+ * e-shell-taskbar.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-shell-taskbar.h"
+
+#include <e-shell-view.h>
+
+#include <widgets/misc/e-activity-proxy.h>
+
+#define E_SHELL_TASKBAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SHELL_TASKBAR, EShellTaskbarPrivate))
+
+struct _EShellTaskbarPrivate {
+
+ gpointer shell_view; /* weak pointer */
+
+ GtkWidget *label;
+ GtkWidget *hbox;
+
+ GHashTable *proxy_table;
+};
+
+enum {
+ PROP_0,
+ PROP_MESSAGE,
+ PROP_SHELL_VIEW
+};
+
+static gpointer parent_class;
+
+static void
+shell_taskbar_activity_remove (EShellTaskbar *shell_taskbar,
+ EActivity *activity)
+{
+ GtkBox *box;
+ GtkWidget *proxy;
+ GHashTable *proxy_table;
+
+ box = GTK_BOX (shell_taskbar->priv->hbox);
+ proxy_table = shell_taskbar->priv->proxy_table;
+ proxy = g_hash_table_lookup (proxy_table, activity);
+ g_return_if_fail (proxy != NULL);
+
+ g_hash_table_remove (proxy_table, activity);
+ gtk_container_remove (GTK_CONTAINER (box), proxy);
+
+ if (box->children == NULL)
+ gtk_widget_hide (GTK_WIDGET (box));
+}
+
+static void
+shell_taskbar_activity_add (EShellTaskbar *shell_taskbar,
+ EActivity *activity)
+{
+ GtkBox *box;
+ GtkWidget *proxy;
+
+ proxy = e_activity_proxy_new (activity);
+ box = GTK_BOX (shell_taskbar->priv->hbox);
+ gtk_box_pack_start (box, proxy, TRUE, TRUE, 0);
+ gtk_box_reorder_child (box, proxy, 0);
+ gtk_widget_show (GTK_WIDGET (box));
+ gtk_widget_show (proxy);
+
+ g_hash_table_insert (
+ shell_taskbar->priv->proxy_table,
+ g_object_ref (activity), g_object_ref (proxy));
+
+ g_signal_connect_swapped (
+ activity, "cancelled",
+ G_CALLBACK (shell_taskbar_activity_remove), shell_taskbar);
+
+ g_signal_connect_swapped (
+ activity, "completed",
+ G_CALLBACK (shell_taskbar_activity_remove), shell_taskbar);
+}
+
+static void
+shell_taskbar_set_shell_view (EShellTaskbar *shell_taskbar,
+ EShellView *shell_view)
+{
+ g_return_if_fail (shell_taskbar->priv->shell_view == NULL);
+
+ shell_taskbar->priv->shell_view = shell_view;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_view),
+ &shell_taskbar->priv->shell_view);
+}
+
+static void
+shell_taskbar_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MESSAGE:
+ e_shell_taskbar_set_message (
+ E_SHELL_TASKBAR (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_SHELL_VIEW:
+ shell_taskbar_set_shell_view (
+ E_SHELL_TASKBAR (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_taskbar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MESSAGE:
+ g_value_set_string (
+ value, e_shell_taskbar_get_message (
+ E_SHELL_TASKBAR (object)));
+ return;
+
+ case PROP_SHELL_VIEW:
+ g_value_set_object (
+ value, e_shell_taskbar_get_shell_view (
+ E_SHELL_TASKBAR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_taskbar_dispose (GObject *object)
+{
+ EShellTaskbarPrivate *priv;
+
+ priv = E_SHELL_TASKBAR_GET_PRIVATE (object);
+
+ if (priv->shell_view != NULL) {
+ g_object_remove_weak_pointer (
+ G_OBJECT (priv->shell_view), &priv->shell_view);
+ priv->shell_view = NULL;
+ }
+
+ if (priv->label != NULL) {
+ g_object_unref (priv->label);
+ priv->label = NULL;
+ }
+
+ if (priv->hbox != NULL) {
+ g_object_unref (priv->hbox);
+ priv->hbox = NULL;
+ }
+
+ g_hash_table_remove_all (priv->proxy_table);
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+shell_taskbar_finalize (GObject *object)
+{
+ EShellTaskbarPrivate *priv;
+
+ priv = E_SHELL_TASKBAR_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->proxy_table);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+shell_taskbar_constructed (GObject *object)
+{
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ EShellTaskbar *shell_taskbar;
+
+ shell_taskbar = E_SHELL_TASKBAR (object);
+ shell_view = e_shell_taskbar_get_shell_view (shell_taskbar);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ g_signal_connect_swapped (
+ shell_backend, "activity-added",
+ G_CALLBACK (shell_taskbar_activity_add), shell_taskbar);
+}
+
+static void
+shell_taskbar_class_init (EShellTaskbarClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EShellTaskbarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = shell_taskbar_set_property;
+ object_class->get_property = shell_taskbar_get_property;
+ object_class->dispose = shell_taskbar_dispose;
+ object_class->finalize = shell_taskbar_finalize;
+ object_class->constructed = shell_taskbar_constructed;
+
+ /**
+ * EShellTaskbar:message
+ *
+ * The message to display in the taskbar.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_MESSAGE,
+ g_param_spec_string (
+ "message",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ /**
+ * EShellTaskbar:shell-view
+ *
+ * The #EShellView to which the taskbar widget belongs.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_VIEW,
+ g_param_spec_object (
+ "shell-view",
+ NULL,
+ NULL,
+ E_TYPE_SHELL_VIEW,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+shell_taskbar_init (EShellTaskbar *shell_taskbar)
+{
+ GtkWidget *widget;
+ GHashTable *proxy_table;
+ gint height;
+
+ proxy_table = g_hash_table_new_full (
+ g_direct_hash, g_direct_equal,
+ (GDestroyNotify) g_object_unref,
+ (GDestroyNotify) g_object_unref);
+
+ shell_taskbar->priv = E_SHELL_TASKBAR_GET_PRIVATE (shell_taskbar);
+ shell_taskbar->priv->proxy_table = proxy_table;
+
+ gtk_box_set_spacing (GTK_BOX (shell_taskbar), 12);
+
+ widget = gtk_label_new (NULL);
+ gtk_label_set_ellipsize (GTK_LABEL (widget), PANGO_ELLIPSIZE_END);
+ gtk_box_pack_start (GTK_BOX (shell_taskbar), widget, TRUE, TRUE, 0);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ shell_taskbar->priv->label = g_object_ref (widget);
+ gtk_widget_hide (widget);
+
+ widget = gtk_hbox_new (FALSE, 3);
+ gtk_box_pack_start (GTK_BOX (shell_taskbar), widget, TRUE, TRUE, 0);
+ shell_taskbar->priv->hbox = g_object_ref (widget);
+ gtk_widget_hide (widget);
+
+ /* Make the taskbar large enough to accomodate a small icon.
+ * XXX The "* 2" is a fudge factor to allow for some padding
+ * The true value is probably buried in a style property. */
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &height);
+ gtk_widget_set_size_request (
+ GTK_WIDGET (shell_taskbar), -1, (height * 2));
+}
+
+GType
+e_shell_taskbar_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EShellTaskbarClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) shell_taskbar_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EShellTaskbar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) shell_taskbar_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_HBOX, "EShellTaskbar", &type_info, 0);
+ }
+
+ return type;
+}
+
+/**
+ * e_shell_taskbar_new:
+ * @shell_view: an #EShellView
+ *
+ * Creates a new #EShellTaskbar instance belonging to @shell_view.
+ *
+ * Returns: a new #EShellTaskbar instance
+ **/
+GtkWidget *
+e_shell_taskbar_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_SHELL_TASKBAR, "shell-view", shell_view, NULL);
+}
+
+/**
+ * e_shell_taskbar_get_shell_view:
+ * @shell_taskbar: an #EShellTaskbar
+ *
+ * Returns the #EShellView that was passed to e_shell_taskbar_new().
+ *
+ * Returns: the #EShellView to which @shell_taskbar belongs
+ **/
+EShellView *
+e_shell_taskbar_get_shell_view (EShellTaskbar *shell_taskbar)
+{
+ g_return_val_if_fail (E_IS_SHELL_TASKBAR (shell_taskbar), NULL);
+
+ return shell_taskbar->priv->shell_view;
+}
+
+/**
+ * e_shell_taskbar_get_message:
+ * @shell_taskbar: an #EShellTaskbar
+ *
+ * Returns the message currently shown in the taskbar, or an empty string
+ * if no message is shown. Taskbar messages are used primarily for menu
+ * tooltips.
+ *
+ * Returns: the current taskbar message
+ **/
+const gchar *
+e_shell_taskbar_get_message (EShellTaskbar *shell_taskbar)
+{
+ GtkWidget *label;
+
+ g_return_val_if_fail (E_IS_SHELL_TASKBAR (shell_taskbar), NULL);
+
+ label = shell_taskbar->priv->label;
+
+ return gtk_label_get_text (GTK_LABEL (label));
+}
+
+/**
+ * e_shell_taskbar_set_message:
+ * @shell_taskbar: an #EShellTaskbar
+ * @message: the message to show
+ *
+ * Shows a message in the taskbar. If @message is %NULL or an empty string,
+ * the taskbar message is cleared. Taskbar messages are used primarily for
+ * menu tooltips.
+ **/
+void
+e_shell_taskbar_set_message (EShellTaskbar *shell_taskbar,
+ const gchar *message)
+{
+ GtkWidget *label;
+
+ g_return_if_fail (E_IS_SHELL_TASKBAR (shell_taskbar));
+
+ label = shell_taskbar->priv->label;
+ gtk_label_set_text (GTK_LABEL (label), message);
+
+ if (message != NULL && *message != '\0')
+ gtk_widget_show (label);
+ else
+ gtk_widget_hide (label);
+
+ g_object_notify (G_OBJECT (shell_taskbar), "message");
+}
+
+/**
+ * e_shell_taskbar_unset_message:
+ * @shell_taskbar: an #EShellTaskbar
+ *
+ * This is equivalent to passing a %NULL message to
+ * e_shell_taskbar_set_message().
+ **/
+void
+e_shell_taskbar_unset_message (EShellTaskbar *shell_taskbar)
+{
+ g_return_if_fail (E_IS_SHELL_TASKBAR (shell_taskbar));
+
+ e_shell_taskbar_set_message (shell_taskbar, NULL);
+}
diff --git a/shell/e-shell-taskbar.h b/shell/e-shell-taskbar.h
new file mode 100644
index 0000000000..3c3d40010e
--- /dev/null
+++ b/shell/e-shell-taskbar.h
@@ -0,0 +1,87 @@
+/*
+ * e-shell-taskbar.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+/**
+ * SECTION: e-shell-taskbar
+ * @short_description: the bottom of the main window
+ * @include: shell/e-shell-taskbar.h
+ **/
+
+#ifndef E_SHELL_TASKBAR_H
+#define E_SHELL_TASKBAR_H
+
+#include <shell/e-shell-common.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SHELL_TASKBAR \
+ (e_shell_taskbar_get_type ())
+#define E_SHELL_TASKBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SHELL_TASKBAR, EShellTaskbar))
+#define E_SHELL_TASKBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SHELL_TASKBAR, EShellTaskbarClass))
+#define E_IS_SHELL_TASKBAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SHELL_TASKBAR))
+#define E_IS_SHELL_TASKBAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SHELL_TASKBAR))
+#define E_SHELL_TASKBAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SHELL_TASKBAR, EShellTaskbarClass))
+
+G_BEGIN_DECLS
+
+/* Avoid including <e-shell-view.h>, because it includes us! */
+struct _EShellView;
+
+typedef struct _EShellTaskbar EShellTaskbar;
+typedef struct _EShellTaskbarClass EShellTaskbarClass;
+typedef struct _EShellTaskbarPrivate EShellTaskbarPrivate;
+
+/**
+ * EShellTaskbar:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
+struct _EShellTaskbar {
+ GtkHBox parent;
+ EShellTaskbarPrivate *priv;
+};
+
+struct _EShellTaskbarClass {
+ GtkHBoxClass parent_class;
+};
+
+GType e_shell_taskbar_get_type (void);
+GtkWidget * e_shell_taskbar_new (struct _EShellView *shell_view);
+struct _EShellView *
+ e_shell_taskbar_get_shell_view (EShellTaskbar *shell_taskbar);
+const gchar * e_shell_taskbar_get_message (EShellTaskbar *shell_taskbar);
+void e_shell_taskbar_set_message (EShellTaskbar *shell_taskbar,
+ const gchar *message);
+void e_shell_taskbar_unset_message (EShellTaskbar *shell_taskbar);
+
+G_END_DECLS
+
+#endif /* E_SHELL_TASKBAR_H */
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index a6d071cc78..cf89442c7c 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -1,5 +1,5 @@
/*
- * Helper class for evolution shells to setup a view
+ * e-shell-view.c
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -15,126 +15,1027 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "e-shell-view.h"
-#include <gtk/gtk.h>
+#include <string.h>
#include <glib/gi18n.h>
-#include "e-shell-view.h"
-#include "e-shell-window.h"
+#include "e-util/e-util.h"
+#include "e-util/e-plugin-ui.h"
+
+#include "e-shell-window-actions.h"
-static BonoboObjectClass *parent_class = NULL;
+#define E_SHELL_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SHELL_VIEW, EShellViewPrivate))
struct _EShellViewPrivate {
- int dummy;
+
+ gpointer shell_window; /* weak pointer */
+
+ gchar *title;
+ gchar *view_id;
+ gint page_num;
+ guint merge_id;
+
+ GtkAction *action;
+ GtkSizeGroup *size_group;
+ GtkWidget *shell_content;
+ GtkWidget *shell_sidebar;
+ GtkWidget *shell_taskbar;
};
+enum {
+ PROP_0,
+ PROP_ACTION,
+ PROP_PAGE_NUM,
+ PROP_TITLE,
+ PROP_SHELL_BACKEND,
+ PROP_SHELL_CONTENT,
+ PROP_SHELL_SIDEBAR,
+ PROP_SHELL_TASKBAR,
+ PROP_SHELL_WINDOW,
+ PROP_VIEW_ID
+};
+
+enum {
+ TOGGLED,
+ UPDATE_ACTIONS,
+ LAST_SIGNAL
+};
+
+static gpointer parent_class;
+static gulong signals[LAST_SIGNAL];
+
static void
-impl_ShellView_setTitle(PortableServer_Servant _servant, const CORBA_char *id, const CORBA_char * title, CORBA_Environment * ev)
+shell_view_init_view_collection (EShellViewClass *class)
{
- EShellView *esw = (EShellView *)bonobo_object_from_servant(_servant);
- /* To translators: This is the window title and %s is the
- component name. Most translators will want to keep it as is. */
- char *tmp = g_strdup_printf(_("%s - Evolution"), title);
+ EShellBackend *shell_backend;
+ const gchar *base_dir;
+ const gchar *backend_name;
+ gchar *system_dir;
+ gchar *local_dir;
+
+ shell_backend = class->shell_backend;
+ g_return_if_fail (E_IS_SHELL_BACKEND (shell_backend));
+ backend_name = E_SHELL_BACKEND_GET_CLASS (shell_backend)->name;
+
+ base_dir = EVOLUTION_GALVIEWSDIR;
+ system_dir = g_build_filename (base_dir, backend_name, NULL);
- e_shell_window_set_title(esw->window, id, tmp);
- g_free(tmp);
+ base_dir = e_shell_backend_get_data_dir (shell_backend);
+ local_dir = g_build_filename (base_dir, "views", NULL);
+
+ /* The view collection is never destroyed. */
+ class->view_collection = gal_view_collection_new ();
+
+ gal_view_collection_set_title (
+ class->view_collection, class->label);
+
+ gal_view_collection_set_storage_directories (
+ class->view_collection, system_dir, local_dir);
+
+ g_free (system_dir);
+ g_free (local_dir);
+
+ /* This is all we can do. It's up to the subclasses to
+ * add the appropriate factories to the view collection. */
}
static void
-impl_ShellView_setComponent(PortableServer_Servant _servant, const CORBA_char *id, CORBA_Environment * ev)
+shell_view_update_view_id (EShellView *shell_view,
+ GalViewInstance *view_instance)
{
- EShellView *esw = (EShellView *)bonobo_object_from_servant(_servant);
+ gchar *view_id;
- e_shell_window_switch_to_component(esw->window, id);
+ view_id = gal_view_instance_get_current_view_id (view_instance);
+ e_shell_view_set_view_id (shell_view, view_id);
+ g_free (view_id);
}
-struct change_icon_struct {
- const char *component_name;
- const char *icon_name;
-};
+static void
+shell_view_emit_toggled (EShellView *shell_view)
+{
+ g_signal_emit (shell_view, signals[TOGGLED], 0);
+}
+
+static void
+shell_view_set_action (EShellView *shell_view,
+ GtkAction *action)
+{
+ gchar *label;
+
+ g_return_if_fail (shell_view->priv->action == NULL);
+
+ shell_view->priv->action = g_object_ref (action);
+
+ g_object_get (action, "label", &label, NULL);
+ e_shell_view_set_title (shell_view, label);
+ g_free (label);
+
+ g_signal_connect_swapped (
+ action, "toggled",
+ G_CALLBACK (shell_view_emit_toggled), shell_view);
+}
+
+static void
+shell_view_set_shell_window (EShellView *shell_view,
+ GtkWidget *shell_window)
+{
+ g_return_if_fail (shell_view->priv->shell_window == NULL);
+
+ shell_view->priv->shell_window = shell_window;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_window),
+ &shell_view->priv->shell_window);
+}
+
+static void
+shell_view_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ACTION:
+ shell_view_set_action (
+ E_SHELL_VIEW (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_PAGE_NUM:
+ e_shell_view_set_page_num (
+ E_SHELL_VIEW (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_TITLE:
+ e_shell_view_set_title (
+ E_SHELL_VIEW (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_SHELL_WINDOW:
+ shell_view_set_shell_window (
+ E_SHELL_VIEW (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_VIEW_ID:
+ e_shell_view_set_view_id (
+ E_SHELL_VIEW (object),
+ g_value_get_string (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_view_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ACTION:
+ g_value_set_object (
+ value, e_shell_view_get_action (
+ E_SHELL_VIEW (object)));
+ return;
+
+ case PROP_PAGE_NUM:
+ g_value_set_int (
+ value, e_shell_view_get_page_num (
+ E_SHELL_VIEW (object)));
+ return;
+
+ case PROP_TITLE:
+ g_value_set_string (
+ value, e_shell_view_get_title (
+ E_SHELL_VIEW (object)));
+ return;
+
+ case PROP_SHELL_BACKEND:
+ g_value_set_object (
+ value, e_shell_view_get_shell_backend (
+ E_SHELL_VIEW (object)));
+
+ case PROP_SHELL_CONTENT:
+ g_value_set_object (
+ value, e_shell_view_get_shell_content (
+ E_SHELL_VIEW (object)));
+ return;
+
+ case PROP_SHELL_SIDEBAR:
+ g_value_set_object (
+ value, e_shell_view_get_shell_sidebar (
+ E_SHELL_VIEW (object)));
+ return;
+
+ case PROP_SHELL_TASKBAR:
+ g_value_set_object (
+ value, e_shell_view_get_shell_taskbar (
+ E_SHELL_VIEW (object)));
+ return;
-static gboolean
-change_button_icon_func (EShell *shell, EShellWindow *window, gpointer user_data)
+ case PROP_SHELL_WINDOW:
+ g_value_set_object (
+ value, e_shell_view_get_shell_window (
+ E_SHELL_VIEW (object)));
+ return;
+
+ case PROP_VIEW_ID:
+ g_value_set_string (
+ value, e_shell_view_get_view_id (
+ E_SHELL_VIEW (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+shell_view_dispose (GObject *object)
{
- struct change_icon_struct *cis = (struct change_icon_struct*)user_data;
+ EShellViewPrivate *priv;
+
+ priv = E_SHELL_VIEW_GET_PRIVATE (object);
+
+ if (priv->shell_window != NULL) {
+ g_object_remove_weak_pointer (
+ G_OBJECT (priv->shell_window), &priv->shell_window);
+ priv->shell_window = NULL;
+ }
- g_return_val_if_fail (window != NULL, FALSE);
- g_return_val_if_fail (cis != NULL, FALSE);
+ if (priv->size_group != NULL) {
+ g_object_unref (priv->size_group);
+ priv->size_group = NULL;
+ }
- e_shell_window_change_component_button_icon (window, cis->component_name, cis->icon_name);
+ if (priv->shell_content != NULL) {
+ g_object_unref (priv->shell_content);
+ priv->shell_content = NULL;
+ }
- return TRUE;
+ if (priv->shell_sidebar != NULL) {
+ g_object_unref (priv->shell_sidebar);
+ priv->shell_sidebar = NULL;
+ }
+
+ if (priv->shell_taskbar != NULL) {
+ g_object_unref (priv->shell_taskbar);
+ priv->shell_taskbar = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-impl_ShellView_setButtonIcon (PortableServer_Servant _servant, const CORBA_char *id, const CORBA_char * iconName, CORBA_Environment * ev)
+shell_view_finalize (GObject *object)
{
- EShellView *esw = (EShellView *)bonobo_object_from_servant(_servant);
- EShell *shell = e_shell_window_peek_shell (esw->window);
+ EShellViewPrivate *priv;
- struct change_icon_struct cis;
- cis.component_name = id;
- cis.icon_name = iconName;
+ priv = E_SHELL_VIEW_GET_PRIVATE (object);
- e_shell_foreach_shell_window (shell, change_button_icon_func, &cis);
+ g_free (priv->title);
+ g_free (priv->view_id);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-impl_dispose (GObject *object)
+shell_view_constructed (GObject *object)
{
- /*EShellView *esv = (EShellView *)object;*/
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ EShellViewClass *class;
+ GtkUIManager *ui_manager;
+ GtkWidget *widget;
+ const gchar *id;
+
+ shell_view = E_SHELL_VIEW (object);
+ class = E_SHELL_VIEW_GET_CLASS (object);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ id = class->ui_manager_id;
+
+ e_plugin_ui_register_manager (ui_manager, id, shell_view);
+
+ /* Invoke factory methods. */
- ((GObjectClass *)parent_class)->dispose(object);
+ widget = class->new_shell_content (shell_view);
+ shell_view->priv->shell_content = g_object_ref_sink (widget);
+ gtk_widget_show (widget);
+
+ widget = class->new_shell_sidebar (shell_view);
+ shell_view->priv->shell_sidebar = g_object_ref_sink (widget);
+ gtk_widget_show (widget);
+
+ widget = class->new_shell_taskbar (shell_view);
+ shell_view->priv->shell_taskbar = g_object_ref_sink (widget);
+ gtk_widget_show (widget);
}
static void
-impl_finalise (GObject *object)
+shell_view_toggled (EShellView *shell_view)
{
- ((GObjectClass *)parent_class)->finalize(object);
+ EShellViewPrivate *priv = shell_view->priv;
+ EShellViewClass *class;
+ EShellWindow *shell_window;
+ GtkUIManager *ui_manager;
+ const gchar *basename;
+ gboolean view_is_active;
+
+ class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ view_is_active = e_shell_view_is_active (shell_view);
+ basename = class->ui_definition;
+
+ if (view_is_active && priv->merge_id == 0) {
+ priv->merge_id = e_load_ui_definition (ui_manager, basename);
+ e_plugin_ui_enable_manager (ui_manager, class->ui_manager_id);
+
+ } else if (!view_is_active && priv->merge_id != 0) {
+ e_plugin_ui_disable_manager (ui_manager, class->ui_manager_id);
+ gtk_ui_manager_remove_ui (ui_manager, priv->merge_id);
+ priv->merge_id = 0;
+ }
+
+ gtk_ui_manager_ensure_update (ui_manager);
}
static void
-e_shell_view_class_init (EShellViewClass *klass)
+shell_view_class_init (EShellViewClass *class)
{
GObjectClass *object_class;
- POA_GNOME_Evolution_ShellView__epv *epv;
- parent_class = g_type_class_ref(bonobo_object_get_type());
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EShellViewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = shell_view_set_property;
+ object_class->get_property = shell_view_get_property;
+ object_class->dispose = shell_view_dispose;
+ object_class->finalize = shell_view_finalize;
+ object_class->constructed = shell_view_constructed;
+
+ /* Default Factories */
+ class->new_shell_content = e_shell_content_new;
+ class->new_shell_sidebar = e_shell_sidebar_new;
+ class->new_shell_taskbar = e_shell_taskbar_new;
+
+ class->toggled = shell_view_toggled;
+
+ /**
+ * EShellView:action:
+ *
+ * The #GtkRadioAction registered with #EShellSwitcher.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_ACTION,
+ g_param_spec_object (
+ "action",
+ _("Switcher Action"),
+ _("The switcher action for this shell view"),
+ GTK_TYPE_RADIO_ACTION,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * EShellView:page-num
+ *
+ * The #GtkNotebook page number of the shell view.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_PAGE_NUM,
+ g_param_spec_int (
+ "page-num",
+ _("Page Number"),
+ _("The notebook page number of the shell view"),
+ -1,
+ G_MAXINT,
+ -1,
+ G_PARAM_READWRITE));
+
+ /**
+ * EShellView:title
+ *
+ * The title of the shell view. Also serves as the #EShellWindow
+ * title when the shell view is active.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_TITLE,
+ g_param_spec_string (
+ "title",
+ _("Title"),
+ _("The title of the shell view"),
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * EShellView::shell-backend
+ *
+ * The #EShellBackend for this shell view.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_BACKEND,
+ g_param_spec_object (
+ "shell-backend",
+ _("Shell Backend"),
+ _("The EShellBackend for this shell view"),
+ E_TYPE_SHELL_BACKEND,
+ G_PARAM_READABLE));
+
+ /**
+ * EShellView:shell-content
+ *
+ * The content widget appears in an #EShellWindow<!-- -->'s
+ * right pane.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_CONTENT,
+ g_param_spec_object (
+ "shell-content",
+ _("Shell Content Widget"),
+ _("The content widget appears in "
+ "a shell window's right pane"),
+ E_TYPE_SHELL_CONTENT,
+ G_PARAM_READABLE));
- object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalise;
+ /**
+ * EShellView:shell-sidebar
+ *
+ * The sidebar widget appears in an #EShellWindow<!-- -->'s
+ * left pane.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_SIDEBAR,
+ g_param_spec_object (
+ "shell-sidebar",
+ _("Shell Sidebar Widget"),
+ _("The sidebar widget appears in "
+ "a shell window's left pane"),
+ E_TYPE_SHELL_SIDEBAR,
+ G_PARAM_READABLE));
- epv = & klass->epv;
- epv->setTitle = impl_ShellView_setTitle;
- epv->setComponent = impl_ShellView_setComponent;
- epv->setButtonIcon = impl_ShellView_setButtonIcon;
+ /**
+ * EShellView:shell-taskbar
+ *
+ * The taskbar widget appears at the bottom of an #EShellWindow.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_TASKBAR,
+ g_param_spec_object (
+ "shell-taskbar",
+ _("Shell Taskbar Widget"),
+ _("The taskbar widget appears at "
+ "the bottom of a shell window"),
+ E_TYPE_SHELL_TASKBAR,
+ G_PARAM_READABLE));
+
+ /**
+ * EShellView:shell-window
+ *
+ * The #EShellWindow to which the shell view belongs.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_WINDOW,
+ g_param_spec_object (
+ "shell-window",
+ _("Shell Window"),
+ _("The window to which the shell view belongs"),
+ E_TYPE_SHELL_WINDOW,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * EShellView:view-id
+ *
+ * The current #GalView ID.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_VIEW_ID,
+ g_param_spec_string (
+ "view-id",
+ _("Current View ID"),
+ _("The current GAL view ID"),
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * EShellView::toggled
+ * @shell_view: the #EShellView which emitted the signal
+ *
+ * Emitted when @shell_view is activated or deactivated.
+ * Use e_shell_view_is_active() to find out which event has
+ * occurred. The shell view being deactivated is always
+ * notified before the shell view being activated.
+ *
+ * By default, #EShellView adds the UI definition file
+ * given in the <structfield>ui_definition</structfield>
+ * field of #EShellViewClass on activation, and removes the
+ * UI definition on deactivation.
+ **/
+ signals[TOGGLED] = g_signal_new (
+ "toggled",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EShellViewClass, toggled),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ /**
+ * EShellView::update-actions
+ * @shell_view: the #EShellView which emitted the signal
+ *
+ * #EShellView subclasses should override the
+ * <structfield>update_actions</structfield> method in
+ * #EShellViewClass to update sensitivities, labels, or any
+ * other aspect of the #GtkAction<!-- -->s they have registered.
+ *
+ * Plugins can also connect to this signal to be notified
+ * when to update their own #GtkAction<!-- -->s.
+ **/
+ signals[UPDATE_ACTIONS] = g_signal_new (
+ "update-actions",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EShellViewClass, update_actions),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
static void
-e_shell_view_init (EShellView *shell)
+shell_view_init (EShellView *shell_view,
+ EShellViewClass *class)
+{
+ GtkSizeGroup *size_group;
+
+ if (class->view_collection == NULL)
+ shell_view_init_view_collection (class);
+
+ size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
+
+ shell_view->priv = E_SHELL_VIEW_GET_PRIVATE (shell_view);
+ shell_view->priv->size_group = size_group;
+}
+
+GType
+e_shell_view_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (EShellViewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) shell_view_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EShellView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) shell_view_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ G_TYPE_OBJECT, "EShellView",
+ &type_info, G_TYPE_FLAG_ABSTRACT);
+ }
+
+ return type;
+}
+
+/**
+ * e_shell_view_get_name:
+ * @shell_view: an #EShellView
+ *
+ * Returns the view name for @shell_view, which is also the name of
+ * the corresponding #EShellBackend (see the <structfield>name</structfield>
+ * field in #EShellBackendInfo).
+ *
+ * Returns: the view name for @shell_view
+ **/
+const gchar *
+e_shell_view_get_name (EShellView *shell_view)
+{
+ GtkAction *action;
+
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ action = e_shell_view_get_action (shell_view);
+
+ /* Switcher actions have a secret "view-name" data value.
+ * This gets set in e_shell_window_create_switcher_actions(). */
+ return g_object_get_data (G_OBJECT (action), "view-name");
+}
+
+/**
+ * e_shell_view_get_action:
+ * @shell_view: an #EShellView
+ *
+ * Returns the switcher action for @shell_view.
+ *
+ * An #EShellWindow creates a #GtkRadioAction for each registered subclass
+ * of #EShellView. This action gets passed to the #EShellSwitcher, which
+ * displays a button that proxies the action. The icon at the top of the
+ * sidebar also proxies the action. When @shell_view is active, the
+ * action's icon becomes the #EShellWindow icon.
+ *
+ * Returns: the switcher action for @shell_view
+ **/
+GtkAction *
+e_shell_view_get_action (EShellView *shell_view)
{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return shell_view->priv->action;
+}
+
+/**
+ * e_shell_view_get_title:
+ * @shell_view: an #EShellView
+ *
+ * Returns the title for @shell_view. When @shell_view is active, the
+ * shell view's title becomes the #EShellWindow title.
+ *
+ * Returns: the title for @shell_view
+ **/
+const gchar *
+e_shell_view_get_title (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return shell_view->priv->title;
+}
+
+/**
+ * e_shell_view_set_title:
+ * @shell_view: an #EShellView
+ * @title: a title for @shell_view
+ *
+ * Sets the title for @shell_view. When @shell_view is active, the
+ * shell view's title becomes the #EShellWindow title.
+ **/
+void
+e_shell_view_set_title (EShellView *shell_view,
+ const gchar *title)
+{
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+
+ if (title == NULL)
+ title = E_SHELL_VIEW_GET_CLASS (shell_view)->label;
+
+ if (g_strcmp0 (shell_view->priv->title, title) == 0)
+ return;
+
+ g_free (shell_view->priv->title);
+ shell_view->priv->title = g_strdup (title);
+
+ g_object_notify (G_OBJECT (shell_view), "title");
+}
+
+/**
+ * e_shell_view_get_view_id:
+ * @shell_view: an #EShellView
+ *
+ * Returns the ID of the currently selected #GalView.
+ *
+ * #EShellView subclasses are responsible for keeping this property in
+ * sync with their #GalViewInstance. #EShellView itself just provides
+ * a place to store the view ID, and emits a #GObject::notify signal
+ * when the property changes.
+ *
+ * Returns: the ID of the current #GalView
+ **/
+const gchar *
+e_shell_view_get_view_id (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return shell_view->priv->view_id;
+}
+
+/**
+ * e_shell_view_set_view_id:
+ * @shell_view: an #EShellView
+ * @view_id: a #GalView ID
+ *
+ * Selects the #GalView whose ID is equal to @view_id.
+ *
+ * #EShellView subclasses are responsible for keeping this property in
+ * sync with their #GalViewInstance. #EShellView itself just provides
+ * a place to store the view ID, and emits a #GObject::notify signal
+ * when the property changes.
+ **/
+void
+e_shell_view_set_view_id (EShellView *shell_view,
+ const gchar *view_id)
+{
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+
+ if (g_strcmp0 (shell_view->priv->view_id, view_id) == 0)
+ return;
+
+ g_free (shell_view->priv->view_id);
+ shell_view->priv->view_id = g_strdup (view_id);
+
+ g_object_notify (G_OBJECT (shell_view), "view-id");
+}
+
+/**
+ * e_shell_view_get_shell_window:
+ * @shell_view: an #EShellView
+ *
+ * Returns the #EShellWindow to which @shell_view belongs.
+ *
+ * Returns: the #EShellWindow to which @shell_view belongs
+ **/
+EShellWindow *
+e_shell_view_get_shell_window (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return E_SHELL_WINDOW (shell_view->priv->shell_window);
+}
+
+/**
+ * e_shell_view_is_active:
+ * @shell_view: an #EShellView
+ *
+ * Returns %TRUE if @shell_view is active. That is, if it's currently
+ * visible in its #EShellWindow. An #EShellWindow can only display one
+ * shell view at a time.
+ *
+ * Technically this just checks the #GtkToggleAction:active property of
+ * the shell view's switcher action. See e_shell_view_get_action().
+ *
+ * Returns: %TRUE if @shell_view is active
+ **/
+gboolean
+e_shell_view_is_active (EShellView *shell_view)
+{
+ GtkAction *action;
+
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
+
+ action = e_shell_view_get_action (shell_view);
+
+ return gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+}
+
+/**
+ * e_shell_view_get_page_num:
+ * @shell_view: an #EShellView
+ *
+ * This function is only interesting to #EShellWindow. It returns the
+ * #GtkNotebook page number for @shell_view. The rest of the application
+ * should have no need for this.
+ *
+ * Returns: the notebook page number for @shell_view
+ **/
+gint
+e_shell_view_get_page_num (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), -1);
+
+ return shell_view->priv->page_num;
+}
+
+/**
+ * e_shell_view_set_page_num:
+ * @shell_view: an #EShellView
+ * @page_num: a notebook page number
+ *
+ * This function is only interesting to #EShellWindow. It sets the
+ * #GtkNotebook page number for @shell_view. The rest of the application
+ * must never call this because it could mess up shell view switching.
+ **/
+void
+e_shell_view_set_page_num (EShellView *shell_view,
+ gint page_num)
+{
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+
+ shell_view->priv->page_num = page_num;
+
+ g_object_notify (G_OBJECT (shell_view), "page-num");
+}
+
+/**
+ * e_shell_view_get_size_group:
+ * @shell_view: an #EShellView
+ *
+ * Returns a #GtkSizeGroup that #EShellContent and #EShellSidebar use
+ * to keep the search bar and sidebar banner vertically aligned. The
+ * rest of the application should have no need for this.
+ *
+ * Returns: a #GtkSizeGroup for internal use
+ **/
+GtkSizeGroup *
+e_shell_view_get_size_group (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return shell_view->priv->size_group;
}
-EShellView *e_shell_view_new(struct _EShellWindow *window)
+/**
+ * e_shell_view_get_shell_backend:
+ * @shell_view: an #EShellView
+ *
+ * Returns the corresponding #EShellBackend for @shell_view.
+ *
+ * Returns: the corresponding #EShellBackend for @shell_view
+ **/
+EShellBackend *
+e_shell_view_get_shell_backend (EShellView *shell_view)
{
- EShellView *new = g_object_new (e_shell_view_get_type (), NULL);
+ EShellViewClass *class;
+
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ g_return_val_if_fail (class->shell_backend != NULL, NULL);
+
+ return class->shell_backend;
+}
- /* TODO: listen to destroy? */
- new->window = window;
+/**
+ * e_shell_view_get_shell_content:
+ * @shell_view: an #EShellView
+ *
+ * Returns the #EShellContent instance for @shell_view.
+ *
+ * By default, #EShellView creates a plain #EShellContent during
+ * initialization. But #EShellView subclasses can override the
+ * <structfield>new_shell_content</structfield> factory method
+ * in #EShellViewClass to create a custom #EShellContent.
+ *
+ * Returns: the #EShellContent instance for @shell_view
+ **/
+EShellContent *
+e_shell_view_get_shell_content (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
- return new;
+ return E_SHELL_CONTENT (shell_view->priv->shell_content);
}
-BONOBO_TYPE_FUNC_FULL (EShellView, GNOME_Evolution_ShellView, bonobo_object_get_type(), e_shell_view)
+/**
+ * e_shell_view_get_shell_sidebar:
+ * @shell_view: an #EShellView
+ *
+ * Returns the #EShellSidebar instance for @shell_view.
+ *
+ * By default, #EShellView creates a plain #EShellSidebar during
+ * initialization. But #EShellView subclasses can override the
+ * <structfield>new_shell_sidebar</structfield> factory method
+ * in #EShellViewClass to create a custom #EShellSidebar.
+ *
+ * Returns: the #EShellSidebar instance for @shell_view
+ **/
+EShellSidebar *
+e_shell_view_get_shell_sidebar (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return E_SHELL_SIDEBAR (shell_view->priv->shell_sidebar);
+}
+/**
+ * e_shell_view_get_shell_taskbar:
+ * @shell_view: an #EShellView
+ *
+ * Returns the #EShellTaskbar instance for @shell_view.
+ *
+ * By default, #EShellView creates a plain #EShellTaskbar during
+ * initialization. But #EShellView subclasses can override the
+ * <structfield>new_shell_taskbar</structfield> factory method
+ * in #EShellViewClass to create a custom #EShellTaskbar.
+ *
+ * Returns: the #EShellTaskbar instance for @shell_view
+ **/
+EShellTaskbar *
+e_shell_view_get_shell_taskbar (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return E_SHELL_TASKBAR (shell_view->priv->shell_taskbar);
+}
+
+/**
+ * e_shell_view_update_actions:
+ * @shell_view: an #EShellView
+ *
+ * Emits the #EShellView::update-actions signal.
+ *
+ * #EShellView subclasses should implement the
+ * <structfield>update_actions</structfield> method in #EShellViewClass
+ * to update the various #GtkAction<!-- -->s based on the current
+ * #EShellSidebar and #EShellContent selections. The
+ * #EShellView::update-actions signal is typically emitted just before
+ * showing a popup menu or just after the user selects an item in the
+ * shell view.
+ **/
+void
+e_shell_view_update_actions (EShellView *shell_view)
+{
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+
+ g_signal_emit (shell_view, signals[UPDATE_ACTIONS], 0);
+}
+
+/**
+ * e_shell_view_show_popup_menu:
+ * @shell_view: an #EShellView
+ * @widget_path: path in the UI definition
+ * @event: a #GdkEventButton
+ *
+ * Displays a context-sensitive (or "popup") menu that is described in
+ * the UI definition loaded into @shell_view<!-- -->'s user interface
+ * manager. The menu will be shown at the current mouse cursor position.
+ *
+ * The #EShellView::update-actions signal is emitted just prior to
+ * showing the menu to give @shell_view and any plugins that extend
+ * @shell_view a chance to update the menu's actions.
+ **/
+void
+e_shell_view_show_popup_menu (EShellView *shell_view,
+ const gchar *widget_path,
+ GdkEventButton *event)
+{
+ EShellWindow *shell_window;
+ GtkWidget *menu;
+
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+
+ e_shell_view_update_actions (shell_view);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ menu = e_shell_window_get_managed_widget (shell_window, widget_path);
+ g_return_if_fail (GTK_IS_MENU (menu));
+
+ if (event != NULL)
+ gtk_menu_popup (
+ GTK_MENU (menu), NULL, NULL, NULL, NULL,
+ event->button, event->time);
+ else
+ gtk_menu_popup (
+ GTK_MENU (menu), NULL, NULL, NULL, NULL,
+ 0, gtk_get_current_event_time ());
+}
+
+/**
+ * e_shell_view_new_view_instance:
+ * @shell_view: an #EShellView
+ * @instance_id: a name for the #GalViewInstance
+ *
+ * Creates a new #GalViewInstance and configures it to keep
+ * @shell_view<!-- -->'s #EShellView:view-id property up-to-date.
+ *
+ * Returns: a new #GalViewInstance
+ **/
+GalViewInstance *
+e_shell_view_new_view_instance (EShellView *shell_view,
+ const gchar *instance_id)
+{
+ EShellViewClass *class;
+ GalViewCollection *view_collection;
+ GalViewInstance *view_instance;
+
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ class = E_SHELL_VIEW_GET_CLASS (shell_view);
+
+ view_collection = class->view_collection;
+ view_instance = gal_view_instance_new (view_collection, instance_id);
+
+ g_signal_connect_swapped (
+ view_instance, "changed",
+ G_CALLBACK (shell_view_update_view_id), shell_view);
+
+ return view_instance;
+}
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index dd500efa94..664094e3a8 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -1,6 +1,5 @@
/*
- *
- * This is only a CORBA wrapper around e_shell_window.
+ * e-shell-view.h
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -20,51 +19,166 @@
*
*/
-#ifndef _E_SHELL_VIEW_H_
-#define _E_SHELL_VIEW_H_
+/**
+ * SECTION: e-shell-view
+ * @short_description: views within the main window
+ * @include: shell/e-shell-view.h
+ **/
+
+#ifndef E_SHELL_VIEW_H
+#define E_SHELL_VIEW_H
+
+#include <shell/e-shell-common.h>
+#include <shell/e-shell-backend.h>
+#include <shell/e-shell-content.h>
+#include <shell/e-shell-sidebar.h>
+#include <shell/e-shell-taskbar.h>
+#include <shell/e-shell-window.h>
+
+#include <widgets/menus/gal-view-collection.h>
+#include <widgets/menus/gal-view-instance.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SHELL_VIEW \
+ (e_shell_view_get_type ())
+#define E_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SHELL_VIEW, EShellView))
+#define E_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SHELL_VIEW, EShellViewClass))
+#define E_IS_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SHELL_VIEW))
+#define E_IS_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SHELL_VIEW))
+#define E_SHELL_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SHELL_VIEW, EShellViewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EShellView EShellView;
+typedef struct _EShellViewClass EShellViewClass;
+typedef struct _EShellViewPrivate EShellViewPrivate;
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo/bonobo-object.h>
+/**
+ * EShellView:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
+struct _EShellView {
+ GObject parent;
+ EShellViewPrivate *priv;
+};
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+/**
+ * EShellViewClass:
+ * @parent_class: The parent class structure.
+ * @label: The initial value for the switcher action's
+ * #GtkAction:label property. See
+ * e_shell_view_get_action().
+ * @icon_name: The initial value for the switcher action's
+ * #GtkAction:icon-name property. See
+ * e_shell_view_get_action().
+ * @ui_definition: Base name of the UI definintion file to add
+ * when the shell view is activated.
+ * @ui_manager_id: The #GtkUIManager ID for #EPluginUI. Plugins
+ * should use to this ID in their "eplug" files to
+ * add menu and toolbar items to the shell view.
+ * @search_options: Widget path in the UI definition to the search
+ * options popup menu. The menu gets shown when the
+ * user clicks the "find" icon in the search entry.
+ * @search_rules: Base name of the XML file containing predefined
+ * search rules for this shell view. The XML files
+ * are usually named something like <filename>
+ * <emphasis>view</emphasis>types.xml</filename>.
+ * @view_collection: A unique #GalViewCollection instance is created
+ * for each subclass and shared across all instances
+ * of that subclass. That much is done automatically
+ * for subclasses, but subclasses are still responsible
+ * for adding the appropriate #GalView factories to the
+ * view collection.
+ * @new_shell_content: Factory method for the shell view's #EShellContent.
+ * See e_shell_view_get_shell_content().
+ * @new_shell_sidebar: Factory method for the shell view's #EShellSidebar.
+ * See e_shell_view_get_shell_sidebar().
+ * @new_shell_taskbar: Factory method for the shell view's #EShellTaskbar.
+ * See e_shell_view_get_shell_taskbar().
+ * @toggled: Class method for the #EShellView::toggled signal.
+ * Subclasses should rarely need to override the
+ * default behavior.
+ * @update_actions: Class method for the #EShellView::update_actions
+ * signal. There is no default behavior; subclasses
+ * should override this.
+ *
+ * #EShellViewClass contains a number of important settings for subclasses.
+ **/
+struct _EShellViewClass {
+ GObjectClass parent_class;
-struct _EShell;
+ /* Initial switcher action values. */
+ const gchar *label;
+ const gchar *icon_name;
-typedef struct _EShellView EShellView;
-typedef struct _EShellViewPrivate EShellViewPrivate;
-typedef struct _EShellViewClass EShellViewClass;
+ /* Base name of the UI definition file. */
+ const gchar *ui_definition;
-#include "Evolution.h"
+ /* GtkUIManager identifier for use with EPluginUI.
+ * Usually "org.gnome.evolution.$(VIEW_NAME)". */
+ const gchar *ui_manager_id;
-#define E_TYPE_SHELL_VIEW (e_shell_view_get_type ())
-#define E_SHELL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SHELL_VIEW, EShellView))
-#define E_SHELL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_VIEW, EShellViewClass))
-#define E_IS_SHELL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SHELL_VIEW))
-#define E_IS_SHELL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_VIEW))
+ /* Widget path to the search options popup menu. */
+ const gchar *search_options;
-struct _EShellView {
- BonoboObject parent;
+ /* Base name of the search rule definition file. */
+ const gchar *search_rules;
- struct _EShellWindow *window;
+ /* A unique instance is created for each subclass. */
+ GalViewCollection *view_collection;
- EShellViewPrivate *priv;
-};
+ /* This is set by the corresponding EShellBackend. */
+ EShellBackend *shell_backend;
-struct _EShellViewClass {
- BonoboObjectClass parent_class;
+ /* Factory Methods */
+ GtkWidget * (*new_shell_content) (EShellView *shell_view);
+ GtkWidget * (*new_shell_sidebar) (EShellView *shell_view);
+ GtkWidget * (*new_shell_taskbar) (EShellView *shell_view);
- POA_GNOME_Evolution_ShellView__epv epv;
+ /* Signals */
+ void (*toggled) (EShellView *shell_view);
+ void (*update_actions) (EShellView *shell_view);
};
-GType e_shell_view_get_type (void);
-EShellView *e_shell_view_new(struct _EShellWindow *window);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_SHELL_VIEW_H_ */
-
+GType e_shell_view_get_type (void);
+const gchar * e_shell_view_get_name (EShellView *shell_view);
+GtkAction * e_shell_view_get_action (EShellView *shell_view);
+const gchar * e_shell_view_get_title (EShellView *shell_view);
+void e_shell_view_set_title (EShellView *shell_view,
+ const gchar *title);
+const gchar * e_shell_view_get_view_id (EShellView *shell_view);
+void e_shell_view_set_view_id (EShellView *shell_view,
+ const gchar *view_id);
+gboolean e_shell_view_is_active (EShellView *shell_view);
+gint e_shell_view_get_page_num (EShellView *shell_view);
+void e_shell_view_set_page_num (EShellView *shell_view,
+ gint page_num);
+GtkSizeGroup * e_shell_view_get_size_group (EShellView *shell_view);
+EShellBackend * e_shell_view_get_shell_backend (EShellView *shell_view);
+EShellContent * e_shell_view_get_shell_content (EShellView *shell_view);
+EShellSidebar * e_shell_view_get_shell_sidebar (EShellView *shell_view);
+EShellTaskbar * e_shell_view_get_shell_taskbar (EShellView *shell_view);
+EShellWindow * e_shell_view_get_shell_window (EShellView *shell_view);
+void e_shell_view_update_actions (EShellView *shell_view);
+void e_shell_view_show_popup_menu (EShellView *shell_view,
+ const gchar *widget_path,
+ GdkEventButton *event);
+GalViewInstance *
+ e_shell_view_new_view_instance (EShellView *shell_view,
+ const gchar *instance_id);
+
+G_END_DECLS
+
+#endif /* E_SHELL_VIEW_H */
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
new file mode 100644
index 0000000000..a53412c00b
--- /dev/null
+++ b/shell/e-shell-window-actions.c
@@ -0,0 +1,2226 @@
+/*
+ * e-shell-window-actions.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-shell-window-private.h"
+
+#include <e-util/e-dialog-utils.h>
+#include <e-util/e-error.h>
+#include <e-util/e-print.h>
+#include <gal-define-views-dialog.h>
+
+#include <libedataserverui/e-passwords.h>
+
+#include "e-shell-importer.h"
+
+#define EVOLUTION_COPYRIGHT \
+ "Copyright \xC2\xA9 1999 - 2008 Novell, Inc. and Others"
+
+#define EVOLUTION_FAQ \
+ "http://www.go-evolution.org/FAQ"
+
+#define EVOLUTION_WEBSITE \
+ "http://www.gnome.org/projects/evolution/"
+
+/* Authors and Documenters
+ *
+ * The names below must be in UTF-8. The breaking of escaped strings
+ * is so the hexadecimal sequences don't swallow too many characters.
+ *
+ * SO THAT MEANS, FOR 8-BIT CHARACTERS USE \xXX HEX ENCODING ONLY!
+ *
+ * Not all environments are UTF-8 and not all editors can handle it.
+ */
+static const gchar *authors[] = {
+ "Aaron Weber",
+ "Abel Cheung",
+ "Abhishek Parwal",
+ "Adam Weinberger",
+ "Adi Attar",
+ "Ahmad Riza H Nst",
+ "Aidan Delaney",
+ "Aishwarya K",
+ "Akagic Amila",
+ "Akhil Laddha",
+ "Akira Tagoh",
+ "Alastair McKinstry",
+ "Alastair Tse",
+ "Alejandro Andres",
+ "Alessandro Decina",
+ "Alex Graveley",
+ "Alex Jiang",
+ "Alex Jones",
+ "Alex Kloss",
+ "Alexander Shopov",
+ "Alfred Peng",
+ "Ali Abdin",
+ "Ali Akcaagac",
+ "Almer S. Tigelaar",
+ "Amish",
+ "Anand V M",
+ "Anders Carlsson",
+ "Andre Klapper",
+ "Andrea Campi",
+ "Andreas Henriksson",
+ "Andreas Hyden",
+ "Andreas J. Guelzow",
+ "Andreas K\xC3\xB6hler",
+ "Andreas Köhler",
+ "Andrew Ruthven",
+ "Andrew T. Veliath",
+ "Andrew Wu",
+ "Ankit Patel",
+ "Anna Marie Dirks",
+ "Antonio Xu",
+ "Arafat Medini",
+ "Arangel Angov",
+ "Archit Baweja",
+ "Ariel Rios",
+ "Arik Devens",
+ "Armin Bauer",
+ "Arturo Espinosa Aldama",
+ "Arulanandan P",
+ "Arun Prakash",
+ "Arvind Sundararajan",
+ "Arvind",
+ "Ashish",
+ "B S Srinidhi",
+ "Bastien Nocera",
+ "Behnam Esfahbod",
+ "Ben Gamari",
+ "Benjamin Berg",
+ "Benjamin Kahn",
+ "Benoît Dejean",
+ "Bernard Leach",
+ "Bertrand Guiheneuf",
+ "Bharath Acharya",
+ "Bill Zhu",
+ "Bj\xC3\xB6rn Torkelsson",
+ "Björn Lindqvist",
+ "Bob Doan",
+ "Bob Mauchin",
+ "Boby Wang",
+ "Bolian Yin",
+ "Brian Mury",
+ "Brian Pepple",
+ "Bruce Tao",
+ "Calvin Liu",
+ "Cantona Su",
+ "Carl Sun",
+ "Carlos Garcia Campos",
+ "Carlos Garnacho Parro",
+ "Carlos Perell\xC3\xB3" " Mar\xC3\xAD" "n",
+ "Carsten Guenther",
+ "Carsten Schaar",
+ "Changwoo Ryu",
+ "Chao-Hsiung Liao",
+ "Charles Zhang",
+ "Chema Celorio",
+ "Chenthill Palanisamy",
+ "Chpe",
+ "Chris Halls",
+ "Chris Heath",
+ "Chris Phelps",
+ "Chris Toshok",
+ "Christian Hammond",
+ "Christian Kellner",
+ "Christian Kirbach",
+ "Christian Krause",
+ "Christian Kreibich",
+ "Christian Neumair",
+ "Christophe Fergeau",
+ "Christophe Merlet",
+ "Christopher Blizzard",
+ "Christopher J. Lahey",
+ "Christopher R. Gabriel",
+ "Claude Paroz",
+ "Claudio Saavedra",
+ "Clifford R. Conover",
+ "Cody Russell",
+ "Colin Leroy",
+ "Craig Small",
+ "Dafydd Harries",
+ "Damian Ivereigh",
+ "Damien Carbery",
+ "Damon Chaplin",
+ "Dan Berger",
+ "Dan Damian",
+ "Dan Nguyen",
+ "Dan Winship",
+ "Daniel Gryniewicz",
+ "Daniel Nylander",
+ "Daniel van Eeden",
+ "Daniel Veillard",
+ "Daniel Yacob",
+ "Danilo \xC5\xA0" "egan",
+ "Danilo Segan",
+ "Darin Adler",
+ "Dave Benson",
+ "Dave Camp",
+ "Dave Fallon",
+ "Dave Malcolm",
+ "Dave West",
+ "David Farning",
+ "David Kaelbling",
+ "David Malcolm",
+ "David Moore",
+ "David Mosberger",
+ "David Richards",
+ "David Trowbridge",
+ "David Turner",
+ "David Woodhouse",
+ "Denis Washington",
+ "Devashish Sharma",
+ "Diego Escalante Urrelo",
+ "Diego Gonzalez",
+ "Diego Sevilla Ruiz",
+ "Dietmar Maurer",
+ "Dinesh Layek",
+ "Djihed Afifi",
+ "Dmitry Mastrukov",
+ "Dodji Seketeli",
+ "Duarte Loreto",
+ "Dulmandakh Sukhbaatar",
+ "Duncan Mak",
+ "Ebby Wiselyn",
+ "Ed Catmur",
+ "Edd Dumbill",
+ "Edgar Luna Díaz",
+ "Edward Rudd",
+ "Elijah Newren",
+ "Elizabeth Greene",
+ "Elliot Lee",
+ "Elliot Turner",
+ "Eneko Lacunza",
+ "Enver Altin",
+ "Erdal Ronahi",
+ "Eric Busboom",
+ "Eric Zhao",
+ "Eskil Heyn Olsen",
+ "Ettore Perazzoli",
+ "Evan Yan",
+ "Fatih Demir",
+ "Fazlu & Hannah",
+ "Federico Mena Quintero",
+ "Fernando Herrera",
+ "Francisco Javier F. Serrador",
+ "Frank Arnold",
+ "Frank Belew",
+ "Frederic Crozat",
+ "Frederic Peters",
+ "Funda Wang",
+ "Gabor Kelemen",
+ "Ganesh",
+ "Gareth Owen",
+ "Gary Coady",
+ "Gary Ekker",
+ "Gavin Scott",
+ "Gediminas Paulauskas",
+ "Gerg\xC5\x91 \xC3\x89rdi",
+ "George Lebl",
+ "Gerardo Marin",
+ "Gert Kulyk",
+ "Giancarlo Capella",
+ "Gil Osher",
+ "Gilbert Fang",
+ "Gilles Dartiguelongue",
+ "Grahame Bowland",
+ "Greg Hudson",
+ "Gregory Leblanc",
+ "Gregory McLean",
+ "Grzegorz Goawski",
+ "Gustavo Gir\xC3\x8E" "ldez",
+ "Gustavo Maciel Dias Vieira",
+ "H P Nadig",
+ "H\xC3\xA9" "ctor Garc\xC3\xAD" "a \xC3\x81" "lvarez",
+ "Hans Petter Jansson",
+ "Hao Sheng",
+ "Hari Prasad Nadig",
+ "Harish K",
+ "Harish Krishnaswamy",
+ "Harry Lu",
+ "Hasbullah Bin Pit",
+ "Havoc Pennington",
+ "Heath Harrelson",
+ "Hein-Pieter van Braam",
+ "Herbert V. Riedel",
+ "Hiroyuki Ikezoe",
+ "Iain Buchanan",
+ "Iain Holmes",
+ "Ian Campbell",
+ "Ilkka Tuohela",
+ "Irene Huang",
+ "Ismael Olea",
+ "Israel Escalante",
+ "Iv\xC3\xA1" "n Frade",
+ "Iván Frade",
+ "J.H.M. Dassen (Ray)",
+ "JP Rosevear",
+ "J\xC3\xBC" "rg Billeter",
+ "Jürg Billeter",
+ "Jack Jia",
+ "Jacob Ulysses Berkman",
+ "Jacob Berkman",
+ "Jaka Mocnik",
+ "Jakub Steiner",
+ "James Doc Livingston",
+ "James Bowes",
+ "James Henstridge",
+ "James Willcox",
+ "Jan Arne Petersen",
+ "Jan Tichavsky",
+ "Jan Van Buggenhout",
+ "Jared Moore",
+ "Jarkko Ranta",
+ "Jason Leach",
+ "Jason Tackaberry",
+ "Jayaradha",
+ "Jean-Noel Guiheneuf",
+ "Jedy Wang",
+ "Jeff Bailey",
+ "Jeff Cai",
+ "Jeff Garzik",
+ "Jeffrey Stedfast",
+ "Jens Granseuer",
+ "Jens Seidel",
+ "Jeremy Katz",
+ "Jeremy Wise",
+ "Jerome Lacoste",
+ "Jerry Yu",
+ "Jes\xC3\xBA" "s Bravo \xC3\x81" "lvarez",
+ "Jesse Pavel",
+ "Ji Lee",
+ "Joan Sanfeliu",
+ "Jody Goldberg",
+ "Joe Marcus Clarke",
+ "Joe Shaw",
+ "John Gotts",
+ "Johnny Jacob",
+ "Johnny",
+ "Jon Ander Hernandez",
+ "Jon K Hellan",
+ "Jon Oberheide",
+ "Jon Trowbridge",
+ "Jonas Borgstr",
+ "Jonathan Blandford",
+ "Jonathan Dieter",
+ "Jos Dehaes",
+ "Josselin Mouette",
+ "JP Rosvear",
+ "Jukka Zitting",
+ "Jules Colding",
+ "Julian Missig",
+ "Julio M. Merino Vidal",
+ "Jürg Billeter",
+ "Karl Eichwalder",
+ "Karl Relton",
+ "Karsten Br\xC3\xA4" "ckelmann",
+ "Kaushal Kumar",
+ "Kenneth Christiansen",
+ "Kenny Graunke",
+ "Keshav Upadhyaya",
+ "Kevin Breit",
+ "Kevin Piche",
+ "Kevin Vandersloot",
+ "Khasim Shaheed",
+ "Kidd Wang",
+ "Kjartan Maraas",
+ "Krishnan R",
+ "Krisztian Pifko",
+ "Kyle Ambroff",
+ "Larry Ewing",
+ "Laszlo (Laca) Peter",
+ "Laurent Dhima",
+ "Lauris Kaplinski",
+ "Leon Zhang",
+ "Li Yuan",
+ "Loïc Minier",
+ "Loïc Minier",
+ "Lorenzo Gil Sanchez",
+ "Luca Ferretti",
+ "Lucky Wankhede",
+ "Luis Villa",
+ "Lutz M",
+ "M Victor Aloysius J",
+ "Maciej Stachowiak",
+ "Makuchaku",
+ "Malcolm Tredinnick",
+ "Marco Pesenti Gritti",
+ "Marius Andreiana",
+ "Marius Vollmer",
+ "Mark Crichton",
+ "Mark G. Adams",
+ "Mark Gordon",
+ "Mark McLoughlin",
+ "Mark Moulder",
+ "Mark Tearle",
+ "Martha Burke",
+ "Martin Baulig",
+ "Martin Hicks",
+ "Martin Meyer",
+ "Martin Norb\xC3\xA4" "ck",
+ "Martyn Russell",
+ "Masahiro Sakai",
+ "Mathieu Lacage",
+ "Matias Mutchinick",
+ "Matt Bissiri",
+ "Matt Brown",
+ "Matt Loper",
+ "Matt Martin",
+ "Matt Wilson",
+ "Matthew Barnes",
+ "Matthew Daniel",
+ "Matthew Hall",
+ "Matthew Loper",
+ "Matthew Wilson",
+ "Matthias Clasen",
+ "Max Horn",
+ "Maxx Cao",
+ "Mayank Jain",
+ "Meilof Veeningen",
+ "Mengjie Yu",
+ "Michael Granger",
+ "Michael M. Morrison",
+ "Michael MacDonald",
+ "Michael Meeks",
+ "Michael Monreal",
+ "Michael Terry",
+ "Michael Zucchi",
+ "Michel Daenzer",
+ "Miguel Angel Lopez Hernandez",
+ "Miguel de Icaza",
+ "Mikael Hallendal",
+ "Mikael Nilsson",
+ "Mike Castle",
+ "Mike Kestner",
+ "Mike McEwan",
+ "Mikhail Zabaluev",
+ "Milan Crha",
+ "Miles Lane",
+ "Mohammad Damt",
+ "Morten Welinder",
+ "Mubeen Jukaku",
+ "Murray Cumming",
+ "Naba Kumar",
+ "Nagappan Alagappan",
+ "Nancy Cai",
+ "Nat Friedman",
+ "Nathan Owens",
+ "Nicel KM",
+ "Nicholas J Kreucher",
+ "Nicholas Miell",
+ "Nick Sukharev",
+ "Nickolay V. Shmyrev",
+ "Nike Gerdts",
+ "Noel",
+ "Nuno Ferreira",
+ "Nyall Dawson",
+ "Ondrej Jirman",
+ "Oswald Rodrigues",
+ "Owen Taylor",
+ "Oystein Gisnas",
+ "P Chenthill",
+ "P S Chakravarthi",
+ "Pablo Gonzalo del Campo",
+ "Pablo Saratxaga",
+ "Pamplona Hackers",
+ "Paolo Molaro",
+ "Parag Goel",
+ "Parthasarathi Susarla",
+ "Pascal Terjan",
+ "Patrick Ohly",
+ "Paul Bolle",
+ "Paul Lindner",
+ "Pavel Cisler",
+ "Pavel Roskin",
+ "Pavithran",
+ "Pawan Chitrakar",
+ "Pedro Villavicencio",
+ "Peter Pouliot",
+ "Peter Teichman",
+ "Peter Williams",
+ "Peteris Krisjanis",
+ "Petta Pietikainen",
+ "Phil Goembel",
+ "Philip Van Hoof",
+ "Philip Zhao",
+ "Poornima Nayak",
+ "Pratik V. Parikh",
+ "Praveen Kumar",
+ "Priit Laes",
+ "Priyanshu Raj",
+ "Radek Doul\xC3\xADk",
+ "Raghavendran R",
+ "Raja R Harinath",
+ "Rajeev Ramanathan",
+ "Rajesh Ranjan",
+ "Rakesh k.g",
+ "Ramiro Estrugo",
+ "Ranjan Somani",
+ "Ray Strode",
+ "Rhys Jones",
+ "Ricardo Markiewicz",
+ "Richard Boulton",
+ "Richard Hult",
+ "Richard Li",
+ "Rob Bradford",
+ "Robert Brady",
+ "Robert Sedak",
+ "Robin Slomkowski",
+ "Rodney Dawes",
+ "Rodrigo Moya",
+ "Rohini S",
+ "Rohini",
+ "Roland Illig",
+ "Ronald Kuetemeier",
+ "Roozbeh Pournader",
+ "Ross Burton",
+ "Rouslan Solomakhin",
+ "Runa Bhattacharjee",
+ "Russell Steinthal",
+ "Rusty Conover",
+ "Ryan P. Skadberg",
+ "S Antony Vincent Pandian",
+ "S N Tejasvi",
+ "S. \xC3\x87" "a\xC4\x9F" "lar Onur",
+ "S.Antony Vincent Pandian",
+ "S. Caglar Onur",
+ "Sam Creasey",
+ "Sam Yang",
+ "Sam\xC3\xBA" "el J\xC3\xB3" "n Gunnarsson",
+ "Sankar P",
+ "Sanlig Badral",
+ "Sanshao Jiang",
+ "Sarfraaz Ahmed",
+ "Sayamindu Dasgupta",
+ "Sean Atkinson",
+ "Sean Gao",
+ "Sebastian Rittau",
+ "Sebastian Wilhelmi",
+ "Sebastien Bacher",
+ "Sergey Panov",
+ "Seth Alves",
+ "Seth Nickell",
+ "Shakti Sen",
+ "Shi Pu",
+ "Shilpa C",
+ "Shree Krishnan",
+ "Shreyas Srinivasan",
+ "Simon Zheng",
+ "Simos Xenitellis",
+ "Sivaiah Nallagatla",
+ "Srinivasa Ragavan",
+ "Stanislav Brabec",
+ "Stanislav Visnovsky",
+ "Stéphane Raimbault",
+ "Stephen Cook",
+ "Steve Murphy",
+ "Steven Zhang",
+ "Stuart Parmenter",
+ "Subodh Soni",
+ "Suman Manjunath",
+ "Sunil Mohan Adapa",
+ "Suresh Chandrasekharan",
+ "Sushma Rai",
+ "Sven Herzberg",
+ "Szabolcs Ban",
+ "T\xC3\xB5" "ivo Leedj\xC3\xA4" "rv",
+ "Takao Fujiwara",
+ "Takayuki Kusano",
+ "Takeshi Aihana",
+ "Tambet Ingo",
+ "Taylor Hayward",
+ "Ted Percival",
+ "Theppitak Karoonboonyanan",
+ "Thomas Cataldo",
+ "Thomas Klausner",
+ "Thomas Mirlacher",
+ "Thouis R. Jones",
+ "Tim Wo",
+ "Tim Yamin",
+ "Timo Hoenig",
+ "Timo Sirainen",
+ "Timothy Lee",
+ "Timur Bakeyev",
+ "Tino Meinen",
+ "Tobias Mueller",
+ "Tõivo Leedjärv",
+ "Tom Tromey",
+ "Tomas Ogren",
+ "Tomasz K\xC5\x82" "oczko",
+ "Tomislav Vujec",
+ "Tommi Komulainen",
+ "Tommi Vainikainen",
+ "Tony Tsui",
+ "Tor Lillqvist",
+ "Trent Lloyd",
+ "Tuomas J. Lukka",
+ "Tuomas Kuosmanen",
+ "Ulrich Neumann",
+ "Umesh Tiwari",
+ "Umeshtej",
+ "Ushveen Kaur",
+ "V Ravi Kumar Raju",
+ "Vadim Strizhevsky",
+ "Valek Filippov",
+ "Vandana Shenoy .B",
+ "Vardhman Jain",
+ "Veerapuram Varadhan",
+ "Vincent Noel",
+ "Vincent van Adrighem",
+ "Viren",
+ "Vivek Jain",
+ "Vladimer Sichinava",
+ "Vladimir Vukicevic",
+ "Wadim Dziedzic",
+ "Wang Jian",
+ "Wang Xin",
+ "Wayne Davis",
+ "William Jon McCann",
+ "Wouter Bolsterlee",
+ "Xan Lopez",
+ "Xiurong Simon Zheng",
+ "Yanko Kaneti",
+ "Yi Jin",
+ "Yong Sun",
+ "Yu Mengjie",
+ "Yuedong Du",
+ "Yukihiro Nakai",
+ "Yuri Pankov",
+ "Yuri Syrota",
+ "Zach Frey",
+ "Zan Lynx",
+ "Zbigniew Chyla",
+ "\xC3\x98ystein Gisn\xC3\xA5s",
+ "\xC5\xBDygimantas Beru\xC4\x8Dka",
+ NULL
+};
+
+static const gchar *documenters[] = {
+ "Aaron Weber",
+ "Binika Preet",
+ "Dan Winship",
+ "David Trowbridge",
+ "Jessica Prabhakar",
+ "JP Rosevear",
+ "Radhika Nair",
+ NULL
+};
+
+/**
+ * E_SHELL_WINDOW_ACTION_ABOUT:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action displays the application's About dialog.
+ *
+ * Main menu item: Help -> About
+ **/
+static void
+action_about_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ gchar *translator_credits;
+
+ /* The translator-credits string is for translators to list
+ * per-language credits for translation, displayed in the
+ * about dialog. */
+ translator_credits = _("translator-credits");
+ if (strcmp (translator_credits, "translator-credits") == 0)
+ translator_credits = NULL;
+
+ gtk_show_about_dialog (
+ GTK_WINDOW (shell_window),
+ "program-name", "Evolution",
+ "version", VERSION,
+ "copyright", EVOLUTION_COPYRIGHT,
+ "comments", _("Groupware Suite"),
+ "website", EVOLUTION_WEBSITE,
+ "website-label", _("Evolution Website"),
+ "authors", authors,
+ "documenters", documenters,
+ "translator-credits", translator_credits,
+ "logo-icon-name", "evolution",
+ NULL);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_CLOSE:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action closes @window. If this is the last window,
+ * the application initiates shutdown.
+ *
+ * Main menu item: File -> Close
+ **/
+static void
+action_close_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ GtkWidget *widget = GTK_WIDGET (shell_window);
+ GdkEvent *event;
+
+ /* Synthesize a delete_event on this window. */
+ event = gdk_event_new (GDK_DELETE);
+ event->any.window = g_object_ref (widget->window);
+ event->any.send_event = TRUE;
+ gtk_main_do_event (event);
+ gdk_event_free (event);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_CONTENTS:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action opens the application's user manual.
+ *
+ * Main menu item: Help -> Contents
+ **/
+static void
+action_contents_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ e_display_help (GTK_WINDOW (shell_window), NULL);
+}
+
+static void
+action_custom_rule_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ FilterRule *rule;
+ EShellView *shell_view;
+ EShellContent *shell_content;
+ const gchar *view_name;
+
+ rule = g_object_get_data (G_OBJECT (action), "rule");
+ g_return_if_fail (rule != NULL);
+
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ rule = g_object_get_data (G_OBJECT (action), "rule");
+ g_return_if_fail (IS_FILTER_RULE (rule));
+
+ e_shell_content_set_search_rule (shell_content, rule);
+ gtk_action_activate (ACTION (SEARCH_EXECUTE));
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_FAQ:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action opens a web page with answers to frequently
+ * asked questions about this application.
+ *
+ * Main menu item: Help -> Evolution FAQ
+ **/
+static void
+action_faq_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ e_show_uri (GTK_WINDOW (shell_window), EVOLUTION_FAQ);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_FORGET_PASSWORDS:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action deletes all stored passwords.
+ *
+ * Main menu item: File -> Forget Passwords
+ **/
+static void
+action_forget_passwords_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ gint response;
+
+ response = e_error_run (
+ GTK_WINDOW (shell_window), "shell:forget-passwords", NULL);
+
+ if (response == GTK_RESPONSE_OK)
+ e_passwords_forget_passwords ();
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_GAL_DEFINE_VIEWS:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action opens a dialog for editing GAL views for
+ * the current shell view.
+ *
+ * Main menu item: View -> Current View -> Define Views...
+ **/
+static void
+action_gal_define_views_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShellView *shell_view;
+ EShellViewClass *shell_view_class;
+ GalViewCollection *view_collection;
+ GtkWidget *dialog;
+ const gchar *view_name;
+
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ view_collection = shell_view_class->view_collection;
+ g_return_if_fail (view_collection != NULL);
+
+ dialog = gal_define_views_dialog_new (view_collection);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gal_view_collection_save (view_collection);
+ gtk_widget_destroy (dialog);
+
+ e_shell_window_update_view_menu (shell_window);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_GAL_CUSTOM_VIEW:
+ * @window: an #EShellWindow
+ *
+ * This radio action is selected when using a custom GAL view that has
+ * not been saved.
+ *
+ * Main menu item: View -> Current View -> Custom View
+ **/
+static void
+action_gal_view_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EShellWindow *shell_window)
+{
+ EShellView *shell_view;
+ const gchar *view_name;
+ const gchar *view_id;
+
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ view_id = g_object_get_data (G_OBJECT (current), "view-id");
+ e_shell_view_set_view_id (shell_view, view_id);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_GAL_SAVE_CUSTOM_VIEW:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action saves a custom GAL view.
+ *
+ * Main menu item: View -> Current View -> Save Custom View...
+ **/
+
+/**
+ * E_SHELL_WINDOW_ACTION_IMPORT:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action opens the Evolution Import Assistant.
+ *
+ * Main menu item: File -> Import...
+ **/
+static void
+action_import_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ e_shell_importer_start_import (shell_window);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_NEW_WINDOW:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action opens a new shell window.
+ *
+ * Main menu item: File -> New Window
+ **/
+static void
+action_new_window_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShell *shell;
+ const gchar *view_name;
+
+ shell = e_shell_window_get_shell (shell_window);
+ view_name = e_shell_window_get_active_view (shell_window);
+
+ e_shell_create_shell_window (shell, view_name);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_PAGE_SETUP:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action opens the application's Page Setup dialog.
+ *
+ * Main menu item: File -> Page Setup...
+ **/
+static void
+action_page_setup_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ e_print_run_page_setup_dialog (GTK_WINDOW (shell_window));
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_PREFERENCES:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action opens the application's Preferences window.
+ *
+ * Main menu item: Edit -> Preferences
+ **/
+static void
+action_preferences_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShell *shell;
+ GtkWidget *preferences_window;
+
+ shell = e_shell_window_get_shell (shell_window);
+ preferences_window = e_shell_get_preferences_window (shell);
+
+ gtk_window_set_transient_for (
+ GTK_WINDOW (preferences_window),
+ GTK_WINDOW (shell_window));
+ gtk_window_set_position (
+ GTK_WINDOW (preferences_window),
+ GTK_WIN_POS_CENTER_ON_PARENT);
+ gtk_window_present (GTK_WINDOW (preferences_window));
+
+ /* FIXME Switch to a page appropriate for the current view. */
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_QUICK_REFERENCE:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action opens a printable table of useful shortcut
+ * keys for this application.
+ *
+ * Main menu item: Help -> Quick Reference
+ **/
+static void
+action_quick_reference_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ const gchar * const *language_names;
+
+ language_names = g_get_language_names ();
+ while (*language_names != NULL) {
+ const gchar *language = *language_names++;
+ gchar *filename;
+
+ /* This must be a valid language AND a language with
+ * no encoding suffix. The next language should have
+ * no encoding suffix. */
+ if (language == NULL || strchr (language, '.') != NULL)
+ continue;
+
+ filename = g_build_filename (
+ EVOLUTION_HELPDIR, "quickref",
+ language, "quickref.pdf", NULL);
+
+ if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ GFile *file;
+ gchar *uri;
+ GError *error = NULL;
+
+ file = g_file_new_for_path (filename);
+ uri = g_file_get_uri (file);
+
+ g_app_info_launch_default_for_uri (uri, NULL, &error);
+
+ if (error != NULL) {
+ /* FIXME Show an error dialog. */
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+
+ g_object_unref (file);
+ g_free (uri);
+ }
+
+ g_free (filename);
+ }
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_QUIT:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action initiates application shutdown.
+ *
+ * Main menu item: File -> Quit
+ **/
+static void
+action_quit_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShell *shell;
+
+ shell = e_shell_window_get_shell (shell_window);
+ e_shell_quit (shell);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SEARCH_ADVANCED:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action opens an Advanced Search dialog.
+ *
+ * Main menu item: Search -> Advanced Search...
+ **/
+static void
+action_search_advanced_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShellView *shell_view;
+ EShellContent *shell_content;
+ const gchar *view_name;
+
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ e_shell_content_run_advanced_search_dialog (shell_content);
+ e_shell_window_update_search_menu (shell_window);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SEARCH_CLEAR:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action clears the most recent search results.
+ *
+ * Main menu item: Search -> Clear
+ **/
+static void
+action_search_clear_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShellView *shell_view;
+ EShellContent *shell_content;
+ const gchar *view_name;
+
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ e_shell_content_set_search_rule (shell_content, NULL);
+ e_shell_content_set_search_text (shell_content, NULL);
+
+ gtk_action_activate (ACTION (SEARCH_EXECUTE));
+
+ e_shell_window_update_search_menu (shell_window);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SEARCH_EDIT:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action opens a dialog for editing saved searches.
+ *
+ * Main menu item: Search -> Edit Saved Searches...
+ **/
+static void
+action_search_edit_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShellView *shell_view;
+ EShellContent *shell_content;
+ const gchar *view_name;
+
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ e_shell_content_run_edit_searches_dialog (shell_content);
+ e_shell_window_update_search_menu (shell_window);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SEARCH_EXECUTE:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action executes the current search conditions.
+ *
+ * Main menu item: Search -> Find Now
+ **/
+
+/**
+ * E_SHELL_WINDOW_ACTION_SEARCH_OPTIONS:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action displays a menu of search options.
+ * This appears as a "find" icon in the window's search entry.
+ **/
+static void
+action_search_options_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShellView *shell_view;
+ EShellViewClass *shell_view_class;
+ const gchar *view_name;
+ const gchar *widget_path;
+
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+
+ widget_path = shell_view_class->search_options;
+ e_shell_view_show_popup_menu (shell_view, widget_path, NULL);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SEARCH_SAVE:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action saves the current search conditions.
+ *
+ * Main menu item: Search -> Save Search...
+ **/
+static void
+action_search_save_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShellView *shell_view;
+ EShellContent *shell_content;
+ const gchar *view_name;
+
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ e_shell_content_run_save_search_dialog (shell_content);
+ e_shell_window_update_search_menu (shell_window);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SEND_RECEIVE:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action opens the Send &amp; Receive Mail dialog.
+ *
+ * Main menu item: File -> Send / Receive
+ **/
+static void
+action_send_receive_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShell *shell;
+
+ shell = e_shell_window_get_shell (shell_window);
+ e_shell_send_receive (shell, GTK_WINDOW (shell_window));
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SHOW_SIDEBAR:
+ * @window: an #EShellWindow
+ *
+ * This toggle action controls whether the side bar is visible.
+ *
+ * Main menu item: View -> Layout -> Show Side Bar
+ **/
+static void
+action_show_sidebar_cb (GtkToggleAction *action,
+ EShellWindow *shell_window)
+{
+ GtkPaned *paned;
+ GtkWidget *widget;
+ gboolean active;
+
+ paned = GTK_PANED (shell_window->priv->content_pane);
+
+ widget = gtk_paned_get_child1 (paned);
+ active = gtk_toggle_action_get_active (action);
+ g_object_set (widget, "visible", active, NULL);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SHOW_STATUSBAR:
+ * @window: an #EShellWindow
+ *
+ * This toggle action controls whether the status bar is visible.
+ *
+ * Main menu item: View -> Layout -> Show Status Bar
+ **/
+static void
+action_show_statusbar_cb (GtkToggleAction *action,
+ EShellWindow *shell_window)
+{
+ GtkWidget *widget;
+ gboolean active;
+
+ widget = shell_window->priv->status_area;
+ active = gtk_toggle_action_get_active (action);
+ g_object_set (widget, "visible", active, NULL);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SHOW_SWITCHER:
+ * @window: an #EShellWindow
+ *
+ * This toggle action controls whether the switcher buttons are visible.
+ *
+ * Main menu item: View -> Switcher Appearance -> Show Buttons
+ **/
+static void
+action_show_switcher_cb (GtkToggleAction *action,
+ EShellWindow *shell_window)
+{
+ EShellSwitcher *switcher;
+ gboolean active;
+
+ switcher = E_SHELL_SWITCHER (shell_window->priv->switcher);
+ active = gtk_toggle_action_get_active (action);
+ e_shell_switcher_set_visible (switcher, active);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SHOW_TOOLBAR:
+ * @window: an #EShellWindow
+ *
+ * This toggle action controls whether the tool bar is visible.
+ *
+ * Main menu item: View -> Layout -> Show Tool Bar
+ **/
+static void
+action_show_toolbar_cb (GtkToggleAction *action,
+ EShellWindow *shell_window)
+{
+ GtkWidget *widget;
+ gboolean active;
+
+ widget = shell_window->priv->main_toolbar;
+ active = gtk_toggle_action_get_active (action);
+ g_object_set (widget, "visible", active, NULL);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SUBMIT_BUG:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action allows users to report a bug using
+ * Bug Buddy.
+ *
+ * Main menu item: Help -> Submit Bug Report
+ **/
+static void
+action_submit_bug_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ const gchar *command_line;
+ GError *error = NULL;
+
+ command_line = "bug-buddy --sm-disable --package=Evolution";
+
+ g_debug ("Spawning: %s", command_line);
+ g_spawn_command_line_async (command_line, &error);
+
+ if (error != NULL) {
+ const gchar *message;
+
+ if (error->code == G_SPAWN_ERROR_NOENT)
+ message = _("Bug Buddy is not installed.");
+ else
+ message = _("Bug Buddy could not be run.");
+ e_notice (shell_window, GTK_MESSAGE_ERROR, message);
+ g_error_free (error);
+ }
+}
+
+static void
+action_switcher_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EShellWindow *shell_window)
+{
+ const gchar *view_name;
+
+ view_name = g_object_get_data (G_OBJECT (current), "view-name");
+ e_shell_window_switch_to_view (shell_window, view_name);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_BOTH:
+ * @window: an #EShellWindow
+ *
+ * This radio action displays switcher buttons with icons and text.
+ *
+ * Main menu item: View -> Switcher Appearance -> Icons and Text
+ **/
+
+/**
+ * E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_ICONS:
+ * @window: an #EShellWindow
+ *
+ * This radio action displays switcher buttons with icons only.
+ *
+ * Main menu item: View -> Switcher Appearance -> Icons Only
+ **/
+
+/**
+ * E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_TEXT:
+ * @window: an #EShellWindow
+ *
+ * This radio action displays switcher buttons with text only.
+ *
+ * Main menu item: View -> Switcher Appearance -> Text Only
+ **/
+
+/**
+ * E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_USER:
+ * @window: an #EShellWindow
+ *
+ * This radio action displays switcher buttons according to the desktop
+ * toolbar setting.
+ *
+ * Main menu item: View -> Switcher Appearance -> Toolbar Style
+ **/
+static void
+action_switcher_style_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EShellWindow *shell_window)
+{
+ EShellSwitcher *switcher;
+ GtkToolbarStyle style;
+
+ switcher = E_SHELL_SWITCHER (shell_window->priv->switcher);
+ style = gtk_radio_action_get_current_value (action);
+
+ switch (style) {
+ case GTK_TOOLBAR_ICONS:
+ case GTK_TOOLBAR_TEXT:
+ case GTK_TOOLBAR_BOTH:
+ case GTK_TOOLBAR_BOTH_HORIZ:
+ e_shell_switcher_set_style (switcher, style);
+ break;
+
+ default:
+ e_shell_switcher_unset_style (switcher);
+ break;
+ }
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_SYNC_OPTIONS:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action opens the Gnome Pilot settings.
+ *
+ * Main menu item: Edit -> Synchronization Options...
+ **/
+static void
+action_sync_options_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ const gchar *command_line;
+ GError *error = NULL;
+
+ command_line = "gpilotd-control-applet";
+
+ g_debug ("Spawning: %s", command_line);
+ g_spawn_command_line_async (command_line, &error);
+
+ if (error != NULL) {
+ const gchar *message;
+
+ if (error->code == G_SPAWN_ERROR_NOENT)
+ message = _("GNOME Pilot is not installed.");
+ else
+ message = _("GNOME Pilot could not be run.");
+ e_notice (shell_window, GTK_MESSAGE_ERROR, message);
+ g_error_free (error);
+ }
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_WORK_OFFLINE:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action puts the application into offline mode.
+ *
+ * Main menu item: File -> Work Offline
+ **/
+static void
+action_work_offline_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShell *shell;
+
+ shell = e_shell_window_get_shell (shell_window);
+ e_shell_set_online (shell, FALSE);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_WORK_ONLINE:
+ * @window: an #EShellWindow
+ *
+ * Activation of this action puts the application into online mode.
+ *
+ * Main menu item: File -> Work Online
+ **/
+static void
+action_work_online_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EShell *shell;
+
+ shell = e_shell_window_get_shell (shell_window);
+ e_shell_set_online (shell, TRUE);
+}
+
+/**
+ * E_SHELL_WINDOW_ACTION_GROUP_CUSTOM_RULES:
+ * @window: an #EShellWindow
+ **/
+
+/**
+ * E_SHELL_WINDOW_ACTION_GROUP_GAL_VIEW:
+ * @window: an #EShellWindow
+ **/
+
+/**
+ * E_SHELL_WINDOW_ACTION_GROUP_NEW_ITEM:
+ * @window: an #EShellWindow
+ **/
+
+/**
+ * E_SHELL_WINDOW_ACTION_GROUP_NEW_SOURCE:
+ * @window: an #EShellWindow
+ **/
+
+/**
+ * E_SHELL_WINDOW_ACTION_GROUP_SHELL:
+ * @window: an #EShellWindow
+ **/
+
+/**
+ * E_SHELL_WINDOW_ACTION_GROUP_SWITCHER:
+ * @window: an #EShellWindow
+ **/
+
+static GtkActionEntry shell_entries[] = {
+
+ { "about",
+ GTK_STOCK_ABOUT,
+ NULL,
+ NULL,
+ N_("Show information about Evolution"),
+ G_CALLBACK (action_about_cb) },
+
+ { "close",
+ GTK_STOCK_CLOSE,
+ N_("_Close Window"),
+ "<Control>w",
+ N_("Close this window"),
+ G_CALLBACK (action_close_cb) },
+
+ { "contents",
+ GTK_STOCK_HELP,
+ N_("_Contents"),
+ "F1",
+ N_("Open the Evolution User Guide"),
+ G_CALLBACK (action_contents_cb) },
+
+ { "faq",
+ "help-faq",
+ N_("Evolution _FAQ"),
+ NULL,
+ N_("Open the Frequently Asked Questions webpage"),
+ G_CALLBACK (action_faq_cb) },
+
+ { "forget-passwords",
+ NULL,
+ N_("_Forget Passwords"),
+ NULL,
+ N_("Forget all remembered passwords"),
+ G_CALLBACK (action_forget_passwords_cb) },
+
+ { "import",
+ "stock_mail-import",
+ N_("I_mport..."),
+ NULL,
+ N_("Import data from other programs"),
+ G_CALLBACK (action_import_cb) },
+
+ { "new-window",
+ "window-new",
+ N_("New _Window"),
+ "<Control><Shift>w",
+ N_("Create a new window displaying this view"),
+ G_CALLBACK (action_new_window_cb) },
+
+ { "preferences",
+ GTK_STOCK_PREFERENCES,
+ NULL,
+ "<Control><Shift>s",
+ N_("Configure Evolution"),
+ G_CALLBACK (action_preferences_cb) },
+
+ { "quick-reference",
+ NULL,
+ N_("_Quick Reference"),
+ NULL,
+ N_("Show Evolution's shortcut keys"),
+ G_CALLBACK (action_quick_reference_cb) },
+
+ { "quit",
+ GTK_STOCK_QUIT,
+ NULL,
+ NULL,
+ N_("Exit the program"),
+ G_CALLBACK (action_quit_cb) },
+
+ { "search-advanced",
+ NULL,
+ N_("_Advanced Search..."),
+ NULL,
+ N_("Construct a more advanced search"),
+ G_CALLBACK (action_search_advanced_cb) },
+
+ { "search-clear",
+ GTK_STOCK_CLEAR,
+ NULL,
+ "<Control><Shift>q",
+ N_("Clear the current search parameters"),
+ G_CALLBACK (action_search_clear_cb) },
+
+ { "search-edit",
+ NULL,
+ N_("_Edit Saved Searches..."),
+ NULL,
+ N_("Manage your saved searches"),
+ G_CALLBACK (action_search_edit_cb) },
+
+ { "search-execute",
+ GTK_STOCK_FIND,
+ N_("_Find Now"),
+ "", /* Block the default Ctrl+F. */
+ N_("Execute the current search parameters"),
+ NULL }, /* Handled by EShellContent and subclasses. */
+
+ { "search-options",
+ GTK_STOCK_FIND,
+ NULL,
+ NULL,
+ N_("Click here to change the search type"),
+ G_CALLBACK (action_search_options_cb) },
+
+ { "search-save",
+ NULL,
+ N_("_Save Search..."),
+ NULL,
+ N_("Save the current search parameters"),
+ G_CALLBACK (action_search_save_cb) },
+
+ { "send-receive",
+ "mail-send-receive",
+ N_("Send / _Receive"),
+ "F9",
+ N_("Send queued items and retrieve new items"),
+ G_CALLBACK (action_send_receive_cb) },
+
+ { "submit-bug",
+ NULL,
+ N_("Submit _Bug Report"),
+ NULL,
+ N_("Submit a bug report using Bug Buddy"),
+ G_CALLBACK (action_submit_bug_cb) },
+
+ { "sync-options",
+ NULL,
+ N_("_Synchronization Options..."),
+ NULL,
+ N_("Set up Pilot configuration"),
+ G_CALLBACK (action_sync_options_cb) },
+
+ { "work-offline",
+ "stock_disconnect",
+ N_("_Work Offline"),
+ NULL,
+ N_("Put Evolution into offline mode"),
+ G_CALLBACK (action_work_offline_cb) },
+
+ { "work-online",
+ "stock_connect",
+ N_("_Work Online"),
+ NULL,
+ N_("Put Evolution into online mode"),
+ G_CALLBACK (action_work_online_cb) },
+
+ /*** Menus ***/
+
+ { "edit-menu",
+ NULL,
+ N_("_Edit"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "file-menu",
+ NULL,
+ N_("_File"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "help-menu",
+ NULL,
+ N_("_Help"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "layout-menu",
+ NULL,
+ N_("Lay_out"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "new-menu",
+ GTK_STOCK_NEW,
+ N_("_New"),
+ "",
+ NULL,
+ NULL },
+
+ { "search-menu",
+ NULL,
+ N_("_Search"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "switcher-menu",
+ NULL,
+ N_("_Switcher Appearance"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "view-menu",
+ NULL,
+ N_("_View"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "window-menu",
+ NULL,
+ N_("_Window"),
+ NULL,
+ NULL,
+ NULL }
+};
+
+static GtkToggleActionEntry shell_toggle_entries[] = {
+
+ { "show-sidebar",
+ NULL,
+ N_("Show Side _Bar"),
+ NULL,
+ N_("Show the side bar"),
+ G_CALLBACK (action_show_sidebar_cb),
+ TRUE },
+
+ { "show-statusbar",
+ NULL,
+ N_("Show _Status Bar"),
+ NULL,
+ N_("Show the status bar"),
+ G_CALLBACK (action_show_statusbar_cb),
+ TRUE },
+
+ { "show-switcher",
+ NULL,
+ N_("Show _Buttons"),
+ NULL,
+ N_("Show the switcher buttons"),
+ G_CALLBACK (action_show_switcher_cb),
+ TRUE },
+
+ { "show-toolbar",
+ NULL,
+ N_("Show _Tool Bar"),
+ NULL,
+ N_("Show the toolbar"),
+ G_CALLBACK (action_show_toolbar_cb),
+ TRUE }
+};
+
+static GtkRadioActionEntry shell_switcher_entries[] = {
+
+ /* This action represents the initial active shell view.
+ * It should not be visible in the UI, nor should it be
+ * possible to switch to it from another shell view. */
+ { "switcher-initial",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ -1 }
+};
+
+static GtkRadioActionEntry shell_switcher_style_entries[] = {
+
+ { "switcher-style-icons",
+ NULL,
+ N_("_Icons Only"),
+ NULL,
+ N_("Display window buttons with icons only"),
+ GTK_TOOLBAR_ICONS },
+
+ { "switcher-style-text",
+ NULL,
+ N_("_Text Only"),
+ NULL,
+ N_("Display window buttons with text only"),
+ GTK_TOOLBAR_TEXT },
+
+ { "switcher-style-both",
+ NULL,
+ N_("Icons _and Text"),
+ NULL,
+ N_("Display window buttons with icons and text"),
+ GTK_TOOLBAR_BOTH_HORIZ },
+
+ { "switcher-style-user",
+ NULL,
+ N_("Tool_bar Style"),
+ NULL,
+ N_("Display window buttons using the desktop toolbar setting"),
+ -1 }
+};
+
+static GtkActionEntry shell_gal_view_entries[] = {
+
+ { "gal-define-views",
+ NULL,
+ N_("Define Views..."),
+ NULL,
+ N_("Create or edit views"),
+ G_CALLBACK (action_gal_define_views_cb) },
+
+ { "gal-save-custom-view",
+ NULL,
+ N_("Save Custom View..."),
+ NULL,
+ N_("Save current custom view"),
+ NULL }, /* Handled by subclasses. */
+
+ /*** Menus ***/
+
+ { "gal-view-menu",
+ NULL,
+ N_("C_urrent View"),
+ NULL,
+ NULL,
+ NULL }
+};
+
+static GtkRadioActionEntry shell_gal_view_radio_entries[] = {
+
+ { "gal-custom-view",
+ NULL,
+ N_("Custom View"),
+ NULL,
+ N_("Current view is a customized view"),
+ -1 }
+};
+
+static GtkActionEntry shell_lockdown_print_setup_entries[] = {
+
+ { "page-setup",
+ GTK_STOCK_PAGE_SETUP,
+ NULL,
+ NULL,
+ N_("Change the page settings for your current printer"),
+ G_CALLBACK (action_page_setup_cb) }
+};
+
+static void
+shell_window_extract_actions (EShellWindow *shell_window,
+ GList **source_list,
+ GList **destination_list)
+{
+ const gchar *current_view;
+ GList *match_list = NULL;
+ GList *iter;
+
+ /* Pick out the actions from the source list that are tagged
+ * as belonging to the current EShellView and move them to the
+ * destination list. */
+
+ current_view = e_shell_window_get_active_view (shell_window);
+
+ /* Example: Suppose [A] and [C] are tagged for this EShellView.
+ *
+ * source_list = [A] -> [B] -> [C]
+ * ^ ^
+ * | |
+ * match_list = [ ] --------> [ ]
+ *
+ *
+ * destination_list = [1] -> [2] (other actions)
+ */
+ for (iter = *source_list; iter != NULL; iter = iter->next) {
+ GtkAction *action = iter->data;
+ const gchar *backend_name;
+
+ backend_name = g_object_get_data (
+ G_OBJECT (action), "backend-name");
+
+ if (strcmp (backend_name, current_view) != 0)
+ continue;
+
+ if (g_object_get_data (G_OBJECT (action), "primary"))
+ match_list = g_list_prepend (match_list, iter);
+ else
+ match_list = g_list_append (match_list, iter);
+ }
+
+ /* source_list = [B] match_list = [A] -> [C] */
+ for (iter = match_list; iter != NULL; iter = iter->next) {
+ GList *link = iter->data;
+
+ iter->data = link->data;
+ *source_list = g_list_delete_link (*source_list, link);
+ }
+
+ /* destination_list = [1] -> [2] -> [A] -> [C] */
+ *destination_list = g_list_concat (*destination_list, match_list);
+}
+
+void
+e_shell_window_actions_init (EShellWindow *shell_window)
+{
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+
+ e_load_ui_definition (ui_manager, "evolution-shell.ui");
+
+ /* Shell Actions */
+ action_group = ACTION_GROUP (SHELL);
+ gtk_action_group_add_actions (
+ action_group, shell_entries,
+ G_N_ELEMENTS (shell_entries), shell_window);
+ gtk_action_group_add_toggle_actions (
+ action_group, shell_toggle_entries,
+ G_N_ELEMENTS (shell_toggle_entries), shell_window);
+ gtk_action_group_add_radio_actions (
+ action_group, shell_switcher_style_entries,
+ G_N_ELEMENTS (shell_switcher_style_entries),
+ E_SHELL_SWITCHER_DEFAULT_TOOLBAR_STYLE,
+ G_CALLBACK (action_switcher_style_cb), shell_window);
+ gtk_action_group_add_actions (
+ action_group, shell_gal_view_entries,
+ G_N_ELEMENTS (shell_gal_view_entries), shell_window);
+ gtk_action_group_add_radio_actions (
+ action_group, shell_gal_view_radio_entries,
+ G_N_ELEMENTS (shell_gal_view_radio_entries),
+ 0, G_CALLBACK (action_gal_view_cb), shell_window);
+
+ /* Switcher Actions */
+ action_group = ACTION_GROUP (SWITCHER);
+ gtk_action_group_add_radio_actions (
+ action_group, shell_switcher_entries,
+ G_N_ELEMENTS (shell_switcher_entries),
+ -1, G_CALLBACK (action_switcher_cb), shell_window);
+
+ /* Lockdown Print Setup Actions */
+ action_group = ACTION_GROUP (LOCKDOWN_PRINT_SETUP);
+ gtk_action_group_add_actions (
+ action_group, shell_lockdown_print_setup_entries,
+ G_N_ELEMENTS (shell_lockdown_print_setup_entries),
+ shell_window);
+
+ /* Fine tuning. */
+
+ g_object_set (ACTION (SEND_RECEIVE), "is-important", TRUE, NULL);
+}
+
+GtkWidget *
+e_shell_window_create_new_menu (EShellWindow *shell_window)
+{
+ GtkActionGroup *action_group;
+ GList *new_item_actions;
+ GList *new_source_actions;
+ GList *iter, *list = NULL;
+ GtkWidget *menu;
+ GtkWidget *separator;
+
+ /* Get sorted lists of "new item" and "new source" actions. */
+
+ action_group = ACTION_GROUP (NEW_ITEM);
+
+ new_item_actions = g_list_sort (
+ gtk_action_group_list_actions (action_group),
+ (GCompareFunc) e_action_compare_by_label);
+
+ action_group = ACTION_GROUP (NEW_SOURCE);
+
+ new_source_actions = g_list_sort (
+ gtk_action_group_list_actions (action_group),
+ (GCompareFunc) e_action_compare_by_label);
+
+ /* Give priority to actions that belong to this shell view. */
+
+ shell_window_extract_actions (
+ shell_window, &new_item_actions, &list);
+
+ shell_window_extract_actions (
+ shell_window, &new_source_actions, &list);
+
+ /* Convert the actions to menu item proxy widgets. */
+
+ for (iter = list; iter != NULL; iter = iter->next)
+ iter->data = gtk_action_create_menu_item (iter->data);
+
+ for (iter = new_item_actions; iter != NULL; iter = iter->next)
+ iter->data = gtk_action_create_menu_item (iter->data);
+
+ for (iter = new_source_actions; iter != NULL; iter = iter->next)
+ iter->data = gtk_action_create_menu_item (iter->data);
+
+ /* Add menu separators. */
+
+ separator = gtk_separator_menu_item_new ();
+ new_item_actions = g_list_prepend (new_item_actions, separator);
+ gtk_widget_show (GTK_WIDGET (separator));
+
+ separator = gtk_separator_menu_item_new ();
+ new_source_actions = g_list_prepend (new_source_actions, separator);
+ gtk_widget_show (GTK_WIDGET (separator));
+
+ /* Merge everything into one list, reflecting the menu layout. */
+
+ list = g_list_concat (list, new_item_actions);
+ new_item_actions = NULL; /* just for clarity */
+
+ list = g_list_concat (list, new_source_actions);
+ new_source_actions = NULL; /* just for clarity */
+
+ /* And finally, build the menu. */
+
+ menu = gtk_menu_new ();
+
+ for (iter = list; iter != NULL; iter = iter->next)
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), iter->data);
+
+ g_list_free (list);
+
+ return menu;
+}
+
+void
+e_shell_window_create_switcher_actions (EShellWindow *shell_window)
+{
+ GSList *group = NULL;
+ GtkRadioAction *action;
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+ EShellSwitcher *switcher;
+ EShell *shell;
+ GList *list, *iter;
+ guint merge_id;
+ guint ii = 0;
+
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+
+ action_group = ACTION_GROUP (SWITCHER);
+ switcher = E_SHELL_SWITCHER (shell_window->priv->switcher);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ shell = e_shell_window_get_shell (shell_window);
+ list = e_shell_get_shell_backends (shell);
+
+ /* Construct a group of radio actions from the various EShellView
+ * subclasses and register them with the EShellSwitcher. These
+ * actions are manifested as switcher buttons and View->Window
+ * menu items. */
+
+ action = GTK_RADIO_ACTION (ACTION (SWITCHER_INITIAL));
+ gtk_radio_action_set_group (action, group);
+ group = gtk_radio_action_get_group (action);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ EShellBackend *shell_backend = iter->data;
+ EShellBackendClass *backend_class;
+ EShellViewClass *class;
+ GType view_type;
+ const gchar *view_name;
+ gchar *accelerator;
+ gchar *action_name;
+ gchar *tooltip;
+
+ /* The backend name is also the view name. */
+ backend_class = E_SHELL_BACKEND_GET_CLASS (shell_backend);
+ view_type = backend_class->shell_view_type;
+ view_name = backend_class->name;
+
+ if (!g_type_is_a (view_type, E_TYPE_SHELL_VIEW)) {
+ g_critical (
+ "%s is not a subclass of %s",
+ g_type_name (view_type),
+ g_type_name (E_TYPE_SHELL_VIEW));
+ continue;
+ }
+
+ class = g_type_class_ref (view_type);
+
+ if (class->label == NULL) {
+ g_critical (
+ "Label member not set on %s",
+ G_OBJECT_CLASS_NAME (class));
+ continue;
+ }
+
+ action_name = g_strdup_printf (SWITCHER_FORMAT, view_name);
+ tooltip = g_strdup_printf (_("Switch to %s"), class->label);
+
+ /* Note, we have to set "icon-name" separately because
+ * gtk_radio_action_new() expects a "stock-id". Sadly,
+ * GTK+ still distinguishes between the two. */
+
+ action = gtk_radio_action_new (
+ action_name, class->label,
+ tooltip, NULL, ii++);
+
+ g_object_set (
+ G_OBJECT (action),
+ "icon-name", class->icon_name, NULL);
+
+ g_object_set_data (
+ G_OBJECT (action),
+ "view-name", (gpointer) view_name);
+
+ gtk_radio_action_set_group (action, group);
+ group = gtk_radio_action_get_group (action);
+
+ /* The first nine views have accelerators Ctrl+(1-9). */
+ if (ii < 10)
+ accelerator = g_strdup_printf ("<Control>%d", ii);
+ else
+ accelerator = g_strdup ("");
+
+ gtk_action_group_add_action_with_accel (
+ action_group, GTK_ACTION (action), accelerator);
+
+ e_shell_switcher_add_action (switcher, GTK_ACTION (action));
+
+ gtk_ui_manager_add_ui (
+ ui_manager, merge_id,
+ "/main-menu/view-menu/window-menu",
+ action_name, action_name,
+ GTK_UI_MANAGER_AUTO, FALSE);
+
+ g_free (accelerator);
+ g_free (action_name);
+ g_free (tooltip);
+
+ g_type_class_unref (class);
+ }
+}
+
+void
+e_shell_window_update_view_menu (EShellWindow *shell_window)
+{
+ EShellView *shell_view;
+ EShellViewClass *shell_view_class;
+ GtkUIManager *ui_manager;
+ GtkActionGroup *action_group;
+ GalViewCollection *view_collection;
+ GtkRadioAction *radio_action;
+ GtkAction *action;
+ GSList *radio_group;
+ gboolean visible;
+ const gchar *path;
+ const gchar *view_id;
+ const gchar *view_name;
+ guint merge_id;
+ gint count, ii;
+
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ g_return_if_fail (shell_view != NULL);
+
+ shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ view_collection = shell_view_class->view_collection;
+ view_id = e_shell_view_get_view_id (shell_view);
+ g_return_if_fail (view_collection != NULL);
+
+ action_group = ACTION_GROUP (GAL_VIEW);
+ merge_id = shell_window->priv->gal_view_merge_id;
+
+ /* Unmerge the previous menu. */
+ gtk_ui_manager_remove_ui (ui_manager, merge_id);
+ e_action_group_remove_all_actions (action_group);
+
+ /* We have a view ID, so forge ahead. */
+ count = gal_view_collection_get_count (view_collection);
+ path = "/main-menu/view-menu/gal-view-menu/gal-view-list";
+
+ /* Prevent spurious activations. */
+ action = ACTION (GAL_CUSTOM_VIEW);
+ g_signal_handlers_block_matched (
+ action, G_SIGNAL_MATCH_FUNC, 0, 0,
+ NULL, action_gal_view_cb, NULL);
+
+ /* Default to "Custom View", unless we find our view ID. */
+ radio_action = GTK_RADIO_ACTION (ACTION (GAL_CUSTOM_VIEW));
+ gtk_radio_action_set_group (radio_action, NULL);
+ radio_group = gtk_radio_action_get_group (radio_action);
+ gtk_radio_action_set_current_value (radio_action, -1);
+
+ /* Add a menu item for each view collection item. */
+ for (ii = 0; ii < count; ii++) {
+ GalViewCollectionItem *item;
+ gchar *action_name;
+ gchar *tooltip;
+
+ item = gal_view_collection_get_view_item (view_collection, ii);
+
+ action_name = g_strdup_printf (
+ "gal-view-%s-%d", view_name, ii);
+ tooltip = g_strdup_printf ("Select view: %s", item->title);
+
+ radio_action = gtk_radio_action_new (
+ action_name, item->title, tooltip, NULL, ii);
+
+ action = GTK_ACTION (radio_action);
+ gtk_radio_action_set_group (radio_action, radio_group);
+ radio_group = gtk_radio_action_get_group (radio_action);
+
+ g_object_set_data_full (
+ G_OBJECT (radio_action), "view-id",
+ g_strdup (item->id), (GDestroyNotify) g_free);
+
+ if (view_id != NULL && strcmp (item->id, view_id) == 0)
+ gtk_radio_action_set_current_value (radio_action, ii);
+
+ gtk_action_group_add_action (action_group, action);
+
+ gtk_ui_manager_add_ui (
+ ui_manager, merge_id, path, action_name,
+ action_name, GTK_UI_MANAGER_AUTO, FALSE);
+
+ g_free (action_name);
+ g_free (tooltip);
+ }
+
+ /* Doesn't matter which radio action we check. */
+ visible = (gtk_radio_action_get_current_value (radio_action) < 0);
+
+ action = ACTION (GAL_CUSTOM_VIEW);
+ gtk_action_set_visible (action, visible);
+ g_signal_handlers_unblock_matched (
+ action, G_SIGNAL_MATCH_FUNC, 0, 0,
+ NULL, action_gal_view_cb, NULL);
+
+ action = ACTION (GAL_SAVE_CUSTOM_VIEW);
+ gtk_action_set_visible (action, visible);
+}
+
+void
+e_shell_window_update_search_menu (EShellWindow *shell_window)
+{
+ EShellContent *shell_content;
+ EShellView *shell_view;
+ EShellViewClass *shell_view_class;
+ RuleContext *context;
+ FilterRule *rule;
+ GtkUIManager *ui_manager;
+ GtkActionGroup *action_group;
+ const gchar *source;
+ const gchar *view_name;
+ gboolean sensitive;
+ guint merge_id;
+ gint ii = 0;
+
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ context = e_shell_content_get_search_context (shell_content);
+ shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ source = FILTER_SOURCE_INCOMING;
+
+ /* Update sensitivity of search actions. */
+
+ sensitive = (e_shell_content_get_search_rule (shell_content) != NULL);
+ gtk_action_set_sensitive (ACTION (SEARCH_CLEAR), sensitive);
+ gtk_action_set_sensitive (ACTION (SEARCH_SAVE), sensitive);
+
+ sensitive = (shell_view_class->search_options != NULL);
+ gtk_action_set_sensitive (ACTION (SEARCH_OPTIONS), sensitive);
+
+ /* Add custom rules to the Search menu. */
+
+ action_group = ACTION_GROUP (CUSTOM_RULES);
+ merge_id = shell_window->priv->custom_rule_merge_id;
+
+ /* Unmerge the previous menu. */
+ gtk_ui_manager_remove_ui (ui_manager, merge_id);
+ e_action_group_remove_all_actions (action_group);
+
+ rule = rule_context_next_rule (context, NULL, source);
+ while (rule != NULL) {
+ GtkAction *action;
+ gchar *action_name;
+ gchar *action_label;
+
+ action_name = g_strdup_printf ("custom-rule-%d", ii++);
+ if (ii < 10)
+ action_label = g_strdup_printf (
+ "_%d. %s", ii, rule->name);
+ else
+ action_label = g_strdup (rule->name);
+
+ action = gtk_action_new (
+ action_name, action_label,
+ _("Execute these search parameters"), NULL);
+
+ g_object_set_data_full (
+ G_OBJECT (action),
+ "rule", g_object_ref (rule),
+ (GDestroyNotify) g_object_unref);
+
+ g_signal_connect (
+ action, "activate",
+ G_CALLBACK (action_custom_rule_cb), shell_window);
+
+ gtk_action_group_add_action (action_group, action);
+
+ gtk_ui_manager_add_ui (
+ ui_manager, merge_id,
+ "/main-menu/search-menu/custom-rules",
+ action_name, action_name,
+ GTK_UI_MANAGER_AUTO, FALSE);
+
+ g_free (action_name);
+ g_free (action_label);
+
+ rule = rule_context_next_rule (context, rule, source);
+ }
+}
diff --git a/shell/e-shell-window-actions.h b/shell/e-shell-window-actions.h
new file mode 100644
index 0000000000..3b8774a494
--- /dev/null
+++ b/shell/e-shell-window-actions.h
@@ -0,0 +1,123 @@
+/*
+ * e-shell-window-actions.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_SHELL_WINDOW_ACTIONS_H
+#define E_SHELL_WINDOW_ACTIONS_H
+
+#define E_SHELL_WINDOW_ACTION(window, name) \
+ (e_shell_window_get_action (E_SHELL_WINDOW (window), (name)))
+
+#define E_SHELL_WINDOW_ACTION_GROUP(window, name) \
+ (e_shell_window_get_action_group (E_SHELL_WINDOW (window), (name)))
+
+/* Actions */
+#define E_SHELL_WINDOW_ACTION_ABOUT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "about")
+#define E_SHELL_WINDOW_ACTION_CLOSE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "close")
+#define E_SHELL_WINDOW_ACTION_CONTENTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contents")
+#define E_SHELL_WINDOW_ACTION_FAQ(window) \
+ E_SHELL_WINDOW_ACTION ((window), "faq")
+#define E_SHELL_WINDOW_ACTION_FORGET_PASSWORDS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "forget-passwords")
+#define E_SHELL_WINDOW_ACTION_GAL_CUSTOM_VIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "gal-custom-view")
+#define E_SHELL_WINDOW_ACTION_GAL_DEFINE_VIEWS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "gal-define-views")
+#define E_SHELL_WINDOW_ACTION_GAL_SAVE_CUSTOM_VIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "gal-save-custom-view")
+#define E_SHELL_WINDOW_ACTION_IMPORT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "import")
+#define E_SHELL_WINDOW_ACTION_NEW_WINDOW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "new-window")
+#define E_SHELL_WINDOW_ACTION_PAGE_SETUP(window) \
+ E_SHELL_WINDOW_ACTION ((window), "page-setup")
+#define E_SHELL_WINDOW_ACTION_PREFERENCES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "preferences")
+#define E_SHELL_WINDOW_ACTION_QUICK_REFERENCE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "quick-reference")
+#define E_SHELL_WINDOW_ACTION_QUIT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "quit")
+#define E_SHELL_WINDOW_ACTION_SEARCH_ADVANCED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "search-advanced")
+#define E_SHELL_WINDOW_ACTION_SEARCH_CLEAR(window) \
+ E_SHELL_WINDOW_ACTION ((window), "search-clear")
+#define E_SHELL_WINDOW_ACTION_SEARCH_EDIT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "search-edit")
+#define E_SHELL_WINDOW_ACTION_SEARCH_EXECUTE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "search-execute")
+#define E_SHELL_WINDOW_ACTION_SEARCH_OPTIONS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "search-options")
+#define E_SHELL_WINDOW_ACTION_SEARCH_SAVE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "search-save")
+#define E_SHELL_WINDOW_ACTION_SEND_RECEIVE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "send-receive")
+#define E_SHELL_WINDOW_ACTION_SHOW_SIDEBAR(window) \
+ E_SHELL_WINDOW_ACTION ((window), "show-sidebar")
+#define E_SHELL_WINDOW_ACTION_SHOW_STATUSBAR(window) \
+ E_SHELL_WINDOW_ACTION ((window), "show-statusbar")
+#define E_SHELL_WINDOW_ACTION_SHOW_SWITCHER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "show-switcher")
+#define E_SHELL_WINDOW_ACTION_SHOW_TOOLBAR(window) \
+ E_SHELL_WINDOW_ACTION ((window), "show-toolbar")
+#define E_SHELL_WINDOW_ACTION_SUBMIT_BUG(window) \
+ E_SHELL_WINDOW_ACTION ((window), "submit-bug")
+#define E_SHELL_WINDOW_ACTION_SWITCHER_INITIAL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "switcher-initial")
+#define E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_BOTH(window) \
+ E_SHELL_WINDOW_ACTION ((window), "switcher-style-both")
+#define E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_ICONS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "switcher-style-icons")
+#define E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_TEXT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "switcher-style-text")
+#define E_SHELL_WINDOW_ACTION_SWITCHER_STYLE_USER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "switcher-style-user")
+#define E_SHELL_WINDOW_ACTION_SYNC_OPTIONS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "sync-options")
+#define E_SHELL_WINDOW_ACTION_WORK_OFFLINE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "work-offline")
+#define E_SHELL_WINDOW_ACTION_WORK_ONLINE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "work-online")
+
+/* Action Groups */
+#define E_SHELL_WINDOW_ACTION_GROUP_CUSTOM_RULES(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "custom-rules")
+#define E_SHELL_WINDOW_ACTION_GROUP_GAL_VIEW(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "gal-view")
+#define E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_APPLICATION_HANDLERS(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "lockdown-application-handlers")
+#define E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINTING(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "lockdown-printing")
+#define E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_PRINT_SETUP(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "lockdown-print-setup")
+#define E_SHELL_WINDOW_ACTION_GROUP_LOCKDOWN_SAVE_TO_DISK(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "lockdown-save-to-disk")
+#define E_SHELL_WINDOW_ACTION_GROUP_NEW_ITEM(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "new-item")
+#define E_SHELL_WINDOW_ACTION_GROUP_NEW_SOURCE(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "new-source")
+#define E_SHELL_WINDOW_ACTION_GROUP_SHELL(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "shell")
+#define E_SHELL_WINDOW_ACTION_GROUP_SWITCHER(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "switcher")
+
+#endif /* E_SHELL_WINDOW_ACTIONS_H */
diff --git a/shell/e-shell-window-commands.c b/shell/e-shell-window-commands.c
deleted file mode 100644
index 6f180012cb..0000000000
--- a/shell/e-shell-window-commands.c
+++ /dev/null
@@ -1,1393 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include <config.h>
-
-#include <string.h>
-
-#include <gtk/gtk.h>
-#include <glib/gprintf.h>
-
-#include <glib/gi18n.h>
-
-#include <gio/gio.h>
-
-#include <bonobo/bonobo-ui-component.h>
-
-#include <libedataserverui/e-passwords.h>
-
-#include <gconf/gconf-client.h>
-
-#include "e-util/e-dialog-utils.h"
-#include "e-util/e-error.h"
-#include "e-util/e-icon-factory.h"
-#include "e-util/e-print.h"
-#include "e-util/e-util.h"
-#include "e-util/e-util-private.h"
-
-#include "e-shell-window-commands.h"
-#include "e-shell-window.h"
-#include "evolution-shell-component-utils.h"
-
-#include "e-shell-importer.h"
-
-#define EVOLUTION_COPYRIGHT \
- "Copyright \xC2\xA9 1999 - 2009 Novell, Inc. and Others"
-
-#define EVOLUTION_WEBSITE \
- "http://www.gnome.org/projects/evolution/"
-
-/* Utility functions. */
-
-static void
-launch_pilot_settings (void)
-{
- GError* error = NULL;
-
- gchar* args = g_find_program_in_path ("gpilotd-control-applet");
- if (args == NULL) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
- _("The GNOME Pilot tools do not appear to be installed on this system."));
- return;
- }
-
- g_spawn_command_line_async (args, &error);
- g_free (args);
-
- if (error != NULL) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
- _("Error executing %s. (%s)"), args, error->message);
- g_error_free (error);
- }
-}
-
-
-/* Command callbacks. */
-
-static void
-command_import (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- e_shell_importer_start_import (window);
-}
-
-static void
-command_page_setup (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- e_print_run_page_setup_dialog (GTK_WINDOW (window));
-}
-
-static void
-command_close (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- if (e_shell_request_close_window (e_shell_window_peek_shell (window), window))
- gtk_widget_destroy (GTK_WIDGET (window));
-}
-
-static void
-command_quit (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- EShell *shell = e_shell_window_peek_shell (window);
-
- e_shell_quit(shell);
-}
-
-static void
-command_submit_bug (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- const gchar *command_line;
- GError *error = NULL;
-
- command_line = "bug-buddy --sm-disable --package=Evolution";
-
- g_debug ("Spawning: %s", command_line);
-
- if (!g_spawn_command_line_async (command_line, &error)) {
- if (error->code == G_SPAWN_ERROR_NOENT)
- e_notice (NULL, GTK_MESSAGE_ERROR,
- _("Bug buddy is not installed."));
- else
- e_notice (NULL, GTK_MESSAGE_ERROR,
- _("Bug buddy could not be run."));
- g_error_free (error);
- }
-}
-
-/* must be in utf8, the weird breaking of escaped strings
- is so the hex escape strings dont swallow too many chars
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- So that means, 8 bit characters, use \xXX hex encoding ONLY
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
- No all environments are utf8 and not all editors can handle it.
-*/
-static const char *authors[] = {
- "Aaron Weber",
- "Abel Cheung",
- "Abhishek Parwal",
- "Adam Weinberger",
- "Adi Attar",
- "Ahmad Riza H Nst",
- "Aidan Delaney",
- "Aishwarya K",
- "Akagic Amila",
- "Akhil Laddha",
- "Akira Tagoh",
- "Alastair McKinstry",
- "Alastair Tse",
- "Alejandro Andres",
- "Ales Nyakhaychyk",
- "Alessandro Decina",
- "Alessio Frusciante",
- "Alex Graveley",
- "Alex Jiang",
- "Alex Jones",
- "Alex Kloss",
- "Alex Rostovtsev",
- "Alexander Didebulidze",
- "Alexander Shopov",
- "Alexander Winston",
- "Alexandre Folle de Menezes",
- "Alfred Peng",
- "Ali Abdin",
- "Ali Akcaagac",
- "Alireza Kheirkhahan",
- "Almer S. Tigelaar",
- "Alp Toker",
- "Amanpreet Singh Alam",
- "Ambuj Chitranshi",
- "Amish",
- "Amitakhya Phukan",
- "Anand V M",
- "Anders Carlsson",
- "Andras Timar",
- "Andrea Campi",
- "Andreas Henriksson",
- "Andreas Hyden",
- "Andreas J. Guelzow",
- "Andreas Köhler",
- "Andrew Ruthven",
- "Andre Klapper",
- "Andrew T. Veliath",
- "Andrew V. Samoilov",
- "Andrew Wu",
- "Ani Peter",
- "Ankit Patel",
- "Anna Marie Dirks",
- "Antonio Xu",
- "Arafat Medini",
- "Arangel Angov",
- "Archit Baweja",
- "Ariel Rios",
- "Arik Devens",
- "Armin Bauer",
- "Arjan Scherpenisse",
- "Arkadiusz Lipiec",
- "Artis Trops",
- "Artur Flinta",
- "Arturo Espinosa Aldama",
- "Arulanandan P",
- "Arun Prakash",
- "Arvind Sundararajan",
- "Ashish Shrivastava",
- "Åsmund Skjæveland",
- "Audrey Simons",
- "Baptiste Mille-Mathias",
- "Baris Cicek",
- "Bastien Nocera",
- "Behnam Esfahbod",
- "Benedikt Roth",
- "Ben Gamari",
- "Benjamin Berg",
- "Benjamin Kahn",
- "Benoît Dejean",
- "Bernard Leach",
- "Bertrand Guiheneuf",
- "Bharath Acharya",
- "Bharat Kumar",
- "Bharathi Gauthaman",
- "Big Iain Holmes",
- "Bill Zhu",
- "Björn Torkelsson",
- "Björn Lindqvist",
- "Bob Doan",
- "Bob Mauchin",
- "Boby Wang",
- "Bolian Yin",
- "Borislav Aleksandrov",
- "Boulton",
- "Brian Mury",
- "Brian Pepple",
- "Brigitte Le Grand",
- "Bruce Tao",
- "B S Srinidhi",
- "Calvin Liu",
- "Cantona Su",
- "Carlos Garcia Campos",
- "Carlos Garnacho Parro",
- "Carlos Perelló Marín",
- "Carl Sun",
- "Carsten Guenther",
- "Carsten Schaar",
- "Changwoo Ryu",
- "Chao-Hsiung Liao",
- "Charles Zhang",
- "Chema Celorio",
- "Chenthill Palanisamy",
- "Christian Persch",
- "Chris Halls",
- "Chris Heath",
- "Chris Lahey",
- "Christian Hammond",
- "Christian Kellner",
- "Christian Kintner",
- "Christian Kirbach",
- "Christian Krause",
- "Christian Kreibich",
- "Christian Meyer",
- "Christian Neumair",
- "Christian Persch",
- "Christian Rose",
- "Christophe Fergeau",
- "Christophe Merlet",
- "Christopher Blizzard",
- "Christopher James Lahey",
- "Christopher R. Gabriel",
- "Chris Phelps",
- "Chris Toshok",
- "Clara Tattoni",
- "Claude Paroz",
- "Claudio Saavedra",
- "Clifford R. Conover",
- "Clytie Siddall",
- "Cody Russell",
- "Colin Leroy",
- "Craig Jeffares",
- "Craig Small",
- "Cyprien Le Pannérer",
- "Dafydd Harries",
- "Damian Ivereigh",
- "Damien Carbery",
- "Damon Chaplin",
- "Daniel Gryniewicz",
- "Daniel Nylander",
- "Daniel van Eeden",
- "Daniel Veillard",
- "Daniel Yacob",
- "Danilo Šegan",
- "Danishka Navin",
- "Dan Korostelev",
- "Danny Baumann",
- "Dan Berger",
- "Dan Damian",
- "Dan Nguyen",
- "Dan Williams",
- "Dan Winship",
- "Darin Adler",
- "Dave Benson",
- "Dave Camp",
- "Dave Fallon",
- "Dave Malcolm",
- "Dave West",
- "David Farning",
- "David Kaelbling",
- "David Lodge",
- "David Malcolm",
- "David Moore",
- "David Mosberger",
- "David O'Callaghan",
- "David Richards",
- "David Trowbridge",
- "David Turner",
- "David Woodhouse",
- "Denis Washington",
- "Devashish Sharma",
- "Diego Escalante Urrelo",
- "Diego Gonzalez",
- "Diego Sevilla Ruiz",
- "Dietmar Maurer",
- "Dinesh Layek",
- "Dirk-Jan C. Binnema",
- "Djihed Afifi",
- "Dmitrijs Ledkovs",
- "Dmitry Mastrukov",
- "Dodji Seketeli",
- "Duarte Loreto",
- "Dulmandakh Sukhbaatar",
- "Duncan Mak",
- "Ebby Wiselyn",
- "Ed Catmur",
- "Edd Dumbill",
- "Edgar Luna Díaz",
- "Edward Rudd",
- "Elijah Newren",
- "Elizabeth Greene",
- "Elliot Lee",
- "Elliot Turner",
- "Emil Hessman",
- "Eneko Lacunza",
- "Enver Altin",
- "Erdal Ronahi",
- "Erdi Gergo",
- "Eric Busboom",
- "Eric Zhao",
- "Eskild Hustvedt"
- "Eskil Heyn Olsen",
- "Espen Stefansen",
- "Ettore Perazzoli",
- "Evandro Fernandes Giovanini",
- "Evan Yan",
- "Fatih Demir",
- "Fazlu & Hannah",
- "Federico Mena Quintero",
- "Fernando Herrera",
- "Ferretti",
- "F. Priyadharshini",
- "Francisco Javier Fernandez Serrador",
- "Frank Arnold",
- "Frank Belew",
- "Frederic Crozat",
- "Frederic Peters",
- "Frederic Riss",
- "Fredrik Wendt",
- "Funda Wang",
- "Gabor Kelemen",
- "Ganesh",
- "Göran Uddeborg",
- "Gareth Owen",
- "Gary Coady",
- "Gary Ekker",
- "Gavin Scott",
- "Gediminas Paulauskas",
- "George Lebl",
- "Gerardo Marin",
- "Gergő Érdi",
- "Gert Kulyk",
- "Giancarlo Capella",
- "Gilbert Fang",
- "Gildas Guillemot",
- "Gil Forcada",
- "Gilles Dartiguelongue",
- "Gil Osher",
- "Gintautas Miliauskas",
- "Goran Rakić",
- "Grahame Bowland",
- "Greg Hudson",
- "Gregory Leblanc",
- "Gregory McLean",
- "Grzegorz Goawski",
- "Guilherme de S. Pastore",
- "Guntupalli Karunakar",
- "Gustavo GirÎldez",
- "Gustavo Maciel Dias Vieira",
- "Gustavo Noronha Silva",
- "Hamed Malek",
- "Hannah & Fazlu",
- "Hans Petter Jansson",
- "Hao Sheng",
- "Hari Prasad Nadig",
- "Harish Krishnaswamy",
- "Harry Lu",
- "Hasbullah Bin Pit",
- "Havoc Pennington",
- "Heath Harrelson",
- "Hein-Pieter van Braam",
- "Héctor García Álvarez",
- "Helgi Þormar Þorbjörnsson",
- "Hendrik Brandt",
- "Hendrik Richter",
- "Herbert V. Riedel",
- "Hessam M. Armandehi",
- "Hiroyuki Ikezoe",
- "Iain Buchanan",
- "Iain Holmes",
- "Ian Campbell",
- "Iassen Pramatarov",
- "Iestyn Pryce",
- "I.Felix",
- "Ignacio Casal Quinteiro",
- "Igor Nestorović",
- "Ihar Hrachyshka",
- "Ilkka Tuohela",
- "Imam Musthaqim",
- "Iñaki Larrañaga",
- "Inaki Larranaga Murgoitio",
- "Indu",
- "Irene Huang",
- "Ismael Olea",
- "Israel Escalante",
- "Ivan Stojmirov",
- "Ivar Smolin",
- "Ivelina Karcheva",
- "Iván Frade",
- "J.H.M. Dassen (Ray)",
- "Jaap A. Haitsma",
- "Jack Jia",
- "Jacob Berkman",
- "Jacob Brown",
- "Jacobo Tarrio Barreiro",
- "Jacob Ulysses Berkman",
- "Jaka Mocnik",
- "Jakub Friedl",
- "Jakub Steiner",
- "James Bowes",
- "James Doc Livingston",
- "James Henstridge",
- "James Westby",
- "James Willcox",
- "Jamil Ahmed",
- "Jan Arne Petersen",
- "Jan Tichavsky",
- "Jan Van Buggenhout",
- "J�rg Billeter",
- "Jared Moore",
- "Jarkko Ranta",
- "Jason Leach",
- "Jason Tackaberry",
- "Jayaradha",
- "Jean-Noel Guiheneuf",
- "Jedy Wang",
- "Jeff Bailey",
- "Jeff Cai",
- "Jeff Garzik",
- "Jeffrey Stedfast",
- "Jens Granseuer",
- "Jens Seidel",
- "Jeremy Katz",
- "Jeremy Messenger",
- "Jeremy Wise",
- "Jerome Lacoste",
- "Jerry Yu",
- "Jesse Pavel",
- "Jesus Bravo Alvarez",
- "Jesse Pavel",
- "Ji Lee",
- "Joan Sanfeliu",
- "João Vale",
- "Joaquim Fellmann",
- "Jody Goldberg",
- "Joe Man",
- "Joe Marcus Clarke",
- "Joe Shaw",
- "Johan Dahlin",
- "Johan Euphrosine",
- "John Gotts",
- "Johnny Jacob",
- "Jon Ander Hernandez",
- "Jonas Borgstr�m",
- "Jonathan Blandford",
- "Jonathan Dieter",
- "Jonathan Ernst",
- "Jonh Wendell",
- "Jon K Hellan",
- "Jon Oberheide",
- "Jon Trowbridge",
- "Jonas Borgstr",
- "Jonathan Blandford",
- "Jonathan Dieter",
- "Joop Stakenborg",
- "Jordi Mallach",
- "Jordi Mas",
- "Jorge Gonzalez",
- "Jörgen Scheibengruber",
- "Jos Dehaes",
- "Josep Puigdemont Casamajó",
- "Josselin Mouette",
- "Jovan Naumovski",
- "JP Rosevear",
- "Juan Manuel García Molina",
- "Juan Pizarro",
- "Jukka Zitting",
- "Jules Colding",
- "Julian Missig",
- "Julien Puydt",
- "Julio M. Merino Vidal",
- "Juraj Kubelka",
- "Jürg Billeter",
- "Justina Klingaitė",
- "Kai Lahmann",
- "Kang Jeong-Hee",
- "Karl Eichwalder",
- "Karl Relton",
- "Karsten Bräckelmann",
- "Kaushal Kumar",
- "Keith Packard",
- "Keld Simonsen",
- "Kenneth Christiansen",
- "Kenneth Nielsen",
- "Kenneth Rohde Christiansen",
- "Kenny Graunke",
- "Keshav Upadhyaya",
- "Kevin Breit",
- "Kevin Piche",
- "Kevin Vandersloot",
- "Khasim Shaheed",
- "Kidd Wang",
- "Kjartan Maraas",
- "Krishnan R",
- "Kostas Papadimas",
- "Krishna Babu K",
- "Krisztian Pifko",
- "Kyle Ambroff",
- "Larry Ewing",
- "Laszlo Dvornik",
- "Laszlo (Laca) Peter",
- "Laurent Dhima",
- "Lauris Kaplinski",
- "Leonardo Ferreira Fontenelle",
- "Leonid Kanter",
- "Leon Zhang",
- "Li Yuan",
- "Loïc Minier",
- "Lorenzo Gil Sanchez",
- "Luca Ferretti",
- "Lucas Rocha",
- "Lucian Langa",
- "Lucky Wankhede",
- "Luis Villa",
- "Lukas Novotny",
- "Lutz M",
- "Maciej Piechotka",
- "Maciej Stachowiak",
- "Makuchaku",
- "Malcolm Tredinnick",
- "Manuel A. Fernández Montecelo",
- "Manuel Borchers",
- "Marcel Telka",
- "Marco Ciampa",
- "Marco Pesenti Gritti",
- "Marius Andreiana",
- "Marius Vollmer",
- "Mark Crichton",
- "Mark G. Adams",
- "Mark Gordon",
- "Mark McLoughlin",
- "Mark Moulder",
- "Mark Tearle",
- "Martha Burke",
- "Martin Baulig",
- "Martin Hicks",
- "Martin Meyer",
- "Martin Norbäck",
- "Martin Willemoes Hansen",
- "Martyn Russell",
- "Masahiro Sakai",
- "Matej Urbančič",
- "Mathieu Lacage",
- "Matias Mutchinick",
- "Matic Žgur",
- "Matt Bissiri",
- "Matt Brown",
- "Matthew Barnes",
- "Matthew Daniel",
- "Matthew Hall",
- "Matthew Loper",
- "Matthew Wilson",
- "Matthias Braun",
- "Matthias Clasen",
- "Matthias Warkus",
- "Matt Loper",
- "Matt Martin",
- "Matt McCutchen",
- "Matt Wilson",
- "Max Horn",
- "Maxim Dziumanenko",
- "Maxx Cao",
- "Mayank Jain",
- "Meelad Zakaria",
- "Meilof Veeningen",
- "Mendel Mobach",
- "Mengjie Yu",
- "Metin Amiroff",
- "Michael Granger",
- "Michael M. Morrison",
- "Michael MacDonald",
- "Michael Meeks",
- "Michael Monreal",
- "Michael Terry",
- "Michael Zucchi",
- "Michal Bukovjan",
- "Michel Daenzer",
- "Miguel Angel Lopez Hernandez",
- "Miguel de Icaza",
- "Mikael Hallendal",
- "Mikael Nilsson",
- "Mike Castle",
- "Mike Kestner",
- "Mike McEwan",
- "Mikhail Zabaluev",
- "Milan Crha",
- "Miles Lane",
- "Miloslav Trmač",
- "MIMOS Open Source Development Group",
- "Mohammad Damt",
- "Moritz Mertinkat",
- "Morten Welinder",
- "Mubeen Jukaku",
- "Mugurel Tudor",
- "Murray Cumming",
- "M Victor Aloysius J",
- "Naba Kumar",
- "Nagappan Alagappan",
- "Nancy Cai",
- "Naresh N",
- "Nat Friedman",
- "Nathan Owens",
- "Nguyễn Thái Ngọc Duy",
- "Nicel KM",
- "Nicholas J Kreucher",
- "Nicholas Miell",
- "Nickolay V. Shmyrev",
- "Nick Sukharev",
- "Nike Gerdts",
- "Nikos Charonitakis",
- "Noel",
- "Nuno Ferreira",
- "Nyall Dawson",
- "Og Maciel",
- "Ole Laursen",
- "Ondrej Jirman",
- "Oswald Rodrigues",
- "Owen Taylor",
- "Øystein Gisnås",
- "Pablo Gonzalo del Campo",
- "Pablo Saratxaga",
- "Pamplona Hackers",
- "Pauli Virtanen",
- "Paolo Borelli",
- "Paolo Molaro",
- "Parag Goel",
- "Parthasarathi Susarla",
- "Pascal Terjan",
- "Patrick Ohly",
- "Paul Bolle",
- "Paul Duffy",
- "Paul Iadonisi",
- "Paul Lindner",
- "Paul Smith",
- "Paulo Gomes Vanzuita",
- "Pavel Cholakov",
- "Pavel Cisler",
- "Pavel Roskin",
- "Pavithran",
- "Pawan Chitrakar",
- "Pedro Villavicencio",
- "Pema Geyleg",
- "Peteris Krisjanis",
- "Peter Bach",
- "Peter Pouliot",
- "Peter Teichman",
- "Peter Williams",
- "Petr Kovar",
- "Petta Pietikainen",
- "Phil Goembel",
- "Philipp Kerling",
- "Philip Van Hoof",
- "Philip Withnall",
- "Philip Zhao",
- "Poornima Nayak",
- "Pramod",
- "Prasad Kandepu",
- "Pratik V. Parikh",
- "Praveen Arimbrathodiyil",
- "Praveen Kumar",
- "Priit Laes",
- "Priyanshu Raj",
- "P S Chakravarthi",
- "Radek Doulik",
- "Raghavendran R",
- "Rahul Bhalerao",
- "Raivis Dejus",
- "Raja R Harinath",
- "Rajeev Ramanathan",
- "Rajesh Ranjan",
- "Rakesh k.g",
- "Ramiro Estrugo",
- "Ranjan Somani",
- "Raphael Higino",
- "Ray Strode",
- "Reinout van Schouwen",
- "Rhys Jones",
- "Ricardo Markiewicz",
- "Richard Boulton",
- "Richard Hult",
- "Richard Li",
- "Rob Bradford",
- "Robert-André Mauchin",
- "Robert Brady",
- "Robert Sedak",
- "Robin Slomkowski",
- "Rodney Dawes",
- "Rodrigo Moya",
- "Roger Zauner",
- "Rohini S",
- "Roland Illig",
- "Ronald Kuetemeier",
- "Roozbeh Pournader",
- "Roshan Kumar Singh",
- "Ross Burton",
- "Rostislav Raykov",
- "Rouslan Solomakhin",
- "Roy-Magne Mo",
- "Runa Bhattacharjee",
- "Russell Steinthal",
- "Russian team",
- "Rusty Conover",
- "Ryan P. Skadberg",
- "Sam Creasey",
- "Sami Pesonen",
- "Samúel Jón Gunnarsson",
- "Sam Yang",
- "Sankar P",
- "Sanlig Badral",
- "Sanshao Jiang",
- "S.Antony Vincent Pandian",
- "Sarfraaz Ahmed",
- "Satoru SATOH",
- "Sayamindu Dasgupta",
- "S. Caglar Onur",
- "Sean Atkinson",
- "Seán de Búrca",
- "Sean Gao",
- "Sebastian Rittau",
- "Sebastian Wilhelmi",
- "Sebastien Bacher",
- "Sergey Panov",
- "Sergio Villar Senín",
- "Seth Alves",
- "Seth Nickell",
- "Shakti Sen",
- "Shankar Prasad",
- "Shi Pu",
- "Shilpa C",
- "Shree Krishnan",
- "Shreyas Srinivasan",
- "Shuai Liu",
- "Sigurd Gartmann",
- "Simon Zheng",
- "Simos Xenitellis",
- "Sitic Vulnerability Advisory",
- "Sivaiah Nallagatla",
- "Slobodan D. Sredojevic",
- "S N Tejasvi",
- "Spiros Papadimitriou",
- "Srinivasa Ragavan",
- "Stanislav Brabec",
- "Stanislav Slusny",
- "Stanislav Visnovsky",
- "Stéphane Raimbault",
- "Stephen Cook",
- "Steve Murphy",
- "Steven Zhang",
- "Stuart Parmenter",
- "Subhransu Behera",
- "Subodh Soni",
- "Suman Manjunath",
- "Sunil Mohan Adapa",
- "Supranee Thirawatthanasuk",
- "Suresh Chandrasekharan",
- "Sushma Rai",
- "Sven Herzberg",
- "Sweta Kothari",
- "Szabolcs Ban",
- "Takao Fujiwara",
- "Takayuki Kusano",
- "Takeshi Aihana",
- "Takuo Kitame",
- "Tambet Ingo",
- "Taylor Hayward",
- "Ted Percival",
- "Telsa Gwynne",
- "Terance Sola",
- "Theppitak Karoonboonyanan",
- "Thierry Moisan",
- "Thierry Randrianiriana",
- "Thomas Cataldo",
- "Thomas Klausner",
- "Thomas Mirlacher",
- "Thouis R. Jones",
- "Tiago Antao",
- "Timo Jyrinki",
- "Timur Bakeyev",
- "Tim Wo",
- "Tim Yamin",
- "Timo Hoenig",
- "Timo Sirainen",
- "Timothy Lee",
- "Timur Bakeyev",
- "Tino Meinen",
- "Tobias Mueller",
- "Tõivo Leedjärv",
- "Tom Tromey",
- "Tomas Ogren",
- "Tomasz Kłoczko",
- "Tomislav Vujec",
- "Tommi Komulainen",
- "Tommi Vainikainen",
- "Tony Tsui",
- "Tor Lillqvist",
- "Trent Lloyd",
- "Tristan Tarrant",
- "Tuomas J. Lukka",
- "Tuomas Kuosmanen",
- "Udomsak Chundang",
- "Ulrich Neumann",
- "Umeshtej",
- "Umesh Tiwari",
- "Ushveen Kaur",
- "Vadim Strizhevsky",
- "Valek Filippov",
- "Vandana Shenoy .B",
- "Vardhman Jain",
- "Vasiliy Faronov",
- "Veerapuram Varadhan",
- "Vincent Carriere",
- "Vincent Noel",
- "Vincent Renardias",
- "Vincent Untz",
- "Vincent van Adrighem",
- "Viren.L",
- "Vivek Jain",
- "Vladimer Sichinava",
- "Vladimir Petkov",
- "Vladimir Vukicevic",
- "Vladimir Melo",
- "V Ravi Kumar Raju",
- "Wadim Dziedzic",
- "Wang Jian",
- "Wang Li",
- "Wang Xin",
- "Washington Lins",
- "Wayne Davis",
- "William Jon McCann",
- "Woodman Tuen",
- "Wouter Bolsterlee",
- "Xan Lopez",
- "Xavier Conde Rueda",
- "Xiurong Simon Zheng",
- "Yair Hershkovitz",
- "Yanko Kaneti",
- "Yannig Marchegay",
- "Yavor Doganov",
- "Yi Jin",
- "Yong Sun",
- "Yuedong Du",
- "Yukihiro Nakai",
- "Yu Mengjie",
- "Yuri Pankov",
- "Yuri Syrota",
- "Yuriy Penkin",
- "Zach Frey",
- "Zan Lynx",
- "Zbigniew Chyla",
- "Zhe Su",
- "Zipeco",
- "Žygimantas Beručka",
- NULL
-};
-
-static const char *documentors[] = {
- "Aaron Weber",
- "Binika Preet",
- "Dan Winship",
- "David Trowbridge",
- "Jessica Prabhakar",
- "JP Rosevear",
- "Radhika Nair",
- NULL
-};
-
-static void
-command_about (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- gchar *translator_credits;
-
- /* The translator-credits string is for translators to list
- * per-language credits for translation, displayed in the
- * about dialog. */
- translator_credits = _("translator-credits");
- if (strcmp (translator_credits, "translator-credits") == 0)
- translator_credits = NULL;
-
- gtk_show_about_dialog (
- GTK_WINDOW (window),
- "program-name", "Evolution",
- "version", VERSION,
- "copyright", EVOLUTION_COPYRIGHT,
- "comments", _("Groupware Suite"),
- "website", EVOLUTION_WEBSITE,
- "website-label", _("Evolution Website"),
- "authors", authors,
- "documenters", documentors,
- "translator-credits", translator_credits,
- "logo-icon-name", "evolution",
- NULL);
-}
-
-static void
-command_open_faq (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- const gchar *uri;
-
- uri = "http://www.go-evolution.org/FAQ";
- e_show_uri (GTK_WINDOW (window), uri);
-}
-
-static void
-command_quick_reference (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- char *quickref;
- const gchar * const *language_names;
-
- language_names = g_get_language_names ();
- while (*language_names != NULL) {
- const gchar *lang = *language_names++;
-
- /* This has to be a valid language AND a language with
- * no encoding postfix. The language will come up without
- * encoding next */
- if (lang == NULL || strchr (lang, '.') != NULL)
- continue;
-
- quickref = g_build_filename (EVOLUTION_HELPDIR, "quickref", lang, "quickref.pdf", NULL);
- if (g_file_test (quickref, G_FILE_TEST_EXISTS)) {
- GFile *file = g_file_new_for_path (quickref);
-
- if (file) {
- GError *error = NULL;
- char *uri = g_file_get_uri (file);
-
- g_app_info_launch_default_for_uri (uri, NULL, &error);
-
- if (error) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
-
- g_object_unref (file);
- g_free (uri);
- }
-
- g_free (quickref);
- return;
- }
-
- g_free (quickref);
- }
-}
-
-
-static void
-command_work_offline (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- EShell *shell;
-
- shell = e_shell_window_peek_shell (window);
- e_shell_set_line_status (shell, GNOME_Evolution_USER_OFFLINE);
-}
-
-static void
-command_work_online (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- EShell *shell;
-
- shell = e_shell_window_peek_shell (window);
- e_shell_set_line_status (shell, GNOME_Evolution_USER_ONLINE);
-}
-
-static void
-command_open_new_window (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- e_shell_create_window (e_shell_window_peek_shell (window),
- e_shell_window_peek_current_component_id (window),
- window);
-}
-
-
-/* Actions menu. */
-
-static void
-command_send_receive (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- e_shell_send_receive (e_shell_window_peek_shell (window));
-}
-
-static void
-command_forget_passwords (BonoboUIComponent *ui_component,
- void *data,
- const char *path)
-{
- if (e_error_run (NULL, "shell:forget-passwords", NULL) == GTK_RESPONSE_OK)
- e_passwords_forget_passwords();
-}
-
-/* Tools menu. */
-
-static void
-command_settings (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- e_shell_window_show_settings (window);
-}
-
-static void
-command_pilot_settings (BonoboUIComponent *uih,
- EShellWindow *window,
- const char *path)
-{
- launch_pilot_settings ();
-}
-
-
-static BonoboUIVerb file_verbs [] = {
- BONOBO_UI_VERB ("FileImporter", (BonoboUIVerbFn) command_import),
- BONOBO_UI_VERB ("FilePageSetup", (BonoboUIVerbFn) command_page_setup),
- BONOBO_UI_VERB ("FileClose", (BonoboUIVerbFn) command_close),
- BONOBO_UI_VERB ("FileExit", (BonoboUIVerbFn) command_quit),
-
- BONOBO_UI_VERB ("WorkOffline", (BonoboUIVerbFn) command_work_offline),
- BONOBO_UI_VERB ("WorkOnline", (BonoboUIVerbFn) command_work_online),
-
- BONOBO_UI_VERB_END
-};
-
-static BonoboUIVerb new_verbs [] = {
- BONOBO_UI_VERB ("OpenNewWindow", (BonoboUIVerbFn) command_open_new_window),
-
- BONOBO_UI_VERB_END
-};
-
-static BonoboUIVerb actions_verbs[] = {
- BONOBO_UI_VERB ("SendReceive", (BonoboUIVerbFn) command_send_receive),
- BONOBO_UI_VERB ("ForgetPasswords", command_forget_passwords),
-
- BONOBO_UI_VERB_END
-};
-
-static BonoboUIVerb tools_verbs[] = {
- BONOBO_UI_VERB ("Settings", (BonoboUIVerbFn) command_settings),
- BONOBO_UI_VERB ("PilotSettings", (BonoboUIVerbFn) command_pilot_settings),
-
- BONOBO_UI_VERB_END
-};
-
-static BonoboUIVerb help_verbs [] = {
- BONOBO_UI_VERB ("QuickReference", (BonoboUIVerbFn) command_quick_reference),
- BONOBO_UI_VERB ("HelpOpenFAQ", (BonoboUIVerbFn) command_open_faq),
- BONOBO_UI_VERB ("HelpSubmitBug", (BonoboUIVerbFn) command_submit_bug),
- BONOBO_UI_VERB ("HelpAbout", (BonoboUIVerbFn) command_about),
-
- BONOBO_UI_VERB_END
-};
-
-static EPixmap pixmaps [] = {
- E_PIXMAP ("/Toolbar/SendReceive", "mail-send-receive", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/menu/File/OpenNewWindow", "window-new", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/menu/File/SendReceive", "mail-send-receive", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/menu/File/FileImporter", "stock_mail-import", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/menu/File/Print/FilePageSetup", "stock_print-setup", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/menu/File/ToggleOffline", "stock_disconnect", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/menu/File/FileClose", "window-close", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/menu/File/FileExit", "application-exit", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/menu/Edit/Settings", "preferences-desktop", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/menu/Help/HelpOpenFAQ", "help-faq", GTK_ICON_SIZE_MENU),
-
- E_PIXMAP_END
-};
-
-static EPixmap offline_pixmaps [] = {
- E_PIXMAP ("/menu/File/ToggleOffline", "stock_disconnect", GTK_ICON_SIZE_MENU),
- E_PIXMAP_END
-};
-
-static EPixmap online_pixmaps [] = {
- E_PIXMAP ("/menu/File/ToggleOffline", "stock_connect", GTK_ICON_SIZE_MENU),
- E_PIXMAP_END
-};
-
-
-/* The Work Online / Work Offline menu item. */
-
-static void
-update_offline_menu_item (EShellWindow *shell_window,
- EShellLineStatus line_status)
-{
- BonoboUIComponent *ui_component;
-
- ui_component = e_shell_window_peek_bonobo_ui_component (shell_window);
-
- switch (line_status) {
- case E_SHELL_LINE_STATUS_OFFLINE:
- case E_SHELL_LINE_STATUS_FORCED_OFFLINE:
- bonobo_ui_component_set_prop (ui_component,
- "/menu/File/ToggleOffline",
- "label", _("_Work Online"), NULL);
- bonobo_ui_component_set_prop (ui_component,
- "/menu/File/ToggleOffline",
- "verb", "WorkOnline", NULL);
- bonobo_ui_component_set_prop (ui_component,
- "/commands/ToggleOffline",
- "sensitive", "1", NULL);
- e_pixmaps_update (ui_component, online_pixmaps);
- break;
-
- case E_SHELL_LINE_STATUS_ONLINE:
- bonobo_ui_component_set_prop (ui_component,
- "/menu/File/ToggleOffline",
- "label", _("_Work Offline"), NULL);
- bonobo_ui_component_set_prop (ui_component,
- "/menu/File/ToggleOffline",
- "verb", "WorkOffline", NULL);
- bonobo_ui_component_set_prop (ui_component,
- "/commands/ToggleOffline",
- "sensitive", "1", NULL);
- e_pixmaps_update (ui_component, offline_pixmaps);
- break;
-
- case E_SHELL_LINE_STATUS_GOING_OFFLINE:
- bonobo_ui_component_set_prop (ui_component,
- "/menu/File/ToggleOffline",
- "label", _("Work Offline"), NULL);
- bonobo_ui_component_set_prop (ui_component,
- "/menu/File/ToggleOffline",
- "verb", "WorkOffline", NULL);
- bonobo_ui_component_set_prop (ui_component,
- "/commands/ToggleOffline",
- "sensitive", "0", NULL);
- e_pixmaps_update (ui_component, offline_pixmaps);
- break;
-
- default:
- g_return_if_reached();
- }
-}
-
-static void
-shell_line_status_changed_cb (EShell *shell,
- EShellLineStatus new_status,
- EShellWindow *shell_window)
-{
- update_offline_menu_item (shell_window, new_status);
-}
-
-static void
-view_buttons_icontext_item_toggled_handler (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- EShellWindow *shell_window)
-{
- ESidebar *sidebar;
-
- sidebar = e_shell_window_peek_sidebar (shell_window);
- e_sidebar_set_mode (sidebar, E_SIDEBAR_MODE_BOTH);
-}
-
-static void
-view_buttons_icon_item_toggled_handler (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- EShellWindow *shell_window)
-{
- ESidebar *sidebar;
-
- sidebar = e_shell_window_peek_sidebar (shell_window);
- e_sidebar_set_mode (sidebar, E_SIDEBAR_MODE_ICON);
-}
-
-static void
-view_buttons_text_item_toggled_handler (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- EShellWindow *shell_window)
-{
- ESidebar *sidebar;
-
- sidebar = e_shell_window_peek_sidebar (shell_window);
- e_sidebar_set_mode (sidebar, E_SIDEBAR_MODE_TEXT);
-}
-
-static void
-view_buttons_toolbar_item_toggled_handler (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- EShellWindow *shell_window)
-{
- ESidebar *sidebar;
-
- sidebar = e_shell_window_peek_sidebar (shell_window);
- e_sidebar_set_mode (sidebar, E_SIDEBAR_MODE_TOOLBAR);
-}
-
-static void
-view_buttons_hide_item_toggled_handler (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- EShellWindow *shell_window)
-{
- ESidebar *sidebar;
- gboolean is_visible;
-
- sidebar = e_shell_window_peek_sidebar (shell_window);
-
- is_visible = state[0] == '0';
-
- e_sidebar_set_show_buttons (sidebar, is_visible);
-}
-
-static void
-view_toolbar_item_toggled_handler (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- EShellWindow *shell_window)
-{
- gboolean is_visible;
-
- is_visible = state[0] == '1';
-
- bonobo_ui_component_set_prop (ui_component, "/Toolbar",
- "hidden", is_visible ? "0" : "1", NULL);
-}
-
-static void
-view_statusbar_item_toggled_handler (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- EShellWindow *shell_window)
-{
- GtkWidget *status_bar = e_shell_window_peek_statusbar (shell_window);
- gboolean is_visible;
- GConfClient *gconf_client;
-
- is_visible = state[0] == '1';
- if(is_visible)
- gtk_widget_show (status_bar);
- else
- gtk_widget_hide (status_bar);
- gconf_client = gconf_client_get_default ();
- gconf_client_set_bool (gconf_client,"/apps/evolution/shell/view_defaults/statusbar_visible", is_visible, NULL);
- g_object_unref (gconf_client);
-}
-
-static void
-view_sidebar_item_toggled_handler (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- EShellWindow *shell_window)
-{
- GtkWidget *side_bar = GTK_WIDGET(e_shell_window_peek_sidebar (shell_window));
- gboolean is_visible;
- GConfClient *gconf_client;
-
- is_visible = state[0] == '1';
- if(is_visible)
- gtk_widget_show (side_bar);
- else
- gtk_widget_hide (side_bar);
- gconf_client = gconf_client_get_default ();
- gconf_client_set_bool (gconf_client_get_default (),"/apps/evolution/shell/view_defaults/sidebar_visible", is_visible, NULL);
- g_object_unref (gconf_client);
-}
-
-/* Public API. */
-
-void
-e_shell_window_commands_setup (EShellWindow *shell_window)
-{
- BonoboUIComponent *uic;
- EShell *shell;
-
- g_return_if_fail (shell_window != NULL);
- g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
-
- uic = e_shell_window_peek_bonobo_ui_component (shell_window);
- shell = e_shell_window_peek_shell (shell_window);
-
- bonobo_ui_component_add_verb_list_with_data (uic, file_verbs, shell_window);
- bonobo_ui_component_add_verb_list_with_data (uic, new_verbs, shell_window);
- bonobo_ui_component_add_verb_list_with_data (uic, actions_verbs, shell_window);
- bonobo_ui_component_add_verb_list_with_data (uic, tools_verbs, shell_window);
- bonobo_ui_component_add_verb_list_with_data (uic, help_verbs, shell_window);
- bonobo_ui_component_add_listener (uic, "ViewButtonsIconText",
- (BonoboUIListenerFn)view_buttons_icontext_item_toggled_handler,
- (gpointer)shell_window);
- bonobo_ui_component_add_listener (uic, "ViewButtonsIcon",
- (BonoboUIListenerFn)view_buttons_icon_item_toggled_handler,
- (gpointer)shell_window);
- bonobo_ui_component_add_listener (uic, "ViewButtonsText",
- (BonoboUIListenerFn)view_buttons_text_item_toggled_handler,
- (gpointer)shell_window);
- bonobo_ui_component_add_listener (uic, "ViewButtonsToolbar",
- (BonoboUIListenerFn)view_buttons_toolbar_item_toggled_handler,
- (gpointer)shell_window);
- bonobo_ui_component_add_listener (uic, "ViewButtonsHide",
- (BonoboUIListenerFn)view_buttons_hide_item_toggled_handler,
- (gpointer)shell_window);
- bonobo_ui_component_add_listener (uic, "ViewToolbar",
- (BonoboUIListenerFn)view_toolbar_item_toggled_handler,
- (gpointer)shell_window);
- bonobo_ui_component_add_listener (uic, "ViewStatusBar",
- (BonoboUIListenerFn)view_statusbar_item_toggled_handler,
- (gpointer)shell_window);
- bonobo_ui_component_add_listener (uic, "ViewSideBar",
- (BonoboUIListenerFn)view_sidebar_item_toggled_handler,
- (gpointer)shell_window);
-
- e_pixmaps_update (uic, pixmaps);
-
- /* Set up the work online / work offline menu item. */
- g_signal_connect_object (shell, "line_status_changed",
- G_CALLBACK (shell_line_status_changed_cb), shell_window, 0);
- update_offline_menu_item (shell_window, e_shell_get_line_status (shell));
-}
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
new file mode 100644
index 0000000000..bb74e35ced
--- /dev/null
+++ b/shell/e-shell-window-private.c
@@ -0,0 +1,575 @@
+/*
+ * e-shell-window-private.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-shell-window-private.h"
+
+static void
+shell_window_save_switcher_style_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EShellWindow *shell_window)
+{
+ EShell *shell;
+ GConfClient *client;
+ GtkToolbarStyle style;
+ const gchar *key;
+ const gchar *string;
+ GError *error = NULL;
+
+ shell = e_shell_window_get_shell (shell_window);
+ client = e_shell_get_gconf_client (shell);
+
+ style = gtk_radio_action_get_current_value (action);
+ key = "/apps/evolution/shell/view_defaults/buttons_style";
+
+ switch (style) {
+ case GTK_TOOLBAR_ICONS:
+ string = "icons";
+ break;
+
+ case GTK_TOOLBAR_TEXT:
+ string = "text";
+ break;
+
+ case GTK_TOOLBAR_BOTH:
+ case GTK_TOOLBAR_BOTH_HORIZ:
+ string = "both";
+ break;
+
+ default:
+ string = "toolbar";
+ break;
+ }
+
+ if (!gconf_client_set_string (client, key, string, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+shell_window_init_switcher_style (EShellWindow *shell_window)
+{
+ EShell *shell;
+ GtkAction *action;
+ GConfClient *client;
+ GtkToolbarStyle style;
+ const gchar *key;
+ gchar *string;
+ GError *error = NULL;
+
+ /* XXX GConfBridge doesn't let you convert between numeric properties
+ * and string keys, so we have to create the binding manually. */
+
+ shell = e_shell_window_get_shell (shell_window);
+ client = e_shell_get_gconf_client (shell);
+
+ action = ACTION (SWITCHER_STYLE_ICONS);
+ key = "/apps/evolution/shell/view_defaults/buttons_style";
+ string = gconf_client_get_string (client, key, &error);
+
+ if (string != NULL) {
+ if (strcmp (string, "icons") == 0)
+ style = GTK_TOOLBAR_ICONS;
+ else if (strcmp (string, "text") == 0)
+ style = GTK_TOOLBAR_TEXT;
+ else if (strcmp (string, "both") == 0)
+ style = GTK_TOOLBAR_BOTH_HORIZ;
+ else
+ style = -1;
+
+ gtk_radio_action_set_current_value (
+ GTK_RADIO_ACTION (action), style);
+ }
+
+ g_signal_connect (
+ action, "changed",
+ G_CALLBACK (shell_window_save_switcher_style_cb),
+ shell_window);
+}
+
+static void
+shell_window_menu_item_select_cb (EShellWindow *shell_window,
+ GtkWidget *menu_item)
+{
+ GtkAction *action;
+ GtkLabel *label;
+ gchar *tooltip = NULL;
+
+ action = g_object_get_data (G_OBJECT (menu_item), "action");
+ g_return_if_fail (GTK_IS_ACTION (action));
+
+ g_object_get (action, "tooltip", &tooltip, NULL);
+
+ if (tooltip == NULL)
+ return;
+
+ label = GTK_LABEL (shell_window->priv->tooltip_label);
+ gtk_label_set_text (label, tooltip);
+ g_free (tooltip);
+
+ gtk_widget_show (shell_window->priv->tooltip_label);
+ gtk_widget_hide (shell_window->priv->status_notebook);
+}
+
+static void
+shell_window_menu_item_deselect_cb (EShellWindow *shell_window)
+{
+ gtk_widget_hide (shell_window->priv->tooltip_label);
+ gtk_widget_show (shell_window->priv->status_notebook);
+}
+
+static void
+shell_window_connect_proxy_cb (EShellWindow *shell_window,
+ GtkAction *action,
+ GtkWidget *proxy)
+{
+ if (!GTK_IS_MENU_ITEM (proxy))
+ return;
+
+ g_object_set_data_full (
+ G_OBJECT (proxy),
+ "action", g_object_ref (action),
+ (GDestroyNotify) g_object_unref);
+
+ g_signal_connect_swapped (
+ proxy, "select",
+ G_CALLBACK (shell_window_menu_item_select_cb),
+ shell_window);
+
+ g_signal_connect_swapped (
+ proxy, "deselect",
+ G_CALLBACK (shell_window_menu_item_deselect_cb),
+ shell_window);
+}
+
+static void
+shell_window_online_button_clicked_cb (EOnlineButton *button,
+ EShellWindow *shell_window)
+{
+ if (e_online_button_get_online (button))
+ gtk_action_activate (ACTION (WORK_OFFLINE));
+ else
+ gtk_action_activate (ACTION (WORK_ONLINE));
+}
+
+void
+e_shell_window_private_init (EShellWindow *shell_window)
+{
+ EShellWindowPrivate *priv = shell_window->priv;
+ GHashTable *loaded_views;
+ GArray *signal_handler_ids;
+ GtkAccelGroup *accel_group;
+ GtkToolItem *item;
+ GtkWidget *container;
+ GtkWidget *widget;
+ guint merge_id;
+ gint height;
+
+ loaded_views = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_object_unref);
+
+ signal_handler_ids = g_array_new (FALSE, FALSE, sizeof (gulong));
+
+ priv->ui_manager = gtk_ui_manager_new ();
+ priv->loaded_views = loaded_views;
+ priv->active_view = "unknown";
+ priv->signal_handler_ids = signal_handler_ids;
+
+ e_shell_window_add_action_group (shell_window, "shell");
+ e_shell_window_add_action_group (shell_window, "gal-view");
+ e_shell_window_add_action_group (shell_window, "new-item");
+ e_shell_window_add_action_group (shell_window, "new-source");
+ e_shell_window_add_action_group (shell_window, "custom-rules");
+ e_shell_window_add_action_group (shell_window, "switcher");
+ e_shell_window_add_action_group (shell_window, "lockdown-application-handlers");
+ e_shell_window_add_action_group (shell_window, "lockdown-printing");
+ e_shell_window_add_action_group (shell_window, "lockdown-print-setup");
+ e_shell_window_add_action_group (shell_window, "lockdown-save-to-disk");
+
+ merge_id = gtk_ui_manager_new_merge_id (priv->ui_manager);
+ priv->custom_rule_merge_id = merge_id;
+
+ merge_id = gtk_ui_manager_new_merge_id (priv->ui_manager);
+ priv->gal_view_merge_id = merge_id;
+
+ e_shell_window_actions_init (shell_window);
+
+ accel_group = gtk_ui_manager_get_accel_group (priv->ui_manager);
+ gtk_window_add_accel_group (GTK_WINDOW (shell_window), accel_group);
+
+ g_signal_connect_swapped (
+ priv->ui_manager, "connect-proxy",
+ G_CALLBACK (shell_window_connect_proxy_cb), shell_window);
+
+ /* Construct window widgets. */
+
+ widget = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (shell_window), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = e_shell_window_get_managed_widget (
+ shell_window, "/main-menu");
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ priv->main_menu = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = e_shell_window_get_managed_widget (
+ shell_window, "/main-toolbar");
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ priv->main_toolbar = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* XXX Having this separator in the UI definition doesn't work
+ * because GtkUIManager is unaware of the "New" button, so
+ * it makes the separator invisible. One possibility is to
+ * define a GtkAction subclass for which create_tool_item()
+ * returns an EMenuToolButton. Then both this separator
+ * and the "New" button could be added to the UI definition.
+ * Tempting, but the "New" button and its dynamically
+ * generated menu is already a complex beast, and I'm not
+ * convinced having it proxy some new type of GtkAction
+ * is worth the extra effort. */
+ item = gtk_separator_tool_item_new ();
+ gtk_toolbar_insert (GTK_TOOLBAR (widget), item, 0);
+ gtk_widget_show (GTK_WIDGET (item));
+
+ item = e_menu_tool_button_new (_("New"));
+ gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
+ gtk_widget_add_accelerator (
+ GTK_WIDGET (item), "clicked",
+ gtk_ui_manager_get_accel_group (priv->ui_manager),
+ GDK_N, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
+ gtk_toolbar_insert (GTK_TOOLBAR (widget), item, 0);
+ priv->menu_tool_button = g_object_ref (item);
+ gtk_widget_show (GTK_WIDGET (item));
+
+ widget = gtk_hpaned_new ();
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ priv->content_pane = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_hbox_new (FALSE, 3);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ priv->status_area = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Make the status area as large as the task bar. */
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &height);
+ gtk_widget_set_size_request (widget, -1, (height * 2) + 6);
+
+ container = priv->content_pane;
+
+ widget = e_shell_switcher_new ();
+ gtk_paned_pack1 (GTK_PANED (container), widget, FALSE, FALSE);
+ priv->switcher = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
+ gtk_paned_pack2 (GTK_PANED (container), widget, TRUE, TRUE);
+ priv->content_notebook = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = priv->switcher;
+
+ widget = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->sidebar_notebook = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = priv->status_area;
+
+ widget = e_online_button_new ();
+ g_signal_connect (
+ widget, "clicked",
+ G_CALLBACK (shell_window_online_button_clicked_cb),
+ shell_window);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, TRUE, 0);
+ priv->online_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ priv->tooltip_label = g_object_ref (widget);
+ gtk_widget_hide (widget);
+
+ widget = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ priv->status_notebook = g_object_ref (widget);
+ gtk_widget_show (widget);
+}
+
+void
+e_shell_window_private_constructed (EShellWindow *shell_window)
+{
+ EShellWindowPrivate *priv = shell_window->priv;
+ EShellSettings *shell_settings;
+ EShell *shell;
+ GConfBridge *bridge;
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ GObject *object;
+ const gchar *key;
+
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ e_shell_watch_window (shell, GTK_WINDOW (shell_window));
+
+ /* Create the switcher actions before we set the initial
+ * shell view, because the shell view relies on them for
+ * default settings during construction. */
+ e_shell_window_create_switcher_actions (shell_window);
+
+ /* Support lockdown. */
+
+ action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
+
+ e_binding_new_with_negation (
+ G_OBJECT (shell_settings), "disable-printing",
+ G_OBJECT (action_group), "sensitive");
+
+ action_group = ACTION_GROUP (LOCKDOWN_PRINT_SETUP);
+
+ e_binding_new_with_negation (
+ G_OBJECT (shell_settings), "disable-print-setup",
+ G_OBJECT (action_group), "sensitive");
+
+ action_group = ACTION_GROUP (LOCKDOWN_SAVE_TO_DISK);
+
+ e_binding_new_with_negation (
+ G_OBJECT (shell_settings), "disable-save-to-disk",
+ G_OBJECT (action_group), "sensitive");
+
+ /* Bind GObject properties to GObject properties. */
+
+ action = ACTION (SEND_RECEIVE);
+
+ e_binding_new (
+ G_OBJECT (shell), "online",
+ G_OBJECT (action), "sensitive");
+
+ action = ACTION (WORK_OFFLINE);
+
+ e_binding_new (
+ G_OBJECT (shell), "online",
+ G_OBJECT (action), "visible");
+
+ action = ACTION (WORK_ONLINE);
+
+ e_binding_new_with_negation (
+ G_OBJECT (shell), "online",
+ G_OBJECT (action), "visible");
+
+ e_binding_new (
+ G_OBJECT (shell), "online",
+ G_OBJECT (shell_window->priv->online_button), "online");
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ key = "/apps/evolution/shell/view_defaults/window";
+ gconf_bridge_bind_window (
+ bridge, key, GTK_WINDOW (shell_window), TRUE, FALSE);
+
+ object = G_OBJECT (shell_window);
+ key = "/apps/evolution/shell/view_defaults/component_id";
+ gconf_bridge_bind_property (bridge, key, object, "active-view");
+
+ object = G_OBJECT (priv->content_pane);
+ key = "/apps/evolution/shell/view_defaults/folder_bar/width";
+ gconf_bridge_bind_property_delayed (bridge, key, object, "position");
+
+ object = G_OBJECT (ACTION (SHOW_SIDEBAR));
+ key = "/apps/evolution/shell/view_defaults/sidebar_visible";
+ gconf_bridge_bind_property (bridge, key, object, "active");
+
+ object = G_OBJECT (ACTION (SHOW_STATUSBAR));
+ key = "/apps/evolution/shell/view_defaults/statusbar_visible";
+ gconf_bridge_bind_property (bridge, key, object, "active");
+
+ object = G_OBJECT (ACTION (SHOW_SWITCHER));
+ key = "/apps/evolution/shell/view_defaults/buttons_visible";
+ gconf_bridge_bind_property (bridge, key, object, "active");
+
+ object = G_OBJECT (ACTION (SHOW_TOOLBAR));
+ key = "/apps/evolution/shell/view_defaults/toolbar_visible";
+ gconf_bridge_bind_property (bridge, key, object, "active");
+
+ shell_window_init_switcher_style (shell_window);
+}
+
+void
+e_shell_window_private_dispose (EShellWindow *shell_window)
+{
+ EShellWindowPrivate *priv = shell_window->priv;
+
+ /* Need to disconnect handlers before we unref the shell. */
+ if (priv->signal_handler_ids != NULL) {
+ GArray *array = priv->signal_handler_ids;
+ gulong handler_id;
+ guint ii;
+
+ for (ii = 0; ii < array->len; ii++) {
+ handler_id = g_array_index (array, gulong, ii);
+ g_signal_handler_disconnect (priv->shell, handler_id);
+ }
+
+ g_array_free (array, TRUE);
+ priv->signal_handler_ids = NULL;
+ }
+
+ DISPOSE (priv->ui_manager);
+
+ g_hash_table_remove_all (priv->loaded_views);
+
+ DISPOSE (priv->main_menu);
+ DISPOSE (priv->main_toolbar);
+ DISPOSE (priv->menu_tool_button);
+ DISPOSE (priv->content_pane);
+ DISPOSE (priv->content_notebook);
+ DISPOSE (priv->sidebar_notebook);
+ DISPOSE (priv->switcher);
+ DISPOSE (priv->status_area);
+ DISPOSE (priv->online_button);
+ DISPOSE (priv->tooltip_label);
+ DISPOSE (priv->status_notebook);
+
+ priv->destroyed = TRUE;
+}
+
+void
+e_shell_window_private_finalize (EShellWindow *shell_window)
+{
+ EShellWindowPrivate *priv = shell_window->priv;
+
+ g_hash_table_destroy (priv->loaded_views);
+}
+
+void
+e_shell_window_switch_to_view (EShellWindow *shell_window,
+ const gchar *view_name)
+{
+ GtkNotebook *notebook;
+ EShellView *shell_view;
+ gint page_num;
+
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+ g_return_if_fail (view_name != NULL);
+
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+
+ page_num = e_shell_view_get_page_num (shell_view);
+ g_return_if_fail (page_num >= 0);
+
+ notebook = GTK_NOTEBOOK (shell_window->priv->content_notebook);
+ gtk_notebook_set_current_page (notebook, page_num);
+
+ notebook = GTK_NOTEBOOK (shell_window->priv->sidebar_notebook);
+ gtk_notebook_set_current_page (notebook, page_num);
+
+ notebook = GTK_NOTEBOOK (shell_window->priv->status_notebook);
+ gtk_notebook_set_current_page (notebook, page_num);
+
+ shell_window->priv->active_view = view_name;
+ g_object_notify (G_OBJECT (shell_window), "active-view");
+
+ e_shell_window_update_icon (shell_window);
+ e_shell_window_update_title (shell_window);
+ e_shell_window_update_new_menu (shell_window);
+ e_shell_window_update_view_menu (shell_window);
+ e_shell_window_update_search_menu (shell_window);
+
+ e_shell_view_update_actions (shell_view);
+}
+
+void
+e_shell_window_update_icon (EShellWindow *shell_window)
+{
+ EShellView *shell_view;
+ GtkAction *action;
+ const gchar *view_name;
+ gchar *icon_name = NULL;
+
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+
+ action = e_shell_view_get_action (shell_view);
+ g_object_get (action, "icon-name", &icon_name, NULL);
+ gtk_window_set_icon_name (GTK_WINDOW (shell_window), icon_name);
+ g_free (icon_name);
+}
+
+void
+e_shell_window_update_title (EShellWindow *shell_window)
+{
+ EShellView *shell_view;
+ const gchar *view_title;
+ const gchar *view_name;
+ gchar *window_title;
+
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ view_title = e_shell_view_get_title (shell_view);
+
+ /* Translators: This is used for the main window title. */
+ window_title = g_strdup_printf (_("%s - Evolution"), view_title);
+ gtk_window_set_title (GTK_WINDOW (shell_window), window_title);
+ g_free (window_title);
+}
+
+void
+e_shell_window_update_new_menu (EShellWindow *shell_window)
+{
+ GtkWidget *menu;
+ GtkWidget *widget;
+ const gchar *path;
+
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+
+ /* Update the "File -> New" submenu. */
+ path = "/main-menu/file-menu/new-menu";
+ menu = e_shell_window_create_new_menu (shell_window);
+ widget = e_shell_window_get_managed_widget (shell_window, path);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (widget), menu);
+ gtk_widget_show (widget);
+
+ /* Update the "New" menu tool button submenu. */
+ menu = e_shell_window_create_new_menu (shell_window);
+ widget = shell_window->priv->menu_tool_button;
+ gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (widget), menu);
+}
diff --git a/shell/e-shell-window-private.h b/shell/e-shell-window-private.h
new file mode 100644
index 0000000000..b0bfe7c63a
--- /dev/null
+++ b/shell/e-shell-window-private.h
@@ -0,0 +1,127 @@
+/*
+ * e-shell-window-private.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_SHELL_WINDOW_PRIVATE_H
+#define E_SHELL_WINDOW_PRIVATE_H
+
+#include "e-shell-window.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+
+#include <e-util/e-util.h>
+#include <e-util/e-binding.h>
+#include <e-util/gconf-bridge.h>
+#include <widgets/misc/e-menu-tool-button.h>
+#include <widgets/misc/e-online-button.h>
+
+#include <e-shell.h>
+#include <e-shell-content.h>
+#include <e-shell-view.h>
+#include <e-shell-switcher.h>
+#include <e-shell-window-actions.h>
+
+#define E_SHELL_WINDOW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SHELL_WINDOW, EShellWindowPrivate))
+
+/* Shorthand, requires a variable named "shell_window". */
+#define ACTION(name) \
+ (E_SHELL_WINDOW_ACTION_##name (shell_window))
+#define ACTION_GROUP(name) \
+ (E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window))
+
+/* For use in dispose() methods. */
+#define DISPOSE(obj) \
+ G_STMT_START { \
+ if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \
+ } G_STMT_END
+
+/* Format for switcher action names.
+ * The last part is the shell view name.
+ * (e.g. switch-to-mail, switch-to-calendar) */
+#define SWITCHER_FORMAT "switch-to-%s"
+
+G_BEGIN_DECLS
+
+struct _EShellWindowPrivate {
+
+ gpointer shell; /* weak pointer */
+
+ /*** UI Management ***/
+
+ GtkUIManager *ui_manager;
+ guint custom_rule_merge_id;
+ guint gal_view_merge_id;
+
+ /*** Shell Views ***/
+
+ GHashTable *loaded_views;
+ const gchar *active_view;
+
+ /*** Widgetry ***/
+
+ GtkWidget *main_menu;
+ GtkWidget *main_toolbar;
+ GtkWidget *menu_tool_button;
+ GtkWidget *content_pane;
+ GtkWidget *content_notebook;
+ GtkWidget *sidebar_notebook;
+ GtkWidget *switcher;
+ GtkWidget *status_area;
+ GtkWidget *online_button;
+ GtkWidget *tooltip_label;
+ GtkWidget *status_notebook;
+
+ /* Miscellaneous */
+
+ /* Shell signal handlers. */
+ GArray *signal_handler_ids;
+
+ guint destroyed : 1; /* XXX Do we still need this? */
+ guint safe_mode : 1;
+};
+
+void e_shell_window_private_init (EShellWindow *shell_window);
+void e_shell_window_private_constructed
+ (EShellWindow *shell_window);
+void e_shell_window_private_dispose (EShellWindow *shell_window);
+void e_shell_window_private_finalize (EShellWindow *shell_window);
+
+/* Private Utilities */
+
+void e_shell_window_actions_init (EShellWindow *shell_window);
+void e_shell_window_switch_to_view (EShellWindow *shell_window,
+ const gchar *view_name);
+GtkWidget * e_shell_window_create_new_menu (EShellWindow *shell_window);
+void e_shell_window_create_switcher_actions
+ (EShellWindow *shell_window);
+void e_shell_window_update_gal_view (EShellWindow *shell_window);
+void e_shell_window_update_icon (EShellWindow *shell_window);
+void e_shell_window_update_title (EShellWindow *shell_window);
+void e_shell_window_update_new_menu (EShellWindow *shell_window);
+void e_shell_window_update_view_menu (EShellWindow *shell_window);
+void e_shell_window_update_search_menu
+ (EShellWindow *shell_window);
+
+G_END_DECLS
+
+#endif /* E_SHELL_WINDOW_PRIVATE_H */
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 83e537c31b..bb913f74ea 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -1,4 +1,6 @@
/*
+ * e-shell-window.c
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,1260 +15,873 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-shell-window.h"
-#include "e-shell-view.h"
-
-#include "Evolution.h"
-
-#include "e-util/e-util-private.h"
-#include "widgets/misc/e-online-button.h"
-
-#include "e-component-registry.h"
-#include "e-shell-window-commands.h"
-#include "e-sidebar.h"
-#include "es-menu.h"
-#include "es-event.h"
-
-#include <gtk/gtk.h>
-
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-widget.h>
-
-#include <glib/gi18n.h>
+#include "e-shell-window-private.h"
#include <gconf/gconf-client.h>
-#include <string.h>
+#include <es-event.h>
-#if NM_SUPPORT
-gboolean e_shell_dbus_initialise (EShell *shell);
-#endif
+#include <e-util/e-plugin-ui.h>
+#include <e-util/e-util-private.h>
-/* A view for each component. These are all created when EShellWindow is
- instantiated, but with the widget pointers to NULL and the page number set
- to -1. When the views are created the first time, the widget pointers as
- well as the notebook page value get set. */
-struct _ComponentView {
- int button_id;
- char *component_id;
- char *component_alias;
-
- GNOME_Evolution_ComponentView component_view;
- char *title;
-
- GtkWidget *sidebar_widget;
- GtkWidget *view_widget;
- GtkWidget *statusbar_widget;
-
- int notebook_page_num;
+enum {
+ PROP_0,
+ PROP_ACTIVE_VIEW,
+ PROP_SAFE_MODE,
+ PROP_SHELL,
+ PROP_UI_MANAGER
};
-typedef struct _ComponentView ComponentView;
-
-
-struct _EShellWindowPrivate {
- union {
- EShell *eshell;
- gpointer pointer;
- } shell;
-
- EShellView *shell_view; /* CORBA wrapper for this, just a placeholder */
-
- /* plugin menu manager */
- ESMenu *menu;
- /* All the ComponentViews. */
- GSList *component_views;
+static gpointer parent_class;
- /* The paned widget for the sidebar and component views */
- GtkWidget *paned;
-
- /* The sidebar. */
- GtkWidget *sidebar;
-
- /* Notebooks used to switch between components. */
- GtkWidget *sidebar_notebook;
- GtkWidget *view_notebook;
- GtkWidget *statusbar_notebook;
-
- /* Bonobo foo. */
- BonoboUIComponent *ui_component;
-
- /* The current view (can be NULL initially). */
- ComponentView *current_view;
-
- /* The status bar widgetry. */
- GtkWidget *status_bar;
- GtkWidget *offline_toggle;
- GtkWidget *menu_hint_label;
-
- /* The timeout for saving the window size */
- guint store_window_size_timer;
- gboolean destroyed;
-};
+static EShellView *
+shell_window_new_view (EShellBackend *shell_backend,
+ EShellWindow *shell_window)
+{
+ GHashTable *loaded_views;
+ EShellView *shell_view;
+ GtkNotebook *notebook;
+ GtkAction *action;
+ GtkWidget *widget;
+ const gchar *name;
+ gint page_num;
+ GType type;
+ name = E_SHELL_BACKEND_GET_CLASS (shell_backend)->name;
+ type = E_SHELL_BACKEND_GET_CLASS (shell_backend)->shell_view_type;
-enum {
- COMPONENT_CHANGED,
- LAST_SIGNAL
-};
+ /* First off, start the shell backend. */
+ e_shell_backend_start (shell_backend);
-static guint signals[LAST_SIGNAL] = { 0 };
+ /* Determine the page number for the new shell view. */
+ notebook = GTK_NOTEBOOK (shell_window->priv->content_notebook);
+ page_num = gtk_notebook_get_n_pages (notebook);
-G_DEFINE_TYPE (EShellWindow, e_shell_window, BONOBO_TYPE_WINDOW)
+ /* Get the switcher action for this view. */
+ action = e_shell_window_get_shell_view_action (shell_window, name);
-static gboolean store_window_size (GtkWidget* widget);
+ /* Create the shell view. */
+ shell_view = g_object_new (
+ type, "action", action, "page-num",page_num,
+ "shell-window", shell_window, NULL);
-/* ComponentView handling. */
+ /* Register the shell view. */
+ loaded_views = shell_window->priv->loaded_views;
+ g_hash_table_insert (loaded_views, g_strdup (name), shell_view);
-static ComponentView *
-component_view_new (const char *id, const char *alias, int button_id)
-{
- ComponentView *view = g_new0 (ComponentView, 1);
+ /* Add pages to the various shell window notebooks. */
- view->component_id = g_strdup (id);
- view->component_alias = g_strdup (alias);
- view->button_id = button_id;
- view->notebook_page_num = -1;
+ /* We can't determine the shell view's page number until after the
+ * shell view is fully initialized because the shell view may load
+ * other shell views during initialization, and those other shell
+ * views will append their widgets to the notebooks before us. */
+ page_num = gtk_notebook_get_n_pages (notebook);
+ e_shell_view_set_page_num (shell_view, page_num);
- return view;
-}
+ notebook = GTK_NOTEBOOK (shell_window->priv->content_notebook);
+ widget = GTK_WIDGET (e_shell_view_get_shell_content (shell_view));
+ gtk_notebook_append_page (notebook, widget, NULL);
-static void
-component_view_free (ComponentView *view)
-{
- if (view->component_view) {
- CORBA_Environment ev = { NULL };
+ notebook = GTK_NOTEBOOK (shell_window->priv->sidebar_notebook);
+ widget = GTK_WIDGET (e_shell_view_get_shell_sidebar (shell_view));
+ gtk_notebook_append_page (notebook, widget, NULL);
- CORBA_Object_release(view->component_view, &ev);
- CORBA_exception_free(&ev);
- }
+ notebook = GTK_NOTEBOOK (shell_window->priv->status_notebook);
+ widget = GTK_WIDGET (e_shell_view_get_shell_taskbar (shell_view));
+ gtk_notebook_append_page (notebook, widget, NULL);
- g_free (view->component_id);
- g_free (view->component_alias);
- g_free (view->title);
- g_free (view);
-}
+ /* Listen for changes that affect the shell window. */
-static void
-component_view_deactivate (ComponentView *view)
-{
- BonoboControlFrame *view_control_frame;
- BonoboControlFrame *sidebar_control_frame;
+ g_signal_connect_swapped (
+ action, "notify::icon-name",
+ G_CALLBACK (e_shell_window_update_icon), shell_window);
- g_return_if_fail (view->sidebar_widget != NULL);
- g_return_if_fail (view->view_widget != NULL);
+ g_signal_connect_swapped (
+ shell_view, "notify::title",
+ G_CALLBACK (e_shell_window_update_title), shell_window);
- view_control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (view->view_widget));
- bonobo_control_frame_control_deactivate (view_control_frame);
+ g_signal_connect_swapped (
+ shell_view, "notify::view-id",
+ G_CALLBACK (e_shell_window_update_view_menu), shell_window);
- sidebar_control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (view->sidebar_widget));
- bonobo_control_frame_control_deactivate (sidebar_control_frame);
+ return shell_view;
}
static void
-component_view_activate (ComponentView *view)
+shell_window_update_close_action_cb (EShellWindow *shell_window)
{
- BonoboControlFrame *view_control_frame;
- BonoboControlFrame *sidebar_control_frame;
+ EShell *shell;
+ GList *watched_windows;
+ gint n_shell_windows = 0;
- g_return_if_fail (view->sidebar_widget != NULL);
- g_return_if_fail (view->view_widget != NULL);
+ shell = e_shell_window_get_shell (shell_window);
+ watched_windows = e_shell_get_watched_windows (shell);
- view_control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (view->view_widget));
- bonobo_control_frame_control_activate (view_control_frame);
+ /* Count the shell windows. */
+ while (watched_windows != NULL) {
+ if (E_IS_SHELL_WINDOW (watched_windows->data))
+ n_shell_windows++;
+ watched_windows = g_list_next (watched_windows);
+ }
- sidebar_control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (view->sidebar_widget));
- bonobo_control_frame_control_activate (sidebar_control_frame);
+ /* Disable Close Window if there's only one shell window.
+ * Helps prevent users from accidentally quitting. */
+ gtk_action_set_sensitive (ACTION (CLOSE), n_shell_windows > 1);
}
static void
-init_view (EShellWindow *window,
- ComponentView *view)
+shell_window_set_shell (EShellWindow *shell_window,
+ EShell *shell)
{
- EShellWindowPrivate *priv = window->priv;
- EComponentRegistry *registry = e_shell_peek_component_registry (window->priv->shell.eshell);
- GNOME_Evolution_Component component_iface;
- GNOME_Evolution_ComponentView component_view;
- Bonobo_UIContainer container;
- Bonobo_Control sidebar_control;
- Bonobo_Control view_control;
- Bonobo_Control statusbar_control;
- CORBA_boolean select_item;
- CORBA_Environment ev;
- int sidebar_notebook_page_num;
- int view_notebook_page_num;
-
- g_return_if_fail (view->view_widget == NULL);
- g_return_if_fail (view->sidebar_widget == NULL);
- g_return_if_fail (view->notebook_page_num == -1);
-
- select_item = !e_shell_get_crash_recovery (priv->shell.eshell);
- e_shell_set_crash_recovery (priv->shell.eshell, FALSE);
-
- CORBA_exception_init (&ev);
-
- /* 1. Activate component. (FIXME: Shouldn't do this here.) */
-
- component_iface = e_component_registry_activate (registry, view->component_id, &ev);
- if (BONOBO_EX (&ev) || component_iface == CORBA_OBJECT_NIL) {
- char *ex_text = bonobo_exception_get_text (&ev);
- g_warning ("Cannot activate component %s: %s", view->component_id, ex_text);
- g_free (ex_text);
- CORBA_exception_free (&ev);
- return;
- }
-
- /* 2. Set up view. */
-
- /* The rest of the code assumes that the component is valid and can create
- controls; if this fails something is really wrong in the component
- (e.g. methods not implemented)... So handle it as if there was no
- component at all. */
-
- component_view = GNOME_Evolution_Component_createView(component_iface, BONOBO_OBJREF(priv->shell_view), select_item, &ev);
- if (component_view == NULL || BONOBO_EX (&ev)) {
- g_warning ("Cannot create view for %s", view->component_id);
- bonobo_object_release_unref (component_iface, NULL);
- CORBA_exception_free (&ev);
- return;
- }
-
- GNOME_Evolution_ComponentView_getControls(component_view, &sidebar_control, &view_control, &statusbar_control, &ev);
- if (BONOBO_EX (&ev)) {
- g_warning ("Cannot create view for %s", view->component_id);
- bonobo_object_release_unref (component_iface, NULL);
- CORBA_exception_free (&ev);
- return;
- }
-
- view->component_view = component_view;
-
- CORBA_exception_free (&ev);
+ GArray *array;
+ gulong handler_id;
- container = bonobo_ui_component_get_container (priv->ui_component);
+ g_return_if_fail (shell_window->priv->shell == NULL);
- view->sidebar_widget = bonobo_widget_new_control_from_objref (sidebar_control, container);
- gtk_widget_show (view->sidebar_widget);
- bonobo_object_release_unref (sidebar_control, NULL);
+ shell_window->priv->shell = shell;
- view->view_widget = bonobo_widget_new_control_from_objref (view_control, container);
- gtk_widget_show (view->view_widget);
- bonobo_object_release_unref (view_control, NULL);
+ g_object_add_weak_pointer (
+ G_OBJECT (shell_window),
+ &shell_window->priv->shell);
- view->statusbar_widget = bonobo_widget_new_control_from_objref (statusbar_control, container);
- gtk_widget_show (view->statusbar_widget);
- bonobo_object_release_unref (statusbar_control, NULL);
+ /* Need to disconnect these when the window is closing. */
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->sidebar_notebook), view->sidebar_widget, NULL);
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->view_notebook), view->view_widget, NULL);
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->statusbar_notebook), view->statusbar_widget, NULL);
+ array = shell_window->priv->signal_handler_ids;
- sidebar_notebook_page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->sidebar_notebook), view->sidebar_widget);
- view_notebook_page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->view_notebook), view->view_widget);
+ handler_id = g_signal_connect_swapped (
+ shell, "window-created",
+ G_CALLBACK (shell_window_update_close_action_cb),
+ shell_window);
- /* Since we always add a view page and a sidebar page at the same time... */
- g_return_if_fail (sidebar_notebook_page_num == view_notebook_page_num);
+ g_array_append_val (array, handler_id);
- view->notebook_page_num = view_notebook_page_num;
+ handler_id = g_signal_connect_swapped (
+ shell, "window-destroyed",
+ G_CALLBACK (shell_window_update_close_action_cb),
+ shell_window);
- /* 3. Switch to the new page. */
+ g_array_append_val (array, handler_id);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->view_notebook), view_notebook_page_num);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->sidebar_notebook), view_notebook_page_num);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->statusbar_notebook), view_notebook_page_num);
-
- if (priv->current_view != NULL)
- component_view_deactivate (priv->current_view);
- priv->current_view = view;
- component_view_activate (view);
-
- bonobo_object_release_unref (component_iface, NULL);
+ g_object_notify (G_OBJECT (shell), "online");
}
static void
-switch_view (EShellWindow *window, ComponentView *component_view)
+shell_window_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- EShellWindowPrivate *priv = window->priv;
- GConfClient *gconf_client = gconf_client_get_default ();
- EComponentRegistry *registry = e_shell_peek_component_registry (window->priv->shell.eshell);
- EComponentInfo *info = e_component_registry_peek_info (registry,
- ECR_FIELD_ID,
- component_view->component_id);
- char *title;
-
- if (component_view->sidebar_widget == NULL) {
- init_view (window, component_view);
- } else {
- if (priv->current_view != NULL)
- component_view_deactivate (priv->current_view);
- priv->current_view = component_view;
- component_view_activate (component_view);
-
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->view_notebook), component_view->notebook_page_num);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->sidebar_notebook), component_view->notebook_page_num);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->statusbar_notebook), component_view->notebook_page_num);
- }
-
- if (component_view->title == NULL) {
- /* To translators: This is the window title and %s is the
- component name. Most translators will want to keep it as is. */
- title = g_strdup_printf (_("%s - Evolution"), info->button_label);
- gtk_window_set_title (GTK_WINDOW (window), title);
- g_free (title);
- } else
- gtk_window_set_title (GTK_WINDOW (window), component_view->title);
-
- if (info->icon_name)
- gtk_window_set_icon_name (GTK_WINDOW (window), info->icon_name);
-
- gconf_client_set_string (gconf_client, "/apps/evolution/shell/view_defaults/component_id",
- (component_view->component_alias != NULL
- ? component_view->component_alias
- : component_view->component_id),
- NULL);
-
- g_object_unref (gconf_client);
-
- /** @Event: Shell component activated or switched to.
- * @Id: component.activated
- * @Target: ESEventTargetComponent
- *
- * This event is emitted whenever the shell successfully activates component
- * view.
- */
- e_event_emit ((EEvent *) es_event_peek (), "component.activated", (EEventTarget *) es_event_target_new_component (es_event_peek (), component_view->component_id));
-
- g_signal_emit (window, signals[COMPONENT_CHANGED], 0);
-}
-
+ switch (property_id) {
+ case PROP_ACTIVE_VIEW:
+ e_shell_window_set_active_view (
+ E_SHELL_WINDOW (object),
+ g_value_get_string (value));
+ return;
-/* Functions to update the sensitivity of buttons and menu items depending on the status. */
+ case PROP_SAFE_MODE:
+ e_shell_window_set_safe_mode (
+ E_SHELL_WINDOW (object),
+ g_value_get_boolean (value));
+ return;
-static void
-update_offline_toggle_status (EShellWindow *window)
-{
- EShellWindowPrivate *priv;
- GtkWidget *widget;
- const gchar *tooltip;
- gboolean online;
- gboolean sensitive;
- guint32 flags = 0;
- ESMenuTargetShell *t;
-
- priv = window->priv;
-
- switch (e_shell_get_line_status (priv->shell.eshell)) {
- case E_SHELL_LINE_STATUS_ONLINE:
- online = TRUE;
- sensitive = TRUE;
- tooltip = _("Evolution is currently online.\n"
- "Click on this button to work offline.");
- flags = ES_MENU_SHELL_ONLINE;
- break;
- case E_SHELL_LINE_STATUS_GOING_OFFLINE:
- online = TRUE;
- sensitive = FALSE;
- tooltip = _("Evolution is in the process of going offline.");
- flags = ES_MENU_SHELL_OFFLINE;
- break;
- case E_SHELL_LINE_STATUS_OFFLINE:
- case E_SHELL_LINE_STATUS_FORCED_OFFLINE:
- online = FALSE;
- sensitive = TRUE;
- tooltip = _("Evolution is currently offline.\n"
- "Click on this button to work online.");
- flags = ES_MENU_SHELL_OFFLINE;
- break;
- default:
- g_return_if_reached ();
+ case PROP_SHELL:
+ shell_window_set_shell (
+ E_SHELL_WINDOW (object),
+ g_value_get_object (value));
+ return;
}
- widget = window->priv->offline_toggle;
- gtk_widget_set_sensitive (widget, sensitive);
- gtk_widget_set_tooltip_text (widget, tooltip);
- e_online_button_set_online (E_ONLINE_BUTTON (widget), online);
-
- /* TODO: If we get more shell flags, this should be centralised */
- t = es_menu_target_new_shell(priv->menu, flags);
- t->target.widget = (GtkWidget *)window;
- e_menu_update_target((EMenu *)priv->menu, t);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-update_send_receive_sensitivity (EShellWindow *window)
+shell_window_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- if (e_shell_get_line_status (window->priv->shell.eshell) == E_SHELL_LINE_STATUS_OFFLINE ||
- e_shell_get_line_status (window->priv->shell.eshell) == E_SHELL_LINE_STATUS_FORCED_OFFLINE)
- bonobo_ui_component_set_prop (window->priv->ui_component,
- "/commands/SendReceive",
- "sensitive", "0", NULL);
- else
- bonobo_ui_component_set_prop (window->priv->ui_component,
- "/commands/SendReceive",
- "sensitive", "1", NULL);
-}
-
+ switch (property_id) {
+ case PROP_ACTIVE_VIEW:
+ g_value_set_string (
+ value, e_shell_window_get_active_view (
+ E_SHELL_WINDOW (object)));
+ return;
-/* Callbacks. */
+ case PROP_SAFE_MODE:
+ g_value_set_boolean (
+ value, e_shell_window_get_safe_mode (
+ E_SHELL_WINDOW (object)));
+ return;
-static ComponentView *
-get_component_view (EShellWindow *window, int id)
-{
- GSList *p;
+ case PROP_SHELL:
+ g_value_set_object (
+ value, e_shell_window_get_shell (
+ E_SHELL_WINDOW (object)));
+ return;
- for (p = window->priv->component_views; p; p = p->next) {
- if (((ComponentView *) p->data)->button_id == id)
- return p->data;
+ case PROP_UI_MANAGER:
+ g_value_set_object (
+ value, e_shell_window_get_ui_manager (
+ E_SHELL_WINDOW (object)));
+ return;
}
- g_warning ("Unknown component button id %d", id);
- return NULL;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-sidebar_button_selected_callback (ESidebar *sidebar,
- int button_id,
- EShellWindow *window)
+shell_window_dispose (GObject *object)
{
- ComponentView *component_view;
-
- if ((component_view = get_component_view (window, button_id)))
- switch_view (window, component_view);
-}
+ e_shell_window_private_dispose (E_SHELL_WINDOW (object));
-static gboolean
-sidebar_button_pressed_callback (ESidebar *sidebar,
- GdkEventButton *event,
- int button_id,
- EShellWindow *window)
-{
- if (event->type == GDK_BUTTON_PRESS &&
- event->button == 2) {
- /* open it in a new window */
- ComponentView *component_view;
-
- if ((component_view = get_component_view (window, button_id))) {
- e_shell_create_window (window->priv->shell.eshell,
- component_view->component_id,
- window);
- }
- return TRUE;
- }
- return FALSE;
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-offline_toggle_clicked_cb (EShellWindow *window)
+shell_window_finalize (GObject *object)
{
- EShell *shell;
- GNOME_Evolution_ShellState shell_state;
-
- shell = window->priv->shell.eshell;
-
- switch (e_shell_get_line_status (shell)) {
- case E_SHELL_LINE_STATUS_ONLINE:
- shell_state = GNOME_Evolution_USER_OFFLINE;
- break;
- case E_SHELL_LINE_STATUS_OFFLINE:
- case E_SHELL_LINE_STATUS_FORCED_OFFLINE:
- shell_state = GNOME_Evolution_USER_ONLINE;
- break;
- default:
- g_return_if_reached();
- }
+ e_shell_window_private_finalize (E_SHELL_WINDOW (object));
- e_shell_set_line_status (shell, shell_state);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-shell_line_status_changed_callback (EShell *shell,
- EShellLineStatus new_status,
- EShellWindow *window)
+shell_window_constructed (GObject *object)
{
- update_offline_toggle_status (window);
- update_send_receive_sensitivity (window);
+ e_shell_window_private_constructed (E_SHELL_WINDOW (object));
}
static void
-ui_engine_add_hint_callback (BonoboUIEngine *engine,
- const char *hint,
- EShellWindow *window)
+shell_window_class_init (EShellWindowClass *class)
{
- gtk_label_set_text (GTK_LABEL (window->priv->menu_hint_label), hint);
- gtk_widget_show (window->priv->menu_hint_label);
- gtk_widget_hide (window->priv->statusbar_notebook);
-}
+ GObjectClass *object_class;
-static void
-ui_engine_remove_hint_callback (BonoboUIEngine *engine,
- EShellWindow *window)
-{
- gtk_widget_hide (window->priv->menu_hint_label);
- gtk_widget_show (window->priv->statusbar_notebook);
-}
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EShellWindowPrivate));
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = shell_window_set_property;
+ object_class->get_property = shell_window_get_property;
+ object_class->dispose = shell_window_dispose;
+ object_class->finalize = shell_window_finalize;
+ object_class->constructed = shell_window_constructed;
-/* Widgetry. */
-
-static void
-setup_offline_toggle (EShellWindow *window)
-{
- GtkWidget *widget;
-
- g_return_if_fail (window->priv->status_bar != NULL);
-
- widget = e_online_button_new ();
- g_signal_connect_swapped (
- widget, "clicked",
- G_CALLBACK (offline_toggle_clicked_cb), window);
- gtk_box_pack_start (
- GTK_BOX (window->priv->status_bar),
- widget, FALSE, TRUE, 0);
- window->priv->offline_toggle = widget;
- gtk_widget_show (widget);
-
- update_offline_toggle_status (window);
+ /**
+ * EShellWindow:active-view
+ *
+ * Name of the active #EShellView.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_ACTIVE_VIEW,
+ g_param_spec_string (
+ "active-view",
+ _("Active Shell View"),
+ _("Name of the active shell view"),
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * EShellWindow:safe-mode
+ *
+ * Whether the shell window is in safe mode.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SAFE_MODE,
+ g_param_spec_boolean (
+ "safe-mode",
+ _("Safe Mode"),
+ _("Whether the shell window is in safe mode"),
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ /**
+ * EShellWindow:shell
+ *
+ * The #EShell singleton.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL,
+ g_param_spec_object (
+ "shell",
+ _("Shell"),
+ _("The EShell singleton"),
+ E_TYPE_SHELL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * EShellWindow:ui-manager
+ *
+ * The shell window's #GtkUIManager.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_UI_MANAGER,
+ g_param_spec_object (
+ "ui-manager",
+ _("UI Manager"),
+ _("The shell window's GtkUIManager"),
+ GTK_TYPE_UI_MANAGER,
+ G_PARAM_READABLE));
}
static void
-setup_menu_hint_label (EShellWindow *window)
+shell_window_init (EShellWindow *shell_window)
{
- EShellWindowPrivate *priv;
-
- priv = window->priv;
+ GtkUIManager *ui_manager;
+ const gchar *id;
- priv->menu_hint_label = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (priv->menu_hint_label), 0.0, 0.5);
-
- gtk_box_pack_start (GTK_BOX (priv->status_bar), priv->menu_hint_label, TRUE, TRUE, 0);
-}
-
-static void
-setup_statusbar_notebook (EShellWindow *window)
-{
- EShellWindowPrivate *priv;
+ shell_window->priv = E_SHELL_WINDOW_GET_PRIVATE (shell_window);
- priv = window->priv;
+ gtk_window_set_title (GTK_WINDOW (shell_window), _("Evolution"));
- priv->statusbar_notebook = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->statusbar_notebook), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->statusbar_notebook), FALSE);
+ e_shell_window_private_init (shell_window);
- gtk_box_pack_start (GTK_BOX (priv->status_bar), priv->statusbar_notebook, TRUE, TRUE, 0);
- gtk_widget_show (priv->statusbar_notebook);
-}
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
-static void
-setup_nm_support (EShellWindow *window)
-{
-#if NM_SUPPORT
- e_shell_dbus_initialise (window->priv->shell.eshell);
-#endif
+ id = "org.gnome.evolution.shell";
+ e_plugin_ui_register_manager (ui_manager, id, shell_window);
+ e_plugin_ui_enable_manager (ui_manager, id);
}
-static void
-setup_status_bar (EShellWindow *window)
+GType
+e_shell_window_get_type (void)
{
- EShellWindowPrivate *priv;
- BonoboUIEngine *ui_engine;
- GConfClient *gconf_client;
- gint height;
-
- priv = window->priv;
-
- priv->status_bar = gtk_hbox_new (FALSE, 2);
-
- /* Make the status bar as large as the task bar. */
- gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &height);
- gtk_widget_set_size_request (GTK_WIDGET (priv->status_bar), -1, height * 2);
+ static GType type = 0;
- gconf_client = gconf_client_get_default ();
- if(gconf_client_get_bool (gconf_client,"/apps/evolution/shell/view_defaults/statusbar_visible",NULL))
- gtk_widget_show (priv->status_bar);
- g_object_unref (gconf_client);
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (EShellWindowClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) shell_window_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EShellWindow),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) shell_window_init,
+ NULL /* value_table */
+ };
- /* setup dbus interface here*/
- setup_nm_support (window);
-
- setup_offline_toggle (window);
- setup_menu_hint_label (window);
- setup_statusbar_notebook (window);
-
- ui_engine = bonobo_window_get_ui_engine (BONOBO_WINDOW (window));
+ type = g_type_register_static (
+ GTK_TYPE_WINDOW, "EShellWindow", &type_info, 0);
+ }
- g_signal_connect (ui_engine, "add_hint", G_CALLBACK (ui_engine_add_hint_callback), window);
- g_signal_connect (ui_engine, "remove_hint", G_CALLBACK (ui_engine_remove_hint_callback), window);
+ return type;
}
-static void
-menu_component_selected (BonoboUIComponent *uic,
- EShellWindow *window,
- const char *path)
+/**
+ * e_shell_window_new:
+ * @shell: an #EShell
+ * @safe_mode: whether to initialize the window to "safe mode"
+ *
+ * Returns a new #EShellWindow.
+ *
+ * It's up to the various #EShellView<!-- -->'s to define exactly
+ * what "safe mode" means, but the #EShell usually puts the initial
+ * #EShellWindow into "safe mode" if detects the previous Evolution
+ * session crashed.
+ *
+ * The initial view for the window is determined by GConf key
+ * <filename>/apps/evolution/shell/view_defaults/component_id</filename>.
+ * Or, if the GConf key is not set or can't be read, the first view
+ * in the switcher is used.
+ *
+ * Returns: a new #EShellWindow
+ **/
+GtkWidget *
+e_shell_window_new (EShell *shell,
+ gboolean safe_mode)
{
- char *component_id;
-
- component_id = strchr(path, '-');
- if (component_id)
- e_shell_window_switch_to_component (window, component_id+1);
+ return g_object_new (
+ E_TYPE_SHELL_WINDOW,
+ "shell", shell, "safe-mode", safe_mode, NULL);
}
-static GConfEnumStringPair button_styles[] = {
- { E_SIDEBAR_MODE_TEXT, "text" },
- { E_SIDEBAR_MODE_ICON, "icons" },
- { E_SIDEBAR_MODE_BOTH, "both" },
- { E_SIDEBAR_MODE_TOOLBAR, "toolbar" },
- { -1, NULL }
-};
-
-static void
-setup_widgets (EShellWindow *window)
+/**
+ * e_shell_window_get_shell:
+ * @shell_window: an #EShellWindow
+ *
+ * Returns the #EShell that was passed to e_shell_window_new().
+ *
+ * Returns: the #EShell
+ **/
+EShell *
+e_shell_window_get_shell (EShellWindow *shell_window)
{
- EShellWindowPrivate *priv = window->priv;
- EComponentRegistry *registry = e_shell_peek_component_registry (priv->shell.eshell);
- GConfClient *gconf_client = gconf_client_get_default ();
- GtkWidget *contents_vbox;
- GSList *p;
- GString *xml;
- int button_id;
- gboolean visible;
- char *style;
- int mode;
-
- priv->paned = gtk_hpaned_new ();
- gtk_widget_show (priv->paned);
-
- priv->sidebar = e_sidebar_new ();
- g_signal_connect (priv->sidebar, "button_selected",
- G_CALLBACK (sidebar_button_selected_callback), window);
- g_signal_connect (priv->sidebar, "button_pressed",
- G_CALLBACK (sidebar_button_pressed_callback), window);
- gtk_paned_pack1 (GTK_PANED (priv->paned), priv->sidebar, FALSE, FALSE);
- gtk_widget_show (priv->sidebar);
-
- priv->sidebar_notebook = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->sidebar_notebook), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->sidebar_notebook), FALSE);
- e_sidebar_set_selection_widget (E_SIDEBAR (priv->sidebar), priv->sidebar_notebook);
- gtk_widget_show (priv->sidebar_notebook);
-
- priv->view_notebook = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->view_notebook), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->view_notebook), FALSE);
- gtk_paned_pack2 (GTK_PANED (priv->paned), priv->view_notebook, TRUE, FALSE);
- gtk_widget_show (priv->view_notebook);
-
- gtk_paned_set_position (GTK_PANED (priv->paned),
- gconf_client_get_int (gconf_client, "/apps/evolution/shell/view_defaults/folder_bar/width", NULL));
-
- /* The buttons */
- visible = gconf_client_get_bool (gconf_client,
- "/apps/evolution/shell/view_defaults/buttons_visible",
- NULL);
- bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
- "/commands/ViewButtonsHide",
- "state",
- visible ? "0" : "1",
- NULL);
-
- e_sidebar_set_show_buttons (E_SIDEBAR (priv->sidebar), visible);
-
- style = gconf_client_get_string (gconf_client,
- "/apps/evolution/shell/view_defaults/buttons_style",
- NULL);
-
- if (gconf_string_to_enum (button_styles, style, &mode)) {
- switch (mode) {
- case E_SIDEBAR_MODE_TEXT:
- bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
- "/commands/ViewButtonsText",
- "state", "1", NULL);
- break;
- case E_SIDEBAR_MODE_ICON:
- bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
- "/commands/ViewButtonsIcon",
- "state", "1", NULL);
- break;
- case E_SIDEBAR_MODE_BOTH:
- bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
- "/commands/ViewButtonsIconText",
- "state", "1", NULL);
- break;
-
- case E_SIDEBAR_MODE_TOOLBAR:
- bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
- "/commands/ViewButtonsToolbar",
- "state", "1", NULL);
- break;
- }
-
- e_sidebar_set_mode (E_SIDEBAR (priv->sidebar), mode);
- }
- g_free (style);
-
- /* Status Bar*/
- visible = gconf_client_get_bool (gconf_client,
- "/apps/evolution/shell/view_defaults/statusbar_visible",
- NULL);
- bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
- "/commands/ViewStatusBar",
- "state",
- visible ? "1" : "0",
- NULL);
-
- /* Side Bar*/
- visible = gconf_client_get_bool (gconf_client,
- "/apps/evolution/shell/view_defaults/sidebar_visible",
- NULL);
- bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
- "/commands/ViewSideBar",
- "state",
- visible ? "1" : "0",
- NULL);
-
- /* The tool bar */
- visible = gconf_client_get_bool (gconf_client,
- "/apps/evolution/shell/view_defaults/toolbar_visible",
- NULL);
- bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
- "/commands/ViewToolbar",
- "state",
- visible ? "1" : "0",
- NULL);
- bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
- "/Toolbar",
- "hidden",
- visible ? "0" : "1",
- NULL);
-
- button_id = 0;
- xml = g_string_new("");
- for (p = e_component_registry_peek_list (registry); p != NULL; p = p->next) {
- char *tmp, *tmp2;
- EComponentInfo *info = p->data;
- ComponentView *view = component_view_new (info->id, info->alias, button_id);
- GtkIconInfo *icon_info;
- gint width;
-
- window->priv->component_views = g_slist_prepend (window->priv->component_views, view);
-
- if (!info->button_label || !info->menu_label)
- continue;
- e_sidebar_add_button (E_SIDEBAR (priv->sidebar), info->button_label, info->button_tooltips, info->icon_name, button_id);
-
- g_string_printf(xml, "SwitchComponent-%s", info->alias);
- bonobo_ui_component_add_verb (e_shell_window_peek_bonobo_ui_component (window),
- xml->str,
- (BonoboUIVerbFn)menu_component_selected,
- window);
-
- g_string_printf(xml, "<submenu name=\"View\">"
- "<submenu name=\"Window\">"
- "<placeholder name=\"WindowComponent\">"
- "<menuitem name=\"SwitchComponent-%s\" "
- "verb=\"\" label=\"%s\" accel=\"%s\" tip=\"",
- info->alias,
- info->menu_label,
- info->menu_accelerator);
- tmp = g_strdup_printf (_("Switch to %s"), info->button_label);
- tmp2 = g_markup_escape_text (tmp, -1);
- g_string_append (xml, tmp2);
- g_free (tmp2);
- g_free (tmp);
-
- gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, NULL);
- icon_info = gtk_icon_theme_lookup_icon (
- gtk_icon_theme_get_default (),
- info->icon_name, width, 0);
- g_string_append_printf(xml, "\" pixtype=\"filename\" pixname=\"%s\"/>"
- "</placeholder></submenu></submenu>\n",
- icon_info ? gtk_icon_info_get_filename (icon_info) : "");
- gtk_icon_info_free (icon_info);
- bonobo_ui_component_set_translate (e_shell_window_peek_bonobo_ui_component (window),
- "/menu",
- xml->str,
- NULL);
- g_string_printf(xml, "<cmd name=\"SwitchComponent-%s\"/>\n", info->alias);
- bonobo_ui_component_set_translate (e_shell_window_peek_bonobo_ui_component (window),
- "/commands",
- xml->str,
- NULL);
- button_id ++;
- }
- g_string_free(xml, TRUE);
-
- setup_status_bar (window);
-
- contents_vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (contents_vbox), priv->paned, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (contents_vbox), priv->status_bar, FALSE, TRUE, 0);
- gtk_widget_show (contents_vbox);
+ g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), NULL);
- /* We only display this when a menu item is actually selected. */
- gtk_widget_hide (priv->menu_hint_label);
-
- bonobo_window_set_contents (BONOBO_WINDOW (window), contents_vbox);
- g_object_unref (gconf_client);
+ return E_SHELL (shell_window->priv->shell);
}
-
-/* GObject methods. */
-
-static void
-impl_dispose (GObject *object)
+/**
+ * e_shell_window_get_shell_view:
+ * @shell_window: an #EShellWindow
+ * @view_name: name of a shell view
+ *
+ * Returns the #EShellView named @view_name (see the
+ * <structfield>name</structfield> field in #EShellBackendInfo). This
+ * will also instantiate the #EShellView the first time it's requested.
+ * To reduce resource consumption, Evolution tries to delay instantiating
+ * shell views until the user switches to them. So in general, only the
+ * active view name, as returned by e_shell_window_get_active_view(),
+ * should be requested.
+ *
+ * Returns: the requested #EShellView, or %NULL if no such view is
+ * registered
+ **/
+EShellView *
+e_shell_window_get_shell_view (EShellWindow *shell_window,
+ const gchar *view_name)
{
- EShellWindow *self = E_SHELL_WINDOW (object);
- EShellWindowPrivate *priv = self->priv;
+ EShell *shell;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ GHashTable *loaded_views;
- priv->destroyed = TRUE;
+ g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), NULL);
+ g_return_val_if_fail (view_name != NULL, NULL);
- if (priv->shell.eshell != NULL) {
- g_object_remove_weak_pointer (G_OBJECT (priv->shell.eshell), &priv->shell.pointer);
- priv->shell.eshell = NULL;
- }
+ loaded_views = shell_window->priv->loaded_views;
+ shell_view = g_hash_table_lookup (loaded_views, view_name);
- if (priv->ui_component != NULL) {
- bonobo_object_unref (BONOBO_OBJECT (priv->ui_component));
- priv->ui_component = NULL;
- }
+ if (shell_view != NULL)
+ return shell_view;
- if (priv->store_window_size_timer) {
- g_source_remove (priv->store_window_size_timer);
- self->priv->store_window_size_timer = 0;
+ shell = e_shell_window_get_shell (shell_window);
+ shell_backend = e_shell_get_backend_by_name (shell, view_name);
- /* There was a timer. Let us store the settings.*/
- store_window_size (GTK_WIDGET (self));
+ if (shell_backend == NULL) {
+ g_critical ("Unknown shell view name: %s", view_name);
+ return NULL;
}
- (* G_OBJECT_CLASS (e_shell_window_parent_class)->dispose) (object);
+ return shell_window_new_view (shell_backend, shell_window);
}
-static void
-impl_finalize (GObject *object)
+/**
+ * e_shell_window_get_shell_view_action:
+ * @shell_window: an #EShellWindow
+ * @view_name: name of a shell view
+ *
+ * Returns the switcher action for @view_name.
+ *
+ * An #EShellWindow creates a #GtkRadioAction for each registered subclass
+ * of #EShellView. This action gets passed to the #EShellSwitcher, which
+ * displays a button that proxies the action. When the #EShellView named
+ * @view_name is active, the action's icon becomes the @shell_window icon.
+ *
+ * Returns: the switcher action for the #EShellView named @view_name,
+ * or %NULL if no such shell view exists
+ **/
+GtkAction *
+e_shell_window_get_shell_view_action (EShellWindow *shell_window,
+ const gchar *view_name)
{
- EShellWindowPrivate *priv = E_SHELL_WINDOW (object)->priv;
-
- g_slist_foreach (priv->component_views, (GFunc) component_view_free, NULL);
- g_slist_free (priv->component_views);
+ GtkAction *action;
+ gchar *action_name;
- g_object_unref(priv->menu);
+ g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), NULL);
+ g_return_val_if_fail (view_name != NULL, NULL);
- g_free (priv);
-
- (* G_OBJECT_CLASS (e_shell_window_parent_class)->finalize) (object);
-}
+ action_name = g_strdup_printf (SWITCHER_FORMAT, view_name);
+ action = e_shell_window_get_action (shell_window, action_name);
+ g_free (action_name);
-/* GtkWidget methods */
-static void
-e_shell_window_remove_resize_timer (EShellWindow* self)
-{
- if (self->priv->store_window_size_timer) {
- g_source_remove (self->priv->store_window_size_timer);
- self->priv->store_window_size_timer = 0;
- }
+ return action;
}
-static gboolean
-impl_window_state (GtkWidget *widget, GdkEventWindowState* ev)
+/**
+ * e_shell_window_get_ui_manager:
+ * @shell_window: an #EShellWindow
+ *
+ * Returns @shell_window<!-- -->'s user interface manager, which
+ * manages the window's menus and toolbars via #GtkAction<!-- -->s.
+ * This is the mechanism by which shell views and plugins can extend
+ * Evolution's menus and toolbars.
+ *
+ * Returns: the #GtkUIManager for @shell_window
+ **/
+GtkUIManager *
+e_shell_window_get_ui_manager (EShellWindow *shell_window)
{
- gboolean retval = FALSE;
-
- /* store only if the window state really changed */
- if ((ev->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) != 0) {
- GConfClient* client = gconf_client_get_default ();
- gconf_client_set_bool (client, "/apps/evolution/shell/view_defaults/maximized",
- (ev->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0, NULL);
- g_object_unref(client);
- }
-
- if ((ev->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0) {
- e_shell_window_remove_resize_timer (E_SHELL_WINDOW (widget));
- }
-
- if (GTK_WIDGET_CLASS (e_shell_window_parent_class)->window_state_event) {
- retval |= GTK_WIDGET_CLASS (e_shell_window_parent_class)->window_state_event (widget, ev);
- }
+ g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), NULL);
- return retval;
+ return shell_window->priv->ui_manager;
}
-static gboolean
-store_window_size (GtkWidget* widget)
-{
- GConfClient* client = gconf_client_get_default ();
- gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/width",
- widget->allocation.width, NULL);
- gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/height",
- widget->allocation.height, NULL);
- g_object_unref(client);
-
- E_SHELL_WINDOW (widget)->priv->store_window_size_timer = 0;
- return FALSE; /* remove this timeout */
-}
-
-static void
-impl_size_alloc (GtkWidget* widget, GtkAllocation* alloc)
+/**
+ * e_shell_window_get_action:
+ * @shell_window: an #EShellWindow
+ * @action_name: the name of an action
+ *
+ * Returns the #GtkAction named @action_name in @shell_window<!-- -->'s
+ * user interface manager, or %NULL if no such action exists.
+ *
+ * Returns: the #GtkAction named @action_name
+ **/
+GtkAction *
+e_shell_window_get_action (EShellWindow *shell_window,
+ const gchar *action_name)
{
- EShellWindow* self = E_SHELL_WINDOW (widget);
- e_shell_window_remove_resize_timer(self);
+ GtkUIManager *ui_manager;
- if (GTK_WIDGET_REALIZED(widget) && !(gdk_window_get_state(widget->window) & GDK_WINDOW_STATE_MAXIMIZED)) {
- /* update the size storage timer */
- self->priv->store_window_size_timer = g_timeout_add_seconds (1, (GSourceFunc)store_window_size, self);
- }
+ g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), NULL);
+ g_return_val_if_fail (action_name != NULL, NULL);
- if (GTK_WIDGET_CLASS (e_shell_window_parent_class)->size_allocate) {
- GTK_WIDGET_CLASS (e_shell_window_parent_class)->size_allocate (widget, alloc);
- }
-}
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
-/* Initialization. */
-
-static void
-e_shell_window_class_init (EShellWindowClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
-
- widget_class->window_state_event = impl_window_state;
- widget_class->size_allocate = impl_size_alloc;
-
- signals[COMPONENT_CHANGED] = g_signal_new ("component_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EShellWindowClass, component_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ return e_lookup_action (ui_manager, action_name);
}
-static void
-e_shell_window_init (EShellWindow *shell_window)
+/**
+ * e_shell_window_get_action_group:
+ * @shell_window: an #EShellWindow
+ * @group_name: the name of an action group
+ *
+ * Returns the #GtkActionGroup named @group_name in
+ * @shell_window<!-- -->'s user interface manager, or %NULL if no
+ * such action group exists.
+ *
+ * Returns: the #GtkActionGroup named @group_name
+ **/
+GtkActionGroup *
+e_shell_window_get_action_group (EShellWindow *shell_window,
+ const gchar *group_name)
{
- EShellWindowPrivate *priv = g_new0 (EShellWindowPrivate, 1);
+ GtkUIManager *ui_manager;
- priv->shell_view = e_shell_view_new(shell_window);
- priv->destroyed = FALSE;
+ g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), NULL);
+ g_return_val_if_fail (group_name != NULL, NULL);
- shell_window->priv = priv;
-
- /** @HookPoint: Shell Main Menu
- * @Id: org.gnome.evolution.shell
- * @Type: ESMenu
- * @Target: ESMenuTargetShell
- *
- * This hook point is used to add bonobo menu's to the main
- * evolution shell window, used for global commands not
- * requiring a specific component.
- */
- priv->menu = es_menu_new("org.gnome.evolution.shell");
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ return e_lookup_action_group (ui_manager, group_name);
}
-
-/* Instantiation. */
-
+/**
+ * e_shell_window_get_managed_widget:
+ * @shell_window: an #EShellWindow
+ * @widget_path: path in the UI definintion
+ *
+ * Looks up a widget in @shell_window<!-- -->'s user interface manager by
+ * following a path. See gtk_ui_manager_get_widget() for more information
+ * about paths.
+ *
+ * Returns: the widget found by following the path, or %NULL if no widget
+ * was found
+ **/
GtkWidget *
-e_shell_window_new (EShell *shell,
- const char *component_id)
+e_shell_window_get_managed_widget (EShellWindow *shell_window,
+ const gchar *widget_path)
{
- EShellWindow *window = g_object_new (e_shell_window_get_type (), NULL);
- EShellWindowPrivate *priv = window->priv;
- GConfClient *gconf_client = gconf_client_get_default ();
- BonoboUIContainer *ui_container;
- char *default_component_id = NULL;
- char *xmlfile;
- gint width, height;
-
- if (bonobo_window_construct (BONOBO_WINDOW (window),
- bonobo_ui_container_new (),
- "evolution", "Evolution") == NULL) {
- g_object_unref (window);
- g_object_unref (gconf_client);
- return NULL;
- }
-
- window->priv->shell.eshell = shell;
- g_object_add_weak_pointer (G_OBJECT (shell), &window->priv->shell.pointer);
-
- /* FIXME TODO: Add system_exception signal handling and all the other
- stuff from e_shell_view_construct(). */
-
- ui_container = bonobo_window_get_ui_container (BONOBO_WINDOW (window));
-
- priv->ui_component = bonobo_ui_component_new ("evolution");
- bonobo_ui_component_set_container (priv->ui_component,
- bonobo_object_corba_objref (BONOBO_OBJECT (ui_container)),
- NULL);
-
- xmlfile = g_build_filename (EVOLUTION_UIDIR, "evolution.xml", NULL);
- bonobo_ui_util_set_ui (priv->ui_component,
- PREFIX,
- xmlfile,
- "evolution", NULL);
- g_free (xmlfile);
-
- e_shell_window_commands_setup (window);
- e_menu_activate((EMenu *)priv->menu, priv->ui_component, TRUE);
-
- setup_widgets (window);
-
- if(gconf_client_get_bool (gconf_client,"/apps/evolution/shell/view_defaults/sidebar_visible",NULL))
- gtk_widget_show (priv->sidebar);
- else
- gtk_widget_hide (priv->sidebar);
-
- update_send_receive_sensitivity (window);
- g_signal_connect_object (shell, "line_status_changed", G_CALLBACK (shell_line_status_changed_callback), window, 0);
+ GtkUIManager *ui_manager;
+ GtkWidget *widget;
- gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
+ g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), NULL);
+ g_return_val_if_fail (widget_path != NULL, NULL);
- if (component_id == NULL) {
- component_id = default_component_id =
- gconf_client_get_string (gconf_client,
- "/apps/evolution/shell/view_defaults/component_id",
- NULL);
- if (component_id == NULL)
- component_id = "mail";
- }
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ widget = gtk_ui_manager_get_widget (ui_manager, widget_path);
- e_shell_window_switch_to_component (window, component_id);
- g_free(default_component_id);
- g_object_unref (gconf_client);
+ g_return_val_if_fail (widget != NULL, NULL);
- width = gconf_client_get_int (gconf_client, "/apps/evolution/shell/view_defaults/width", NULL);
- height = gconf_client_get_int (gconf_client, "/apps/evolution/shell/view_defaults/height", NULL);
- gtk_window_set_default_size (GTK_WINDOW (window), (width >= 0) ? width : 0,
- (height >= 0) ? height : 0);
- if (gconf_client_get_bool (gconf_client, "/apps/evolution/shell/view_defaults/maximized", NULL)) {
- gtk_window_maximize (GTK_WINDOW (window));
- }
-
- g_object_unref (gconf_client);
- return GTK_WIDGET (window);
+ return widget;
}
-
-void
-e_shell_window_switch_to_component (EShellWindow *window, const char *component_id)
+/**
+ * e_shell_window_get_active_view:
+ * @shell_window: an #EShellWindow
+ *
+ * Returns the name of the active #EShellView.
+ *
+ * Returns: the name of the active view
+ **/
+const gchar *
+e_shell_window_get_active_view (EShellWindow *shell_window)
{
- EShellWindowPrivate *priv = window->priv;
- ComponentView *view = NULL;
- GSList *p;
-
- g_return_if_fail (E_IS_SHELL_WINDOW (window));
- g_return_if_fail (component_id != NULL);
-
- for (p = priv->component_views; p != NULL; p = p->next) {
- ComponentView *this_view = p->data;
-
- if (strcmp (this_view->component_id, component_id) == 0
- || (this_view->component_alias != NULL
- && strcmp (this_view->component_alias, component_id) == 0))
- {
- view = p->data;
- break;
- }
- }
+ g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), NULL);
- if (view == NULL) {
- g_warning ("Unknown component %s", component_id);
- return;
- }
-
- e_sidebar_select_button (E_SIDEBAR (priv->sidebar), view->button_id);
+ return shell_window->priv->active_view;
}
-
-const char *
-e_shell_window_peek_current_component_id (EShellWindow *window)
+/**
+ * e_shell_window_set_active_view:
+ * @shell_window: an #EShellWindow
+ * @view_name: the name of the shell view to switch to
+ *
+ * Switches @shell_window to the #EShellView named @view_name, causing
+ * the entire content of @shell_window to change. This is typically
+ * called as a result of the user clicking one of the switcher buttons.
+ *
+ * The name of the newly activated shell view is also written to GConf key
+ * <filename>/apps/evolution/shell/view_defaults/component_id</filename>.
+ * This makes the active shell view persistent across Evolution sessions.
+ * It also causes new shell windows created within the current Evolution
+ * session to open to the most recently selected shell view.
+ **/
+void
+e_shell_window_set_active_view (EShellWindow *shell_window,
+ const gchar *view_name)
{
- g_return_val_if_fail (E_IS_SHELL_WINDOW (window), NULL);
+ GtkAction *action;
+ EShellView *shell_view;
- if (window->priv->current_view == NULL)
- return NULL;
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+ g_return_if_fail (view_name != NULL);
- return window->priv->current_view->component_id;
-}
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ g_return_if_fail (shell_view != NULL);
+ action = e_shell_view_get_action (shell_view);
+ gtk_action_activate (action);
+}
-EShell *
-e_shell_window_peek_shell (EShellWindow *window)
+/**
+ * e_shell_window_get_safe_mode:
+ * @shell_window: an #EShellWindow
+ *
+ * Returns %TRUE if @shell_window is in "safe mode".
+ *
+ * It's up to the various #EShellView<!-- -->'s to define exactly
+ * what "safe mode" means. The @shell_window simply manages the
+ * "safe mode" state.
+ *
+ * Returns: %TRUE if @shell_window is in "safe mode"
+ **/
+gboolean
+e_shell_window_get_safe_mode (EShellWindow *shell_window)
{
- g_return_val_if_fail (E_IS_SHELL_WINDOW (window), NULL);
+ g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), FALSE);
- return window->priv->shell.eshell;
+ return shell_window->priv->safe_mode;
}
-
-BonoboUIComponent *
-e_shell_window_peek_bonobo_ui_component (EShellWindow *window)
+/**
+ * e_shell_window_set_safe_mode:
+ * @shell_window: an #EShellWindow
+ * @safe_mode: whether to put @shell_window into "safe mode"
+ *
+ * If %TRUE, puts @shell_window into "safe mode".
+ *
+ * It's up to the various #EShellView<!-- -->'s to define exactly
+ * what "safe mode" means. The @shell_window simply manages the
+ * "safe mode" state.
+ **/
+void
+e_shell_window_set_safe_mode (EShellWindow *shell_window,
+ gboolean safe_mode)
{
- g_return_val_if_fail (E_IS_SHELL_WINDOW (window), NULL);
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+
+ shell_window->priv->safe_mode = safe_mode;
- return window->priv->ui_component;
+ g_object_notify (G_OBJECT (shell_window), "safe-mode");
}
-ESidebar *
-e_shell_window_peek_sidebar (EShellWindow *window)
+/**
+ * e_shell_window_add_action_group:
+ * @shell_window: an #EShellWindow
+ * @group_name: the name of the new action group
+ *
+ * Creates a new #GtkActionGroup and adds it to @shell_window<!-- -->'s
+ * user interface manager. This also takes care of details like setting
+ * the translation domain.
+ **/
+void
+e_shell_window_add_action_group (EShellWindow *shell_window,
+ const gchar *group_name)
{
- g_return_val_if_fail (E_IS_SHELL_WINDOW (window), NULL);
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+ const gchar *domain;
- return E_SIDEBAR (window->priv->sidebar);
-}
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+ g_return_if_fail (group_name != NULL);
-GtkWidget *
-e_shell_window_peek_statusbar (EShellWindow *window)
-{
- return window->priv->status_bar;
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ domain = GETTEXT_PACKAGE;
+
+ action_group = gtk_action_group_new (group_name);
+ gtk_action_group_set_translation_domain (action_group, domain);
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ g_object_unref (action_group);
}
+/**
+ * e_shell_window_register_new_item_actions:
+ * @shell_window: an #EShellWindow
+ * @backend_name: name of an #EShellBackend
+ * @entries: an array of #GtkActionEntry<!-- -->s
+ * @n_entries: number of elements in the array
+ *
+ * Registers a list of #GtkAction<!-- -->s to appear in
+ * @shell_window<!-- -->'s "New" menu and toolbar button. This
+ * function should be called from an #EShell<!-- -->'s
+ * #EShell::window-created signal handler. The #EShellBackend calling
+ * this function should pass its own name for the @backend_name argument
+ * (i.e. the <structfield>name</structfield> field from its own
+ * #EShellBackendInfo).
+ *
+ * The registered #GtkAction<!-- -->s should be for creating individual
+ * items such as an email message or a calendar appointment. The action
+ * labels should be marked for translation with the "New" context using
+ * the NC_() macro.
+ **/
void
-e_shell_window_save_defaults (EShellWindow *window)
-{
- GConfClient *client = gconf_client_get_default ();
- char *prop;
- const char *style;
- gboolean visible;
-
- gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/folder_bar/width",
- gtk_paned_get_position (GTK_PANED (window->priv->paned)), NULL);
-
- /* The button styles */
- if ((style = gconf_enum_to_string (button_styles, e_sidebar_get_mode (E_SIDEBAR (window->priv->sidebar))))) {
- gconf_client_set_string (client,
- "/apps/evolution/shell/view_defaults/buttons_style",
- style, NULL);
- }
+e_shell_window_register_new_item_actions (EShellWindow *shell_window,
+ const gchar *backend_name,
+ GtkActionEntry *entries,
+ guint n_entries)
+{
+ GtkActionGroup *action_group;
+ GtkAccelGroup *accel_group;
+ GtkUIManager *ui_manager;
+ guint ii;
+
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+ g_return_if_fail (backend_name != NULL);
+ g_return_if_fail (entries != NULL);
+
+ action_group = ACTION_GROUP (NEW_ITEM);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ accel_group = gtk_ui_manager_get_accel_group (ui_manager);
+ backend_name = g_intern_string (backend_name);
+
+ /* XXX The action label translations are retrieved from the
+ * message context "New", but gtk_action_group_add_actions()
+ * does not support message contexts. So we have to fetch
+ * the label translations ourselves before adding them to
+ * the action group.
+ *
+ * gtk_action_group_set_translate_func() does not help here
+ * because the action tooltips do not use a message context
+ * (though I suppose they could). */
+ for (ii = 0; ii < n_entries; ii++)
+ entries[ii].label = g_dpgettext2 (
+ GETTEXT_PACKAGE, "New", entries[ii].label);
- /* Button hiding setting */
- prop = bonobo_ui_component_get_prop (e_shell_window_peek_bonobo_ui_component (window),
- "/commands/ViewButtonsHide",
- "state",
- NULL);
- if (prop) {
- visible = prop[0] == '0';
- gconf_client_set_bool (client,
- "/apps/evolution/shell/view_defaults/buttons_visible",
- visible,
- NULL);
- g_free (prop);
- }
+ gtk_action_group_add_actions (
+ action_group, entries, n_entries, shell_window);
- /* Toolbar visibility setting */
- prop = bonobo_ui_component_get_prop (e_shell_window_peek_bonobo_ui_component (window),
- "/commands/ViewToolbar",
- "state",
- NULL);
- if (prop) {
- visible = prop[0] == '1';
- gconf_client_set_bool (client,
- "/apps/evolution/shell/view_defaults/toolbar_visible",
- visible,
- NULL);
- g_free (prop);
- }
+ /* Tag each action with the name of the shell backend that
+ * registered it. This is used to help sort actions in the
+ * "New" menu. */
- /* SideBar visibility setting */
- prop = bonobo_ui_component_get_prop (e_shell_window_peek_bonobo_ui_component (window),
- "/commands/ViewSideBar",
- "state",
- NULL);
- if (prop) {
- visible = prop[0] == '1';
- gconf_client_set_bool (client,
- "/apps/evolution/shell/view_defaults/sidebar_visible",
- visible,
- NULL);
- g_free (prop);
- }
+ for (ii = 0; ii < n_entries; ii++) {
+ const gchar *action_name;
+ GtkAction *action;
+ action_name = entries[ii].name;
- g_object_unref (client);
-}
+ action = gtk_action_group_get_action (
+ action_group, action_name);
-void
-e_shell_window_show_settings (EShellWindow *window)
-{
- g_return_if_fail (E_IS_SHELL_WINDOW (window));
+ gtk_action_set_accel_group (action, accel_group);
- e_shell_show_settings (window->priv->shell.eshell, window->priv->current_view ? window->priv->current_view->component_alias : NULL, window);
-}
+ g_object_set_data (
+ G_OBJECT (action),
+ "backend-name", (gpointer) backend_name);
-void
-e_shell_window_set_title(EShellWindow *window, const char *component_id, const char *title)
-{
- EShellWindowPrivate *priv = window->priv;
- ComponentView *view = NULL;
- GSList *p;
-
- if (priv->destroyed)
- return;
-
- for (p = priv->component_views; p != NULL; p = p->next) {
- ComponentView *this_view = p->data;
-
- if (strcmp (this_view->component_id, component_id) == 0
- || (this_view->component_alias != NULL
- && strcmp (this_view->component_alias, component_id) == 0)) {
- view = p->data;
- break;
- }
+ /* The first action becomes the first item in the "New"
+ * menu, and consequently its icon is shown in the "New"
+ * button when the shell backend's view is active. This
+ * is all sorted out in shell_window_extract_actions().
+ * Note, the data value just needs to be non-zero. */
+ if (ii == 0)
+ g_object_set_data (
+ G_OBJECT (action),
+ "primary", GINT_TO_POINTER (TRUE));
}
- if (view) {
- g_free(view->title);
- view->title = g_strdup(title);
- if (view->title && view == priv->current_view)
- gtk_window_set_title((GtkWindow *)window, title);
- }
+ e_shell_window_update_new_menu (shell_window);
}
/**
- * e_shell_window_change_component_button_icon
- * Changes icon of components button at sidebar. For more info how this behaves see
- * info at @ref e_sidebar_change_button_icon.
- * @param window EShellWindow instance.
- * @param component_id ID of the component.
- * @param icon Icon buffer.
+ * e_shell_window_register_new_source_actions:
+ * @shell_window: an #EShellWindow
+ * @backend_name: name of an #EShellBackend
+ * @entries: an array of #GtkActionEntry<!-- -->s
+ * @n_entries: number of elements in the array
+ *
+ * Registers a list of #GtkAction<!-- -->s to appear in
+ * @shell_window<!-- -->'s "New" menu and toolbar button. This
+ * function should be called from an #EShell<!-- -->'s
+ * #EShell::window-created signal handler. The #EShellBackend calling
+ * this function should pass its own name for the @backend_name argument
+ * (i.e. the <structfield>name</structfield> field from its own
+ * #EShellBackendInfo).
+ *
+ * The registered #GtkAction<!-- -->s should be for creating item
+ * containers such as an email folder or a calendar. The action labels
+ * should be marked for translation with the "New" context using the
+ * NC_() macro.
**/
void
-e_shell_window_change_component_button_icon (EShellWindow *window, const char *component_id, const char *icon_name)
-{
- EShellWindowPrivate *priv;
- GSList *p;
+e_shell_window_register_new_source_actions (EShellWindow *shell_window,
+ const gchar *backend_name,
+ GtkActionEntry *entries,
+ guint n_entries)
+{
+ GtkActionGroup *action_group;
+ GtkAccelGroup *accel_group;
+ GtkUIManager *ui_manager;
+ guint ii;
+
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+ g_return_if_fail (backend_name != NULL);
+ g_return_if_fail (entries != NULL);
+
+ action_group = ACTION_GROUP (NEW_SOURCE);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ accel_group = gtk_ui_manager_get_accel_group (ui_manager);
+ backend_name = g_intern_string (backend_name);
+
+ /* XXX The action label translations are retrieved from the
+ * message context "New", but gtk_action_group_add_actions()
+ * does not support message contexts. So we have to fetch
+ * the label translations ourselves before adding them to
+ * the action group.
+ *
+ * gtk_action_group_set_translate_func() does not help here
+ * because the action tooltips do not use a message context
+ * (though I suppose they could). */
+ for (ii = 0; ii < n_entries; ii++)
+ entries[ii].label = g_dpgettext2 (
+ GETTEXT_PACKAGE, "New", entries[ii].label);
+
+ gtk_action_group_add_actions (
+ action_group, entries, n_entries, shell_window);
- g_return_if_fail (window != NULL);
- g_return_if_fail (component_id != NULL);
+ /* Tag each action with the name of the shell backend that
+ * registered it. This is used to help sort actions in the
+ * "New" menu. */
- priv = window->priv;
+ for (ii = 0; ii < n_entries; ii++) {
+ const gchar *action_name;
+ GtkAction *action;
- if (priv->destroyed)
- return;
+ action_name = entries[ii].name;
- for (p = priv->component_views; p != NULL; p = p->next) {
- ComponentView *this_view = p->data;
+ action = gtk_action_group_get_action (
+ action_group, action_name);
- if (strcmp (this_view->component_id, component_id) == 0
- || (this_view->component_alias != NULL
- && strcmp (this_view->component_alias, component_id) == 0)) {
- e_sidebar_change_button_icon (E_SIDEBAR (priv->sidebar), icon_name, this_view->button_id);
- break;
- }
+ gtk_action_set_accel_group (action, accel_group);
+
+ g_object_set_data (
+ G_OBJECT (action),
+ "backend-name", (gpointer) backend_name);
}
+
+ e_shell_window_update_new_menu (shell_window);
}
diff --git a/shell/e-shell-window.h b/shell/e-shell-window.h
index 869352b01c..b867490afb 100644
--- a/shell/e-shell-window.h
+++ b/shell/e-shell-window.h
@@ -1,4 +1,5 @@
/*
+ * e-shell-window.h
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -14,66 +15,104 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifndef _E_SHELL_WINDOW_H_
-#define _E_SHELL_WINDOW_H_
-
-#include <bonobo/bonobo-window.h>
-#include <bonobo/bonobo-ui-component.h>
-#include "e-sidebar.h"
-
-#define E_TYPE_SHELL_WINDOW (e_shell_window_get_type ())
-#define E_SHELL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SHELL_WINDOW, EShellWindow))
-#define E_SHELL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_WINDOW, EShellWindowClass))
-#define E_IS_SHELL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SHELL_WINDOW))
-#define E_IS_SHELL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_WINDOW))
-
-
-typedef struct _EShellWindow EShellWindow;
+/**
+ * SECTION: e-shell-window
+ * @short_description: the main window
+ * @include: shell/e-shell-window.h
+ **/
+
+#ifndef E_SHELL_WINDOW_H
+#define E_SHELL_WINDOW_H
+
+#include <shell/e-shell.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SHELL_WINDOW \
+ (e_shell_window_get_type ())
+#define E_SHELL_WINDOW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SHELL_WINDOW, EShellWindow))
+#define E_SHELL_WINDOW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SHELL_WINDOW, EShellWindowClass))
+#define E_IS_SHELL_WINDOW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SHELL_WINDOW))
+#define E_IS_SHELL_WINDOW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), E_TYPE_SHELL_WINDOW))
+#define E_SHELL_WINDOW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SHELL_WINDOW, EShellWindowClass))
+
+G_BEGIN_DECLS
+
+/* Avoid including <e-shell-view.h>, because it includes us! */
+struct _EShellView;
+
+typedef struct _EShellWindow EShellWindow;
+typedef struct _EShellWindowClass EShellWindowClass;
typedef struct _EShellWindowPrivate EShellWindowPrivate;
-typedef struct _EShellWindowClass EShellWindowClass;
+/**
+ * EShellWindow:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
struct _EShellWindow {
- BonoboWindow parent;
-
+ GtkWindow parent;
EShellWindowPrivate *priv;
};
struct _EShellWindowClass {
- BonoboWindowClass parent_class;
-
- void (* component_changed) (EShellWindow *window);
+ GtkWindowClass parent_class;
};
-
-#include "e-shell.h"
-
-
-GType e_shell_window_get_type (void);
-
-GtkWidget *e_shell_window_new (EShell *shell,
- const char *component_id);
-
-void e_shell_window_switch_to_component (EShellWindow *shell,
- const char *component_id);
-const char *e_shell_window_peek_current_component_id (EShellWindow *shell);
-
-EShell *e_shell_window_peek_shell (EShellWindow *window);
-BonoboUIComponent *e_shell_window_peek_bonobo_ui_component (EShellWindow *window);
-ESidebar *e_shell_window_peek_sidebar (EShellWindow *window);
-GtkWidget *e_shell_window_peek_statusbar (EShellWindow *window);
-
-void e_shell_window_set_title(EShellWindow *window, const char *component_id, const char *title);
-
-void e_shell_window_save_defaults (EShellWindow *window);
-void e_shell_window_show_settings (EShellWindow *window);
-
-void e_shell_window_change_component_button_icon (EShellWindow *window, const char *component_id, const char *icon_name);
-
-#endif /* _E_SHELL_WINDOW_H_ */
+GType e_shell_window_get_type (void);
+GtkWidget * e_shell_window_new (EShell *shell,
+ gboolean safe_mode);
+EShell * e_shell_window_get_shell (EShellWindow *shell_window);
+struct _EShellView *
+ e_shell_window_get_shell_view (EShellWindow *shell_window,
+ const gchar *view_name);
+GtkAction * e_shell_window_get_shell_view_action
+ (EShellWindow *shell_window,
+ const gchar *view_name);
+GtkUIManager * e_shell_window_get_ui_manager (EShellWindow *shell_window);
+GtkAction * e_shell_window_get_action (EShellWindow *shell_window,
+ const gchar *action_name);
+GtkActionGroup *e_shell_window_get_action_group (EShellWindow *shell_window,
+ const gchar *group_name);
+GtkWidget * e_shell_window_get_managed_widget
+ (EShellWindow *shell_window,
+ const gchar *widget_path);
+const gchar * e_shell_window_get_active_view (EShellWindow *shell_window);
+void e_shell_window_set_active_view (EShellWindow *shell_window,
+ const gchar *view_name);
+gboolean e_shell_window_get_safe_mode (EShellWindow *shell_window);
+void e_shell_window_set_safe_mode (EShellWindow *shell_window,
+ gboolean safe_mode);
+void e_shell_window_add_action_group (EShellWindow *shell_window,
+ const gchar *group_name);
+
+/* These should be called from the shell backend's window_created() handler. */
+
+void e_shell_window_register_new_item_actions
+ (EShellWindow *shell_window,
+ const gchar *backend_name,
+ GtkActionEntry *entries,
+ guint n_entries);
+void e_shell_window_register_new_source_actions
+ (EShellWindow *shell_window,
+ const gchar *backend_name,
+ GtkActionEntry *entries,
+ guint n_entries);
+
+G_END_DECLS
+
+#endif /* E_SHELL_WINDOW_H */
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 9b4e6bc53a..785485320f 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -1,4 +1,6 @@
/*
+ * e-shell.c
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,1420 +15,1407 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#include <config.h>
-
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-#include <gtk/gtk.h>
-#include <glib/gstdio.h>
-
-#ifdef GDK_WINDOWING_X11
-#include <gdk/gdkprivate.h>
-#include <gdk/gdkx.h>
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
-#elif defined (GDK_WINDOWING_WIN32)
-/* gdkwin32.h includes <windows.h> which stomps over the namespace */
-#undef DATADIR
-#define interface windows_interface
-#include <gdk/gdkwin32.h>
-#undef interface
-#endif
+#include "e-shell.h"
#include <glib/gi18n.h>
-
-#include <gconf/gconf-client.h>
-
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-moniker-util.h>
-
-#include <libedataserver/e-xml-utils.h>
#include <libedataserverui/e-passwords.h>
-#include "e-util/e-bconf-map.h"
-#include "e-util/e-dialog-utils.h"
-#include "e-util/e-error.h"
-#include "e-util/e-fsutils.h"
#include "e-util/e-util.h"
+#include "e-util/e-module.h"
+#include "widgets/misc/e-preferences-window.h"
-#include "Evolution.h"
-#include "e-shell-constants.h"
-#include "e-shell-settings-dialog.h"
-#include "e-shell.h"
-#include "e-shell-view.h"
-#include "es-event.h"
-#include "evolution-listener.h"
-#include "evolution-shell-component-utils.h"
+#include "e-shell-backend.h"
+#include "e-shell-migrate.h"
+#include "e-shell-window.h"
-static void set_line_status_complete(EvolutionListener *el, void *data);
+#define SHUTDOWN_TIMEOUT 500 /* milliseconds */
-#define PARENT_TYPE bonobo_object_get_type ()
-static BonoboObjectClass *parent_class = NULL;
-static gboolean session_started = FALSE;
+#define E_SHELL_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SHELL, EShellPrivate))
struct _EShellPrivate {
- /* IID for registering the object on OAF. */
- char *iid;
+ GList *watched_windows;
+ EShellSettings *settings;
+ GConfClient *gconf_client;
+ GtkWidget *preferences_window;
- GList *windows;
+ /* Shell Backends */
+ GList *loaded_backends;
+ GHashTable *backends_by_name;
+ GHashTable *backends_by_scheme;
- /* EUriSchemaRegistry *uri_schema_registry; FIXME */
- EComponentRegistry *component_registry;
+ gpointer preparing_for_line_change; /* weak pointer */
- /* Names for the types of the folders that have maybe crashed. */
- /* FIXME TODO */
- GList *crash_type_names; /* char * */
+ guint auto_reconnect : 1;
+ guint network_available : 1;
+ guint online : 1;
+ guint safe_mode : 1;
+};
- /* Line status and controllers */
- EShellLineStatus line_status;
- int line_status_pending;
- EShellLineStatus line_status_working;
- EvolutionListener *line_status_listener;
+enum {
+ PROP_0,
+ PROP_NETWORK_AVAILABLE,
+ PROP_ONLINE,
+ PROP_SHELL_SETTINGS
+};
- /* Settings Dialog */
- union {
- GtkWidget *widget;
- gpointer pointer;
- } settings_dialog;
+enum {
+ EVENT,
+ HANDLE_URI,
+ PREPARE_FOR_OFFLINE,
+ PREPARE_FOR_ONLINE,
+ SEND_RECEIVE,
+ WINDOW_CREATED,
+ WINDOW_DESTROYED,
+ LAST_SIGNAL
+};
- /* If we're quitting and things are still busy, a timeout handler */
- guint quit_timeout;
+enum {
+ DEBUG_KEY_SETTINGS = 1 << 0
+};
- /* Whether the shell is succesfully initialized. This is needed during
- the start-up sequence, to avoid CORBA calls to do make wrong things
- to happen while the shell is initializing. */
- unsigned int is_initialized : 1;
+static GDebugKey debug_keys[] = {
+ { "settings", DEBUG_KEY_SETTINGS }
+};
- /* Wether the shell is working in "interactive" mode or not.
- (Currently, it's interactive IIF there is at least one active
- view.) */
- unsigned int is_interactive : 1;
+EShell *default_shell = NULL;
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
- /* Whether quit has been requested, and the shell is now waiting for
- permissions from all the components to quit. */
- unsigned int preparing_to_quit : 1;
+#if NM_SUPPORT
+void e_shell_dbus_initialize (EShell *shell);
+#endif
- /* Whether we are recovering from a crash in the previous session. */
- unsigned int crash_recovery : 1;
-};
+static void
+shell_parse_debug_string (EShell *shell)
+{
+ guint flags;
+ flags = g_parse_debug_string (
+ g_getenv ("EVOLUTION_DEBUG"),
+ debug_keys, G_N_ELEMENTS (debug_keys));
-/* Signals. */
+ if (flags & DEBUG_KEY_SETTINGS)
+ e_shell_settings_enable_debug (shell->priv->settings);
+}
-enum {
- NO_WINDOWS_LEFT,
- LINE_STATUS_CHANGED,
- NEW_WINDOW_CREATED,
- LAST_SIGNAL
-};
+static void
+shell_notify_online_cb (EShell *shell)
+{
+ gboolean online;
-static guint signals[LAST_SIGNAL] = { 0 };
+ online = e_shell_get_online (shell);
+ e_passwords_set_online (online);
+}
+static gboolean
+shell_window_delete_event_cb (EShell *shell,
+ GtkWindow *window)
+{
+ /* If other windows are open we can safely close this one. */
+ if (g_list_length (shell->priv->watched_windows) > 1)
+ return FALSE;
-/* Utility functions. */
+ /* Otherwise we initiate application shutdown. */
+ return !e_shell_quit (shell);
+}
static gboolean
-get_config_start_offline (void)
+shell_window_focus_in_event_cb (EShell *shell,
+ GdkEventFocus *event,
+ GtkWindow *window)
{
- GConfClient *client;
- gboolean value;
+ GList *list, *link;
- client = gconf_client_get_default ();
+ /* Keep the watched windows list sorted by most recently focused,
+ * so the first item in the list should always be the currently
+ * focused window. */
- value = gconf_client_get_bool (client, "/apps/evolution/shell/start_offline", NULL);
+ list = shell->priv->watched_windows;
+ link = g_list_find (list, window);
+ g_return_val_if_fail (link != NULL, FALSE);
- g_object_unref (client);
-
- return value;
-}
+ if (link != list) {
+ list = g_list_remove_link (list, link);
+ list = g_list_concat (link, list);
+ }
+ shell->priv->watched_windows = list;
-/* Interactivity handling. */
+ return FALSE;
+}
static void
-set_interactive (EShell *shell,
- gboolean interactive)
+shell_window_weak_notify_cb (EShell *shell,
+ GObject *where_the_object_was)
{
- GSList *component_list;
- GSList *p;
- GList *first_element;
- int num_windows;
- GtkWidget *view;
-
- g_return_if_fail (E_IS_SHELL (shell));
+ GList *list;
- shell->priv->is_interactive = interactive;
+ list = shell->priv->watched_windows;
+ list = g_list_remove (list, where_the_object_was);
+ shell->priv->watched_windows = list;
- num_windows = g_list_length (shell->priv->windows);
+ g_signal_emit (shell, signals[WINDOW_DESTROYED], 0);
+}
- /* We want to send the "interactive" message only when the first
- window is created */
- if (num_windows != 1)
+static void
+shell_ready_for_offline (EShell *shell,
+ EActivity *activity,
+ gboolean is_last_ref)
+{
+ if (!is_last_ref)
return;
- first_element = g_list_first (shell->priv->windows);
- view = GTK_WIDGET (first_element->data);
-
- component_list = e_component_registry_peek_list (shell->priv->component_registry);
+ /* Increment the reference count so we can safely emit
+ * a signal without triggering the toggle reference. */
+ g_object_ref (activity);
- for (p = component_list; p != NULL; p = p->next) {
- EComponentInfo *info = p->data;
- CORBA_Environment ev;
+ e_activity_complete (activity);
- CORBA_exception_init (&ev);
+ g_object_remove_toggle_ref (
+ G_OBJECT (activity), (GToggleNotify)
+ shell_ready_for_offline, shell);
-#ifdef GDK_WINDOWING_X11
- GNOME_Evolution_Component_interactive (info->iface, interactive,GPOINTER_TO_INT (GDK_WINDOW_XWINDOW (view->window)), &ev);
-#elif defined (GDK_WINDOWING_WIN32)
- GNOME_Evolution_Component_interactive (info->iface, interactive,GPOINTER_TO_INT (GDK_WINDOW_HWND (view->window)), &ev);
-#else
-#error Port this to your windowing system
-#endif
+ /* Finalize the activity. */
+ g_object_unref (activity);
- /* Ignore errors, the components can decide to not implement
- this interface. */
+ shell->priv->online = FALSE;
+ g_object_notify (G_OBJECT (shell), "online");
- CORBA_exception_free (&ev);
- }
+ g_message ("Offline preparations complete.");
}
+static void
+shell_prepare_for_offline (EShell *shell)
+{
+ /* Are preparations already in progress? */
+ if (shell->priv->preparing_for_line_change != NULL)
+ return;
+
+ g_message ("Preparing for offline mode...");
-/* CORBA interface implementation. */
+ shell->priv->preparing_for_line_change =
+ e_activity_new (_("Preparing to go offline..."));
-static gboolean
-raise_exception_if_not_ready (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- EShell *shell;
+ g_object_add_toggle_ref (
+ G_OBJECT (shell->priv->preparing_for_line_change),
+ (GToggleNotify) shell_ready_for_offline, shell);
- shell = E_SHELL (bonobo_object_from_servant (servant));
+ g_object_add_weak_pointer (
+ G_OBJECT (shell->priv->preparing_for_line_change),
+ &shell->priv->preparing_for_line_change);
- if (! shell->priv->is_initialized) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Shell_NotReady, NULL);
- return TRUE;
- }
+ g_signal_emit (
+ shell, signals[PREPARE_FOR_OFFLINE], 0,
+ shell->priv->preparing_for_line_change);
- return FALSE;
+ g_object_unref (shell->priv->preparing_for_line_change);
}
-static GNOME_Evolution_ShellView
-impl_Shell_createNewWindow (PortableServer_Servant servant,
- const CORBA_char *component_id,
- CORBA_Environment *ev)
+static void
+shell_ready_for_online (EShell *shell,
+ EActivity *activity,
+ gboolean is_last_ref)
{
- BonoboObject *bonobo_object;
- EShell *shell;
- EShellWindow *shell_window;
- EShellView *shell_view;
-
- if (raise_exception_if_not_ready (servant, ev))
- return CORBA_OBJECT_NIL;
+ if (!is_last_ref)
+ return;
- bonobo_object = bonobo_object_from_servant (servant);
- shell = E_SHELL (bonobo_object);
+ /* Increment the reference count so we can safely emit
+ * a signal without triggering the toggle reference. */
+ g_object_ref (activity);
- if (component_id[0] == '\0')
- component_id = NULL;
+ e_activity_complete (activity);
- shell_window = e_shell_create_window (shell, component_id, NULL);
- if (shell_window == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Shell_ComponentNotFound, NULL);
- return CORBA_OBJECT_NIL;
- }
+ g_object_remove_toggle_ref (
+ G_OBJECT (activity), (GToggleNotify)
+ shell_ready_for_online, shell);
- /* refs?? */
- shell_view = e_shell_view_new(shell_window);
+ /* Finalize the activity. */
+ g_object_unref (activity);
- return BONOBO_OBJREF(shell_view);
+ shell->priv->online = TRUE;
+ g_object_notify (G_OBJECT (shell), "online");
+ g_message ("Online preparations complete.");
}
static void
-impl_Shell_handleURI (PortableServer_Servant servant,
- const CORBA_char *uri,
- CORBA_Environment *ev)
+shell_prepare_for_online (EShell *shell)
{
- EShell *shell = E_SHELL (bonobo_object_from_servant (servant));
- EComponentInfo *component_info;
- char *schema, *p;
- int show = FALSE;
-
- schema = g_alloca(strlen(uri)+1);
- strcpy(schema, uri);
- p = strchr(schema, ':');
- if (p)
- *p = 0;
-
- component_info = e_component_registry_peek_info(shell->priv->component_registry, ECR_FIELD_SCHEMA, schema);
- if (component_info == NULL) {
- show = TRUE;
- component_info = e_component_registry_peek_info(shell->priv->component_registry, ECR_FIELD_ALIAS, schema);
- }
-
- if (component_info == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_UnsupportedSchema, NULL);
+ /* Are preparations already in progress? */
+ if (shell->priv->preparing_for_line_change != NULL)
return;
- }
-
- if (show) {
- GtkWidget *shell_window;
-
- shell_window = (GtkWidget *)e_shell_create_window (shell, component_info->id, NULL);
- if (shell_window == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_ComponentNotFound, NULL);
- return;
- }
- }
- GNOME_Evolution_Component_handleURI (component_info->iface, uri, ev);
- /* not an error not to implement it */
- if (ev->_id != NULL && strcmp(ev->_id, ex_CORBA_NO_IMPLEMENT) == 0)
- memset(ev, 0, sizeof(*ev));
-}
+ g_message ("Preparing for online mode...");
-static void
-impl_Shell_setLineStatus (PortableServer_Servant servant,
- CORBA_boolean online,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- EShell *shell;
+ shell->priv->preparing_for_line_change =
+ e_activity_new (_("Preparing to go online..."));
- if (raise_exception_if_not_ready (servant, ev))
- return;
+ g_object_add_toggle_ref (
+ G_OBJECT (shell->priv->preparing_for_line_change),
+ (GToggleNotify) shell_ready_for_online, shell);
- bonobo_object = bonobo_object_from_servant (servant);
- shell = E_SHELL (bonobo_object);
+ g_object_add_weak_pointer (
+ G_OBJECT (shell->priv->preparing_for_line_change),
+ &shell->priv->preparing_for_line_change);
- /* let the password manager know out online status */
- e_passwords_set_online(online);
+ g_signal_emit (
+ shell, signals[PREPARE_FOR_ONLINE], 0,
+ shell->priv->preparing_for_line_change);
- if (online)
- e_shell_set_line_status (shell, GNOME_Evolution_USER_ONLINE);
- else
- e_shell_set_line_status (shell, GNOME_Evolution_USER_OFFLINE);
+ g_object_unref (shell->priv->preparing_for_line_change);
}
-/*
-static GNOME_Evolution_Component
-impl_Shell_findComponent(PortableServer_Servant servant,
- const CORBA_char *id,
- CORBA_Environment *ev)
-{
- EShell *shell;
- EComponentInfo *ci;
-
- if (raise_exception_if_not_ready (servant, ev))
- return CORBA_OBJECT_NIL;
-
- shell = (EShell *)bonobo_object_from_servant (servant);
- ci = e_component_registry_peek_info(shell->priv->component_registry, ECR_FIELD_ALIAS, id);
- if (ci == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_ComponentNotFound, NULL);
- return CORBA_OBJECT_NIL;
- } else if (ci->iface == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_NotReady, NULL);
- return CORBA_OBJECT_NIL;
- } else {
- return ci->iface;
- }
-}
-*/
-
-/* EShellWindow handling and bookkeeping. */
-static int
-window_delete_event_cb (GtkWidget *widget,
- GdkEventAny *ev,
- void *data)
+static void
+shell_load_modules (EShell *shell)
{
- EShell *shell;
+ GList *modules;
- g_return_val_if_fail (E_IS_SHELL_WINDOW (widget), TRUE);
- shell = E_SHELL (data);
+ /* Load all shared library modules. */
+ modules = e_module_load_all_in_directory (EVOLUTION_MODULEDIR);
- return ! e_shell_request_close_window (shell, E_SHELL_WINDOW (widget));
+ while (modules != NULL) {
+ g_type_module_unuse (G_TYPE_MODULE (modules->data));
+ modules = g_list_delete_link (modules, modules);
+ }
}
-static gboolean
-notify_no_windows_left_idle_cb (void *data)
+/* Helper for shell_process_backend() */
+static void
+shell_split_and_insert_items (GHashTable *hash_table,
+ const gchar *items,
+ EShellBackend *shell_backend)
{
- EShell *shell;
- EShellPrivate *priv;
-
- shell = E_SHELL (data);
- priv = shell->priv;
-
- set_interactive (shell, FALSE);
+ gpointer key;
+ gchar **strv;
+ gint ii;
- g_signal_emit (shell, signals [NO_WINDOWS_LEFT], 0);
+ strv = g_strsplit_set (items, ":", -1);
- if (priv->iid != NULL)
- bonobo_activation_active_server_unregister (priv->iid,
- bonobo_object_corba_objref (BONOBO_OBJECT (shell)));
- bonobo_object_unref (BONOBO_OBJECT (shell));
+ for (ii = 0; strv[ii] != NULL; ii++) {
+ key = (gpointer) g_intern_string (strv[ii]);
+ g_hash_table_insert (hash_table, key, shell_backend);
+ }
- return FALSE;
+ g_strfreev (strv);
}
static void
-window_weak_notify (void *data,
- GObject *where_the_object_was)
+shell_process_backend (EShell *shell,
+ EShellBackend *shell_backend)
{
- EShell *shell;
- int num_windows;
+ EShellBackendClass *class;
+ GHashTable *backends_by_name;
+ GHashTable *backends_by_scheme;
+ const gchar *string;
- shell = E_SHELL (data);
+ shell->priv->loaded_backends = g_list_insert_sorted (
+ shell->priv->loaded_backends, shell_backend,
+ (GCompareFunc) e_shell_backend_compare);
- num_windows = g_list_length (shell->priv->windows);
+ /* Bookkeeping */
- /* If this is our last window, save settings now because in the callback
- for no_windows_left shell->priv->windows will be NULL and settings won't
- be saved because of that. */
- if (num_windows == 1)
- e_shell_save_settings (shell);
+ class = E_SHELL_BACKEND_GET_CLASS (shell_backend);
+ backends_by_name = shell->priv->backends_by_name;
+ backends_by_scheme = shell->priv->backends_by_scheme;
- shell->priv->windows = g_list_remove (shell->priv->windows, where_the_object_was);
+ if ((string = class->name) != NULL)
+ g_hash_table_insert (
+ backends_by_name, (gpointer)
+ g_intern_string (string), shell_backend);
- if (shell->priv->windows == NULL) {
- bonobo_object_ref (BONOBO_OBJECT (shell));
- g_idle_add (notify_no_windows_left_idle_cb, shell);
- }
-}
+ if ((string = class->aliases) != NULL)
+ shell_split_and_insert_items (
+ backends_by_name, string, shell_backend);
-/* GObject methods. */
+ if ((string = class->schemes) != NULL)
+ shell_split_and_insert_items (
+ backends_by_scheme, string, shell_backend);
+}
static void
-impl_dispose (GObject *object)
+shell_create_backends (EShell *shell)
{
- EShell *shell;
- EShellPrivate *priv;
- GList *p;
+ GType *children;
+ guint ii, n_children;
- shell = E_SHELL (object);
- priv = shell->priv;
+ /* Create an instance of each EShellBackend subclass. */
+ children = g_type_children (E_TYPE_SHELL_BACKEND, &n_children);
- priv->is_initialized = FALSE;
+ for (ii = 0; ii < n_children; ii++) {
+ EShellBackend *shell_backend;
+ GType type = children[ii];
-#if 0 /* FIXME */
- if (priv->uri_schema_registry != NULL) {
- g_object_unref (priv->uri_schema_registry);
- priv->uri_schema_registry = NULL;
+ shell_backend = g_object_new (type, "shell", shell, NULL);
+ shell_process_backend (shell, shell_backend);
}
-#endif
- if (priv->component_registry != NULL) {
- g_object_unref (priv->component_registry);
- priv->component_registry = NULL;
- }
+ g_free (children);
+}
- if (priv->quit_timeout) {
- g_source_remove(priv->quit_timeout);
- priv->quit_timeout = 0;
+static gboolean
+shell_shutdown_timeout (EShell *shell)
+{
+ GList *list, *iter;
+ gboolean proceed = TRUE;
+ static guint source_id = 0;
+ static guint message_timer = 1;
+
+ /* Module list is read-only; do not free. */
+ list = e_shell_get_shell_backends (shell);
+
+ /* Any backend can defer shutdown if it's still busy. */
+ for (iter = list; proceed && iter != NULL; iter = iter->next) {
+ EShellBackend *shell_backend = iter->data;
+ proceed = e_shell_backend_shutdown (shell_backend);
+
+ /* Emit a message every few seconds to indicate
+ * which backend(s) we're still waiting on. */
+ if (proceed || message_timer == 0)
+ continue;
+
+ g_message (
+ _("Waiting for the \"%s\" backend to finish..."),
+ E_SHELL_BACKEND_GET_CLASS (shell_backend)->name);
}
- for (p = priv->windows; p != NULL; p = p->next) {
- EShellWindow *window;
-
- window = E_SHELL_WINDOW (p->data);
+ message_timer = (message_timer + 1) % 10;
+
+ /* If we're go for shutdown, destroy all shell windows. Note,
+ * we iterate over a /copy/ of the active windows list because
+ * the act of destroying a shell window will modify the active
+ * windows list, which would otherwise derail the iteration. */
+ if (proceed) {
+ list = g_list_copy (shell->priv->watched_windows);
+ g_list_foreach (list, (GFunc) gtk_widget_destroy, NULL);
+ g_list_free (list);
+
+ /* If a backend is still busy, try again after a short delay. */
+ } else if (source_id == 0)
+ source_id = g_timeout_add (
+ SHUTDOWN_TIMEOUT, (GSourceFunc)
+ shell_shutdown_timeout, shell);
+
+ /* Return TRUE to repeat the timeout, FALSE to stop it. This
+ * may seem backwards if the function was called directly. */
+ return !proceed;
+}
- g_signal_handlers_disconnect_by_func (window, G_CALLBACK (window_delete_event_cb), shell);
- g_object_weak_unref (G_OBJECT (window), window_weak_notify, shell);
+static void
+shell_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_NETWORK_AVAILABLE:
+ e_shell_set_network_available (
+ E_SHELL (object),
+ g_value_get_boolean (value));
+ return;
- gtk_object_destroy (GTK_OBJECT (window));
+ case PROP_ONLINE:
+ e_shell_set_online (
+ E_SHELL (object),
+ g_value_get_boolean (value));
+ return;
}
- g_list_free (priv->windows);
- priv->windows = NULL;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
- /* No unreffing for these as they are aggregate. */
- /* bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); */
+static void
+shell_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_NETWORK_AVAILABLE:
+ g_value_set_boolean (
+ value, e_shell_get_network_available (
+ E_SHELL (object)));
+ return;
- if (priv->settings_dialog.widget != NULL) {
- gtk_widget_destroy (priv->settings_dialog.widget);
- priv->settings_dialog.widget = NULL;
- }
+ case PROP_ONLINE:
+ g_value_set_boolean (
+ value, e_shell_get_online (
+ E_SHELL (object)));
+ return;
- if (priv->line_status_listener) {
- priv->line_status_listener->complete = NULL;
- bonobo_object_unref(BONOBO_OBJECT(priv->line_status_listener));
- priv->line_status_listener = NULL;
+ case PROP_SHELL_SETTINGS:
+ g_value_set_object (
+ value, e_shell_get_shell_settings (
+ E_SHELL (object)));
+ return;
}
- g_free (priv->iid);
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-impl_finalize (GObject *object)
+shell_dispose (GObject *object)
{
- EShell *shell;
EShellPrivate *priv;
- shell = E_SHELL (object);
- priv = shell->priv;
+ priv = E_SHELL_GET_PRIVATE (object);
- g_list_foreach (priv->crash_type_names, (GFunc) g_free, NULL);
- g_list_free (priv->crash_type_names);
-
- g_free (priv);
+ if (priv->settings != NULL) {
+ g_object_unref (priv->settings);
+ priv->settings = NULL;
+ }
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
+ if (priv->gconf_client != NULL) {
+ g_object_unref (priv->gconf_client);
+ priv->gconf_client = NULL;
+ }
+ if (priv->preferences_window != NULL) {
+ g_object_unref (priv->preferences_window);
+ priv->preferences_window = NULL;
+ }
-/* Initialization. */
+ g_list_foreach (priv->loaded_backends, (GFunc) g_object_unref, NULL);
+ g_list_free (priv->loaded_backends);
+ priv->loaded_backends = NULL;
-static void
-e_shell_class_init (EShellClass *klass)
-{
- GObjectClass *object_class;
- POA_GNOME_Evolution_Shell__epv *epv;
-
- parent_class = g_type_class_ref(PARENT_TYPE);
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
-
- signals[NO_WINDOWS_LEFT] =
- g_signal_new ("no_windows_left",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EShellClass, no_windows_left),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- signals[LINE_STATUS_CHANGED] =
- g_signal_new ("line_status_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EShellClass, line_status_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1,
- G_TYPE_INT);
-
- signals[NEW_WINDOW_CREATED] =
- g_signal_new ("new_window_created",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EShellClass, new_window_created),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- epv = & klass->epv;
- epv->createNewWindow = impl_Shell_createNewWindow;
- epv->handleURI = impl_Shell_handleURI;
- epv->setLineStatus = impl_Shell_setLineStatus;
-/* epv->findComponent = impl_Shell_findComponent;*/
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-e_shell_init (EShell *shell)
+shell_finalize (GObject *object)
{
EShellPrivate *priv;
- priv = g_new0 (EShellPrivate, 1);
- priv->line_status = E_SHELL_LINE_STATUS_OFFLINE;
- priv->component_registry = e_component_registry_new ();
+ priv = E_SHELL_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->backends_by_name);
+ g_hash_table_destroy (priv->backends_by_scheme);
- shell->priv = priv;
+ /* Indicates a clean shut down to the next session. */
+ if (!unique_app_is_running (UNIQUE_APP (object)))
+ e_file_lock_destroy ();
- priv->line_status_listener = evolution_listener_new(set_line_status_complete, shell);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-detect_version (GConfClient *gconf, int *major, int *minor, int *revision)
+shell_constructed (GObject *object)
{
- char *val, *evolution_dir;
- struct stat st;
-
- evolution_dir = g_build_filename (g_get_home_dir (), "evolution", NULL);
-
- val = gconf_client_get_string(gconf, "/apps/evolution/version", NULL);
- if (val) {
- /* Since 1.4.0 We've been keeping the version key in gconf */
- sscanf(val, "%d.%d.%d", major, minor, revision);
- g_free(val);
- } else if (g_lstat (evolution_dir, &st) != 0 || !S_ISDIR (st.st_mode)) {
- /* If ~/evolution does not exit or is not a directory it must be a new installation */
- *major = 0;
- *minor = 0;
- *revision = 0;
- } else {
- xmlDocPtr config_doc;
- xmlNodePtr source;
- char *tmp;
-
- tmp = g_build_filename (evolution_dir, "config.xmldb", NULL);
- config_doc = e_xml_parse_file (tmp);
- g_free (tmp);
- tmp = NULL;
-
- if (config_doc
- && (source = e_bconf_get_path (config_doc, "/Shell"))
- && (tmp = e_bconf_get_value (source, "upgrade_from_1_0_to_1_2_performed"))
- && tmp[0] == '1' ) {
- *major = 1;
- *minor = 2;
- *revision = 0;
- } else {
- *major = 1;
- *minor = 0;
- *revision = 0;
- }
- g_free (tmp);
- if (config_doc)
- xmlFreeDoc (config_doc);
- }
+ /* UniqueApp will have by this point determined whether we're
+ * the only Evolution process running. If so, proceed normally.
+ * Otherwise we just issue commands to the other process. */
+ if (unique_app_is_running (UNIQUE_APP (object)))
+ return;
- g_free (evolution_dir);
+ e_file_lock_create ();
+
+ shell_load_modules (E_SHELL (object));
+ shell_create_backends (E_SHELL (object));
+ e_shell_migrate_attempt (E_SHELL (object));
}
-/* calls components to perform upgrade */
static gboolean
-attempt_upgrade (EShell *shell, int major, int minor, int revision)
+shell_message_handle_new (EShell *shell,
+ UniqueMessageData *data)
{
- GSList *component_infos, *p;
- gboolean success;
- int res;
-
- success = TRUE;
-
- component_infos = e_component_registry_peek_list (shell->priv->component_registry);
- for (p = component_infos; success && p != NULL; p = p->next) {
- const EComponentInfo *info = p->data;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Component_upgradeFromVersion (info->iface, major, minor, revision, &ev);
-
- if (BONOBO_EX (&ev)) {
- char *exception_text;
- CORBA_char *id = CORBA_exception_id(&ev);
-
- if (strcmp (id, ex_CORBA_NO_IMPLEMENT) == 0) {
- /* Ignore components that do not implement this version, it
- might just mean that they don't need an upgrade path. */
- } else if (strcmp (id, ex_GNOME_Evolution_Component_UpgradeFailed) == 0) {
- GNOME_Evolution_Component_UpgradeFailed *ex = CORBA_exception_value(&ev);
-
- res = e_error_run(NULL, "shell:upgrade-failed", ex->what, ex->why, NULL);
- if (res == GTK_RESPONSE_CANCEL)
- success = FALSE;
- } else if (strcmp (id, ex_GNOME_Evolution_Component_UnsupportedVersion) == 0) {
- /* This is non-fatal */
- /* DO WE CARE??? */
- printf("Upgrade of component failed, unsupported prior version\n");
- } else {
- exception_text = bonobo_exception_get_text (&ev);
- res = e_error_run(NULL, "shell:upgrade-failed", exception_text, _("Unknown system error."), NULL);
- g_free (exception_text);
- if (res == GTK_RESPONSE_CANCEL)
- success = FALSE;
- }
- }
- CORBA_exception_free (&ev);
- }
+ gchar *view_name;
- return success;
+ view_name = unique_message_data_get_text (data);
+ e_shell_create_shell_window (shell, view_name);
+ g_free (view_name);
+
+ return TRUE;
}
-/**
- * e_shell_construct:
- * @shell: An EShell object to construct
- * @iid: OAFIID for registering the shell into the name server
- * @startup_line_mode: How to set up the line mode (online or offline) initally.
- *
- * Construct @shell so that it uses the specified @corba_object.
- *
- * Return value: The result of the operation.
- **/
-EShellConstructResult
-e_shell_construct (EShell *shell,
- const char *iid,
- EShellStartupLineMode startup_line_mode)
+static gboolean
+shell_message_handle_open (EShell *shell,
+ UniqueMessageData *data)
{
- EShellPrivate *priv;
- CORBA_Object corba_object;
- gboolean start_online;
- GSList *component;
-
- g_return_val_if_fail (E_IS_SHELL (shell), E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
- g_return_val_if_fail (startup_line_mode == E_SHELL_STARTUP_LINE_MODE_CONFIG
- || startup_line_mode == E_SHELL_STARTUP_LINE_MODE_ONLINE
- || startup_line_mode == E_SHELL_STARTUP_LINE_MODE_OFFLINE,
- E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
-
- priv = shell->priv;
- priv->iid = g_strdup (iid);
-
- /* Now we can register into OAF. Notice that we shouldn't be
- registering into OAF until we are sure we can complete. */
-
- /* FIXME: Multi-display stuff. */
- corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (shell));
- if (bonobo_activation_active_server_register (iid, corba_object) != Bonobo_ACTIVATION_REG_SUCCESS)
- return E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER;
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
-
- /* activate all the components (peek list does this implictly) */
- /* Do we really need to assign the result of this to the list? */
- component = e_component_registry_peek_list (shell->priv->component_registry);
-
- e_shell_attempt_upgrade(shell);
-
- priv->is_initialized = TRUE;
-
- switch (startup_line_mode) {
- case E_SHELL_STARTUP_LINE_MODE_CONFIG:
- start_online = ! get_config_start_offline ();
- break;
- case E_SHELL_STARTUP_LINE_MODE_ONLINE:
- start_online = TRUE;
- break;
- case E_SHELL_STARTUP_LINE_MODE_OFFLINE:
- start_online = FALSE;
- break;
- default:
- start_online = FALSE; /* Make compiler happy. */
- g_return_val_if_reached(E_SHELL_CONSTRUCT_RESULT_OK);
- }
+ gchar **uris;
- e_passwords_set_online(start_online);
+ uris = unique_message_data_get_uris (data);
+ e_shell_handle_uris (shell, uris);
+ g_strfreev (uris);
- if (start_online)
- e_shell_set_line_status (shell, GNOME_Evolution_USER_ONLINE);
- else
- e_shell_set_line_status (shell, GNOME_Evolution_USER_OFFLINE);
+ return TRUE;
+}
+
+static gboolean
+shell_message_handle_close (EShell *shell,
+ UniqueMessageData *data)
+{
+ e_shell_quit (shell);
- return E_SHELL_CONSTRUCT_RESULT_OK;
+ return TRUE;
}
-/**
- * e_shell_new:
- * @start_online: Whether to start in on-line mode or not.
- * @construct_result_return: A pointer to an EShellConstructResult variable into
- * which the result of the operation will be stored.
- *
- * Create a new EShell.
- *
- * Return value:
- **/
-EShell *
-e_shell_new (EShellStartupLineMode startup_line_mode,
- EShellConstructResult *construct_result_return)
+static UniqueResponse
+shell_message_received (UniqueApp *app,
+ gint command,
+ UniqueMessageData *data,
+ guint time_)
{
- EShell *new;
- EShellConstructResult construct_result;
+ EShell *shell = E_SHELL (app);
- new = g_object_new (e_shell_get_type (), NULL);
+ switch (command) {
+ case UNIQUE_ACTIVATE:
+ break; /* use the default behavior */
- construct_result = e_shell_construct (new, E_SHELL_OAFIID, startup_line_mode);
+ case UNIQUE_NEW:
+ if (shell_message_handle_new (shell, data))
+ return UNIQUE_RESPONSE_OK;
+ break;
- if (construct_result != E_SHELL_CONSTRUCT_RESULT_OK) {
- *construct_result_return = construct_result;
- bonobo_object_unref (BONOBO_OBJECT (new));
- return NULL;
- }
+ case UNIQUE_OPEN:
+ if (shell_message_handle_open (shell, data))
+ return UNIQUE_RESPONSE_OK;
+ break;
- *construct_result_return = E_SHELL_CONSTRUCT_RESULT_OK;
- return new;
-}
+ case UNIQUE_CLOSE:
+ if (shell_message_handle_close (shell, data))
+ return UNIQUE_RESPONSE_OK;
+ break;
-static int
-remove_dir(const char *root, const char *path)
-{
- GDir *dir;
- const char *dname;
- int res = -1;
- char *new = NULL;
- struct stat st;
-
- dir = g_dir_open(path, 0, NULL);
- if (dir == NULL)
- return -1;
-
- while ( (dname = g_dir_read_name(dir)) ) {
- new = g_build_filename(path, dname, NULL);
- if (g_stat(new, &st) == -1)
- goto fail;
-
- /* make sure we're really removing something from evolution dir */
- g_return_val_if_fail (strlen(path) >= strlen(root)
- && strncmp(root, path, strlen(root)) == 0, -1);
-
- if (S_ISDIR(st.st_mode)) {
- if (remove_dir(root, new) == -1)
- goto fail;
- } else {
- if (g_unlink(new) == -1)
- goto fail;
- }
- g_free(new);
- new = NULL;
+ default:
+ break;
}
- res = g_rmdir(path);
-fail:
- g_free(new);
- g_dir_close(dir);
- return res;
+ /* Chain up to parent's message_received() method. */
+ return UNIQUE_APP_CLASS (parent_class)->
+ message_received (app, command, data, time_);
}
-/**
- * e_shell_attempt_upgrade:
- * @shell:
- *
- * Upgrade config and components from the currently installed version.
- *
- * Return value: %TRUE If it works. If it fails the application will exit.
- **/
-gboolean
-e_shell_attempt_upgrade (EShell *shell)
+static void
+shell_class_init (EShellClass *class)
{
- GConfClient *gconf_client;
- int major = 0, minor = 0, revision = 0;
- int lmajor, lminor, lrevision;
- int cmajor, cminor, crevision;
- char *version_string, *last_version = NULL;
- int done_upgrade = FALSE;
- char *oldpath;
- struct stat st;
- ESEvent *ese;
-
- gconf_client = gconf_client_get_default();
-
- oldpath = g_build_filename(g_get_home_dir(), "evolution", NULL);
-
- g_return_val_if_fail (sscanf(BASE_VERSION, "%u.%u", &cmajor, &cminor) == 2, TRUE);
- crevision = atoi(UPGRADE_REVISION);
-
- detect_version (gconf_client, &major, &minor, &revision);
-
- if (!(cmajor > major
- || (cmajor == major && cminor > minor)
- || (cminor == minor && crevision > revision)))
- goto check_old;
-
- /* if upgrading from < 1.5, we need to copy most data from ~/evolution to ~/.evolution */
- if (major == 1 && minor < 5) {
- long size, space;
-
- size = e_fsutils_usage(oldpath);
- space = e_fsutils_avail(g_get_home_dir());
- if (size != -1 && space != -1 && space < size) {
- char *required = g_strdup_printf(_("%ld KB"), size);
- char *have = g_strdup_printf(_("%ld KB"), space);
-
- e_error_run(NULL, "shell:upgrade-nospace", required, have, NULL);
- g_free(required);
- g_free(have);
- _exit(0);
- }
- }
+ GObjectClass *object_class;
+ UniqueAppClass *unique_app_class;
- if (!attempt_upgrade (shell, major, minor, revision))
- _exit(0);
-
- /* mark as upgraded */
- version_string = g_strdup_printf ("%s.%s", BASE_VERSION, UPGRADE_REVISION);
- gconf_client_set_string (gconf_client, "/apps/evolution/version", version_string, NULL);
- done_upgrade = TRUE;
-
-check_old:
- /* if the last upgraded version was old, check for stuff to remove */
- if (done_upgrade
- || (last_version = gconf_client_get_string (gconf_client, "/apps/evolution/last_version", NULL)) == NULL
- || sscanf(last_version, "%d.%d.%d", &lmajor, &lminor, &lrevision) != 3) {
- lmajor = major;
- lminor = minor;
- lrevision = revision;
- }
- g_free(last_version);
-
- if (lmajor == 1 && lminor < 5
- && g_stat(oldpath, &st) == 0
- && S_ISDIR(st.st_mode)) {
- int res;
-
- last_version = g_strdup_printf("%d.%d.%d", lmajor, lminor, lrevision);
- res = e_error_run(NULL, "shell:upgrade-remove-1-4", last_version, NULL);
- g_free(last_version);
-
- switch (res) {
- case GTK_RESPONSE_OK: /* 'delete' */
- if (e_error_run(NULL, "shell:upgrade-remove-1-4-confirm", NULL) == GTK_RESPONSE_OK)
- remove_dir(oldpath, oldpath);
- else
- break;
- /* falls through */
- case GTK_RESPONSE_ACCEPT: /* 'keep' */
- lmajor = cmajor;
- lminor = cminor;
- lrevision = crevision;
- break;
- default:
- /* cancel - noop */
- break;
- }
- } else {
- /* otherwise 'last version' is now the same as current */
- lmajor = cmajor;
- lminor = cminor;
- lrevision = crevision;
- }
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EShellPrivate));
- last_version = g_strdup_printf("%d.%d.%d", lmajor, lminor, lrevision);
- gconf_client_set_string (gconf_client, "/apps/evolution/last_version", last_version, NULL);
- g_free(last_version);
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = shell_set_property;
+ object_class->get_property = shell_get_property;
+ object_class->dispose = shell_dispose;
+ object_class->finalize = shell_finalize;
+ object_class->constructed = shell_constructed;
- g_free(oldpath);
- g_object_unref (gconf_client);
+ unique_app_class = UNIQUE_APP_CLASS (class);
+ unique_app_class->message_received = shell_message_received;
- /** @Event: Shell attempted upgrade
- * @Id: upgrade.done
- * @Target: ESMenuTargetState
+ /**
+ * EShell:network-available
*
- * This event is emitted whenever the shell successfully attempts an upgrade.
+ * Whether the network is available.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_NETWORK_AVAILABLE,
+ g_param_spec_boolean (
+ "network-available",
+ _("Network Available"),
+ _("Whether the network is available"),
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ /**
+ * EShell:online
*
- */
- ese = es_event_peek();
- e_event_emit((EEvent *)ese, "upgrade.done", (EEventTarget *)es_event_target_new_upgrade(ese, cmajor, cminor, crevision));
-
- return TRUE;
+ * Whether the shell is online.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_ONLINE,
+ g_param_spec_boolean (
+ "online",
+ _("Online"),
+ _("Whether the shell is online"),
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ /**
+ * EShell:settings
+ *
+ * The #EShellSettings object stores application settings.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_SETTINGS,
+ g_param_spec_object (
+ "shell-settings",
+ _("Shell Settings"),
+ _("Application-wide settings"),
+ E_TYPE_SHELL_SETTINGS,
+ G_PARAM_READABLE));
+
+ /**
+ * EShell::event
+ * @shell: the #EShell which emitted the signal
+ * @event_data: data associated with the event
+ *
+ * This signal is used to broadcast custom events to the entire
+ * application. The nature of @event_data depends on the event
+ * being broadcast. The signal's detail denotes the event.
+ **/
+ signals[EVENT] = g_signal_new (
+ "event",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED | G_SIGNAL_ACTION,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
+
+ /**
+ * EShell::handle-uri
+ * @shell: the #EShell which emitted the signal
+ * @uri: the URI to be handled
+ *
+ * Emitted when @shell receives a URI to be handled, usually by
+ * way of a command-line argument. An #EShellBackend should listen
+ * for this signal and try to handle the URI, usually by opening an
+ * editor window for the identified resource.
+ *
+ * Returns: %TRUE if the URI could be handled, %FALSE otherwise
+ **/
+ signals[HANDLE_URI] = g_signal_new (
+ "handle-uri",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ 0, g_signal_accumulator_true_handled, NULL,
+ e_marshal_BOOLEAN__STRING,
+ G_TYPE_BOOLEAN, 1,
+ G_TYPE_STRING);
+
+ /**
+ * EShell::prepare-for-offline
+ * @shell: the #EShell which emitted the signal
+ * @activity: the #EActivity for offline preparations
+ *
+ * Emitted when the user elects to work offline. An #EShellBackend
+ * should listen for this signal and make preparations for working
+ * in offline mode.
+ *
+ * If preparations for working offline cannot immediately be
+ * completed (such as when synchronizing with a remote server),
+ * the #EShellBackend should reference the @activity until
+ * preparations are complete, and then unreference the @activity.
+ * This will delay Evolution from actually going to offline mode
+ * until all backends have unreferenced @activity.
+ **/
+ signals[PREPARE_FOR_OFFLINE] = g_signal_new (
+ "prepare-for-offline",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_ACTIVITY);
+
+ /**
+ * EShell::prepare-for-online
+ * @shell: the #EShell which emitted the signal
+ * @activity: the #EActivity for offline preparations
+ *
+ * Emitted when the user elects to work online. An #EShellBackend
+ * should listen for this signal and make preparations for working
+ * in online mode.
+ *
+ * If preparations for working online cannot immediately be
+ * completed (such as when re-connecting to a remote server), the
+ * #EShellBackend should reference the @activity until preparations
+ * are complete, and then unreference the @activity. This will
+ * delay Evolution from actually going to online mode until all
+ * backends have unreferenced @activity.
+ **/
+ signals[PREPARE_FOR_ONLINE] = g_signal_new (
+ "prepare-for-online",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_ACTIVITY);
+
+ /**
+ * EShell::send-receive
+ * @shell: the #EShell which emitted the signal
+ * @parent: a parent #GtkWindow
+ *
+ * Emitted when the user chooses the "Send / Receive" action.
+ * The parent window can be used for showing transient windows.
+ **/
+ signals[SEND_RECEIVE] = g_signal_new (
+ "send-receive",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_WINDOW);
+
+ /**
+ * EShell::window-created
+ * @shell: the #EShell which emitted the signal
+ * @window: the newly created #GtkWindow
+ *
+ * Emitted when @shell begins watching a newly created window.
+ **/
+ signals[WINDOW_CREATED] = g_signal_new (
+ "window-created",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_WINDOW);
+
+ /**
+ * EShell::window-destroyed
+ * @shell: the #EShell which emitted the signal
+ *
+ * Emitted when a watched is destroyed.
+ **/
+ signals[WINDOW_DESTROYED] = g_signal_new (
+ "window-destroyed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ /* Install some application-wide settings. */
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "disable-application-handlers",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "disable-command-line",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "disable-printing",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "disable-print-setup",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "disable-save-to-disk",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_install_property (
+ g_param_spec_string (
+ "file-chooser-folder",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
}
-/**
- * e_shell_create_window:
- * @shell: The shell for which to create a new window.
- * @component_id: Id or alias of the component to display in the new window.
- * @template_window: Window from which to copy the window settings (can be %NULL).
- *
- * Create a new window for @uri.
- *
- * Return value: The new window.
- **/
-EShellWindow *
-e_shell_create_window (EShell *shell,
- const char *component_id,
- EShellWindow *template_window)
+static void
+shell_init (EShell *shell)
{
- EShellWindow *window;
+ GHashTable *backends_by_name;
+ GHashTable *backends_by_scheme;
- /* FIXME need to actually copy settings from template_window. */
+ shell->priv = E_SHELL_GET_PRIVATE (shell);
- g_return_val_if_fail (shell != NULL, NULL);
- g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+ backends_by_name = g_hash_table_new (g_str_hash, g_str_equal);
+ backends_by_scheme = g_hash_table_new (g_str_hash, g_str_equal);
- window = E_SHELL_WINDOW (e_shell_window_new (shell, component_id));
+ shell->priv->settings = g_object_new (E_TYPE_SHELL_SETTINGS, NULL);
+ shell->priv->gconf_client = gconf_client_get_default ();
+ shell->priv->preferences_window = e_preferences_window_new ();
+ shell->priv->backends_by_name = backends_by_name;
+ shell->priv->backends_by_scheme = backends_by_scheme;
+ shell->priv->safe_mode = e_file_lock_exists ();
- g_signal_connect (window, "delete_event", G_CALLBACK (window_delete_event_cb), shell);
- g_object_weak_ref (G_OBJECT (window), window_weak_notify, shell);
- shell->priv->windows = g_list_prepend (shell->priv->windows, window);
+ g_object_ref_sink (shell->priv->preferences_window);
- g_signal_emit (shell, signals[NEW_WINDOW_CREATED], 0, window);
+#if NM_SUPPORT
+ e_shell_dbus_initialize (shell);
+#endif
- gtk_widget_show (GTK_WIDGET (window));
+ shell_parse_debug_string (shell);
- e_error_default_parent((GtkWindow *)window);
+ g_signal_connect (
+ shell, "notify::online",
+ G_CALLBACK (shell_notify_online_cb), NULL);
- set_interactive (shell, TRUE);
+ e_shell_settings_bind_to_gconf (
+ shell->priv->settings, "disable-application-handlers",
+ "/desktop/gnome/lockdown/disable_application_handlers");
- if (!session_started) {
- ESEvent *ese;
+ e_shell_settings_bind_to_gconf (
+ shell->priv->settings, "disable-command-line",
+ "/desktop/gnome/lockdown/disable_command_line");
- session_started = TRUE;
- ese = es_event_peek();
- e_event_emit((EEvent *)ese, "started.done", (EEventTarget *)es_event_target_new_shell(ese, shell));
- }
- return window;
-}
+ e_shell_settings_bind_to_gconf (
+ shell->priv->settings, "disable-printing",
+ "/desktop/gnome/lockdown/disable_printing");
-gboolean
-e_shell_request_close_window (EShell *shell,
- EShellWindow *shell_window)
-{
- g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
- g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), FALSE);
+ e_shell_settings_bind_to_gconf (
+ shell->priv->settings, "disable-print-setup",
+ "/desktop/gnome/lockdown/disable_print_setup");
- e_shell_save_settings (shell);
+ e_shell_settings_bind_to_gconf (
+ shell->priv->settings, "disable-save-to-disk",
+ "/desktop/gnome/lockdown/disable_save_to_disk");
+}
- if (g_list_length (shell->priv->windows) != 1) {
- /* Not the last window. */
- return TRUE;
+GType
+e_shell_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (EShellClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) shell_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EShell),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) shell_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ UNIQUE_TYPE_APP, "EShell", &type_info, 0);
}
- return e_shell_quit(shell);
+ return type;
}
-#if 0 /* FIXME */
/**
- * e_shell_peek_uri_schema_registry:
- * @shell: An EShell object.
+ * e_shell_get_default:
*
- * Get the schema registry associated to @shell.
+ * Returns the #EShell created by <function>main()</function>.
*
- * Return value: A pointer to the EUriSchemaRegistry associated to @shell.
+ * Try to obtain the #EShell from elsewhere if you can. This function
+ * is intended as a temporary workaround for when that proves difficult.
+ *
+ * Returns: the #EShell singleton
**/
-EUriSchemaRegistry *
-e_shell_peek_uri_schema_registry (EShell *shell)
+EShell *
+e_shell_get_default (void)
{
- g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+ /* Emit a warning if we call this too early. */
+ g_return_val_if_fail (default_shell != NULL, NULL);
- return shell->priv->uri_schema_registry;
+ return default_shell;
}
-#endif
-
/**
- * e_shell_peek_component_registry:
- * @shell:
+ * e_shell_get_shell_backends:
+ * @shell: an #EShell
*
- * Get the component registry associated to @shell.
+ * Returns a list of loaded #EShellBackend instances. The list is
+ * owned by @shell and should not be modified or freed.
*
- * Return value:
+ * Returns: a list of loaded #EShellBackend instances
**/
-EComponentRegistry *
-e_shell_peek_component_registry (EShell *shell)
+GList *
+e_shell_get_shell_backends (EShell *shell)
{
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- return shell->priv->component_registry;
+ return shell->priv->loaded_backends;
}
-
/**
- * e_shell_save_settings:
- * @shell:
+ * e_shell_get_canonical_name:
+ * @shell: an #EShell
+ * @name: the name or alias of an #EShellBackend
*
- * Save the settings for this shell.
+ * Returns the canonical name for the #EShellBackend whose name or alias
+ * is @name.
*
- * Return value: %TRUE if it worked, %FALSE otherwise. Even if %FALSE is
- * returned, it is possible that at least part of the settings for the windows
- * have been saved.
+ * Returns: the canonical #EShellBackend name
**/
-gboolean
-e_shell_save_settings (EShell *shell)
+const gchar *
+e_shell_get_canonical_name (EShell *shell,
+ const gchar *name)
{
- GConfClient *client;
- gboolean is_offline;
+ EShellBackend *shell_backend;
+
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- is_offline = ( e_shell_get_line_status (shell) == E_SHELL_LINE_STATUS_OFFLINE || e_shell_get_line_status (shell) == E_SHELL_LINE_STATUS_FORCED_OFFLINE);
+ /* Handle NULL name arguments silently. */
+ if (name == NULL)
+ return NULL;
- client = gconf_client_get_default ();
- gconf_client_set_bool (client, "/apps/evolution/shell/start_offline", is_offline, NULL);
- g_object_unref (client);
+ shell_backend = e_shell_get_backend_by_name (shell, name);
- return TRUE;
+ if (shell_backend == NULL)
+ return NULL;
+
+ return E_SHELL_BACKEND_GET_CLASS (shell_backend)->name;
}
/**
- * e_shell_close_all_windows:
- * @shell:
+ * e_shell_get_backend_by_name:
+ * @shell: an #EShell
+ * @name: the name or alias of an #EShellBackend
+ *
+ * Returns the corresponding #EShellBackend for the given name or alias,
+ * or %NULL if @name is not recognized.
*
- * Destroy all the windows in @shell.
+ * Returns: the #EShellBackend named @name, or %NULL
**/
-void
-e_shell_close_all_windows (EShell *shell)
+EShellBackend *
+e_shell_get_backend_by_name (EShell *shell,
+ const gchar *name)
{
- EShellPrivate *priv;
- GList *p, *pnext;
-
- g_return_if_fail (shell != NULL);
- g_return_if_fail (E_IS_SHELL (shell));
+ GHashTable *hash_table;
- if (shell->priv->windows)
- e_shell_save_settings (shell);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+ g_return_val_if_fail (name != NULL, NULL);
- priv = shell->priv;
- for (p = priv->windows; p != NULL; p = pnext) {
- pnext = p->next;
+ hash_table = shell->priv->backends_by_name;
- /* Note that this will also remove the window from the list... Hence the
- need for the pnext variable. */
- gtk_widget_destroy (GTK_WIDGET (p->data));
- }
+ return g_hash_table_lookup (hash_table, name);
}
/**
- * e_shell_get_line_status:
- * @shell: A pointer to an EShell object.
+ * e_shell_get_backend_by_scheme:
+ * @shell: an #EShell
+ * @scheme: a URI scheme
*
- * Get the line status for @shell.
+ * Returns the #EShellBackend that implements the given URI scheme,
+ * or %NULL if @scheme is not recognized.
*
- * Return value: The current line status for @shell.
+ * Returns: the #EShellBackend that implements @scheme, or %NULL
**/
-EShellLineStatus
-e_shell_get_line_status (EShell *shell)
+EShellBackend *
+e_shell_get_backend_by_scheme (EShell *shell,
+ const gchar *scheme)
{
- g_return_val_if_fail (shell != NULL, E_SHELL_LINE_STATUS_OFFLINE);
- g_return_val_if_fail (E_IS_SHELL (shell), E_SHELL_LINE_STATUS_OFFLINE);
-
- return shell->priv->line_status;
-}
+ GHashTable *hash_table;
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+ g_return_val_if_fail (scheme != NULL, NULL);
-/* Offline/online handling. */
+ hash_table = shell->priv->backends_by_scheme;
-static void
-set_line_status_finished(EShell *shell)
+ return g_hash_table_lookup (hash_table, scheme);
+}
+/**
+ * e_shell_get_shell_settings:
+ * @shell: an #EShell
+ *
+ * Returns the #EShellSettings instance for @shell.
+ *
+ * Returns: the #EShellSettings instance for @shell
+ **/
+EShellSettings *
+e_shell_get_shell_settings (EShell *shell)
{
- EShellPrivate *priv = shell->priv;
- ESEvent *ese;
-
- priv->line_status = priv->line_status_working;
-
- e_passwords_set_online (priv->line_status == E_SHELL_LINE_STATUS_ONLINE);
- g_signal_emit (shell, signals[LINE_STATUS_CHANGED], 0, priv->line_status);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- /** @Event: Shell online state changed
- * @Id: state.changed
- * @Target: ESMenuTargetState
- *
- * This event is emitted whenever the shell online state changes.
- *
- * Only the online and offline states are emitted.
- */
- ese = es_event_peek();
- e_event_emit((EEvent *)ese, "state.changed", (EEventTarget *)es_event_target_new_state(ese, priv->line_status == E_SHELL_LINE_STATUS_ONLINE));
+ return shell->priv->settings;
}
-static void
-set_line_status_complete(EvolutionListener *el, void *data)
+/**
+ * e_shell_get_gconf_client:
+ * @shell: an #EShell
+ *
+ * Returns the default #GConfClient. This function is purely for
+ * convenience. The @shell owns the reference so you don't have to.
+ *
+ * Returns: the default #GConfClient
+ **/
+GConfClient *
+e_shell_get_gconf_client (EShell *shell)
{
- EShell *shell = data;
- EShellPrivate *priv = shell->priv;
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- if (priv->line_status_pending > 0) {
- priv->line_status_pending--;
- if (priv->line_status_pending == 0)
- set_line_status_finished(shell);
- }
+ return shell->priv->gconf_client;
}
-void
-e_shell_set_line_status (EShell *shell,
- GNOME_Evolution_ShellState shell_state)
+/**
+ * e_shell_create_shell_window:
+ * @shell: an #EShell
+ * @view_name: name of the initial shell view, or %NULL
+ *
+ * Creates a new #EShellWindow and emits the #EShell::window-created
+ * signal. Use this function instead of e_shell_window_new() so that
+ * @shell can track the window.
+ *
+ * Returns: a new #EShellWindow
+ **/
+GtkWidget *
+e_shell_create_shell_window (EShell *shell,
+ const gchar *view_name)
{
- EShellPrivate *priv;
- GSList *component_infos;
- GSList *p;
- CORBA_Environment ev;
- GConfClient *client;
- gboolean status;
- gboolean forced = FALSE;
-
- priv = shell->priv;
-
- if (shell_state == GNOME_Evolution_FORCED_OFFLINE || shell_state == GNOME_Evolution_USER_OFFLINE) {
- status = FALSE;
- if (shell_state == GNOME_Evolution_FORCED_OFFLINE)
- forced = TRUE;
- } else
- status = TRUE;
+ GtkWidget *shell_window;
+ UniqueMessageData *data;
+ UniqueApp *app;
- if ((status && priv->line_status == E_SHELL_LINE_STATUS_ONLINE)
- || (!status && priv->line_status == E_SHELL_LINE_STATUS_OFFLINE && !forced))
- return;
-
- /* we use 'going offline' to mean 'changing status' now */
- priv->line_status = E_SHELL_LINE_STATUS_GOING_OFFLINE;
- g_signal_emit (shell, signals[LINE_STATUS_CHANGED], 0, priv->line_status);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- client = gconf_client_get_default ();
- gconf_client_set_bool (client, "/apps/evolution/shell/start_offline", !status, NULL);
- g_object_unref (client);
+ app = UNIQUE_APP (shell);
- priv->line_status_working = status?E_SHELL_LINE_STATUS_ONLINE: forced?E_SHELL_LINE_STATUS_FORCED_OFFLINE:E_SHELL_LINE_STATUS_OFFLINE;
- /* we start at 2: setLineStatus could recursively call back, we therefore
- `need to not complete till we're really complete */
- priv->line_status_pending += 2;
+ if (unique_app_is_running (app))
+ goto unique;
- component_infos = e_component_registry_peek_list (priv->component_registry);
- for (p = component_infos; p != NULL; p = p->next) {
- EComponentInfo *info = p->data;
+ view_name = e_shell_get_canonical_name (shell, view_name);
- CORBA_exception_init (&ev);
+ /* EShellWindow initializes its active view from a GConf key,
+ * so set the key ahead of time to control the intial view. */
+ if (view_name != NULL) {
+ GConfClient *client;
+ const gchar *key;
+ GError *error = NULL;
- GNOME_Evolution_Component_setLineStatus(info->iface, shell_state, bonobo_object_corba_objref((BonoboObject *)priv->line_status_listener), &ev);
- if (ev._major == CORBA_NO_EXCEPTION)
- priv->line_status_pending++;
+ client = e_shell_get_gconf_client (shell);
+ key = "/apps/evolution/shell/view_defaults/component_id";
+ gconf_client_set_string (client, key, view_name, &error);
- CORBA_exception_free (&ev);
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
}
- priv->line_status_pending -= 2;
- if (priv->line_status_pending == 0)
- set_line_status_finished(shell);
-}
+ shell_window = e_shell_window_new (shell, shell->priv->safe_mode);
-gboolean
-e_shell_get_crash_recovery (EShell *shell)
-{
- g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+ gtk_widget_show (shell_window);
- return shell->priv->crash_recovery;
-}
+ return shell_window;
-void
-e_shell_set_crash_recovery (EShell *shell,
- gboolean crash_recovery)
-{
- g_return_if_fail (E_IS_SHELL (shell));
+unique: /* Send a message to the other Evolution process. */
- shell->priv->crash_recovery = crash_recovery;
+ /* XXX Do something with UniqueResponse? */
+
+ if (view_name != NULL) {
+ data = unique_message_data_new ();
+ unique_message_data_set_text (data, view_name, -1);
+ unique_app_send_message (app, UNIQUE_NEW, data);
+ unique_message_data_free (data);
+ } else
+ unique_app_send_message (app, UNIQUE_ACTIVATE, NULL);
+
+ return NULL;
}
-void
-e_shell_send_receive (EShell *shell)
+/**
+ * e_shell_handle_uris:
+ * @shell: an #EShell
+ * @uris: %NULL-terminated list of URIs
+ *
+ * Emits the #EShell::handle-uri signal for each URI.
+ *
+ * Returns: the number of URIs successfully handled
+ **/
+guint
+e_shell_handle_uris (EShell *shell,
+ gchar **uris)
{
- GSList *component_list;
- GSList *p;
+ UniqueApp *app;
+ UniqueMessageData *data;
+ guint n_handled = 0;
+ gint ii;
- g_return_if_fail (E_IS_SHELL (shell));
+ g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+ g_return_val_if_fail (uris != NULL, FALSE);
- component_list = e_component_registry_peek_list (shell->priv->component_registry);
+ app = UNIQUE_APP (shell);
- for (p = component_list; p != NULL; p = p->next) {
- EComponentInfo *info = p->data;
- CORBA_Environment ev;
+ if (unique_app_is_running (app))
+ goto unique;
- CORBA_exception_init (&ev);
+ for (ii = 0; uris[ii] != NULL; ii++) {
+ gboolean handled;
- GNOME_Evolution_Component_sendAndReceive (info->iface, &ev);
+ g_signal_emit (
+ shell, signals[HANDLE_URI],
+ 0, uris[ii], &handled);
+ n_handled += handled ? 1 : 0;
+ }
- /* Ignore errors, the components can decide to not implement
- this interface. */
+ return n_handled;
- CORBA_exception_free (&ev);
- }
-}
+unique: /* Send a message to the other Evolution process. */
+
+ /* XXX Do something with UniqueResponse? */
+
+ data = unique_message_data_new ();
+ unique_message_data_set_uris (data, uris);
+ unique_app_send_message (app, UNIQUE_OPEN, data);
+ unique_message_data_free (data);
+ return 0;
+}
+/**
+ * e_shell_watch_window:
+ * @shell: an #EShell
+ * @window: a #GtkWindow
+ *
+ * Makes @shell "watch" a newly created toplevel window, and emits the
+ * #EShell::window-created signal. All #EShellWindow<!-- -->s should be
+ * watched, along with any editor or viewer windows that may be shown in
+ * response to e_shell_handle_uris(). When the last watched window is
+ * closed, Evolution terminates.
+ **/
void
-e_shell_show_settings (EShell *shell,
- const char *type,
- EShellWindow *shell_window)
+e_shell_watch_window (EShell *shell,
+ GtkWindow *window)
{
- EShellPrivate *priv;
+ GList *list;
- g_return_if_fail (shell != NULL);
g_return_if_fail (E_IS_SHELL (shell));
+ g_return_if_fail (GTK_IS_WINDOW (window));
- priv = shell->priv;
+ list = shell->priv->watched_windows;
- if (priv->settings_dialog.widget != NULL) {
- gdk_window_show (priv->settings_dialog.widget->window);
- gtk_widget_grab_focus (priv->settings_dialog.widget);
+ /* Ignore duplicates. */
+ if (g_list_find (list, window) != NULL)
return;
- }
- priv->settings_dialog.widget = e_shell_settings_dialog_new ();
+ list = g_list_prepend (list, window);
+ shell->priv->watched_windows = list;
- if (type != NULL)
- e_shell_settings_dialog_show_type (E_SHELL_SETTINGS_DIALOG (priv->settings_dialog.widget), type);
+ unique_app_watch_window (UNIQUE_APP (shell), window);
- g_object_add_weak_pointer (G_OBJECT (priv->settings_dialog.widget), &priv->settings_dialog.pointer);
+ g_signal_connect_swapped (
+ window, "delete-event",
+ G_CALLBACK (shell_window_delete_event_cb), shell);
- gtk_window_set_transient_for (GTK_WINDOW (priv->settings_dialog.widget), GTK_WINDOW (shell_window));
- gtk_widget_show (priv->settings_dialog.widget);
-}
+ g_signal_connect_swapped (
+ window, "focus-in-event",
+ G_CALLBACK (shell_window_focus_in_event_cb), shell);
+ g_object_weak_ref (
+ G_OBJECT (window), (GWeakNotify)
+ shell_window_weak_notify_cb, shell);
-const char *
-e_shell_construct_result_to_string (EShellConstructResult result)
-{
- switch (result) {
- case E_SHELL_CONSTRUCT_RESULT_OK:
- return _("OK");
- case E_SHELL_CONSTRUCT_RESULT_INVALIDARG:
- return _("Invalid arguments");
- case E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER:
- return _("Cannot register on OAF");
- case E_SHELL_CONSTRUCT_RESULT_NOCONFIGDB:
- return _("Configuration Database not found");
- case E_SHELL_CONSTRUCT_RESULT_GENERICERROR:
- return _("Generic error");
- default:
- return _("Unknown error");
- }
+ g_signal_emit (shell, signals[WINDOW_CREATED], 0, window);
}
-/* timeout handler, so returns TRUE if we can't quit yet */
-static gboolean
-es_run_quit(EShell *shell)
+/**
+ * e_shell_get_watched_windows:
+ * @shell: an #EShell
+ *
+ * Returns a list of windows being watched by @shell. The list is sorted
+ * by the most recently focused window, such that the first instance is the
+ * currently focused window. (Useful for choosing a parent for a transient
+ * window.) The list is owned by @shell and should not be modified or freed.
+ *
+ * Returns: a list of watched windows
+ **/
+GList *
+e_shell_get_watched_windows (EShell *shell)
{
- EShellPrivate *priv;
- GSList *component_infos;
- GSList *sp;
- CORBA_boolean done_quit;
-
- g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
-
- priv = shell->priv;
- priv->preparing_to_quit = TRUE;
-
- component_infos = e_component_registry_peek_list (priv->component_registry);
- done_quit = TRUE;
- for (sp = component_infos; sp != NULL; sp = sp->next) {
- EComponentInfo *info = sp->data;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- done_quit = GNOME_Evolution_Component_quit(info->iface, &ev);
- if (BONOBO_EX (&ev)) {
- /* The component might not implement the interface, in which case we assume we can quit. */
- done_quit = TRUE;
- }
-
- CORBA_exception_free (&ev);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- if (!done_quit)
- break;
- }
+ return shell->priv->watched_windows;
+}
- if (done_quit) {
- if (priv->quit_timeout) {
- g_source_remove(priv->quit_timeout);
- priv->quit_timeout = 0;
- }
- e_shell_close_all_windows(shell);
- } else if (priv->quit_timeout == 0) {
- priv->quit_timeout = g_timeout_add(500, (GSourceFunc)es_run_quit, shell);
- }
+/**
+ * e_shell_send_receive:
+ * @shell: an #EShell
+ * @parent: the parent #GtkWindow
+ *
+ * Emits the #EShell::send-receive signal.
+ **/
+void
+e_shell_send_receive (EShell *shell,
+ GtkWindow *parent)
+{
+ g_return_if_fail (E_IS_SHELL (shell));
+ g_return_if_fail (GTK_IS_WINDOW (parent));
- return !done_quit;
+ g_signal_emit (shell, signals[SEND_RECEIVE], 0, parent);
}
+/**
+ * e_shell_get_network_available:
+ * @shell: an #EShell
+ *
+ * Returns %TRUE if a network is available.
+ *
+ * Returns: %TRUE if a network is available
+ **/
gboolean
-e_shell_can_quit (EShell *shell)
+e_shell_get_network_available (EShell *shell)
{
- EShellPrivate *priv;
- GSList *component_infos;
- GSList *sp;
- CORBA_boolean can_quit;
-
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
- priv = shell->priv;
-
- if (priv->preparing_to_quit)
- return FALSE;
-
- component_infos = e_component_registry_peek_list (priv->component_registry);
- can_quit = TRUE;
- for (sp = component_infos; sp != NULL; sp = sp->next) {
- EComponentInfo *info = sp->data;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
+ return shell->priv->network_available;
+}
- can_quit = GNOME_Evolution_Component_requestQuit (info->iface, &ev);
- if (BONOBO_EX (&ev)) {
- /* The component might not implement the interface, in which case we assume we can quit. */
- can_quit = TRUE;
- }
+/**
+ * e_shell_set_network_available:
+ * @shell: an #EShell
+ * @network_available: whether a network is available
+ *
+ * Sets whether a network is available. This is usually called in
+ * response to a status change signal from NetworkManager. If the
+ * network becomes unavailable while #EShell:online is %TRUE, the
+ * @shell will force #EShell:online to %FALSE until the network
+ * becomes available again.
+ **/
+void
+e_shell_set_network_available (EShell *shell,
+ gboolean network_available)
+{
+ g_return_if_fail (E_IS_SHELL (shell));
- CORBA_exception_free (&ev);
+ if (network_available == shell->priv->network_available)
+ return;
- if (! can_quit)
- break;
+ shell->priv->network_available = network_available;
+ g_object_notify (G_OBJECT (shell), "network-available");
+
+ /* If we're being forced offline, perhaps due to a network outage,
+ * reconnect automatically when the network becomes available. */
+ if (!network_available && shell->priv->online) {
+ g_message ("Network disconnected. Forced offline.");
+ e_shell_set_online (shell, FALSE);
+ shell->priv->auto_reconnect = TRUE;
+ } else if (network_available && shell->priv->auto_reconnect) {
+ g_message ("Connection established. Going online.");
+ e_shell_set_online (shell, TRUE);
+ shell->priv->auto_reconnect = FALSE;
}
-
- return can_quit;
}
+/**
+ * e_shell_get_online:
+ * @shell: an #EShell
+ *
+ * Returns %TRUE if Evolution is online, %FALSE if Evolution is offline.
+ * Evolution may be offline because the user elected to work offline, or
+ * because the network has become unavailable.
+ *
+ * Returns: %TRUE if Evolution is online
+ **/
gboolean
-e_shell_do_quit (EShell *shell)
+e_shell_get_online (EShell *shell)
{
- EShellPrivate *priv;
- GList *p;
- gboolean can_quit;
-
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
- priv = shell->priv;
-
- if (priv->preparing_to_quit)
- return FALSE;
-
- for (p = shell->priv->windows; p != NULL; p = p->next) {
- gtk_widget_set_sensitive (GTK_WIDGET (p->data), FALSE);
-
- if (p == shell->priv->windows)
- e_shell_window_save_defaults (p->data);
- }
-
- can_quit = !es_run_quit (shell);
-
- /* Mark a safe quit by destroying the lock. */
- e_file_lock_destroy ();
-
- return can_quit;
+ return shell->priv->online;
}
-gboolean
-e_shell_quit (EShell *shell)
+/**
+ * e_shell_set_online:
+ * @shell: an #EShell
+ * @online: %TRUE to go online, %FALSE to go offline
+ *
+ * Asynchronously places Evolution in online or offline mode.
+ **/
+void
+e_shell_set_online (EShell *shell,
+ gboolean online)
{
- return e_shell_can_quit (shell) && e_shell_do_quit (shell);
+ g_return_if_fail (E_IS_SHELL (shell));
+
+ if (online == shell->priv->online)
+ return;
+
+ if (online)
+ shell_prepare_for_online (shell);
+ else
+ shell_prepare_for_offline (shell);
}
/**
- * gboolean (*EMainShellFunc) (EShell *shell, EShellWindow *window, gpointer user_data);
- * Function used in @ref e_shell_foreach_shell_window.
- * @param shell Pointer to EShell.
- * @param window Pointer to EShellWindow.
- * @param user_data User's data passed to @ref main_shell_foreach_shell_window.
- * @return TRUE if need to go to next window, FALSE when stop looking for next window.
+ * e_shell_get_preferences_window:
+ * @shell: an #EShell
+ *
+ * Returns the Evolution Preferences window.
+ *
+ * Returns: the preferences window
**/
+GtkWidget *
+e_shell_get_preferences_window (EShell *shell)
+{
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+
+ return shell->priv->preferences_window;
+}
/**
- * e_shell_foreach_shell_window
- * This will call function callback for all known EShellWindow of main shell.
- * When there is no shell active, then this will do nothing.
- * @param shell EShell instance.
- * @param func Function to be called.
- * @param user_data User data to pass to func.
+ * e_shell_event:
+ * @shell: an #EShell
+ * @event_name: the name of the event
+ * @event_data: data associated with the event
+ *
+ * The #EShell::event signal acts as a cheap mechanism for broadcasting
+ * events to the rest of the application, such as new mail arriving. The
+ * @event_name is used as the signal detail, and @event_data may point to
+ * an object or data structure associated with the event.
**/
void
-e_shell_foreach_shell_window (EShell *shell, EMainShellFunc func, gpointer user_data)
+e_shell_event (EShell *shell,
+ const gchar *event_name,
+ gpointer event_data)
{
- EShellPrivate *priv;
- GList *p;
-
- if (!shell)
- return;
+ GQuark detail;
- priv = shell->priv;
+ g_return_if_fail (E_IS_SHELL (shell));
+ g_return_if_fail (event_name != NULL);
- for (p = priv->windows; p != NULL; p = p->next) {
- EShellWindow *window;
+ detail = g_quark_from_string (event_name);
+ g_signal_emit (shell, signals[EVENT], detail, event_data);
+}
- window = E_SHELL_WINDOW (p->data);
+gboolean
+e_shell_is_busy (EShell *shell)
+{
+ /* FIXME */
+ return FALSE;
+}
- if (window && !func (shell, window, user_data))
- break;
- }
+gboolean
+e_shell_do_quit (EShell *shell)
+{
+ /* FIXME */
+ return TRUE;
}
-BONOBO_TYPE_FUNC_FULL (EShell, GNOME_Evolution_Shell, PARENT_TYPE, e_shell)
+gboolean
+e_shell_quit (EShell *shell)
+{
+ /* FIXME */
+ return TRUE;
+}
diff --git a/shell/e-shell.h b/shell/e-shell.h
index e8451e3b5b..1d0b9ab705 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -1,4 +1,6 @@
/*
+ * e-shell.h
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,136 +15,99 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifndef _E_SHELL_H_
-#define _E_SHELL_H_
-
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo/bonobo-object.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-typedef struct _EShell EShell;
+/**
+ * SECTION: e-shell
+ * @short_description: the backbone of Evolution
+ * @include: shell/e-shell.h
+ **/
+
+#ifndef E_SHELL_H
+#define E_SHELL_H
+
+#include <unique/unique.h>
+#include <gconf/gconf-client.h>
+#include <shell/e-shell-common.h>
+#include <shell/e-shell-backend.h>
+#include <shell/e-shell-settings.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SHELL \
+ (e_shell_get_type ())
+#define E_SHELL(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SHELL, EShell))
+#define E_SHELL_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SHELL, EShellClass))
+#define E_IS_SHELL(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SHELL))
+#define E_IS_SHELL_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SHELL))
+#define E_SHELL_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SHELL, EShellClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EShell EShell;
+typedef struct _EShellClass EShellClass;
typedef struct _EShellPrivate EShellPrivate;
-typedef struct _EShellClass EShellClass;
-
-#include "Evolution.h"
-
-#include "e-component-registry.h"
-#include "e-shell-window.h"
-
-
-#define E_TYPE_SHELL (e_shell_get_type ())
-#define E_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SHELL, EShell))
-#define E_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL, EShellClass))
-#define E_IS_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SHELL))
-#define E_IS_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL))
-
-
-enum _EShellLineStatus {
- E_SHELL_LINE_STATUS_ONLINE,
- E_SHELL_LINE_STATUS_GOING_OFFLINE, /* NB: really means changing state in either direction */
- E_SHELL_LINE_STATUS_OFFLINE,
- E_SHELL_LINE_STATUS_FORCED_OFFLINE
-};
-typedef enum _EShellLineStatus EShellLineStatus;
-
-enum _EShellStartupLineMode {
- E_SHELL_STARTUP_LINE_MODE_CONFIG,
- E_SHELL_STARTUP_LINE_MODE_ONLINE,
- E_SHELL_STARTUP_LINE_MODE_OFFLINE
-};
-typedef enum _EShellStartupLineMode EShellStartupLineMode;
+/**
+ * EShell:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
struct _EShell {
- BonoboObject parent;
-
+ UniqueApp parent;
EShellPrivate *priv;
};
struct _EShellClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Shell__epv epv;
-
- void (* no_windows_left) (EShell *shell);
- void (* line_status_changed) (EShell *shell, EShellLineStatus status);
- void (* new_window_created) (EShell *shell, EShellWindow *window);
-};
-
-
-/* ID for registering the shell in the OAF name service. */
-#define E_SHELL_OAFIID "OAFIID:GNOME_Evolution_Shell:" BASE_VERSION
-
-enum _EShellConstructResult {
- E_SHELL_CONSTRUCT_RESULT_OK,
- E_SHELL_CONSTRUCT_RESULT_INVALIDARG,
- E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER,
- E_SHELL_CONSTRUCT_RESULT_NOCONFIGDB,
- E_SHELL_CONSTRUCT_RESULT_GENERICERROR
+ UniqueAppClass parent_class;
};
-typedef enum _EShellConstructResult EShellConstructResult;
-
-
-GType e_shell_get_type (void);
-EShellConstructResult e_shell_construct (EShell *shell,
- const char *iid,
- EShellStartupLineMode startup_line_mode);
-EShell *e_shell_new (EShellStartupLineMode startup_line_mode,
- EShellConstructResult *construct_result_return);
-
-gboolean e_shell_attempt_upgrade (EShell *shell);
-
-EShellWindow *e_shell_create_window (EShell *shell,
- const char *component_id,
- EShellWindow *template_window);
-gboolean e_shell_request_close_window (EShell *shell,
- EShellWindow *window);
-
-
-#if 0
-EUriSchemaRegistry *e_shell_peek_uri_schema_registry (EShell *shell);
-#endif
-
-EComponentRegistry *e_shell_peek_component_registry (EShell *shell);
-
-gboolean e_shell_save_settings (EShell *shell);
-void e_shell_close_all_windows (EShell *shell);
-
-EShellLineStatus e_shell_get_line_status (EShell *shell);
-void e_shell_set_line_status (EShell *shell,
- GNOME_Evolution_ShellState shell_state);
-
-gboolean e_shell_get_crash_recovery (EShell *shell);
-void e_shell_set_crash_recovery (EShell *shell,
- gboolean crash_recovery);
-
-void e_shell_send_receive (EShell *shell);
-
-void e_shell_show_settings (EShell *shell,
- const char *type,
- EShellWindow *shell_window);
-
-gboolean e_shell_can_quit (EShell *shell);
-gboolean e_shell_do_quit (EShell *shell);
-gboolean e_shell_quit (EShell *shell);
-
-const char *e_shell_construct_result_to_string (EShellConstructResult result);
-
-typedef gboolean (*EMainShellFunc) (EShell *shell, EShellWindow *window, gpointer user_data);
-void e_shell_foreach_shell_window (EShell *shell, EMainShellFunc func, gpointer user_data);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* _E_SHELL_H_ */
+GType e_shell_get_type (void);
+EShell * e_shell_get_default (void);
+GList * e_shell_get_shell_backends (EShell *shell);
+const gchar * e_shell_get_canonical_name (EShell *shell,
+ const gchar *name);
+EShellBackend * e_shell_get_backend_by_name (EShell *shell,
+ const gchar *name);
+EShellBackend * e_shell_get_backend_by_scheme (EShell *shell,
+ const gchar *scheme);
+EShellSettings *e_shell_get_shell_settings (EShell *shell);
+GConfClient * e_shell_get_gconf_client (EShell *shell);
+GtkWidget * e_shell_create_shell_window (EShell *shell,
+ const gchar *view_name);
+guint e_shell_handle_uris (EShell *shell,
+ gchar **uris);
+void e_shell_watch_window (EShell *shell,
+ GtkWindow *window);
+GList * e_shell_get_watched_windows (EShell *shell);
+void e_shell_send_receive (EShell *shell,
+ GtkWindow *parent);
+gboolean e_shell_get_network_available (EShell *shell);
+void e_shell_set_network_available (EShell *shell,
+ gboolean network_available);
+gboolean e_shell_get_online (EShell *shell);
+void e_shell_set_online (EShell *shell,
+ gboolean online);
+GtkWidget * e_shell_get_preferences_window (EShell *shell);
+void e_shell_event (EShell *shell,
+ const gchar *event_name,
+ gpointer event_data);
+gboolean e_shell_is_busy (EShell *shell);
+gboolean e_shell_do_quit (EShell *shell);
+gboolean e_shell_quit (EShell *shell);
+
+G_END_DECLS
+
+#endif /* E_SHELL_H */
diff --git a/shell/e-sidebar.c b/shell/e-sidebar.c
deleted file mode 100644
index d4c02e63ce..0000000000
--- a/shell/e-sidebar.c
+++ /dev/null
@@ -1,795 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-sidebar.h"
-
-#include "e-util/e-util.h"
-
-#include <gconf/gconf-client.h>
-
-typedef struct {
- GtkWidget *button_widget;
- GtkWidget *label;
- GtkWidget *icon;
- GtkWidget *hbox;
- gchar *default_icon_name;
- int id;
-} Button;
-
-struct _ESidebarPrivate {
- ESidebarMode mode;
- ESidebarMode toolbar_mode;
-
- gboolean show;
-
- GtkWidget *selection_widget;
- GSList *buttons;
-
- guint style_changed_id;
-
- gboolean in_toggle;
-};
-
-
-enum {
- BUTTON_SELECTED,
- BUTTON_PRESSED,
- NUM_SIGNALS
-};
-
-static unsigned int signals[NUM_SIGNALS] = { 0 };
-
-G_DEFINE_TYPE (ESidebar, e_sidebar, GTK_TYPE_CONTAINER)
-
-#define INTERNAL_MODE(sidebar) (sidebar->priv->mode == E_SIDEBAR_MODE_TOOLBAR ? sidebar->priv->toolbar_mode : sidebar->priv->mode)
-#define H_PADDING 6
-#define V_PADDING 6
-
-/* Utility functions. */
-
-static Button *
-button_new (GtkWidget *button_widget,
- GtkWidget *label,
- GtkWidget *icon,
- GtkWidget *hbox,
- int id)
-{
- Button *button = g_new (Button, 1);
- const gchar *icon_name;
-
- button->button_widget = button_widget;
- button->label = label;
- button->icon = icon;
- button->hbox = hbox;
- button->id = id;
-
- gtk_image_get_icon_name (GTK_IMAGE (icon), &icon_name, NULL);
- button->default_icon_name = g_strdup (icon_name);
-
- g_object_ref (button_widget);
- g_object_ref (label);
- g_object_ref (icon);
- g_object_ref (hbox);
-
- return button;
-}
-
-static void
-button_free (Button *button)
-{
- g_object_unref (button->button_widget);
- g_object_unref (button->label);
- g_object_unref (button->icon);
- g_object_unref (button->hbox);
- g_free (button->default_icon_name);
- g_free (button);
-}
-
-static void
-update_buttons (ESidebar *sidebar, int new_selected_id)
-{
- GSList *p;
-
- sidebar->priv->in_toggle = TRUE;
-
- for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
- Button *button = p->data;
-
- if (button->id == new_selected_id)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button->button_widget), TRUE);
- else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button->button_widget), FALSE);
- }
-
- sidebar->priv->in_toggle = FALSE;
-}
-
-
-/* Callbacks. */
-
-static void
-button_toggled_callback (GtkToggleButton *toggle_button,
- ESidebar *sidebar)
-{
- int id = 0;
- gboolean is_active = FALSE;
- GSList *p;
-
- if (sidebar->priv->in_toggle)
- return;
-
- sidebar->priv->in_toggle = TRUE;
-
- if (gtk_toggle_button_get_active (toggle_button))
- is_active = TRUE;
-
- for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
- Button *button = p->data;
-
- if (button->button_widget != GTK_WIDGET (toggle_button)) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button->button_widget), FALSE);
- } else {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button->button_widget), TRUE);
- id = button->id;
- }
- }
-
- sidebar->priv->in_toggle = FALSE;
-
- if (is_active)
- g_signal_emit (sidebar, signals[BUTTON_SELECTED], 0, id);
-}
-
-static gboolean
-button_pressed_callback (GtkToggleButton *toggle_button,
- GdkEventButton *event,
- ESidebar *sidebar)
-{
- gboolean return_val = FALSE;
- GSList *p;
-
- for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
- Button *button = p->data;
-
- if (button->button_widget == GTK_WIDGET (toggle_button))
- g_signal_emit (sidebar, signals [BUTTON_PRESSED],
- 0, event, button->id, &return_val);
- }
-
- return return_val;
-}
-
-static gboolean
-button_query_tooltip (GtkWidget *widget,
- gint x,
- gint y,
- gboolean keyboard_mode,
- GtkTooltip *tooltip,
- ESidebar *sidebar)
-{
- /* Show the tooltip only if the label is hidden */
- if (INTERNAL_MODE (sidebar) == E_SIDEBAR_MODE_ICON) {
- char *tip;
-
- tip = g_object_get_data (G_OBJECT (widget),
- "ESidebar:button-tooltip");
- if (tip) {
- gtk_tooltip_set_text (tooltip, tip);
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-
-/* Layout. */
-
-static int
-layout_buttons (ESidebar *sidebar)
-{
- GtkAllocation *allocation = & GTK_WIDGET (sidebar)->allocation;
- ESidebarMode mode;
- gboolean icons_only;
- int num_btns = g_slist_length (sidebar->priv->buttons), btns_per_row;
- GSList **rows, *p;
- Button *button;
- int row_number;
- int max_btn_width = 0, max_btn_height = 0;
- int row_last;
- int x, y;
- int i;
-
- y = allocation->y + allocation->height - V_PADDING - 1;
-
- if (num_btns == 0)
- return y;
-
- mode = INTERNAL_MODE (sidebar);
- icons_only = (mode == E_SIDEBAR_MODE_ICON);
-
- /* Figure out the max width and height */
- for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
- GtkRequisition requisition;
-
- button = p->data;
- gtk_widget_size_request (GTK_WIDGET (button->button_widget), &requisition);
-
- max_btn_height = MAX (max_btn_height, requisition.height);
- max_btn_width = MAX (max_btn_width, requisition.width);
- }
-
- /* Figure out how many rows and columns we'll use. */
- btns_per_row = allocation->width / (max_btn_width + H_PADDING);
- if (!icons_only) {
- /* If using text buttons, we want to try to have a
- * completely filled-in grid, but if we can't, we want
- * the odd row to have just a single button.
- */
- while (num_btns % btns_per_row > 1)
- btns_per_row--;
- }
-
- /* Assign buttons to rows */
- rows = g_new0 (GSList *, num_btns / btns_per_row + 1);
-
- if (!icons_only && num_btns % btns_per_row != 0) {
- button = sidebar->priv->buttons->data;
- rows [0] = g_slist_append (rows [0], button->button_widget);
-
- p = sidebar->priv->buttons->next;
- row_number = p ? 1 : 0;
- } else {
- p = sidebar->priv->buttons;
- row_number = 0;
- }
-
- for (; p != NULL; p = p->next) {
- button = p->data;
-
- if (g_slist_length (rows [row_number]) == btns_per_row)
- row_number ++;
-
- rows [row_number] = g_slist_append (rows [row_number], button->button_widget);
- }
-
- row_last = row_number;
-
- /* Layout the buttons. */
- for (i = row_last; i >= 0; i --) {
- int len, extra_width;
-
- y -= max_btn_height;
- x = H_PADDING + allocation->x;
- len = g_slist_length (rows[i]);
- if (mode == E_SIDEBAR_MODE_TEXT || mode == E_SIDEBAR_MODE_BOTH)
- extra_width = (allocation->width - (len * max_btn_width ) - (len * H_PADDING)) / len;
- else
- extra_width = 0;
- for (p = rows [i]; p != NULL; p = p->next) {
- GtkAllocation child_allocation;
-
- child_allocation.x = x;
- child_allocation.y = y;
- child_allocation.width = max_btn_width + extra_width;
- child_allocation.height = max_btn_height;
-
- gtk_widget_size_allocate (GTK_WIDGET (p->data), &child_allocation);
-
- x += child_allocation.width + H_PADDING;
- }
-
- y -= V_PADDING;
- }
-
- for (i = 0; i <= row_last; i ++)
- g_slist_free (rows [i]);
- g_free (rows);
-
- return y;
-}
-
-static void
-do_layout (ESidebar *sidebar)
-{
- GtkAllocation *allocation = & GTK_WIDGET (sidebar)->allocation;
- GtkAllocation child_allocation;
- int y;
-
- if (sidebar->priv->show)
- y = layout_buttons (sidebar);
- else
- y = allocation->y + allocation->height;
-
- /* Place the selection widget. */
- child_allocation.x = allocation->x;
- child_allocation.y = allocation->y;
- child_allocation.width = allocation->width;
- child_allocation.height = y - allocation->y;
-
- gtk_widget_size_allocate (sidebar->priv->selection_widget, & child_allocation);
-}
-
-
-/* GtkContainer methods. */
-
-static void
-impl_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- void *callback_data)
-{
- ESidebar *sidebar = E_SIDEBAR (container);
- GSList *p;
-
- if (sidebar->priv->selection_widget != NULL)
- (* callback) (sidebar->priv->selection_widget, callback_data);
-
- for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
- GtkWidget *widget = ((Button *) p->data)->button_widget;
- (* callback) (widget, callback_data);
- }
-}
-
-static void
-impl_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- ESidebar *sidebar = E_SIDEBAR (container);
- GSList *p;
-
- if (widget == sidebar->priv->selection_widget) {
- e_sidebar_set_selection_widget (sidebar, NULL);
- return;
- }
-
- for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
- GtkWidget *button_widget = ((Button *) p->data)->button_widget;
-
- if (button_widget == widget) {
- gtk_widget_unparent (button_widget);
- sidebar->priv->buttons = g_slist_remove_link (sidebar->priv->buttons, p);
- gtk_widget_queue_resize (GTK_WIDGET (sidebar));
- break;
- }
- }
-}
-
-
-/* GtkWidget methods. */
-
-static void
-impl_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- ESidebar *sidebar = E_SIDEBAR (widget);
- GSList *p;
-
- if (sidebar->priv->selection_widget == NULL) {
- requisition->width = 2 * H_PADDING;
- requisition->height = 2 * V_PADDING;
- } else {
- gtk_widget_size_request (sidebar->priv->selection_widget, requisition);
- }
-
- if (!sidebar->priv->show)
- return;
-
- for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
- Button *button = p->data;
- GtkRequisition button_requisition;
-
- gtk_widget_size_request (button->button_widget, &button_requisition);
-
- requisition->width = MAX (requisition->width, button_requisition.width + 2 * H_PADDING);
- requisition->height += button_requisition.height + V_PADDING;
- }
-}
-
-static void
-impl_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- widget->allocation = *allocation;
-
- do_layout (E_SIDEBAR (widget));
-}
-
-
-/* GObject methods. */
-
-static void
-impl_dispose (GObject *object)
-{
- ESidebarPrivate *priv = E_SIDEBAR (object)->priv;
- GConfClient *gconf_client = gconf_client_get_default ();
-
- g_slist_foreach (priv->buttons, (GFunc) button_free, NULL);
- g_slist_free (priv->buttons);
- priv->buttons = NULL;
-
- if (priv->style_changed_id) {
- gconf_client_notify_remove (gconf_client, priv->style_changed_id);
- priv->style_changed_id = 0;
- }
-
- g_object_unref (gconf_client);
-
- (* G_OBJECT_CLASS (e_sidebar_parent_class)->dispose) (object);
-}
-
-static gboolean
-boolean_handled_accumulator (GSignalInvocationHint *ihint,
- GValue *return_accu,
- const GValue *handler_return,
- gpointer dummy)
-{
- gboolean handled;
-
- handled = g_value_get_boolean (handler_return);
- g_value_set_boolean (return_accu, handled);
-
- return !handled;
-}
-
-static void
-impl_finalize (GObject *object)
-{
- ESidebarPrivate *priv = E_SIDEBAR (object)->priv;
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (e_sidebar_parent_class)->finalize) (object);
-}
-
-
-/* Initialization. */
-
-static void
-e_sidebar_class_init (ESidebarClass *klass)
-{
- GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- container_class->forall = impl_forall;
- container_class->remove = impl_remove;
-
- widget_class->size_request = impl_size_request;
- widget_class->size_allocate = impl_size_allocate;
-
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
-
- signals[BUTTON_SELECTED]
- = g_signal_new ("button_selected",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ESidebarClass, button_selected),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1,
- G_TYPE_INT);
- signals[BUTTON_PRESSED]
- = g_signal_new ("button_pressed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESidebarClass, button_pressed),
- boolean_handled_accumulator, NULL,
- e_marshal_NONE__POINTER_INT,
- G_TYPE_BOOLEAN, 2,
- G_TYPE_POINTER, G_TYPE_INT);
-}
-
-static void
-e_sidebar_init (ESidebar *sidebar)
-{
- ESidebarPrivate *priv;
-
- GTK_WIDGET_SET_FLAGS (sidebar, GTK_NO_WINDOW);
-
- priv = g_new0 (ESidebarPrivate, 1);
- sidebar->priv = priv;
-
- priv->mode = E_SIDEBAR_MODE_TEXT;
-}
-
-GtkWidget *
-e_sidebar_new (void)
-{
- ESidebar *sidebar = g_object_new (e_sidebar_get_type (), NULL);
-
- return GTK_WIDGET (sidebar);
-}
-
-
-void
-e_sidebar_set_selection_widget (ESidebar *sidebar, GtkWidget *widget)
-{
- if (sidebar->priv->selection_widget != NULL)
- gtk_widget_unparent (sidebar->priv->selection_widget);
-
- sidebar->priv->selection_widget = widget;
-
- if (widget != NULL)
- gtk_widget_set_parent (widget, GTK_WIDGET (sidebar));
-
- gtk_widget_queue_resize (GTK_WIDGET (sidebar));
-}
-
-
-void
-e_sidebar_add_button (ESidebar *sidebar,
- const char *label,
- const char *tooltips,
- const char *icon_name,
- int id)
-{
- GtkWidget *button_widget;
- GtkWidget *hbox;
- GtkWidget *icon_widget;
- GtkWidget *label_widget;
-
- button_widget = gtk_toggle_button_new ();
- if (sidebar->priv->show)
- gtk_widget_show (button_widget);
- g_signal_connect (button_widget, "toggled", G_CALLBACK (button_toggled_callback), sidebar);
- g_signal_connect (button_widget, "button_press_event",
- G_CALLBACK (button_pressed_callback), sidebar);
-
- hbox = gtk_hbox_new (FALSE, 3);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
- gtk_widget_show (hbox);
-
- icon_widget = gtk_image_new_from_icon_name (
- icon_name, GTK_ICON_SIZE_BUTTON);
- gtk_widget_show (icon_widget);
-
- label_widget = gtk_label_new (label);
- gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
- gtk_widget_show (label_widget);
-
- g_object_set_data_full (G_OBJECT (button_widget),
- "ESidebar:button-tooltip",
- g_strdup (tooltips),
- g_free);
- gtk_widget_set_has_tooltip (button_widget, TRUE);
- g_signal_connect (button_widget, "query-tooltip",
- G_CALLBACK (button_query_tooltip), sidebar);
-
- switch (INTERNAL_MODE (sidebar)) {
- case E_SIDEBAR_MODE_TEXT:
- gtk_box_pack_start (GTK_BOX (hbox), label_widget, TRUE, TRUE, 0);
- break;
- case E_SIDEBAR_MODE_ICON:
- gtk_box_pack_start (GTK_BOX (hbox), icon_widget, TRUE, TRUE, 0);
- break;
- case E_SIDEBAR_MODE_BOTH:
- default:
- gtk_box_pack_start (GTK_BOX (hbox), icon_widget, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), label_widget, TRUE, TRUE, 0);
- break;
- }
-
- gtk_container_add (GTK_CONTAINER (button_widget), hbox);
-
- sidebar->priv->buttons = g_slist_append (sidebar->priv->buttons, button_new (button_widget, label_widget, icon_widget, hbox, id));
- gtk_widget_set_parent (button_widget, GTK_WIDGET (sidebar));
-
- gtk_widget_queue_resize (GTK_WIDGET (sidebar));
-}
-
-/**
- * e_sidebar_change_button_icon
- * @sidebar: an #ESidebar
- * @icon_name: button icon name, or %NULL
- * @button_id: component's button ID, for which change the icon.
- *
- * This will change icon in icon_widget of the button of known component.
- * You cannot change icon as in a stack, only one default icon will be stored.
- **/
-void
-e_sidebar_change_button_icon (ESidebar *sidebar, const gchar *icon_name, int button_id)
-{
- GSList *p;
-
- g_return_if_fail (sidebar != NULL);
-
- for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
- Button *button = p->data;
-
- if (button->id == button_id) {
- if (!button->icon)
- break;
-
- if (icon_name == NULL)
- icon_name = button->default_icon_name;
-
- gtk_image_set_from_icon_name (
- GTK_IMAGE (button->icon),
- icon_name, GTK_ICON_SIZE_BUTTON);
-
- break;
- }
- }
-}
-
-void
-e_sidebar_select_button (ESidebar *sidebar, int id)
-{
- update_buttons (sidebar, id);
-
- g_signal_emit (sidebar, signals[BUTTON_SELECTED], 0, id);
-}
-
-ESidebarMode
-e_sidebar_get_mode (ESidebar *sidebar)
-{
- return sidebar->priv->mode;
-}
-
-
-static GConfEnumStringPair toolbar_styles[] = {
- { E_SIDEBAR_MODE_TEXT, "text" },
- { E_SIDEBAR_MODE_ICON, "icons" },
- { E_SIDEBAR_MODE_BOTH, "both" },
- { E_SIDEBAR_MODE_BOTH, "both-horiz" },
- { E_SIDEBAR_MODE_BOTH, "both_horiz" },
- { -1, NULL }
-};
-
-static void
-set_mode_internal (ESidebar *sidebar, ESidebarMode mode )
-{
- GSList *p;
-
- if (mode == INTERNAL_MODE (sidebar))
- return;
-
- for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
- Button *button = p->data;
-
- switch (mode) {
- case E_SIDEBAR_MODE_TEXT:
- gtk_container_remove (GTK_CONTAINER (button->hbox), button->icon);
- if (INTERNAL_MODE (sidebar) == E_SIDEBAR_MODE_ICON) {
- gtk_box_pack_start (GTK_BOX (button->hbox), button->label, TRUE, TRUE, 0);
- gtk_widget_show (button->label);
- }
- break;
- case E_SIDEBAR_MODE_ICON:
- gtk_container_remove(GTK_CONTAINER (button->hbox), button->label);
- if (INTERNAL_MODE (sidebar) == E_SIDEBAR_MODE_TEXT) {
- gtk_box_pack_start (GTK_BOX (button->hbox), button->icon, TRUE, TRUE, 0);
- gtk_widget_show (button->icon);
- } else
- gtk_container_child_set (GTK_CONTAINER (button->hbox), button->icon,
- "expand", TRUE,
- NULL);
- break;
- case E_SIDEBAR_MODE_BOTH:
- if (INTERNAL_MODE (sidebar) == E_SIDEBAR_MODE_TEXT) {
- gtk_container_remove (GTK_CONTAINER (button->hbox), button->label);
- gtk_box_pack_start (GTK_BOX (button->hbox), button->icon, FALSE, TRUE, 0);
- gtk_widget_show (button->icon);
- } else {
- gtk_container_child_set (GTK_CONTAINER (button->hbox), button->icon,
- "expand", FALSE,
- NULL);
- }
-
- gtk_box_pack_start (GTK_BOX (button->hbox), button->label, TRUE, TRUE, 0);
- gtk_widget_show (button->label);
- break;
- default:
- break;
- }
- }
-}
-
-static void
-style_changed_notify (GConfClient *gconf, guint id, GConfEntry *entry, void *data)
-{
- ESidebar *sidebar = data;
- char *val;
- int mode;
-
- val = gconf_client_get_string (gconf, "/desktop/gnome/interface/toolbar_style", NULL);
- if (val == NULL || !gconf_string_to_enum (toolbar_styles, val, &mode))
- mode = E_SIDEBAR_MODE_BOTH;
- g_free(val);
-
- set_mode_internal (E_SIDEBAR (sidebar), mode);
- sidebar->priv->toolbar_mode = mode;
-
- gtk_widget_queue_resize (GTK_WIDGET (sidebar));
-}
-
-void
-e_sidebar_set_mode (ESidebar *sidebar, ESidebarMode mode)
-{
- GConfClient *gconf_client = gconf_client_get_default ();
-
- if (sidebar->priv->mode == mode)
- return;
-
- if (sidebar->priv->mode == E_SIDEBAR_MODE_TOOLBAR) {
- if (sidebar->priv->style_changed_id) {
- gconf_client_notify_remove (gconf_client, sidebar->priv->style_changed_id);
- sidebar->priv->style_changed_id = 0;
- }
- }
-
- if (mode != E_SIDEBAR_MODE_TOOLBAR) {
- set_mode_internal (sidebar, mode);
-
- gtk_widget_queue_resize (GTK_WIDGET (sidebar));
- } else {
- /* This is a little bit tricky, toolbar mode is more
- * of a meta-mode where the actual mode is dictated by
- * the gnome toolbar setting, so that is why we have
- * the is_toolbar_mode bool - it tracks the toolbar
- * mode while the mode member is the actual look and
- * feel */
- sidebar->priv->style_changed_id = gconf_client_notify_add (gconf_client,
- "/desktop/gnome/interface/toolbar_style",
- style_changed_notify, sidebar, NULL, NULL);
- style_changed_notify (gconf_client, 0, NULL, sidebar);
- }
-
- g_object_unref (gconf_client);
-
- sidebar->priv->mode = mode;
-}
-
-void
-e_sidebar_set_show_buttons (ESidebar *sidebar, gboolean show)
-{
- GSList *p;
-
- if (sidebar->priv->show == show)
- return;
-
- for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
- Button *button = p->data;
-
- if (show)
- gtk_widget_show (button->button_widget);
- else
- gtk_widget_hide (button->button_widget);
- }
-
- sidebar->priv->show = show;
-
- gtk_widget_queue_resize (GTK_WIDGET (sidebar));
-}
-
-gboolean
-e_sidebar_get_show_buttons (ESidebar *sidebar)
-{
- return sidebar->priv->show;
-}
diff --git a/shell/e-sidebar.h b/shell/e-sidebar.h
deleted file mode 100644
index 2585592363..0000000000
--- a/shell/e-sidebar.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_SIDEBAR_H_
-#define _E_SIDEBAR_H_
-
-#include <gtk/gtk.h>
-
-#define E_TYPE_SIDEBAR (e_sidebar_get_type ())
-#define E_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SIDEBAR, ESidebar))
-#define E_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SIDEBAR, ESidebarClass))
-#define E_IS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SIDEBAR))
-#define E_IS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SIDEBAR))
-
-
-typedef struct _ESidebar ESidebar;
-typedef struct _ESidebarPrivate ESidebarPrivate;
-typedef struct _ESidebarClass ESidebarClass;
-
-typedef enum {
- E_SIDEBAR_MODE_TEXT,
- E_SIDEBAR_MODE_ICON,
- E_SIDEBAR_MODE_BOTH,
- E_SIDEBAR_MODE_TOOLBAR
-} ESidebarMode;
-
-struct _ESidebar {
- GtkContainer parent;
-
- ESidebarPrivate *priv;
-};
-
-struct _ESidebarClass {
- GtkContainerClass parent_class;
-
- /* signals */
- void (* button_selected) (ESidebar *sidebar, int id);
- void (* button_pressed) (ESidebar *sidebar, GdkEventButton *event, int id);
-};
-
-
-GType e_sidebar_get_type (void);
-GtkWidget *e_sidebar_new (void);
-
-void e_sidebar_set_selection_widget (ESidebar *sidebar,
- GtkWidget *widget);
-
-void e_sidebar_add_button (ESidebar *sidebar,
- const char *label,
- const char *tooltips,
- const char *icon_name,
- int id);
-
-void e_sidebar_select_button (ESidebar *sidebar,
- int id);
-
-void e_sidebar_change_button_icon (ESidebar *sidebar,
- const char *icon_name,
- int button_id);
-
-ESidebarMode e_sidebar_get_mode (ESidebar *sidebar);
-void e_sidebar_set_mode (ESidebar *sidebar, ESidebarMode mode);
-
-void e_sidebar_set_show_buttons (ESidebar *sidebar, gboolean show);
-gboolean e_sidebar_get_show_buttons (ESidebar *sidebar);
-
-
-#endif /* _E_SIDEBAR_H_ */
diff --git a/shell/e-user-creatable-items-handler.c b/shell/e-user-creatable-items-handler.c
deleted file mode 100644
index a49d7dbdc4..0000000000
--- a/shell/e-user-creatable-items-handler.c
+++ /dev/null
@@ -1,915 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-user-creatable-items-handler.h"
-#include <e-util/e-icon-factory.h>
-#include "Evolution.h"
-
-#include "e-util/e-corba-utils.h"
-#include "misc/e-combo-button.h"
-
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-control.h>
-
-#include <gtk/gtk.h>
-#include <glib/gi18n-lib.h>
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-
-#include <gconf/gconf-client.h>
-
-struct _Component {
- char *id, *alias;
- GNOME_Evolution_Component component;
- GNOME_Evolution_CreatableItemTypeList *type_list;
-};
-typedef struct _Component Component;
-
-/* Representation of a single menu item. */
-struct _MenuItem {
- const char *label;
- char shortcut;
- char *verb;
- char *tooltip;
- char *component;
- GdkPixbuf *icon;
- GdkPixbuf *icon_toolbar;
-};
-typedef struct _MenuItem MenuItem;
-
-struct _EUserCreatableItemsHandlerPrivate {
- /* This component's alias */
- char *this_component;
-
- /* For creating items on the view */
- EUserCreatableItemsHandlerCreate create_local;
- void *create_data;
-
- /* The components that register user creatable items. */
- GSList *components; /* Component */
-
- /* The "New ..." menu items. */
- GSList *objects; /* MenuItem */
- GSList *folders; /* MenuItem */
-
- /* The default item (the mailer's "message" item). To be used when the
- component in the view we are in doesn't provide a default user
- creatable type. This pointer always points to one of the menu items
- in ->objects. */
- const MenuItem *fallback_menu_item;
- const MenuItem *default_menu_item;
-
- char *menu_xml;
- GtkWidget *new_button, *new_menu;
- BonoboControl *new_control;
- GtkAccelGroup *accel_group;
-};
-
-enum {
- PROP_THIS_COMPONENT = 1,
- LAST_PROP
-};
-
-G_DEFINE_TYPE (EUserCreatableItemsHandler, e_user_creatable_items_handler, G_TYPE_OBJECT)
-
-/* Component struct handling. */
-
-static Component *
-component_new (const char *id,
- const char *component_alias,
- GNOME_Evolution_Component component)
-{
- CORBA_Environment ev;
- Component *new;
-
- CORBA_exception_init (&ev);
-
- new = g_new (Component, 1);
- new->id = g_strdup (id);
- new->alias = g_strdup (component_alias);
-
- new->type_list = GNOME_Evolution_Component__get_userCreatableItems (component, &ev);
- if (BONOBO_EX (&ev))
- new->type_list = NULL;
-
- new->component = component;
- Bonobo_Unknown_ref (new->component, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- new->type_list = NULL;
-
- CORBA_exception_free (&ev);
-
- return new;
-}
-
-static void
-component_free (Component *component)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- Bonobo_Unknown_unref (component->component, &ev);
-
- g_free (component->id);
- g_free (component->alias);
-
- if (component->type_list != NULL)
- CORBA_free (component->type_list);
-
- CORBA_exception_free (&ev);
-
- g_free (component);
-}
-
-static const char *component_query =
- "repo_ids.has ('IDL:GNOME/Evolution/Component:" BASE_VERSION "')";
-
-static void
-get_components_from_bonobo (EUserCreatableItemsHandler *handler)
-{
- Bonobo_ServerInfoList *info_list;
- Bonobo_ActivationProperty *property;
- CORBA_Environment ev;
- const gchar *alias;
- char *iid;
- GNOME_Evolution_Component corba_component;
- Component *component;
- int i;
-
- CORBA_exception_init (&ev);
- info_list = bonobo_activation_query (component_query, NULL, &ev);
- if (BONOBO_EX (&ev)) {
- char *ex_text = bonobo_exception_get_text (&ev);
- g_warning ("Cannot query for components: %s\n", ex_text);
- g_free (ex_text);
- CORBA_exception_free (&ev);
- return;
- }
-
- for (i = 0; i < info_list->_length; i++) {
- iid = info_list->_buffer[i].iid;
- corba_component = bonobo_activation_activate_from_id (iid, Bonobo_ACTIVATION_FLAG_EXISTING_ONLY, NULL, &ev);
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
- continue;
- }
-
- property = bonobo_server_info_prop_find (&info_list->_buffer[i],
- "evolution:component_alias");
- alias = property ? property->v._u.value_string : "unknown";
-
- component = component_new (iid, alias, corba_component);
- handler->priv->components = g_slist_prepend (handler->priv->components, component);
- }
-
- CORBA_free (info_list);
-}
-
-
-/* Helper functions. */
-
-static gboolean
-item_is_default (const MenuItem *item,
- const char *component)
-{
- if (component == NULL)
- return FALSE;
-
- if (strcmp (item->component, component) == 0)
- return TRUE;
- else
- return FALSE;
-}
-
-static char *
-create_verb (EUserCreatableItemsHandler *handler, int component_num, const char *comp, const char *type_id)
-{
- return g_strdup_printf ("EUserCreatableItemsHandler-%s:%d:%s", comp, component_num, type_id);
-}
-
-/* Setting up menu items for the "File -> New" submenu and the "New" toolbar
- button. */
-
-static void
-ensure_menu_items (EUserCreatableItemsHandler *handler)
-{
- EUserCreatableItemsHandlerPrivate *priv;
- GSList *objects, *folders;
- GSList *p;
- int component_num;
- const char *default_verb;
-
- priv = handler->priv;
- if (priv->objects != NULL)
- return;
-
- objects = folders = NULL;
- component_num = 0;
- default_verb = NULL;
- for (p = priv->components; p != NULL; p = p->next) {
- const Component *component;
- int i;
-
- component = (const Component *) p->data;
- if (component->type_list != NULL) {
- for (i = 0; i < component->type_list->_length; i ++) {
- const GNOME_Evolution_CreatableItemType *corba_item;
- MenuItem *item;
-
- corba_item = (const GNOME_Evolution_CreatableItemType *) component->type_list->_buffer + i;
-
- item = g_new (MenuItem, 1);
- item->label = corba_item->menuDescription;
- item->shortcut = corba_item->menuShortcut;
- item->verb = create_verb (handler, component_num, component->alias, corba_item->id);
- item->tooltip = corba_item->tooltip;
- item->component = g_strdup (component->alias);
-
- if (strcmp (item->component, "mail") == 0
- && strcmp (corba_item->id, "message") == 0)
- default_verb = item->verb;
-
- if (corba_item->iconName == NULL || *corba_item->iconName == '\0') {
- item->icon = NULL;
- item->icon_toolbar = NULL;
- } else {
- item->icon = e_icon_factory_get_icon (corba_item->iconName, GTK_ICON_SIZE_MENU);
- if (item_is_default (item, component->alias))
- item->icon_toolbar = e_icon_factory_get_icon (corba_item->iconName, GTK_ICON_SIZE_LARGE_TOOLBAR);
- else
- item->icon_toolbar = NULL;
- }
-
- if (corba_item->type == GNOME_Evolution_CREATABLE_OBJECT)
- objects = g_slist_prepend (objects, item);
- else
- folders = g_slist_prepend (folders, item);
- }
- }
-
- component_num ++;
- }
-
- priv->objects = g_slist_reverse (objects);
- priv->folders = g_slist_reverse (folders);
-
- priv->fallback_menu_item = NULL;
- if (default_verb != NULL) {
- for (p = priv->objects; p != NULL; p = p->next) {
- const MenuItem *item;
-
- item = (const MenuItem *) p->data;
- if (strcmp (item->verb, default_verb) == 0)
- priv->fallback_menu_item = item;
- }
- }
-}
-
-static void
-free_menu_items (GSList *menu_items)
-{
- GSList *p;
-
- if (menu_items == NULL)
- return;
-
- for (p = menu_items; p != NULL; p = p->next) {
- MenuItem *item;
-
- item = (MenuItem *) p->data;
- g_free (item->verb);
-
- if (item->icon != NULL)
- g_object_unref (item->icon);
-
- if (item->icon_toolbar != NULL)
- g_object_unref (item->icon_toolbar);
-
- g_free (item->component);
- g_free (item);
- }
-
- g_slist_free (menu_items);
-}
-
-static const MenuItem *
-get_default_action_for_view (EUserCreatableItemsHandler *handler)
-{
- EUserCreatableItemsHandlerPrivate *priv;
- const GSList *p;
-
- priv = handler->priv;
-
- for (p = priv->objects; p != NULL; p = p->next) {
- const MenuItem *item;
-
- item = (const MenuItem *) p->data;
- if (item_is_default (item, priv->this_component))
- return item;
- }
-
- return priv->fallback_menu_item;
-}
-
-
-/* Verb handling. */
-
-static void
-execute_verb (EUserCreatableItemsHandler *handler,
- const char *verb_name)
-{
- EUserCreatableItemsHandlerPrivate *priv;
- const Component *component;
- int component_number;
- const char *p;
- const char *id;
- GSList *component_list_item;
- int i;
-
- priv = handler->priv;
-
- p = strchr (verb_name, ':');
- g_return_if_fail (p != NULL);
- component_number = atoi (p + 1);
-
- p = strchr (p + 1, ':');
- g_return_if_fail (p != NULL);
- id = p + 1;
-
- component_list_item = g_slist_nth (priv->components, component_number);
- g_return_if_fail (component_list_item != NULL);
-
- component = (const Component *) component_list_item->data;
-
- if (component->type_list == NULL)
- return;
-
- /* TODO: why do we actually iterate this? Is it just to check we have it in the menu? The
- search isn't used otherwise */
- for (i = 0; i < component->type_list->_length; i ++) {
- if (strcmp (component->type_list->_buffer[i].id, id) == 0) {
- if (priv->create_local && priv->this_component && strcmp(priv->this_component, component->alias) == 0) {
- priv->create_local(handler, id, priv->create_data);
- } else {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Component_requestCreateItem (component->component, id, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- g_warning ("Error in requestCreateItem -- %s", BONOBO_EX_REPOID (&ev));
-
- CORBA_exception_free (&ev);
- }
- return;
- }
- }
-}
-
-static void
-verb_fn (BonoboUIComponent *ui_component,
- void *data,
- const char *verb_name)
-{
- EUserCreatableItemsHandler *handler=
- E_USER_CREATABLE_ITEMS_HANDLER (data);
-
- execute_verb (handler, verb_name);
-}
-
-static void
-add_verbs (EUserCreatableItemsHandler *handler,
- BonoboUIComponent *ui_component)
-{
- EUserCreatableItemsHandlerPrivate *priv;
- int component_num;
- GSList *p;
-
- priv = handler->priv;
-
- component_num = 0;
- for (p = priv->components; p != NULL; p = p->next) {
- const Component *component;
- int i;
-
- component = (const Component *) p->data;
-
- if (component->type_list != NULL) {
- for (i = 0; i < component->type_list->_length; i ++) {
- char *verb_name;
-
- verb_name = create_verb (handler,
- component_num,
- component->alias,
- component->type_list->_buffer[i].id);
-
- bonobo_ui_component_add_verb (ui_component, verb_name, verb_fn, handler);
-
- g_free (verb_name);
- }
- }
-
- component_num ++;
- }
-}
-
-
-/* Generic menu construction code */
-
-static int
-item_types_sort_func (const void *a,
- const void *b)
-{
- const MenuItem *item_a;
- const MenuItem *item_b;
- const char *p1, *p2;
-
- item_a = (const MenuItem *) a;
- item_b = (const MenuItem *) b;
-
- p1 = item_a->label;
- p2 = item_b->label;
-
- while (*p1 != '\0' && *p2 != '\0') {
- if (*p1 == '_') {
- p1 ++;
- continue;
- }
-
- if (*p2 == '_') {
- p2 ++;
- continue;
- }
-
- if (toupper ((int) *p1) < toupper ((int) *p2))
- return -1;
- else if (toupper ((int) *p1) > toupper ((int) *p2))
- return +1;
-
- p1 ++, p2 ++;
- }
-
- if (*p1 == '\0') {
- if (*p2 == '\0')
- return 0;
- else
- return -1;
- } else {
- return +1;
- }
-}
-
-typedef void (*EUserCreatableItemsHandlerMenuItemFunc) (EUserCreatableItemsHandler *, gpointer, MenuItem *, gboolean);
-typedef void (*EUserCreatableItemsHandlerSeparatorFunc) (EUserCreatableItemsHandler *, gpointer, int);
-
-static void
-construct_menu (EUserCreatableItemsHandler *handler, gpointer menu,
- EUserCreatableItemsHandlerMenuItemFunc menu_item_func,
- EUserCreatableItemsHandlerSeparatorFunc separator_func)
-{
- EUserCreatableItemsHandlerPrivate *priv;
- MenuItem *item;
- GSList *p, *items;
- gboolean first = TRUE;
-
- priv = handler->priv;
-
- /* First add the current component's creatable objects */
- for (p = priv->objects; p != NULL; p = p->next) {
- item = p->data;
- if (item_is_default (item, priv->this_component)) {
- menu_item_func (handler, menu, item, first);
- first = FALSE;
- }
- }
-
- /* Then its creatable folders */
- for (p = priv->folders; p != NULL; p = p->next) {
- item = p->data;
- if (item_is_default (item, priv->this_component))
- menu_item_func (handler, menu, item, FALSE);
- }
-
- /* Then a separator */
- separator_func (handler, menu, 1);
-
- /* Then the objects from other components. */
- items = NULL;
- for (p = priv->objects; p != NULL; p = p->next) {
- item = p->data;
- if (! item_is_default (item, priv->this_component))
- items = g_slist_prepend (items, item);
- }
-
- items = g_slist_sort (items, item_types_sort_func);
- for (p = items; p != NULL; p = p->next)
- menu_item_func (handler, menu, p->data, FALSE);
- g_slist_free (items);
-
- /* Another separator */
- separator_func (handler, menu, 2);
-
- /* And finally the folders from other components */
- items = NULL;
- for (p = priv->folders; p != NULL; p = p->next) {
- item = p->data;
- if (! item_is_default (item, priv->this_component))
- items = g_slist_prepend (items, item);
- }
-
- items = g_slist_sort (items, item_types_sort_func);
- for (p = items; p != NULL; p = p->next)
- menu_item_func (handler, menu, p->data, FALSE);
- g_slist_free (items);
-}
-
-/* The XML description for "File -> New". */
-
-static void
-xml_menu_item_func (EUserCreatableItemsHandler *handler, gpointer menu,
- MenuItem *item, gboolean first)
-{
- GString *xml = menu;
- char *encoded_label;
- char *encoded_tooltip;
-
- encoded_label = bonobo_ui_util_encode_str (item->label);
- g_string_append_printf (xml, "<menuitem name=\"New:%s\" verb=\"%s\" label=\"%s\"",
- item->verb, item->verb, encoded_label);
-
- if (first)
- g_string_append_printf (xml, " accel=\"*Control*N\"");
- else if (item->shortcut != '\0')
- g_string_append_printf (xml, " accel=\"*Control**Shift*%c\"", item->shortcut);
-
- if (item->icon != NULL) {
- char *icon_xml;
-
- icon_xml = bonobo_ui_util_pixbuf_to_xml (item->icon);
- g_string_append_printf (xml, " pixtype=\"pixbuf\" pixname=\"%s\"", icon_xml);
- g_free (icon_xml);
- }
-
- encoded_tooltip = bonobo_ui_util_encode_str (item->tooltip);
- g_string_append_printf (xml, " tip=\"%s\"", encoded_tooltip);
-
- g_string_append (xml, "/> ");
-
- g_free (encoded_label);
- g_free (encoded_tooltip);
-}
-
-static void
-xml_separator_func (EUserCreatableItemsHandler *handler, gpointer menu, int nth)
-{
- GString *xml = menu;
-
- g_string_append_printf (xml, "<separator f=\"\" name=\"EUserCreatableItemsHandlerSeparator%d\"/>", nth);
-}
-
-static void
-create_menu_xml (EUserCreatableItemsHandler *handler)
-{
- GString *xml;
-
- xml = g_string_new ("<placeholder name=\"NewMenu\">");
- construct_menu (handler, xml, xml_menu_item_func, xml_separator_func);
- g_string_append (xml, "</placeholder>");
-
- handler->priv->menu_xml = xml->str;
- g_string_free (xml, FALSE);
-}
-
-
-/* The GtkMenu for the toolbar button. */
-
-static void
-menuitem_activate (GtkMenuItem *item, gpointer data)
-{
- EUserCreatableItemsHandler *handler = data;
- const char *verb;
-
- verb = g_object_get_data (G_OBJECT (item), "EUserCreatableItemsHandler:verb");
- execute_verb (handler, verb);
-}
-
-static void
-default_activate (EComboButton *combo_button, gpointer data)
-{
- EUserCreatableItemsHandler *handler = data;
-
- execute_verb (handler, handler->priv->default_menu_item->verb);
-}
-
-static void
-gtk_menu_item_func (EUserCreatableItemsHandler *handler, gpointer menu,
- MenuItem *item, gboolean first)
-{
- GtkWidget *menuitem, *icon;
-
- menuitem = gtk_image_menu_item_new_with_mnemonic (item->label);
-
- if (item->icon) {
- icon = gtk_image_new_from_pixbuf (item->icon);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem),
- icon);
- }
-
- if (first) {
- gtk_widget_add_accelerator (menuitem, "activate",
- handler->priv->accel_group,
- 'n', GDK_CONTROL_MASK,
- GTK_ACCEL_VISIBLE);
- } else if (item->shortcut != '\0') {
- gtk_widget_add_accelerator (menuitem, "activate",
- handler->priv->accel_group,
- item->shortcut,
- GDK_CONTROL_MASK | GDK_SHIFT_MASK,
- GTK_ACCEL_VISIBLE);
- }
-
- g_object_set_data (G_OBJECT (menuitem), "EUserCreatableItemsHandler:verb", item->verb);
- g_signal_connect (menuitem, "activate",
- G_CALLBACK (menuitem_activate), handler);
-
- gtk_menu_shell_append (menu, menuitem);
-}
-
-static void
-gtk_separator_func (EUserCreatableItemsHandler *handler, gpointer menu, int nth)
-{
- gtk_menu_shell_append (menu, gtk_separator_menu_item_new ());
-}
-
-static void
-set_combo_button_style (EComboButton *button, const gchar *style, GdkPixbuf *icon)
-{
- if(!g_ascii_strcasecmp (style,"both-horiz")){
- e_combo_button_pack_hbox (button);
- e_combo_button_set_label (button, _("New"));
- e_combo_button_set_icon (button, icon);
- }
- else if(!g_ascii_strcasecmp (style,"icons")){
- e_combo_button_pack_hbox (button);
- e_combo_button_set_icon (button, icon);
- e_combo_button_set_label (button, "");
- }
- else if(!g_ascii_strcasecmp(style,"text")){
- e_combo_button_pack_hbox (button);
- e_combo_button_set_label (button, _("New"));
- e_combo_button_set_icon (button, NULL);
- } else { /* Default to both */
- e_combo_button_pack_vbox (button);
- e_combo_button_set_icon (button, icon);
- e_combo_button_set_label (button, _("New"));
- }
-}
-
-static void
-new_button_change (GConfClient *gconf,
- unsigned int connection_id,
- GConfEntry *entry,
- EUserCreatableItemsHandler *handler)
-{
- EUserCreatableItemsHandlerPrivate *priv;
- char *val;
-
- priv = handler->priv;
- val = gconf_client_get_string (gconf, "/desktop/gnome/interface/toolbar_style", NULL);
-
- set_combo_button_style (E_COMBO_BUTTON (priv->new_button),
- val, priv->default_menu_item->icon_toolbar ? priv->default_menu_item->icon_toolbar : priv->default_menu_item->icon);
-
- g_free (val);
- gtk_widget_show (priv->new_button);
-}
-
-static void
-setup_toolbar_button (EUserCreatableItemsHandler *handler)
-{
- EUserCreatableItemsHandlerPrivate *priv;
- GConfClient *gconf = gconf_client_get_default ();
- char *val;
-
- priv = handler->priv;
- val = gconf_client_get_string (gconf, "/desktop/gnome/interface/toolbar_style", NULL);
-
- priv->new_button = e_combo_button_new ();
- priv->new_menu = gtk_menu_new ();
- priv->accel_group = gtk_accel_group_new ();
- construct_menu (handler, priv->new_menu,
- gtk_menu_item_func, gtk_separator_func);
- gtk_widget_show_all (priv->new_menu);
- e_combo_button_set_menu (E_COMBO_BUTTON (priv->new_button),
- GTK_MENU (priv->new_menu));
-
- g_signal_connect (priv->new_button, "activate_default",
- G_CALLBACK (default_activate), handler);
-
- priv->new_control = bonobo_control_new (priv->new_button);
-
- priv->default_menu_item = get_default_action_for_view (handler);
- if (!priv->default_menu_item) {
- gtk_widget_set_sensitive (priv->new_button, FALSE);
- g_object_unref (gconf);
- return;
- }
-
- gtk_widget_set_sensitive (priv->new_button, TRUE);
-
- set_combo_button_style (E_COMBO_BUTTON (priv->new_button),
- val, priv->default_menu_item->icon_toolbar ? priv->default_menu_item->icon_toolbar : priv->default_menu_item->icon);
-
- gconf_client_notify_add(gconf,"/desktop/gnome/interface/toolbar_style",
- (GConfClientNotifyFunc)new_button_change, handler, NULL, NULL);
-
- gtk_widget_set_tooltip_text (priv->new_button,
- priv->default_menu_item->tooltip);
- gtk_widget_show (priv->new_button);
-
- g_free (val);
- g_object_unref (gconf);
-}
-
-
-/* GObject methods. */
-
-static void
-impl_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
-{
- EUserCreatableItemsHandler *handler =
- E_USER_CREATABLE_ITEMS_HANDLER (object);
-
- switch (prop_id) {
- case PROP_THIS_COMPONENT:
- handler->priv->this_component = g_value_dup_string (value);
-
- get_components_from_bonobo (handler);
- ensure_menu_items (handler);
- break;
- default:
- break;
- }
-}
-
-static void
-impl_dispose (GObject *object)
-{
- EUserCreatableItemsHandler *handler;
- EUserCreatableItemsHandlerPrivate *priv;
- GSList *p;
-
- handler = E_USER_CREATABLE_ITEMS_HANDLER (object);
- priv = handler->priv;
-
- for (p = priv->components; p != NULL; p = p->next)
- component_free ((Component *) p->data);
-
- g_slist_free (priv->components);
- priv->components = NULL;
-
- if (priv->new_control) {
- bonobo_object_unref (priv->new_control);
- priv->new_control = NULL;
- }
-
- if (priv->accel_group) {
- g_object_unref (priv->accel_group);
- priv->accel_group = NULL;
- }
-
- (* G_OBJECT_CLASS (e_user_creatable_items_handler_parent_class)->dispose) (object);
-}
-
-static void
-impl_finalize (GObject *object)
-{
- EUserCreatableItemsHandler *handler;
- EUserCreatableItemsHandlerPrivate *priv;
-
- handler = E_USER_CREATABLE_ITEMS_HANDLER (object);
- priv = handler->priv;
-
- g_free (priv->this_component);
-
- free_menu_items (priv->objects);
- free_menu_items (priv->folders);
-
- g_free (priv->menu_xml);
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (e_user_creatable_items_handler_parent_class)->finalize) (object);
-}
-
-
-static void
-e_user_creatable_items_handler_class_init (EUserCreatableItemsHandlerClass *klass)
-{
- GObjectClass *object_class;
-
- bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
- object_class->set_property = impl_set_property;
-
- g_object_class_install_property (
- object_class, PROP_THIS_COMPONENT,
- g_param_spec_string ("this_component", "Component alias",
- "The component_alias of this component",
- NULL,
- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-}
-
-static void
-e_user_creatable_items_handler_init (EUserCreatableItemsHandler *handler)
-{
- EUserCreatableItemsHandlerPrivate *priv;
-
- priv = g_new0 (EUserCreatableItemsHandlerPrivate, 1);
-
- handler->priv = priv;
-}
-
-
-EUserCreatableItemsHandler *
-e_user_creatable_items_handler_new (const char *component_alias,
- EUserCreatableItemsHandlerCreate create_local, void *data)
-{
- EUserCreatableItemsHandler *handler;
-
- handler = g_object_new (e_user_creatable_items_handler_get_type (),
- "this_component", component_alias,
- NULL);
- handler->priv->create_local = create_local;
- handler->priv->create_data = data;
-
- return handler;
-}
-
-
-/**
- * e_user_creatable_items_handler_activate:
- * @handler: the #EUserCreatableItemsHandler
- * @ui_component: the #BonoboUIComponent to attach to
- *
- * Set up the menus and toolbar items for @ui_component.
- **/
-void
-e_user_creatable_items_handler_activate (EUserCreatableItemsHandler *handler,
- BonoboUIComponent *ui_component)
-{
- EUserCreatableItemsHandlerPrivate *priv;
-
- g_return_if_fail (E_IS_USER_CREATABLE_ITEMS_HANDLER (handler));
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
-
- priv = handler->priv;
-
- if (!priv->menu_xml) {
- create_menu_xml (handler);
- setup_toolbar_button (handler);
- add_verbs (handler, ui_component);
- }
-
- bonobo_ui_component_set (ui_component, "/menu/File/New",
- priv->menu_xml, NULL);
-
- bonobo_ui_component_object_set (ui_component,
- "/Toolbar/NewComboButton",
- BONOBO_OBJREF (priv->new_control),
- NULL);
-}
diff --git a/shell/e-user-creatable-items-handler.h b/shell/e-user-creatable-items-handler.h
deleted file mode 100644
index b9be272af1..0000000000
--- a/shell/e-user-creatable-items-handler.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_USER_CREATABLE_ITEMS_HANDLER_H_
-#define _E_USER_CREATABLE_ITEMS_HANDLER_H_
-
-#include <glib-object.h>
-#include <bonobo/bonobo-ui-component.h>
-#include <bonobo/bonobo-window.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_USER_CREATABLE_ITEMS_HANDLER (e_user_creatable_items_handler_get_type ())
-#define E_USER_CREATABLE_ITEMS_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_USER_CREATABLE_ITEMS_HANDLER, EUserCreatableItemsHandler))
-#define E_USER_CREATABLE_ITEMS_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_USER_CREATABLE_ITEMS_HANDLER, EUserCreatableItemsHandlerClass))
-#define E_IS_USER_CREATABLE_ITEMS_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_USER_CREATABLE_ITEMS_HANDLER))
-#define E_IS_USER_CREATABLE_ITEMS_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_USER_CREATABLE_ITEMS_HANDLER))
-
-
-typedef struct _EUserCreatableItemsHandler EUserCreatableItemsHandler;
-typedef struct _EUserCreatableItemsHandlerPrivate EUserCreatableItemsHandlerPrivate;
-typedef struct _EUserCreatableItemsHandlerClass EUserCreatableItemsHandlerClass;
-
-typedef void (*EUserCreatableItemsHandlerCreate)(EUserCreatableItemsHandler *handler, const char *item_type_name, void *data);
-
-struct _EUserCreatableItemsHandler {
- GObject parent;
-
- EUserCreatableItemsHandlerPrivate *priv;
-};
-
-struct _EUserCreatableItemsHandlerClass {
- GObjectClass parent_class;
-};
-
-
-GType e_user_creatable_items_handler_get_type (void);
-EUserCreatableItemsHandler *e_user_creatable_items_handler_new (const char *component_alias,
- EUserCreatableItemsHandlerCreate create_local, void *data);
-
-void e_user_creatable_items_handler_activate (EUserCreatableItemsHandler *handler,
- BonoboUIComponent *ui_component);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_USER_CREATABLE_ITEMS_HANDLER_H_ */
diff --git a/shell/es-event.c b/shell/es-event.c
index 43a55c3fd5..e0ebb45d29 100644
--- a/shell/es-event.c
+++ b/shell/es-event.c
@@ -112,6 +112,14 @@ ESEvent *es_event_peek(void)
return es_event;
}
+ESEventTargetShell *
+es_event_target_new (ESEvent *eme)
+{
+ return e_event_target_new (
+ &eme->event, ES_EVENT_TARGET_SHELL,
+ sizeof (ESEventTargetShell));
+}
+
ESEventTargetState *
es_event_target_new_state(ESEvent *eme, int state)
{
@@ -130,16 +138,6 @@ es_event_target_new_state(ESEvent *eme, int state)
return t;
}
-ESEventTargetShell *
-es_event_target_new_shell(ESEvent *eme, EShell *shell)
-{
- ESEventTargetShell *t = e_event_target_new(&eme->event, ES_EVENT_TARGET_SHELL, sizeof(*t));
-
- t->shell = shell;
-
- return t;
-}
-
ESEventTargetUpgrade *
es_event_target_new_upgrade(ESEvent *eme, int major, int minor, int revision)
{
diff --git a/shell/es-event.h b/shell/es-event.h
index 5ac363b8c8..a23cb99b4f 100644
--- a/shell/es-event.h
+++ b/shell/es-event.h
@@ -28,12 +28,7 @@
#include "e-util/e-event.h"
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-struct _EShell; /* Avoid including "e-shell.h" */
+G_BEGIN_DECLS
typedef struct _ESEvent ESEvent;
typedef struct _ESEventClass ESEventClass;
@@ -59,8 +54,6 @@ typedef struct _ESEventTargetComponent ESEventTargetComponent;
struct _ESEventTargetShell {
EEventTarget target;
-
- struct _EShell *shell;
};
struct _ESEventTargetState {
@@ -100,8 +93,8 @@ GType es_event_get_type(void);
ESEvent *es_event_peek(void);
+ESEventTargetShell *es_event_target_new(ESEvent *eme);
ESEventTargetState *es_event_target_new_state(ESEvent *emp, int state);
-ESEventTargetShell *es_event_target_new_shell(ESEvent *eme, struct _EShell *shell);
ESEventTargetUpgrade *es_event_target_new_upgrade(ESEvent *emp, int major, int minor, int revision);
ESEventTargetComponent *es_event_target_new_component(ESEvent *eme, const char *id);
@@ -120,8 +113,6 @@ struct _ESEventHookClass {
GType es_event_hook_get_type(void);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* __ES_EVENT_H__ */
diff --git a/shell/es-menu.c b/shell/es-menu.c
deleted file mode 100644
index 3b459268a3..0000000000
--- a/shell/es-menu.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <glib.h>
-
-#include "es-menu.h"
-
-static GObjectClass *esm_parent;
-
-static void
-esm_init(GObject *o)
-{
- /*ESMenu *esm = (ESMenu *)o; */
-}
-
-static void
-esm_finalise(GObject *o)
-{
- ((GObjectClass *)esm_parent)->finalize(o);
-}
-
-static void
-esm_target_free(EMenu *ep, EMenuTarget *t)
-{
- switch (t->type) {
- case ES_MENU_TARGET_SHELL: {
- ESMenuTargetShell *s = (ESMenuTargetShell *)t;
-
- s = s;
- break; }
- }
-
- ((EMenuClass *)esm_parent)->target_free(ep, t);
-}
-
-static void
-esm_class_init(GObjectClass *klass)
-{
- klass->finalize = esm_finalise;
- ((EMenuClass *)klass)->target_free = esm_target_free;
-}
-
-GType
-es_menu_get_type(void)
-{
- static GType type = 0;
-
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(ESMenuClass),
- NULL, NULL,
- (GClassInitFunc)esm_class_init,
- NULL, NULL,
- sizeof(ESMenu), 0,
- (GInstanceInitFunc)esm_init
- };
- esm_parent = g_type_class_ref(e_menu_get_type());
- type = g_type_register_static(e_menu_get_type(), "ESMenu", &info, 0);
- }
-
- return type;
-}
-
-ESMenu *es_menu_new(const char *menuid)
-{
- ESMenu *esm = g_object_new(es_menu_get_type(), NULL);
-
- e_menu_construct(&esm->menu, menuid);
-
- return esm;
-}
-
-/**
- * es_menu_target_new_shell:
- * @esm:
- * @flags:
- *
- * Create a new menu target for the shell.
- *
- * Return value:
- **/
-ESMenuTargetShell *
-es_menu_target_new_shell(ESMenu *esm, guint32 flags)
-{
- ESMenuTargetShell *t = e_menu_target_new(&esm->menu, ES_MENU_TARGET_SHELL, sizeof(*t));
- guint32 mask = ~0;
-
- mask &= ~ flags;
- t->target.mask = mask;
-
- return t;
-}
-
-/* ********************************************************************** */
-
-
-static void *esph_parent_class;
-#define esph ((ESMenuHook *)eph)
-
-static const EMenuHookTargetMask esph_shell_masks[] = {
- { "online", ES_MENU_SHELL_ONLINE },
- { "offline", ES_MENU_SHELL_OFFLINE },
- { NULL }
-};
-
-static const EMenuHookTargetMap esph_targets[] = {
- { "shell", ES_MENU_TARGET_SHELL, esph_shell_masks },
- { NULL }
-};
-
-static void
-esph_finalise(GObject *o)
-{
- /*EPluginHook *eph = (EPluginHook *)o;*/
-
- ((GObjectClass *)esph_parent_class)->finalize(o);
-}
-
-static void
-esph_class_init(EPluginHookClass *klass)
-{
- int i;
-
- /** @HookClass: Shell Main Menu
- * @Id: org.gnome.evolution.shell.bonobomenu:1.0
- * @Target: ESMenuTargetShell
- *
- * A hook for the main menus from the shell component.
- *
- * These menu's will be available from all components, but
- * will have no context for the current component.
- **/
-
- ((GObjectClass *)klass)->finalize = esph_finalise;
- ((EPluginHookClass *)klass)->id = "org.gnome.evolution.shell.bonobomenu:1.0";
-
- for (i=0;esph_targets[i].type;i++)
- e_menu_hook_class_add_target_map((EMenuHookClass *)klass, &esph_targets[i]);
-
- /* FIXME: leaks parent set class? */
- ((EMenuHookClass *)klass)->menu_class = g_type_class_ref(es_menu_get_type());
-}
-
-GType
-es_menu_hook_get_type(void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof(ESMenuHookClass), NULL, NULL, (GClassInitFunc) esph_class_init, NULL, NULL,
- sizeof(ESMenuHook), 0, (GInstanceInitFunc) NULL,
- };
-
- esph_parent_class = g_type_class_ref(e_menu_hook_get_type());
- type = g_type_register_static(e_menu_hook_get_type(), "ESMenuHook", &info, 0);
- }
-
- return type;
-}
diff --git a/shell/es-menu.h b/shell/es-menu.h
deleted file mode 100644
index 9e9e0613b0..0000000000
--- a/shell/es-menu.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michel Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef __ES_MENU_H__
-#define __ES_MENU_H__
-
-#include <glib-object.h>
-
-#include "e-util/e-menu.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-typedef struct _ESMenu ESMenu;
-typedef struct _ESMenuClass ESMenuClass;
-
-/* Current target description */
-/* Types of popup tagets */
-enum _es_menu_target_t {
- ES_MENU_TARGET_SHELL
-};
-
-/* Flags that describe a TARGET_SHELL */
-enum {
- ES_MENU_SHELL_ONLINE = 1<<0,
- ES_MENU_SHELL_OFFLINE = 1<<1
-};
-
-typedef struct _ESMenuTargetShell ESMenuTargetShell;
-
-struct _ESMenuTargetShell {
- EMenuTarget target;
-
- /* current component?? */
-};
-
-typedef struct _EMenuItem ESMenuItem;
-
-/* The object */
-struct _ESMenu {
- EMenu menu;
-
- struct _ESMenuPrivate *priv;
-};
-
-struct _ESMenuClass {
- EMenuClass menu_class;
-};
-
-GType es_menu_get_type(void);
-
-ESMenu *es_menu_new(const char *menuid);
-
-ESMenuTargetShell *es_menu_target_new_shell(ESMenu *emp, guint32 flags);
-
-/* ********************************************************************** */
-
-typedef struct _ESMenuHook ESMenuHook;
-typedef struct _ESMenuHookClass ESMenuHookClass;
-
-struct _ESMenuHook {
- EMenuHook hook;
-};
-
-struct _ESMenuHookClass {
- EMenuHookClass hook_class;
-};
-
-GType es_menu_hook_get_type(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __ES_MENU_H__ */
diff --git a/shell/evolution-component.h b/shell/evolution-component.h
deleted file mode 100644
index 302263a657..0000000000
--- a/shell/evolution-component.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *
- * Abstract class wrapper for EvolutionComponent
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _EVOLUTION_COMPONENT_H_
-#define _EVOLUTION_COMPONENT_H_
-
-#include <bonobo/bonobo-object.h>
-#include "shell/Evolution.h"
-
-typedef struct _EvolutionComponent EvolutionComponent;
-typedef struct _EvolutionComponentClass EvolutionComponentClass;
-
-struct _EvolutionComponent {
- BonoboObject parent;
-};
-
-struct _EvolutionComponentClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Component__epv epv;
-};
-
-GType evolution_component_get_type(void);
-
-#endif /* _EVOLUTION_COMPONENT_H_ */
diff --git a/shell/evolution-config-control.c b/shell/evolution-config-control.c
deleted file mode 100644
index a0d3f473a2..0000000000
--- a/shell/evolution-config-control.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "evolution-config-control.h"
-
-#include <e-util/e-util.h>
-
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-event-source.h>
-
-
-#define PARENT_TYPE BONOBO_OBJECT_TYPE
-static BonoboObjectClass *parent_class = NULL;
-
-struct _EvolutionConfigControlPrivate {
- BonoboControl *control;
- BonoboEventSource *event_source;
-};
-
-/* GObject methods. */
-
-static void
-impl_dispose (GObject *object)
-{
- EvolutionConfigControl *config_control;
- EvolutionConfigControlPrivate *priv;
-
- config_control = EVOLUTION_CONFIG_CONTROL (object);
- priv = config_control->priv;
-
- if (priv->control != NULL) {
- bonobo_object_unref (BONOBO_OBJECT (priv->control));
- priv->control = NULL;
- }
-
- if (priv->event_source != NULL) {
- bonobo_object_unref (BONOBO_OBJECT (priv->event_source));
- priv->event_source = NULL;
- }
-
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-impl_finalize (GObject *object)
-{
- EvolutionConfigControl *config_control;
- EvolutionConfigControlPrivate *priv;
-
- config_control = EVOLUTION_CONFIG_CONTROL (object);
- priv = config_control->priv;
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-/* Evolution::ConfigControl CORBA methods. */
-
-static Bonobo_Control
-impl__get_control (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- EvolutionConfigControl *config_control;
- EvolutionConfigControlPrivate *priv;
-
- config_control = EVOLUTION_CONFIG_CONTROL (bonobo_object_from_servant (servant));
- priv = config_control->priv;
-
- bonobo_object_ref (BONOBO_OBJECT (priv->control));
-
- return CORBA_Object_duplicate (bonobo_object_corba_objref (BONOBO_OBJECT (priv->control)), ev);
-}
-
-static Bonobo_EventSource
-impl__get_eventSource (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- EvolutionConfigControl *config_control;
- EvolutionConfigControlPrivate *priv;
-
- config_control = EVOLUTION_CONFIG_CONTROL (bonobo_object_from_servant (servant));
- priv = config_control->priv;
-
- bonobo_object_ref (BONOBO_OBJECT (priv->event_source));
-
- return CORBA_Object_duplicate (bonobo_object_corba_objref (BONOBO_OBJECT (priv->event_source)), ev);
-}
-
-
-static void
-evolution_config_control_class_init (EvolutionConfigControlClass *class)
-{
- POA_GNOME_Evolution_ConfigControl__epv *epv;
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (class);
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
-
- epv = &class->epv;
- epv->_get_control = impl__get_control;
- epv->_get_eventSource = impl__get_eventSource;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-}
-
-static void
-evolution_config_control_init (EvolutionConfigControl *config_control)
-{
- EvolutionConfigControlPrivate *priv;
-
- priv = g_new (EvolutionConfigControlPrivate, 1);
- priv->control = NULL;
- priv->event_source = bonobo_event_source_new ();
-
- config_control->priv = priv;
-}
-
-
-void
-evolution_config_control_construct (EvolutionConfigControl *control,
- GtkWidget *widget)
-{
- EvolutionConfigControlPrivate *priv;
-
- g_return_if_fail (EVOLUTION_IS_CONFIG_CONTROL (control));
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- priv = control->priv;
-
- priv->control = bonobo_control_new (widget);
-}
-
-EvolutionConfigControl *
-evolution_config_control_new (GtkWidget *widget)
-{
- EvolutionConfigControl *new;
-
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- new = g_object_new (evolution_config_control_get_type (), NULL);
- evolution_config_control_construct (new, widget);
-
- return new;
-}
-
-BONOBO_TYPE_FUNC_FULL (EvolutionConfigControl,
- GNOME_Evolution_ConfigControl,
- PARENT_TYPE,
- evolution_config_control)
diff --git a/shell/evolution-config-control.h b/shell/evolution-config-control.h
deleted file mode 100644
index 59d7aba210..0000000000
--- a/shell/evolution-config-control.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef EVOLUTION_CONFIG_CONTROL_H
-#define EVOLUTION_CONFIG_CONTROL_H
-
-#include "Evolution.h"
-
-#include <bonobo/bonobo-object.h>
-#include <gtk/gtk.h>
-
-#ifdef cplusplus
-extern "C" {
-#pragma }
-#endif /* cplusplus */
-
-#define EVOLUTION_TYPE_CONFIG_CONTROL (evolution_config_control_get_type ())
-#define EVOLUTION_CONFIG_CONTROL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVOLUTION_TYPE_CONFIG_CONTROL, EvolutionConfigControl))
-#define EVOLUTION_CONFIG_CONTROL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_CONFIG_CONTROL, EvolutionConfigControlClass))
-#define EVOLUTION_IS_CONFIG_CONTROL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVOLUTION_TYPE_CONFIG_CONTROL))
-#define EVOLUTION_IS_CONFIG_CONTROL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_CONFIG_CONTROL))
-
-typedef struct _EvolutionConfigControl EvolutionConfigControl;
-typedef struct _EvolutionConfigControlPrivate EvolutionConfigControlPrivate;
-typedef struct _EvolutionConfigControlClass EvolutionConfigControlClass;
-
-struct _EvolutionConfigControl {
- BonoboObject parent;
-
- EvolutionConfigControlPrivate *priv;
-};
-
-struct _EvolutionConfigControlClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_ConfigControl__epv epv;
-};
-
-
-GType evolution_config_control_get_type (void);
-EvolutionConfigControl *evolution_config_control_new (GtkWidget *widget);
-void evolution_config_control_construct (EvolutionConfigControl *control,
- GtkWidget *widget);
-
-#endif /* EVOLUTION_CONFIG_CONTROL_H */
diff --git a/shell/evolution-listener.c b/shell/evolution-listener.c
deleted file mode 100644
index 4bf9a76376..0000000000
--- a/shell/evolution-listener.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "evolution-listener.h"
-
-#define PARENT_TYPE bonobo_object_get_type ()
-
-static BonoboObjectClass *parent_class = NULL;
-
-/* Evolution.Listener */
-static void
-impl_complete(PortableServer_Servant _servant, CORBA_Environment * ev)
-{
- EvolutionListener *el = (EvolutionListener *)bonobo_object_from_servant(_servant);
-
- if (el->complete)
- el->complete(el, el->data);
-}
-
-static void
-evolution_listener_class_init (EvolutionListenerClass *klass)
-{
- POA_GNOME_Evolution_Listener__epv *epv = &klass->epv;
-
- parent_class = g_type_class_peek_parent (klass);
-
- epv->complete = impl_complete;
-}
-
-static void
-evolution_listener_init(EvolutionListener *emf, EvolutionListenerClass *klass)
-{
-}
-
-BONOBO_TYPE_FUNC_FULL (EvolutionListener, GNOME_Evolution_Listener, PARENT_TYPE, evolution_listener)
-
-EvolutionListener *
-evolution_listener_new(EvolutionListenerFunc complete, void *data)
-{
- EvolutionListener *el;
-
- el = g_object_new(evolution_listener_get_type(), NULL);
- el->complete = complete;
- el->data = data;
-
- return el;
-}
diff --git a/shell/evolution-listener.h b/shell/evolution-listener.h
deleted file mode 100644
index 7b79b3bab8..0000000000
--- a/shell/evolution-listener.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * Abstract class wrapper for EvolutionListener
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _EVOLUTION_LISTENER_H_
-#define _EVOLUTION_LISTENER_H_
-
-#include <bonobo/bonobo-object.h>
-#include "shell/Evolution.h"
-
-typedef struct _EvolutionListener EvolutionListener;
-typedef struct _EvolutionListenerClass EvolutionListenerClass;
-
-typedef void (*EvolutionListenerFunc)(EvolutionListener *, void *);
-
-struct _EvolutionListener {
- BonoboObject parent;
-
- /* we dont need signals, so why bother wasting resources on it */
- EvolutionListenerFunc complete;
- void *data;
-};
-
-struct _EvolutionListenerClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Listener__epv epv;
-};
-
-GType evolution_listener_get_type(void);
-EvolutionListener *evolution_listener_new(EvolutionListenerFunc complete, void *data);
-
-#endif /* _EVOLUTION_LISTENER_H_ */
diff --git a/shell/evolution-shell-component-utils.c b/shell/evolution-shell-component-utils.c
deleted file mode 100644
index a8ce855268..0000000000
--- a/shell/evolution-shell-component-utils.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "evolution-shell-component-utils.h"
-#include <e-util/e-icon-factory.h>
-#include "e-util/e-dialog-utils.h"
-
-#include <string.h>
-#include <glib/gi18n.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-moniker-util.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo-activation/bonobo-activation.h>
-
-static void free_pixmaps (void);
-static GSList *inited_arrays = NULL;
-
-void e_pixmaps_update (BonoboUIComponent *uic, EPixmap *pixcache)
-{
- static int done_init = 0;
- int i;
-
- if (!done_init) {
- g_atexit (free_pixmaps);
- done_init = 1;
- }
-
- if (g_slist_find (inited_arrays, pixcache) == NULL)
- inited_arrays = g_slist_prepend (inited_arrays, pixcache);
-
- for (i = 0; pixcache [i].path; i++) {
- if (!pixcache [i].pixbuf) {
- GdkPixbuf *pixbuf;
-
- pixbuf = e_icon_factory_get_icon (pixcache [i].name, pixcache [i].size);
- pixcache [i].pixbuf = bonobo_ui_util_pixbuf_to_xml (pixbuf);
- g_object_unref (pixbuf);
- bonobo_ui_component_set_prop (uic,
- pixcache [i].path, "pixname",
- pixcache [i].pixbuf, NULL);
- } else {
- bonobo_ui_component_set_prop (uic, pixcache [i].path,
- "pixname",
- pixcache [i].pixbuf,
- NULL);
- }
- }
-}
-
-static void
-free_pixmaps (void)
-{
- int i;
- GSList *li;
-
- for (li = inited_arrays; li != NULL; li = li->next) {
- EPixmap *pixcache = li->data;
- for (i = 0; pixcache [i].path; i++)
- g_free (pixcache [i].pixbuf);
- }
-
- g_slist_free (inited_arrays);
-}
-
-
-/**
- * e_get_activation_failure_msg:
- * @ev: An exception returned by an oaf_activate call.
- *
- * Get a descriptive error message from @ev.
- *
- * Return value: A newly allocated string with the printable error message.
- **/
-char *
-e_get_activation_failure_msg (CORBA_Environment *ev)
-{
- g_return_val_if_fail (ev != NULL, NULL);
-
- if (CORBA_exception_id (ev) == NULL)
- return NULL;
-
- if (strcmp (CORBA_exception_id (ev), ex_Bonobo_GeneralError) != 0) {
- return bonobo_exception_get_text (ev);
- } else {
- const Bonobo_GeneralError *oaf_general_error;
-
- oaf_general_error = CORBA_exception_value (ev);
- return g_strdup (oaf_general_error->description);
- }
-}
diff --git a/shell/evolution-shell-component-utils.h b/shell/evolution-shell-component-utils.h
deleted file mode 100644
index ce4fa11229..0000000000
--- a/shell/evolution-shell-component-utils.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef __EVOLUTION_SHELL_COMPONENT_UTILS_H__
-#define __EVOLUTION_SHELL_COMPONENT_UTILS_H__
-
-#include <bonobo/bonobo-ui-component.h>
-#include <gtk/gtk.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-typedef struct _EPixmap {
- const char *path;
- const char *name;
- GtkIconSize size;
- char *pixbuf;
-} EPixmap;
-
-#define E_PIXMAP(path,name,size) { (path), (name), (size), NULL }
-#define E_PIXMAP_END { NULL, NULL, 0, NULL }
-
-/* Takes an array of pixmaps, terminated by E_PIXMAP_END, and loads into uic */
-void e_pixmaps_update (BonoboUIComponent *uic, EPixmap *pixcache);
-
-char *e_get_activation_failure_msg (CORBA_Environment *ev);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __EVOLUTION_SHELL_COMPONENT_UTILS_H__ */
diff --git a/shell/importer/GNOME_Evolution_Importer.idl b/shell/importer/GNOME_Evolution_Importer.idl
deleted file mode 100644
index e33ca150ae..0000000000
--- a/shell/importer/GNOME_Evolution_Importer.idl
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Interfaces for the importer framework.
- *
- * Authors:
- * Iain Holmes <iain@ximian.com>
- *
- * Copyright (C) 2000 Ximian, Inc.
- */
-
-#include <Bonobo.idl>
-
-module GNOME {
-module Evolution {
- interface ImporterListener : Bonobo::Unknown {
- enum ImporterResult {
- OK,
- UNSUPPORTED_OPERATION,
- NOT_READY,
- BUSY,
- UNKNOWN_DATA,
- BAD_DATA,
- BAD_FILE
- };
-
- /**
- * notifyResult:
- * @result: The result of the import.
- * @more_items: Are there any more items to be processed?
- *
- * Notifies the listener of the result and whether there are
- * any more items to be imported.
- */
- oneway void notifyResult (in ImporterResult result,
- in boolean more_items);
- };
-
- interface Importer : Bonobo::Unknown {
-
- /**
- * processItem:
- * @listener: The ImporterListener that will be notified of the
- * progress.
- *
- * Processes the next item.
- *
- */
- oneway void processItem (in ImporterListener listener);
-
- /**
- * getError:
- *
- * Retrieve a detailed explaination of the error.
- *
- * Returns: A string.
- */
- string getError ();
-
- void createControl (out Bonobo::Control control);
-
- /**
- * supportFormat:
- * @filename: The filename of the file.
- *
- * Checks if the importer created by this factory can
- * import the file specified.
- *
- * Returns: A boolean, TRUE if it can import the file,
- * FALSE otherwise.
- */
- boolean supportFormat (in string filename);
-
- /**
- * loadFile:
- * @filename: The filename of the file.
- * @folderpath: The full pathname to the folder.
- * @foldertpe: The type of the folder to import to.
- *
- * Loads the file and prepares an Importer object that can
- * process files of this type.
- *
- * Returns: An Importer object.
- */
- boolean loadFile (in string filename);
- };
-
- interface IntelligentImporter : Bonobo::Unknown {
-
- readonly attribute string importername;
- readonly attribute string message;
-
- boolean canImport ();
-
- void importData ();
- };
-};
-};
diff --git a/shell/importer/Makefile.am b/shell/importer/Makefile.am
deleted file mode 100644
index 1aa5d5b484..0000000000
--- a/shell/importer/Makefile.am
+++ /dev/null
@@ -1,68 +0,0 @@
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/shell \
- -I$(top_builddir)/shell \
- -DG_LOG_DOMAIN=\"Evolution-Importer\" \
- -DEVOLUTION_GLADEDIR="\"$(gladedir)\"" \
- $(SHELL_CFLAGS)
-
-privlib_LTLIBRARIES = libevolution-importer.la
-
-
-# IDL stuff
-
-IDLS = GNOME_Evolution_Importer.idl
-
-IDL_GENERATED_H = \
- GNOME_Evolution_Importer.h
-
-IDL_GENERATED_C = \
- GNOME_Evolution_Importer-common.c \
- GNOME_Evolution_Importer-skels.c \
- GNOME_Evolution_Importer-stubs.c
-
-IDL_GENERATED = $(IDL_GENERATED_H) $(IDL_GENERATED_C)
-
-$(IDL_GENERATED_H): $(IDLS)
- $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) $(srcdir)/GNOME_Evolution_Importer.idl
-
-$(IDL_GENERATED_C): $(IDL_GENERATED_H)
-
-idl_DATA = $(IDLS)
-
-
-# Component
-
-libevolution_importerincludedir = $(privincludedir)/importer
-libevolution_importer_la_SOURCES = \
- $(IDL_GENERATED) \
- evolution-intelligent-importer.c \
- evolution-importer-client.c \
- evolution-importer-listener.c \
- evolution-importer.c \
- intelligent.c \
- intelligent.h
-
-libevolution_importerinclude_HEADERS = \
- GNOME_Evolution_Importer.h \
- evolution-intelligent-importer.h \
- evolution-importer-client.h \
- evolution-importer-listener.h \
- evolution-importer.h
-
-libevolution_importer_la_LIBADD = \
- $(top_builddir)/e-util/libeutil.la \
- $(SHELL_LIBS)
-
-glade_DATA = import.glade
-
-EXTRA_DIST = $(glade_DATA) $(IDLS)
-
-BUILT_SOURCES= $(IDL_GENERATED)
-CLEANFILES = $(BUILT_SOURCES)
-
-dist-hook:
- cd $(distdir); rm -f $(BUILT_SOURCES)
-
-
--include $(top_srcdir)/git.mk
diff --git a/shell/importer/evolution-importer-client.c b/shell/importer/evolution-importer-client.c
deleted file mode 100644
index 06d30d5733..0000000000
--- a/shell/importer/evolution-importer-client.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Iain Holmes <iain@ximian.com>
- *
- * Based on evolution-shell-component-client.c by Ettore Perazzoli
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "evolution-importer-client.h"
-
-#include <glib.h>
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-widget.h>
-#include <bonobo/bonobo-exception.h>
-
-#include "GNOME_Evolution_Importer.h"
-
-G_DEFINE_TYPE (EvolutionImporterClient, evolution_importer_client, G_TYPE_OBJECT)
-
-
-static void
-finalise (GObject *object)
-{
- /* FIXME: should this unref the client->objref?? */
-
- (* G_OBJECT_CLASS (evolution_importer_client_parent_class)->finalize) (object);
-}
-
-static void
-evolution_importer_client_class_init (EvolutionImporterClientClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = finalise;
-}
-
-static void
-evolution_importer_client_init (EvolutionImporterClient *client)
-{
-}
-
-/**
- * evolution_importer_client_new:
- * @objref: The CORBA_Object to make a client for.
- *
- * Makes a client for @objref. @objref should be an Evolution_Importer.
- *
- * Returns: A newly created EvolutionImporterClient.
- */
-EvolutionImporterClient *
-evolution_importer_client_new (const CORBA_Object objref)
-{
- EvolutionImporterClient *client;
-
- g_return_val_if_fail (objref != CORBA_OBJECT_NIL, NULL);
-
- client = g_object_new (evolution_importer_client_get_type (), NULL);
- client->objref = objref;
-
- return client;
-}
-
-/**
- * evolution_importer_client_new_from_id:
- * @id: The oafiid of the component to make a client for.
- *
- * Makes a client for the object returned by activating @id.
- *
- * Returns: A newly created EvolutionImporterClient.
- */
-EvolutionImporterClient *
-evolution_importer_client_new_from_id (const char *id)
-{
- CORBA_Environment ev;
- CORBA_Object objref;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- CORBA_exception_init (&ev);
- objref = bonobo_activation_activate_from_id ((char *) id, 0, NULL, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- CORBA_exception_free (&ev);
- g_warning ("Could not start %s.", id);
- return NULL;
- }
-
- CORBA_exception_free (&ev);
- if (objref == CORBA_OBJECT_NIL) {
- g_warning ("Could not activate component %s", id);
- return NULL;
- }
-
- return evolution_importer_client_new (objref);
-}
-
-/* API */
-GtkWidget *
-evolution_importer_client_create_control (EvolutionImporterClient *client)
-{
- GNOME_Evolution_Importer corba_importer;
- GtkWidget *widget = NULL;
- Bonobo_Control control;
- CORBA_Environment ev;
-
- g_return_val_if_fail (client != NULL, NULL);
- g_return_val_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client), NULL);
-
- CORBA_exception_init (&ev);
- corba_importer = client->objref;
- GNOME_Evolution_Importer_createControl (corba_importer, &control, &ev);
-
- if (!BONOBO_EX (&ev)) {
- /* FIXME Pass in container? */
- widget = bonobo_widget_new_control_from_objref (control, NULL);
- gtk_widget_show (widget);
- }
-
- CORBA_exception_free (&ev);
-
- return widget;
-}
-
-/**
- * evolution_importer_client_support_format:
- * @client: The EvolutionImporterClient.
- * @filename: Name of the file to check.
- *
- * Checks whether @client is able to import @filename.
- *
- * Returns: TRUE if @client can import @filename, FALSE otherwise.
- */
-gboolean
-evolution_importer_client_support_format (EvolutionImporterClient *client,
- const char *filename)
-{
- GNOME_Evolution_Importer corba_importer;
- gboolean result;
- CORBA_Environment ev;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client), FALSE);
- g_return_val_if_fail (filename != NULL, FALSE);
-
- CORBA_exception_init (&ev);
- corba_importer = client->objref;
- result = GNOME_Evolution_Importer_supportFormat (corba_importer,
- filename, &ev);
- CORBA_exception_free (&ev);
-
- return result;
-}
-
-/**
- * evolution_importer_client_load_file:
- * @client: The EvolutionImporterClient.
- * @filename: The file to load.
- * @physical_uri: The physical URI of the folder to import data into.
- * @folder_type: The type of the folder represented by @physical_uri.
- *
- * Loads and initialises the importer.
- *
- * Returns: TRUE on sucess, FALSE on failure.
- */
-gboolean
-evolution_importer_client_load_file (EvolutionImporterClient *client, const char *filename)
-{
- GNOME_Evolution_Importer corba_importer;
- gboolean result;
- CORBA_Environment ev;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client), FALSE);
- g_return_val_if_fail (filename != NULL, FALSE);
-
- CORBA_exception_init (&ev);
- corba_importer = client->objref;
- result = GNOME_Evolution_Importer_loadFile (corba_importer, filename, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Oh there *WAS* an exception.\nIt was %s",
- CORBA_exception_id (&ev));
- CORBA_exception_free (&ev);
- return FALSE;
- }
- CORBA_exception_free (&ev);
-
- return result;
-}
-
-/**
- * evolution_importer_client_process_item:
- * @client: The EvolutionImporterClient.
- * @listener: The EvolutionImporterListener.
- *
- * Starts importing the next item in the file. @listener will be notified
- * when the item has finished.
- */
-void
-evolution_importer_client_process_item (EvolutionImporterClient *client,
- EvolutionImporterListener *listener)
-{
- GNOME_Evolution_Importer corba_importer;
- GNOME_Evolution_ImporterListener corba_listener;
- CORBA_Environment ev;
-
- g_return_if_fail (client != NULL);
- g_return_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client));
- g_return_if_fail (listener != NULL);
- g_return_if_fail (EVOLUTION_IS_IMPORTER_LISTENER (listener));
-
- CORBA_exception_init (&ev);
-
- corba_importer = client->objref;
- corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener));
- GNOME_Evolution_Importer_processItem (corba_importer,
- corba_listener, &ev);
- CORBA_exception_free (&ev);
-}
-
-/**
- * evolution_importer_client_get_error:
- * @client: The EvolutionImporterClient.
- *
- * Gets the error as a string.
- *
- * Returns: The error as a string. If there is no error NULL is returned.
- * Importers need not support this method and if so, NULL is also returned.
- */
-const char *
-evolution_importer_client_get_error (EvolutionImporterClient *client)
-{
- GNOME_Evolution_Importer corba_importer;
- CORBA_char *str;
- CORBA_Environment ev;
-
- g_return_val_if_fail (client != NULL, NULL);
- g_return_val_if_fail (EVOLUTION_IS_IMPORTER_CLIENT (client), NULL);
-
- corba_importer = client->objref;
-
- CORBA_exception_init (&ev);
- str = GNOME_Evolution_Importer_getError (corba_importer, &ev);
-
- return str;
-}
diff --git a/shell/importer/evolution-importer-client.h b/shell/importer/evolution-importer-client.h
deleted file mode 100644
index 3ae4b2f7b0..0000000000
--- a/shell/importer/evolution-importer-client.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Iain Holmes <iain@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef EVOLUTION_IMPORTER_CLIENT_H
-#define EVOLUTION_IMPORTER_CLIENT_H
-
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <importer/evolution-importer.h>
-#include <importer/evolution-importer-listener.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif
-
-#define EVOLUTION_TYPE_IMPORTER_CLIENT (evolution_importer_client_get_type ())
-#define EVOLUTION_IMPORTER_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVOLUTION_TYPE_IMPORTER_CLIENT, EvolutionImporterClient))
-#define EVOLUTION_IMPORTER_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER_CLIENT, EvolutionImporterClientClass))
-#define EVOLUTION_IS_IMPORTER_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_CLIENT))
-#define EVOLUTION_IS_IMPORTER_CLIENT_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE ((klass), EVOLUTION_TYPE_IMPORTER_CLIENT))
-
-
-typedef struct _EvolutionImporterClient EvolutionImporterClient;
-typedef struct _EvolutionImporterClientClass EvolutionImporterClientClass;
-
-struct _EvolutionImporterClient {
- GObject parent_type;
-
- GNOME_Evolution_Importer objref;
-};
-
-struct _EvolutionImporterClientClass {
- GObjectClass parent_class;
-};
-
-GType evolution_importer_client_get_type (void);
-
-EvolutionImporterClient *evolution_importer_client_new (const CORBA_Object objref);
-EvolutionImporterClient *evolution_importer_client_new_from_id (const char *id);
-
-GtkWidget *evolution_importer_client_create_control (EvolutionImporterClient *client);
-gboolean evolution_importer_client_support_format (EvolutionImporterClient *client,
- const char *filename);
-gboolean evolution_importer_client_load_file (EvolutionImporterClient *client,
- const char *filename);
-void evolution_importer_client_process_item (EvolutionImporterClient *client,
- EvolutionImporterListener *listener);
-const char *evolution_importer_client_get_error (EvolutionImporterClient *client);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/shell/importer/evolution-importer-listener.c b/shell/importer/evolution-importer-listener.c
deleted file mode 100644
index 8915202d30..0000000000
--- a/shell/importer/evolution-importer-listener.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Iain Holmes <iain@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "evolution-importer-listener.h"
-
-#include <bonobo/bonobo-object.h>
-#include <e-util/e-util.h>
-
-#include "GNOME_Evolution_Importer.h"
-#define PARENT_TYPE BONOBO_OBJECT_TYPE
-
-static BonoboObjectClass *parent_class = NULL;
-
-struct _EvolutionImporterListenerPrivate {
- EvolutionImporterListenerCallback callback;
-
- void *closure;
-};
-
-#if 0
-static POA_GNOME_Evolution_ImporterListener__vepv Listener_vepv;
-
-static POA_GNOME_Evolution_ImporterListener *
-create_servant (void)
-{
- POA_GNOME_Evolution_ImporterListener *servant;
- CORBA_Environment ev;
-
- servant = (POA_GNOME_Evolution_ImporterListener *) g_new0 (BonoboObjectServant, 1);
- servant->vepv = &Listener_vepv;
-
- CORBA_exception_init (&ev);
- POA_GNOME_Evolution_ImporterListener__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;
-}
-#endif
-
-static EvolutionImporterResult
-corba_result_to_evolution (GNOME_Evolution_ImporterListener_ImporterResult corba_result)
-{
- switch (corba_result) {
- case GNOME_Evolution_ImporterListener_OK:
- return EVOLUTION_IMPORTER_OK;
- case GNOME_Evolution_ImporterListener_UNSUPPORTED_OPERATION:
- return EVOLUTION_IMPORTER_UNSUPPORTED_OPERATION;
- case GNOME_Evolution_ImporterListener_UNKNOWN_DATA:
- return EVOLUTION_IMPORTER_UNKNOWN_DATA;
- case GNOME_Evolution_ImporterListener_BAD_DATA:
- return EVOLUTION_IMPORTER_BAD_DATA;
- case GNOME_Evolution_ImporterListener_BAD_FILE:
- return EVOLUTION_IMPORTER_BAD_FILE;
- case GNOME_Evolution_ImporterListener_NOT_READY:
- return EVOLUTION_IMPORTER_NOT_READY;
- case GNOME_Evolution_ImporterListener_BUSY:
- return EVOLUTION_IMPORTER_BUSY;
- default:
- return EVOLUTION_IMPORTER_UNKNOWN_ERROR;
- }
-}
-
-static inline EvolutionImporterListener *
-evolution_importer_listener_from_servant (PortableServer_Servant servant)
-{
- return EVOLUTION_IMPORTER_LISTENER (bonobo_object_from_servant (servant));
-}
-
-static void
-impl_GNOME_Evolution_ImporterListener_notifyResult (PortableServer_Servant servant,
- GNOME_Evolution_ImporterListener_ImporterResult result,
- CORBA_boolean more_items,
- CORBA_Environment *ev)
-{
- EvolutionImporterListener *listener;
- EvolutionImporterListenerPrivate *priv;
- EvolutionImporterResult out_result;
-
- listener = evolution_importer_listener_from_servant (servant);
- priv = listener->priv;
-
- out_result = corba_result_to_evolution (result);
- if (priv->callback) {
- (priv->callback) (listener, out_result, more_items,
- priv->closure);
- }
-
- return;
-}
-
-
-/* GObject methods */
-static void
-finalise (GObject *object)
-{
- EvolutionImporterListener *listener;
- EvolutionImporterListenerPrivate *priv;
-
- listener = EVOLUTION_IMPORTER_LISTENER (object);
- priv = listener->priv;
-
- if (priv == NULL)
- return;
-
- g_free (priv);
- listener->priv = NULL;
-
- G_OBJECT_CLASS (parent_class)->finalize(object);
-}
-
-#if 0
-static void
-corba_class_init (void)
-{
- POA_GNOME_Evolution_ImporterListener__vepv *vepv;
- POA_GNOME_Evolution_ImporterListener__epv *epv;
- PortableServer_ServantBase__epv *base_epv;
-
- base_epv = g_new0 (PortableServer_ServantBase__epv, 1);
- base_epv->_private = NULL;
- base_epv->finalize = NULL;
- base_epv->default_POA = NULL;
-
- epv = g_new0 (POA_GNOME_Evolution_ImporterListener__epv, 1);
- epv->notifyResult = impl_GNOME_Evolution_ImporterListener_notifyResult;
-
- vepv = &Listener_vepv;
- vepv->_base_epv = base_epv;
- vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
- vepv->GNOME_Evolution_ImporterListener_epv = epv;
-}
-#endif
-
-static void
-evolution_importer_listener_class_init (EvolutionImporterListenerClass *klass)
-{
- GObjectClass *object_class;
- POA_GNOME_Evolution_ImporterListener__epv *epv = &klass->epv;
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = finalise;
-
- parent_class = g_type_class_ref(PARENT_TYPE);
- epv->notifyResult = impl_GNOME_Evolution_ImporterListener_notifyResult;
-}
-
-static void
-evolution_importer_listener_init (EvolutionImporterListener *listener)
-{
- EvolutionImporterListenerPrivate *priv;
-
- priv = g_new0 (EvolutionImporterListenerPrivate, 1);
- listener->priv = priv;
-}
-
-static void
-evolution_importer_listener_construct (EvolutionImporterListener *listener,
- EvolutionImporterListenerCallback callback,
- void *closure)
-{
- EvolutionImporterListenerPrivate *priv;
-
- g_return_if_fail (listener != NULL);
- g_return_if_fail (EVOLUTION_IS_IMPORTER_LISTENER (listener));
- g_return_if_fail (callback != NULL);
-
- priv = listener->priv;
- priv->callback = callback;
- priv->closure = closure;
-}
-
-/**
- * evolution_importer_listener_new
- * @callback: The #EvolutionImporterListenerCallback callback.
- * @closure: The data that will be passed to that callback.
- *
- * Creates a new #EvolutionImporterListener object which calls @callback when
- * something happens.
- * Returns: A newly allocated #EvolutionImporterListener.
- */
-EvolutionImporterListener *
-evolution_importer_listener_new (EvolutionImporterListenerCallback callback,
- void *closure)
-{
- EvolutionImporterListener *listener;
-
- listener = g_object_new (evolution_importer_listener_get_type (), NULL);
-
- evolution_importer_listener_construct (listener, callback, closure);
- return listener;
-}
-
-BONOBO_TYPE_FUNC_FULL (EvolutionImporterListener,
- GNOME_Evolution_ImporterListener,
- PARENT_TYPE, evolution_importer_listener);
diff --git a/shell/importer/evolution-importer-listener.h b/shell/importer/evolution-importer-listener.h
deleted file mode 100644
index 63f480e4dd..0000000000
--- a/shell/importer/evolution-importer-listener.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Iain Holmes <iain@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef EVOLUTION_IMPORTER_LISTENER_H
-#define EVOLUTION_IMPORTER_LISTENER_H
-
-#include <glib.h>
-#include <bonobo/bonobo-object.h>
-#include <importer/GNOME_Evolution_Importer.h>
-#include "evolution-importer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* cplusplus */
-
-#define EVOLUTION_TYPE_IMPORTER_LISTENER (evolution_importer_listener_get_type ())
-#define EVOLUTION_IMPORTER_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER, EvolutionImporterListener))
-#define EVOLUTION_IMPORTER_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER_LISTENER, EvolutionImporterListenerClass))
-#define EVOLUTION_IS_IMPORTER_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER))
-#define EVOLUTION_IS_IMPORTER_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER))
-
-typedef struct _EvolutionImporterListener EvolutionImporterListener;
-typedef struct _EvolutionImporterListenerPrivate EvolutionImporterListenerPrivate;
-typedef struct _EvolutionImporterListenerClass EvolutionImporterListenerClass;
-
-typedef void (* EvolutionImporterListenerCallback) (EvolutionImporterListener *listener,
- EvolutionImporterResult result,
- gboolean more_items,
- void *closure);
-struct _EvolutionImporterListener {
- BonoboObject parent;
-
- EvolutionImporterListenerPrivate *priv;
-};
-
-struct _EvolutionImporterListenerClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_ImporterListener__epv epv;
-};
-
-GType evolution_importer_listener_get_type (void);
-
-EvolutionImporterListener *evolution_importer_listener_new (EvolutionImporterListenerCallback callback,
- void *closure);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/shell/importer/evolution-importer.c b/shell/importer/evolution-importer.c
deleted file mode 100644
index f8e6847891..0000000000
--- a/shell/importer/evolution-importer.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Iain Holmes <iain@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "evolution-importer.h"
-
-#include <bonobo/bonobo-object.h>
-#include <e-util/e-util.h>
-
-#include "GNOME_Evolution_Importer.h"
-
-#define PARENT_TYPE BONOBO_OBJECT_TYPE
-static BonoboObjectClass *parent_class = NULL;
-
-struct _EvolutionImporterPrivate {
- EvolutionImporterCreateControlFn create_control_fn;
- EvolutionImporterLoadFileFn load_file_fn;
- EvolutionImporterSupportFormatFn support_format_fn;
- EvolutionImporterProcessItemFn process_item_fn;
- EvolutionImporterGetErrorFn get_error_fn;
-
- void *closure;
-};
-
-
-static inline EvolutionImporter *
-evolution_importer_from_servant (PortableServer_Servant servant)
-{
- return EVOLUTION_IMPORTER (bonobo_object_from_servant (servant));
-}
-
-static void
-impl_GNOME_Evolution_Importer_createControl (PortableServer_Servant servant,
- Bonobo_Control *control,
- CORBA_Environment *ev)
-{
- EvolutionImporter *importer;
- EvolutionImporterPrivate *priv;
-
- importer = evolution_importer_from_servant (servant);
- priv = importer->priv;
-
- if (priv->create_control_fn != NULL)
- (priv->create_control_fn) (importer, control, priv->closure);
- else
- CORBA_exception_set_system (ev, ex_CORBA_NO_IMPLEMENT, CORBA_COMPLETED_NO);
-}
-
-static CORBA_boolean
-impl_GNOME_Evolution_Importer_supportFormat (PortableServer_Servant servant,
- const CORBA_char *filename,
- CORBA_Environment *ev)
-{
- EvolutionImporter *importer;
- EvolutionImporterPrivate *priv;
-
- importer = evolution_importer_from_servant (servant);
- priv = importer->priv;
-
- if (priv->support_format_fn != NULL)
- return (priv->support_format_fn) (importer, filename,
- priv->closure);
- else
- return FALSE;
-}
-
-static CORBA_boolean
-impl_GNOME_Evolution_Importer_loadFile (PortableServer_Servant servant,
- const CORBA_char *filename,
- CORBA_Environment *ev)
-{
- EvolutionImporter *importer;
- EvolutionImporterPrivate *priv;
-
- importer = evolution_importer_from_servant (servant);
- priv = importer->priv;
-
- if (priv->load_file_fn != NULL)
- return (priv->load_file_fn) (importer, filename, priv->closure);
- else
- return FALSE;
-}
-
-static void
-impl_GNOME_Evolution_Importer_processItem (PortableServer_Servant servant,
- GNOME_Evolution_ImporterListener listener,
- CORBA_Environment *ev)
-{
- EvolutionImporter *importer;
- EvolutionImporterPrivate *priv;
-
- importer = evolution_importer_from_servant (servant);
- priv = importer->priv;
-
- if (priv->process_item_fn != NULL)
- (priv->process_item_fn) (importer, listener, priv->closure, ev);
- else
- GNOME_Evolution_ImporterListener_notifyResult (listener,
- GNOME_Evolution_ImporterListener_UNSUPPORTED_OPERATION, FALSE, ev);
-}
-
-static CORBA_char *
-impl_GNOME_Evolution_Importer_getError (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- EvolutionImporter *importer;
- EvolutionImporterPrivate *priv;
- CORBA_char *out_str;
-
- importer = evolution_importer_from_servant (servant);
- priv = importer->priv;
-
- if (priv->get_error_fn != NULL) {
- out_str = (priv->get_error_fn) (importer, priv->closure);
- return CORBA_string_dup (out_str ? out_str : "");
- } else
- return CORBA_string_dup ("");
-}
-
-
-static void
-finalise (GObject *object)
-{
- EvolutionImporter *importer;
- EvolutionImporterPrivate *priv;
-
- importer = EVOLUTION_IMPORTER (object);
- priv = importer->priv;
-
- if (priv == NULL)
- return;
-
- g_free (priv);
- importer->priv = NULL;
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-evolution_importer_class_init (EvolutionImporterClass *klass)
-{
- GObjectClass *object_class;
- POA_GNOME_Evolution_Importer__epv *epv = &klass->epv;
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = finalise;
-
- parent_class = g_type_class_ref(PARENT_TYPE);
- epv->createControl = impl_GNOME_Evolution_Importer_createControl;
- epv->supportFormat = impl_GNOME_Evolution_Importer_supportFormat;
- epv->loadFile = impl_GNOME_Evolution_Importer_loadFile;
- epv->processItem = impl_GNOME_Evolution_Importer_processItem;
- epv->getError = impl_GNOME_Evolution_Importer_getError;
-}
-
-static void
-evolution_importer_init (EvolutionImporter *importer)
-{
- EvolutionImporterPrivate *priv;
-
- priv = g_new0 (EvolutionImporterPrivate, 1);
-
- importer->priv = priv;
-}
-
-
-
-static void
-evolution_importer_construct (EvolutionImporter *importer,
- EvolutionImporterCreateControlFn create_control_fn,
- EvolutionImporterSupportFormatFn support_format_fn,
- EvolutionImporterLoadFileFn load_file_fn,
- EvolutionImporterProcessItemFn process_item_fn,
- EvolutionImporterGetErrorFn get_error_fn,
- void *closure)
-{
- EvolutionImporterPrivate *priv;
-
- g_return_if_fail (importer != NULL);
- g_return_if_fail (EVOLUTION_IS_IMPORTER (importer));
- g_return_if_fail (support_format_fn != NULL);
- g_return_if_fail (load_file_fn != NULL);
- g_return_if_fail (process_item_fn != NULL);
-
- priv = importer->priv;
- priv->create_control_fn = create_control_fn;
- priv->support_format_fn = support_format_fn;
- priv->load_file_fn = load_file_fn;
- priv->process_item_fn = process_item_fn;
- priv->get_error_fn = get_error_fn;
-
- priv->closure = closure;
-}
-
-/**
- * evolution_importer_new:
- * @support_format_fn: The function to be called by the supportFormat method.
- * @load_file_fn: The function to be called by the loadFile method.
- * @process_item_fn: The function to be called by the processItem method.
- * @get_error_fn: The function to be called by the getError method.
- * @closure: The data to be passed to all of the above functions.
- *
- * Creates a new EvolutionImporter object. Of the parameters only
- * @get_error_function and @closure may be #NULL.
- *
- * Returns: A newly created EvolutionImporter object.
- */
-EvolutionImporter *
-evolution_importer_new (EvolutionImporterCreateControlFn create_control_fn,
- EvolutionImporterSupportFormatFn support_format_fn,
- EvolutionImporterLoadFileFn load_file_fn,
- EvolutionImporterProcessItemFn process_item_fn,
- EvolutionImporterGetErrorFn get_error_fn,
- void *closure)
-{
- EvolutionImporter *importer;
-
- importer = g_object_new(evolution_importer_get_type (), NULL);
- evolution_importer_construct (importer, create_control_fn, support_format_fn, load_file_fn,
- process_item_fn, get_error_fn, closure);
- return importer;
-}
-
-BONOBO_TYPE_FUNC_FULL (EvolutionImporter,
- GNOME_Evolution_Importer,
- PARENT_TYPE,
- evolution_importer);
diff --git a/shell/importer/evolution-importer.h b/shell/importer/evolution-importer.h
deleted file mode 100644
index 4925fad4fc..0000000000
--- a/shell/importer/evolution-importer.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Iain Holmes <iain@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef EVOLUTION_IMPORTER_H
-#define EVOLUTION_IMPORTER_H
-
-#include <glib.h>
-#include <bonobo/bonobo-object.h>
-#include <importer/GNOME_Evolution_Importer.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* cplusplus */
-
-#define EVOLUTION_TYPE_IMPORTER (evolution_importer_get_type ())
-#define EVOLUTION_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVOLUTION_TYPE_IMPORTER, EvolutionImporter))
-#define EVOLUTION_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER, EvolutionImporterClass))
-#define EVOLUTION_IS_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVOLUTION_TYPE_IMPORTER))
-#define EVOLUTION_IS_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_IMPORTER))
-
-typedef struct _EvolutionImporter EvolutionImporter;
-typedef struct _EvolutionImporterPrivate EvolutionImporterPrivate;
-typedef struct _EvolutionImporterClass EvolutionImporterClass;
-
-typedef void (* EvolutionImporterCreateControlFn) (EvolutionImporter *importer,
- Bonobo_Control *control,
- void *closure);
-
-typedef gboolean (* EvolutionImporterSupportFormatFn) (EvolutionImporter *importer,
- const char *filename,
- void *closure);
-typedef gboolean (* EvolutionImporterLoadFileFn) (EvolutionImporter *importer,
- const char *filename,
- void *closure);
-typedef void (* EvolutionImporterProcessItemFn) (EvolutionImporter *importer,
- CORBA_Object listener,
- void *closure,
- CORBA_Environment *ev);
-typedef char *(* EvolutionImporterGetErrorFn) (EvolutionImporter *importer,
- void *closure);
-
-typedef enum {
- EVOLUTION_IMPORTER_OK,
- EVOLUTION_IMPORTER_UNSUPPORTED_OPERATION,
- EVOLUTION_IMPORTER_INTERRUPTED,
- EVOLUTION_IMPORTER_BUSY,
- EVOLUTION_IMPORTER_NOT_READY,
- EVOLUTION_IMPORTER_UNKNOWN_DATA,
- EVOLUTION_IMPORTER_BAD_DATA,
- EVOLUTION_IMPORTER_BAD_FILE,
- EVOLUTION_IMPORTER_UNKNOWN_ERROR
-} EvolutionImporterResult;
-
-struct _EvolutionImporter {
- BonoboObject parent;
-
- EvolutionImporterPrivate *priv;
-};
-
-struct _EvolutionImporterClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Importer__epv epv;
-};
-
-GType evolution_importer_get_type (void);
-
-EvolutionImporter *evolution_importer_new (EvolutionImporterCreateControlFn create_control_fn,
- EvolutionImporterSupportFormatFn support_format_fn,
- EvolutionImporterLoadFileFn load_file_fn,
- EvolutionImporterProcessItemFn process_item_fn,
- EvolutionImporterGetErrorFn get_error_fn,
- void *closure);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/shell/importer/evolution-intelligent-importer.c b/shell/importer/evolution-intelligent-importer.c
deleted file mode 100644
index d867c120b8..0000000000
--- a/shell/importer/evolution-intelligent-importer.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Iain Holmes <iain@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "evolution-intelligent-importer.h"
-
-#include <bonobo/bonobo-object.h>
-
-#include "GNOME_Evolution_Importer.h"
-
-#define PARENT_TYPE BONOBO_OBJECT_TYPE
-static BonoboObjectClass *parent_class = NULL;
-
-struct _EvolutionIntelligentImporterPrivate {
- EvolutionIntelligentImporterCanImportFn can_import_fn;
- EvolutionIntelligentImporterImportDataFn import_data_fn;
-
- char *importername;
- char *message;
- void *closure;
-};
-
-
-static inline EvolutionIntelligentImporter *
-evolution_intelligent_importer_from_servant (PortableServer_Servant servant)
-{
- return EVOLUTION_INTELLIGENT_IMPORTER (bonobo_object_from_servant (servant));
-}
-
-static CORBA_char *
-impl_GNOME_Evolution_IntelligentImporter__get_importername (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- EvolutionIntelligentImporter *ii;
-
- ii = evolution_intelligent_importer_from_servant (servant);
-
- return CORBA_string_dup (ii->priv->importername ?
- ii->priv->importername : "");
-}
-
-static CORBA_char *
-impl_GNOME_Evolution_IntelligentImporter__get_message (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- EvolutionIntelligentImporter *ii;
-
- ii = evolution_intelligent_importer_from_servant (servant);
-
- return CORBA_string_dup (ii->priv->message ?
- ii->priv->message : "");
-}
-
-static CORBA_boolean
-impl_GNOME_Evolution_IntelligentImporter_canImport (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- EvolutionIntelligentImporter *ii;
- EvolutionIntelligentImporterPrivate *priv;
-
- ii = evolution_intelligent_importer_from_servant (servant);
- priv = ii->priv;
-
- if (priv->can_import_fn != NULL)
- return (priv->can_import_fn) (ii, priv->closure);
- else
- return FALSE;
-}
-
-static void
-impl_GNOME_Evolution_IntelligentImporter_importData (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- EvolutionIntelligentImporter *ii;
- EvolutionIntelligentImporterPrivate *priv;
-
- ii = evolution_intelligent_importer_from_servant (servant);
- priv = ii->priv;
-
- if (priv->import_data_fn)
- (priv->import_data_fn) (ii, priv->closure);
-}
-
-
-static void
-finalise (GObject *object)
-{
- EvolutionIntelligentImporter *ii;
-
- ii = EVOLUTION_INTELLIGENT_IMPORTER (object);
-
- if (ii->priv == NULL)
- return;
-
- g_free (ii->priv->importername);
- g_free (ii->priv);
- ii->priv = NULL;
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-evolution_intelligent_importer_class_init (EvolutionIntelligentImporterClass *klass)
-{
- GObjectClass *object_class;
- POA_GNOME_Evolution_IntelligentImporter__epv *epv = &klass->epv;
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = finalise;
-
- parent_class = g_type_class_ref(PARENT_TYPE);
- epv->_get_importername = impl_GNOME_Evolution_IntelligentImporter__get_importername;
- epv->_get_message = impl_GNOME_Evolution_IntelligentImporter__get_message;
- epv->canImport = impl_GNOME_Evolution_IntelligentImporter_canImport;
- epv->importData = impl_GNOME_Evolution_IntelligentImporter_importData;
-}
-
-static void
-evolution_intelligent_importer_init (EvolutionIntelligentImporter *ii)
-{
- ii->priv = g_new0 (EvolutionIntelligentImporterPrivate, 1);
-}
-
-
-static void
-evolution_intelligent_importer_construct (EvolutionIntelligentImporter *ii,
- EvolutionIntelligentImporterCanImportFn can_import_fn,
- EvolutionIntelligentImporterImportDataFn import_data_fn,
- const char *importername,
- const char *message,
- void *closure)
-{
- g_return_if_fail (ii != NULL);
- ii->priv->importername = g_strdup (importername);
- ii->priv->message = g_strdup (message);
-
- ii->priv->can_import_fn = can_import_fn;
- ii->priv->import_data_fn = import_data_fn;
- ii->priv->closure = closure;
-}
-
-/**
- * evolution_intelligent_importer_new:
- * can_import_fn: The function that will be called to see if this importer can do
- * anything.
- * import_data_fn: The function that will be called when the importer should
- * import the data.
- * importername: The name of this importer.
- * message: The message that will be displayed when the importer can import.
- * closure: The data to be passed to @can_import_fn and @import_data_fn.
- *
- * Creates a new IntelligentImporter.
- *
- * Returns: A newly allocated EvolutionIntelligentImporter.
- */
-EvolutionIntelligentImporter *
-evolution_intelligent_importer_new (EvolutionIntelligentImporterCanImportFn can_import_fn,
- EvolutionIntelligentImporterImportDataFn import_data_fn,
- const char *importername,
- const char *message,
- void *closure)
-{
- EvolutionIntelligentImporter *ii;
-
- ii = g_object_new (evolution_intelligent_importer_get_type (), NULL);
- evolution_intelligent_importer_construct (ii, can_import_fn,
- import_data_fn, importername,
- message, closure);
- return ii;
-}
-
-BONOBO_TYPE_FUNC_FULL (EvolutionIntelligentImporter,
- GNOME_Evolution_IntelligentImporter,
- PARENT_TYPE,
- evolution_intelligent_importer);
diff --git a/shell/importer/evolution-intelligent-importer.h b/shell/importer/evolution-intelligent-importer.h
deleted file mode 100644
index 2d36d498e9..0000000000
--- a/shell/importer/evolution-intelligent-importer.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Iain Holmes <iain@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef EVOLUTION_INTELLIGENT_IMPORTER_H
-#define EVOLUTION_INTELLIGENT_IMPORTER_H
-
-#include <glib.h>
-#include <bonobo/bonobo-object.h>
-#include <importer/GNOME_Evolution_Importer.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define EVOLUTION_TYPE_INTELLIGENT_IMPORTER (evolution_intelligent_importer_get_type ())
-#define EVOLUTION_INTELLIGENT_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER, EvolutionIntelligentImporter))
-#define EVOLUTION_INTELLIGENT_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_INTELLIGENT_IMPORTER, EvolutionIntelligentImporterClass))
-#define EVOLUTION_IS_INTELLIGENT_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER))
-#define EVOLUTION_IS_INTELLIGENT_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER))
-
-typedef struct _EvolutionIntelligentImporter EvolutionIntelligentImporter;
-typedef struct _EvolutionIntelligentImporterPrivate EvolutionIntelligentImporterPrivate;
-typedef struct _EvolutionIntelligentImporterClass EvolutionIntelligentImporterClass;
-
-typedef gboolean (* EvolutionIntelligentImporterCanImportFn) (EvolutionIntelligentImporter *ii,
- void *closure);
-typedef void (* EvolutionIntelligentImporterImportDataFn) (EvolutionIntelligentImporter *ii,
- void *closure);
-
-struct _EvolutionIntelligentImporter {
- BonoboObject parent;
-
- EvolutionIntelligentImporterPrivate *priv;
-};
-
-struct _EvolutionIntelligentImporterClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_IntelligentImporter__epv epv;
-};
-
-GType evolution_intelligent_importer_get_type (void);
-
-EvolutionIntelligentImporter *evolution_intelligent_importer_new (EvolutionIntelligentImporterCanImportFn can_import_fn,
- EvolutionIntelligentImporterImportDataFn import_data_fn,
- const char *importername,
- const char *message,
- void *closure);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/shell/importer/import.glade b/shell/importer/import.glade
deleted file mode 100644
index 389d2feee3..0000000000
--- a/shell/importer/import.glade
+++ /dev/null
@@ -1,124 +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="GtkWindow" id="importwizard">
- <property name="title" translatable="yes">Evolution Import Assistant</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
-
- <child>
- <widget class="GnomeDruid" id="druid1">
- <property name="border_width">4</property>
- <property name="visible">True</property>
- <property name="show_help">False</property>
-
- <child>
- <widget class="GnomeDruidPageEdge" id="page0">
- <property name="visible">True</property>
- <property name="position">GNOME_EDGE_START</property>
- <property name="title" translatable="yes">Evolution Import Assistant</property>
- <property name="text" translatable="yes">Welcome to the Evolution Import Assistant.
-With this assistant you will be guided through the process of
-importing external files into Evolution.</property>
- </widget>
- </child>
-
- <child>
- <widget class="GnomeDruidPageStandard" id="page1">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Importer Type</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="druid-vbox2">
- <property name="border_width">16</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GnomeDruidPageStandard" id="page2-file">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Select a File</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="druid-vbox1">
- <property name="border_width">16</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GnomeDruidPageStandard" id="page3-file">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Import Location</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="druid-vbox3">
- <property name="border_width">16</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GnomeDruidPageStandard" id="page2-intelligent">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Select Information to Import</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="druid-vbox3">
- <property name="border_width">16</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GnomeDruidPageEdge" id="page4">
- <property name="visible">True</property>
- <property name="position">GNOME_EDGE_FINISH</property>
- <property name="title" translatable="yes">Import File</property>
- <property name="text" translatable="yes">Click &quot;Import&quot; to begin importing the file into Evolution. </property>
- </widget>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-interface>
diff --git a/shell/importer/intelligent.c b/shell/importer/intelligent.c
deleted file mode 100644
index 20927d2742..0000000000
--- a/shell/importer/intelligent.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Iain Holmes <iain@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "intelligent.h"
-
-#include <gtk/gtk.h>
-
-#include <libgnome/gnome-config.h>
-#include <glib/gi18n.h>
-
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-widget.h>
-
-#include "intelligent.h"
-#include "GNOME_Evolution_Importer.h"
-
-/* Prototypes */
-
-void intelligent_importer_init (void);
-
-/* End prototypes */
-
-typedef struct {
- CORBA_Object object;
- Bonobo_Control control;
- GtkWidget *widget;
-
- char *name;
- char *blurb;
- char *iid;
-} IntelligentImporterData;
-
-typedef struct {
- GtkWidget *dialog;
- GtkWidget *placeholder;
- GtkWidget *clist;
- BonoboWidget *current;
-
- GList *importers;
-
- int running;
-} IntelligentImporterDialog;
-
-typedef struct {
- CORBA_Object importer;
- char *iid;
-} SelectedImporterData;
-
-static void
-free_importer_dialog (IntelligentImporterDialog *d)
-{
- GList *l;
-
- for (l = d->importers; l; l = l->next) {
- CORBA_Environment ev;
- IntelligentImporterData *data;
-
- data = l->data;
-
- CORBA_exception_init (&ev);
- if (data->object != CORBA_OBJECT_NIL)
- bonobo_object_release_unref (data->object, &ev);
-
- g_free (data->iid);
- g_free (data->name);
- g_free (data->blurb);
- g_free (data);
- }
-
- g_list_free (d->importers);
- gtk_widget_destroy (d->dialog);
- g_free (d);
-}
-
-static void
-start_importers (GList *selected)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- for (; selected; selected = selected->next) {
- SelectedImporterData *selection = selected->data;
-
- GNOME_Evolution_IntelligentImporter_importData (selection->importer, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Error importing %s\n%s", selection->iid,
- CORBA_exception_id (&ev));
- }
- }
- CORBA_exception_free (&ev);
-}
-
-static GList *
-get_intelligent_importers (void)
-{
- Bonobo_ServerInfoList *info_list;
- GList *iids_ret = NULL;
- CORBA_Environment ev;
- int i;
-
- CORBA_exception_init (&ev);
- info_list = bonobo_activation_query ("repo_ids.has ('IDL:GNOME/Evolution/IntelligentImporter:" BASE_VERSION "')", NULL, &ev);
- CORBA_exception_free (&ev);
-
- for (i = 0; i < info_list->_length; i++) {
- const Bonobo_ServerInfo *info;
-
- info = info_list->_buffer + i;
- iids_ret = g_list_prepend (iids_ret, g_strdup (info->iid));
- }
-
- return iids_ret;
-}
-
-static void
-select_row_cb (GtkCList *clist,
- int row,
- int column,
- GdkEvent *ev,
- IntelligentImporterDialog *d)
-{
- gtk_notebook_set_current_page (GTK_NOTEBOOK (d->placeholder), row);
-}
-
-static void
-unselect_row_cb (GtkCList *clist,
- int row,
- int column,
- GdkEvent *ev,
- IntelligentImporterDialog *d)
-{
- gtk_notebook_set_current_page (GTK_NOTEBOOK (d->placeholder), d->running);
-}
-
-static IntelligentImporterDialog *
-create_gui (GList *importers)
-{
- GtkWidget *dialog, *clist, *sw, *label;
- GtkWidget *hbox, *vbox, *dummy;
- IntelligentImporterDialog *d;
- GList *l;
- int running = 0;
-
- d = g_new (IntelligentImporterDialog, 1);
- d->dialog = dialog = gtk_dialog_new();
- gtk_dialog_set_has_separator ((GtkDialog *) dialog, FALSE);
- gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *)dialog)->vbox, 0);
- gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *)dialog)->action_area, 12);
-
- gtk_window_set_title((GtkWindow *)dialog, _("Importers"));
- dummy = gtk_button_new_from_stock(GTK_STOCK_CONVERT);
- gtk_button_set_label((GtkButton *)dummy, _("Import"));
- gtk_dialog_add_action_widget((GtkDialog *)dialog, dummy, GTK_RESPONSE_ACCEPT);
-
- dummy = gtk_button_new_from_stock(GTK_STOCK_NO);
- gtk_button_set_label((GtkButton *)dummy, _("Do not import"));
- gtk_dialog_add_action_widget((GtkDialog *)dialog, dummy, GTK_RESPONSE_REJECT);
-
- dummy = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
- gtk_button_set_label((GtkButton *)dummy, _("Do not ask me again"));
- gtk_dialog_add_action_widget((GtkDialog *)dialog, dummy, GTK_RESPONSE_CANCEL);
- d->importers = NULL;
- d->current = NULL;
-
- d->clist = clist = gtk_clist_new (1);
- gtk_clist_set_selection_mode (GTK_CLIST (d->clist), GTK_SELECTION_MULTIPLE);
-
- label = gtk_label_new (_("Evolution can import data from the following files:"));
- gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label,
- TRUE, TRUE, 0);
-
- hbox = gtk_hbox_new (FALSE, 2);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
-
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
- TRUE, TRUE, 0);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
- gtk_widget_set_size_request (sw, 300, 150);
- gtk_container_add (GTK_CONTAINER (sw), clist);
- gtk_box_pack_start (GTK_BOX (hbox), sw, TRUE, TRUE, 0);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
- gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
-
- d->placeholder = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (d->placeholder), FALSE);
- gtk_box_pack_start (GTK_BOX (vbox), d->placeholder, TRUE, TRUE, 0);
-
- for (l = importers; l; l = l->next) {
- IntelligentImporterData *data;
- CORBA_Environment ev;
- gboolean dontaskagain, can_run;
- char *text[1], *prefix;
-
- /* Check if we want to show this one again */
- prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", g_get_home_dir ());
- gnome_config_push_prefix (prefix);
- g_free (prefix);
-
- dontaskagain = gnome_config_get_bool (l->data);
- gnome_config_pop_prefix ();
-
- if (dontaskagain)
- continue;
-
- data = g_new0 (IntelligentImporterData, 1);
- data->iid = g_strdup (l->data);
-
- CORBA_exception_init (&ev);
- data->object = bonobo_activation_activate_from_id ((char *) data->iid, 0,
- NULL, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Could not start %s: %s", data->iid,
- CORBA_exception_id (&ev));
- CORBA_exception_free (&ev);
-
- /* Clean up the IntelligentImporterData */
- g_free (data->iid);
- g_free (data);
- continue;
- }
-
- CORBA_exception_free (&ev);
- if (data->object == CORBA_OBJECT_NIL) {
- g_warning ("Could not activate_component %s", data->iid);
- g_free (data->iid);
- g_free (data);
- continue;
- }
-
- CORBA_exception_init (&ev);
- can_run = GNOME_Evolution_IntelligentImporter_canImport (data->object,
- &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Could not get canImport(%s): %s",
- data->iid, CORBA_exception_id (&ev));
- bonobo_object_release_unref (data->object, &ev);
- CORBA_exception_free (&ev);
- g_free (data->iid);
- g_free (data);
- continue;
- }
- CORBA_exception_free (&ev);
-
- if (can_run == FALSE) {
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (data->object, &ev);
- CORBA_exception_free (&ev);
- g_free (data->iid);
- g_free (data);
- continue;
- }
-
- running++;
-
- data->name = g_strdup (GNOME_Evolution_IntelligentImporter__get_importername (data->object, &ev));
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Could not get name(%s): %s",
- data->iid, CORBA_exception_id (&ev));
- bonobo_object_release_unref (data->object, &ev);
- CORBA_exception_free (&ev);
- g_free (data->iid);
- g_free (data);
- continue;
- }
-
- data->blurb = g_strdup (GNOME_Evolution_IntelligentImporter__get_message (data->object, &ev));
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Could not get message(%s): %s",
- data->iid, CORBA_exception_id (&ev));
- bonobo_object_release_unref (data->object, &ev);
- CORBA_exception_free (&ev);
- g_free (data->iid);
- g_free (data->name);
- g_free (data);
- continue;
- }
-
- data->control = Bonobo_Unknown_queryInterface (data->object,
- "IDL:Bonobo/Control:1.0", &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Could not QI for Bonobo/Control:1.0 %s:%s",
- data->iid, CORBA_exception_id (&ev));
- bonobo_object_release_unref (data->object, &ev);
- CORBA_exception_free (&ev);
- g_free (data->iid);
- g_free (data->name);
- g_free (data->blurb);
- continue;
- }
- if (data->control != CORBA_OBJECT_NIL) {
- data->widget = bonobo_widget_new_control_from_objref (data->control, CORBA_OBJECT_NIL);
- /* Ref this widget so even if we remove it from the
- containers it will always have an extra ref. */
- gtk_widget_show (data->widget);
- g_object_ref (data->widget);
- } else {
- data->widget = gtk_label_new ("");
- }
-
- CORBA_exception_free (&ev);
-
- d->importers = g_list_prepend (d->importers, data);
- gtk_notebook_prepend_page (GTK_NOTEBOOK (d->placeholder),
- data->widget, NULL);
- text[0] = data->name;
- gtk_clist_prepend (GTK_CLIST (clist), text);
- }
-
- d->running = running;
- dummy = gtk_drawing_area_new ();
- gtk_widget_show (dummy);
- gtk_notebook_append_page (GTK_NOTEBOOK (d->placeholder),
- dummy, NULL);
- /* Set the start to the blank page */
- gtk_notebook_set_current_page (GTK_NOTEBOOK (d->placeholder), running);
-
- g_signal_connect((clist), "select-row",
- G_CALLBACK (select_row_cb), d);
- g_signal_connect((clist), "unselect-row",
- G_CALLBACK (unselect_row_cb), d);
-
- gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
- return d;
-}
-
-void
-intelligent_importer_init (void)
-{
- GList *importers, *l, *selected = NULL;
- IntelligentImporterDialog *d;
- char *prefix;
- gboolean dontaskagain;
- int resp;
-
- prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", g_get_home_dir());
- gnome_config_push_prefix (prefix);
- g_free (prefix);
-
- dontaskagain = gnome_config_get_bool ("Dontaskagain=False");
- gnome_config_pop_prefix ();
-
- if (dontaskagain) {
- return;
- }
-
- importers = get_intelligent_importers ();
- if (importers == NULL)
- return; /* No intelligent importers. Easy :) */
-
- d = create_gui (importers);
- if (d->running == 0) {
- free_importer_dialog (d);
- return; /* No runnable intelligent importers. */
- }
-
- resp = gtk_dialog_run((GtkDialog *)d->dialog);
- gtk_widget_destroy(d->dialog);
- switch (resp) {
- case GTK_RESPONSE_ACCEPT:
- /* Make a list of the importers */
-
- /* FIXME: Sort this list and don't do it a slow way */
- for (l = GTK_CLIST (d->clist)->selection; l; l = l->next) {
- IntelligentImporterData *data;
- SelectedImporterData *new_data;
- CORBA_Environment ev;
- char *iid;
-
- data = g_list_nth_data (d->importers, GPOINTER_TO_INT (l->data));
- iid = g_strdup (data->iid);
-
- new_data = g_new (SelectedImporterData, 1);
- new_data->iid = iid;
-
- /* Reference the remote object, and duplicate the
- local one. */
- CORBA_exception_init (&ev);
- new_data->importer = bonobo_object_dup_ref (data->object, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Error duplicating %s\n%s", iid,
- CORBA_exception_id (&ev));
- g_free (iid);
- CORBA_exception_free (&ev);
- g_free (new_data);
- continue;
- }
- CORBA_exception_free (&ev);
-
- selected = g_list_prepend (selected, new_data);
- }
-
- /* Now destroy all the importers, as we've kept references to
- the ones we need */
- free_importer_dialog (d);
-
- if (selected != NULL) {
- /* Restart the selected ones */
- start_importers (selected);
-
- /* Free the selected list */
- for (l = selected; l; l = l->next) {
- CORBA_Environment ev;
- SelectedImporterData *selection = l->data;
-
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (selection->importer, &ev);
- CORBA_exception_free (&ev);
-
- g_free (selection->iid);
- g_free (selection);
- }
- g_list_free (selected);
- }
-
- break;
-
- case GTK_RESPONSE_CANCEL: /* Dont ask again */
- prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", g_get_home_dir());
- gnome_config_push_prefix (prefix);
- g_free (prefix);
-
- gnome_config_set_bool ("Dontaskagain", TRUE);
- gnome_config_pop_prefix ();
-
- gnome_config_sync ();
- gnome_config_drop_all ();
- g_print ("Not asking again");
- free_importer_dialog (d);
- break;
-
- default:
- case GTK_RESPONSE_REJECT: /* No button */
- free_importer_dialog (d);
- break;
- }
-
- g_list_free (importers);
-}
diff --git a/shell/main.c b/shell/main.c
index c6959d7663..928a321e61 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -23,6 +23,7 @@
#include <config.h>
#include <gtk/gtk.h>
+#include <gdk/gdkx.h> /* for copied UniqueApp code */
#include <glib/gstdio.h>
#ifdef G_OS_WIN32
@@ -34,12 +35,10 @@
#include "e-util/e-bconf-map.h"
#include <e-util/e-icon-factory.h>
-#include "e-shell-constants.h"
#include "e-util/e-profile-event.h"
#include "e-util/e-util.h"
#include "e-shell.h"
-#include "es-menu.h"
#include "es-event.h"
#include "e-util/e-util-private.h"
@@ -55,12 +54,11 @@
#include <libgnomeui/gnome-ui-init.h>
#include <libgnomeui/gnome-client.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-moniker-util.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo-activation/bonobo-activation.h>
+#include <libedataserver/e-categories.h>
#include <libedataserverui/e-passwords.h>
#include <glade/glade.h>
@@ -92,13 +90,11 @@
#define DEVELOPMENT 1
#endif
-static EShell *shell = NULL;
-
/* Command-line options. */
static gboolean start_online = FALSE;
static gboolean start_offline = FALSE;
static gboolean setup_only = FALSE;
-static gboolean killev = FALSE;
+static gboolean force_shutdown = FALSE;
#ifdef DEVELOPMENT
static gboolean force_migrate = FALSE;
#endif
@@ -106,24 +102,12 @@ static gboolean disable_eplugin = FALSE;
static gboolean disable_preview = FALSE;
static gboolean idle_cb (gchar **uris);
-static char *default_component_id = NULL;
-static char *evolution_debug_log = NULL;
+static gchar *requested_view = NULL;
+static gchar *evolution_debug_log = NULL;
static gchar **remaining_args;
-static void
-no_windows_left_cb (EShell *shell, gpointer data)
-{
- bonobo_object_unref (BONOBO_OBJECT (shell));
- bonobo_main_quit ();
-}
-
-static void
-shell_weak_notify (void *data,
- GObject *where_the_object_was)
-{
- bonobo_main_quit ();
-}
-
+/* Defined in <e-shell.h> */
+extern EShell *default_shell;
#ifdef KILL_PROCESS_CMD
@@ -185,6 +169,36 @@ kill_old_dataserver (void)
}
#endif
+static void
+categories_icon_theme_hack (void)
+{
+ GtkIconTheme *icon_theme;
+ const gchar *category_name;
+ const gchar *filename;
+ gchar *dirname;
+
+ /* XXX Allow the category icons to be referenced as named
+ * icons, since GtkAction does not support GdkPixbufs. */
+
+ /* Get the icon file for some default category. Doesn't matter
+ * which, so long as it has an icon. We're just interested in
+ * the directory components. */
+ category_name = _("Birthday");
+ filename = e_categories_get_icon_file_for (category_name);
+ g_return_if_fail (filename != NULL && *filename != '\0');
+
+ /* Extract the directory components. */
+ dirname = g_path_get_dirname (filename);
+
+ /* Add it to the icon theme's search path. This relies on
+ * GtkIconTheme's legacy feature of using image files found
+ * directly in the search path. */
+ icon_theme = gtk_icon_theme_get_default ();
+ gtk_icon_theme_append_search_path (icon_theme, dirname);
+
+ g_free (dirname);
+}
+
#ifdef DEVELOPMENT
@@ -287,124 +301,35 @@ destroy_config (GConfClient *client)
#endif /* DEVELOPMENT */
-static void
-open_uris (GNOME_Evolution_Shell corba_shell, gchar **uris)
-{
- CORBA_Environment ev;
- guint n_uris, ii;
-
- g_return_if_fail (uris != NULL);
- n_uris = g_strv_length (uris);
-
- CORBA_exception_init (&ev);
-
- for (ii = 0; ii < n_uris; ii++) {
- GNOME_Evolution_Shell_handleURI (corba_shell, uris[ii], &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Invalid URI: %s", uris[ii]);
- CORBA_exception_free (&ev);
- }
- }
-
- CORBA_exception_free (&ev);
-}
-
/* This is for doing stuff that requires the GTK+ loop to be running already. */
static gboolean
idle_cb (gchar **uris)
{
- GNOME_Evolution_Shell corba_shell;
- CORBA_Environment ev;
- EShellConstructResult result;
- EShellStartupLineMode startup_line_mode;
-
- g_return_val_if_fail (uris == NULL || g_strv_length (uris) > 0, FALSE);
+ EShell *shell;
#ifdef KILL_PROCESS_CMD
kill_old_dataserver ();
#endif
- CORBA_exception_init (&ev);
+ shell = e_shell_get_default ();
- if (! start_online && ! start_offline)
- startup_line_mode = E_SHELL_STARTUP_LINE_MODE_CONFIG;
- else if (start_online)
- startup_line_mode = E_SHELL_STARTUP_LINE_MODE_ONLINE;
+ /* These calls do the right thing when another Evolution
+ * process is running. */
+ if (uris != NULL && *uris != NULL)
+ e_shell_handle_uris (shell, uris);
else
- startup_line_mode = E_SHELL_STARTUP_LINE_MODE_OFFLINE;
-
- shell = e_shell_new (startup_line_mode, &result);
-
- switch (result) {
- case E_SHELL_CONSTRUCT_RESULT_OK:
- e_shell_set_crash_recovery (shell, e_file_lock_exists ());
- g_signal_connect (shell, "no_windows_left", G_CALLBACK (no_windows_left_cb), NULL);
- g_object_weak_ref (G_OBJECT (shell), shell_weak_notify, 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 (
- (Bonobo_ActivationID) E_SHELL_OAFIID, 0, NULL, &ev);
- if (ev._major != CORBA_NO_EXCEPTION || corba_shell == CORBA_OBJECT_NIL) {
- e_error_run(NULL, "shell:noshell", NULL);
- CORBA_exception_free (&ev);
- bonobo_main_quit ();
- return FALSE;
- }
- break;
-
- default:
- e_error_run(NULL, "shell:noshell-reason",
- e_shell_construct_result_to_string(result), NULL);
- CORBA_exception_free (&ev);
- bonobo_main_quit ();
- return FALSE;
-
- }
-
- if (shell != NULL) {
- if (uris != NULL)
- open_uris (corba_shell, uris);
- else {
- e_file_lock_create ();
- e_shell_create_window (shell, default_component_id, NULL);
- }
- } else {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- if (uris != NULL)
- open_uris (corba_shell, uris);
- else
- if (default_component_id == NULL)
- GNOME_Evolution_Shell_createNewWindow (corba_shell, "", &ev);
- else
- GNOME_Evolution_Shell_createNewWindow (corba_shell, default_component_id, &ev);
-
- CORBA_exception_free (&ev);
- }
-
- CORBA_Object_release (corba_shell, &ev);
-
- CORBA_exception_free (&ev);
+ e_shell_create_shell_window (shell, requested_view);
- if (shell == NULL) {
- /*there is another instance but because we don't open any windows
- we must notify the startup was complete manually*/
- gdk_notify_startup_complete ();
- bonobo_main_quit ();
- }
-
- /* This must be done after Bonobo has created all the components. For
- * example the mail component makes the global variable `session` which
- * is being used by several EPlugins */
+ /* If another Evolution process is running, we're done. */
+ if (unique_app_is_running (UNIQUE_APP (shell)))
+ gtk_main_quit ();
- if (!disable_eplugin) {
+ /* This must be done after EShell has loaded all the backends.
+ * For example the mail backend makes the global variable `session`
+ * which is being used by several EPlugins */
+ else if (uris == NULL && !disable_eplugin)
e_plugin_load_plugins_with_missing_symbols ();
- }
return FALSE;
}
@@ -466,27 +391,15 @@ setup_segv_redirect (void)
#define setup_segv_redirect() (void)0
#endif
-static gint
-gnome_master_client_save_yourself_cb (GnomeClient *client, GnomeSaveStyle save_style, gint shutdown, GnomeInteractStyle interact_style, gint fast, gpointer user_data)
-{
- return !shell || e_shell_can_quit (shell);
-}
-
-static void
-gnome_master_client_die_cb (GnomeClient *client)
-{
- e_shell_do_quit (shell);
-}
-
-static const GOptionEntry options[] = {
- { "component", 'c', 0, G_OPTION_ARG_STRING, &default_component_id,
+static GOptionEntry entries[] = {
+ { "component", 'c', 0, G_OPTION_ARG_STRING, &requested_view,
N_("Start Evolution activating the specified component"), NULL },
{ "offline", '\0', 0, G_OPTION_ARG_NONE, &start_offline,
N_("Start in offline mode"), NULL },
{ "online", '\0', 0, G_OPTION_ARG_NONE, &start_online,
N_("Start in online mode"), NULL },
#ifdef KILL_PROCESS_CMD
- { "force-shutdown", '\0', 0, G_OPTION_ARG_NONE, &killev,
+ { "force-shutdown", '\0', 0, G_OPTION_ARG_NONE, &force_shutdown,
N_("Forcibly shut down all Evolution components"), NULL },
#endif
#ifdef DEVELOPMENT
@@ -549,19 +462,178 @@ set_paths (void)
g_free (exe_folder_utf8);
g_free (components_folder_utf8);
- /* Set BONOBO_ACTIVATION_PATH */
- if (g_getenv ("BONOBO_ACTIVATION_PATH" ) == NULL) {
- path = g_build_filename (top_folder_utf8,
- "lib/bonobo/servers",
- NULL);
- if (!g_setenv ("BONOBO_ACTIVATION_PATH", path, TRUE))
- g_warning ("Could not set BONOBO_ACTIVATION_PATH");
- g_free (path);
- }
g_free (top_folder_utf8);
}
#endif
+static void
+shell_window_destroyed_cb (EShell *shell)
+{
+ if (e_shell_get_watched_windows (shell) == NULL)
+ gtk_main_quit ();
+}
+
+static gint
+master_client_save_yourself_cb (GnomeClient *client,
+ GnomeSaveStyle save_style,
+ gint shutdown,
+ GnomeInteractStyle interact_style,
+ gint fast,
+ gpointer user_data)
+{
+ EShell *shell = user_data;
+
+ return !e_shell_is_busy (shell);
+}
+
+static void
+master_client_die_cb (GnomeClient *client,
+ gpointer user_data)
+{
+ EShell *shell = user_data;
+
+ e_shell_do_quit (shell);
+}
+
+/* taken from nautilus */
+static guint32
+slowly_and_stupidly_obtain_timestamp (GdkDisplay *display)
+{
+ Display *xdisplay;
+ Window xwindow;
+ XEvent event;
+ XSetWindowAttributes attrs;
+ Atom atom_name;
+ Atom atom_type;
+ const gchar *name;
+
+ xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+ attrs.override_redirect = True;
+ attrs.event_mask = PropertyChangeMask | StructureNotifyMask;
+
+ xwindow = XCreateWindow (
+ xdisplay, RootWindow (xdisplay, 0),
+ -100, -100, 1, 1,
+ 0,
+ CopyFromParent,
+ CopyFromParent,
+ CopyFromParent,
+ CWOverrideRedirect | CWEventMask,
+ &attrs);
+
+ atom_name = XInternAtom (xdisplay, "WM_NAME", TRUE);
+ g_assert (atom_name != None);
+
+ atom_type = XInternAtom (xdisplay, "STRING", TRUE);
+ g_assert (atom_type != None);
+
+ name = "Fake Window";
+ XChangeProperty (
+ xdisplay, xwindow, atom_name, atom_type,
+ 8, PropModeReplace, (unsigned char *) name,
+ strlen (name));
+
+ XWindowEvent (
+ xdisplay, xwindow, PropertyChangeMask, &event);
+
+ XDestroyWindow (xdisplay, xwindow);
+
+ return event.xproperty.time;
+}
+
+static gchar *
+pick_startup_id (void)
+{
+ GdkDisplay *display;
+ const gchar *startup_id;
+ gchar *id;
+
+ /* XXX This copies logic from unique_app_new(), which we can't use
+ * because we're subclassing UniqueApp. I already sent ebassi
+ * a patch to fix this. */
+
+ display = gdk_display_get_default ();
+
+ /* Try and get the startup notification ID from GDK, the
+ * environment or, if everything else failed, fake one. */
+ startup_id = gdk_x11_display_get_startup_notification_id (display);
+
+ if (!startup_id || startup_id[0] == '\0')
+ startup_id = g_getenv ("DESKTOP_STARTUP_ID");
+
+ if (!startup_id || startup_id[0] == '\0') {
+ guint32 timestamp;
+
+ timestamp = slowly_and_stupidly_obtain_timestamp (display);
+ id = g_strdup_printf ("_TIME%lu", (gulong) timestamp);
+ } else
+ id = g_strdup (startup_id);
+
+ return id;
+}
+
+static void
+create_default_shell (void)
+{
+ EShell *shell;
+ GConfClient *conf_client;
+ GnomeClient *master_client;
+ gboolean online = TRUE;
+ gchar *startup_id;
+ GError *error = NULL;
+
+ conf_client = gconf_client_get_default ();
+ master_client = gnome_master_client ();
+
+ if (start_online)
+ online = TRUE;
+ else if (start_offline)
+ online = FALSE;
+ else {
+ const gchar *key;
+ gboolean value;
+
+ key = "/apps/evolution/shell/start_offline";
+ value = gconf_client_get_bool (conf_client, key, &error);
+ if (error == NULL)
+ online = !value;
+ else {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+ }
+
+ startup_id = pick_startup_id ();
+
+ shell = g_object_new (
+ E_TYPE_SHELL,
+ "name", "org.gnome.evolution",
+ "online", online,
+ "startup-id", startup_id,
+ NULL);
+
+ g_free (startup_id);
+
+ g_signal_connect (
+ shell, "window-destroyed",
+ G_CALLBACK (shell_window_destroyed_cb), NULL);
+
+ if (master_client != NULL) {
+ g_signal_connect (
+ master_client, "save_yourself",
+ G_CALLBACK (master_client_save_yourself_cb), shell);
+
+ g_signal_connect (
+ master_client, "die",
+ G_CALLBACK (master_client_die_cb), shell);
+ }
+
+ g_object_unref (conf_client);
+
+ default_shell = shell;
+}
+
int
main (int argc, char **argv)
{
@@ -573,10 +645,8 @@ main (int argc, char **argv)
#ifdef DEVELOPMENT
gboolean skip_warning_dialog;
#endif
- GnomeProgram *program;
- GnomeClient *master_client;
- GOptionContext *context;
- char *filename;
+ gchar *filename;
+ GError *error = NULL;
/* Make ElectricFence work. */
free (malloc (10));
@@ -585,21 +655,19 @@ main (int argc, char **argv)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- context = g_option_context_new (_("- The Evolution PIM and Email Client"));
-
- g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
-
- g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
-
#ifdef G_OS_WIN32
set_paths ();
#endif
- program = gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, argc, argv,
- GNOME_PROGRAM_STANDARD_PROPERTIES,
- GNOME_PARAM_GOPTION_CONTEXT, context,
- GNOME_PARAM_HUMAN_READABLE_NAME, _("Evolution"),
- NULL);
+ gtk_init_with_args (
+ &argc, &argv,
+ _("- The Evolution PIM and Email Client"),
+ entries, GETTEXT_PACKAGE, &error);
+ if (error != NULL) {
+ g_printerr ("%s\n", error->message);
+ g_error_free (error);
+ exit (1);
+ }
#ifdef G_OS_WIN32
if (strcmp (gettext (""), "") == 0) {
@@ -613,15 +681,14 @@ main (int argc, char **argv)
}
#endif
if (start_online && start_offline) {
- fprintf (stderr, _("%s: --online and --offline cannot be used together.\n Use %s --help for more information.\n"),
+ g_printerr (_("%s: --online and --offline cannot be used together.\n Use %s --help for more information.\n"),
argv[0], argv[0]);
exit (1);
}
- if (killev) {
- filename = g_build_filename (EVOLUTION_TOOLSDIR,
- "killev",
- NULL);
+ if (force_shutdown) {
+ filename = g_build_filename (
+ EVOLUTION_TOOLSDIR, "killev", NULL);
execl (filename, "killev", NULL);
/* Not reached */
exit (0);
@@ -630,11 +697,10 @@ main (int argc, char **argv)
client = gconf_client_get_default ();
#ifdef DEVELOPMENT
-
- if (force_migrate) {
+ if (force_migrate)
destroy_config (client);
- }
#endif
+
if (disable_preview) {
gconf_client_set_bool (client, "/apps/evolution/mail/display/show_preview", FALSE, NULL);
gconf_client_set_bool (client, "/apps/evolution/mail/display/safe_list", TRUE, NULL);
@@ -656,34 +722,29 @@ main (int argc, char **argv)
g_warning ("Could not set up debugging output file.");
}
- master_client = gnome_master_client ();
-
- g_signal_connect (G_OBJECT (master_client), "save_yourself", G_CALLBACK (gnome_master_client_save_yourself_cb), NULL);
- g_signal_connect (G_OBJECT (master_client), "die", G_CALLBACK (gnome_master_client_die_cb), NULL);
-
glade_init ();
e_cursors_init ();
e_icon_factory_init ();
- e_passwords_init();
+ e_passwords_init ();
gtk_window_set_default_icon_name ("evolution");
if (setup_only)
exit (0);
+ categories_icon_theme_hack ();
gnome_sound_init ("localhost");
gtk_accel_map_load (e_get_accels_filename ());
if (!disable_eplugin) {
- e_plugin_register_type(e_plugin_lib_get_type());
- e_plugin_hook_register_type(es_menu_hook_get_type());
- e_plugin_hook_register_type(es_event_hook_get_type());
+ e_plugin_register_type (e_plugin_lib_get_type ());
+ e_plugin_hook_register_type (es_event_hook_get_type ());
#ifdef ENABLE_PROFILING
- e_plugin_hook_register_type(e_profile_event_hook_get_type());
+ e_plugin_hook_register_type (e_profile_event_hook_get_type ());
#endif
- e_plugin_hook_register_type(e_plugin_type_hook_get_type());
- e_plugin_hook_register_type(e_import_hook_get_type());
- e_plugin_hook_register_type(E_TYPE_PLUGIN_UI_HOOK);
+ e_plugin_hook_register_type (e_plugin_type_hook_get_type ());
+ e_plugin_hook_register_type (e_import_hook_get_type ());
+ e_plugin_hook_register_type (E_TYPE_PLUGIN_UI_HOOK);
e_plugin_load_plugins ();
}
@@ -701,18 +762,26 @@ main (int argc, char **argv)
#else
g_idle_add ((GSourceFunc) idle_cb, remaining_args);
#endif
+
g_object_unref (client);
- bonobo_main ();
+ create_default_shell ();
+
+ gtk_main ();
+
+ /* Emit a warning if the shell is not finalized. */
+ g_object_unref (default_shell);
+ if (E_IS_SHELL (default_shell))
+ g_warning ("Shell not finalized on exit");
gtk_accel_map_save (e_get_accels_filename ());
e_icon_factory_shutdown ();
- g_object_unref (program);
gnome_sound_shutdown ();
e_cursors_shutdown ();
#ifdef G_OS_WIN32
link_shutdown ();
#endif
+
return 0;
}
diff --git a/shell/shell.error.xml b/shell/shell.error.xml
index 7ae57dec58..603d5ed955 100644
--- a/shell/shell.error.xml
+++ b/shell/shell.error.xml
@@ -16,9 +16,8 @@ You will need to make more space available in your home directory before you can
</error>
<error id="upgrade-failed" type="error">
- <_primary>Upgrade from previous version failed:
-{0}</_primary>
- <_secondary xml:space="preserve">{1}
+ <_primary>Upgrade from previous version failed:</_primary>
+ <_secondary xml:space="preserve">{0}
If you choose to continue, you may not have access to some of your old data.
</_secondary>
@@ -51,28 +50,6 @@ Once deleted, you cannot downgrade to the previous version of Evolution without
<button stock="gtk-delete" response="GTK_RESPONSE_OK"/>
</error>
- <error id="noshell" type="error">
- <_title>Cannot start Evolution</_title>
- <_primary>Evolution can not start.</_primary>
- <_secondary xml:space="preserve">Your system configuration does not match your Evolution configuration.
-
-Click help for details</_secondary>
- <help uri="http://go-evolution.org/FAQ#What_does_.22Your_system_configuration_does_not_match_your_Evolution_configuration.22_mean.3F"/>
- <button stock="gtk-quit" response="GTK_RESPONSE_CANCEL"/>
- </error>
-
- <error id="noshell-reason" type="error">
- <_title>Cannot start Evolution</_title>
- <_primary>Evolution can not start.</_primary>
- <_secondary xml:space="preserve">Your system configuration does not match your Evolution configuration:
-
-{0}
-
-Click help for details.</_secondary>
- <help uri="http://go-evolution.org/FAQ#What_does_.22Your_system_configuration_does_not_match_your_Evolution_configuration.22_mean.3F"/>
- <button stock="gtk-quit" response="GTK_RESPONSE_CANCEL"/>
- </error>
-
<error id="forget-passwords" type="question" default="GTK_RESPONSE_CANCEL">
<_primary>Are you sure you want to forget all remembered passwords?</_primary>
<_secondary xml:space="preserve">Forgetting your passwords will clear all remembered passwords. You will be reprompted next time they are needed.</_secondary>
diff --git a/shell/test/GNOME_Evolution_Test.server.in.in b/shell/test/GNOME_Evolution_Test.server.in.in
deleted file mode 100644
index ef0db8b1ac..0000000000
--- a/shell/test/GNOME_Evolution_Test.server.in.in
+++ /dev/null
@@ -1,39 +0,0 @@
-<oaf_info>
-
- <!-- (factory) -->
- <oaf_server iid="OAFIID:GNOME_Evolution_Test_Factory:@VERSION@"
- type="shlib"
- location="@COMPONENTDIR_IN_SERVER_FILE@/libevolution-test@SOEXT@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Test"/>
- </oaf_server>
-
- <!-- Component Interface -->
-
- <oaf_server iid="OAFIID:GNOME_Evolution_Test_Component:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Test_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/Component:@VERSION@"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string" _value="Evolution Test component"/>
-
- <oaf_attribute name="evolution:component_alias" type="string" value="test"/>
-
- <oaf_attribute name="evolution:button_label" type="string" _value="Test"/>
- <oaf_attribute name="evolution:button_sort_order" type="string" value="-1"/>
- <oaf_attribute name="evolution:button_icon" type="string" value="stock_mail"/>
-
- <oaf_attribute name="evolution:component_icon" type="string" value="stock_mail"/>
- <oaf_attribute name="evolution:component_display_order" type="number" value="1"/>
-
- </oaf_server>
-
-</oaf_info>
diff --git a/shell/test/Makefile.am b/shell/test/Makefile.am
index 74bd509958..7982e29f17 100644
--- a/shell/test/Makefile.am
+++ b/shell/test/Makefile.am
@@ -1,37 +1,26 @@
-component_LTLIBRARIES = libevolution-test.la
+module_LTLIBRARIES = libevolution-module-test.la
INCLUDES = \
-I$(top_srcdir)/shell \
+ -I$(top_srcdir)/widgets \
+ -I$(top_srcdir)/widgets/menus \
-I$(top_srcdir)/widgets/misc \
-I$(top_builddir)/shell \
-DG_LOG_DOMAIN=\"evolution-test\" \
$(EVOLUTION_TEST_CFLAGS)
-libevolution_test_la_SOURCES = \
- evolution-test-component.c \
- evolution-test-component.h
+libevolution_module_test_la_SOURCES = \
+ evolution-module-test.c \
+ e-test-shell-backend.c \
+ e-test-shell-backend.h \
+ e-test-shell-view.c \
+ e-test-shell-view.h
-libevolution_test_la_LIBADD = \
+libevolution_module_test_la_LIBADD = \
$(top_builddir)/shell/libeshell.la \
$(EVOLUTION_TEST_LIBS)
-libevolution_test_la_LDFLAGS = \
+libevolution_module_test_la_LDFLAGS = \
-avoid-version -module $(NO_UNDEFINED)
-testserver_in_files = GNOME_Evolution_Test.server.in.in
-testserver_DATA = $(testserver_in_files:.server.in.in=.server)
-testserverdir = $(serverdir)
-@EVO_SERVER_RULE@
-@INTLTOOL_SERVER_RULE@
-
-BUILT_SOURCES = $(testserver_DATA)
-CLEANFILES = $(BUILT_SOURCES)
-
-EXTRA_DIST = \
- $(testserver_in_files) \
- GNOME_Evolution_Test.server.in.in
-
-dist-hook:
- cd $(distdir); rm -f $(BUILD_SOURCES)
-
-include $(top_srcdir)/git.mk
diff --git a/shell/test/e-test-shell-backend.c b/shell/test/e-test-shell-backend.c
new file mode 100644
index 0000000000..e5fd3c6a43
--- /dev/null
+++ b/shell/test/e-test-shell-backend.c
@@ -0,0 +1,240 @@
+/*
+ * e-test-shell-backend.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-test-shell-backend.h"
+
+#include <glib/gi18n.h>
+
+#include "shell/e-shell.h"
+#include "shell/e-shell-window.h"
+
+#include "e-test-shell-view.h"
+
+#define E_TEST_SHELL_BACKEND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TEST_SHELL_BACKEND, ETestShellBackendPrivate))
+
+struct _ETestShellBackendPrivate {
+ gint placeholder;
+};
+
+static gpointer parent_class;
+static GType test_shell_backend_type;
+
+static void
+action_test_item_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ g_debug ("%s", G_STRFUNC);
+}
+
+static void
+action_test_source_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ g_debug ("%s", G_STRFUNC);
+}
+
+static GtkActionEntry item_entries[] = {
+
+ { "test-item-new",
+ "document-new",
+ NC_("New", "_Test Item"),
+ NULL,
+ N_("Create a new test item"),
+ G_CALLBACK (action_test_item_new_cb) }
+};
+
+static GtkActionEntry source_entries[] = {
+
+ { "test-source-new",
+ "folder-new",
+ NC_("New", "Test _Source"),
+ NULL,
+ N_("Create a new test source"),
+ G_CALLBACK (action_test_source_new_cb) }
+};
+
+static void
+test_shell_backend_start (EShellBackend *shell_backend)
+{
+ g_debug ("%s", G_STRFUNC);
+}
+
+static gboolean
+test_shell_backend_is_busy (EShellBackend *shell_backend)
+{
+ g_debug ("%s", G_STRFUNC);
+
+ return FALSE;
+}
+
+static gboolean
+test_shell_backend_shutdown (EShellBackend *shell_backend)
+{
+ g_debug ("%s", G_STRFUNC);
+
+ return TRUE;
+}
+
+static gboolean
+test_shell_backend_migrate (EShellBackend *shell_backend,
+ gint major,
+ gint minor,
+ gint micro,
+ GError **error)
+{
+ g_debug ("%s (from %d.%d.%d)", G_STRFUNC, major, minor, micro);
+
+ return TRUE;
+}
+
+static gboolean
+test_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
+ const gchar *uri)
+{
+ g_debug ("%s (uri=%s)", G_STRFUNC, uri);
+
+ return FALSE;
+}
+
+static void
+test_shell_backend_send_receive_cb (EShellBackend *shell_backend,
+ GtkWindow *parent_window)
+{
+ g_debug ("%s (window=%p)", G_STRFUNC, parent_window);
+}
+
+static void
+test_shell_backend_window_created_cb (EShellBackend *shell_backend,
+ GtkWindow *window)
+{
+ const gchar *backend_name;
+
+ g_debug ("%s (%s)", G_STRFUNC, G_OBJECT_TYPE_NAME (window));
+
+ if (!E_IS_SHELL_WINDOW (window))
+ return;
+
+ backend_name = E_SHELL_BACKEND_GET_CLASS (shell_backend)->name;
+
+ e_shell_window_register_new_item_actions (
+ E_SHELL_WINDOW (window), backend_name,
+ item_entries, G_N_ELEMENTS (item_entries));
+
+ e_shell_window_register_new_source_actions (
+ E_SHELL_WINDOW (window), backend_name,
+ source_entries, G_N_ELEMENTS (source_entries));
+}
+
+static void
+test_shell_backend_window_destroyed_cb (EShellBackend *shell_backend)
+{
+ g_debug ("%s", G_STRFUNC);
+}
+
+void
+test_shell_backend_constructed (GObject *object)
+{
+ EShell *shell;
+ EShellBackend *shell_backend;
+
+ shell_backend = E_SHELL_BACKEND (object);
+ shell = e_shell_backend_get_shell (shell_backend);
+
+ g_signal_connect_swapped (
+ shell, "handle-uri",
+ G_CALLBACK (test_shell_backend_handle_uri_cb),
+ shell_backend);
+
+ g_signal_connect_swapped (
+ shell, "send-receive",
+ G_CALLBACK (test_shell_backend_send_receive_cb),
+ shell_backend);
+
+ g_signal_connect_swapped (
+ shell, "window-created",
+ G_CALLBACK (test_shell_backend_window_created_cb),
+ shell_backend);
+
+ g_signal_connect_swapped (
+ shell, "window-destroyed",
+ G_CALLBACK (test_shell_backend_window_destroyed_cb),
+ shell_backend);
+}
+
+static void
+test_shell_backend_class_init (ETestShellBackendClass *class)
+{
+ GObjectClass *object_class;
+ EShellBackendClass *shell_backend_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ETestShellBackendPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = test_shell_backend_constructed;
+
+ shell_backend_class = E_SHELL_BACKEND_CLASS (class);
+ shell_backend_class->shell_view_type = E_TYPE_TEST_SHELL_VIEW;
+ shell_backend_class->name = "test";
+ shell_backend_class->aliases = "monkey";
+ shell_backend_class->schemes = "";
+ shell_backend_class->sort_order = 100;
+ shell_backend_class->start = test_shell_backend_start;
+ shell_backend_class->is_busy = test_shell_backend_is_busy;
+ shell_backend_class->shutdown = test_shell_backend_shutdown;
+ shell_backend_class->migrate = test_shell_backend_migrate;
+}
+
+static void
+test_shell_backend_init (ETestShellBackend *test_shell_backend)
+{
+ test_shell_backend->priv =
+ E_TEST_SHELL_BACKEND_GET_PRIVATE (test_shell_backend);
+}
+
+GType
+e_test_shell_backend_get_type (void)
+{
+ return test_shell_backend_type;
+}
+
+void
+e_test_shell_backend_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (ETestShellBackendClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) test_shell_backend_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ETestShellBackend),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) test_shell_backend_init,
+ NULL /* value_table */
+ };
+
+ test_shell_backend_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_BACKEND,
+ "ETestShellBackend", &type_info, 0);
+}
diff --git a/shell/test/e-test-shell-backend.h b/shell/test/e-test-shell-backend.h
new file mode 100644
index 0000000000..0d342bfbcc
--- /dev/null
+++ b/shell/test/e-test-shell-backend.h
@@ -0,0 +1,67 @@
+/*
+ * e-test-shell-backend.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_TEST_SHELL_BACKEND_H
+#define E_TEST_SHELL_BACKEND_H
+
+#include <shell/e-shell-backend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_TEST_SHELL_BACKEND \
+ (e_test_shell_backend_get_type ())
+#define E_TEST_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_TEST_SHELL_BACKEND, ETestShellBackend))
+#define E_TEST_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_TEST_SHELL_BACKEND, ETestShellBackendClass))
+#define E_IS_TEST_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_TEST_SHELL_BACKEND))
+#define E_IS_TEST_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_TEST_SHELL_BACKEND))
+#define E_TEST_SHELL_BACKEND_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_TEST_SHELL_BACKEND, ETestShellBackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ETestShellBackend ETestShellBackend;
+typedef struct _ETestShellBackendClass ETestShellBackendClass;
+typedef struct _ETestShellBackendPrivate ETestShellBackendPrivate;
+
+struct _ETestShellBackend {
+ EShellBackend parent;
+ ETestShellBackendPrivate *priv;
+};
+
+struct _ETestShellBackendClass {
+ EShellBackendClass parent_class;
+};
+
+GType e_test_shell_backend_get_type (void);
+void e_test_shell_backend_register_type
+ (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_TEST_SHELL_BACKEND_H */
diff --git a/shell/test/e-test-shell-view.c b/shell/test/e-test-shell-view.c
new file mode 100644
index 0000000000..b4464cc68f
--- /dev/null
+++ b/shell/test/e-test-shell-view.c
@@ -0,0 +1,155 @@
+/*
+ * e-test-shell-view.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-test-shell-view.h"
+
+#include "shell/e-shell-content.h"
+#include "shell/e-shell-sidebar.h"
+
+#define E_TEST_SHELL_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TEST_SHELL_VIEW, ETestShellViewPrivate))
+
+struct _ETestShellViewPrivate {
+ EActivity *activity;
+};
+
+static gpointer parent_class;
+static GType test_shell_view_type;
+
+static void
+test_shell_view_toggled (EShellView *shell_view)
+{
+#if 0
+ gboolean is_active;
+ const gchar *active;
+
+ is_active = e_shell_view_is_active (shell_view);
+ active = is_active ? "active" : "inactive";
+ g_debug ("%s (now %s)", G_STRFUNC, active);
+#endif
+}
+
+static void
+test_shell_view_dispose (GObject *object)
+{
+ ETestShellViewPrivate *priv;
+
+ priv = E_TEST_SHELL_VIEW_GET_PRIVATE (object);
+
+ if (priv->activity != NULL) {
+ e_activity_complete (priv->activity);
+ g_object_unref (priv->activity);
+ priv->activity = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+test_shell_view_constructed (GObject *object)
+{
+ ETestShellViewPrivate *priv;
+ EShellContent *shell_content;
+ EShellSidebar *shell_sidebar;
+ EShellBackend *shell_backend;
+ EShellView *shell_view;
+ EActivity *activity;
+ GtkWidget *widget;
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ priv = E_TEST_SHELL_VIEW_GET_PRIVATE (object);
+
+ shell_view = E_SHELL_VIEW (object);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ widget = gtk_label_new ("Content Widget");
+ gtk_container_add (GTK_CONTAINER (shell_content), widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_label_new ("Sidebar Widget");
+ gtk_container_add (GTK_CONTAINER (shell_sidebar), widget);
+ gtk_widget_show (widget);
+
+ activity = e_activity_new ("Test Activity");
+ e_activity_set_allow_cancel (activity, TRUE);
+ e_shell_backend_add_activity (shell_backend, activity);
+ priv->activity = activity;
+}
+
+static void
+test_shell_view_class_init (ETestShellViewClass *class,
+ GTypeModule *type_module)
+{
+ GObjectClass *object_class;
+ EShellViewClass *shell_view_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ETestShellViewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = test_shell_view_dispose;
+ object_class->constructed = test_shell_view_constructed;
+
+ shell_view_class = E_SHELL_VIEW_CLASS (class);
+ shell_view_class->label = "Test";
+ shell_view_class->icon_name = "face-monkey";
+ shell_view_class->toggled = test_shell_view_toggled;
+}
+
+static void
+test_shell_view_init (ETestShellView *test_shell_view)
+{
+ test_shell_view->priv =
+ E_TEST_SHELL_VIEW_GET_PRIVATE (test_shell_view);
+}
+
+GType
+e_test_shell_view_get_type (void)
+{
+ return test_shell_view_type;
+}
+
+void
+e_test_shell_view_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (ETestShellViewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) test_shell_view_class_init,
+ (GClassFinalizeFunc) NULL,
+ type_module,
+ sizeof (ETestShellView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) test_shell_view_init,
+ NULL /* value_table */
+ };
+
+ test_shell_view_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_VIEW,
+ "ETestShellView", &type_info, 0);
+}
diff --git a/shell/test/e-test-shell-view.h b/shell/test/e-test-shell-view.h
new file mode 100644
index 0000000000..85c33bfb39
--- /dev/null
+++ b/shell/test/e-test-shell-view.h
@@ -0,0 +1,66 @@
+/*
+ * e-test-shell-view.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_TEST_SHELL_VIEW_H
+#define E_TEST_SHELL_VIEW_H
+
+#include <shell/e-shell-view.h>
+
+/* Standard GObject macros */
+#define E_TYPE_TEST_SHELL_VIEW \
+ (e_test_shell_view_get_type ())
+#define E_TEST_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_TEST_SHELL_VIEW, ETestShellView))
+#define E_TEST_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_TEST_SHELL_VIEW, ETestShellViewClass))
+#define E_IS_TEST_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_TEST_SHELL_VIEW))
+#define E_IS_TEST_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_TEST_SHELL_VIEW))
+#define E_TEST_SHELL_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_TEST_SHELL_VIEW, ETestShellViewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ETestShellView ETestShellView;
+typedef struct _ETestShellViewClass ETestShellViewClass;
+typedef struct _ETestShellViewPrivate ETestShellViewPrivate;
+
+struct _ETestShellView {
+ EShellView parent;
+ ETestShellViewPrivate *priv;
+};
+
+struct _ETestShellViewClass {
+ EShellViewClass parent_class;
+};
+
+GType e_test_shell_view_get_type (void);
+void e_test_shell_view_register_type (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_TEST_SHELL_VIEW_H */
diff --git a/widgets/misc/e-config-page.c b/shell/test/evolution-module-test.c
index 00fb991578..1fe3c7c0d0 100644
--- a/widgets/misc/e-config-page.c
+++ b/shell/test/evolution-module-test.c
@@ -1,4 +1,6 @@
/*
+ * evolution-module-test.c
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,37 +15,27 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-config-page.h"
-
-G_DEFINE_TYPE (EConfigPage, e_config_page, GTK_TYPE_EVENT_BOX)
+#include "e-test-shell-backend.h"
+#include "e-test-shell-view.h"
-/* GObject methods. */
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
-static void
-e_config_page_class_init (EConfigPageClass *class)
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
{
-}
+ /* Register dynamically loaded types. */
-static void
-e_config_page_init (EConfigPage *page)
-{
+ e_test_shell_backend_register_type (type_module);
+ e_test_shell_view_register_type (type_module);
}
-GtkWidget *
-e_config_page_new (void)
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
{
- return g_object_new (e_config_page_get_type (), NULL);
}
-
-
diff --git a/shell/test/evolution-test-component.c b/shell/test/evolution-test-component.c
deleted file mode 100644
index 9fdeab7a3f..0000000000
--- a/shell/test/evolution-test-component.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <string.h>
-#include <glib/gi18n.h>
-#include <bonobo/bonobo-shlib-factory.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-exception.h>
-#include <gtk/gtk.h>
-#include "e-task-bar.h"
-#include "evolution-test-component.h"
-
-
-#define FACTORY_ID "OAFIID:GNOME_Evolution_Test_Factory:" BASE_VERSION
-#define TEST_COMPONENT_ID "OAFIID:GNOME_Evolution_Test_Component:" BASE_VERSION
-#define CREATE_TEST_ID "test"
-
-#define PARENT_TYPE bonobo_object_get_type ()
-
-static BonoboObjectClass *parent_class = NULL;
-
-struct _EvolutionTestComponentPrivate {
- BonoboControl *view_control;
- BonoboControl *sidebar_control;
- BonoboControl *status_control;
-};
-
-/* GObject methods */
-
-static void
-impl_dispose (GObject *object)
-{
- EvolutionTestComponentPrivate *priv;
-
- priv = EVOLUTION_TEST_COMPONENT (object)->priv;
-
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-impl_finalize (GObject *object)
-{
- EvolutionTestComponentPrivate *priv = EVOLUTION_TEST_COMPONENT (object)->priv;
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-/* Evolution::Component CORBA methods */
-
-static void
-impl_upgradeFromVersion (PortableServer_Servant servant,
- const CORBA_short major,
- const CORBA_short minor,
- const CORBA_short revision,
- CORBA_Environment *ev)
-{
- EvolutionTestComponent *component = EVOLUTION_TEST_COMPONENT (bonobo_object_from_servant (servant));
- EvolutionTestComponentPrivate *priv;
-
- priv = component->priv;
-
- g_message ("Upgrading from %d.%d.%d", major, minor, revision);
-}
-
-
-static GNOME_Evolution_CreatableItemTypeList *
-impl__get_userCreatableItems (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GNOME_Evolution_CreatableItemTypeList *list = GNOME_Evolution_CreatableItemTypeList__alloc ();
-
- list->_length = 1;
- list->_maximum = list->_length;
- list->_buffer = GNOME_Evolution_CreatableItemTypeList_allocbuf (list->_length);
-
- CORBA_sequence_set_release (list, FALSE);
-
- list->_buffer[0].id = CREATE_TEST_ID;
- list->_buffer[0].description = _("New Test");
- list->_buffer[0].menuDescription = (char *) C_("New", "_Test");
- list->_buffer[0].tooltip = _("Create a new test item");
- list->_buffer[0].menuShortcut = 'i';
- list->_buffer[0].iconName = "";
-
- return list;
-}
-
-static void
-impl_requestCreateItem (PortableServer_Servant servant,
- const CORBA_char *item_type_name,
- CORBA_Environment *ev)
-{
- EvolutionTestComponent *evolution_test_component = EVOLUTION_TEST_COMPONENT (bonobo_object_from_servant (servant));
- EvolutionTestComponentPrivate *priv;
-
- priv = evolution_test_component->priv;
-
- if (strcmp (item_type_name, CREATE_TEST_ID) == 0) {
- g_message ("Creating test item");
- } else {
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_UnknownType);
- return;
- }
-}
-
-/* Initialization */
-
-static void
-evolution_test_component_class_init (EvolutionTestComponentClass *klass)
-{
- POA_GNOME_Evolution_Component__epv *epv = &klass->epv;
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- epv->upgradeFromVersion = impl_upgradeFromVersion;
- epv->_get_userCreatableItems = impl__get_userCreatableItems;
- epv->requestCreateItem = impl_requestCreateItem;
-
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
-}
-
-static void
-evolution_test_component_init (EvolutionTestComponent *component, EvolutionTestComponentClass *klass)
-{
- EvolutionTestComponentPrivate *priv;
-
- priv = g_new0 (EvolutionTestComponentPrivate, 1);
-
- component->priv = priv;
-}
-
-BONOBO_TYPE_FUNC_FULL (EvolutionTestComponent, GNOME_Evolution_Component, PARENT_TYPE, evolution_test_component)
-
-static BonoboObject *
-factory (BonoboGenericFactory *factory,
- const char *component_id,
- void *closure)
-{
- if (strcmp (component_id, TEST_COMPONENT_ID) == 0) {
- BonoboObject *object = BONOBO_OBJECT (g_object_new (EVOLUTION_TEST_TYPE_COMPONENT, NULL));
- bonobo_object_ref (object);
- return object;
- }
-
- g_warning (FACTORY_ID ": Don't know what to do with %s", component_id);
-
- return NULL;
-}
-
-BONOBO_ACTIVATION_SHLIB_FACTORY (FACTORY_ID, "Evolution Calendar component factory", factory, NULL)
diff --git a/shell/test/evolution-test-component.h b/shell/test/evolution-test-component.h
deleted file mode 100644
index 18dd40c7ff..0000000000
--- a/shell/test/evolution-test-component.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _EVOLUTION_TEST_COMPONENT_H_
-#define _EVOLUTION_TEST_COMPONENT_H_
-
-#include <bonobo/bonobo-object.h>
-#include "Evolution.h"
-
-
-#define EVOLUTION_TEST_TYPE_COMPONENT (evolution_test_component_get_type ())
-#define EVOLUTION_TEST_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVOLUTION_TEST_TYPE_COMPONENT, EvolutionTestComponent))
-#define EVOLUTION_TEST_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVOLUTION_TEST_TYPE_COMPONENT, EvolutionTestComponentClass))
-#define EVOLUTION_TEST_IS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVOLUTION_TEST_TYPE_COMPONENT))
-#define EVOLUTION_TEST_IS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EVOLUTION_TEST_TYPE_COMPONENT))
-
-
-typedef struct _EvolutionTestComponent EvolutionTestComponent;
-typedef struct _EvolutionTestComponentPrivate EvolutionTestComponentPrivate;
-typedef struct _EvolutionTestComponentClass EvolutionTestComponentClass;
-
-struct _EvolutionTestComponent {
- BonoboObject parent;
-
- EvolutionTestComponentPrivate *priv;
-};
-
-struct _EvolutionTestComponentClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Component__epv epv;
-};
-
-
-GType evolution_test_component_get_type (void);
-
-#endif /* _EVOLUTION_TEST_COMPONENT_H_ */
diff --git a/smime/gui/Makefile.am b/smime/gui/Makefile.am
index 02bfd859f9..807e71ff51 100644
--- a/smime/gui/Makefile.am
+++ b/smime/gui/Makefile.am
@@ -6,6 +6,8 @@ INCLUDES = \
-I$(top_builddir)/smime/lib \
-I$(top_srcdir)/shell \
-I$(top_builddir)/shell \
+ -I$(top_srcdir)/widgets/misc \
+ -I$(top_builddir)/widgets/misc \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
@@ -33,10 +35,11 @@ libevolution_smime_la_SOURCES = \
component.h
-libevolution_smime_la_LIBADD = \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/shell/libeshell.la \
- $(top_builddir)/smime/lib/libessmime.la \
+libevolution_smime_la_LIBADD = \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/shell/libeshell.la \
+ $(top_builddir)/smime/lib/libessmime.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
$(CERT_UI_LIBS)
libevolution_smime_la_LDFLAGS = $(NO_UNDEFINED)
diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c
index c5261e879b..f697b32330 100644
--- a/smime/gui/certificate-manager.c
+++ b/smime/gui/certificate-manager.c
@@ -32,7 +32,6 @@
#include <glib/gi18n.h>
#include <glade/glade.h>
-#include "evolution-config-control.h"
#include "ca-trust-dialog.h"
#include "cert-trust-dialog.h"
#include "certificate-manager.h"
@@ -49,7 +48,9 @@
#include <pkcs11.h>
#include <pk11func.h>
-#include "e-util/e-util-private.h"
+#include <e-shell.h>
+#include <e-preferences-window.h>
+#include <e-util/e-util-private.h>
typedef struct {
GladeXML *gui;
@@ -989,13 +990,16 @@ populate_ui (CertificateManagerData *cfm)
gtk_tree_view_expand_all (GTK_TREE_VIEW (cfm->contactcerts_treeview));
}
-EvolutionConfigControl*
-certificate_manager_config_control_new (void)
+void
+certificate_manager_config_init (EShell *shell)
{
CertificateManagerData *cfm_data;
- GtkWidget *control_widget;
+ GtkWidget *preferences_window;
+ GtkWidget *widget;
char *gladefile;
+ g_return_if_fail (E_IS_SHELL (shell));
+
/* We need to peek the db here to make sure it (and NSS) are fully initialized. */
e_cert_db_peek ();
@@ -1033,14 +1037,20 @@ certificate_manager_config_control_new (void)
populate_ui (cfm_data);
- control_widget = glade_xml_get_widget (cfm_data->gui, "cert-manager-notebook");
- g_object_ref (control_widget);
+ widget = glade_xml_get_widget (cfm_data->gui, "cert-manager-notebook");
+ g_object_ref (widget);
- gtk_container_remove (GTK_CONTAINER (control_widget->parent), control_widget);
+ gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
/* FIXME: remove when implemented */
gtk_widget_set_sensitive(cfm_data->backup_your_button, FALSE);
gtk_widget_set_sensitive(cfm_data->backup_all_your_button, FALSE);
- return evolution_config_control_new (control_widget);
+ preferences_window = e_shell_get_preferences_window (shell);
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "certificates",
+ "preferences-certificates",
+ _("Certificates"),
+ widget, 700);
}
diff --git a/smime/gui/certificate-manager.h b/smime/gui/certificate-manager.h
index 73d3688859..9107e203de 100644
--- a/smime/gui/certificate-manager.h
+++ b/smime/gui/certificate-manager.h
@@ -23,8 +23,13 @@
#ifndef _CERTIFICATE_MANAGER_H_
#define _CERTIFICATE_MANAGER_H
-#include "evolution-config-control.h"
+#include <glib.h>
+#include <shell/e-shell.h>
-EvolutionConfigControl* certificate_manager_config_control_new (void);
+G_BEGIN_DECLS
+
+void certificate_manager_config_init (EShell *shell);
+
+G_END_DECLS
#endif /* _CERTIFICATE_MANAGER_H_ */
diff --git a/ui/Makefile.am b/ui/Makefile.am
index 40a5ad2d3e..ebae928dee 100644
--- a/ui/Makefile.am
+++ b/ui/Makefile.am
@@ -1,17 +1,23 @@
XML_FILES = \
evolution.xml \
- evolution-addressbook.xml \
- evolution-calendar.xml \
evolution-mail-message.xml \
evolution-mail-list.xml \
evolution-mail-global.xml \
- evolution-mail-messagedisplay.xml \
- evolution-memos.xml \
- evolution-tasks.xml
+ evolution-mail-messagedisplay.xml
-evolutionui_DATA = $(XML_FILES)
+UI_FILES = \
+ evolution-calendars.ui \
+ evolution-contacts.ui \
+ evolution-mail.ui \
+ evolution-mail-reader.ui \
+ evolution-memos.ui \
+ evolution-shell.ui \
+ evolution-tasks.ui
+
+evolutionui_DATA = $(UI_FILES) $(XML_FILES)
EXTRA_DIST = \
+ $(UI_FILES) \
$(XML_FILES) \
ChangeLog.pre-1-4
diff --git a/ui/evolution-addressbook.xml b/ui/evolution-addressbook.xml
deleted file mode 100644
index f28172e436..0000000000
--- a/ui/evolution-addressbook.xml
+++ /dev/null
@@ -1,190 +0,0 @@
-<Root>
- <commands>
-
- <cmd name="ContactDelete"
- _tip="Delete selected contacts"
- accel="*Control*d" pixtype="pixbuf"/>
-
- <cmd name="ContactsPrint"
- _tip="Print selected contacts"
- accel="*Control*p" pixtype="pixbuf"/>
-
- <cmd name="ContactsPrintPreview"
- _tip="Previews the contacts to be printed"
- pixtype="pixbuf"/>
-
- <cmd name="ContactsView"
- _tip="View the current contact"
- accel="*Control*o"/>
-
- <cmd name="ContactStop"
- _tip="Stop Loading"
- pixtype="stock" pixname="gtk-stop"/>
-
- <cmd name="ContactsCut" _label="Cut"
- _tip="Cut the selection"
- accel="*Control*x" pixtype="pixbuf"/>
-
- <cmd name="ContactsCopy" _label="Copy"
- _tip="Copy the selection"
- accel="*Control*c" pixtype="pixbuf"/>
-
- <cmd name="ContactsPaste" _label="Paste"
- _tip="Paste the clipboard"
- accel="*Control*v" pixtype="pixbuf"/>
-
- <cmd name="ContactsSelectAll" _label="Select All"
- _tip="Select all contacts" accel="*Control*a"
- pixtype="stock" pixname="gtk-select-all"/>
-
- <cmd name="ContactsSaveAsVCard" _label="Save as VCard..."
- _tip="Save selected contacts as a VCard"
- accel="*Control*s" pixtype="pixbuf"/>
-
- <cmd name="ContactsSendContactToOther" _label="Forward Contact"
- _tip="Send selected contacts to another person"
- pixtype="pixbuf"/>
-
- <cmd name="ContactsSendMessageToContact" _label="Send message to contact"
- _tip="Send a message to the selected contacts"
- pixtype="pixbuf"/>
-
- <cmd name="ContactsCopyToFolder" _label="Copy to Folder..."
- _tip="Copy selected contacts to another folder"
- accel="*Control**Shift*y"/>
-
- <cmd name="ContactsMoveToFolder" _label="Move to Folder..."
- _tip="Move selected contacts to another folder"
- accel="*Control**Shift*v"/>
-
- <cmd name="ContactsViewPreview" _label="Contact _Preview"
- _tip="Show contact preview window"
- accel="*Control*m"
- type="toggle"/>
-
- <cmd name="FolderCreate" _label="_New"
- _tip="Create a new address book folder"
- pixtype="pixbuf"/>
-
- <cmd name="FolderCopy" _label="_Copy Folder Contacts To"
- _tip="Copy the contacts of the selected folder into another folder"
- pixtype="pixbuf"/>
-
- <cmd name="FolderMove" _label="_Move Folder Contacts To"
- _tip="Move the contacts of the selected folder into another folder"
- pixtype="pixbuf"/>
-
- <cmd name="FolderSave" _label="_Save Folder Contacts As VCard"
- _tip="Save the contacts of the selected folder as VCard"
- pixtype="pixbuf"/>
-
- <cmd name="FolderDelete" _label="_Delete"
- _tip="Delete the selected folder"
- pixtype="pixbuf"/>
-
- <cmd name="FolderRename" _label="_Rename"
- _tip="Rename the selected folder"
- pixtype="pixbuf"
- accel="F2"/>
-
- <cmd name="ChangeFolderProperties" _label="_Properties"
- _tip="Change the properties of the selected folder"
- pixtype="pixbuf"/>
-
- </commands>
-
- <menu>
- <submenu name="File">
- <placeholder name="FileOps">
- <menuitem name="ContactsView"
- verb="" _label="_Open"/>
- <menuitem name="ContactsSaveAsVCard"
- verb="" _label="_Save Contact as VCard..."/>
- <menuitem name="FolderSave"
- verb="" _label="S_ave Address Book As VCard"/>
- </placeholder>
-
- <placeholder name="Print">
- <menuitem name="ContactsPrintPreview" verb="" _label="Print Pre_view"/>
- <menuitem name="ContactsPrint" verb="" _label="_Print..."/>
- </placeholder>
-
- </submenu>
-
- <submenu name="View" _label="_View">
- <menuitem name="ContactsViewPreview" verb="" _label="Contact _Preview"/>
- </submenu>
-
- <submenu name="Edit" _label="_Edit">
- <placeholder name="EditPlaceholder">
- <menuitem name="ContactsSelectAll" verb="" _label="Select _All"/>
-
- <separator f="" name="eadbk2"/>
-
- <menuitem name="ContactsCut" verb="" _label="C_ut"/>
-
- <menuitem name="ContactsCopy" verb="" _label="_Copy"/>
-
- <menuitem name="ContactsPaste" verb="" _label="_Paste"/>
-
- <separator f="" name="eadbk6"/>
-
- <menuitem name="ContactDelete" verb="" _label="_Delete Contact"/>
-
- <menuitem name="FolderDelete" verb="" _label="Del_ete Address Book"/>
- </placeholder>
- </submenu>
-
- <placeholder name="FolderPlaceholder">
- </placeholder>
-
- <placeholder name="ActionsPlaceholder">
- <submenu name="Actions" _label="_Actions">
- <menuitem name="ContactsSendContactToOther"
- _label="_Forward Contact..." verb=""/>
-
- <menuitem name="ContactsSendMessageToContact"
- _label="_Send Message to Contact..." verb=""/>
- <menuitem name="ContactActionStop" verb="ContactStop" _label="St_op"/>
-
- <separator f="" name="eadbk5"/>
-
- <menuitem name="ContactsCopyToFolder" _label="_Copy Contact to..." verb=""/>
- <menuitem name="ContactsMoveToFolder" _label="_Move Contact to..." verb=""/>
-
- <separator f="" name="eadbk4"/>
-
- <menuitem name="FolderCopy" verb="" _label="Co_py All Contacts To..."/>
-
- <menuitem name="FolderMove" verb="" _label="Mo_ve All Contacts To..."/>
-
- <separator f="" name="eadbk3"/>
-
- <menuitem name="ChangeFolderProperties" verb="" _label="Address _Book Properties"/>
-
- </submenu>
- </placeholder>
-
- </menu>
-
- <dockitem name="Toolbar">
- <toolitem name="ContactsPrint" verb=""
- _label="Print" pixtype="pixbuf"/>
-
- <toolitem name="ContactDelete" verb=""
- _label="Delete" pixtype="pixbuf"/>
-
- <toolitem name="ContactStop" verb=""
- _label="Stop"/>
-
- </dockitem>
-
- <keybindings>
- <accel name="Delete" verb="ContactDelete"/>
- <accel name="BackSpace" verb="ContactDelete"/>
- <accel name="F16" verb="ContactsCopy"/>
- <accel name="F18" verb="ContactsPaste"/>
- <accel name="F20" verb="ContactsCut"/>
- </keybindings>
-
-</Root>
diff --git a/ui/evolution-calendar.xml b/ui/evolution-calendar.xml
deleted file mode 100644
index 36aa0df0ef..0000000000
--- a/ui/evolution-calendar.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<Root>
- <commands>
- <cmd name="EventOpen" _tip="View the current appointment" accel="*Control*o"/>
- <cmd name="CalendarPrint" _tip="Print this calendar" pixtype="pixbuf"
- accel="*Control*p"/>
- <cmd name="CalendarPrintPreview" _tip="Previews the calendar to be printed" pixtype="pixbuf"/>
-
- <cmd name="CalendarPrev" _tip="Go back" pixtype="pixbuf"/>
- <cmd name="CalendarToday" _tip="Select today" pixtype="pixbuf"/>
- <cmd name="CalendarNext" _tip="Go forward" pixtype="pixbuf"/>
- <cmd name="CalendarGoto" _tip="Select a specific date" pixtype="pixbuf"/>
-
- <cmd name="ShowDayView" _tip="Show one day" pixtype="pixbuf"/>
- <cmd name="ShowWorkWeekView" _tip="Show the working week" pixtype="pixbuf"/>
- <cmd name="ShowWeekView" _tip="Show one week" pixtype="pixbuf"/>
- <cmd name="ShowMonthView" _tip="Show one month" pixtype="pixbuf"/>
- <cmd name="ShowListView" _tip="Show as list" pixtype="pixbuf"/>
-
- <cmd name="Cut" _tip="Cut the selection" accel="*Control*x" pixtype="pixbuf"/>
- <cmd name="Copy" _tip="Copy the selection" accel="*Control*c" pixtype="pixbuf"/>
- <cmd name="Paste" _tip="Paste the clipboard" accel="*Control*v" pixtype="pixbuf"/>
-
- <cmd name="Delete" _tip="Delete the appointment" accel="*Control*d" pixtype="pixbuf"/>
- <cmd name="DeleteOccurrence" _tip="Delete this occurrence" pixtype="pixbuf"/>
- <cmd name="DeleteAllOccurrences" _tip="Delete all occurrences" pixtype="pixbuf"/>
-
- <cmd name="CalendarPurge" _label="Purg_e" _tip="Purge old appointments and meetings" accel="*Control*e"/>
- <cmd name="HelpDebug" _tip="View the debug console for log messages"/>
- </commands>
-
- <menu>
- <submenu name="File">
- <placeholder name="FileOps">
- <menuitem name="EventOpen" verb="EventOpen" _label="_Open Appointment"/>
- </placeholder>
- <placeholder name="Print">
- <menuitem name="PrintPreview" verb="CalendarPrintPreview"
- _label="Print Pre_view"/>
-
- <menuitem name="Print" verb="CalendarPrint" accel="*Control*p"
- _label="_Print..."/>
- </placeholder>
-
- </submenu>
-
- <submenu name="Edit" _label="_Edit">
- <placeholder name="EditPlaceholder">
- <menuitem name="Cut" verb="" _label="C_ut"/>
- <menuitem name="Copy" verb="" _label="_Copy"/>
- <menuitem name="Paste" verb="" _label="_Paste"/>
-
- <separator/>
-
- <menuitem name="Delete" verb="" _label="_Delete"/>
- <menuitem name="DeleteOccurrence" verb="" _label="Delete this _Occurrence"/>
- <menuitem name="DeleteAllOccurrences" verb="" _label="Delete _all Occurrences"/>
- </placeholder>
- </submenu>
-
- <submenu name="View">
- <placeholder name="ViewBegin">
- <menuitem name="Today" verb="CalendarToday" _label="Select _Today"
- accel="*Control*t"/>
- <menuitem name="Goto" verb="CalendarGoto" _label="Select _Date" accel="*Control*g"/>
- <separator f="" name="ecal"/>
- </placeholder>
-
- </submenu>
-
- <placeholder name="ActionsPlaceholder">
- <submenu name="Actions" _label="_Actions">
- <menuitem name="CalendarPurge" verb=""/>
- </submenu>
- </placeholder>
- <submenu name="Help" _label="_Help">
- <placeholder name="PlaceHolderDebug">
- <menuitem name="HelpDebug" verb="" _label="_Debug Logs"/>
- </placeholder>
- </submenu>
- </menu>
-
- <dockitem name="Toolbar">
-
- <toolitem name="Print" verb="CalendarPrint" _label="Print" pixtype="pixbuf"/>
- <toolitem name="Delete" verb="" _label="Delete" pixtype="pixbuf"/>
-
- <separator f="" name="ecal2"/>
-
- <toolitem name="Prev" verb="CalendarPrev" _label="Previous" pixtype="pixbuf"/>
- <toolitem name="Today" verb="CalendarToday" _label="Today" pixtype="pixbuf"/>
- <toolitem name="Next" verb="CalendarNext" _label="Next" pixtype="pixbuf"/>
-
- <separator f="" name="ecal3"/>
-
- <toolitem name="Goto" verb="CalendarGoto" _label="Go To" priority="1" pixtype="pixbuf"/>
-
- <separator f="" name="ecal4"/>
-
- <toolitem name="DayView" verb="ShowDayView" _label="Day" priority="1" pixtype="pixbuf"/>
- <toolitem name="WorkWeekView" verb="ShowWorkWeekView" _label="Work Week" priority="1" pixtype="pixbuf"/>
- <toolitem name="WeekView" verb="ShowWeekView" _label="Week" priority="1" pixtype="pixbuf"/>
- <toolitem name="MonthView" verb="ShowMonthView" _label="Month" priority="1" pixtype="pixbuf"/>
- <toolitem name="ListView" verb="ShowListView" _label="List" priority="1" pixtype="pixbuf"/>
-
- </dockitem>
-
-</Root>
diff --git a/ui/evolution-calendars.ui b/ui/evolution-calendars.ui
new file mode 100644
index 0000000000..59900ea05f
--- /dev/null
+++ b/ui/evolution-calendars.ui
@@ -0,0 +1,136 @@
+<ui>
+ <menubar name='main-menu'>
+ <menu action='file-menu'>
+ <placeholder name='file-actions'>
+ <menuitem action='event-open'/>
+ </placeholder>
+ <placeholder name='print-actions'>
+ <menuitem action='calendar-print-preview'/>
+ <menuitem action='calendar-print'/>
+ </placeholder>
+ </menu>
+ <menu action='edit-menu'>
+ <placeholder name='edit-actions'>
+ <menuitem action='event-clipboard-cut'/>
+ <menuitem action='event-clipboard-copy'/>
+ <menuitem action='event-clipboard-paste'/>
+ <separator/>
+ <menuitem action='event-delete'/>
+ <menuitem action='event-delete-occurrence'/>
+ <menuitem action='event-delete-occurrence-all'/>
+ </placeholder>
+ </menu>
+ <menu action='view-menu'>
+ <menuitem action='calendar-go-today'/>
+ <menuitem action='calendar-jump-to'/>
+ </menu>
+ <placeholder name='custom-menus'>
+ <menu action='calendar-actions-menu'>
+ <menuitem action='calendar-purge'/>
+ </menu>
+ </placeholder>
+ </menubar>
+ <toolbar name='main-toolbar'>
+ <toolitem action='calendar-print'/>
+ <toolitem action='event-delete'/>
+ <separator/>
+ <toolitem action='calendar-go-back'/>
+ <toolitem action='calendar-go-today'/>
+ <toolitem action='calendar-go-forward'/>
+ <separator/>
+ <toolitem action='calendar-jump-to'/>
+ <separator/>
+ <toolitem action='calendar-view-day'/>
+ <toolitem action='calendar-view-workweek'/>
+ <toolitem action='calendar-view-week'/>
+ <toolitem action='calendar-view-month'/>
+ <toolitem action='calendar-view-list'/>
+ </toolbar>
+ <popup name='calendar-popup'>
+ <menuitem action='calendar-new'/>
+ <menuitem action='calendar-popup-copy'/>
+ <menuitem action='calendar-popup-rename'/>
+ <separator/>
+ <menuitem action='calendar-popup-delete'/>
+ <menuitem action='calendar-popup-select-one'/>
+ <separator/>
+ <menuitem action='calendar-popup-properties'/>
+ </popup>
+ <popup name='calendar-empty-popup'>
+ <menuitem action='event-new'/>
+ <menuitem action='event-all-day-new'/>
+ <menuitem action='event-meeting-new'/>
+ <separator/>
+ <menuitem action='event-popup-print'/>
+ <separator/>
+ <menuitem action='event-popup-clipboard-paste'/>
+ <separator/>
+ <menuitem action='gal-view-menu'/>
+ <menuitem action='calendar-popup-go-today'/>
+ <menuitem action='calendar-popup-jump-to'/>
+ </popup>
+ <popup name='calendar-event-popup'>
+ <menuitem action='event-popup-open'/>
+ <menuitem action='event-popup-save-as'/>
+ <menuitem action='event-popup-print'/>
+ <separator/>
+ <menuitem action='event-popup-clipboard-cut'/>
+ <menuitem action='event-popup-clipboard-copy'/>
+ <menuitem action='event-popup-clipboard-paste'/>
+ <separator/>
+ <menuitem action='event-popup-copy'/>
+ <menuitem action='event-popup-move'/>
+ <menuitem action='event-popup-delegate'/>
+ <menuitem action='event-popup-schedule'/>
+ <menuitem action='event-popup-forward'/>
+ <menuitem action='event-popup-reply'/>
+ <menuitem action='event-popup-reply-all'/>
+ <separator/>
+ <menuitem action='event-popup-occurrence-movable'/>
+ <menuitem action='event-popup-delete'/>
+ <menuitem action='event-popup-delete-occurrence'/>
+ <menuitem action='event-popup-delete-occurrence-all'/>
+ </popup>
+ <popup name='calendar-memopad-popup'>
+ <menuitem action='calendar-memopad-new'/>
+ <separator/>
+ <menuitem action='calendar-memopad-open'/>
+ <menuitem action='calendar-memopad-open-url'/>
+ <menuitem action='calendar-memopad-save-as'/>
+ <menuitem action='calendar-memopad-print'/>
+ <separator/>
+ <menuitem action='calendar-memopad-clipboard-cut'/>
+ <menuitem action='calendar-memopad-clipboard-copy'/>
+ <menuitem action='calendar-memopad-clipboard-paste'/>
+ <separator/>
+ <menuitem action='calendar-memopad-forward'/>
+ <separator/>
+ <menuitem action='calendar-memopad-delete'/>
+ </popup>
+ <popup name='calendar-taskpad-popup'>
+ <menuitem action='calendar-taskpad-new'/>
+ <separator/>
+ <menuitem action='calendar-taskpad-open'/>
+ <menuitem action='calendar-taskpad-open-url'/>
+ <menuitem action='calendar-taskpad-save-as'/>
+ <menuitem action='calendar-taskpad-print'/>
+ <separator/>
+ <menuitem action='calendar-taskpad-clipboard-cut'/>
+ <menuitem action='calendar-taskpad-clipboard-copy'/>
+ <menuitem action='calendar-taskpad-clipboard-paste'/>
+ <separator/>
+ <menuitem action='calendar-taskpad-assign'/>
+ <menuitem action='calendar-taskpad-forward'/>
+ <menuitem action='calendar-taskpad-mark-complete'/>
+ <menuitem action='calendar-taskpad-mark-incomplete'/>
+ <separator/>
+ <menuitem action='calendar-taskpad-delete'/>
+ </popup>
+ <popup name='calendar-search-options'>
+ <menuitem action='calendar-search-summary-contains'/>
+ <menuitem action='calendar-search-description-contains'/>
+ <menuitem action='calendar-search-any-field-contains'/>
+ <separator/>
+ <menuitem action='search-advanced'/>
+ </popup>
+</ui>
diff --git a/ui/evolution-contacts.ui b/ui/evolution-contacts.ui
new file mode 100644
index 0000000000..6d42ee0ae2
--- /dev/null
+++ b/ui/evolution-contacts.ui
@@ -0,0 +1,85 @@
+<ui>
+ <menubar name='main-menu'>
+ <menu action='file-menu'>
+ <placeholder name='file-actions'>
+ <menuitem action='contact-open'/>
+ <menuitem action='contact-save-as'/>
+ <menuitem action='address-book-save-as'/>
+ </placeholder>
+ <placeholder name='print-actions'>
+ <menuitem action='contact-print-preview'/>
+ <menuitem action='contact-print'/>
+ </placeholder>
+ </menu>
+ <menu action='edit-menu'>
+ <placeholder name='edit-actions'>
+ <menuitem action='contact-select-all'/>
+ <separator/>
+ <menuitem action='contact-clipboard-cut'/>
+ <menuitem action='contact-clipboard-copy'/>
+ <menuitem action='contact-clipboard-paste'/>
+ <separator/>
+ <menuitem action='contact-delete'/>
+ <menuitem action='address-book-delete'/>
+ </placeholder>
+ </menu>
+ <menu action='view-menu'>
+ <menuitem action='contact-preview'/>
+ </menu>
+ <placeholder name='custom-menus'>
+ <menu action='actions-menu'>
+ <menuitem action='contact-forward'/>
+ <menuitem action='contact-send-message'/>
+ <menuitem action='address-book-stop'/>
+ <separator/>
+ <menuitem action='contact-copy'/>
+ <menuitem action='contact-move'/>
+ <separator/>
+ <menuitem action='address-book-copy'/>
+ <menuitem action='address-book-move'/>
+ <separator/>
+ <menuitem action='address-book-properties'/>
+ </menu>
+ </placeholder>
+ </menubar>
+ <toolbar name='main-toolbar'>
+ <toolitem action='contact-print'/>
+ <toolitem action='contact-delete'/>
+ <toolitem action='address-book-stop'/>
+ </toolbar>
+ <popup name='address-book-popup'>
+ <menuitem action='address-book-new'/>
+ <menuitem action='address-book-popup-rename'/>
+ <menuitem action='address-book-popup-save-as'/>
+ <separator/>
+ <menuitem action='address-book-popup-delete'/>
+ <separator/>
+ <menuitem action='address-book-popup-properties'/>
+ </popup>
+ <popup name='contact-popup'>
+ <menuitem action='contact-popup-open'/>
+ <separator/>
+ <menuitem action='contact-new'/>
+ <menuitem action='contact-new-list'/>
+ <separator/>
+ <menuitem action='contact-popup-save-as'/>
+ <menuitem action='contact-popup-forward'/>
+ <menuitem action='contact-popup-send-message'/>
+ <menuitem action='contact-popup-print'/>
+ <separator/>
+ <menuitem action='contact-popup-copy'/>
+ <menuitem action='contact-popup-move'/>
+ <separator/>
+ <menuitem action='contact-popup-clipboard-cut'/>
+ <menuitem action='contact-popup-clipboard-copy'/>
+ <menuitem action='contact-popup-clipboard-paste'/>
+ <menuitem action='contact-popup-delete'/>
+ </popup>
+ <popup name='contact-search-options'>
+ <menuitem action='contact-search-name-contains'/>
+ <menuitem action='contact-search-email-begins-with'/>
+ <menuitem action='contact-search-any-field-contains'/>
+ <separator/>
+ <menuitem action='search-advanced'/>
+ </popup>
+</ui>
diff --git a/ui/evolution-mail-reader.ui b/ui/evolution-mail-reader.ui
new file mode 100644
index 0000000000..4aaca319ec
--- /dev/null
+++ b/ui/evolution-mail-reader.ui
@@ -0,0 +1,144 @@
+<ui>
+ <menubar name='main-menu'>
+ <menu action='file-menu'>
+ <placeholder name='file-actions'>
+ <menuitem action='mail-save-as'/>
+ </placeholder>
+ <placeholder name='print-actions'>
+ <menuitem action='mail-print-preview'/>
+ <menuitem action='mail-print'/>
+ </placeholder>
+ </menu>
+ <menu action='edit-menu'>
+ <placeholder name='edit-actions'>
+ <menuitem action='mail-clipboard-copy'/>
+ <separator/>
+ <menuitem action='mail-select-all'/>
+ <separator/>
+ <menuitem action='mail-delete'/>
+ <menuitem action='mail-undelete'/>
+ <separator/>
+ <menuitem action='mail-find'/>
+ </placeholder>
+ </menu>
+ <menu action='view-menu'>
+ <separator/>
+ <placeholder name='mail-message-list-actions'/>
+ <separator/>
+ <placeholder name='mail-message-view-actions'>
+ <menuitem action='mail-load-images'/>
+ <menuitem action='mail-show-all-headers'/>
+ <menuitem action='mail-caret-mode'/>
+ <menuitem action='mail-show-source'/>
+ <menu action='mail-zoom-menu'>
+ <menuitem action='mail-zoom-in'/>
+ <menuitem action='mail-zoom-out'/>
+ <menuitem action='mail-zoom-100'/>
+ </menu>
+ <separator/>
+ <menu action='mail-encoding-menu'>
+ <menuitem action='mail-charset-default'/>
+ <separator/>
+ </menu>
+ </placeholder>
+ </menu>
+ <placeholder name='custom-menus'>
+ <menu action='mail-message-menu'>
+ <menuitem action='mail-message-new'/>
+ <menuitem action='mail-message-open'/>
+ <menuitem action='mail-message-edit'/>
+ <menuitem action='mail-add-sender'/>
+ <separator/>
+ <menu action='mail-goto-menu'>
+ <menuitem action='mail-next'/>
+ <menuitem action='mail-next-unread'/>
+ <menuitem action='mail-next-important'/>
+ <menuitem action='mail-next-thread'/>
+ <separator/>
+ <menuitem action='mail-previous'/>
+ <menuitem action='mail-previous-unread'/>
+ <menuitem action='mail-previous-important'/>
+ </menu>
+ <menuitem action='mail-reply-sender'/>
+ <menuitem action='mail-reply-list'/>
+ <menuitem action='mail-reply-all'/>
+ <menuitem action='mail-forward'/>
+ <menu action='mail-forward-as-menu'>
+ <menuitem action='mail-forward-attached'/>
+ <menuitem action='mail-forward-inline'/>
+ <menuitem action='mail-forward-quoted'/>
+ <separator/>
+ <menuitem action='mail-redirect'/>
+ </menu>
+ <separator/>
+ <menuitem action='mail-copy'/>
+ <menuitem action='mail-move'/>
+ <separator/>
+ <menu action='mail-mark-as-menu'>
+ <menuitem action="mail-mark-read"/>
+ <menuitem action="mail-mark-unread"/>
+ <separator/>
+ <menuitem action="mail-mark-important"/>
+ <menuitem action="mail-mark-unimportant"/>
+ <separator/>
+ <menuitem action="mail-mark-junk"/>
+ <menuitem action="mail-mark-notjunk"/>
+ <separator/>
+ <menuitem action="mail-flag-for-followup"/>
+ <menuitem action="mail-flag-clear"/>
+ <menuitem action="mail-flag-completed"/>
+ </menu>
+ <menuitem action='mail-filters-apply'/>
+ <menuitem action='mail-check-for-junk'/>
+ <separator/>
+ <menu action='mail-create-rule-menu'>
+ <menuitem action='mail-filter-on-subject'/>
+ <menuitem action='mail-filter-on-sender'/>
+ <menuitem action='mail-filter-on-recipients'/>
+ <menuitem action='mail-filter-on-mailing-list'/>
+ <separator/>
+ <menuitem action='mail-search-folder-from-subject'/>
+ <menuitem action='mail-search-folder-from-sender'/>
+ <menuitem action='mail-search-folder-from-recipients'/>
+ <menuitem action='mail-search-folder-from-mailing-list'/>
+ </menu>
+ </menu>
+ </placeholder>
+ </menubar>
+ <toolbar name='main-toolbar'>
+ <placeholder name='mail-toolbar-common'>
+ <toolitem action='mail-reply-sender'/>
+ <toolitem action='mail-reply-all'/>
+ <toolitem action='mail-forward'/>
+ <separator/>
+ <toolitem action='mail-print'/>
+ <toolitem action='mail-delete'/>
+ <toolitem action='mail-mark-junk'/>
+ <toolitem action='mail-mark-notjunk'/>
+ </placeholder>
+ <separator/>
+ <placeholder name='mail-toolbar-navigation'>
+ <toolitem action='mail-previous'/>
+ <toolitem action='mail-next'/>
+ </placeholder>
+ </toolbar>
+ <popup name='mail-message-popup'>
+ <placeholder name='mail-message-popup-common-actions'>
+ <menuitem action='mail-popup-reply-sender'/>
+ <menuitem action='mail-popup-reply-all'/>
+ <menuitem action='mail-popup-forward'/>
+ <separator/>
+ <menuitem action='mail-popup-message-edit'/>
+ <menuitem action='mail-popup-save-as'/>
+ <menuitem action='mail-popup-print'/>
+ </placeholder>
+ </popup>
+ <popup name='mail-uri-popup'>
+ <menuitem action='mail-uri-copy'/>
+ <menuitem action='mail-uri-copy-address'/>
+ <menu action='mail-uri-to-search-folder-menu'>
+ <menuitem action='mail-uri-to-search-folder-sender'/>
+ <menuitem action='mail-uri-to-search-folder-recipient'/>
+ </menu>
+ </popup>
+</ui>
diff --git a/ui/evolution-mail.ui b/ui/evolution-mail.ui
new file mode 100644
index 0000000000..c381e6a046
--- /dev/null
+++ b/ui/evolution-mail.ui
@@ -0,0 +1,120 @@
+<ui>
+ <menubar name='main-menu'>
+ <menu action='file-menu'>
+ <placeholder name='long-running-actions'>
+ <menuitem action='mail-empty-trash'/>
+ <menuitem action='mail-download'/>
+ </placeholder>
+ </menu>
+ <menu action='edit-menu'>
+ <placeholder name='administrative-actions'>
+ <menuitem action='mail-tools-filters'/>
+ <menuitem action='mail-tools-search-folders'/>
+ </placeholder>
+ </menu>
+ <menu action='view-menu'>
+ <placeholder name='view-custom-menus'>
+ <menu action='mail-preview-menu'>
+ <menuitem action='mail-preview'/>
+ <separator/>
+ <menuitem action='mail-view-classic'/>
+ <menuitem action='mail-view-vertical'/>
+ </menu>
+ </placeholder>
+ <separator/>
+ <placeholder name='mail-message-list-actions'>
+ <menuitem action='mail-threads-group-by'/>
+ <menuitem action='mail-threads-expand-all'/>
+ <menuitem action='mail-threads-collapse-all'/>
+ <separator/>
+ <menuitem action='mail-hide-deleted'/>
+ <menuitem action='mail-hide-selected'/>
+ <menuitem action='mail-hide-read'/>
+ <menuitem action='mail-show-hidden'/>
+ </placeholder>
+ </menu>
+ <placeholder name='custom-menus'>
+ <menu action='mail-folder-menu'>
+ <menuitem action='mail-folder-new'/>
+ <menuitem action='mail-tools-subscriptions'/>
+ <separator/>
+ <menuitem action='mail-folder-copy'/>
+ <menuitem action='mail-folder-move'/>
+ <separator/>
+ <menuitem action='mail-folder-select-all'/>
+ <menuitem action='mail-folder-select-thread'/>
+ <menuitem action='mail-folder-select-subthread'/>
+ <menuitem action='mail-folder-mark-all-as-read'/>
+ <menuitem action='mail-folder-expunge'/>
+ <separator/>
+ <menuitem action='mail-folder-rename'/>
+ <menuitem action='mail-folder-refresh'/>
+ <menuitem action='mail-folder-delete'/>
+ <separator/>
+ <menuitem action='mail-folder-properties'/>
+ </menu>
+ <menu action='mail-message-menu'/>
+ </placeholder>
+ <menu action='search-menu'>
+ <placeholder name='search-actions'>
+ <menuitem action='mail-create-search-folder'/>
+ </placeholder>
+ </menu>
+ </menubar>
+ <toolbar name='main-toolbar'>
+ <placeholder name='mail-toolbar-common'/>
+ <toolitem action='mail-stop'/>
+ <separator/>
+ <placeholder name='mail-toolbar-navigation'/>
+ </toolbar>
+ <popup name='mail-folder-popup'>
+ <menuitem action='mail-popup-folder-new'/>
+ <menuitem action='mail-popup-folder-copy'/>
+ <menuitem action='mail-popup-folder-move'/>
+ <separator/>
+ <menuitem action='mail-popup-folder-delete'/>
+ <separator/>
+ <placeholder name='mail-folder-popup-actions'/>
+ <menuitem action='mail-popup-folder-rename'/>
+ <menuitem action='mail-popup-folder-refresh'/>
+ <menuitem action='mail-popup-flush-outbox'/>
+ <menuitem action='mail-popup-empty-trash'/>
+ <menuitem action='mail-popup-account-disable'/>
+ <separator/>
+ <menuitem action='mail-popup-folder-properties'/>
+ </popup>
+ <popup name='mail-message-popup'>
+ <placeholder name='mail-message-popup-common-actions'/>
+ <separator/>
+ <menuitem action='mail-popup-delete'/>
+ <menuitem action='mail-popup-undelete'/>
+ <menuitem action='mail-popup-copy'/>
+ <menuitem action='mail-popup-move'/>
+ <separator/>
+ <menuitem action='mail-popup-mark-read'/>
+ <menuitem action='mail-popup-mark-unread'/>
+ <menuitem action='mail-popup-mark-important'/>
+ <menuitem action='mail-popup-mark-unimportant'/>
+ <menuitem action='mail-popup-mark-junk'/>
+ <menuitem action='mail-popup-mark-notjunk'/>
+ <menuitem action='mail-popup-flag-for-followup'/>
+ <menu action='mail-label-menu'>
+ <menuitem action='mail-label-none'/>
+ <separator/>
+ <placeholder name='mail-label-actions'/>
+ <separator/>
+ <menuitem action='mail-label-new'/>
+ </menu>
+ </popup>
+ <popup name='mail-search-options'>
+ <menuitem action='mail-search-subject-or-sender-contains'/>
+ <menuitem action='mail-search-subject-or-recipients-contains'/>
+ <menuitem action='mail-search-recipients-contain'/>
+ <menuitem action='mail-search-message-contains'/>
+ <menuitem action='mail-search-subject-contains'/>
+ <menuitem action='mail-search-sender-contains'/>
+ <menuitem action='mail-search-body-contains'/>
+ <separator/>
+ <menuitem action='search-advanced'/>
+ </popup>
+</ui>
diff --git a/ui/evolution-memos.ui b/ui/evolution-memos.ui
new file mode 100644
index 0000000000..28abc7e997
--- /dev/null
+++ b/ui/evolution-memos.ui
@@ -0,0 +1,68 @@
+<ui>
+ <menubar name='main-menu'>
+ <menu action='file-menu'>
+ <placeholder name='file-actions'>
+ <menuitem action='memo-open'/>
+ </placeholder>
+ <placeholder name='print-actions'>
+ <menuitem action='memo-list-print-preview'/>
+ <menuitem action='memo-list-print'/>
+ </placeholder>
+ </menu>
+ <menu action='edit-menu'>
+ <placeholder name='edit-actions'>
+ <menuitem action='memo-clipboard-cut'/>
+ <menuitem action='memo-clipboard-copy'/>
+ <menuitem action='memo-clipboard-paste'/>
+ <separator/>
+ <menuitem action='memo-delete'/>
+ </placeholder>
+ </menu>
+ <menu action='view-menu'>
+ <menuitem action='memo-preview'/>
+ </menu>
+ </menubar>
+ <toolbar name='main-toolbar'>
+ <placeholder name='toolbar-actions'>
+ <toolitem action='memo-clipboard-cut'/>
+ <toolitem action='memo-clipboard-copy'/>
+ <toolitem action='memo-clipboard-paste'/>
+ <separator/>
+ <toolitem action='memo-list-print'/>
+ <toolitem action='memo-delete'/>
+ </placeholder>
+ </toolbar>
+ <popup name='memo-popup'>
+ <menuitem action='memo-new'/>
+ <separator/>
+ <menuitem action='memo-popup-open'/>
+ <menuitem action='memo-popup-open-url'/>
+ <menuitem action='memo-popup-save-as'/>
+ <menuitem action='memo-popup-print'/>
+ <separator/>
+ <menuitem action='memo-popup-clipboard-cut'/>
+ <menuitem action='memo-popup-clipboard-copy'/>
+ <menuitem action='memo-popup-clipboard-paste'/>
+ <separator/>
+ <menuitem action='memo-popup-forward'/>
+ <separator/>
+ <menuitem action='memo-popup-delete'/>
+ </popup>
+ <popup name='memo-list-popup'>
+ <menuitem action='memo-list-new'/>
+ <menuitem action='memo-list-popup-copy'/>
+ <menuitem action='memo-list-popup-rename'/>
+ <separator/>
+ <menuitem action='memo-list-popup-delete'/>
+ <menuitem action='memo-list-popup-select-one'/>
+ <separator/>
+ <menuitem action='memo-list-popup-properties'/>
+ </popup>
+ <popup name='memo-search-options'>
+ <menuitem action='memo-search-summary-contains'/>
+ <menuitem action='memo-search-description-contains'/>
+ <menuitem action='memo-search-any-field-contains'/>
+ <separator/>
+ <menuitem action='search-advanced'/>
+ </popup>
+</ui>
diff --git a/ui/evolution-memos.xml b/ui/evolution-memos.xml
deleted file mode 100644
index 9a132d2add..0000000000
--- a/ui/evolution-memos.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<Root>
- <commands>
- <cmd name="MemosOpenMemo" _tip="View the selected memo" accel="*Control*o"/>
- <cmd name="MemosPrint" _tip="Print the list of memos" pixtype="pixbuf"
- accel="*Control*p"/>
- <cmd name="MemosPrintPreview" _tip="Previews the list of memos to be printed" pixtype="pixbuf"/>
-
- <cmd name="MemosCut" _tip="Cut selected memo" accel="*Control*x" pixtype="pixbuf"/>
- <cmd name="MemosCopy" _tip="Copy selected memo" accel="*Control*c" pixtype="pixbuf"/>
- <cmd name="MemosPaste" _tip="Paste memo from the clipboard" accel="*Control*v" pixtype="pixbuf"/>
- <cmd name="MemosDelete" _tip="Delete selected memos" accel="*Control*d" sensitive="0"
- pixtype="pixbuf"/>
-
- </commands>
-
- <menu>
- <submenu name="File">
- <placeholder name="FileOps">
- <menuitem name="OpenMemo" verb="MemosOpenMemo" _label="_Open Memo"/>
- </placeholder>
- <placeholder name="Print">
- <menuitem name="PrintPreview" verb="MemosPrintPreview" _label="Print Pre_view"/>
-
- <menuitem name="Print" verb="MemosPrint" accel="*Control*p" _label="_Print..."/>
- </placeholder>
-
- </submenu>
-
- <submenu name="Edit" _label="_Edit">
- <placeholder name="EditPlaceholder">
- <menuitem name="MemosCut" verb="" _label="C_ut"/>
- <menuitem name="MemosCopy" verb="" _label="_Copy"/>
- <menuitem name="MemosPaste" verb="" _label="_Paste"/>
-
- <separator/>
-
- <menuitem name="MemosDelete" verb="" _label="_Delete"/>
- </placeholder>
- </submenu>
-
- </menu>
-
- <dockitem name="Toolbar">
- <toolitem name="Cut" _label="Cut" verb="MemosCut" pixtype="pixbuf"/>
- <toolitem name="Copy" _label="Copy" verb="MemosCopy" pixtype="pixbuf"/>
- <toolitem name="Paste" _label="Paste" verb="MemosPaste" pixtype="pixbuf"/>
-
- <separator/>
-
- <toolitem name="Print" _label="Print" verb="MemosPrint" pixtype="pixbuf"/>
-
- <toolitem name="Delete" _label="Delete" verb="MemosDelete" pixtype="pixbuf"/>
-
- </dockitem>
-
-</Root>
diff --git a/ui/evolution-shell.ui b/ui/evolution-shell.ui
new file mode 100644
index 0000000000..7a89e11adc
--- /dev/null
+++ b/ui/evolution-shell.ui
@@ -0,0 +1,82 @@
+<ui>
+ <menubar name='main-menu'>
+ <menu action='file-menu'>
+ <menu action='new-menu'/>
+ <menuitem action='new-window'/>
+ <separator/>
+ <menuitem action='send-receive'/>
+ <placeholder name='file-actions'/>
+ <separator/>
+ <menuitem action='import'/>
+ <separator/>
+ <menuitem action='page-setup'/>
+ <placeholder name='print-actions'/>
+ <separator/>
+ <placeholder name='long-running-actions'/>
+ <menuitem action='forget-passwords'/>
+ <menuitem action='work-online'/>
+ <menuitem action='work-offline'/>
+ <menuitem action='close'/>
+ <menuitem action='quit'/>
+ </menu>
+ <menu action='edit-menu'>
+ <placeholder name='edit-actions'/>
+ <separator/>
+ <menuitem action='sync-options'/>
+ <placeholder name='administrative-actions'/>
+ <menuitem action='preferences'/>
+ </menu>
+ <menu action='view-menu'>
+ <menu action='gal-view-menu'>
+ <placeholder name='gal-view-list'/>
+ <separator/>
+ <menuitem action='gal-custom-view'/>
+ <menuitem action='gal-save-custom-view'/>
+ <separator/>
+ <menuitem action='gal-define-views'/>
+ </menu>
+ <menu action='window-menu'/>
+ <menu action='layout-menu'>
+ <menuitem action='show-toolbar'/>
+ <menuitem action='show-statusbar'/>
+ <menuitem action='show-sidebar'/>
+ </menu>
+ <placeholder name='view-custom-menus'/>
+ <menu action='switcher-menu'>
+ <menuitem action='switcher-style-both'/>
+ <menuitem action='switcher-style-icons'/>
+ <menuitem action='switcher-style-text'/>
+ <menuitem action='switcher-style-user'/>
+ <separator/>
+ <menuitem action='show-switcher'/>
+ </menu>
+ </menu>
+ <placeholder name='custom-menus'/>
+ <menu action='search-menu'>
+ <menuitem action='search-execute'/>
+ <menuitem action='search-clear'/>
+ <menuitem action='search-advanced'/>
+ <separator/>
+ <menuitem action='search-save'/>
+ <menuitem action='search-edit'/>
+ <separator/>
+ <placeholder name='search-actions'/>
+ <separator/>
+ <placeholder name='custom-rules'/>
+ </menu>
+ <menu action='help-menu'>
+ <menuitem action='contents'/>
+ <menuitem action='quick-reference'/>
+ <separator/>
+ <menuitem action='faq'/>
+ <menuitem action='submit-bug'/>
+ <separator/>
+ <menuitem action='about'/>
+ </menu>
+ </menubar>
+ <toolbar name='main-toolbar'>
+ <toolitem action='send-receive'/>
+ <separator/>
+ <placeholder name='toolbar-actions'/>
+ </toolbar>
+</ui>
diff --git a/ui/evolution-tasks.ui b/ui/evolution-tasks.ui
new file mode 100644
index 0000000000..073f7d450a
--- /dev/null
+++ b/ui/evolution-tasks.ui
@@ -0,0 +1,79 @@
+<ui>
+ <menubar name='main-menu'>
+ <menu action='file-menu'>
+ <placeholder name='file-actions'>
+ <menuitem action='task-open'/>
+ </placeholder>
+ <placeholder name='print-actions'>
+ <menuitem action='task-list-print-preview'/>
+ <menuitem action='task-list-print'/>
+ </placeholder>
+ </menu>
+ <menu action='edit-menu'>
+ <placeholder name='edit-actions'>
+ <menuitem action='task-clipboard-cut'/>
+ <menuitem action='task-clipboard-copy'/>
+ <menuitem action='task-clipboard-paste'/>
+ <separator/>
+ <menuitem action='task-delete'/>
+ <separator/>
+ <menuitem action='task-mark-complete'/>
+ <menuitem action='task-mark-incomplete'/>
+ </placeholder>
+ </menu>
+ <menu action='view-menu'>
+ <menuitem action='task-preview'/>
+ </menu>
+ <placeholder name='custom-menus'>
+ <menu action='task-actions-menu'>
+ <menuitem action='task-purge'/>
+ <menuitem action='task-assign'/>
+ <menuitem action='task-forward'/>
+ </menu>
+ </placeholder>
+ </menubar>
+ <toolbar name='main-toolbar'>
+ <toolitem action='task-clipboard-cut'/>
+ <toolitem action='task-clipboard-copy'/>
+ <toolitem action='task-clipboard-paste'/>
+ <separator/>
+ <toolitem action='task-print'/>
+ <toolitem action='task-delete'/>
+ </toolbar>
+ <popup name='task-popup'>
+ <menuitem action='task-new'/>
+ <separator/>
+ <menuitem action='task-popup-open'/>
+ <menuitem action='task-popup-open-url'/>
+ <menuitem action='task-popup-save-as'/>
+ <menuitem action='task-popup-print'/>
+ <separator/>
+ <menuitem action='task-popup-clipboard-cut'/>
+ <menuitem action='task-popup-clipboard-copy'/>
+ <menuitem action='task-popup-clipboard-paste'/>
+ <separator/>
+ <menuitem action='task-popup-assign'/>
+ <menuitem action='task-popup-forward'/>
+ <menuitem action='task-popup-mark-complete'/>
+ <menuitem action='task-popup-mark-incomplete'/>
+ <separator/>
+ <menuitem action='task-popup-delete'/>
+ </popup>
+ <popup name='task-list-popup'>
+ <menuitem action='task-list-new'/>
+ <menuitem action='task-list-popup-copy'/>
+ <menuitem action='task-list-popup-rename'/>
+ <separator/>
+ <menuitem action='task-list-popup-delete'/>
+ <menuitem action='task-list-popup-select-one'/>
+ <separator/>
+ <menuitem action='task-list-popup-properties'/>
+ </popup>
+ <popup name='task-search-options'>
+ <menuitem action='task-search-summary-contains'/>
+ <menuitem action='task-search-description-contains'/>
+ <menuitem action='task-search-any-field-contains'/>
+ <separator/>
+ <menuitem action='search-advanced'/>
+ </popup>
+</ui>
diff --git a/ui/evolution-tasks.xml b/ui/evolution-tasks.xml
deleted file mode 100644
index e0902b6806..0000000000
--- a/ui/evolution-tasks.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<Root>
- <commands>
- <cmd name="TasksOpenTask" _tip="View the selected task" accel="*Control*o"/>
- <cmd name="TasksPrint" _tip="Print the list of tasks" pixtype="pixbuf"
- accel="*Control*p"/>
- <cmd name="TasksPrintPreview" _tip="Previews the list of tasks to be printed" pixtype="pixbuf"/>
-
- <cmd name="TasksCut" _tip="Cut selected tasks" accel="*Control*x" pixtype="pixbuf"/>
- <cmd name="TasksCopy" _tip="Copy selected tasks" accel="*Control*c" pixtype="pixbuf"/>
- <cmd name="TasksPaste" _tip="Paste tasks from the clipboard" accel="*Control*v" pixtype="pixbuf"/>
- <cmd name="TasksDelete" _tip="Delete selected tasks" accel="*Control*d" sensitive="0"
- pixtype="pixbuf"/>
- <cmd name="TasksMarkComplete" _tip="Mark selected tasks as complete" accel="*Control*k" sensitive="0"/>
-
- <cmd name="TasksPurge" _label="Purg_e" _tip="Delete completed tasks" accel="*Control*e"/>
- <cmd name="TasksAssign" _label="_Assign Task"/>
- <cmd name="TasksForward" _label="_Forward as iCalendar" accel="*Control*f" pixtype="pixbuf"/>
-
- <cmd name="ViewPreview" _tip="Show task preview window" accel="*Control*m" type="toggle"/>
-
- </commands>
-
- <menu>
- <submenu name="File">
- <placeholder name="FileOps">
- <menuitem name="OpenTask" verb="TasksOpenTask" _label="_Open Task"/>
- </placeholder>
- <placeholder name="Print">
- <menuitem name="PrintPreview" verb="TasksPrintPreview" _label="Print Pre_view"/>
-
- <menuitem name="Print" verb="TasksPrint" accel="*Control*p" _label="_Print..."/>
- </placeholder>
-
- </submenu>
-
- <submenu name="Edit" _label="_Edit">
- <placeholder name="EditPlaceholder">
- <menuitem name="TasksCut" verb="" _label="C_ut"/>
- <menuitem name="TasksCopy" verb="" _label="_Copy"/>
- <menuitem name="TasksPaste" verb="" _label="_Paste"/>
-
- <separator/>
-
- <menuitem name="TasksDelete" verb="" _label="_Delete"/>
-
- <separator/>
-
- <menuitem name="TasksMarkComplete" verb="" _label="Mar_k as Complete"/>
- </placeholder>
- </submenu>
-
- <submenu name="View" _label="_View">
- <placeholder name="ViewPreview">
- <menuitem name="ViewPreview" verb="" _label="Task _Preview"/>
- </placeholder>
- </submenu>
-
- <placeholder name="ActionsPlaceholder">
- <submenu name="Actions" _label="_Actions">
- <menuitem name="TasksPurge" verb=""/>
- <menuitem name="TasksAssign" verb=""/>
- <menuitem name="TasksForward" verb=""/>
- </submenu>
- </placeholder>
-
- </menu>
-
- <dockitem name="Toolbar">
- <toolitem name="Cut" _label="Cut" verb="TasksCut" pixtype="pixbuf"/>
- <toolitem name="Copy" _label="Copy" verb="TasksCopy" pixtype="pixbuf"/>
- <toolitem name="Paste" _label="Paste" verb="TasksPaste" pixtype="pixbuf"/>
-
- <separator/>
-
- <toolitem name="Print" _label="Print" verb="TasksPrint" pixtype="pixbuf"/>
-
- <toolitem name="Delete" _label="Delete" verb="TasksDelete" pixtype="pixbuf"/>
-
- </dockitem>
-
-</Root>
diff --git a/widgets/Makefile.am b/widgets/Makefile.am
index 347c0f7c66..99305b844e 100644
--- a/widgets/Makefile.am
+++ b/widgets/Makefile.am
@@ -1,9 +1,9 @@
SUBDIRS = \
- table \
- text \
misc \
+ text \
e-timezone-dialog \
+ table \
menus
EXTRA_DIST = \
diff --git a/widgets/menus/Makefile.am b/widgets/menus/Makefile.am
index 5d0c5ca989..4c214038ee 100644
--- a/widgets/menus/Makefile.am
+++ b/widgets/menus/Makefile.am
@@ -8,7 +8,6 @@ INCLUDES = \
$(E_UTIL_CFLAGS)
libmenus_la_SOURCES = \
- gal-view-menus.c \
gal-define-views-dialog.c \
gal-define-views-model.c \
gal-view-collection.c \
@@ -18,8 +17,7 @@ libmenus_la_SOURCES = \
gal-view-instance-save-as-dialog.c \
gal-view-instance.c \
gal-view-new-dialog.c \
- gal-view.c \
- gal-view-menus.h
+ gal-view.c
glade_DATA = \
gal-define-views.glade \
diff --git a/widgets/menus/gal-view-collection.c b/widgets/menus/gal-view-collection.c
index c32e791809..fae91fce7e 100644
--- a/widgets/menus/gal-view-collection.c
+++ b/widgets/menus/gal-view-collection.c
@@ -33,7 +33,7 @@
#include <glib/gi18n.h>
#include "e-util/e-util.h"
#include "e-util/e-xml-utils.h"
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
#include "gal-view-collection.h"
diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c
index 9e0e2eb7c9..07dab81336 100644
--- a/widgets/menus/gal-view-instance.c
+++ b/widgets/menus/gal-view-instance.c
@@ -38,7 +38,7 @@
#include <glib/gi18n.h>
#include "e-util/e-util.h"
#include "e-util/e-xml-utils.h"
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
#include "gal-define-views-dialog.h"
#include "gal-view-instance.h"
@@ -46,10 +46,6 @@
G_DEFINE_TYPE (GalViewInstance, gal_view_instance, G_TYPE_OBJECT)
-static const EPopupMenu separator = E_POPUP_SEPARATOR;
-static const EPopupMenu terminator = E_POPUP_TERMINATOR;
-
-
#define d(x)
enum {
@@ -467,140 +463,3 @@ gal_view_instance_exists (GalViewInstance *instance)
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,
- const gchar *title,
- GCallback fn,
- gpointer closure,
- gboolean value)
-{
- EPopupMenu menu_item_struct =
- E_POPUP_RADIO_ITEM_CC (title,
- fn,
- closure,
- 0,
- 0);
- menu_item_struct.is_active = value;
-
- e_popup_menu_copy_1 (menu_item, &menu_item_struct);
-}
-
-static void
-add_popup_menu_item (EPopupMenu *menu_item,
- const gchar *title,
- GCallback fn,
- gpointer closure)
-{
- EPopupMenu menu_item_struct =
- E_POPUP_ITEM_CC (title,
- fn,
- closure,
- 0);
-
- e_popup_menu_copy_1 (menu_item, &menu_item_struct);
-}
-
-static void
-define_views_dialog_response(GtkWidget *dialog, int id, GalViewInstance *instance)
-{
- if (id == GTK_RESPONSE_OK) {
- gal_view_collection_save(instance->collection);
- }
- gtk_widget_destroy (dialog);
-}
-
-static void
-define_views_cb(GtkWidget *widget,
- GalViewInstance *instance)
-{
- GtkWidget *dialog = gal_define_views_dialog_new(instance->collection);
- g_signal_connect(dialog, "response",
- G_CALLBACK(define_views_dialog_response), instance);
- gtk_widget_show(dialog);
-}
-
-static void
-save_current_view_cb(GtkWidget *widget,
- GalViewInstance *instance)
-{
- gal_view_instance_save_as (instance);
-}
-
-EPopupMenu *
-gal_view_instance_get_popup_menu (GalViewInstance *instance)
-{
- EPopupMenu *ret_val;
- int length;
- int i;
- gboolean found = FALSE;
- char *id;
-
- length = gal_view_collection_get_count(instance->collection);
- id = gal_view_instance_get_current_view_id (instance);
-
- ret_val = g_new (EPopupMenu, length + 6);
-
- for (i = 0; i < length; i++) {
- gboolean value = FALSE;
- GalViewCollectionItem *item = gal_view_collection_get_view_item(instance->collection, i);
- ListenerClosure *closure;
-
- closure = g_new (ListenerClosure, 1);
- closure->instance = instance;
- closure->id = item->id;
- g_object_ref (closure->instance);
-
- if (!found && id && !strcmp (id, item->id)) {
- found = TRUE;
- value = TRUE;
- }
-
- add_popup_radio_item (ret_val + i, item->title, G_CALLBACK (view_item_cb), closure, value);
- }
-
- if (!found) {
- e_popup_menu_copy_1 (ret_val + i++, &separator);
-
- add_popup_radio_item (ret_val + i++, N_("Custom View"), NULL, NULL, TRUE);
- add_popup_menu_item (ret_val + i++, N_("Save Custom View"), G_CALLBACK (save_current_view_cb), instance);
- }
-
- e_popup_menu_copy_1 (ret_val + i++, &separator);
- add_popup_menu_item (ret_val + i++, N_("Define Views..."), G_CALLBACK (define_views_cb), instance);
- e_popup_menu_copy_1 (ret_val + i++, &terminator);
-
- if (id)
- g_free (id);
-
- return ret_val;
-}
-
-void
-gal_view_instance_free_popup_menu (GalViewInstance *instance, EPopupMenu *menu)
-{
- int i;
- /* This depends on the first non-custom closure to be a separator or a terminator. */
- for (i = 0; menu[i].name && *(menu[i].name); i++) {
- g_object_unref (((ListenerClosure *)(menu[i].closure))->instance);
- g_free (menu[i].closure);
- }
-
- e_popup_menu_free (menu);
-}
diff --git a/widgets/menus/gal-view-instance.h b/widgets/menus/gal-view-instance.h
index 787bc09713..88c2c3c39d 100644
--- a/widgets/menus/gal-view-instance.h
+++ b/widgets/menus/gal-view-instance.h
@@ -26,7 +26,6 @@
#include <glib-object.h>
#include <widgets/menus/gal-view-collection.h>
-#include <misc/e-popup-menu.h>
G_BEGIN_DECLS
@@ -107,10 +106,6 @@ const char *gal_view_instance_get_default_view (GalViewInstance *inst
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-menus.c b/widgets/menus/gal-view-menus.c
deleted file mode 100644
index 4f76eb6cca..0000000000
--- a/widgets/menus/gal-view-menus.c
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- * gal-view-menus.c: Deploy a GalViewCollection in the menus.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gal-view-menus.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtk.h>
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include <glib/gi18n.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <e-util/e-util.h>
-#include <e-util/e-xml-utils.h>
-#include <widgets/menus/gal-define-views-dialog.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <libedataserver/e-list.h>
-
-struct _GalViewMenusPrivate {
- GalViewInstance *instance;
- int collection_changed_id;
- int instance_changed_id;
- BonoboUIComponent *component;
- EList *listenerClosures;
- GtkWidget *define_views_dialog;
-
- guint show_define_views : 1;
-};
-
-typedef struct {
- GalViewInstance *instance;
- char *id;
- int ref_count;
-} ListenerClosure;
-
-static void collection_changed (GalViewCollection *collection,
- GalViewMenus *gvm);
-static void instance_changed (GalViewInstance *instance,
- GalViewMenus *gvm);
-
-#define d(x)
-#define CURRENT_VIEW_PATH "/menu/View/ViewBegin/CurrentView"
-
-G_DEFINE_TYPE(GalViewMenus, gal_view_menus, G_TYPE_OBJECT)
-
-static void
-closure_free (void *data, void *user_data)
-{
- ListenerClosure *closure = data;
- GalViewMenus *gvm = user_data;
-
- closure->ref_count --;
- if (closure->ref_count == 0) {
- g_object_unref (closure->instance);
-
- bonobo_ui_component_remove_listener (gvm->priv->component, closure->id);
- g_free (closure);
- }
-}
-
-static void *
-closure_copy (const void *data, void *user_data)
-{
- ListenerClosure *closure = (void *) data;
-
- closure->ref_count ++;
- return closure;
-}
-
-static void
-remove_listeners (GalViewMenus *gvm)
-{
- if (gvm->priv->listenerClosures)
- g_object_unref (gvm->priv->listenerClosures);
-
- gvm->priv->listenerClosures = NULL;
-}
-
-static void
-remove_xml (GalViewMenus *gvm)
-{
-}
-
-static void
-remove_instance (GalViewMenus *gvm)
-{
- if (gvm->priv->instance) {
- if (gvm->priv->instance_changed_id != 0)
- g_signal_handler_disconnect (gvm->priv->instance, gvm->priv->instance_changed_id);
-
- if (gvm->priv->instance->collection && gvm->priv->collection_changed_id != 0)
- g_signal_handler_disconnect (gvm->priv->instance->collection, gvm->priv->collection_changed_id);
- }
-
- gvm->priv->instance_changed_id = 0;
- gvm->priv->collection_changed_id = 0;
-
- if (gvm->priv->instance) {
- g_object_unref (gvm->priv->instance);
- gvm->priv->instance = NULL;
- }
-
- remove_listeners(gvm);
- remove_xml(gvm);
-}
-
-static void
-add_instance (GalViewMenus *gvm,
- GalViewInstance *instance)
-{
- g_object_ref (instance);
-
- if (gvm->priv->instance != NULL)
- remove_instance (gvm);
-
- gvm->priv->instance = instance;
-
- gal_view_instance_load (gvm->priv->instance);
-
- gvm->priv->instance_changed_id = g_signal_connect (instance, "changed",
- G_CALLBACK (instance_changed), gvm);
- gvm->priv->collection_changed_id = g_signal_connect (instance->collection, "changed",
- G_CALLBACK (collection_changed), gvm);
-}
-
-static void
-clear_define_views_dialog (gpointer data,
- GObject *where_the_object_was)
-{
- GalViewMenus *gvm = GAL_VIEW_MENUS (data);
- gvm->priv->define_views_dialog = NULL;
-}
-
-static void
-gal_view_menus_finalize (GObject *object)
-{
- GalViewMenus *gvm = GAL_VIEW_MENUS (object);
-
- remove_instance (gvm);
-
- gal_view_menus_unmerge (gvm, NULL);
-
- if (gvm->priv->component)
- bonobo_object_unref (gvm->priv->component);
-
- if (gvm->priv->define_views_dialog)
- g_object_weak_unref (G_OBJECT (gvm->priv->define_views_dialog), clear_define_views_dialog, gvm);
-
- g_free(gvm->priv);
-
- (* G_OBJECT_CLASS (gal_view_menus_parent_class)->finalize) (object);
-}
-
-static void
-gal_view_menus_class_init (GalViewMenusClass *gvm_class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (gvm_class);
-
- object_class->finalize = gal_view_menus_finalize;
-}
-
-static void
-gal_view_menus_init (GalViewMenus *gvm)
-{
- gvm->priv = g_new(GalViewMenusPrivate, 1);
- gvm->priv->instance = NULL;
- gvm->priv->collection_changed_id = 0;
- gvm->priv->instance_changed_id = 0;
- gvm->priv->component = NULL;
- gvm->priv->listenerClosures = NULL;
- gvm->priv->define_views_dialog = NULL;
- gvm->priv->show_define_views = TRUE;
-}
-
-GalViewMenus *
-gal_view_menus_new (GalViewInstance *instance)
-{
- GalViewMenus *gvm;
-
- g_return_val_if_fail (instance != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_INSTANCE (instance), NULL);
-
- gvm = g_object_new (GAL_VIEW_MENUS_TYPE, NULL);
- gal_view_menus_construct(gvm, instance);
-
- return gvm;
-}
-
-GalViewMenus *
-gal_view_menus_construct (GalViewMenus *gvm,
- GalViewInstance *instance)
-{
- g_return_val_if_fail (gvm != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_MENUS (gvm), NULL);
- g_return_val_if_fail (instance != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_INSTANCE (instance), NULL);
-
- add_instance (gvm, instance);
-
- return gvm;
-}
-
-static void
-dialog_response(GtkWidget *dialog, int id, GalViewMenus *menus)
-{
- if (id == GTK_RESPONSE_OK) {
- gal_view_collection_save(menus->priv->instance->collection);
- }
- gtk_widget_destroy(dialog);
-}
-
-static void
-define_views(BonoboUIComponent *component,
- GalViewMenus *menus,
- char *cname)
-{
- if (menus->priv->define_views_dialog) {
- gdk_window_raise (menus->priv->define_views_dialog->window);
- } else {
- GtkWidget *dialog = gal_define_views_dialog_new(menus->priv->instance->collection);
-
- g_signal_connect (dialog, "response", G_CALLBACK (dialog_response), menus);
- menus->priv->define_views_dialog = dialog;
- g_object_weak_ref (G_OBJECT (dialog), clear_define_views_dialog, menus);
- gtk_widget_show(dialog);
- }
-}
-
-static void
-save_current_view(BonoboUIComponent *component,
- GalViewMenus *menus,
- char *cname)
-{
- gal_view_instance_save_as (menus->priv->instance);
-}
-
-static void
-toggled_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- ListenerClosure *closure = user_data;
-
- /* do nothing on state change to untoggled */
- if (!strcmp (state, "0"))
- return;
-
- g_print ("%s\n", path);
-
- gal_view_instance_set_current_view_id (closure->instance, closure->id);
-}
-
-static char *
-build_menus(GalViewMenus *menus)
-{
- BonoboUINode *root, *menu, *submenu, *place, *menuitem, *commands, *command;
- char *xml;
- int length;
- int i;
- GalViewInstance *instance = menus->priv->instance;
- GalViewCollection *collection = instance->collection;
- char *id;
- gboolean found = FALSE;
-
- root = bonobo_ui_node_new("Root");
- menu = bonobo_ui_node_new_child(root, "menu");
- commands = bonobo_ui_node_new_child (root, "commands");
-
- submenu = bonobo_ui_node_new_child(menu, "submenu");
- bonobo_ui_node_set_attr(submenu, "name", "View");
-
- place = bonobo_ui_node_new_child(submenu, "placeholder");
- bonobo_ui_node_set_attr(place, "name", "ViewBegin");
-
- submenu = bonobo_ui_node_new_child(place, "submenu");
- bonobo_ui_node_set_attr(submenu, "name", "CurrentView");
- bonobo_ui_node_set_attr(submenu, "_label", N_("C_urrent View"));
-
- id = gal_view_instance_get_current_view_id (instance);
-
-
- length = gal_view_collection_get_count(collection);
-
- menus->priv->listenerClosures = e_list_new (closure_copy, closure_free, menus);
-
- for (i = 0; i < length; i++) {
- GalViewCollectionItem *item = gal_view_collection_get_view_item(collection, i);
- ListenerClosure *closure;
- char *label;
- char *tip;
-
- menuitem = bonobo_ui_node_new_child(submenu, "menuitem");
- bonobo_ui_node_set_attr(menuitem, "name", item->id);
- bonobo_ui_node_set_attr(menuitem, "id", item->id);
- bonobo_ui_node_set_attr(menuitem, "group", "GalViewMenus");
- bonobo_ui_node_set_attr(menuitem, "type", "radio");
-
- command = bonobo_ui_node_new_child (commands, "cmd");
- bonobo_ui_node_set_attr(command, "name", item->id);
- bonobo_ui_node_set_attr(command, "group", "GalViewMenus");
- tip = g_strdup_printf (_("Select View: %s"), item->id);
- bonobo_ui_node_set_attr(command, "_tip", tip);
- g_free (tip);
-
- label = bonobo_ui_util_encode_str (item->title);
- bonobo_ui_node_set_attr(menuitem, "label", label);
- g_free (label);
-
- closure = g_new (ListenerClosure, 1);
- closure->instance = instance;
- closure->id = item->id;
- closure->ref_count = 1;
-
- if (!found && id && !strcmp (item->id, id)) {
- found = TRUE;
- }
-
- g_object_ref (closure->instance);
-
- bonobo_ui_component_add_listener (menus->priv->component, item->id, toggled_cb, closure);
- e_list_append (menus->priv->listenerClosures, closure);
-
- closure_free (closure, menus);
- }
-
- if (menus->priv->show_define_views) {
- if (!found) {
-
- menuitem = bonobo_ui_node_new_child(submenu, "separator");
- bonobo_ui_node_set_attr(menuitem, "name", "GalView:first_sep");
- bonobo_ui_node_set_attr(menuitem, "f", "");
-
-
- menuitem = bonobo_ui_node_new_child(submenu, "menuitem");
- bonobo_ui_node_set_attr(menuitem, "name", "custom_view");
- bonobo_ui_node_set_attr(menuitem, "id", "custom_view");
- bonobo_ui_node_set_attr(menuitem, "group", "GalViewMenus");
- bonobo_ui_node_set_attr(menuitem, "type", "radio");
- /* bonobo displays this string so it must be in locale */
- bonobo_ui_node_set_attr(menuitem, "_label", N_("Custom View"));
-
- command = bonobo_ui_node_new_child (commands, "cmd");
- bonobo_ui_node_set_attr(command, "name", "custom_view");
- bonobo_ui_node_set_attr(command, "group", "GalViewMenus");
- bonobo_ui_node_set_attr(command, "_tip", N_("Current view is a customized view"));
-
-
- menuitem = bonobo_ui_node_new_child(submenu, "menuitem");
- bonobo_ui_node_set_attr(menuitem, "name", "SaveCurrentView");
- bonobo_ui_node_set_attr(menuitem, "_label", N_("Save Custom View..."));
- bonobo_ui_node_set_attr(menuitem, "verb", "");
-
- command = bonobo_ui_node_new_child(commands, "cmd");
- bonobo_ui_node_set_attr(command, "name", "SaveCurrentView");
- bonobo_ui_node_set_attr(command, "_tip", N_("Save current custom view"));
- }
-
- menuitem = bonobo_ui_node_new_child(submenu, "separator");
- bonobo_ui_node_set_attr(menuitem, "name", "GalView:second_sep");
- bonobo_ui_node_set_attr(menuitem, "f", "");
-
- menuitem = bonobo_ui_node_new_child(submenu, "menuitem");
- bonobo_ui_node_set_attr(menuitem, "name", "DefineViews");
- bonobo_ui_node_set_attr(menuitem, "_label", N_("Define Views..."));
- bonobo_ui_node_set_attr(menuitem, "verb", "");
-
- command = bonobo_ui_node_new_child(commands, "cmd");
- bonobo_ui_node_set_attr(command, "name", "DefineViews");
- bonobo_ui_node_set_attr(command, "_tip", N_("Create or edit views"));
- }
-
- xml = bonobo_ui_node_to_string(root, TRUE);
-
- bonobo_ui_node_free(root);
-
- g_free (id);
-
- /* d(g_print (xml));*/
-
- return xml;
-}
-
-static BonoboUIVerb verbs [] = {
- BONOBO_UI_UNSAFE_VERB ("DefineViews", define_views),
- BONOBO_UI_UNSAFE_VERB ("SaveCurrentView", save_current_view),
- BONOBO_UI_VERB_END
-};
-
-static void
-set_state (GalViewMenus *gvm, const gchar *path, CORBA_Environment *ev)
-{
- char *full_path = g_strdup_printf ("/commands/%s", path);
-
- bonobo_ui_component_set_prop (gvm->priv->component, full_path, "state", "1", ev);
- g_free (full_path);
-}
-
-static void
-set_radio (GalViewMenus *gvm,
- CORBA_Environment *ev)
-{
- char *id;
-
- id = gal_view_instance_get_current_view_id (gvm->priv->instance);
-
- if (id) {
- set_state (gvm, id, ev);
- } else {
- set_state (gvm, "custom_view", ev);
- }
- g_free (id);
-}
-
-static void
-build_stuff (GalViewMenus *gvm,
- CORBA_Environment *ev)
-{
- char *xml;
-
- g_object_ref (gvm);
-
- gal_view_menus_unmerge (gvm, ev);
-
- remove_listeners(gvm);
- remove_xml(gvm);
- xml = build_menus(gvm);
- bonobo_ui_component_set_translate(gvm->priv->component, "/", xml, ev);
- g_free(xml);
-
- bonobo_ui_component_add_verb_list_with_data(gvm->priv->component, verbs, gvm);
-
- set_radio (gvm, ev);
-
- g_object_unref (gvm);
-}
-
-void
-gal_view_menus_set_show_define_views (GalViewMenus *gvm,
- gboolean show_define_views)
-{
- if (gvm->priv->show_define_views == show_define_views)
- return;
-
- gvm->priv->show_define_views = show_define_views;
-
- if (gvm->priv->component) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- build_stuff(gvm, &ev);
- CORBA_exception_free (&ev);
- }
-}
-
-void
-gal_view_menus_apply (GalViewMenus *gvm,
- BonoboUIComponent *component,
- CORBA_Environment *opt_ev)
-{
- if (gvm->priv == NULL)
- return;
-
- if (component != gvm->priv->component) {
- if (component)
- bonobo_object_ref (BONOBO_OBJECT (component));
-
- if (gvm->priv->component)
- bonobo_object_unref (BONOBO_OBJECT (gvm->priv->component));
- }
-
- gvm->priv->component = component;
-
- build_stuff (gvm, opt_ev);
-}
-
-void
-gal_view_menus_unmerge (GalViewMenus *gvm,
- CORBA_Environment *opt_ev)
-{
- d(g_print ("%s:\n", G_STRFUNC));
- if (bonobo_ui_component_get_container (gvm->priv->component) != NULL
- && bonobo_ui_component_path_exists (gvm->priv->component, CURRENT_VIEW_PATH, opt_ev)) {
- d(g_print ("%s: Removing path\n", G_STRFUNC));
- bonobo_ui_component_rm (gvm->priv->component, CURRENT_VIEW_PATH, opt_ev);
- }
-}
-
-static void
-collection_changed (GalViewCollection *collection,
- GalViewMenus *gvm)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- build_stuff(gvm, &ev);
- CORBA_exception_free (&ev);
-}
-
-static void
-instance_changed (GalViewInstance *instance,
- GalViewMenus *gvm)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- build_stuff(gvm, &ev);
- CORBA_exception_free (&ev);
-}
-
-void
-gal_view_menus_set_instance (GalViewMenus *gvm,
- GalViewInstance *instance)
-{
- remove_instance (gvm);
- add_instance (gvm, instance);
- instance_changed (instance, gvm);
-}
diff --git a/widgets/menus/gal-view-menus.h b/widgets/menus/gal-view-menus.h
deleted file mode 100644
index f565d07613..0000000000
--- a/widgets/menus/gal-view-menus.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _GAL_VIEW_MENUS_H_
-#define _GAL_VIEW_MENUS_H_
-
-#include <libxml/tree.h>
-#include <bonobo/bonobo-ui-component.h>
-#include <widgets/menus/gal-view-instance.h>
-
-#include <glib-object.h>
-
-#define GAL_VIEW_MENUS_TYPE (gal_view_menus_get_type ())
-#define GAL_VIEW_MENUS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_MENUS_TYPE, GalViewMenus))
-#define GAL_VIEW_MENUS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_MENUS_TYPE, GalViewMenusClass))
-#define GAL_IS_VIEW_MENUS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_MENUS_TYPE))
-#define GAL_IS_VIEW_MENUS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_VIEW_MENUS_TYPE))
-
-typedef struct _GalViewMenusPrivate GalViewMenusPrivate;
-
-typedef struct {
- GObject base;
- GalViewMenusPrivate *priv;
-} GalViewMenus;
-
-typedef struct {
- GObjectClass parent_class;
-} GalViewMenusClass;
-
-GType gal_view_menus_get_type (void);
-GalViewMenus *gal_view_menus_new (GalViewInstance *instance);
-GalViewMenus *gal_view_menus_construct (GalViewMenus *menus,
- GalViewInstance *instance);
-
-void gal_view_menus_set_show_define_views (GalViewMenus *menus,
- gboolean show_define_views);
-
-void gal_view_menus_apply (GalViewMenus *menus,
- BonoboUIComponent *component,
- CORBA_Environment *opt_ev);
-void gal_view_menus_unmerge (GalViewMenus *gvm,
- CORBA_Environment *opt_ev);
-void gal_view_menus_set_instance (GalViewMenus *gvm,
- GalViewInstance *instance);
-
-#endif /* _GAL_VIEW_MENUS_H_ */
diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c
index 8bfc84fa15..39c5411dfb 100644
--- a/widgets/menus/gal-view-new-dialog.c
+++ b/widgets/menus/gal-view-new-dialog.c
@@ -27,7 +27,7 @@
#include <glib/gi18n.h>
#include "e-util/e-util.h"
#include "e-util/e-util-private.h"
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
#include "gal-define-views-model.h"
#include "gal-view-new-dialog.h"
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
index e40664be05..d6a42f10c2 100644
--- a/widgets/misc/Makefile.am
+++ b/widgets/misc/Makefile.am
@@ -1,10 +1,6 @@
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = $(top_builddir)/win32/libfilter.la
-endif
-
INCLUDES = \
-I$(top_srcdir) \
- -I$(top_srcdir)/a11y/widgets \
+ -I$(top_srcdir)/filter \
-I$(top_srcdir)/widgets \
-DEVOLUTION_IMAGES=\""$(imagesdir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
@@ -15,8 +11,7 @@ INCLUDES = \
privsolib_LTLIBRARIES = \
- libemiscwidgets.la \
- libefilterbar.la
+ libemiscwidgets.la
widgetsincludedir = $(privincludedir)/misc
filterbarincludedir = $(privincludedir)/misc
@@ -34,7 +29,12 @@ glade_DATA = e-send-options.glade
widgetsinclude_HEADERS = \
$(pilot_headers) \
e-account-combo-box.h \
- e-activity-handler.h \
+ e-account-manager.h \
+ e-account-tree-view.h \
+ e-action-combo-box.h \
+ e-activity.h \
+ e-activity-proxy.h \
+ e-alert-activity.h \
e-attachment.h \
e-attachment-button.h \
e-attachment-dialog.h \
@@ -46,54 +46,58 @@ widgetsinclude_HEADERS = \
e-attachment-store.h \
e-attachment-tree-view.h \
e-attachment-view.h \
- e-spinner.c \
- e-spinner.h \
e-calendar.h \
e-calendar-item.h \
- e-cell-date-edit.h \
- e-cell-percent.h \
+ e-canvas.h \
+ e-canvas-background.h \
+ e-canvas-utils.h \
+ e-canvas-vbox.h \
e-cell-renderer-combo.h \
e-charset-picker.h \
+ e-colors.h \
e-combo-cell-editable.h \
- e-config-page.h \
- e-combo-button.h \
+ e-cursors.h \
e-dateedit.h \
- e-dropdown-button.h \
+ e-file-activity.h \
+ e-gui-utils.h \
+ e-hsv-utils.h \
e-icon-entry.h \
e-image-chooser.h \
- e-info-label.h \
e-map.h \
- e-multi-config-dialog.h \
+ e-menu-tool-button.h \
e-online-button.h \
- e-search-bar.h \
- e-task-bar.h \
- e-task-widget.h \
- e-send-options.h \
- e-url-entry.h \
- e-canvas-background.h \
- e-canvas-utils.h \
- e-canvas-vbox.h \
- e-canvas.h \
- e-cursors.h \
- e-gui-utils.h \
- e-hsv-utils.h \
+ e-popup-action.h \
e-popup-menu.h \
+ e-preferences-window.h \
e-printable.h \
- e-reflow-model.h \
- e-reflow.h \
+ e-selection-model.h \
e-selection-model-array.h \
e-selection-model-simple.h \
- e-selection-model.h \
+ e-send-options.h \
e-signature-combo-box.h \
- e-unicode.h \
- e-colors.h
+ e-signature-editor.h \
+ e-signature-manager.h \
+ e-signature-preview.h \
+ e-signature-script-dialog.h \
+ e-signature-tree-view.h \
+ e-spinner.c \
+ e-spinner.h \
+ e-timeout-activity.h \
+ e-url-entry.h \
+ a11y/ea-calendar-cell.h \
+ a11y/ea-calendar-item.h \
+ a11y/ea-widgets.h
libemiscwidgets_la_SOURCES = \
$(widgetsinclude_HEADERS) \
$(pilot_sources) \
e-account-combo-box.c \
- e-activity-handler.c \
- e-calendar.c \
+ e-account-manager.c \
+ e-account-tree-view.c \
+ e-action-combo-box.c \
+ e-activity.c \
+ e-activity-proxy.c \
+ e-alert-activity.c \
e-attachment.c \
e-attachment-button.c \
e-attachment-dialog.c \
@@ -105,78 +109,61 @@ libemiscwidgets_la_SOURCES = \
e-attachment-store.c \
e-attachment-tree-view.c \
e-attachment-view.c \
+ e-calendar.c \
e-calendar-item.c \
- e-cell-date-edit.c \
- e-cell-percent.c \
+ e-canvas.c \
+ e-canvas-background.c \
+ e-canvas-utils.c \
+ e-canvas-vbox.c \
e-cell-renderer-combo.c \
e-charset-picker.c \
+ e-colors.c \
e-combo-cell-editable.c \
- e-config-page.c \
- e-combo-button.c \
+ e-cursors.c \
e-dateedit.c \
- e-dropdown-button.c \
+ e-file-activity.c \
+ e-gui-utils.c \
+ e-hsv-utils.c \
e-icon-entry.c \
e-image-chooser.c \
- e-info-label.c \
e-map.c \
- e-multi-config-dialog.c \
+ e-menu-tool-button.c \
e-online-button.c \
- e-search-bar.c \
- e-task-bar.c \
- e-task-widget.c \
- e-send-options.c \
- e-url-entry.c \
- e-canvas-background.c \
- e-canvas-utils.c \
- e-canvas-vbox.c \
- e-canvas.c \
- e-cursors.c \
- e-gui-utils.c \
- e-hsv-utils.c \
+ e-popup-action.c \
e-popup-menu.c \
+ e-preferences-window.c \
e-printable.c \
- e-reflow-model.c \
- e-reflow.c \
+ e-selection-model.c \
e-selection-model-array.c \
e-selection-model-simple.c \
- e-selection-model.c \
+ e-send-options.c \
e-signature-combo-box.c \
- e-unicode.c \
- e-colors.c
-
+ e-signature-editor.c \
+ e-signature-manager.c \
+ e-signature-preview.c \
+ e-signature-script-dialog.c \
+ e-signature-tree-view.c \
+ e-timeout-activity.c \
+ e-url-entry.c \
+ a11y/ea-calendar-cell.c \
+ a11y/ea-calendar-item.c \
+ a11y/ea-widgets.c
libemiscwidgets_la_LDFLAGS = $(NO_UNDEFINED)
-libemiscwidgets_la_LIBADD = $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/widgets/table/libetable.la \
- $(top_builddir)/widgets/text/libetext.la \
- $(top_builddir)/a11y/widgets/libevolution-widgets-a11y.la \
- $(top_builddir)/a11y/libevolution-a11y.la \
- $(EVOLUTION_MAIL_LIBS) \
- $(GNOME_PLATFORM_LIBS) \
- $(EVOLUTON_MAIL_LIBS) \
+libemiscwidgets_la_LIBADD = \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/filter/libfilter.la \
+ $(top_builddir)/a11y/libevolution-a11y.la \
+ $(EVOLUTION_MAIL_LIBS) \
+ $(GNOME_PLATFORM_LIBS) \
+ $(MATH_LIB) \
$(ICONV_LIBS)
-filterbarinclude_HEADERS = e-filter-bar.h
-
-libefilterbar_la_SOURCES = \
- e-filter-bar.c \
- $(filterbarinclude_HEADERS)
-
-libefilterbar_la_LDFLAGS = $(NO_UNDEFINED)
-
-libefilterbar_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
- libemiscwidgets.la \
- $(E_WIDGETS_LIBS)
-
noinst_PROGRAMS = \
test-calendar \
test-dateedit \
- test-dropdown-button \
- test-multi-config-dialog \
- test-info-label
+ test-preferences-window
# test-calendar
@@ -186,6 +173,7 @@ test_calendar_SOURCES = \
test_calendar_LDADD = \
libemiscwidgets.la \
$(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/filter/libfilter.la \
$(E_WIDGETS_LIBS)
# test-dateedit
@@ -196,36 +184,18 @@ test_dateedit_SOURCES = \
test_dateedit_LDADD = \
libemiscwidgets.la \
$(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/filter/libfilter.la \
$(E_WIDGETS_LIBS)
-# test-dropdown-button
-
-test_dropdown_button_SOURCES = \
- test-dropdown-button.c
-
-test_dropdown_button_LDADD = \
- libemiscwidgets.la \
- $(top_builddir)/e-util/libeutil.la \
- $(E_WIDGETS_LIBS)
-
-# test-multi-config-dialog
-
-test_multi_config_dialog_SOURCES = \
- test-multi-config-dialog.c
-
-test_multi_config_dialog_LDADD = \
- libemiscwidgets.la \
- $(top_builddir)/e-util/libeutil.la \
- $(E_WIDGETS_LIBS)
-
-# test-info-label
+# test-preferences-window
-test_info_label_SOURCES = \
- test-info-label.c
+test_preferences_window_SOURCES = \
+ test-preferences-window.c
-test_info_label_LDADD = \
+test_preferences_window_LDADD = \
libemiscwidgets.la \
$(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/filter/libfilter.la \
$(E_WIDGETS_LIBS)
diff --git a/a11y/widgets/ea-calendar-cell.c b/widgets/misc/a11y/ea-calendar-cell.c
index 5b4e9f1d8c..2d2a92de62 100644
--- a/a11y/widgets/ea-calendar-cell.c
+++ b/widgets/misc/a11y/ea-calendar-cell.c
@@ -25,7 +25,7 @@
#include <e-util/e-util.h>
#include "ea-calendar-cell.h"
#include "ea-calendar-item.h"
-#include "ea-factory.h"
+#include "a11y/ea-factory.h"
/* ECalendarCell */
diff --git a/a11y/widgets/ea-calendar-cell.h b/widgets/misc/a11y/ea-calendar-cell.h
index be35c66312..be35c66312 100644
--- a/a11y/widgets/ea-calendar-cell.h
+++ b/widgets/misc/a11y/ea-calendar-cell.h
diff --git a/a11y/widgets/ea-calendar-item.c b/widgets/misc/a11y/ea-calendar-item.c
index fdb109d5e6..34db081692 100644
--- a/a11y/widgets/ea-calendar-item.c
+++ b/widgets/misc/a11y/ea-calendar-item.c
@@ -30,7 +30,7 @@
#include <libedataserver/e-data-server-util.h>
#include "ea-calendar-item.h"
#include "ea-calendar-cell.h"
-#include "ea-cell-table.h"
+#include "a11y/ea-cell-table.h"
#define EA_CALENDAR_COLUMN_NUM E_CALENDAR_COLS_PER_MONTH
diff --git a/a11y/widgets/ea-calendar-item.h b/widgets/misc/a11y/ea-calendar-item.h
index b5f1b0ce81..b5f1b0ce81 100644
--- a/a11y/widgets/ea-calendar-item.h
+++ b/widgets/misc/a11y/ea-calendar-item.h
diff --git a/a11y/widgets/ea-widgets.c b/widgets/misc/a11y/ea-widgets.c
index 3dca419104..9deede235e 100644
--- a/a11y/widgets/ea-widgets.c
+++ b/widgets/misc/a11y/ea-widgets.c
@@ -20,20 +20,13 @@
*
*/
-#include "ea-factory.h"
-#include "widgets/ea-calendar-item.h"
-#include "widgets/ea-combo-button.h"
+#include "a11y/ea-factory.h"
+#include "ea-calendar-item.h"
#include "ea-widgets.h"
EA_FACTORY_GOBJECT (EA_TYPE_CALENDAR_ITEM, ea_calendar_item, ea_calendar_item_new)
-EA_FACTORY (EA_TYPE_COMBO_BUTTON, ea_combo_button, ea_combo_button_new)
void e_calendar_item_a11y_init (void)
{
EA_SET_FACTORY (e_calendar_item_get_type (), ea_calendar_item);
}
-
-void e_combo_button_a11y_init (void)
-{
- EA_SET_FACTORY (e_combo_button_get_type (), ea_combo_button);
-}
diff --git a/a11y/widgets/ea-widgets.h b/widgets/misc/a11y/ea-widgets.h
index c07526f4fd..495222ae05 100644
--- a/a11y/widgets/ea-widgets.h
+++ b/widgets/misc/a11y/ea-widgets.h
@@ -28,6 +28,5 @@
#define _EA_WIDGETS_H__
void e_calendar_item_a11y_init (void);
-void e_combo_button_a11y_init (void);
#endif /* _EA_WIDGETS_H__ */
diff --git a/widgets/misc/e-account-combo-box.c b/widgets/misc/e-account-combo-box.c
index 7663f0faee..4286b0d26c 100644
--- a/widgets/misc/e-account-combo-box.c
+++ b/widgets/misc/e-account-combo-box.c
@@ -1,4 +1,5 @@
/*
+ * e-account-combo-box.c
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/widgets/misc/e-account-combo-box.h b/widgets/misc/e-account-combo-box.h
index b163278dcd..12d4be6c72 100644
--- a/widgets/misc/e-account-combo-box.h
+++ b/widgets/misc/e-account-combo-box.h
@@ -1,4 +1,5 @@
/*
+ * e-account-combo-box.h
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/widgets/misc/e-account-manager.c b/widgets/misc/e-account-manager.c
new file mode 100644
index 0000000000..24b579dee9
--- /dev/null
+++ b/widgets/misc/e-account-manager.c
@@ -0,0 +1,461 @@
+/*
+ * e-account-manager.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-account-manager.h"
+
+#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
+#include "e-util/e-binding.h"
+#include "e-account-tree-view.h"
+
+#define E_ACCOUNT_MANAGER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ACCOUNT_MANAGER, EAccountManagerPrivate))
+
+struct _EAccountManagerPrivate {
+ EAccountList *account_list;
+
+ GtkWidget *tree_view;
+ GtkWidget *add_button;
+ GtkWidget *edit_button;
+ GtkWidget *delete_button;
+ GtkWidget *default_button;
+};
+
+enum {
+ PROP_0,
+ PROP_ACCOUNT_LIST
+};
+
+enum {
+ ADD_ACCOUNT,
+ EDIT_ACCOUNT,
+ DELETE_ACCOUNT,
+ LAST_SIGNAL
+};
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+
+static void
+account_manager_default_clicked_cb (EAccountManager *manager)
+{
+ EAccountTreeView *tree_view;
+ EAccountList *account_list;
+ EAccount *account;
+
+ tree_view = e_account_manager_get_tree_view (manager);
+ account_list = e_account_manager_get_account_list (manager);
+ account = e_account_tree_view_get_selected (tree_view);
+ g_return_if_fail (account != NULL);
+
+ e_account_list_set_default (account_list, account);
+
+ /* This signals the tree view to refresh. */
+ e_account_list_change (account_list, account);
+}
+
+static gboolean
+account_manager_key_press_event_cb (EAccountManager *manager,
+ GdkEventKey *event)
+{
+ if (event->keyval == GDK_Delete) {
+ e_account_manager_delete_account (manager);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+account_manager_selection_changed_cb (EAccountManager *manager,
+ GtkTreeSelection *selection)
+{
+ EAccountTreeView *tree_view;
+ EAccountList *account_list;
+ EAccount *default_account;
+ EAccount *account;
+ GtkWidget *add_button;
+ GtkWidget *edit_button;
+ GtkWidget *delete_button;
+ GtkWidget *default_button;
+ const gchar *url = NULL;
+ gboolean has_proxies;
+ gboolean sensitive;
+
+ add_button = manager->priv->add_button;
+ edit_button = manager->priv->edit_button;
+ delete_button = manager->priv->delete_button;
+ default_button = manager->priv->default_button;
+
+ tree_view = e_account_manager_get_tree_view (manager);
+ account = e_account_tree_view_get_selected (tree_view);
+ account_list = e_account_tree_view_get_account_list (tree_view);
+
+ if (account != NULL)
+ url = e_account_get_string (account, E_ACCOUNT_SOURCE_URL);
+ else
+ gtk_widget_grab_focus (add_button);
+
+ has_proxies = (url != NULL) &&
+ e_account_list_account_has_proxies (account_list, account);
+
+ /* XXX EAccountList misuses const */
+ default_account = (EAccount *)
+ e_account_list_get_default (account_list);
+
+ sensitive = (account != NULL) && !has_proxies;
+ gtk_widget_set_sensitive (edit_button, sensitive);
+
+ sensitive = (account != NULL);
+ gtk_widget_set_sensitive (delete_button, sensitive);
+
+ sensitive = (account != NULL && account != default_account);
+ gtk_widget_set_sensitive (default_button, sensitive);
+}
+
+static void
+account_manager_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ACCOUNT_LIST:
+ e_account_manager_set_account_list (
+ E_ACCOUNT_MANAGER (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+account_manager_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ACCOUNT_LIST:
+ g_value_set_object (
+ value,
+ e_account_manager_get_account_list (
+ E_ACCOUNT_MANAGER (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+account_manager_dispose (GObject *object)
+{
+ EAccountManagerPrivate *priv;
+
+ priv = E_ACCOUNT_MANAGER_GET_PRIVATE (object);
+
+ if (priv->account_list != NULL) {
+ g_object_unref (priv->account_list);
+ priv->account_list = NULL;
+ }
+
+ if (priv->tree_view != NULL) {
+ g_object_unref (priv->tree_view);
+ priv->tree_view = NULL;
+ }
+
+ if (priv->add_button != NULL) {
+ g_object_unref (priv->add_button);
+ priv->add_button = NULL;
+ }
+
+ if (priv->edit_button != NULL) {
+ g_object_unref (priv->edit_button);
+ priv->edit_button = NULL;
+ }
+
+ if (priv->delete_button != NULL) {
+ g_object_unref (priv->delete_button);
+ priv->delete_button = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+account_manager_class_init (EAccountManagerClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EAccountManagerPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = account_manager_set_property;
+ object_class->get_property = account_manager_get_property;
+ object_class->dispose = account_manager_dispose;
+
+ /* XXX If we moved the account editor to /widgets/misc we
+ * could handle adding and editing accounts directly. */
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ACCOUNT_LIST,
+ g_param_spec_object (
+ "account-list",
+ "Account List",
+ NULL,
+ E_TYPE_ACCOUNT_LIST,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ signals[ADD_ACCOUNT] = g_signal_new (
+ "add-account",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EAccountManagerClass, add_account),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[EDIT_ACCOUNT] = g_signal_new (
+ "edit-account",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EAccountManagerClass, edit_account),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[DELETE_ACCOUNT] = g_signal_new (
+ "delete-account",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EAccountManagerClass, delete_account),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void
+account_manager_init (EAccountManager *manager)
+{
+ GtkTreeSelection *selection;
+ GtkWidget *container;
+ GtkWidget *widget;
+
+ manager->priv = E_ACCOUNT_MANAGER_GET_PRIVATE (manager);
+
+ gtk_table_resize (GTK_TABLE (manager), 1, 2);
+ gtk_table_set_col_spacings (GTK_TABLE (manager), 6);
+ gtk_table_set_row_spacings (GTK_TABLE (manager), 12);
+
+ container = GTK_WIDGET (manager);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_table_attach (
+ GTK_TABLE (container), widget, 0, 1, 0, 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = e_account_tree_view_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ manager->priv->tree_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ e_mutual_binding_new (
+ G_OBJECT (manager), "account-list",
+ G_OBJECT (widget), "account-list");
+
+ g_signal_connect_swapped (
+ widget, "key-press-event",
+ G_CALLBACK (account_manager_key_press_event_cb),
+ manager);
+
+ g_signal_connect_swapped (
+ widget, "row-activated",
+ G_CALLBACK (e_account_manager_edit_account),
+ manager);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+
+ g_signal_connect_swapped (
+ selection, "changed",
+ G_CALLBACK (account_manager_selection_changed_cb),
+ manager);
+
+ container = GTK_WIDGET (manager);
+
+ widget = gtk_vbutton_box_new ();
+ gtk_button_box_set_layout (
+ GTK_BUTTON_BOX (widget), GTK_BUTTONBOX_START);
+ gtk_box_set_spacing (GTK_BOX (widget), 6);
+ gtk_table_attach (
+ GTK_TABLE (container), widget,
+ 1, 2, 0, 2, 0, GTK_FILL, 0, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_ADD);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ manager->priv->add_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (e_account_manager_add_account), manager);
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_EDIT);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ manager->priv->edit_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (e_account_manager_edit_account), manager);
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_DELETE);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ manager->priv->delete_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (e_account_manager_delete_account), manager);
+
+ widget = gtk_button_new_with_mnemonic (_("De_fault"));
+ gtk_button_set_image (
+ GTK_BUTTON (widget), gtk_image_new_from_icon_name (
+ "emblem-default", GTK_ICON_SIZE_BUTTON));
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ manager->priv->default_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (account_manager_default_clicked_cb), manager);
+}
+
+GType
+e_account_manager_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EAccountManagerClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) account_manager_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_init */
+ sizeof (EAccountManager),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) account_manager_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_TABLE, "EAccountManager", &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_account_manager_new (EAccountList *account_list)
+{
+ g_return_val_if_fail (E_IS_ACCOUNT_LIST (account_list), NULL);
+
+ return g_object_new (
+ E_TYPE_ACCOUNT_MANAGER,
+ "account-list", account_list, NULL);
+}
+
+void
+e_account_manager_add_account (EAccountManager *manager)
+{
+ g_return_if_fail (E_IS_ACCOUNT_MANAGER (manager));
+
+ g_signal_emit (manager, signals[ADD_ACCOUNT], 0);
+}
+
+void
+e_account_manager_edit_account (EAccountManager *manager)
+{
+ g_return_if_fail (E_IS_ACCOUNT_MANAGER (manager));
+
+ g_signal_emit (manager, signals[EDIT_ACCOUNT], 0);
+}
+
+void
+e_account_manager_delete_account (EAccountManager *manager)
+{
+ g_return_if_fail (E_IS_ACCOUNT_MANAGER (manager));
+
+ g_signal_emit (manager, signals[DELETE_ACCOUNT], 0);
+}
+
+EAccountList *
+e_account_manager_get_account_list (EAccountManager *manager)
+{
+ g_return_val_if_fail (E_IS_ACCOUNT_MANAGER (manager), NULL);
+
+ return manager->priv->account_list;
+}
+
+void
+e_account_manager_set_account_list (EAccountManager *manager,
+ EAccountList *account_list)
+{
+ g_return_if_fail (E_IS_ACCOUNT_MANAGER (manager));
+
+ if (account_list != NULL) {
+ g_return_if_fail (E_IS_ACCOUNT_LIST (account_list));
+ g_object_ref (account_list);
+ }
+
+ if (manager->priv->account_list != NULL)
+ g_object_unref (manager->priv->account_list);
+
+ manager->priv->account_list = account_list;
+
+ g_object_notify (G_OBJECT (manager), "account-list");
+}
+
+EAccountTreeView *
+e_account_manager_get_tree_view (EAccountManager *manager)
+{
+ g_return_val_if_fail (E_IS_ACCOUNT_MANAGER (manager), NULL);
+
+ return E_ACCOUNT_TREE_VIEW (manager->priv->tree_view);
+}
diff --git a/widgets/misc/e-account-manager.h b/widgets/misc/e-account-manager.h
new file mode 100644
index 0000000000..dab8b2832f
--- /dev/null
+++ b/widgets/misc/e-account-manager.h
@@ -0,0 +1,82 @@
+/*
+ * e-account-manager.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_ACCOUNT_MANAGER_H
+#define E_ACCOUNT_MANAGER_H
+
+#include <gtk/gtk.h>
+#include <libedataserver/e-account-list.h>
+#include <misc/e-account-tree-view.h>
+
+/* Standard GObject macros */
+#define E_TYPE_ACCOUNT_MANAGER \
+ (e_account_manager_get_type ())
+#define E_ACCOUNT_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ACCOUNT_MANAGER, EAccountManager))
+#define E_ACCOUNT_MANAGER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ACCOUNT_MANAGER, EAccountManagerClass))
+#define E_IS_ACCOUNT_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ACCOUNT_MANAGER))
+#define E_IS_ACCOUNT_MANAGER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ACCOUNT_MANAGER))
+#define E_ACCOUNT_MANAGER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ACCOUNT_MANAGER, EAccountManagerClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EAccountManager EAccountManager;
+typedef struct _EAccountManagerClass EAccountManagerClass;
+typedef struct _EAccountManagerPrivate EAccountManagerPrivate;
+
+struct _EAccountManager {
+ GtkTable parent;
+ EAccountManagerPrivate *priv;
+};
+
+struct _EAccountManagerClass {
+ GtkTableClass parent_class;
+
+ void (*add_account) (EAccountManager *manager);
+ void (*edit_account) (EAccountManager *manager);
+ void (*delete_account) (EAccountManager *manager);
+};
+
+GType e_account_manager_get_type (void);
+GtkWidget * e_account_manager_new (EAccountList *account_list);
+void e_account_manager_add_account (EAccountManager *manager);
+void e_account_manager_edit_account (EAccountManager *manager);
+void e_account_manager_delete_account(EAccountManager *manager);
+EAccountList * e_account_manager_get_account_list
+ (EAccountManager *manager);
+void e_account_manager_set_account_list
+ (EAccountManager *manager,
+ EAccountList *account_list);
+EAccountTreeView *
+ e_account_manager_get_tree_view (EAccountManager *manager);
+
+G_END_DECLS
+
+#endif /* E_ACCOUNT_MANAGER_H */
diff --git a/widgets/misc/e-account-tree-view.c b/widgets/misc/e-account-tree-view.c
new file mode 100644
index 0000000000..8e57dfcf66
--- /dev/null
+++ b/widgets/misc/e-account-tree-view.c
@@ -0,0 +1,632 @@
+/*
+ * e-account-tree-view.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-account-tree-view.h"
+
+#include <glib/gi18n.h>
+#include <camel/camel-url.h>
+
+#define E_ACCOUNT_TREE_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ACCOUNT_TREE_VIEW, EAccountTreeViewPrivate))
+
+enum {
+ COLUMN_ACCOUNT,
+ COLUMN_DEFAULT,
+ COLUMN_ENABLED,
+ COLUMN_NAME,
+ COLUMN_PROTOCOL
+};
+
+enum {
+ PROP_0,
+ PROP_ACCOUNT_LIST,
+ PROP_SELECTED
+};
+
+enum {
+ ENABLE_ACCOUNT,
+ DISABLE_ACCOUNT,
+ REFRESHED,
+ LAST_SIGNAL
+};
+
+struct _EAccountTreeViewPrivate {
+ EAccountList *account_list;
+ GHashTable *index;
+};
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+
+static void
+account_tree_view_refresh_cb (EAccountList *account_list,
+ EAccount *account,
+ EAccountTreeView *tree_view)
+{
+ GtkListStore *store;
+ GtkTreeModel *model;
+ GtkTreeIter tree_iter;
+ EIterator *account_iter;
+ EAccount *default_account;
+ GHashTable *index;
+ GList *list = NULL;
+ GList *iter;
+
+ store = gtk_list_store_new (
+ 5, E_TYPE_ACCOUNT, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
+ G_TYPE_STRING, G_TYPE_STRING);
+ model = GTK_TREE_MODEL (store);
+ index = tree_view->priv->index;
+
+ g_hash_table_remove_all (index);
+
+ if (account_list == NULL)
+ goto skip;
+
+ /* XXX EAccountList misuses const. */
+ default_account = (EAccount *)
+ e_account_list_get_default (account_list);
+
+ /* Build a list of EAccounts to display. */
+ account_iter = e_list_get_iterator (E_LIST (account_list));
+ while (e_iterator_is_valid (account_iter)) {
+
+ /* XXX EIterator misuses const. */
+ account = (EAccount *) e_iterator_get (account_iter);
+ list = g_list_prepend (list, account);
+ e_iterator_next (account_iter);
+ }
+ g_object_unref (account_iter);
+
+ list = g_list_reverse (list);
+
+ /* Populate the list store and index. */
+ for (iter = list; iter != NULL; iter = iter->next) {
+ GtkTreeRowReference *reference;
+ GtkTreePath *path;
+ CamelURL *url = NULL;
+ gboolean is_default;
+ const gchar *protocol;
+
+ account = iter->data;
+
+ /* Skip proxy accounts. */
+ if (account->parent_uid != NULL)
+ continue;
+
+ is_default = (account == default_account);
+
+ if (account->source != NULL && account->source->url != NULL)
+ url = camel_url_new (account->source->url, NULL);
+
+ if (url != NULL && url->protocol != NULL)
+ protocol = url->protocol;
+ else
+ protocol = _("None");
+
+ gtk_list_store_append (store, &tree_iter);
+ gtk_list_store_set (
+ store, &tree_iter,
+ COLUMN_ACCOUNT, account,
+ COLUMN_DEFAULT, is_default,
+ COLUMN_ENABLED, account->enabled,
+ COLUMN_NAME, account->name,
+ COLUMN_PROTOCOL, protocol, -1);
+
+ path = gtk_tree_model_get_path (model, &tree_iter);
+ reference = gtk_tree_row_reference_new (model, path);
+ g_hash_table_insert (index, account, reference);
+ gtk_tree_path_free (path);
+
+ if (url != NULL)
+ camel_url_free (url);
+ }
+
+skip:
+ /* Restore the previously selected account. */
+ account = e_account_tree_view_get_selected (tree_view);
+ if (account != NULL)
+ g_object_ref (account);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), model);
+ e_account_tree_view_set_selected (tree_view, account);
+ if (account != NULL)
+ g_object_unref (account);
+
+ g_signal_emit (tree_view, signals[REFRESHED], 0);
+}
+
+static void
+account_tree_view_enabled_toggled_cb (EAccountTreeView *tree_view,
+ gchar *path_string,
+ GtkCellRendererToggle *renderer)
+{
+ GtkTreeSelection *selection;
+ GtkTreePath *path;
+
+ /* Change the selection first so we enable or disable the
+ * correct account. */
+ path = gtk_tree_path_new_from_string (path_string);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_path_free (path);
+
+ if (gtk_cell_renderer_toggle_get_active (renderer))
+ e_account_tree_view_disable_account (tree_view);
+ else
+ e_account_tree_view_enable_account (tree_view);
+}
+
+static void
+account_tree_view_selection_changed_cb (EAccountTreeView *tree_view)
+{
+ g_object_notify (G_OBJECT (tree_view), "selected");
+}
+
+static GObject *
+account_tree_view_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
+{
+ GObject *object;
+ GtkTreeView *tree_view;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+
+ /* Chain up to parent's constructor() method. */
+ object = G_OBJECT_CLASS (parent_class)->constructor (
+ type, n_construct_properties, construct_properties);
+
+ tree_view = GTK_TREE_VIEW (object);
+ gtk_tree_view_set_headers_visible (tree_view, TRUE);
+
+ /* Column: Enabled */
+
+ column = gtk_tree_view_column_new ();
+ gtk_tree_view_column_set_expand (column, FALSE);
+ gtk_tree_view_column_set_title (column, _("Enabled"));
+
+ renderer = gtk_cell_renderer_toggle_new ();
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+
+ g_signal_connect_swapped (
+ renderer, "toggled",
+ G_CALLBACK (account_tree_view_enabled_toggled_cb),
+ tree_view);
+
+ gtk_tree_view_column_add_attribute (
+ column, renderer, "active", COLUMN_ENABLED);
+
+ gtk_tree_view_append_column (tree_view, column);
+
+ /* Column: Account Name */
+
+ column = gtk_tree_view_column_new ();
+ gtk_tree_view_column_set_expand (column, TRUE);
+ gtk_tree_view_column_set_title (column, _("Account Name"));
+
+ renderer = gtk_cell_renderer_text_new ();
+ g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+
+ gtk_tree_view_column_add_attribute (
+ column, renderer, "text", COLUMN_NAME);
+
+ renderer = gtk_cell_renderer_text_new ();
+ g_object_set (renderer, "text", _("Default"), NULL);
+ gtk_tree_view_column_pack_end (column, renderer, FALSE);
+
+ gtk_tree_view_column_add_attribute (
+ column, renderer, "visible", COLUMN_DEFAULT);
+
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ g_object_set (
+ renderer, "icon-name", "emblem-default",
+ "stock-size", GTK_ICON_SIZE_MENU, NULL);
+ gtk_tree_view_column_pack_end (column, renderer, FALSE);
+
+ gtk_tree_view_column_add_attribute (
+ column, renderer, "visible", COLUMN_DEFAULT);
+
+ gtk_tree_view_append_column (tree_view, column);
+
+ /* Column: Protocol */
+
+ column = gtk_tree_view_column_new ();
+ gtk_tree_view_column_set_expand (column, FALSE);
+ gtk_tree_view_column_set_title (column, _("Protocol"));
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+
+ gtk_tree_view_column_add_attribute (
+ column, renderer, "text", COLUMN_PROTOCOL);
+
+ gtk_tree_view_append_column (tree_view, column);
+
+ return object;
+}
+
+static void
+account_tree_view_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ACCOUNT_LIST:
+ e_account_tree_view_set_account_list (
+ E_ACCOUNT_TREE_VIEW (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SELECTED:
+ e_account_tree_view_set_selected (
+ E_ACCOUNT_TREE_VIEW (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+account_tree_view_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ACCOUNT_LIST:
+ g_value_set_object (
+ value,
+ e_account_tree_view_get_account_list (
+ E_ACCOUNT_TREE_VIEW (object)));
+ return;
+
+ case PROP_SELECTED:
+ g_value_set_object (
+ value,
+ e_account_tree_view_get_selected (
+ E_ACCOUNT_TREE_VIEW (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+account_tree_view_dispose (GObject *object)
+{
+ EAccountTreeViewPrivate *priv;
+
+ priv = E_ACCOUNT_TREE_VIEW_GET_PRIVATE (object);
+
+ if (priv->account_list != NULL) {
+ g_signal_handlers_disconnect_by_func (
+ priv->account_list,
+ account_tree_view_refresh_cb, object);
+ g_object_unref (priv->account_list);
+ priv->account_list = NULL;
+ }
+
+ g_hash_table_remove_all (priv->index);
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+account_tree_view_finalize (GObject *object)
+{
+ EAccountTreeViewPrivate *priv;
+
+ priv = E_ACCOUNT_TREE_VIEW_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->index);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+account_tree_view_enable_account (EAccountTreeView *tree_view)
+{
+ EAccountList *account_list;
+ EAccount *account;
+
+ account = e_account_tree_view_get_selected (tree_view);
+ if (account == NULL || account->enabled)
+ return;
+
+ account_list = e_account_tree_view_get_account_list (tree_view);
+ g_return_if_fail (account_list != NULL);
+
+ account->enabled = TRUE;
+ e_account_list_change (account_list, account);
+
+ e_account_list_save (account_list);
+}
+
+static void
+account_tree_view_disable_account (EAccountTreeView *tree_view)
+{
+ EAccountList *account_list;
+ EAccount *account;
+
+ account = e_account_tree_view_get_selected (tree_view);
+ if (account == NULL || !account->enabled)
+ return;
+
+ account_list = e_account_tree_view_get_account_list (tree_view);
+ g_return_if_fail (account_list != NULL);
+
+ account->enabled = FALSE;
+ e_account_list_change (account_list, account);
+
+ e_account_list_save (account_list);
+}
+
+static void
+account_tree_view_class_init (EAccountTreeViewClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EAccountTreeViewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructor = account_tree_view_constructor;
+ object_class->set_property = account_tree_view_set_property;
+ object_class->get_property = account_tree_view_get_property;
+ object_class->dispose = account_tree_view_dispose;
+ object_class->finalize = account_tree_view_finalize;
+
+ class->enable_account = account_tree_view_enable_account;
+ class->disable_account = account_tree_view_disable_account;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SELECTED,
+ g_param_spec_object (
+ "selected",
+ "Selected Account",
+ NULL,
+ E_TYPE_ACCOUNT,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ACCOUNT_LIST,
+ g_param_spec_object (
+ "account-list",
+ "Account List",
+ NULL,
+ E_TYPE_ACCOUNT_LIST,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ signals[ENABLE_ACCOUNT] = g_signal_new (
+ "enable-account",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EAccountTreeViewClass, enable_account),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[DISABLE_ACCOUNT] = g_signal_new (
+ "disable-account",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EAccountTreeViewClass, disable_account),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[REFRESHED] = g_signal_new (
+ "refreshed",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EAccountTreeViewClass, refreshed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void
+account_tree_view_init (EAccountTreeView *tree_view)
+{
+ GHashTable *index;
+ GtkTreeSelection *selection;
+
+ /* Reverse-lookup index */
+ index = g_hash_table_new_full (
+ g_direct_hash, g_direct_equal,
+ (GDestroyNotify) g_object_unref,
+ (GDestroyNotify) gtk_tree_row_reference_free);
+
+ tree_view->priv = E_ACCOUNT_TREE_VIEW_GET_PRIVATE (tree_view);
+ tree_view->priv->index = index;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
+
+ g_signal_connect_swapped (
+ selection, "changed",
+ G_CALLBACK (account_tree_view_selection_changed_cb),
+ tree_view);
+}
+
+GType
+e_account_tree_view_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EAccountTreeViewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) account_tree_view_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EAccountTreeView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) account_tree_view_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_TREE_VIEW, "EAccountTreeView",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_account_tree_view_new (void)
+{
+ return g_object_new (E_TYPE_ACCOUNT_TREE_VIEW, NULL);
+}
+
+void
+e_account_tree_view_enable_account (EAccountTreeView *tree_view)
+{
+ g_return_if_fail (E_IS_ACCOUNT_TREE_VIEW (tree_view));
+
+ g_signal_emit (tree_view, signals[ENABLE_ACCOUNT], 0);
+}
+
+void
+e_account_tree_view_disable_account (EAccountTreeView *tree_view)
+{
+ g_return_if_fail (E_IS_ACCOUNT_TREE_VIEW (tree_view));
+
+ g_signal_emit (tree_view, signals[DISABLE_ACCOUNT], 0);
+}
+
+EAccountList *
+e_account_tree_view_get_account_list (EAccountTreeView *tree_view)
+{
+ g_return_val_if_fail (E_IS_ACCOUNT_TREE_VIEW (tree_view), NULL);
+
+ return tree_view->priv->account_list;
+}
+
+void
+e_account_tree_view_set_account_list (EAccountTreeView *tree_view,
+ EAccountList *account_list)
+{
+ EAccountTreeViewPrivate *priv;
+
+ g_return_if_fail (E_IS_ACCOUNT_TREE_VIEW (tree_view));
+
+ if (account_list != NULL)
+ g_return_if_fail (E_IS_ACCOUNT_LIST (account_list));
+
+ priv = E_ACCOUNT_TREE_VIEW_GET_PRIVATE (tree_view);
+
+ if (priv->account_list != NULL) {
+ g_signal_handlers_disconnect_by_func (
+ priv->account_list,
+ account_tree_view_refresh_cb, tree_view);
+ g_object_unref (priv->account_list);
+ priv->account_list = NULL;
+ }
+
+ if (account_list != NULL) {
+ priv->account_list = g_object_ref (account_list);
+
+ /* Listen for changes to the account list. */
+ g_signal_connect (
+ priv->account_list, "account-added",
+ G_CALLBACK (account_tree_view_refresh_cb),
+ tree_view);
+ g_signal_connect (
+ priv->account_list, "account-changed",
+ G_CALLBACK (account_tree_view_refresh_cb),
+ tree_view);
+ g_signal_connect (
+ priv->account_list, "account-removed",
+ G_CALLBACK (account_tree_view_refresh_cb),
+ tree_view);
+ }
+
+ account_tree_view_refresh_cb (account_list, NULL, tree_view);
+
+ g_object_notify (G_OBJECT (tree_view), "account-list");
+}
+
+EAccount *
+e_account_tree_view_get_selected (EAccountTreeView *tree_view)
+{
+ EAccount *account;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ g_return_val_if_fail (E_IS_ACCOUNT_TREE_VIEW (tree_view), NULL);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return NULL;
+
+ gtk_tree_model_get (model, &iter, COLUMN_ACCOUNT, &account, -1);
+
+ return account;
+}
+
+gboolean
+e_account_tree_view_set_selected (EAccountTreeView *tree_view,
+ EAccount *account)
+{
+ GtkTreeRowReference *reference;
+ GtkTreeSelection *selection;
+ GtkTreePath *path;
+
+ g_return_val_if_fail (E_IS_ACCOUNT_TREE_VIEW (tree_view), FALSE);
+
+ if (account != NULL)
+ g_return_val_if_fail (E_IS_ACCOUNT (account), FALSE);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
+
+ /* NULL means clear the selection. */
+ if (account == NULL) {
+ gtk_tree_selection_unselect_all (selection);
+ return TRUE;
+ }
+
+ /* Lookup the tree row reference for the account. */
+ reference = g_hash_table_lookup (tree_view->priv->index, account);
+ if (reference == NULL)
+ return FALSE;
+
+ /* Select the referenced path. */
+ path = gtk_tree_row_reference_get_path (reference);
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_path_free (path);
+
+ g_object_notify (G_OBJECT (tree_view), "selected");
+
+ return TRUE;
+}
diff --git a/widgets/misc/e-account-tree-view.h b/widgets/misc/e-account-tree-view.h
new file mode 100644
index 0000000000..ea13dc3902
--- /dev/null
+++ b/widgets/misc/e-account-tree-view.h
@@ -0,0 +1,84 @@
+/*
+ * e-account-tree-view.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_ACCOUNT_TREE_VIEW_H
+#define E_ACCOUNT_TREE_VIEW_H
+
+#include <gtk/gtk.h>
+#include <libedataserver/e-account.h>
+#include <libedataserver/e-account-list.h>
+
+/* Standard GObject macros */
+#define E_TYPE_ACCOUNT_TREE_VIEW \
+ (e_account_tree_view_get_type ())
+#define E_ACCOUNT_TREE_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ACCOUNT_TREE_VIEW, EAccountTreeView))
+#define E_ACCOUNT_TREE_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ACCOUNT_TREE_VIEW, EAccountTreeViewClass))
+#define E_IS_ACCOUNT_TREE_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ACCOUNT_TREE_VIEW))
+#define E_IS_ACCOUNT_TREE_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ACCOUNT_TREE_VIEW))
+#define E_ACCOUNT_TREE_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ACCOUNT_TREE_VIEW, EAccountTreeViewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EAccountTreeView EAccountTreeView;
+typedef struct _EAccountTreeViewClass EAccountTreeViewClass;
+typedef struct _EAccountTreeViewPrivate EAccountTreeViewPrivate;
+
+struct _EAccountTreeView {
+ GtkTreeView parent;
+ EAccountTreeViewPrivate *priv;
+};
+
+struct _EAccountTreeViewClass {
+ GtkTreeViewClass parent_class;
+
+ void (*enable_account) (EAccountTreeView *tree_view);
+ void (*disable_account) (EAccountTreeView *tree_view);
+ void (*refreshed) (EAccountTreeView *tree_view);
+};
+
+GType e_account_tree_view_get_type (void);
+GtkWidget * e_account_tree_view_new (void);
+void e_account_tree_view_enable_account
+ (EAccountTreeView *tree_view);
+void e_account_tree_view_disable_account
+ (EAccountTreeView *tree_view);
+EAccountList * e_account_tree_view_get_account_list
+ (EAccountTreeView *tree_view);
+void e_account_tree_view_set_account_list
+ (EAccountTreeView *tree_view,
+ EAccountList *account_list);
+EAccount * e_account_tree_view_get_selected(EAccountTreeView *tree_view);
+gboolean e_account_tree_view_set_selected(EAccountTreeView *tree_view,
+ EAccount *account);
+
+G_END_DECLS
+
+#endif /* E_ACCOUNT_TREE_VIEW_H */
diff --git a/widgets/misc/e-action-combo-box.c b/widgets/misc/e-action-combo-box.c
new file mode 100644
index 0000000000..e8a9be51ed
--- /dev/null
+++ b/widgets/misc/e-action-combo-box.c
@@ -0,0 +1,582 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-action-combo-box.c
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser 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 Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "e-action-combo-box.h"
+
+#include <glib/gi18n.h>
+
+#define E_ACTION_COMBO_BOX_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ACTION_COMBO_BOX, EActionComboBoxPrivate))
+
+enum {
+ COLUMN_ACTION,
+ COLUMN_SORT
+};
+
+enum {
+ PROP_0,
+ PROP_ACTION
+};
+
+struct _EActionComboBoxPrivate {
+ GtkRadioAction *action;
+ GtkActionGroup *action_group;
+ GHashTable *index;
+ guint changed_handler_id; /* action::changed */
+ guint group_sensitive_handler_id; /* action-group::sensitive */
+ guint group_visible_handler_id; /* action-group::visible */
+ gboolean group_has_icons : 1;
+};
+
+static gpointer parent_class;
+
+static void
+action_combo_box_action_changed_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EActionComboBox *combo_box)
+{
+ GtkTreeRowReference *reference;
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ gboolean valid;
+
+ reference = g_hash_table_lookup (
+ combo_box->priv->index, GINT_TO_POINTER (
+ gtk_radio_action_get_current_value (current)));
+ g_return_if_fail (reference != NULL);
+
+ model = gtk_tree_row_reference_get_model (reference);
+ path = gtk_tree_row_reference_get_path (reference);
+ valid = gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_path_free (path);
+ g_return_if_fail (valid);
+
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
+}
+
+static void
+action_combo_box_action_group_notify_cb (GtkActionGroup *action_group,
+ GParamSpec *pspec,
+ EActionComboBox *combo_box)
+{
+ g_object_set (
+ combo_box, "sensitive",
+ gtk_action_group_get_sensitive (action_group), "visible",
+ gtk_action_group_get_visible (action_group), NULL);
+}
+
+static void
+action_combo_box_render_pixbuf (GtkCellLayout *layout,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ EActionComboBox *combo_box)
+{
+ GtkRadioAction *action;
+ gchar *icon_name;
+ gchar *stock_id;
+ gboolean sensitive;
+ gboolean visible;
+ gint width;
+
+ gtk_tree_model_get (model, iter, COLUMN_ACTION, &action, -1);
+
+ /* Do any of the actions have an icon? */
+ if (!combo_box->priv->group_has_icons)
+ return;
+
+ /* A NULL action means the row is a separator. */
+ if (action == NULL)
+ return;
+
+ g_object_get (
+ G_OBJECT (action),
+ "icon-name", &icon_name,
+ "sensitive", &sensitive,
+ "stock-id", &stock_id,
+ "visible", &visible,
+ NULL);
+
+ /* Keep the pixbuf renderer a fixed size for proper alignment. */
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, NULL);
+
+ /* We can't set both "icon-name" and "stock-id" because setting
+ * one unsets the other. So pick the one that has a non-NULL
+ * value. If both are non-NULL, "stock-id" wins. */
+
+ if (stock_id != NULL)
+ g_object_set (
+ G_OBJECT (renderer),
+ "sensitive", sensitive,
+ "stock-id", stock_id,
+ "stock-size", GTK_ICON_SIZE_MENU,
+ "visible", visible,
+ "width", width,
+ NULL);
+ else
+ g_object_set (
+ G_OBJECT (renderer),
+ "icon-name", icon_name,
+ "sensitive", sensitive,
+ "stock-size", GTK_ICON_SIZE_MENU,
+ "visible", visible,
+ "width", width,
+ NULL);
+
+ g_free (icon_name);
+ g_free (stock_id);
+}
+
+static void
+action_combo_box_render_text (GtkCellLayout *layout,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ EActionComboBox *combo_box)
+{
+ GtkRadioAction *action;
+ gchar **strv;
+ gchar *label;
+ gboolean sensitive;
+ gboolean visible;
+ gint xpad;
+
+ gtk_tree_model_get (model, iter, COLUMN_ACTION, &action, -1);
+
+ /* A NULL action means the row is a separator. */
+ if (action == NULL)
+ return;
+
+ g_object_get (
+ G_OBJECT (action),
+ "label", &label,
+ "sensitive", &sensitive,
+ "visible", &visible,
+ NULL);
+
+ /* Strip out underscores. */
+ strv = g_strsplit (label, "_", -1);
+ g_free (label);
+ label = g_strjoinv (NULL, strv);
+ g_strfreev (strv);
+
+ xpad = combo_box->priv->group_has_icons ? 3 : 0;
+
+ g_object_set (
+ G_OBJECT (renderer),
+ "sensitive", sensitive,
+ "text", label,
+ "visible", visible,
+ "xpad", xpad,
+ NULL);
+
+ g_free (label);
+}
+
+static gboolean
+action_combo_box_is_row_separator (GtkTreeModel *model,
+ GtkTreeIter *iter)
+{
+ GtkAction *action;
+ gboolean separator;
+
+ /* NULL actions are rendered as separators. */
+ gtk_tree_model_get (model, iter, COLUMN_ACTION, &action, -1);
+ separator = (action == NULL);
+ if (action != NULL)
+ g_object_unref (action);
+
+ return separator;
+}
+
+static void
+action_combo_box_update_model (EActionComboBox *combo_box)
+{
+ GtkListStore *list_store;
+ GSList *list;
+
+ g_hash_table_remove_all (combo_box->priv->index);
+
+ if (combo_box->priv->action == NULL) {
+ gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), NULL);
+ return;
+ }
+
+ /* We store values in the sort column as floats so that we can
+ * insert separators in between consecutive integer values and
+ * still maintain the proper ordering. */
+ list_store = gtk_list_store_new (
+ 2, GTK_TYPE_RADIO_ACTION, G_TYPE_FLOAT);
+
+ list = gtk_radio_action_get_group (combo_box->priv->action);
+ combo_box->priv->group_has_icons = FALSE;
+
+ while (list != NULL) {
+ GtkTreeRowReference *reference;
+ GtkRadioAction *action = list->data;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ gchar *icon_name;
+ gchar *stock_id;
+ gint value;
+
+ g_object_get (
+ action, "icon-name", &icon_name,
+ "stock-id", &stock_id, NULL);
+ combo_box->priv->group_has_icons |=
+ (icon_name != NULL || stock_id != NULL);
+ g_free (icon_name);
+ g_free (stock_id);
+
+ gtk_list_store_append (list_store, &iter);
+ g_object_get (G_OBJECT (action), "value", &value, NULL);
+ gtk_list_store_set (
+ list_store, &iter, COLUMN_ACTION,
+ list->data, COLUMN_SORT, (gfloat) value, -1);
+
+ path = gtk_tree_model_get_path (
+ GTK_TREE_MODEL (list_store), &iter);
+ reference = gtk_tree_row_reference_new (
+ GTK_TREE_MODEL (list_store), path);
+ g_hash_table_insert (
+ combo_box->priv->index,
+ GINT_TO_POINTER (value), reference);
+ gtk_tree_path_free (path);
+
+ list = g_slist_next (list);
+ }
+
+ gtk_tree_sortable_set_sort_column_id (
+ GTK_TREE_SORTABLE (list_store),
+ COLUMN_SORT, GTK_SORT_ASCENDING);
+ gtk_combo_box_set_model (
+ GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (list_store));
+
+ action_combo_box_action_changed_cb (
+ combo_box->priv->action,
+ combo_box->priv->action,
+ combo_box);
+}
+
+static void
+action_combo_box_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ACTION:
+ e_action_combo_box_set_action (
+ E_ACTION_COMBO_BOX (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+action_combo_box_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ACTION:
+ g_value_set_object (
+ value, e_action_combo_box_get_action (
+ E_ACTION_COMBO_BOX (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+action_combo_box_dispose (GObject *object)
+{
+ EActionComboBoxPrivate *priv = E_ACTION_COMBO_BOX_GET_PRIVATE (object);
+
+ if (priv->action != NULL) {
+ g_object_unref (priv->action);
+ priv->action = NULL;
+ }
+
+ if (priv->action_group != NULL) {
+ g_object_unref (priv->action_group);
+ priv->action_group = NULL;
+ }
+
+ g_hash_table_remove_all (priv->index);
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+action_combo_box_finalize (GObject *object)
+{
+ EActionComboBoxPrivate *priv = E_ACTION_COMBO_BOX_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->index);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+action_combo_box_changed (GtkComboBox *combo_box)
+{
+ GtkRadioAction *action;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint value;
+
+ /* This method is virtual, so no need to chain up. */
+
+ if (!gtk_combo_box_get_active_iter (combo_box, &iter))
+ return;
+
+ model = gtk_combo_box_get_model (combo_box);
+ gtk_tree_model_get (model, &iter, COLUMN_ACTION, &action, -1);
+ g_object_get (G_OBJECT (action), "value", &value, NULL);
+ gtk_radio_action_set_current_value (action, value);
+}
+
+static void
+action_combo_box_class_init (EActionComboBoxClass *class)
+{
+ GObjectClass *object_class;
+ GtkComboBoxClass *combo_box_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EActionComboBoxPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = action_combo_box_set_property;
+ object_class->get_property = action_combo_box_get_property;
+ object_class->dispose = action_combo_box_dispose;
+ object_class->finalize = action_combo_box_finalize;
+
+ combo_box_class = GTK_COMBO_BOX_CLASS (class);
+ combo_box_class->changed = action_combo_box_changed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ACTION,
+ g_param_spec_object (
+ "action",
+ _("Action"),
+ _("A GtkRadioAction"),
+ GTK_TYPE_RADIO_ACTION,
+ G_PARAM_READWRITE));
+}
+
+static void
+action_combo_box_init (EActionComboBox *combo_box)
+{
+ GtkCellRenderer *renderer;
+
+ combo_box->priv = E_ACTION_COMBO_BOX_GET_PRIVATE (combo_box);
+
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_cell_layout_pack_start (
+ GTK_CELL_LAYOUT (combo_box), renderer, FALSE);
+ gtk_cell_layout_set_cell_data_func (
+ GTK_CELL_LAYOUT (combo_box), renderer,
+ (GtkCellLayoutDataFunc) action_combo_box_render_pixbuf,
+ combo_box, NULL);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (
+ GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
+ gtk_cell_layout_set_cell_data_func (
+ GTK_CELL_LAYOUT (combo_box), renderer,
+ (GtkCellLayoutDataFunc) action_combo_box_render_text,
+ combo_box, NULL);
+
+ gtk_combo_box_set_row_separator_func (
+ GTK_COMBO_BOX (combo_box), (GtkTreeViewRowSeparatorFunc)
+ action_combo_box_is_row_separator, NULL, NULL);
+
+ combo_box->priv->index = g_hash_table_new_full (
+ g_direct_hash, g_direct_equal,
+ (GDestroyNotify) NULL,
+ (GDestroyNotify) gtk_tree_row_reference_free);
+}
+
+GType
+e_action_combo_box_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EActionComboBoxClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) action_combo_box_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EActionComboBox),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) action_combo_box_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_COMBO_BOX, "EActionComboBox",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_action_combo_box_new (void)
+{
+ return e_action_combo_box_new_with_action (NULL);
+}
+
+GtkWidget *
+e_action_combo_box_new_with_action (GtkRadioAction *action)
+{
+ return g_object_new (E_TYPE_ACTION_COMBO_BOX, "action", action, NULL);
+}
+
+GtkRadioAction *
+e_action_combo_box_get_action (EActionComboBox *combo_box)
+{
+ g_return_val_if_fail (E_ACTION_IS_COMBO_BOX (combo_box), NULL);
+
+ return combo_box->priv->action;
+}
+
+void
+e_action_combo_box_set_action (EActionComboBox *combo_box,
+ GtkRadioAction *action)
+{
+ g_return_if_fail (E_ACTION_IS_COMBO_BOX (combo_box));
+
+ if (action != NULL)
+ g_return_if_fail (GTK_IS_RADIO_ACTION (action));
+
+ if (combo_box->priv->action != NULL) {
+ g_signal_handler_disconnect (
+ combo_box->priv->action,
+ combo_box->priv->changed_handler_id);
+ g_object_unref (combo_box->priv->action);
+ }
+
+ if (combo_box->priv->action_group != NULL) {
+ g_signal_handler_disconnect (
+ combo_box->priv->action_group,
+ combo_box->priv->group_sensitive_handler_id);
+ g_signal_handler_disconnect (
+ combo_box->priv->action_group,
+ combo_box->priv->group_visible_handler_id);
+ g_object_unref (combo_box->priv->action_group);
+ combo_box->priv->action_group = NULL;
+ }
+
+ if (action != NULL)
+ g_object_get (
+ g_object_ref (action), "action-group",
+ &combo_box->priv->action_group, NULL);
+ combo_box->priv->action = action;
+ action_combo_box_update_model (combo_box);
+
+ if (combo_box->priv->action != NULL)
+ combo_box->priv->changed_handler_id = g_signal_connect (
+ combo_box->priv->action, "changed",
+ G_CALLBACK (action_combo_box_action_changed_cb),
+ combo_box);
+
+ if (combo_box->priv->action_group != NULL) {
+ combo_box->priv->group_sensitive_handler_id =
+ g_signal_connect (
+ combo_box->priv->action_group,
+ "notify::sensitive", G_CALLBACK (
+ action_combo_box_action_group_notify_cb),
+ combo_box);
+ combo_box->priv->group_visible_handler_id =
+ g_signal_connect (
+ combo_box->priv->action_group,
+ "notify::visible", G_CALLBACK (
+ action_combo_box_action_group_notify_cb),
+ combo_box);
+ }
+}
+
+gint
+e_action_combo_box_get_current_value (EActionComboBox *combo_box)
+{
+ g_return_val_if_fail (E_ACTION_IS_COMBO_BOX (combo_box), 0);
+ g_return_val_if_fail (combo_box->priv->action != NULL, 0);
+
+ return gtk_radio_action_get_current_value (combo_box->priv->action);
+}
+
+void
+e_action_combo_box_set_current_value (EActionComboBox *combo_box,
+ gint current_value)
+{
+ g_return_if_fail (E_ACTION_IS_COMBO_BOX (combo_box));
+ g_return_if_fail (combo_box->priv->action != NULL);
+
+ gtk_radio_action_set_current_value (
+ combo_box->priv->action, current_value);
+}
+
+void
+e_action_combo_box_add_separator_before (EActionComboBox *combo_box,
+ gint action_value)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ g_return_if_fail (E_ACTION_IS_COMBO_BOX (combo_box));
+
+ /* NULL actions are rendered as separators. */
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (
+ GTK_LIST_STORE (model), &iter, COLUMN_ACTION,
+ NULL, COLUMN_SORT, (gfloat) action_value - 0.5, -1);
+}
+
+void
+e_action_combo_box_add_separator_after (EActionComboBox *combo_box,
+ gint action_value)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ g_return_if_fail (E_ACTION_IS_COMBO_BOX (combo_box));
+
+ /* NULL actions are rendered as separators. */
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (
+ GTK_LIST_STORE (model), &iter, COLUMN_ACTION,
+ NULL, COLUMN_SORT, (gfloat) action_value + 0.5, -1);
+}
diff --git a/widgets/misc/e-action-combo-box.h b/widgets/misc/e-action-combo-box.h
new file mode 100644
index 0000000000..300338639a
--- /dev/null
+++ b/widgets/misc/e-action-combo-box.h
@@ -0,0 +1,85 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-action-combo-box.h
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser 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 Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef E_ACTION_COMBO_BOX_H
+#define E_ACTION_COMBO_BOX_H
+
+/* This is a GtkComboBox that is driven by a group of GtkRadioActions.
+ * Just plug in a GtkRadioAction and the widget will handle the rest.
+ * (Based on GtkhtmlComboBox.) */
+
+#include <gtk/gtk.h>
+
+/* Standard GObject macros */
+#define E_TYPE_ACTION_COMBO_BOX \
+ (e_action_combo_box_get_type ())
+#define E_ACTION_COMBO_BOX(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ACTION_COMBO_BOX, EActionComboBox))
+#define E_ACTION_COMBO_BOX_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ACTION_COMBO_BOX, EActionComboBoxClass))
+#define E_ACTION_IS_COMBO_BOX(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ACTION_COMBO_BOX))
+#define E_ACTION_IS_COMBO_BOX_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ACTION_COMBO_BOX))
+#define E_ACTION_COMBO_BOX_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ACTION_COMBO_BOX, EActionComboBoxClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EActionComboBox EActionComboBox;
+typedef struct _EActionComboBoxClass EActionComboBoxClass;
+typedef struct _EActionComboBoxPrivate EActionComboBoxPrivate;
+
+struct _EActionComboBox {
+ GtkComboBox parent;
+ EActionComboBoxPrivate *priv;
+};
+
+struct _EActionComboBoxClass {
+ GtkComboBoxClass parent_class;
+};
+
+GType e_action_combo_box_get_type (void);
+GtkWidget * e_action_combo_box_new (void);
+GtkWidget * e_action_combo_box_new_with_action
+ (GtkRadioAction *action);
+GtkRadioAction *e_action_combo_box_get_action (EActionComboBox *combo_box);
+void e_action_combo_box_set_action (EActionComboBox *combo_box,
+ GtkRadioAction *action);
+gint e_action_combo_box_get_current_value
+ (EActionComboBox *combo_box);
+void e_action_combo_box_set_current_value
+ (EActionComboBox *combo_box,
+ gint current_value);
+void e_action_combo_box_add_separator_before
+ (EActionComboBox *combo_box,
+ gint action_value);
+void e_action_combo_box_add_separator_after
+ (EActionComboBox *combo_box,
+ gint action_value);
+
+G_END_DECLS
+
+#endif /* E_ACTION_COMBO_BOX_H */
diff --git a/widgets/misc/e-activity-handler.c b/widgets/misc/e-activity-handler.c
deleted file mode 100644
index dd0bd60e9b..0000000000
--- a/widgets/misc/e-activity-handler.c
+++ /dev/null
@@ -1,700 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-activity-handler.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include <misc/e-popup-menu.h>
-
-#define ICON_SIZE 16
-
-
-struct _ActivityInfo {
- char *component_id;
- int error_type;
- guint id;
- char *information;
- gboolean cancellable;
- double progress;
- GtkWidget *menu;
- void (*cancel_func) (gpointer data);
- gpointer data;
- gpointer error;
- time_t error_time;
-};
-typedef struct _ActivityInfo ActivityInfo;
-
-struct _EActivityHandlerPrivate {
- guint next_activity_id;
- GList *activity_infos;
- GSList *task_bars;
- ELogger *logger;
- guint error_timer;
- guint error_flush_interval;
-
-};
-
-/* In the status bar, we show only errors and info. Errors are pictured as warnings. */
-const char *icon_data [] = {"dialog-warning", "dialog-information"};
-
-G_DEFINE_TYPE (EActivityHandler, e_activity_handler, G_TYPE_OBJECT)
-
-/* Utility functions. */
-
-static void handle_error (ETaskWidget *task);
-
-static unsigned int
-get_new_activity_id (EActivityHandler *activity_handler)
-{
- EActivityHandlerPrivate *priv;
-
- priv = activity_handler->priv;
-
- return priv->next_activity_id ++;
-}
-
-static GList *
-lookup_activity (GList *list,
- guint activity_id,
- int *order_number_return)
-{
- GList *p;
- int i;
-
- for (p = list, i = 0; p != NULL; p = p->next, i ++) {
- ActivityInfo *activity_info;
-
- activity_info = (ActivityInfo *) p->data;
- if (activity_info->id == activity_id) {
- *order_number_return = i;
- return p;
- }
- }
-
- *order_number_return = -1;
- return NULL;
-}
-
-
-/* ETaskWidget actions. */
-
-static int
-task_widget_button_press_event_callback (GtkWidget *widget,
- GdkEventButton *button_event,
- void *data)
-{
- ActivityInfo *activity_info;
-
- activity_info = (ActivityInfo *) data;
-
- if (button_event->button == 3)
- return activity_info->cancellable;
-
- if (button_event->button != 1)
- return FALSE;
-
- return TRUE;
-}
-
-
-/* Creating and destroying ActivityInfos. */
-
-static ActivityInfo *
-activity_info_new (const char *component_id,
- guint id,
- const char *information,
- gboolean cancellable)
-{
- ActivityInfo *info;
-
- info = g_new (ActivityInfo, 1);
- info->component_id = g_strdup (component_id);
- info->id = id;
- info->information = g_strdup (information);
- info->cancellable = cancellable;
- info->progress = -1.0; /* (Unknown) */
- info->menu = NULL;
- info->error = NULL;
- info->cancel_func = NULL;
-
- return info;
-}
-
-static void
-activity_info_free (ActivityInfo *info)
-{
- g_free (info->component_id);
- g_free (info->information);
-
- if (info->menu != NULL)
- gtk_widget_destroy (info->menu);
-
- g_free (info);
-}
-
-static ETaskWidget *
-task_widget_new_from_activity_info (ActivityInfo *activity_info)
-{
- GtkWidget *widget;
- ETaskWidget *etw;
-
- widget = e_task_widget_new_with_cancel (
- activity_info->component_id,
- activity_info->information,
- activity_info->cancel_func,
- activity_info->data);
- etw = (ETaskWidget *) widget;
- etw->id = activity_info->id;
- gtk_widget_show (widget);
-
- g_signal_connect (widget, "button_press_event",
- G_CALLBACK (task_widget_button_press_event_callback),
- activity_info);
-
- return E_TASK_WIDGET (widget);
-}
-
-
-/* Task Bar handling. */
-
-static void
-setup_task_bar (EActivityHandler *activity_handler,
- ETaskBar *task_bar)
-{
- EActivityHandlerPrivate *priv;
- GList *p;
-
- priv = activity_handler->priv;
-
- for (p = g_list_last (priv->activity_infos); p != NULL; p = p->prev) {
- ActivityInfo *info = p->data;
- ETaskWidget *task_widget = task_widget_new_from_activity_info (info);
- task_widget->id = info->id;
- e_task_bar_prepend_task (task_bar, task_widget);
- if (info->error) {
- /* Prepare to handle existing errors*/
- GtkWidget *tool;
- const char *stock;
-
- stock = info->error_type ? icon_data [1] : icon_data[0];
- tool = e_task_widget_update_image (task_widget, (char *)stock, info->information);
- g_object_set_data ((GObject *) task_widget, "tool", tool);
- g_object_set_data ((GObject *) task_widget, "error", info->error);
- g_object_set_data ((GObject *) task_widget, "activity-handler", activity_handler);
- g_object_set_data ((GObject *) task_widget, "activity", GINT_TO_POINTER(info->id));
- g_object_set_data ((GObject *) task_widget, "error-type", GINT_TO_POINTER(info->error_type));
- g_signal_connect_swapped (tool, "clicked", G_CALLBACK(handle_error), task_widget);
- }
- }
-}
-
-static void
-task_bar_destroy_notify (void *data,
- GObject *task_bar_instance)
-{
- EActivityHandler *activity_handler;
- EActivityHandlerPrivate *priv;
-
- activity_handler = E_ACTIVITY_HANDLER (data);
- priv = activity_handler->priv;
-
- priv->task_bars = g_slist_remove (priv->task_bars, task_bar_instance);
-}
-
-
-/* GObject methods. */
-
-static void
-impl_dispose (GObject *object)
-{
- EActivityHandler *handler;
- EActivityHandlerPrivate *priv;
- GList *p;
- GSList *sp;
-
- handler = E_ACTIVITY_HANDLER (object);
- priv = handler->priv;
-
- for (p = priv->activity_infos; p != NULL; p = p->next) {
- ActivityInfo *info;
-
- info = (ActivityInfo *) p->data;
- activity_info_free (info);
- }
-
- g_list_free (priv->activity_infos);
- priv->activity_infos = NULL;
-
- for (sp = priv->task_bars; sp != NULL; sp = sp->next)
- g_object_weak_unref (G_OBJECT (sp->data), task_bar_destroy_notify, handler);
- priv->task_bars = NULL;
-
- (* G_OBJECT_CLASS (e_activity_handler_parent_class)->dispose) (object);
-}
-
-static void
-impl_finalize (GObject *object)
-{
- EActivityHandler *handler;
- EActivityHandlerPrivate *priv;
-
- handler = E_ACTIVITY_HANDLER (object);
- priv = handler->priv;
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (e_activity_handler_parent_class)->finalize) (object);
-}
-
-static void
-e_activity_handler_class_init (EActivityHandlerClass *activity_handler_class)
-{
- GObjectClass *object_class = (GObjectClass *) activity_handler_class;
-
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
-}
-
-static void
-e_activity_handler_init (EActivityHandler *activity_handler)
-{
- EActivityHandlerPrivate *priv;
-
- priv = g_new (EActivityHandlerPrivate, 1);
- priv->next_activity_id = 1;
- priv->activity_infos = NULL;
- priv->task_bars = NULL;
- priv->logger = NULL;
- priv->error_timer = 0;
- priv->error_flush_interval = 0;
- activity_handler->priv = priv;
-}
-
-
-EActivityHandler *
-e_activity_handler_new (void)
-{
- return g_object_new (e_activity_handler_get_type (), NULL);
-}
-
-void
-e_activity_handler_set_error_flush_time (EActivityHandler *handler, int time)
-{
- handler->priv->error_flush_interval = time;
-}
-void
-e_activity_handler_set_logger (EActivityHandler *handler, ELogger *logger)
-{
- handler->priv->logger = logger;
-}
-
-void
-e_activity_handler_set_message (EActivityHandler *activity_handler,
- const char *message)
-{
- EActivityHandlerPrivate *priv;
- GSList *i;
-
- priv = activity_handler->priv;
-
- for (i = priv->task_bars; i; i = i->next)
- e_task_bar_set_message (E_TASK_BAR (i->data), message);
-}
-
-void
-e_activity_handler_unset_message (EActivityHandler *activity_handler)
-{
- EActivityHandlerPrivate *priv;
- GSList *i;
-
- priv = activity_handler->priv;
-
- for (i = priv->task_bars; i; i = i->next)
- e_task_bar_unset_message (E_TASK_BAR (i->data));
-}
-
-void
-e_activity_handler_attach_task_bar (EActivityHandler *activity_handler,
- ETaskBar *task_bar)
-{
- EActivityHandlerPrivate *priv;
-
- g_return_if_fail (activity_handler != NULL);
- g_return_if_fail (E_IS_ACTIVITY_HANDLER (activity_handler));
- g_return_if_fail (task_bar != NULL);
- g_return_if_fail (E_IS_TASK_BAR (task_bar));
-
- priv = activity_handler->priv;
-
- g_object_weak_ref (G_OBJECT (task_bar), task_bar_destroy_notify, activity_handler);
-
- priv->task_bars = g_slist_prepend (priv->task_bars, task_bar);
-
- setup_task_bar (activity_handler, task_bar);
-}
-
-struct _cancel_wdata {
- EActivityHandler *handler;
- ActivityInfo *info;
- guint id;
- void (*cancel)(gpointer);
- gpointer data;
-};
-
-static void
-cancel_wrapper (gpointer pdata)
-{
- struct _cancel_wdata *data = (struct _cancel_wdata *) pdata;
- /* This can be invoked in two scenario. Either to cancel or to hide error */
- if (data->info->error) {
- /* Hide the error */
- EActivityHandler *handler = data->handler;
- ActivityInfo *info;
- int order, len;
- GSList *sp;
- GList *p = lookup_activity (handler->priv->activity_infos, data->id, &order);
- e_logger_log (handler->priv->logger, E_LOG_ERROR, g_object_get_data (data->info->error, "primary"),
- g_object_get_data (data->info->error, "secondary"));
- gtk_widget_destroy (data->info->error);
- data->info->error = NULL;
- info = data->info;
- for (sp = handler->priv->task_bars; sp != NULL; sp = sp->next) {
- ETaskBar *task_bar;
-
- task_bar = E_TASK_BAR (sp->data);
- e_task_bar_remove_task_from_id (task_bar, info->id);
- }
- activity_info_free (info);
- len = g_list_length (handler->priv->activity_infos);
- handler->priv->activity_infos = g_list_remove_link (handler->priv->activity_infos, p);
- if (len == 1)
- handler->priv->activity_infos = NULL;
- } else {
- /* Cancel the operation */
- data->cancel (data->data);
- }
- /* No need to free the data. It will be freed as part of the task widget destroy */
-}
-
-/* CORBA methods. */
-guint e_activity_handler_cancelable_operation_started (EActivityHandler *activity_handler,
- const char *component_id,
- const char *information,
- gboolean cancellable,
- void (*cancel_func)(gpointer),
- gpointer user_data)
-{
- EActivityHandlerPrivate *priv;
- ActivityInfo *activity_info;
- unsigned int activity_id;
- GSList *p;
- struct _cancel_wdata *data;
- gboolean bfree = FALSE;
- priv = activity_handler->priv;
-
- activity_id = get_new_activity_id (activity_handler);
- activity_info = activity_info_new (component_id, activity_id, information, cancellable);
-
- data = g_new(struct _cancel_wdata, 1);
- data->handler = activity_handler;
- data->id = activity_id;
- data->info = activity_info;
- data->cancel = cancel_func;
- data->data = user_data;
-
- activity_info->cancel_func = cancel_wrapper;
- activity_info->data = data;
- for (p = priv->task_bars; p != NULL; p = p->next) {
- ETaskWidget *tw = task_widget_new_from_activity_info (activity_info);
- tw->id = activity_id;
- if (!bfree) {
- /* The data will be freed part of the widget destroy */
- g_object_set_data_full ((GObject *) tw, "free-data", data, g_free);
- bfree = TRUE;
- }
- e_task_bar_prepend_task (E_TASK_BAR (p->data), tw);
- }
-
- priv->activity_infos = g_list_prepend (priv->activity_infos, activity_info);
-
- return activity_id;
-
-}
-
-guint
-e_activity_handler_operation_started (EActivityHandler *activity_handler,
- const char *component_id,
- const char *information,
- gboolean cancellable)
-{
- EActivityHandlerPrivate *priv;
- ActivityInfo *activity_info;
- unsigned int activity_id;
- GSList *p;
-
- priv = activity_handler->priv;
-
- activity_id = get_new_activity_id (activity_handler);
-
- activity_info = activity_info_new (component_id, activity_id, information, cancellable);
-
- for (p = priv->task_bars; p != NULL; p = p->next) {
- ETaskWidget *tw = task_widget_new_from_activity_info (activity_info);
- tw->id = activity_id;
- e_task_bar_prepend_task (E_TASK_BAR (p->data), tw);
- }
-
- priv->activity_infos = g_list_prepend (priv->activity_infos, activity_info);
-
- return activity_id;
-}
-
-static void
-handle_error (ETaskWidget *task)
-{
- GtkWidget *tool, *error;
- EActivityHandler *activity_handler;
- guint id;
- int error_type = GPOINTER_TO_INT((g_object_get_data ((GObject *) task, "error-type")));
- tool = g_object_get_data ((GObject *) task, "tool");
- error = g_object_get_data ((GObject *) task, "error");
- activity_handler = g_object_get_data ((GObject *) task, "activity-handler");
- id = GPOINTER_TO_UINT (g_object_get_data ((GObject *) task, "activity"));
- e_activity_handler_operation_finished (activity_handler, id);
- gtk_widget_show (error);
- e_logger_log (activity_handler->priv->logger, error_type,
- g_object_get_data ((GObject *) error, "primary"),
- g_object_get_data ((GObject *) error, "secondary"));
-}
-
-static gboolean
-error_cleanup (EActivityHandler *activity_handler)
-{
- EActivityHandlerPrivate *priv = activity_handler->priv;
- GList *p, *node;
- GSList *sp;
- int i;
- time_t now = time (NULL);
- gboolean berror = FALSE;
-
- for (p = priv->activity_infos, i = 0; p != NULL; i++) {
- ActivityInfo *info;
-
- info = (ActivityInfo *) p->data;
- if (info->error)
- berror = TRUE;
- if (info->error && info->error_time && (now - info->error_time) > 5 ) {
- /* Error older than wanted time. So cleanup */
- e_logger_log (priv->logger, info->error_type, g_object_get_data (info->error, "primary"),
- g_object_get_data (info->error, "secondary"));
-
- if (GTK_IS_DIALOG (info->error))
- gtk_dialog_response (GTK_DIALOG (info->error), GTK_RESPONSE_CLOSE);
- else
- gtk_widget_destroy (info->error);
-
- node = p;
- p = p->next;
-
- for (sp = priv->task_bars; sp != NULL; sp = sp->next) {
- ETaskBar *task_bar;
-
- task_bar = E_TASK_BAR (sp->data);
- e_task_bar_remove_task_from_id (task_bar, info->id);
- }
- activity_info_free (info);
- priv->activity_infos = g_list_remove_link (priv->activity_infos, node);
-
- } else
- p = p->next;
- }
- if (!berror)
- priv->error_timer = 0;
- return berror;
-}
-
-guint
-e_activity_handler_make_error (EActivityHandler *activity_handler,
- const char *component_id,
- int error_type,
- GtkWidget *error)
-{
- EActivityHandlerPrivate *priv;
- ActivityInfo *activity_info;
- unsigned int activity_id;
- GSList *p;
- char *information = g_object_get_data((GObject *) error, "primary");
- const char *img;
-
- priv = activity_handler->priv;
- activity_id = get_new_activity_id (activity_handler);
-
- activity_info = activity_info_new (component_id, activity_id, information, TRUE);
- activity_info->error = error;
- activity_info->error_time = time (NULL);
- activity_info->error_type = error_type;
-
- img = error_type ? icon_data[1] : icon_data[0];
- for (p = priv->task_bars; p != NULL; p = p->next) {
- ETaskBar *task_bar;
- ETaskWidget *task_widget;
- GtkWidget *tool;
-
- task_bar = E_TASK_BAR (p->data);
- task_widget = task_widget_new_from_activity_info (activity_info);
- task_widget->id = activity_id;
- e_task_bar_prepend_task (E_TASK_BAR (p->data), task_widget);
-
- tool = e_task_widget_update_image (task_widget, (char *)img, information);
- g_object_set_data ((GObject *) task_widget, "tool", tool);
- g_object_set_data ((GObject *) task_widget, "error", error);
- g_object_set_data ((GObject *) task_widget, "activity-handler", activity_handler);
- g_object_set_data ((GObject *) task_widget, "activity", GINT_TO_POINTER(activity_id));
- g_object_set_data ((GObject *) task_widget, "error-type", GINT_TO_POINTER(error_type));
- g_signal_connect_swapped (tool, "clicked", G_CALLBACK(handle_error), task_widget);
- }
-
- priv->activity_infos = g_list_prepend (priv->activity_infos, activity_info);
-
- if (!activity_handler->priv->error_timer)
- activity_handler->priv->error_timer = g_timeout_add (activity_handler->priv->error_flush_interval, (GSourceFunc)error_cleanup, activity_handler);
-
- return activity_id;
-}
-
-void
-e_activity_handler_operation_set_error(EActivityHandler *activity_handler,
- guint activity_id,
- GtkWidget *error)
-{
- EActivityHandlerPrivate *priv = activity_handler->priv;
- ActivityInfo *activity_info;
- GList *p;
- GSList *sp;
- int order_number;
-
- p = lookup_activity (priv->activity_infos, activity_id, &order_number);
- if (p == NULL) {
- g_warning ("EActivityHandler: unknown operation %d", activity_id);
- return;
- }
-
- activity_info = (ActivityInfo *) p->data;
- activity_info->error = error;
- activity_info->error_time = time (NULL);
- activity_info->error_type = E_LOG_ERROR;
- g_free (activity_info->information);
- activity_info->information = g_strdup (g_object_get_data ((GObject *) error, "primary"));
- for (sp = priv->task_bars; sp != NULL; sp = sp->next) {
- ETaskBar *task_bar;
- ETaskWidget *task_widget;
- GtkWidget *tool;
-
- task_bar = E_TASK_BAR (sp->data);
- task_widget = e_task_bar_get_task_widget_from_id (task_bar, activity_info->id);
- if (!task_widget)
- continue;
-
- tool = e_task_widget_update_image (task_widget, (char *)icon_data[0], g_object_get_data ((GObject *) error, "primary"));
- g_object_set_data ((GObject *) task_widget, "tool", tool);
- g_object_set_data ((GObject *) task_widget, "error", error);
- g_object_set_data ((GObject *) task_widget, "activity-handler", activity_handler);
- g_object_set_data ((GObject *) task_widget, "activity", GINT_TO_POINTER(activity_id));
- g_object_set_data ((GObject *) task_widget, "error-type", GINT_TO_POINTER(E_LOG_ERROR));
- g_signal_connect_swapped (tool, "clicked", G_CALLBACK(handle_error), task_widget);
- }
-
- if (!activity_handler->priv->error_timer)
- activity_handler->priv->error_timer = g_timeout_add (activity_handler->priv->error_flush_interval, (GSourceFunc) error_cleanup, activity_handler);
-}
-
-void
-e_activity_handler_operation_progressing (EActivityHandler *activity_handler,
- guint activity_id,
- const char *information,
- double progress)
-{
- EActivityHandlerPrivate *priv = activity_handler->priv;
- ActivityInfo *activity_info;
- GList *p;
- GSList *sp;
- int order_number;
-
- p = lookup_activity (priv->activity_infos, activity_id, &order_number);
- if (p == NULL) {
- g_warning ("EActivityHandler: unknown operation %d", activity_id);
- return;
- }
-
- activity_info = (ActivityInfo *) p->data;
-
- g_free (activity_info->information);
- activity_info->information = g_strdup (information);
-
- activity_info->progress = progress;
-
- for (sp = priv->task_bars; sp != NULL; sp = sp->next) {
- ETaskBar *task_bar;
- ETaskWidget *task_widget;
-
- task_bar = E_TASK_BAR (sp->data);
- task_widget = e_task_bar_get_task_widget_from_id (task_bar, activity_info->id);
- if (!task_widget)
- continue;
-
- e_task_widget_update (task_widget, information, progress);
- }
-}
-
-void
-e_activity_handler_operation_finished (EActivityHandler *activity_handler,
- guint activity_id)
-{
- EActivityHandlerPrivate *priv = activity_handler->priv;
- GList *p;
- GSList *sp;
- int order_number;
-
- p = lookup_activity (priv->activity_infos, activity_id, &order_number);
- if (p == NULL) {
- g_warning ("e_activity_handler_operation_finished: Unknown activity %d\n", activity_id);
- return;
- }
-
- activity_info_free ((ActivityInfo *) p->data);
- priv->activity_infos = g_list_remove_link (priv->activity_infos, p);
-
- for (sp = priv->task_bars; sp != NULL; sp = sp->next) {
- ETaskBar *task_bar;
-
- task_bar = E_TASK_BAR (sp->data);
- e_task_bar_remove_task_from_id (task_bar, activity_id);
- }
-}
-
diff --git a/widgets/misc/e-activity-handler.h b/widgets/misc/e-activity-handler.h
deleted file mode 100644
index bf8d8e0095..0000000000
--- a/widgets/misc/e-activity-handler.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_ACTIVITY_HANDLER_H_
-#define _E_ACTIVITY_HANDLER_H_
-
-#include "e-task-bar.h"
-#include "e-util/e-logger.h"
-#include <glib-object.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_ACTIVITY_HANDLER (e_activity_handler_get_type ())
-#define E_ACTIVITY_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_ACTIVITY_HANDLER, EActivityHandler))
-#define E_ACTIVITY_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_ACTIVITY_HANDLER, EActivityHandlerClass))
-#define E_IS_ACTIVITY_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_ACTIVITY_HANDLER))
-#define E_IS_ACTIVITY_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_ACTIVITY_HANDLER))
-
-
-typedef struct _EActivityHandler EActivityHandler;
-typedef struct _EActivityHandlerPrivate EActivityHandlerPrivate;
-typedef struct _EActivityHandlerClass EActivityHandlerClass;
-
-#define EAH_ICON_INFO "stock_dialog-info"
-#define EAH_ICON_ERROR "stock_dialog-warning"
-
-struct _EActivityHandler {
- GObject parent;
-
- EActivityHandlerPrivate *priv;
-};
-
-struct _EActivityHandlerClass {
- GObjectClass parent_class;
-};
-
-
-GType e_activity_handler_get_type (void);
-
-EActivityHandler *e_activity_handler_new (void);
-
-void e_activity_handler_attach_task_bar (EActivityHandler *activity_hanlder,
- ETaskBar *task_bar);
-
-void e_activity_handler_set_message (EActivityHandler *activity_handler,
- const char *message);
-
-void e_activity_handler_unset_message (EActivityHandler *activity_handler);
-
-guint e_activity_handler_operation_started (EActivityHandler *activity_handler,
- const char *component_id,
- const char *information,
- gboolean cancellable);
-guint e_activity_handler_cancelable_operation_started (EActivityHandler *activity_handler,
- const char *component_id,
- const char *information,
- gboolean cancellable,
- void (*cancel_func)(gpointer),
- gpointer user_data);
-
-void e_activity_handler_operation_progressing (EActivityHandler *activity_handler,
- guint activity_id,
- const char *information,
- double progress);
-
-void e_activity_handler_operation_finished (EActivityHandler *activity_handler,
- guint activity_id);
-
-void e_activity_handler_set_logger (EActivityHandler *handler, ELogger *logger);
-guint e_activity_handler_make_error (EActivityHandler *activity_handler,
- const char *component_id,
- int error_type,
- GtkWidget *error);
-void
-e_activity_handler_operation_set_error (EActivityHandler *activity_handler,
- guint activity_id,
- GtkWidget *error);
-
-void
-e_activity_handler_set_error_flush_time (EActivityHandler *handler, int time);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_ACTIVITY_HANDLER_H_ */
diff --git a/widgets/misc/e-activity-proxy.c b/widgets/misc/e-activity-proxy.c
new file mode 100644
index 0000000000..b045394442
--- /dev/null
+++ b/widgets/misc/e-activity-proxy.c
@@ -0,0 +1,345 @@
+/*
+ * e-activity-proxy.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-activity-proxy.h"
+
+#include <glib/gi18n.h>
+#include <e-spinner.h>
+
+#define E_ACTIVITY_PROXY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ACTIVITY_PROXY, EActivityProxyPrivate))
+
+struct _EActivityProxyPrivate {
+ EActivity *activity;
+ GtkWidget *button;
+ GtkWidget *image;
+ GtkWidget *label;
+ GtkWidget *cancel;
+ GtkWidget *spinner;
+};
+
+enum {
+ PROP_0,
+ PROP_ACTIVITY
+};
+
+static gpointer parent_class;
+
+static void
+activity_proxy_update (EActivityProxy *proxy)
+{
+ EActivity *activity = proxy->priv->activity;
+ const gchar *icon_name;
+ gboolean allow_cancel;
+ gboolean cancelled;
+ gboolean clickable;
+ gboolean completed;
+ gboolean sensitive;
+ gchar *description;
+
+ allow_cancel = e_activity_get_allow_cancel (activity);
+ cancelled = e_activity_is_cancelled (activity);
+ clickable = e_activity_get_clickable (activity);
+ completed = e_activity_is_completed (activity);
+ icon_name = e_activity_get_icon_name (activity);
+
+ description = e_activity_describe (activity);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (proxy), description);
+ gtk_label_set_text (GTK_LABEL (proxy->priv->label), description);
+ g_free (description);
+
+ /* Note, an activity requires an icon name in order to
+ * be clickable. We don't support spinner buttons. */
+ if (icon_name != NULL) {
+ gtk_image_set_from_icon_name (
+ GTK_IMAGE (proxy->priv->image),
+ icon_name, GTK_ICON_SIZE_MENU);
+ gtk_button_set_image (
+ GTK_BUTTON (proxy->priv->button),
+ gtk_image_new_from_icon_name (
+ icon_name, GTK_ICON_SIZE_MENU));
+ gtk_widget_hide (proxy->priv->spinner);
+ if (clickable) {
+ gtk_widget_show (proxy->priv->button);
+ gtk_widget_hide (proxy->priv->image);
+ } else {
+ gtk_widget_hide (proxy->priv->button);
+ gtk_widget_show (proxy->priv->image);
+ }
+ } else {
+ gtk_widget_show (proxy->priv->spinner);
+ gtk_widget_hide (proxy->priv->button);
+ gtk_widget_hide (proxy->priv->image);
+ }
+
+ if (allow_cancel)
+ gtk_widget_show (proxy->priv->cancel);
+ else
+ gtk_widget_hide (proxy->priv->cancel);
+
+ sensitive = !(cancelled || completed);
+ gtk_widget_set_sensitive (proxy->priv->cancel, sensitive);
+}
+
+static void
+activity_proxy_set_activity (EActivityProxy *proxy,
+ EActivity *activity)
+{
+ g_return_if_fail (proxy->priv->activity == NULL);
+
+ proxy->priv->activity = g_object_ref (activity);
+}
+
+static void
+activity_proxy_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ACTIVITY:
+ activity_proxy_set_activity (
+ E_ACTIVITY_PROXY (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+activity_proxy_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ACTIVITY:
+ g_value_set_object (
+ value, e_activity_proxy_get_activity (
+ E_ACTIVITY_PROXY (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+activity_proxy_dispose (GObject *object)
+{
+ EActivityProxyPrivate *priv;
+
+ priv = E_ACTIVITY_PROXY_GET_PRIVATE (object);
+
+ if (priv->activity != NULL) {
+ g_signal_handlers_disconnect_matched (
+ priv->activity, G_SIGNAL_MATCH_FUNC, 0, 0,
+ NULL, activity_proxy_update, NULL);
+ g_object_unref (priv->activity);
+ priv->activity = NULL;
+ }
+
+ if (priv->button != NULL) {
+ g_object_unref (priv->button);
+ priv->button = NULL;
+ }
+
+ if (priv->image != NULL) {
+ g_object_unref (priv->image);
+ priv->image = NULL;
+ }
+
+ if (priv->label != NULL) {
+ g_object_unref (priv->label);
+ priv->label = NULL;
+ }
+
+ if (priv->cancel != NULL) {
+ g_object_unref (priv->cancel);
+ priv->cancel = NULL;
+ }
+
+ if (priv->spinner != NULL) {
+ g_object_unref (priv->spinner);
+ priv->spinner = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+activity_proxy_constructed (GObject *object)
+{
+ EActivityProxy *proxy;
+
+ proxy = E_ACTIVITY_PROXY (object);
+
+ g_signal_connect_swapped (
+ proxy->priv->button, "clicked",
+ G_CALLBACK (e_activity_clicked), proxy->priv->activity);
+
+ g_signal_connect_swapped (
+ proxy->priv->cancel, "clicked",
+ G_CALLBACK (e_activity_cancel), proxy->priv->activity);
+
+ g_signal_connect_swapped (
+ proxy->priv->activity, "cancelled",
+ G_CALLBACK (activity_proxy_update), proxy);
+
+ g_signal_connect_swapped (
+ proxy->priv->activity, "completed",
+ G_CALLBACK (activity_proxy_update), proxy);
+
+ g_signal_connect_swapped (
+ proxy->priv->activity, "notify",
+ G_CALLBACK (activity_proxy_update), proxy);
+
+ activity_proxy_update (proxy);
+}
+
+static void
+activity_proxy_class_init (EActivityProxyClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EActivityProxyPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = activity_proxy_set_property;
+ object_class->get_property = activity_proxy_get_property;
+ object_class->dispose = activity_proxy_dispose;
+ object_class->constructed = activity_proxy_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ACTIVITY,
+ g_param_spec_object (
+ "activity",
+ NULL,
+ NULL,
+ E_TYPE_ACTIVITY,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+activity_proxy_init (EActivityProxy *proxy)
+{
+ GtkWidget *container;
+ GtkWidget *widget;
+
+ proxy->priv = E_ACTIVITY_PROXY_GET_PRIVATE (proxy);
+
+ container = GTK_WIDGET (proxy);
+
+ widget = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_hbox_new (FALSE, 3);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_image_new ();
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ proxy->priv->image = g_object_ref (widget);
+ gtk_widget_hide (widget);
+
+ widget = gtk_button_new ();
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ proxy->priv->button = g_object_ref (widget);
+ gtk_widget_hide (widget);
+
+ /* XXX What's the rationale for killing the old spinner API? */
+ widget = e_spinner_new_spinning_small_shown ();
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ proxy->priv->spinner = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_label_new (NULL);
+ gtk_label_set_ellipsize (GTK_LABEL (widget), PANGO_ELLIPSIZE_END);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ proxy->priv->label = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_button_new ();
+ gtk_button_set_image (
+ GTK_BUTTON (widget), gtk_image_new_from_stock (
+ GTK_STOCK_STOP, GTK_ICON_SIZE_MENU));
+ gtk_button_set_relief (GTK_BUTTON (widget), GTK_RELIEF_NONE);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_set_tooltip_text (widget, _("Cancel"));
+ proxy->priv->cancel = g_object_ref (widget);
+ gtk_widget_show (widget);
+}
+
+GType
+e_activity_proxy_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EActivityProxyClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) activity_proxy_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EActivityProxy),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) activity_proxy_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_EVENT_BOX, "EActivityProxy", &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_activity_proxy_new (EActivity *activity)
+{
+ g_return_val_if_fail (E_IS_ACTIVITY (activity), NULL);
+
+ return g_object_new (
+ E_TYPE_ACTIVITY_PROXY,
+ "activity", activity, NULL);
+}
+
+EActivity *
+e_activity_proxy_get_activity (EActivityProxy *proxy)
+{
+ g_return_val_if_fail (E_IS_ACTIVITY_PROXY (proxy), NULL);
+
+ return proxy->priv->activity;
+}
diff --git a/widgets/misc/e-activity-proxy.h b/widgets/misc/e-activity-proxy.h
new file mode 100644
index 0000000000..714dc63e0f
--- /dev/null
+++ b/widgets/misc/e-activity-proxy.h
@@ -0,0 +1,68 @@
+/*
+ * e-activity-proxy.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_ACTIVITY_PROXY_H
+#define E_ACTIVITY_PROXY_H
+
+#include <gtk/gtk.h>
+#include <e-activity.h>
+
+/* Standard GObject macros */
+#define E_TYPE_ACTIVITY_PROXY \
+ (e_activity_proxy_get_type ())
+#define E_ACTIVITY_PROXY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ACTIVITY_PROXY, EActivityProxy))
+#define E_ACTIVITY_PROXY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ACTIVITY_PROXY, EActivityProxyClass))
+#define E_IS_ACTIVITY_PROXY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ACTIVITY_PROXY))
+#define E_IS_ACTIVITY_PROXY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ACTIVITY_PROXY))
+#define E_ACTIVITY_PROXY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ACTIVITY_PROXY, EActivityProxyClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EActivityProxy EActivityProxy;
+typedef struct _EActivityProxyClass EActivityProxyClass;
+typedef struct _EActivityProxyPrivate EActivityProxyPrivate;
+
+struct _EActivityProxy {
+ GtkEventBox parent;
+ EActivityProxyPrivate *priv;
+};
+
+struct _EActivityProxyClass {
+ GtkEventBoxClass parent_class;
+};
+
+GType e_activity_proxy_get_type (void);
+GtkWidget * e_activity_proxy_new (EActivity *activity);
+EActivity * e_activity_proxy_get_activity (EActivityProxy *proxy);
+
+G_END_DECLS
+
+#endif /* E_ACTIVITY_PROXY_H */
diff --git a/widgets/misc/e-activity.c b/widgets/misc/e-activity.c
new file mode 100644
index 0000000000..ac9a3d7e8a
--- /dev/null
+++ b/widgets/misc/e-activity.c
@@ -0,0 +1,764 @@
+/*
+ * e-activity.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-activity.h"
+
+#include <stdarg.h>
+#include <glib/gi18n.h>
+
+#include "e-util/e-util.h"
+
+#define E_ACTIVITY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ACTIVITY, EActivityPrivate))
+
+struct _EActivityPrivate {
+ gchar *icon_name;
+ gchar *primary_text;
+ gchar *secondary_text;
+ gdouble percent;
+ guint idle_id;
+ GError *error;
+
+ guint allow_cancel : 1;
+ guint blocking : 1;
+ guint cancelled : 1;
+ guint clickable : 1;
+ guint completed : 1;
+};
+
+enum {
+ PROP_0,
+ PROP_ALLOW_CANCEL,
+ PROP_BLOCKING,
+ PROP_CLICKABLE,
+ PROP_ICON_NAME,
+ PROP_PERCENT,
+ PROP_PRIMARY_TEXT,
+ PROP_SECONDARY_TEXT
+};
+
+enum {
+ CANCELLED,
+ CLICKED,
+ COMPLETED,
+ DESCRIBE,
+ LAST_SIGNAL
+};
+
+static gpointer parent_class;
+static gulong signals[LAST_SIGNAL];
+
+static gboolean
+activity_idle_cancel_cb (EActivity *activity)
+{
+ activity->priv->idle_id = 0;
+ e_activity_cancel (activity);
+ g_object_unref (activity);
+
+ return FALSE;
+}
+
+static gboolean
+activity_idle_complete_cb (EActivity *activity)
+{
+ activity->priv->idle_id = 0;
+ e_activity_complete (activity);
+ g_object_unref (activity);
+
+ return FALSE;
+}
+
+static gboolean
+activity_describe_accumulator (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer accu_data)
+{
+ const gchar *string;
+
+ string = g_value_get_string (handler_return);
+ g_value_set_string (return_accu, string);
+
+ return (string == NULL);
+}
+
+static void
+activity_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ALLOW_CANCEL:
+ e_activity_set_allow_cancel (
+ E_ACTIVITY (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_BLOCKING:
+ e_activity_set_blocking (
+ E_ACTIVITY (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_CLICKABLE:
+ e_activity_set_clickable (
+ E_ACTIVITY (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_ICON_NAME:
+ e_activity_set_icon_name (
+ E_ACTIVITY (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_PERCENT:
+ e_activity_set_percent (
+ E_ACTIVITY (object),
+ g_value_get_double (value));
+ return;
+
+ case PROP_PRIMARY_TEXT:
+ e_activity_set_primary_text (
+ E_ACTIVITY (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_SECONDARY_TEXT:
+ e_activity_set_secondary_text (
+ E_ACTIVITY (object),
+ g_value_get_string (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+activity_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ALLOW_CANCEL:
+ g_value_set_boolean (
+ value, e_activity_get_allow_cancel (
+ E_ACTIVITY (object)));
+ return;
+
+ case PROP_BLOCKING:
+ g_value_set_boolean (
+ value, e_activity_get_blocking (
+ E_ACTIVITY (object)));
+ return;
+
+ case PROP_CLICKABLE:
+ g_value_set_boolean (
+ value, e_activity_get_clickable (
+ E_ACTIVITY (object)));
+ return;
+
+ case PROP_ICON_NAME:
+ g_value_set_string (
+ value, e_activity_get_icon_name (
+ E_ACTIVITY (object)));
+ return;
+
+ case PROP_PERCENT:
+ g_value_set_double (
+ value, e_activity_get_percent (
+ E_ACTIVITY (object)));
+ return;
+
+ case PROP_PRIMARY_TEXT:
+ g_value_set_string (
+ value, e_activity_get_primary_text (
+ E_ACTIVITY (object)));
+ return;
+
+ case PROP_SECONDARY_TEXT:
+ g_value_set_string (
+ value, e_activity_get_secondary_text (
+ E_ACTIVITY (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+activity_finalize (GObject *object)
+{
+ EActivityPrivate *priv;
+
+ priv = E_ACTIVITY_GET_PRIVATE (object);
+
+ g_free (priv->icon_name);
+ g_free (priv->primary_text);
+ g_free (priv->secondary_text);
+
+ if (priv->idle_id > 0)
+ g_source_remove (priv->idle_id);
+
+ if (priv->error != NULL)
+ g_error_free (priv->error);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+activity_cancelled (EActivity *activity)
+{
+ activity->priv->cancelled = TRUE;
+
+ if (activity->priv->idle_id > 0) {
+ g_source_remove (activity->priv->idle_id);
+ activity->priv->idle_id = 0;
+ }
+}
+
+static void
+activity_completed (EActivity *activity)
+{
+ activity->priv->completed = TRUE;
+
+ if (activity->priv->idle_id > 0) {
+ g_source_remove (activity->priv->idle_id);
+ activity->priv->idle_id = 0;
+ }
+}
+
+static void
+activity_clicked (EActivity *activity)
+{
+ /* Allow subclasses to safely chain up. */
+}
+
+static gchar *
+activity_describe (EActivity *activity)
+{
+ GString *string;
+ const gchar *text;
+ gboolean cancelled;
+ gboolean completed;
+ gdouble percent;
+
+ string = g_string_sized_new (256);
+ text = e_activity_get_primary_text (activity);
+ cancelled = e_activity_is_cancelled (activity);
+ completed = e_activity_is_completed (activity);
+ percent = e_activity_get_percent (activity);
+
+ if (cancelled) {
+ /* Translators: This is a cancelled activity. */
+ g_string_printf (string, _("%s (cancelled)"), text);
+ } else if (completed) {
+ /* Translators: This is a completed activity. */
+ g_string_printf (string, _("%s (completed)"), text);
+ } else if (percent < 0.0) {
+ /* Translators: This is an activity whose percent
+ * complete is unknown. */
+ g_string_printf (string, _("%s..."), text);
+ } else {
+ /* Translators: This is an activity whose percent
+ * complete is known. */
+ g_string_printf (
+ string, _("%s (%d%% complete)"), text,
+ (gint) (percent * 100.0 + 0.5));
+ }
+
+ return g_string_free (string, FALSE);
+}
+
+static void
+activity_class_init (EActivityClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EActivityPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = activity_set_property;
+ object_class->get_property = activity_get_property;
+ object_class->finalize = activity_finalize;
+
+ class->cancelled = activity_cancelled;
+ class->completed = activity_completed;
+ class->clicked = activity_clicked;
+ class->describe = activity_describe;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ALLOW_CANCEL,
+ g_param_spec_boolean (
+ "allow-cancel",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_BLOCKING,
+ g_param_spec_boolean (
+ "blocking",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CLICKABLE,
+ g_param_spec_boolean (
+ "clickable",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ICON_NAME,
+ g_param_spec_string (
+ "icon-name",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PERCENT,
+ g_param_spec_double (
+ "percent",
+ NULL,
+ NULL,
+ -G_MAXDOUBLE,
+ G_MAXDOUBLE,
+ -1.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PRIMARY_TEXT,
+ g_param_spec_string (
+ "primary-text",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SECONDARY_TEXT,
+ g_param_spec_string (
+ "secondary-text",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ signals[CANCELLED] = g_signal_new (
+ "cancelled",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EActivityClass, cancelled),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[CLICKED] = g_signal_new (
+ "clicked",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EActivityClass, clicked),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[COMPLETED] = g_signal_new (
+ "completed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EActivityClass, completed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[DESCRIBE] = g_signal_new (
+ "describe",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EActivityClass, describe),
+ activity_describe_accumulator, NULL,
+ e_marshal_STRING__VOID,
+ G_TYPE_STRING, 0);
+}
+
+static void
+activity_init (EActivity *activity)
+{
+ activity->priv = E_ACTIVITY_GET_PRIVATE (activity);
+}
+
+GType
+e_activity_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EActivityClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) activity_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EActivity),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) activity_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ G_TYPE_OBJECT, "EActivity", &type_info, 0);
+ }
+
+ return type;
+}
+
+EActivity *
+e_activity_new (const gchar *primary_text)
+{
+ return g_object_new (
+ E_TYPE_ACTIVITY,
+ "primary-text", primary_text, NULL);
+}
+
+EActivity *
+e_activity_newv (const gchar *format, ...)
+{
+ EActivity *activity;
+ gchar *primary_text;
+ va_list args;
+
+ va_start (args, format);
+ primary_text = g_strdup_vprintf (format, args);
+ activity = e_activity_new (primary_text);
+ g_free (primary_text);
+ va_end (args);
+
+ return activity;
+}
+
+void
+e_activity_cancel (EActivity *activity)
+{
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ if (!activity->priv->allow_cancel)
+ return;
+
+ if (activity->priv->cancelled)
+ return;
+
+ if (activity->priv->completed)
+ return;
+
+ g_signal_emit (activity, signals[CANCELLED], 0);
+}
+
+void
+e_activity_cancel_in_idle (EActivity *activity)
+{
+ guint old_idle_id;
+
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ /* Be careful not to finalize the activity. Decrement the
+ * reference count only after incrementing it, in case this
+ * is the last reference. */
+
+ old_idle_id = activity->priv->idle_id;
+
+ activity->priv->idle_id = g_idle_add (
+ (GSourceFunc) activity_idle_cancel_cb,
+ g_object_ref (activity));
+
+ if (old_idle_id > 0) {
+ g_source_remove (old_idle_id);
+ g_object_unref (activity);
+ }
+}
+
+void
+e_activity_complete (EActivity *activity)
+{
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ if (activity->priv->cancelled)
+ return;
+
+ if (activity->priv->completed)
+ return;
+
+ g_signal_emit (activity, signals[COMPLETED], 0);
+}
+
+void
+e_activity_complete_in_idle (EActivity *activity)
+{
+ guint old_idle_id;
+
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ /* Be careful not to finalize the activity. Decrement the
+ * reference count only after incrementing it, in case this
+ * is the last reference. */
+
+ old_idle_id = activity->priv->idle_id;
+
+ activity->priv->idle_id = g_idle_add (
+ (GSourceFunc) activity_idle_complete_cb,
+ g_object_ref (activity));
+
+ if (old_idle_id > 0) {
+ g_source_remove (old_idle_id);
+ g_object_unref (activity);
+ }
+}
+
+void
+e_activity_clicked (EActivity *activity)
+{
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ g_signal_emit (activity, signals[CLICKED], 0);
+}
+
+gchar *
+e_activity_describe (EActivity *activity)
+{
+ EActivityClass *class;
+
+ g_return_val_if_fail (E_IS_ACTIVITY (activity), NULL);
+
+ class = E_ACTIVITY_GET_CLASS (activity);
+ g_return_val_if_fail (class->describe != NULL, NULL);
+
+ return class->describe (activity);
+}
+
+gboolean
+e_activity_is_cancelled (EActivity *activity)
+{
+ g_return_val_if_fail (E_IS_ACTIVITY (activity), FALSE);
+
+ return activity->priv->cancelled;
+}
+
+gboolean
+e_activity_is_completed (EActivity *activity)
+{
+ g_return_val_if_fail (E_IS_ACTIVITY (activity), FALSE);
+
+ return activity->priv->completed;
+}
+
+gboolean
+e_activity_get_allow_cancel (EActivity *activity)
+{
+ g_return_val_if_fail (E_IS_ACTIVITY (activity), FALSE);
+
+ return activity->priv->allow_cancel;
+}
+
+void
+e_activity_set_allow_cancel (EActivity *activity,
+ gboolean allow_cancel)
+{
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ activity->priv->allow_cancel = allow_cancel;
+
+ g_object_notify (G_OBJECT (activity), "allow-cancel");
+}
+
+gboolean
+e_activity_get_blocking (EActivity *activity)
+{
+ g_return_val_if_fail (E_IS_ACTIVITY (activity), FALSE);
+
+ return activity->priv->blocking;
+}
+
+void
+e_activity_set_blocking (EActivity *activity,
+ gboolean blocking)
+{
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ activity->priv->blocking = blocking;
+
+ g_object_notify (G_OBJECT (activity), "blocking");
+}
+
+gboolean
+e_activity_get_clickable (EActivity *activity)
+{
+ g_return_val_if_fail (E_IS_ACTIVITY (activity), FALSE);
+
+ return activity->priv->clickable;
+}
+
+void
+e_activity_set_clickable (EActivity *activity,
+ gboolean clickable)
+{
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ activity->priv->clickable = clickable;
+
+ g_object_notify (G_OBJECT (activity), "clickable");
+}
+
+const gchar *
+e_activity_get_icon_name (EActivity *activity)
+{
+ g_return_val_if_fail (E_IS_ACTIVITY (activity), NULL);
+
+ return activity->priv->icon_name;
+}
+
+void
+e_activity_set_icon_name (EActivity *activity,
+ const gchar *icon_name)
+{
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ g_free (activity->priv->icon_name);
+ activity->priv->icon_name = g_strdup (icon_name);
+
+ g_object_notify (G_OBJECT (activity), "icon-name");
+}
+
+gdouble
+e_activity_get_percent (EActivity *activity)
+{
+ g_return_val_if_fail (E_IS_ACTIVITY (activity), -1.0);
+
+ return activity->priv->percent;
+}
+
+void
+e_activity_set_percent (EActivity *activity,
+ gdouble percent)
+{
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ activity->priv->percent = percent;
+
+ g_object_notify (G_OBJECT (activity), "percent");
+}
+
+const gchar *
+e_activity_get_primary_text (EActivity *activity)
+{
+ g_return_val_if_fail (E_IS_ACTIVITY (activity), NULL);
+
+ return activity->priv->primary_text;
+}
+
+void
+e_activity_set_primary_text (EActivity *activity,
+ const gchar *primary_text)
+{
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ g_free (activity->priv->primary_text);
+ activity->priv->primary_text = g_strdup (primary_text);
+
+ g_object_notify (G_OBJECT (activity), "primary-text");
+}
+
+const gchar *
+e_activity_get_secondary_text (EActivity *activity)
+{
+ g_return_val_if_fail (E_IS_ACTIVITY (activity), NULL);
+
+ return activity->priv->secondary_text;
+}
+
+void
+e_activity_set_secondary_text (EActivity *activity,
+ const gchar *secondary_text)
+{
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ g_free (activity->priv->secondary_text);
+ activity->priv->secondary_text = g_strdup (secondary_text);
+
+ g_object_notify (G_OBJECT (activity), "secondary-text");
+}
+
+void
+e_activity_set_error (EActivity *activity,
+ const GError *error)
+{
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ if (activity->priv->error != NULL) {
+ g_error_free (activity->priv->error);
+ activity->priv->error = NULL;
+ }
+
+ if (error != NULL)
+ activity->priv->error = g_error_copy (error);
+}
+
+gboolean
+e_activity_propagate_error (EActivity *activity,
+ GError **destination)
+{
+ gboolean propagated;
+
+ g_return_val_if_fail (E_IS_ACTIVITY (activity), FALSE);
+
+ if ((propagated = (activity->priv->error != NULL))) {
+ g_propagate_error (destination, activity->priv->error);
+ activity->priv->error = NULL;
+ }
+
+ return propagated;
+}
diff --git a/widgets/misc/e-activity.h b/widgets/misc/e-activity.h
new file mode 100644
index 0000000000..aca262172c
--- /dev/null
+++ b/widgets/misc/e-activity.h
@@ -0,0 +1,107 @@
+/*
+ * e-activity.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_ACTIVITY_H
+#define E_ACTIVITY_H
+
+#include <gtk/gtk.h>
+
+/* Standard GObject macros */
+#define E_TYPE_ACTIVITY \
+ (e_activity_get_type ())
+#define E_ACTIVITY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ACTIVITY, EActivity))
+#define E_ACTIVITY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ACTIVITY, EActivityClass))
+#define E_IS_ACTIVITY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ACTIVITY))
+#define E_IS_ACTIVITY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ACTIVITY))
+#define E_ACTIVITY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ACTIVITY, EActivityClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EActivity EActivity;
+typedef struct _EActivityClass EActivityClass;
+typedef struct _EActivityPrivate EActivityPrivate;
+
+struct _EActivity {
+ GObject parent;
+ EActivityPrivate *priv;
+};
+
+struct _EActivityClass {
+ GObjectClass parent_class;
+
+ /* Signals */
+ void (*cancelled) (EActivity *activity);
+ void (*completed) (EActivity *activity);
+ void (*clicked) (EActivity *activity);
+ gchar * (*describe) (EActivity *activity);
+};
+
+GType e_activity_get_type (void);
+EActivity * e_activity_new (const gchar *primary_text);
+EActivity * e_activity_newv (const gchar *format,
+ ...) G_GNUC_PRINTF (1, 2);
+void e_activity_cancel (EActivity *activity);
+void e_activity_cancel_in_idle (EActivity *activity);
+void e_activity_complete (EActivity *activity);
+void e_activity_complete_in_idle (EActivity *activity);
+void e_activity_clicked (EActivity *activity);
+gchar * e_activity_describe (EActivity *activity);
+gboolean e_activity_is_cancelled (EActivity *activity);
+gboolean e_activity_is_completed (EActivity *activity);
+gboolean e_activity_get_allow_cancel (EActivity *activity);
+void e_activity_set_allow_cancel (EActivity *activity,
+ gboolean allow_cancel);
+gboolean e_activity_get_blocking (EActivity *activity);
+void e_activity_set_blocking (EActivity *activity,
+ gboolean blocking);
+gboolean e_activity_get_clickable (EActivity *activity);
+void e_activity_set_clickable (EActivity *activity,
+ gboolean clickable);
+const gchar * e_activity_get_icon_name (EActivity *activity);
+void e_activity_set_icon_name (EActivity *activity,
+ const gchar *icon_name);
+gdouble e_activity_get_percent (EActivity *activity);
+void e_activity_set_percent (EActivity *activity,
+ gdouble percent);
+const gchar * e_activity_get_primary_text (EActivity *activity);
+void e_activity_set_primary_text (EActivity *activity,
+ const gchar *primary_text);
+const gchar * e_activity_get_secondary_text (EActivity *activity);
+void e_activity_set_secondary_text (EActivity *activity,
+ const gchar *secondary_text);
+void e_activity_set_error (EActivity *activity,
+ const GError *error);
+gboolean e_activity_propagate_error (EActivity *activity,
+ GError **destination);
+
+G_END_DECLS
+
+#endif /* E_ACTIVITY_H */
diff --git a/widgets/misc/e-alert-activity.c b/widgets/misc/e-alert-activity.c
new file mode 100644
index 0000000000..860b129ef9
--- /dev/null
+++ b/widgets/misc/e-alert-activity.c
@@ -0,0 +1,254 @@
+/*
+ * e-alert-activity.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-alert-activity.h"
+
+#define E_ALERT_ACTIVITY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ALERT_ACTIVITY, EAlertActivityPrivate))
+
+struct _EAlertActivityPrivate {
+ GtkWidget *message_dialog;
+};
+
+enum {
+ PROP_0,
+ PROP_MESSAGE_DIALOG
+};
+
+static gpointer parent_class;
+
+static void
+alert_activity_set_message_dialog (EAlertActivity *alert_activity,
+ GtkWidget *message_dialog)
+{
+ g_return_if_fail (alert_activity->priv->message_dialog == NULL);
+
+ alert_activity->priv->message_dialog = g_object_ref (message_dialog);
+}
+
+static void
+alert_activity_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MESSAGE_DIALOG:
+ alert_activity_set_message_dialog (
+ E_ALERT_ACTIVITY (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+alert_activity_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_MESSAGE_DIALOG:
+ g_value_set_object (
+ value, e_alert_activity_get_message_dialog (
+ E_ALERT_ACTIVITY (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+alert_activity_dispose (GObject *object)
+{
+ EAlertActivityPrivate *priv;
+
+ priv = E_ALERT_ACTIVITY_GET_PRIVATE (object);
+
+ if (priv->message_dialog != NULL) {
+ g_object_unref (priv->message_dialog);
+ priv->message_dialog = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+alert_activity_constructed (GObject *object)
+{
+ EActivity *activity;
+ EAlertActivity *alert_activity;
+ GtkWidget *message_dialog;
+ const gchar *primary_text;
+ const gchar *secondary_text;
+
+ alert_activity = E_ALERT_ACTIVITY (object);
+ message_dialog = e_alert_activity_get_message_dialog (alert_activity);
+
+ object = G_OBJECT (message_dialog);
+ primary_text = g_object_get_data (object, "primary");
+ secondary_text = g_object_get_data (object, "secondary");
+
+ activity = E_ACTIVITY (alert_activity);
+ e_activity_set_primary_text (activity, primary_text);
+ e_activity_set_secondary_text (activity, secondary_text);
+}
+
+static void
+alert_activity_clicked (EActivity *activity)
+{
+ EAlertActivity *alert_activity;
+ GtkWidget *message_dialog;
+
+ e_activity_complete (activity);
+
+ alert_activity = E_ALERT_ACTIVITY (activity);
+ message_dialog = e_alert_activity_get_message_dialog (alert_activity);
+ gtk_dialog_run (GTK_DIALOG (message_dialog));
+ gtk_widget_hide (message_dialog);
+
+ /* Chain up to parent's clicked() method. */
+ E_ACTIVITY_CLASS (parent_class)->clicked (activity);
+}
+
+static void
+alert_activity_timeout (ETimeoutActivity *activity)
+{
+ e_activity_complete (E_ACTIVITY (activity));
+
+ /* Chain up to parent's timeout() method. */
+ E_TIMEOUT_ACTIVITY_CLASS (parent_class)->timeout (activity);
+}
+
+static void
+alert_activity_class_init (EAlertActivityClass *class)
+{
+ GObjectClass *object_class;
+ EActivityClass *activity_class;
+ ETimeoutActivityClass *timeout_activity_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EAlertActivityPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = alert_activity_set_property;
+ object_class->get_property = alert_activity_get_property;
+ object_class->dispose = alert_activity_dispose;
+ object_class->constructed = alert_activity_constructed;
+
+ activity_class = E_ACTIVITY_CLASS (class);
+ activity_class->clicked = alert_activity_clicked;
+
+ timeout_activity_class = E_TIMEOUT_ACTIVITY_CLASS (class);
+ timeout_activity_class->timeout = alert_activity_timeout;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MESSAGE_DIALOG,
+ g_param_spec_object (
+ "message-dialog",
+ NULL,
+ NULL,
+ GTK_TYPE_DIALOG,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+alert_activity_init (EAlertActivity *alert_activity)
+{
+ alert_activity->priv = E_ALERT_ACTIVITY_GET_PRIVATE (alert_activity);
+
+ e_activity_set_clickable (E_ACTIVITY (alert_activity), TRUE);
+ e_timeout_activity_set_timeout (E_TIMEOUT_ACTIVITY (alert_activity), 60);
+}
+
+GType
+e_alert_activity_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EAlertActivityClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) alert_activity_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EAlertActivity),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) alert_activity_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_TIMEOUT_ACTIVITY, "EAlertActivity",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+EActivity *
+e_alert_activity_new_info (GtkWidget *message_dialog)
+{
+ g_return_val_if_fail (GTK_IS_DIALOG (message_dialog), NULL);
+
+ return g_object_new (
+ E_TYPE_ALERT_ACTIVITY,
+ "icon-name", "dialog-information",
+ "message-dialog", message_dialog, NULL);
+}
+
+EActivity *
+e_alert_activity_new_error (GtkWidget *message_dialog)
+{
+ g_return_val_if_fail (GTK_IS_DIALOG (message_dialog), NULL);
+
+ return g_object_new (
+ E_TYPE_ALERT_ACTIVITY,
+ "icon-name", "dialog-error",
+ "message-dialog", message_dialog, NULL);
+}
+
+EActivity *
+e_alert_activity_new_warning (GtkWidget *message_dialog)
+{
+ g_return_val_if_fail (GTK_IS_DIALOG (message_dialog), NULL);
+
+ return g_object_new (
+ E_TYPE_ALERT_ACTIVITY,
+ "icon-name", "dialog-warning",
+ "message-dialog", message_dialog, NULL);
+}
+
+GtkWidget *
+e_alert_activity_get_message_dialog (EAlertActivity *alert_activity)
+{
+ g_return_val_if_fail (E_IS_ALERT_ACTIVITY (alert_activity), NULL);
+
+ return alert_activity->priv->message_dialog;
+}
diff --git a/widgets/misc/e-alert-activity.h b/widgets/misc/e-alert-activity.h
new file mode 100644
index 0000000000..5557094dda
--- /dev/null
+++ b/widgets/misc/e-alert-activity.h
@@ -0,0 +1,70 @@
+/*
+ * e-alert-activity.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_ALERT_ACTIVITY_H
+#define E_ALERT_ACTIVITY_H
+
+#include <e-timeout-activity.h>
+
+/* Standard GObject macros */
+#define E_TYPE_ALERT_ACTIVITY \
+ (e_alert_activity_get_type ())
+#define E_ALERT_ACTIVITY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ALERT_ACTIVITY, EAlertActivity))
+#define E_ALERT_ACTIVITY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ALERT_ACTIVITY, EAlertActivityClass))
+#define E_IS_ALERT_ACTIVITY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ALERT_ACTIVITY))
+#define E_IS_ALERT_ACTIVITY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ALERT_ACTIVITY))
+#define E_ALERT_ACTIVITY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ALERT_ACTIVITY, EAlertActivityClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EAlertActivity EAlertActivity;
+typedef struct _EAlertActivityClass EAlertActivityClass;
+typedef struct _EAlertActivityPrivate EAlertActivityPrivate;
+
+struct _EAlertActivity {
+ ETimeoutActivity parent;
+ EAlertActivityPrivate *priv;
+};
+
+struct _EAlertActivityClass {
+ ETimeoutActivityClass parent_class;
+};
+
+GType e_alert_activity_get_type (void);
+EActivity * e_alert_activity_new_info (GtkWidget *message_dialog);
+EActivity * e_alert_activity_new_error (GtkWidget *message_dialog);
+EActivity * e_alert_activity_new_warning (GtkWidget *message_dialog);
+GtkWidget * e_alert_activity_get_message_dialog
+ (EAlertActivity *alert_activity);
+
+G_END_DECLS
+
+#endif /* E_ALERT_ACTIVITY_H */
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index be3751f852..bd6ff35cf7 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -26,7 +26,7 @@
#endif
#include "e-calendar-item.h"
-#include "ea-widgets.h"
+#include "a11y/ea-widgets.h"
#include <time.h>
#include <string.h>
diff --git a/widgets/misc/e-calendar.h b/widgets/misc/e-calendar.h
index 7a3c8fd010..d6b9f653d8 100644
--- a/widgets/misc/e-calendar.h
+++ b/widgets/misc/e-calendar.h
@@ -39,9 +39,24 @@ extern "C" {
* to got to the current day.
*/
-#define E_CALENDAR(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_calendar_get_type (), ECalendar)
-#define E_CALENDAR_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_calendar_get_type (), ECalendarClass)
-#define E_IS_CALENDAR(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_calendar_get_type ())
+/* Standard GObject macros */
+#define E_TYPE_CALENDAR \
+ (e_calendar_get_type ())
+#define E_CALENDAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CALENDAR, ECalendar))
+#define E_CALENDAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CALENDAR, ECalendarClass))
+#define E_IS_CALENDAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CALENDAR))
+#define E_IS_CALENDAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CALENDAR))
+#define E_CALENDAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CALENDAR, ECalendarClass))
typedef struct _ECalendar ECalendar;
diff --git a/widgets/misc/e-charset-picker.c b/widgets/misc/e-charset-picker.c
index 5d1f8c036a..d140fe9a5c 100644
--- a/widgets/misc/e-charset-picker.c
+++ b/widgets/misc/e-charset-picker.c
@@ -31,9 +31,6 @@
#include <glib/gi18n-lib.h>
-#include <bonobo/bonobo-ui-node.h>
-#include <bonobo/bonobo-ui-util.h>
-
typedef enum {
E_CHARSET_UNKNOWN,
E_CHARSET_ARABIC,
@@ -440,6 +437,7 @@ e_charset_picker_dialog (const char *title, const char *prompt,
/**
* e_charset_add_radio_actions:
* @action_group: a #GtkActionGroup
+ * @action_prefix: a prefix for action names, or %NULL
* @default_charset: the default character set, or %NULL to use the
* locale character set
* @callback: a callback function for actions in the group, or %NULL
@@ -453,8 +451,9 @@ e_charset_picker_dialog (const char *title, const char *prompt,
* the default will be added next, followed by the remaining character
* sets.
**/
-void
+GSList *
e_charset_add_radio_actions (GtkActionGroup *action_group,
+ const gchar *action_prefix,
const gchar *default_charset,
GCallback callback,
gpointer user_data)
@@ -464,12 +463,10 @@ e_charset_add_radio_actions (GtkActionGroup *action_group,
const gchar *locale_charset;
gint def, ii;
- g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
+ g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), NULL);
- /* XXX I could try to factor out code common to this
- * function and e_charset_picker_bonobo_ui_populate()
- * instead of duplicating it, but I expect the latter
- * function to be obsolete in the foreseeable future. */
+ if (action_prefix == NULL)
+ action_prefix = "";
g_get_charset (&locale_charset);
if (!g_ascii_strcasecmp (locale_charset, "US-ASCII"))
@@ -482,13 +479,18 @@ e_charset_add_radio_actions (GtkActionGroup *action_group,
break;
for (ii = 0; ii < G_N_ELEMENTS (charsets); ii++) {
+ const gchar *charset_name;
+ gchar *action_name;
gchar *escaped_name;
gchar *charset_label;
gchar **str_array;
+ charset_name = charsets[ii].name;
+ action_name = g_strconcat (action_prefix, charset_name, NULL);
+
/* Escape underlines in the character set name so
* they're not treated as GtkLabel mnemonics. */
- str_array = g_strsplit (charsets[ii].name, "_", -1);
+ str_array = g_strsplit (charset_name, "_", -1);
escaped_name = g_strjoinv ("__", str_array);
g_strfreev (str_array);
@@ -506,8 +508,14 @@ e_charset_add_radio_actions (GtkActionGroup *action_group,
else
charset_label = g_strdup (escaped_name);
+ /* XXX Add a tooltip! */
action = gtk_radio_action_new (
- charsets[ii].name, charset_label, NULL, NULL, ii);
+ action_name, charset_label, NULL, NULL, ii);
+
+ /* Character set name is static so no need to free it. */
+ g_object_set_data (
+ G_OBJECT (action), "charset",
+ (gpointer) charset_name);
gtk_radio_action_set_group (action, group);
group = gtk_radio_action_get_group (action);
@@ -521,22 +529,34 @@ e_charset_add_radio_actions (GtkActionGroup *action_group,
g_object_unref (action);
+ g_free (action_name);
g_free (escaped_name);
g_free (charset_label);
}
if (def == G_N_ELEMENTS (charsets)) {
+ const gchar *charset_name;
+ gchar *action_name;
gchar *charset_label;
gchar **str_array;
+ charset_name = default_charset;
+ action_name = g_strconcat (action_prefix, charset_name, NULL);
+
/* Escape underlines in the character set name so
* they're not treated as GtkLabel mnemonics. */
- str_array = g_strsplit (default_charset, "_", -1);
+ str_array = g_strsplit (charset_name, "_", -1);
charset_label = g_strjoinv ("__", str_array);
g_strfreev (str_array);
+ /* XXX Add a tooltip! */
action = gtk_radio_action_new (
- default_charset, charset_label, NULL, NULL, def);
+ action_name, charset_label, NULL, NULL, def);
+
+ /* Character set name is static so no need to free it. */
+ g_object_set_data (
+ G_OBJECT (action), "charset",
+ (gpointer) charset_name);
gtk_radio_action_set_group (action, group);
group = gtk_radio_action_get_group (action);
@@ -550,166 +570,13 @@ e_charset_add_radio_actions (GtkActionGroup *action_group,
g_object_unref (action);
+ g_free (action_name);
g_free (charset_label);
}
/* Any of the actions in the action group will do. */
if (action != NULL)
gtk_radio_action_set_current_value (action, def);
-}
-
-/**
- * e_charset_picker_bonobo_ui_populate:
- * @uic: Bonobo UI Component
- * @path: menu path
- * @default_charset: the default character set, or %NULL to use the
- * locale character set.
- * @cb: Callback function
- * @user_data: data to be passed to the callback.
- *
- * This creates a Bonobo UI menu and fills it in with a selection
- * of available character sets. The @default_charset (or locale character
- * set if @default_charset is %NULL) will be listed first, and selected
- * by default (except that iso-8859-1 will always be used instead of
- * US-ASCII). Any other character sets of the same language class as
- * the default will be listed next, followed by the remaining character
- * sets.
- **/
-void
-e_charset_picker_bonobo_ui_populate (BonoboUIComponent *uic, const char *path,
- const char *default_charset,
- BonoboUIListenerFn cb, gpointer user_data)
-{
- char *encoded_label, *label;
- const char *locale_charset;
- GString *menuitems;
- int def, i;
-
- g_get_charset (&locale_charset);
- if (!g_ascii_strcasecmp (locale_charset, "US-ASCII"))
- locale_charset = "iso-8859-1";
-
- if (!default_charset)
- default_charset = locale_charset;
- for (def = 0; def < num_charsets; def++) {
- if (!g_ascii_strcasecmp (charsets[def].name, default_charset))
- break;
- }
-
- label = g_strdup (_("Ch_aracter Encoding"));
- encoded_label = bonobo_ui_util_encode_str (label);
- menuitems = g_string_new ("");
- g_string_append_printf (menuitems, "<submenu name=\"ECharsetPicker\" label=\"%s\">\n",
- encoded_label);
- g_free (encoded_label);
- g_free (label);
-
- for (i = 0; i < num_charsets; i++) {
- gchar *charset_name;
- gchar *command, *u;
-
- /* escape _'s in the charset name so that it doesn't become an underline in a GtkLabel */
- if ((u = strchr (charsets[i].name, '_'))) {
- int extra = 1;
- const gchar *s;
- gchar *d;
-
- while ((u = strchr (u + 1, '_')))
- extra++;
-
- d = charset_name = g_alloca (strlen (charsets[i].name) + extra + 1);
- s = charsets[i].name;
- while (*s != '\0') {
- if (*s == '_')
- *d++ = '_';
- *d++ = *s++;
- }
- *d = '\0';
- } else {
- charset_name = (gchar *) charsets[i].name;
- }
-
- if (charsets[i].subclass) {
- label = g_strdup_printf ("%s, %s (%s)",
- _(classnames[charsets[i].class]),
- _(charsets[i].subclass),
- charset_name);
- } else if (charsets[i].class) {
- label = g_strdup_printf ("%s (%s)",
- _(classnames[charsets[i].class]),
- charset_name);
- } else {
- label = g_strdup (charset_name);
- }
-
- encoded_label = bonobo_ui_util_encode_str (label);
- g_free (label);
-
- command = g_strdup_printf ("<cmd name=\"Charset-%s\" label=\"%s\" type=\"radio\""
- " group=\"charset_picker\" state=\"%d\"/>\n",
- charsets[i].name, encoded_label, i == def);
-
- bonobo_ui_component_set (uic, "/commands", command, NULL);
- g_free (command);
-
- g_string_append_printf (menuitems, " <menuitem name=\"Charset-%s\" verb=\"\"/>\n",
- charsets[i].name);
-
- g_free (encoded_label);
-
- label = g_strdup_printf ("Charset-%s", charsets[i].name);
- bonobo_ui_component_add_listener (uic, label, cb, user_data);
- g_free (label);
- }
-
- if (def == num_charsets) {
- char *command;
- char *charset_name, *u;
-
- /* escape _'s in the charset name so that it doesn't become an underline in a GtkLabel */
- if ((u = strchr (default_charset, '_'))) {
- int extra = 1;
- char *s, *d;
-
- while ((u = strchr (u + 1, '_')))
- extra++;
-
- d = charset_name = g_alloca (strlen (default_charset) + extra + 1);
- s = (char *) default_charset;
- while (*s != '\0') {
- if (*s == '_')
- *d++ = '_';
- *d++ = *s++;
- }
- *d = '\0';
- } else {
- charset_name = (char *) default_charset;
- }
-
- label = g_strdup (charset_name);
- encoded_label = bonobo_ui_util_encode_str (label);
- g_free (label);
-
- command = g_strdup_printf ("<cmd name=\"Charset-%s\" label=\"%s\" type=\"radio\""
- " group=\"charset_picker\" state=\"1\"/>\n",
- default_charset, encoded_label);
-
- bonobo_ui_component_set (uic, "/commands", command, NULL);
- g_free (command);
-
- g_string_append (menuitems, " <separator/>\n");
- g_string_append_printf (menuitems, " <menuitem name=\"Charset-%s\" verb=\"\"/>\n",
- default_charset);
-
- g_free (encoded_label);
-
- label = g_strdup_printf ("Charset-%s", default_charset);
- bonobo_ui_component_add_listener (uic, label, cb, user_data);
- g_free (label);
- }
-
- g_string_append (menuitems, "</submenu>\n");
- bonobo_ui_component_set (uic, path, menuitems->str, NULL);
- g_string_free (menuitems, TRUE);
+ return group;
}
diff --git a/widgets/misc/e-charset-picker.h b/widgets/misc/e-charset-picker.h
index 88c89fb308..4f701679a5 100644
--- a/widgets/misc/e-charset-picker.h
+++ b/widgets/misc/e-charset-picker.h
@@ -22,7 +22,6 @@
#define E_CHARSETPICKER_H
#include <gtk/gtk.h>
-#include <bonobo/bonobo-ui-component.h>
G_BEGIN_DECLS
@@ -33,18 +32,12 @@ char * e_charset_picker_dialog (const char *title,
const char *default_charset,
GtkWindow *parent);
-void e_charset_add_radio_actions (GtkActionGroup *action_group,
+GSList * e_charset_add_radio_actions (GtkActionGroup *action_group,
+ const gchar *action_prefix,
const gchar *default_charset,
GCallback callback,
gpointer user_data);
-void e_charset_picker_bonobo_ui_populate
- (BonoboUIComponent *uic,
- const char *path,
- const char *default_charset,
- BonoboUIListenerFn cb,
- gpointer user_data);
-
G_END_DECLS
#endif /* E_CHARSETPICKER_H */
diff --git a/widgets/misc/e-combo-button.c b/widgets/misc/e-combo-button.c
deleted file mode 100644
index dc978af91a..0000000000
--- a/widgets/misc/e-combo-button.c
+++ /dev/null
@@ -1,625 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-combo-button.h"
-#include "ea-widgets.h"
-
-struct _EComboButtonPrivate {
- GdkPixbuf *icon;
-
- GtkWidget *icon_image;
- GtkWidget *label;
- GtkWidget *arrow_image;
- GtkWidget *hbox;
- GtkWidget *vbox;
-
- GtkMenu *menu;
-
- gboolean menu_popped_up;
- gboolean is_already_packed;
-};
-
-#define SPACING 2
-
-enum {
- ACTIVATE_DEFAULT,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (EComboButton, e_combo_button, GTK_TYPE_BUTTON)
-
-/* Utility functions. */
-
-static void
-set_icon (EComboButton *combo_button,
- GdkPixbuf *pixbuf)
-{
- EComboButtonPrivate *priv;
-
- priv = combo_button->priv;
-
- if (priv->icon != NULL)
- g_object_unref (priv->icon);
-
- if (pixbuf == NULL) {
- priv->icon = NULL;
- gtk_widget_hide (priv->icon_image);
- return;
- }
-
- priv->icon = g_object_ref (pixbuf);
-
- gtk_image_set_from_pixbuf (GTK_IMAGE (priv->icon_image), priv->icon);
-
- gtk_widget_show (priv->icon_image);
-}
-
-
-/* Paint the borders. */
-
-static void
-paint (EComboButton *combo_button,
- GdkRectangle *area)
-{
- EComboButtonPrivate *priv = combo_button->priv;
- GtkWidget *widget = GTK_WIDGET (combo_button);
- GtkButton *button = GTK_BUTTON (combo_button);
- GtkShadowType shadow_type;
- gboolean interior_focus;
- int separator_x;
- int focus_width, focus_pad;
- int x, y, width, height;
- int border_width;
-
- if (GTK_BUTTON (widget)->depressed || priv->menu_popped_up) {
- shadow_type = GTK_SHADOW_IN;
- gtk_widget_set_state (widget, GTK_STATE_ACTIVE);
- } else if (GTK_BUTTON (widget)->relief == GTK_RELIEF_NONE &&
- (GTK_WIDGET_STATE (widget) == GTK_STATE_NORMAL ||
- GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE))
- shadow_type = GTK_SHADOW_NONE;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- border_width = GTK_CONTAINER (widget)->border_width;
-
- x = widget->allocation.x + border_width;
- y = widget->allocation.y + border_width;
- width = widget->allocation.width - border_width * 2;
- height = widget->allocation.height - border_width * 2;
-
- separator_x = (priv->label->allocation.width
- + priv->label->allocation.x
- + priv->arrow_image->allocation.x) / 2;
-
- gtk_widget_style_get (GTK_WIDGET (widget),
- "focus-line-width", &focus_width,
- "focus-padding", &focus_pad,
- "interior-focus", &interior_focus,
- NULL);
-
- if (GTK_WIDGET_HAS_DEFAULT (widget)
- && GTK_BUTTON (widget)->relief == GTK_RELIEF_NORMAL)
- gtk_paint_box (widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_IN,
- area, widget, "buttondefault",
- x, y, width, height);
-
- if (!interior_focus && GTK_WIDGET_HAS_FOCUS (widget)) {
- x += focus_width + focus_pad;
- y += focus_width + focus_pad;
- width -= 2 * (focus_width + focus_pad);
- height -= 2 * (focus_width + focus_pad);
- }
-
- if (button->relief != GTK_RELIEF_NONE || button->depressed ||
- priv->menu_popped_up ||
- GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT) {
-
- gtk_paint_box (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), shadow_type,
- area, widget, "button",
- x, y, separator_x, height);
-
- if (width - separator_x > 0)
- gtk_paint_box (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), shadow_type,
- area, widget, "button",
- separator_x, y, width - separator_x, height);
- }
-
- if (GTK_WIDGET_HAS_FOCUS (widget)) {
- if (interior_focus) {
- x += widget->style->xthickness + focus_pad;
- y += widget->style->ythickness + focus_pad;
- width -= 2 * (widget->style->xthickness + focus_pad);
- height -= 2 * (widget->style->xthickness + focus_pad);
- } else {
- x -= focus_width + focus_pad;
- y -= focus_width + focus_pad;
- width += 2 * (focus_width + focus_pad);
- height += 2 * (focus_width + focus_pad);
- }
-
- gtk_paint_focus (widget->style, widget->window,
- GTK_WIDGET_STATE (widget),
- area, widget, "button",
- x, y, width, height);
- }
-}
-
-
-/* Callbacks for the associated menu. */
-
-static void
-menu_detacher (GtkWidget *widget,
- GtkMenu *menu)
-{
- EComboButton *combo_button;
- EComboButtonPrivate *priv;
-
- combo_button = E_COMBO_BUTTON (widget);
- priv = combo_button->priv;
- g_signal_handlers_disconnect_matched (menu,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL,
- combo_button);
- priv->menu = NULL;
-}
-
-static void
-menu_deactivate_callback (GtkMenuShell *menu_shell,
- void *data)
-{
- EComboButton *combo_button;
- EComboButtonPrivate *priv;
-
- combo_button = E_COMBO_BUTTON (data);
- priv = combo_button->priv;
-
- priv->menu_popped_up = FALSE;
-
- GTK_BUTTON (combo_button)->button_down = FALSE;
- GTK_BUTTON (combo_button)->in_button = FALSE;
- gtk_button_leave (GTK_BUTTON (combo_button));
- gtk_button_clicked (GTK_BUTTON (combo_button));
-}
-
-static void
-menu_position_func (GtkMenu *menu,
- gint *x_return,
- gint *y_return,
- gboolean *push_in,
- void *data)
-{
- EComboButton *combo_button;
- GtkAllocation *allocation;
-
- combo_button = E_COMBO_BUTTON (data);
- allocation = & (GTK_WIDGET (combo_button)->allocation);
-
- gdk_window_get_origin (GTK_WIDGET (combo_button)->window, x_return, y_return);
-
- *y_return += allocation->height;
-}
-
-
-/* GtkObject methods. */
-
-static void
-impl_destroy (GtkObject *object)
-{
- EComboButton *combo_button;
- EComboButtonPrivate *priv;
-
- combo_button = E_COMBO_BUTTON (object);
- priv = combo_button->priv;
-
- if (priv) {
- if (priv->arrow_image != NULL) {
- gtk_widget_destroy (priv->arrow_image);
- priv->arrow_image = NULL;
- }
-
- if (priv->icon != NULL) {
- g_object_unref (priv->icon);
- priv->icon = NULL;
- }
-
- g_free (priv);
- combo_button->priv = NULL;
- }
-
- (* GTK_OBJECT_CLASS (e_combo_button_parent_class)->destroy) (object);
-}
-
-
-
-static gboolean
-e_combo_button_popup (EComboButton *combo_button, GdkEventButton *event)
-{
- EComboButtonPrivate *priv;
-
- g_return_val_if_fail (combo_button != NULL, FALSE);
- g_return_val_if_fail (E_IS_COMBO_BUTTON (combo_button), FALSE);
-
- priv = combo_button->priv;
-
- priv->menu_popped_up = TRUE;
-
- if (event)
- gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL,
- menu_position_func, combo_button,
- event->button, event->time);
- else
- gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL,
- menu_position_func, combo_button,
- 0, gtk_get_current_event_time());
-
- return TRUE;
-}
-/* GtkWidget methods. */
-
-static int
-impl_button_press_event (GtkWidget *widget,
- GdkEventButton *event)
-{
- EComboButton *combo_button;
- EComboButtonPrivate *priv;
-
- combo_button = E_COMBO_BUTTON (widget);
- priv = combo_button->priv;
-
- if (event->type == GDK_BUTTON_PRESS &&
- (event->button == 1 || event->button == 3)) {
- GTK_BUTTON (widget)->button_down = TRUE;
-
- if (event->button == 3 ||
- event->x >= priv->arrow_image->allocation.x) {
- /* User clicked on the right side: pop up the menu. */
- gtk_button_pressed (GTK_BUTTON (widget));
-
- e_combo_button_popup (combo_button, event);
- } else {
- /* User clicked on the left side: just behave like a
- normal button (i.e. not a toggle). */
- gtk_button_pressed (GTK_BUTTON (widget));
- }
- }
-
- return TRUE;
-}
-
-static int
-impl_leave_notify_event (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- EComboButton *combo_button;
- EComboButtonPrivate *priv;
-
- combo_button = E_COMBO_BUTTON (widget);
- priv = combo_button->priv;
-
- /* This is to override the standard behavior of deactivating the button
- when the pointer gets out of the widget, in the case in which we
- have just popped up the menu. Otherwise, the button would look as
- inactive when the menu is popped up. */
- if (! priv->menu_popped_up)
- return (* GTK_WIDGET_CLASS (e_combo_button_parent_class)->leave_notify_event) (widget, event);
-
- return FALSE;
-}
-
-static int
-impl_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkBin *bin;
- GdkEventExpose child_event;
-
- if (! GTK_WIDGET_DRAWABLE (widget))
- return FALSE;
-
- bin = GTK_BIN (widget);
-
- paint (E_COMBO_BUTTON (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_container_propagate_expose (GTK_CONTAINER (widget), bin->child, &child_event);
-
- return FALSE;
-}
-
-
-/* GtkButton methods. */
-
-static void
-impl_released (GtkButton *button)
-{
- EComboButton *combo_button;
- EComboButtonPrivate *priv;
-
- combo_button = E_COMBO_BUTTON (button);
- priv = combo_button->priv;
-
- /* Massive cut & paste from GtkButton here... The only change in
- behavior here is that we want to emit ::activate_default when not
- the menu hasn't been popped up. */
-
- if (button->button_down) {
- int new_state;
-
- button->button_down = FALSE;
-
- if (button->in_button) {
- gtk_button_clicked (button);
-
- if (! priv->menu_popped_up)
- g_signal_emit (button, signals[ACTIVATE_DEFAULT], 0);
- }
-
- new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
-
- if (GTK_WIDGET_STATE (button) != new_state) {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
-
- /* We _draw () instead of queue_draw so that if the
- operation blocks, the label doesn't vanish. */
- /* XXX gtk_widget_draw() is deprecated.
- * Replace it with GTK's implementation. */
- gtk_widget_queue_draw (GTK_WIDGET (button));
- gdk_window_process_updates (
- GTK_WIDGET (button)->window, TRUE);
- }
- }
-}
-
-
-static void
-e_combo_button_class_init (EComboButtonClass *combo_button_class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkButtonClass *button_class;
-
- object_class = GTK_OBJECT_CLASS (combo_button_class);
- object_class->destroy = impl_destroy;
-
- widget_class = GTK_WIDGET_CLASS (object_class);
- widget_class->button_press_event = impl_button_press_event;
- widget_class->leave_notify_event = impl_leave_notify_event;
- widget_class->expose_event = impl_expose_event;
-
- button_class = GTK_BUTTON_CLASS (object_class);
- button_class->released = impl_released;
-
- signals[ACTIVATE_DEFAULT] = g_signal_new ("activate_default",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EComboButtonClass, activate_default),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- e_combo_button_a11y_init ();
-}
-
-static void
-e_combo_button_init (EComboButton *combo_button)
-{
- EComboButtonPrivate *priv;
-
- priv = g_new (EComboButtonPrivate, 1);
- combo_button->priv = priv;
-
- priv->icon = NULL;
- priv->menu = NULL;
- priv->menu_popped_up = FALSE;
- priv->is_already_packed = FALSE;
-}
-
-void
-e_combo_button_pack_hbox (EComboButton *combo_button)
-{
- EComboButtonPrivate *priv;
-
- priv = combo_button->priv;
-
- if(priv->is_already_packed){
- gtk_widget_destroy (priv->hbox);
- }
-
- priv->hbox = gtk_hbox_new (FALSE, SPACING);
- gtk_container_add (GTK_CONTAINER (combo_button), priv->hbox);
- gtk_widget_show (priv->hbox);
-
- priv->icon_image = gtk_image_new_from_stock (
- GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_MENU);
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->icon_image, TRUE, TRUE, 0);
- gtk_widget_show (priv->icon_image);
-
- priv->label = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->label, TRUE, TRUE,
- 0);
- gtk_widget_show (priv->label);
-
- priv->arrow_image = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
- gtk_box_pack_end (GTK_BOX (priv->hbox), priv->arrow_image, TRUE, TRUE,
- GTK_WIDGET (combo_button)->style->xthickness);
- gtk_widget_show (priv->arrow_image);
-
- gtk_widget_show (priv->hbox);
-
- priv->is_already_packed = TRUE;
-}
-
-void
-e_combo_button_pack_vbox (EComboButton *combo_button)
-{
- EComboButtonPrivate *priv;
-
- priv = combo_button->priv;
-
- if(priv->is_already_packed){
- gtk_widget_destroy (priv->hbox);
- }
-
- priv->hbox = gtk_hbox_new (FALSE, SPACING);
- gtk_container_add (GTK_CONTAINER (combo_button), priv->hbox);
- gtk_widget_show (priv->hbox);
-
- priv->vbox = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (priv->vbox);
-
- priv->icon_image = gtk_image_new_from_stock (
- GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_MENU);
- gtk_box_pack_start (GTK_BOX (priv->vbox), priv->icon_image, TRUE, TRUE, 0);
- gtk_widget_show (priv->icon_image);
-
- priv->label = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (priv->vbox), priv->label, TRUE, TRUE,
- 0);
- gtk_widget_show (priv->label);
-
- gtk_box_pack_start (GTK_BOX(priv->hbox),priv->vbox, TRUE, TRUE, 0);
-
- priv->arrow_image = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
- gtk_box_pack_end (GTK_BOX (priv->hbox), priv->arrow_image, TRUE, TRUE,
- GTK_WIDGET (combo_button)->style->xthickness);
- gtk_widget_show (priv->arrow_image);
-
- gtk_widget_show (priv->hbox);
-
- priv->is_already_packed = TRUE;
-}
-
-
-void
-e_combo_button_construct (EComboButton *combo_button)
-{
- EComboButtonPrivate *priv;
-
- g_return_if_fail (combo_button != NULL);
- g_return_if_fail (E_IS_COMBO_BUTTON (combo_button));
-
- priv = combo_button->priv;
- g_return_if_fail (priv->menu == NULL);
-
- GTK_WIDGET_UNSET_FLAGS (combo_button, GTK_CAN_FOCUS);
-
- gtk_button_set_relief (GTK_BUTTON (combo_button), GTK_RELIEF_NONE);
-}
-
-GtkWidget *
-e_combo_button_new (void)
-{
- EComboButton *new;
-
- new = g_object_new (e_combo_button_get_type (), NULL);
- e_combo_button_construct (new);
-
- return GTK_WIDGET (new);
-}
-
-
-void
-e_combo_button_set_icon (EComboButton *combo_button,
- GdkPixbuf *pixbuf)
-{
- g_return_if_fail (combo_button != NULL);
- g_return_if_fail (E_IS_COMBO_BUTTON (combo_button));
-
- set_icon (combo_button, pixbuf);
-}
-
-void
-e_combo_button_set_label (EComboButton *combo_button,
- const char *label)
-{
- EComboButtonPrivate *priv;
-
- g_return_if_fail (combo_button != NULL);
- g_return_if_fail (E_IS_COMBO_BUTTON (combo_button));
-
- priv = combo_button->priv;
-
- if (label == NULL)
- label = "";
-
- gtk_label_set_label (GTK_LABEL (priv->label), label);
- gtk_label_set_use_markup (GTK_LABEL (priv->label), FALSE);
- gtk_label_set_use_underline (GTK_LABEL (priv->label), TRUE);
-}
-
-void
-e_combo_button_set_menu (EComboButton *combo_button,
- GtkMenu *menu)
-{
- EComboButtonPrivate *priv;
-
- g_return_if_fail (combo_button != NULL);
- g_return_if_fail (E_IS_COMBO_BUTTON (combo_button));
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- priv = combo_button->priv;
-
- if (priv->menu != NULL)
- gtk_menu_detach (priv->menu);
-
- priv->menu = menu;
- if (menu == NULL)
- return;
-
- gtk_menu_attach_to_widget (menu, GTK_WIDGET (combo_button), menu_detacher);
-
- g_signal_connect((menu), "deactivate",
- G_CALLBACK (menu_deactivate_callback),
- combo_button);
-}
-
-GtkWidget *
-e_combo_button_get_label (EComboButton *combo_button)
-{
- EComboButtonPrivate *priv;
-
- g_return_val_if_fail (combo_button != NULL, NULL);
- g_return_val_if_fail (E_IS_COMBO_BUTTON (combo_button), NULL);
-
- priv = combo_button->priv;
-
- return priv->label;
-}
-
-gboolean
-e_combo_button_popup_menu (EComboButton *combo_button)
-{
- return e_combo_button_popup (combo_button, NULL);
-}
diff --git a/widgets/misc/e-combo-button.h b/widgets/misc/e-combo-button.h
deleted file mode 100644
index edeb1be9bd..0000000000
--- a/widgets/misc/e-combo-button.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_COMBO_BUTTON_H_
-#define _E_COMBO_BUTTON_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_COMBO_BUTTON (e_combo_button_get_type ())
-#define E_COMBO_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_COMBO_BUTTON, EComboButton))
-#define E_COMBO_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_COMBO_BUTTON, EComboButtonClass))
-#define E_IS_COMBO_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_COMBO_BUTTON))
-#define E_IS_COMBO_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_COMBO_BUTTON))
-
-
-typedef struct _EComboButton EComboButton;
-typedef struct _EComboButtonPrivate EComboButtonPrivate;
-typedef struct _EComboButtonClass EComboButtonClass;
-
-struct _EComboButton {
- GtkButton parent;
-
- EComboButtonPrivate *priv;
-};
-
-struct _EComboButtonClass {
- GtkButtonClass parent_class;
-
- /* Signals. */
- void (* activate_default) (EComboButton *combo_button);
-};
-
-
-GType e_combo_button_get_type (void);
-void e_combo_button_construct (EComboButton *combo_button);
-GtkWidget *e_combo_button_new (void);
-
-void e_combo_button_set_icon (EComboButton *combo_button,
- GdkPixbuf *pixbuf);
-void e_combo_button_set_label (EComboButton *combo_button,
- const char *label);
-void e_combo_button_set_menu (EComboButton *combo_button,
- GtkMenu *menu);
-void e_combo_button_pack_vbox (EComboButton *combo_button);
-void e_combo_button_pack_hbox (EComboButton *combo_button);
-
-GtkWidget *e_combo_button_get_label (EComboButton *combo_button);
-
-gboolean e_combo_button_popup_menu (EComboButton *combo_button);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_COMBO_BUTTON_H_ */
diff --git a/widgets/misc/e-config-page.h b/widgets/misc/e-config-page.h
deleted file mode 100644
index 886d89d851..0000000000
--- a/widgets/misc/e-config-page.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_CONFIG_PAGE_H_
-#define _E_CONFIG_PAGE_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_CONFIG_PAGE (e_config_page_get_type ())
-#define E_CONFIG_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONFIG_PAGE, EConfigPage))
-#define E_CONFIG_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONFIG_PAGE, EConfigPageClass))
-#define E_IS_CONFIG_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONFIG_PAGE))
-#define E_IS_CONFIG_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONFIG_PAGE))
-
-
-typedef struct _EConfigPage EConfigPage;
-typedef struct _EConfigPagePrivate EConfigPagePrivate;
-typedef struct _EConfigPageClass EConfigPageClass;
-
-struct _EConfigPage {
- GtkEventBox parent;
-
- EConfigPagePrivate *priv;
-};
-
-struct _EConfigPageClass {
- GtkEventBoxClass parent_class;
-
-};
-
-
-GType e_config_page_get_type (void);
-GtkWidget *e_config_page_new (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_CONFIG_PAGE_H_ */
diff --git a/widgets/misc/e-dropdown-button.c b/widgets/misc/e-dropdown-button.c
deleted file mode 100644
index 00b2695e5f..0000000000
--- a/widgets/misc/e-dropdown-button.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-dropdown-button.h"
-
-#include <stdio.h>
-
-struct _EDropdownButtonPrivate {
- GtkAccelGroup *accel_group;
- GtkWidget *menu;
-};
-
-G_DEFINE_TYPE (EDropdownButton, e_dropdown_button, GTK_TYPE_TOGGLE_BUTTON)
-
-/* Callback to position the pop-up menu. */
-
-static void
-menu_position_cb (GtkMenu *menu,
- int *x,
- int *y,
- gboolean *push_in,
- void *data)
-{
- EDropdownButton *dropdown_button;
- EDropdownButtonPrivate *priv;
- GtkRequisition menu_requisition;
- int max_x, max_y;
-
- dropdown_button = E_DROPDOWN_BUTTON (data);
- priv = dropdown_button->priv;
-
- /* Calculate our preferred position. */
- gdk_window_get_origin (GTK_WIDGET (dropdown_button)->window, x, y);
- *y += GTK_WIDGET (dropdown_button)->allocation.height;
-
- /* Now make sure we are on the screen. */
- gtk_widget_size_request (GTK_WIDGET (priv->menu), &menu_requisition);
- max_x = MAX (0, gdk_screen_width () - menu_requisition.width);
- max_y = MAX (0, gdk_screen_height () - menu_requisition.height);
-
- *x = CLAMP (*x, 0, max_x);
- *y = CLAMP (*y, 0, max_y);
-}
-
-/* Callback for the "deactivate" signal on the pop-up menu. This is used so
- that we unset the state of the toggle button when the pop-up menu
- disappears. */
-
-static int
-menu_deactivate_cb (GtkMenuShell *menu_shell,
- void *data)
-{
- EDropdownButton *dropdown_button;
-
- dropdown_button = E_DROPDOWN_BUTTON (data);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dropdown_button), FALSE);
- return TRUE;
-}
-
-
-/* GtkObject methods. */
-
-static void
-impl_destroy (GtkObject *object)
-{
- EDropdownButton *dropdown_button;
- EDropdownButtonPrivate *priv;
-
- dropdown_button = E_DROPDOWN_BUTTON (object);
- priv = dropdown_button->priv;
-
- g_object_unref (priv->accel_group);
- gtk_widget_destroy (priv->menu);
-
- g_free (priv);
-
- if (GTK_OBJECT_CLASS (e_dropdown_button_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (e_dropdown_button_parent_class)->destroy) (object);
-}
-
-
-/* GtkWidget methods. */
-
-static void
-impl_toggled (GtkToggleButton *toggle_button)
-{
- EDropdownButton *dropdown_button;
- EDropdownButtonPrivate *priv;
-
- if (GTK_TOGGLE_BUTTON_CLASS (e_dropdown_button_parent_class)->toggled)
- GTK_TOGGLE_BUTTON_CLASS (e_dropdown_button_parent_class)->toggled (toggle_button);
-
- dropdown_button = E_DROPDOWN_BUTTON (toggle_button);
- priv = dropdown_button->priv;
-
- if (toggle_button->active) {
- gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL,
- menu_position_cb, dropdown_button,
- 1, GDK_CURRENT_TIME);
- } else {
- gtk_menu_popdown (GTK_MENU (priv->menu));
- }
-}
-
-
-static void
-e_dropdown_button_class_init (EDropdownButtonClass *klass)
-{
- GtkObjectClass *object_class;
- GtkToggleButtonClass *toggle_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
- toggle_class = GTK_TOGGLE_BUTTON_CLASS (klass);
-
- object_class->destroy = impl_destroy;
- toggle_class->toggled = impl_toggled;
-}
-
-
-static void
-e_dropdown_button_init (EDropdownButton *dropdown_button)
-{
- EDropdownButtonPrivate *priv;
-
- priv = g_new (EDropdownButtonPrivate, 1);
- priv->accel_group = gtk_accel_group_new ();
- priv->menu = NULL;
-
- dropdown_button->priv = priv;
-}
-
-
-/**
- * e_dropdown_button_construct:
- * @dropdown_button: A pointer to an %EDropdownButton object
- * @label_text: Text to display in the button
- * @menu: The menu to pop up when the button is pressed
- *
- * Construct the @dropdown_button with the specified @label_text and the
- * associated @menu.
- **/
-void
-e_dropdown_button_construct (EDropdownButton *dropdown_button,
- const char *label_text,
- GtkMenu *menu)
-{
- EDropdownButtonPrivate *priv;
- GtkWidget *hbox;
- GtkWidget *arrow;
- GtkWidget *label;
- guint accel_key;
-
- g_return_if_fail (dropdown_button != NULL);
- g_return_if_fail (E_IS_DROPDOWN_BUTTON (dropdown_button));
- g_return_if_fail (label_text != NULL);
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- priv = dropdown_button->priv;
-
- hbox = gtk_hbox_new (FALSE, 2);
- gtk_container_add (GTK_CONTAINER (dropdown_button), hbox);
- gtk_widget_show (hbox);
-
- label = gtk_label_new ("");
- gtk_label_set_label (GTK_LABEL (label), label_text);
- gtk_label_set_use_markup (GTK_LABEL (label), FALSE);
- gtk_label_set_use_underline (GTK_LABEL (label), TRUE);
-
- accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
- gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
- gtk_widget_show (label);
- gtk_widget_add_accelerator (GTK_WIDGET (dropdown_button), "clicked",
- priv->accel_group, accel_key, GDK_MOD1_MASK, 0);
-
- arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
- gtk_box_pack_start (GTK_BOX (hbox), arrow, FALSE, FALSE, 2);
- gtk_widget_show (arrow);
-
- priv->menu = GTK_WIDGET (menu);
-
- g_signal_connect_object (priv->menu, "deactivate",
- G_CALLBACK (menu_deactivate_cb),
- dropdown_button, 0);
-}
-
-/**
- * e_dropdown_button_new:
- * @label_text: Text to display in the button
- * @menu: The menu to pop up when the button is pressed
- *
- * Create a new dropdown button. When the button is clicked, the specified
- * @menu will be popped up.
- *
- * Return value: A pointer to the newly created %EDropdownButton.
- **/
-GtkWidget *
-e_dropdown_button_new (const char *label_text,
- GtkMenu *menu)
-{
- GtkWidget *widget;
-
- g_return_val_if_fail (label_text != NULL, NULL);
- g_return_val_if_fail (menu != NULL, NULL);
- g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
-
- widget = g_object_new (e_dropdown_button_get_type (), NULL);
-
- e_dropdown_button_construct (E_DROPDOWN_BUTTON (widget), label_text, menu);
- return widget;
-}
-
diff --git a/widgets/misc/e-dropdown-button.h b/widgets/misc/e-dropdown-button.h
deleted file mode 100644
index bd4fe6feb4..0000000000
--- a/widgets/misc/e-dropdown-button.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_DROPDOWN_BUTTON_H_
-#define _E_DROPDOWN_BUTTON_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_DROPDOWN_BUTTON (e_dropdown_button_get_type ())
-#define E_DROPDOWN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_DROPDOWN_BUTTON, EDropdownButton))
-#define E_DROPDOWN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_DROPDOWN_BUTTON, EDropdownButtonClass))
-#define E_IS_DROPDOWN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_DROPDOWN_BUTTON))
-#define E_IS_DROPDOWN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_DROPDOWN_BUTTON))
-
-
-typedef struct _EDropdownButton EDropdownButton;
-typedef struct _EDropdownButtonPrivate EDropdownButtonPrivate;
-typedef struct _EDropdownButtonClass EDropdownButtonClass;
-
-struct _EDropdownButton {
- GtkToggleButton parent;
-
- EDropdownButtonPrivate *priv;
-};
-
-struct _EDropdownButtonClass {
- GtkToggleButtonClass parent_class;
-};
-
-
-GType e_dropdown_button_get_type (void);
-void e_dropdown_button_construct (EDropdownButton *dropdown_button,
- const char *label_text,
- GtkMenu *menu);
-GtkWidget *e_dropdown_button_new (const char *label_text,
- GtkMenu *menu);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_DROPDOWN_BUTTON_H_ */
diff --git a/widgets/misc/e-file-activity.c b/widgets/misc/e-file-activity.c
new file mode 100644
index 0000000000..e35ab4955c
--- /dev/null
+++ b/widgets/misc/e-file-activity.c
@@ -0,0 +1,365 @@
+/*
+ * e-file-activity.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-file-activity.h"
+
+#include <stdarg.h>
+
+#define E_FILE_ACTIVITY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_FILE_ACTIVITY, EFileActivityPrivate))
+
+struct _EFileActivityPrivate {
+ GCancellable *cancellable;
+ GAsyncResult *result;
+ GFile *file;
+
+ gulong handler_id;
+};
+
+enum {
+ PROP_0,
+ PROP_CANCELLABLE,
+ PROP_FILE,
+ PROP_RESULT
+};
+
+static gpointer parent_class;
+
+static void
+file_activity_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CANCELLABLE:
+ e_file_activity_set_cancellable (
+ E_FILE_ACTIVITY (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_FILE:
+ e_file_activity_set_file (
+ E_FILE_ACTIVITY (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_RESULT:
+ e_file_activity_set_result (
+ E_FILE_ACTIVITY (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+file_activity_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CANCELLABLE:
+ g_value_set_object (
+ value, e_file_activity_get_cancellable (
+ E_FILE_ACTIVITY (object)));
+ return;
+
+ case PROP_FILE:
+ g_value_set_object (
+ value, e_file_activity_get_file (
+ E_FILE_ACTIVITY (object)));
+ return;
+
+ case PROP_RESULT:
+ g_value_set_object (
+ value, e_file_activity_get_result (
+ E_FILE_ACTIVITY (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+file_activity_dispose (GObject *object)
+{
+ EFileActivityPrivate *priv;
+
+ priv = E_FILE_ACTIVITY_GET_PRIVATE (object);
+
+ if (priv->cancellable != NULL) {
+ g_signal_handler_disconnect (
+ priv->cancellable, priv->handler_id);
+ g_object_unref (priv->cancellable);
+ priv->cancellable = NULL;
+ }
+
+ if (priv->result != NULL) {
+ g_object_unref (priv->result);
+ priv->result = NULL;
+ }
+
+ if (priv->file != NULL) {
+ g_object_unref (priv->file);
+ priv->file = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+file_activity_cancelled (EActivity *activity)
+{
+ EFileActivity *file_activity;
+ GCancellable *cancellable;
+
+ file_activity = E_FILE_ACTIVITY (activity);
+ cancellable = e_file_activity_get_cancellable (file_activity);
+ g_cancellable_cancel (cancellable);
+
+ /* Chain up to parent's cancelled() method. */
+ E_ACTIVITY_CLASS (parent_class)->cancelled (activity);
+}
+
+static void
+file_activity_class_init (EFileActivityClass *class)
+{
+ GObjectClass *object_class;
+ EActivityClass *activity_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EFileActivityPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = file_activity_set_property;
+ object_class->get_property = file_activity_get_property;
+ object_class->dispose = file_activity_dispose;
+
+ activity_class = E_ACTIVITY_CLASS (class);
+ activity_class->cancelled = file_activity_cancelled;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CANCELLABLE,
+ g_param_spec_object (
+ "cancellable",
+ "Cancellable",
+ NULL,
+ G_TYPE_CANCELLABLE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FILE,
+ g_param_spec_object (
+ "file",
+ "File",
+ NULL,
+ G_TYPE_FILE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_RESULT,
+ g_param_spec_object (
+ "result",
+ "Result",
+ NULL,
+ G_TYPE_ASYNC_RESULT,
+ G_PARAM_READWRITE));
+}
+
+static void
+file_activity_init (EFileActivity *file_activity)
+{
+ GCancellable *cancellable;
+
+ file_activity->priv = E_FILE_ACTIVITY_GET_PRIVATE (file_activity);
+
+ e_activity_set_allow_cancel (E_ACTIVITY (file_activity), TRUE);
+
+ cancellable = g_cancellable_new ();
+ e_file_activity_set_cancellable (file_activity, cancellable);
+ g_object_unref (cancellable);
+}
+
+GType
+e_file_activity_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EFileActivityClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) file_activity_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EFileActivity),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) file_activity_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_ACTIVITY, "EFileActivity", &type_info, 0);
+ }
+
+ return type;
+}
+
+EActivity *
+e_file_activity_new (const gchar *primary_text)
+{
+ return g_object_new (
+ E_TYPE_FILE_ACTIVITY,
+ "primary-text", primary_text, NULL);
+}
+
+EActivity *
+e_file_activity_newv (const gchar *format, ...)
+{
+ EActivity *activity;
+ gchar *primary_text;
+ va_list args;
+
+ va_start (args, format);
+ primary_text = g_strdup_vprintf (format, args);
+ activity = e_file_activity_new (primary_text);
+ g_free (primary_text);
+ va_end (args);
+
+ return activity;
+}
+
+GCancellable *
+e_file_activity_get_cancellable (EFileActivity *file_activity)
+{
+ g_return_val_if_fail (E_IS_FILE_ACTIVITY (file_activity), NULL);
+
+ return file_activity->priv->cancellable;
+}
+
+void
+e_file_activity_set_cancellable (EFileActivity *file_activity,
+ GCancellable *cancellable)
+{
+ g_return_if_fail (E_IS_FILE_ACTIVITY (file_activity));
+
+ if (cancellable != NULL) {
+ g_return_if_fail (G_IS_CANCELLABLE (cancellable));
+ g_object_ref (cancellable);
+ }
+
+ if (file_activity->priv->cancellable != NULL) {
+ g_signal_handler_disconnect (
+ file_activity->priv->cancellable,
+ file_activity->priv->handler_id);
+ g_object_unref (file_activity->priv->cancellable);
+ file_activity->priv->handler_id = 0;
+ }
+
+ file_activity->priv->cancellable = cancellable;
+
+ if (cancellable != NULL)
+ file_activity->priv->handler_id =
+ g_signal_connect_swapped (
+ cancellable, "cancelled",
+ G_CALLBACK (e_activity_cancel),
+ file_activity);
+
+ g_object_notify (G_OBJECT (file_activity), "cancellable");
+}
+
+GFile *
+e_file_activity_get_file (EFileActivity *file_activity)
+{
+ g_return_val_if_fail (E_IS_FILE_ACTIVITY (file_activity), NULL);
+
+ return file_activity->priv->file;
+}
+
+void
+e_file_activity_set_file (EFileActivity *file_activity,
+ GFile *file)
+{
+ g_return_if_fail (E_IS_FILE_ACTIVITY (file_activity));
+
+ if (file != NULL) {
+ g_return_if_fail (G_IS_FILE (file));
+ g_object_ref (file);
+ }
+
+ if (file_activity->priv->file != NULL)
+ g_object_unref (file_activity->priv->file);
+
+ file_activity->priv->file = file;
+
+ g_object_notify (G_OBJECT (file_activity), "file");
+}
+
+GAsyncResult *
+e_file_activity_get_result (EFileActivity *file_activity)
+{
+ g_return_val_if_fail (E_IS_FILE_ACTIVITY (file_activity), NULL);
+
+ return file_activity->priv->result;
+}
+
+void
+e_file_activity_set_result (EFileActivity *file_activity,
+ GAsyncResult *result)
+{
+ g_return_if_fail (E_IS_FILE_ACTIVITY (file_activity));
+
+ if (result != NULL) {
+ g_return_if_fail (G_IS_ASYNC_RESULT (result));
+ g_object_ref (result);
+ }
+
+ if (file_activity->priv->result != NULL)
+ g_object_unref (file_activity->priv->result);
+
+ file_activity->priv->result = result;
+
+ g_object_notify (G_OBJECT (file_activity), "result");
+}
+
+void
+e_file_activity_progress (goffset current_num_bytes,
+ goffset total_num_bytes,
+ gpointer activity)
+{
+ gdouble percent = -1.0;
+
+ g_return_if_fail (E_IS_ACTIVITY (activity));
+
+ if (current_num_bytes > 0 && total_num_bytes > 0)
+ percent = (gdouble) current_num_bytes / total_num_bytes;
+
+ e_activity_set_percent (activity, percent);
+}
diff --git a/widgets/misc/e-file-activity.h b/widgets/misc/e-file-activity.h
new file mode 100644
index 0000000000..b4a5433c21
--- /dev/null
+++ b/widgets/misc/e-file-activity.h
@@ -0,0 +1,83 @@
+/*
+ * e-file-activity.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_FILE_ACTIVITY_H
+#define E_FILE_ACTIVITY_H
+
+#include <gio/gio.h>
+#include <widgets/misc/e-activity.h>
+
+/* Standard GObject macros */
+#define E_TYPE_FILE_ACTIVITY \
+ (e_file_activity_get_type ())
+#define E_FILE_ACTIVITY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_FILE_ACTIVITY, EFileActivity))
+#define E_FILE_ACTIVITY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_FILE_ACTIVITY, EFileActivityClass))
+#define E_IS_FILE_ACTIVITY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_FILE_ACTIVITY))
+#define E_IS_FILE_ACTIVITY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_FILE_ACTIVITY))
+#define E_FILE_ACTIVITY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_FILE_ACTIVITY, EFileActivityClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EFileActivity EFileActivity;
+typedef struct _EFileActivityClass EFileActivityClass;
+typedef struct _EFileActivityPrivate EFileActivityPrivate;
+
+struct _EFileActivity {
+ EActivity parent;
+ EFileActivityPrivate *priv;
+};
+
+struct _EFileActivityClass {
+ EActivityClass parent_class;
+};
+
+GType e_file_activity_get_type (void);
+EActivity * e_file_activity_new (const gchar *primary_text);
+EActivity * e_file_activity_newv (const gchar *format,
+ ...) G_GNUC_PRINTF (1, 2);
+GCancellable * e_file_activity_get_cancellable (EFileActivity *file_activity);
+void e_file_activity_set_cancellable (EFileActivity *file_activity,
+ GCancellable *cancellable);
+GFile * e_file_activity_get_file (EFileActivity *file_activity);
+void e_file_activity_set_file (EFileActivity *file_activity,
+ GFile *file);
+GAsyncResult * e_file_activity_get_result (EFileActivity *file_activity);
+void e_file_activity_set_result (EFileActivity *file_activity,
+ GAsyncResult *result);
+
+/* This can be used as a GFileProgressCallback. */
+void e_file_activity_progress (goffset current_num_bytes,
+ goffset total_num_bytes,
+ gpointer activity);
+
+G_END_DECLS
+
+#endif /* E_FILE_ACTIVITY_H */
diff --git a/widgets/misc/e-filter-bar.c b/widgets/misc/e-filter-bar.c
index 9a67636939..a113d1f101 100644
--- a/widgets/misc/e-filter-bar.c
+++ b/widgets/misc/e-filter-bar.c
@@ -25,26 +25,14 @@
#endif
#include <string.h>
+#include <glib/gi18n.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
-#include <glib/gi18n.h>
-
-#include "e-dropdown-button.h"
#include "e-filter-bar.h"
#include "filter/rule-editor.h"
-#define d(x)
-
-enum {
- LAST_SIGNAL
-};
-
-/*static gint esb_signals [LAST_SIGNAL] = { 0, };*/
-
-static ESearchBarClass *parent_class = NULL;
-
/* The arguments we take */
enum {
PROP_0,
@@ -52,59 +40,26 @@ enum {
PROP_STATE
};
+static gpointer parent_class;
/* Callbacks. */
static void rule_changed (FilterRule *rule, gpointer user_data);
-
/* rule editor thingy */
static void
-rule_editor_destroyed (EFilterBar *efb, GObject *deadbeef)
-{
- efb->save_dialog = NULL;
- e_search_bar_set_menu_sensitive (E_SEARCH_BAR (efb), E_FILTERBAR_SAVE_ID, TRUE);
-}
-
-/* FIXME: need to update the popup menu to match any edited rules, sigh */
-static void
-full_rule_editor_response (GtkWidget *dialog, int response, void *data)
-{
- EFilterBar *efb = data;
-
- if (response == GTK_RESPONSE_OK)
- rule_context_save (efb->context, efb->userrules);
-
- gtk_widget_destroy (dialog);
-}
-
-static void
-rule_editor_response (GtkWidget *dialog, int response, void *data)
+rule_editor_destroyed (EFilterBar *filter_bar, GObject *deadbeef)
{
- EFilterBar *efb = data;
- FilterRule *rule;
-
- if (response == GTK_RESPONSE_OK) {
- rule = g_object_get_data (G_OBJECT (dialog), "rule");
- if (rule) {
- if (!filter_rule_validate (rule))
- return;
-
- rule_context_add_rule (efb->context, rule);
- /* FIXME: check return */
- rule_context_save (efb->context, efb->userrules);
- }
- }
-
- gtk_widget_destroy (dialog);
+ filter_bar->save_dialog = NULL;
+ e_search_bar_set_menu_sensitive (E_SEARCH_BAR (filter_bar), E_FILTERBAR_SAVE_ID, TRUE);
}
static void
rule_advanced_response (GtkWidget *dialog, int response, void *data)
{
- EFilterBar *efb = data;
+ EFilterBar *filter_bar = data;
/* the below generates a compiler warning about incompatible pointer types */
- ESearchBar *esb = (ESearchBar *)efb;
+ ESearchBar *search_bar = (ESearchBar *)filter_bar;
FilterRule *rule;
if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY) {
@@ -115,27 +70,29 @@ rule_advanced_response (GtkWidget *dialog, int response, void *data)
if (!filter_rule_validate (rule))
return;
- efb->current_query = rule;
+ filter_bar->current_query = rule;
g_object_ref (rule);
- gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED]));
- gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
- gtk_widget_modify_base (esb->viewoption, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
- e_search_bar_set_text (esb,_("Advanced Search"));
- gtk_widget_set_sensitive (esb->clear_button, TRUE);
+ gtk_widget_modify_base (search_bar->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+ gtk_widget_modify_text (search_bar->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (search_bar->icon_entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (search_bar->viewoption, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+ e_search_bar_set_text (search_bar,_("Advanced Search"));
+ gtk_widget_set_sensitive (search_bar->clear_button, TRUE);
+
+ g_signal_emit_by_name (efb, "search_activated");
g_signal_emit_by_name (efb, "search_activated");
if (response == GTK_RESPONSE_APPLY) {
- if (!rule_context_find_rule (efb->context, rule->name, rule->source))
- rule_context_add_rule (efb->context, rule);
+ if (!rule_context_find_rule (filter_bar->context, rule->name, rule->source))
+ rule_context_add_rule (filter_bar->context, rule);
/* FIXME: check return */
- rule_context_save (efb->context, efb->userrules);
+ rule_context_save (filter_bar->context, filter_bar->userrules);
}
}
} else {
- e_search_bar_set_item_id (esb, esb->last_search_option);
+ e_search_bar_set_item_id (search_bar, search_bar->last_search_option);
}
if (response != GTK_RESPONSE_APPLY)
@@ -145,34 +102,26 @@ rule_advanced_response (GtkWidget *dialog, int response, void *data)
static void
dialog_rule_changed (FilterRule *fr, GtkWidget *dialog)
{
- gboolean sensitive;
-
- g_return_if_fail (dialog != NULL);
-
- sensitive = fr && fr->parts;
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, sensitive);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, sensitive);
+ /* mbarnes: converted */
}
static void
-do_advanced (ESearchBar *esb)
+do_advanced (ESearchBar *search_bar)
{
- EFilterBar *efb = (EFilterBar *)esb;
-
- d(printf("Advanced search!\n"));
+ EFilterBar *filter_bar = (EFilterBar *)search_bar;
- if (!efb->save_dialog && !efb->setquery) {
+ if (!filter_bar->save_dialog && !filter_bar->setquery) {
GtkWidget *dialog, *w;
FilterRule *rule;
- if (efb->current_query)
- rule = filter_rule_clone (efb->current_query);
+ if (filter_bar->current_query)
+ rule = filter_rule_clone (filter_bar->current_query);
else {
rule = filter_rule_new ();
- efb->current_query = rule;
+ filter_bar->current_query = rule;
}
- w = filter_rule_get_widget (rule, efb->context);
+ w = filter_rule_get_widget (rule, filter_bar->context);
filter_rule_set_source (rule, FILTER_SOURCE_INCOMING);
gtk_container_set_border_width (GTK_CONTAINER (w), 12);
@@ -182,7 +131,7 @@ do_advanced (ESearchBar *esb)
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
- efb->save_dialog = dialog;
+ filter_bar->save_dialog = dialog;
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
@@ -198,129 +147,71 @@ do_advanced (ESearchBar *esb)
g_signal_connect (rule, "changed", G_CALLBACK (dialog_rule_changed), dialog);
dialog_rule_changed (rule, dialog);
- g_signal_connect (dialog, "response", G_CALLBACK (rule_advanced_response), efb);
- g_object_weak_ref ((GObject *) dialog, (GWeakNotify) rule_editor_destroyed, efb);
+ g_signal_connect (dialog, "response", G_CALLBACK (rule_advanced_response), filter_bar);
+ g_object_weak_ref ((GObject *) dialog, (GWeakNotify) rule_editor_destroyed, filter_bar);
- e_search_bar_set_menu_sensitive (esb, E_FILTERBAR_SAVE_ID, FALSE);
+ e_search_bar_set_menu_sensitive (search_bar, E_FILTERBAR_SAVE_ID, FALSE);
gtk_widget_show (dialog);
}
}
static void
-save_search_dialog (ESearchBar *esb)
+save_search_dialog (ESearchBar *search_bar)
{
- FilterRule *rule;
- char *name, *text;
- GtkWidget *dialog, *w;
-
- EFilterBar *efb = (EFilterBar *)esb;
-
- rule = filter_rule_clone (efb->current_query);
- text = e_search_bar_get_text (esb);
- name = g_strdup_printf ("%s %s", rule->name, text && text[0] ? text : "''");
- filter_rule_set_name (rule, name);
- g_free (text);
- g_free (name);
-
- w = filter_rule_get_widget (rule, efb->context);
- filter_rule_set_source (rule, FILTER_SOURCE_INCOMING);
- gtk_container_set_border_width (GTK_CONTAINER (w), 12);
-
- /* FIXME: get the toplevel window... */
- dialog = gtk_dialog_new_with_buttons (_("Save Search"), NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
- efb->save_dialog = dialog;
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
-
- gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300);
-
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), w, TRUE, TRUE, 0);
-
- g_object_ref (rule);
- g_object_set_data_full ((GObject *) dialog, "rule", rule, (GDestroyNotify) g_object_unref);
- g_signal_connect (dialog, "response", G_CALLBACK (rule_editor_response), efb);
- g_object_weak_ref ((GObject *) dialog, (GWeakNotify) rule_editor_destroyed, efb);
-
- g_signal_connect (rule, "changed", G_CALLBACK (dialog_rule_changed), dialog);
- dialog_rule_changed (rule, dialog);
-
- e_search_bar_set_menu_sensitive (esb, E_FILTERBAR_SAVE_ID, FALSE);
-
- gtk_widget_show (dialog);
+ /* mbarnes: converted */
}
static void
-menubar_activated (ESearchBar *esb, int id, void *data)
+menubar_activated (ESearchBar *search_bar, int id, void *data)
{
- EFilterBar *efb = (EFilterBar *)esb;
+ EFilterBar *filter_bar = (EFilterBar *)search_bar;
GtkWidget *dialog;
GtkStyle *style;
- d(printf ("menubar activated!\n"));
-
switch (id) {
case E_FILTERBAR_EDIT_ID:
- if (!efb->save_dialog) {
- efb->save_dialog = dialog = (GtkWidget *) rule_editor_new (efb->context, FILTER_SOURCE_INCOMING, _("_Searches"));
-
- gtk_window_set_title (GTK_WINDOW (dialog), _("Searches"));
- g_signal_connect (dialog, "response", G_CALLBACK (full_rule_editor_response), efb);
- g_object_weak_ref ((GObject *) dialog, (GWeakNotify) rule_editor_destroyed, efb);
- gtk_widget_show (dialog);
- }
+ /* mbarnes: converted */
break;
case E_FILTERBAR_SAVE_ID:
- if (efb->current_query && !efb->save_dialog)
- save_search_dialog (esb);
+ if (filter_bar->current_query && !filter_bar->save_dialog)
+ save_search_dialog (search_bar);
- d(printf("Save menu\n"));
break;
case E_FILTERBAR_ADVANCED_ID:
- e_search_bar_set_item_id (esb, E_FILTERBAR_ADVANCED_ID);
+ e_search_bar_set_item_id (search_bar, E_FILTERBAR_ADVANCED_ID);
break;
default:
- if (id >= efb->menu_base && id < efb->menu_base + efb->menu_rules->len) {
-#if d(!)0
- GString *out = g_string_new ("");
+ if (id >= filter_bar->menu_base && id < filter_bar->menu_base + filter_bar->menu_rules->len) {
+ filter_bar->current_query = (FilterRule *)filter_bar->menu_rules->pdata[id - filter_bar->menu_base];
- printf("Selected rule: %s\n", ((FilterRule *)efb->menu_rules->pdata[id - efb->menu_base])->name);
- filter_rule_build_code (efb->menu_rules->pdata[id - efb->menu_base], out);
- printf("query: '%s'\n", out->str);
- g_string_free (out, TRUE);
-#endif
- efb->current_query = (FilterRule *)efb->menu_rules->pdata[id - efb->menu_base];
-
- efb->setquery = TRUE;
- e_search_bar_set_item_id (esb, E_FILTERBAR_ADVANCED_ID);
- efb->setquery = FALSE;
+ filter_bar->setquery = TRUE;
+ e_search_bar_set_item_id (search_bar, E_FILTERBAR_ADVANCED_ID);
+ filter_bar->setquery = FALSE;
/* saved searches activated */
style = gtk_widget_get_default_style ();
- efb->setquery = TRUE;
- gtk_widget_modify_base (esb->entry , GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED] ));
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, &(style->text [GTK_STATE_SELECTED] ));
- gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, &(style->base [GTK_STATE_SELECTED] ));
- gtk_widget_modify_base (esb->viewoption, GTK_STATE_NORMAL, &(style->base [GTK_STATE_SELECTED] ));
- e_search_bar_set_text (esb,_("Advanced Search"));
- g_signal_emit_by_name (efb, "search_activated", NULL);
- efb->setquery = FALSE;
+ filter_bar->setquery = TRUE;
+ gtk_widget_modify_base (search_bar->entry , GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED] ));
+ gtk_widget_modify_text (search_bar->entry, GTK_STATE_NORMAL, &(style->text [GTK_STATE_SELECTED] ));
+ gtk_widget_modify_base (search_bar->icon_entry, GTK_STATE_NORMAL, &(style->base [GTK_STATE_SELECTED] ));
+ gtk_widget_modify_base (search_bar->viewoption, GTK_STATE_NORMAL, &(style->base [GTK_STATE_SELECTED] ));
+ e_search_bar_set_text (search_bar,_("Advanced Search"));
+ g_signal_emit_by_name (filter_bar, "search_activated", NULL);
+ filter_bar->setquery = FALSE;
} else {
return;
}
}
- g_signal_stop_emission_by_name (esb, "menu_activated");
+ g_signal_stop_emission_by_name (search_bar, "menu_activated");
}
static void
-option_changed (ESearchBar *esb, void *data)
+option_changed (ESearchBar *search_bar, void *data)
{
- EFilterBar *efb = (EFilterBar *)esb;
- int id = e_search_bar_get_item_id (esb);
+ EFilterBar *filter_bar = (EFilterBar *)search_bar;
+ int id = e_search_bar_get_item_id (search_bar);
char *query;
d(printf("option changed, id = %d, setquery = %s %d\n", id, efb->setquery ? "true" : "false", esb->block_search));
@@ -331,27 +222,26 @@ option_changed (ESearchBar *esb, void *data)
switch (id) {
case E_FILTERBAR_SAVE_ID:
/* Fixme */
- /* save_search_dialog (esb); */
+ /* save_search_dialog (search_bar); */
break;
case E_FILTERBAR_ADVANCED_ID:
- d(printf ("do_advanced\n"));
- if (!esb->block_search)
- do_advanced (esb);
+ if (!search_bar->block_search)
+ do_advanced (search_bar);
break;
default:
- if (id >= efb->option_base && id < efb->option_base + efb->option_rules->len) {
- efb->current_query = (FilterRule *)efb->option_rules->pdata[id - efb->option_base];
- if (efb->config && efb->current_query) {
- query = e_search_bar_get_text (esb);
- efb->config (efb, efb->current_query, id, query, efb->config_data);
+ if (id >= filter_bar->option_base && id < filter_bar->option_base + filter_bar->option_rules->len) {
+ filter_bar->current_query = (FilterRule *)filter_bar->option_rules->pdata[id - filter_bar->option_base];
+ if (filter_bar->config && filter_bar->current_query) {
+ query = e_search_bar_get_text (search_bar);
+ filter_bar->config (filter_bar, filter_bar->current_query, id, query, filter_bar->config_data);
g_free (query);
}
} else {
- gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, NULL);
- efb->current_query = NULL;
- gtk_entry_set_text ((GtkEntry *)esb->entry, "");
+ gtk_widget_modify_base (search_bar->entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_modify_text (search_bar->entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_modify_base (search_bar->icon_entry, GTK_STATE_NORMAL, NULL);
+ filter_bar->current_query = NULL;
+ gtk_entry_set_text ((GtkEntry *)search_bar->entry, "");
}
}
}
@@ -366,10 +256,10 @@ dup_item_no_subitems (ESearchBarItem *dest,
}
static GArray *
-build_items (ESearchBar *esb, ESearchBarItem *items, int type, int *start, GPtrArray *rules)
+build_items (ESearchBar *search_bar, ESearchBarItem *items, int type, int *start, GPtrArray *rules)
{
FilterRule *rule = NULL;
- EFilterBar *efb = (EFilterBar *)esb;
+ EFilterBar *filter_bar = (EFilterBar *)search_bar;
int id = 0, i;
GArray *menu = g_array_new (FALSE, FALSE, sizeof (ESearchBarItem));
ESearchBarItem item = { NULL, -1, 2 };
@@ -399,7 +289,7 @@ build_items (ESearchBar *esb, ESearchBarItem *items, int type, int *start, GPtrA
source = FILTER_SOURCE_INCOMING;
/* Add a separator if there is at least one custom rule. */
- if (rule_context_next_rule (efb->context, rule, source) != NULL) {
+ if (rule_context_next_rule (filter_bar->context, rule, source) != NULL) {
item.id = 0;
item.text = NULL;
item.type = 0;
@@ -410,7 +300,7 @@ build_items (ESearchBar *esb, ESearchBarItem *items, int type, int *start, GPtrA
}
num = 1;
- while ((rule = rule_context_next_rule (efb->context, rule, source))) {
+ while ((rule = rule_context_next_rule (filter_bar->context, rule, source))) {
item.id = id++;
if (type == 0 && num <= 10) {
@@ -423,7 +313,7 @@ build_items (ESearchBar *esb, ESearchBarItem *items, int type, int *start, GPtrA
if (g_slist_find(gtksux, rule) == NULL) {
g_object_ref (rule);
- g_signal_connect (rule, "changed", G_CALLBACK (rule_changed), efb);
+ g_signal_connect (rule, "changed", G_CALLBACK (rule_changed), filter_bar);
} else {
gtksux = g_slist_remove(gtksux, rule);
}
@@ -437,7 +327,7 @@ build_items (ESearchBar *esb, ESearchBarItem *items, int type, int *start, GPtrA
next = gtksux->next;
rule = gtksux->data;
- g_signal_handlers_disconnect_by_func (rule, G_CALLBACK (rule_changed), efb);
+ g_signal_handlers_disconnect_by_func (rule, G_CALLBACK (rule_changed), filter_bar);
g_object_unref (rule);
g_slist_free_1(gtksux);
@@ -480,13 +370,13 @@ free_built_items (GArray *menu)
}
static void
-generate_menu (ESearchBar *esb, ESearchBarItem *items)
+generate_menu (ESearchBar *search_bar, ESearchBarItem *items)
{
- EFilterBar *efb = (EFilterBar *)esb;
+ EFilterBar *filter_bar = (EFilterBar *)search_bar;
GArray *menu;
- menu = build_items (esb, items, 0, &efb->menu_base, efb->menu_rules);
- ((ESearchBarClass *)parent_class)->set_menu (esb, (ESearchBarItem *)menu->data);
+ menu = build_items (search_bar, items, 0, &filter_bar->menu_base, filter_bar->menu_rules);
+ ((ESearchBarClass *)parent_class)->set_menu (search_bar, (ESearchBarItem *)menu->data);
free_built_items (menu);
}
@@ -504,14 +394,14 @@ free_items (ESearchBarItem *items)
/* Virtual methods */
static void
-set_menu (ESearchBar *esb, ESearchBarItem *items)
+set_menu (ESearchBar *search_bar, ESearchBarItem *items)
{
- EFilterBar *efb = E_FILTER_BAR (esb);
+ EFilterBar *filter_bar = E_FILTER_BAR (search_bar);
ESearchBarItem *default_items;
int i, num;
- if (efb->default_items)
- free_items (efb->default_items);
+ if (filter_bar->default_items)
+ free_items (filter_bar->default_items);
for (num = 0; items[num].id != -1; num++)
;
@@ -523,72 +413,72 @@ set_menu (ESearchBar *esb, ESearchBarItem *items)
default_items[i].type = items[i].type;
}
- efb->default_items = default_items;
+ filter_bar->default_items = default_items;
- generate_menu (esb, default_items);
+ generate_menu (search_bar, default_items);
}
static void
-set_option (ESearchBar *esb, ESearchBarItem *items)
+set_option (ESearchBar *search_bar, ESearchBarItem *items)
{
GArray *menu;
- EFilterBar *efb = (EFilterBar *)esb;
+ EFilterBar *filter_bar = (EFilterBar *)search_bar;
- menu = build_items (esb, items, 1, &efb->option_base, efb->option_rules);
- ((ESearchBarClass *)parent_class)->set_option (esb, (ESearchBarItem *)menu->data);
+ menu = build_items (search_bar, items, 1, &filter_bar->option_base, filter_bar->option_rules);
+ ((ESearchBarClass *)parent_class)->set_option (search_bar, (ESearchBarItem *)menu->data);
free_built_items (menu);
- e_search_bar_set_item_id (esb, efb->option_base);
+ e_search_bar_set_item_id (search_bar, filter_bar->option_base);
}
static void
context_changed (RuleContext *context, gpointer user_data)
{
- EFilterBar *efb = E_FILTER_BAR (user_data);
- ESearchBar *esb = E_SEARCH_BAR (user_data);
+ EFilterBar *filter_bar = E_FILTER_BAR (user_data);
+ ESearchBar *search_bar = E_SEARCH_BAR (user_data);
/* just generate whole menu again */
- generate_menu (esb, efb->default_items);
+ generate_menu (search_bar, filter_bar->default_items);
}
static void
context_rule_removed (RuleContext *context, FilterRule *rule, gpointer user_data)
{
- EFilterBar *efb = E_FILTER_BAR (user_data);
- ESearchBar *esb = E_SEARCH_BAR (user_data);
+ EFilterBar *filter_bar = E_FILTER_BAR (user_data);
+ ESearchBar *search_bar = E_SEARCH_BAR (user_data);
/* just generate whole menu again */
- generate_menu (esb, efb->default_items);
+ generate_menu (search_bar, filter_bar->default_items);
}
static void
rule_changed (FilterRule *rule, gpointer user_data)
{
- EFilterBar *efb = E_FILTER_BAR (user_data);
- ESearchBar *esb = E_SEARCH_BAR (user_data);
+ EFilterBar *filter_bar = E_FILTER_BAR (user_data);
+ ESearchBar *search_bar = E_SEARCH_BAR (user_data);
/* just generate whole menu again */
- generate_menu (esb, efb->default_items);
+ generate_menu (search_bar, filter_bar->default_items);
}
-
-/* GtkObject methods. */
-
static void
-get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+filter_bar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- EFilterBar *efb = (EFilterBar *) object;
- ESearchBar *esb = E_SEARCH_BAR (object);
+ EFilterBar *filter_bar = (EFilterBar *) object;
+ ESearchBar *search_bar = E_SEARCH_BAR (object);
switch (property_id) {
case PROP_QUERY: {
- char *text = e_search_bar_get_text (E_SEARCH_BAR (efb));
+ char *text = e_search_bar_get_text (E_SEARCH_BAR (filter_bar));
/* empty search text means searching turned off */
- if (efb->current_query && text && *text) {
+ if (filter_bar->current_query && text && *text) {
GString *out = g_string_new ("");
- filter_rule_build_code (efb->current_query, out);
+ filter_rule_build_code (filter_bar->current_query, out);
g_value_take_string (value, out->str);
g_string_free (out, FALSE);
} else {
@@ -605,32 +495,32 @@ get_property (GObject *object, guint property_id, GValue *value, GParamSpec *psp
xmlNodePtr root, node;
xmlDocPtr doc;
- item_id = e_search_bar_get_item_id ((ESearchBar *) efb);
+ item_id = e_search_bar_get_item_id ((ESearchBar *) filter_bar);
doc = xmlNewDoc ((const unsigned char *)"1.0");
root = xmlNewDocNode (doc, NULL, (const unsigned char *)"state", NULL);
xmlDocSetRootElement (doc, root);
- searchscope = e_search_bar_get_search_scope ((ESearchBar *) efb);
- view_id = e_search_bar_get_viewitem_id ((ESearchBar *) efb);
+ searchscope = e_search_bar_get_search_scope ((ESearchBar *) filter_bar);
+ view_id = e_search_bar_get_viewitem_id ((ESearchBar *) filter_bar);
if (searchscope < E_FILTERBAR_CURRENT_FOLDER_ID)
- item_id = esb->last_search_option;
+ item_id = search_bar->last_search_option;
if (item_id == E_FILTERBAR_ADVANCED_ID) {
/* advanced query, save the filterbar state */
node = xmlNewChild (root, NULL, (const unsigned char *)"filter-bar", NULL);
- sprintf (buf, "%d", esb->last_search_option);
+ sprintf (buf, "%d", search_bar->last_search_option);
xmlSetProp (node, (const unsigned char *)"item_id", (unsigned char *)buf);
sprintf (buf, "%d", searchscope);
xmlSetProp (node, (const unsigned char *)"searchscope", (unsigned char *)buf);
sprintf (buf, "%d", view_id);
xmlSetProp (node, (const unsigned char *)"view_id", (unsigned char *)buf);
- xmlAddChild (node, filter_rule_xml_encode (efb->current_query));
+ xmlAddChild (node, filter_rule_xml_encode (filter_bar->current_query));
} else {
/* simple query, save the searchbar state */
- text = e_search_bar_get_text ((ESearchBar *) efb);
+ text = e_search_bar_get_text ((ESearchBar *) filter_bar);
node = xmlNewChild (root, NULL, (const unsigned char *)"search-bar", NULL);
xmlSetProp (node, (const unsigned char *)"text", (unsigned char *)(text ? text : ""));
@@ -678,10 +568,13 @@ xml_get_prop_int (xmlNodePtr node, const char *prop)
}
static void
-set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+filter_bar_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- EFilterBar *efb = (EFilterBar *) object;
- ESearchBar *esb = E_SEARCH_BAR (object);
+ EFilterBar *filter_bar = (EFilterBar *) object;
+ ESearchBar *search_bar = E_SEARCH_BAR (object);
xmlNodePtr root, node;
const char *state;
xmlDocPtr doc;
@@ -719,43 +612,43 @@ set_property (GObject *object, guint property_id, const GValue *value, GParamSpe
GtkStyle *style = gtk_widget_get_default_style ();
rule = filter_rule_new ();
- if (filter_rule_xml_decode (rule, node, efb->context) != 0) {
- gtk_widget_modify_base (E_SEARCH_BAR (efb)->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_text (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_base (((ESearchBar *)efb)->icon_entry, GTK_STATE_NORMAL, NULL);
+ if (filter_rule_xml_decode (rule, node, filter_bar->context) != 0) {
+ gtk_widget_modify_base (E_SEARCH_BAR (filter_bar)->entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_modify_text (((ESearchBar *)filter_bar)->entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_modify_base (((ESearchBar *)filter_bar)->icon_entry, GTK_STATE_NORMAL, NULL);
g_object_unref (rule);
rule = NULL;
} else {
rule_set = TRUE;
- gtk_widget_set_sensitive (esb->clear_button, TRUE);
- gtk_widget_modify_base (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
- gtk_widget_modify_text (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED]));
- gtk_widget_modify_base (((ESearchBar *)efb)->icon_entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
- gtk_widget_modify_base (((ESearchBar *)efb)->viewoption, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+ gtk_widget_set_sensitive (search_bar->clear_button, TRUE);
+ gtk_widget_modify_base (((ESearchBar *)filter_bar)->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+ gtk_widget_modify_text (((ESearchBar *)filter_bar)->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (((ESearchBar *)filter_bar)->icon_entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (((ESearchBar *)filter_bar)->viewoption, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
g_object_set_data_full (object, "rule", rule, (GDestroyNotify) g_object_unref);
}
}
if (rule_set) {
- esb->block_search = TRUE;
- e_search_bar_set_text (esb, _("Advanced Search"));
- e_search_bar_set_item_menu ((ESearchBar *) efb, item_id);
- e_search_bar_set_search_scope ((ESearchBar *) efb, scope);
- esb->block_search = FALSE;
- efb->current_query = (FilterRule *)efb->option_rules->pdata[item_id - efb->option_base];
- if (efb->config && efb->current_query) {
- char *query = e_search_bar_get_text (esb);
- efb->config (efb, efb->current_query, item_id, query, efb->config_data);
+ search_bar->block_search = TRUE;
+ e_search_bar_set_text (search_bar, _("Advanced Search"));
+ e_search_bar_set_item_menu ((ESearchBar *) filter_bar, item_id);
+ e_search_bar_set_search_scope ((ESearchBar *) filter_bar, scope);
+ search_bar->block_search = FALSE;
+ filter_bar->current_query = (FilterRule *)filter_bar->option_rules->pdata[item_id - filter_bar->option_base];
+ if (filter_bar->config && filter_bar->current_query) {
+ char *query = e_search_bar_get_text (search_bar);
+ filter_bar->config (filter_bar, filter_bar->current_query, item_id, query, filter_bar->config_data);
g_free (query);
}
}
- e_search_bar_set_viewitem_id ((ESearchBar *) efb, view_id);
- efb->current_query = rule;
- efb->setquery = TRUE;
- e_search_bar_set_item_id ((ESearchBar *) efb, E_FILTERBAR_ADVANCED_ID);
- efb->setquery = FALSE;
+ e_search_bar_set_viewitem_id ((ESearchBar *) filter_bar, view_id);
+ filter_bar->current_query = rule;
+ filter_bar->setquery = TRUE;
+ e_search_bar_set_item_id ((ESearchBar *) filter_bar, E_FILTERBAR_ADVANCED_ID);
+ filter_bar->setquery = FALSE;
break;
} else if (!strcmp ((char *)node->name, "search-bar")) {
@@ -770,36 +663,36 @@ set_property (GObject *object, guint property_id, const GValue *value, GParamSpe
item_id = xml_get_prop_int (node, "item_id");
subitem_id = xml_get_prop_int (node, "subitem_id");
- esb->block_search = TRUE;
+ search_bar->block_search = TRUE;
if (subitem_id >= 0)
- e_search_bar_set_ids (E_SEARCH_BAR (efb), item_id, subitem_id);
+ e_search_bar_set_ids (E_SEARCH_BAR (filter_bar), item_id, subitem_id);
else
- e_search_bar_set_item_menu (E_SEARCH_BAR (efb), item_id);
- esb->block_search = FALSE;
+ e_search_bar_set_item_menu (E_SEARCH_BAR (filter_bar), item_id);
+ search_bar->block_search = FALSE;
view_id = xml_get_prop_int (node, "view_id");
- e_search_bar_set_viewitem_id (E_SEARCH_BAR (efb), view_id);
+ e_search_bar_set_viewitem_id (E_SEARCH_BAR (filter_bar), view_id);
scope = xml_get_prop_int (node, "searchscope");
- e_search_bar_set_search_scope (E_SEARCH_BAR (efb), scope);
+ e_search_bar_set_search_scope (E_SEARCH_BAR (filter_bar), scope);
text = (char *)xmlGetProp (node, (const unsigned char *)"text");
- e_search_bar_set_text (E_SEARCH_BAR (efb), text);
+ e_search_bar_set_text (E_SEARCH_BAR (filter_bar), text);
if (text && *text) {
- efb->current_query = (FilterRule *)efb->option_rules->pdata[item_id - efb->option_base];
- if (efb->config && efb->current_query)
- efb->config (efb, efb->current_query, item_id, text, efb->config_data);
- gtk_widget_set_sensitive (esb->clear_button, TRUE);
- gtk_widget_modify_base (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
- gtk_widget_modify_text (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED]));
- gtk_widget_modify_base (((ESearchBar *)efb)->icon_entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
- gtk_widget_modify_base (((ESearchBar *)efb)->viewoption, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+ filter_bar->current_query = (FilterRule *)filter_bar->option_rules->pdata[item_id - filter_bar->option_base];
+ if (filter_bar->config && filter_bar->current_query)
+ filter_bar->config (filter_bar, filter_bar->current_query, item_id, text, filter_bar->config_data);
+ gtk_widget_set_sensitive (search_bar->clear_button, TRUE);
+ gtk_widget_modify_base (((ESearchBar *)filter_bar)->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+ gtk_widget_modify_text (((ESearchBar *)filter_bar)->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (((ESearchBar *)filter_bar)->icon_entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (((ESearchBar *)filter_bar)->viewoption, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
} else {
- gtk_widget_modify_base (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_text (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_base (((ESearchBar *)efb)->icon_entry, GTK_STATE_NORMAL, NULL);
- e_search_bar_paint (esb);
- efb->current_query = (FilterRule *)efb->option_rules->pdata[item_id - efb->option_base];
- if (efb->config && efb->current_query)
- efb->config (efb, efb->current_query, item_id, "", efb->config_data);
+ gtk_widget_modify_base (((ESearchBar *)filter_bar)->entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_modify_text (((ESearchBar *)filter_bar)->entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_modify_base (((ESearchBar *)filter_bar)->icon_entry, GTK_STATE_NORMAL, NULL);
+ e_search_bar_paint (search_bar);
+ filter_bar->current_query = (FilterRule *)filter_bar->option_rules->pdata[item_id - filter_bar->option_base];
+ if (filter_bar->config && filter_bar->current_query)
+ filter_bar->config (filter_bar, filter_bar->current_query, item_id, "", filter_bar->config_data);
}
xmlFree (text);
@@ -814,15 +707,15 @@ set_property (GObject *object, guint property_id, const GValue *value, GParamSpe
xmlFreeDoc (doc);
} else {
/* set default state */
- e_search_bar_set_item_id ((ESearchBar *) efb, 0);
- e_search_bar_set_viewitem_id ((ESearchBar *) efb, 0);
- e_search_bar_set_search_scope ((ESearchBar *) efb, E_FILTERBAR_CURRENT_FOLDER_ID);
+ e_search_bar_set_item_id ((ESearchBar *) filter_bar, 0);
+ e_search_bar_set_viewitem_id ((ESearchBar *) filter_bar, 0);
+ e_search_bar_set_search_scope ((ESearchBar *) filter_bar, E_FILTERBAR_CURRENT_FOLDER_ID);
}
/* we don't want to run option_changed */
- efb->setquery = TRUE;
- g_signal_emit_by_name (efb, "search_activated", NULL);
- efb->setquery = FALSE;
+ filter_bar->setquery = TRUE;
+ g_signal_emit_by_name (filter_bar, "search_activated", NULL);
+ filter_bar->setquery = FALSE;
break;
default:
@@ -831,22 +724,27 @@ set_property (GObject *object, guint property_id, const GValue *value, GParamSpe
}
}
-static void clear_rules(EFilterBar *efb, GPtrArray *rules)
+static void
+filter_bar_clear_rules (EFilterBar *filter_bar,
+ GPtrArray *rules)
{
- int i;
FilterRule *rule;
+ gint ii;
+
+ /* Clear out any data on old rules. */
+ for (ii = 0; ii < rules->len; ii++) {
+ FilterRule *rule = rules->pdata[ii];
- /* clear out any data on old rules */
- for (i=0;i<rules->len;i++) {
- rule = rules->pdata[i];
- g_signal_handlers_disconnect_by_func (rule, G_CALLBACK (rule_changed), efb);
+ g_signal_handlers_disconnect_by_func (
+ rule, G_CALLBACK (rule_changed), filter_bar);
g_object_unref(rule);
}
+
g_ptr_array_set_size (rules, 0);
}
static void
-dispose (GObject *object)
+filter_bar_dispose (GObject *object)
{
EFilterBar *bar;
@@ -859,8 +757,8 @@ dispose (GObject *object)
rule_context_save (bar->context, bar->userrules);
if (bar->menu_rules != NULL) {
- clear_rules(bar, bar->menu_rules);
- clear_rules(bar, bar->option_rules);
+ filter_bar_clear_rules (bar, bar->menu_rules);
+ filter_bar_clear_rules (bar, bar->option_rules);
g_ptr_array_free (bar->menu_rules, TRUE);
g_ptr_array_free (bar->option_rules, TRUE);
@@ -887,84 +785,83 @@ dispose (GObject *object)
bar->default_items = NULL;
}
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
-
static void
-class_init (EFilterBarClass *klass)
+class_init (EFilterBarClass *class)
{
- GObjectClass *object_class = (GObjectClass *) klass;
- ESearchBarClass *esb_class = (ESearchBarClass *) klass;
+ GObjectClass *object_class;
+ ESearchBarClass *search_bar_class;
GParamSpec *pspec;
- parent_class = g_type_class_ref (e_search_bar_get_type ());
-
- object_class->dispose = dispose;
- object_class->get_property = get_property;
- object_class->set_property = set_property;
-
- esb_class->set_menu = set_menu;
- esb_class->set_option = set_option;
-
- pspec = g_param_spec_string ("query", NULL, NULL, NULL, G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_QUERY, pspec);
-
- pspec = g_param_spec_string ("state", NULL, NULL, NULL, G_PARAM_READWRITE);
- g_object_class_install_property (object_class, PROP_STATE, pspec);
-
- /*gtk_object_add_arg_type ("EFilterBar::query", G_TYPE_STRING, GTK_ARG_READABLE, ARG_QUERY);*/
-
-#if 0
- esb_signals [QUERY_CHANGED] =
- g_signal_new ("query_changed",
- G_SIGNAL_RUN_LAST,
- object_class->type,
- G_STRUCT_OFFSET (EFilterBarClass, query_changed),
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- esb_signals [MENU_ACTIVATED] =
- g_signal_new ("menu_activated",
- G_SIGNAL_RUN_LAST,
- object_class->type,
- G_STRUCT_OFFSET (EFilterBarClass, menu_activated),
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, esb_signals, LAST_SIGNAL);
-#endif
+ parent_class = g_type_class_peek_parent (class);
+
+ object_class = G_OBJECT_CLASS (object_class);
+ object_class->set_property = filter_bar_set_property;
+ object_class->get_property = filter_bar_get_property;
+ object_class->dispose = filter_bar_dispose;
+
+ search_bar_class = E_SEARCH_BAR_CLASS (class);
+ search_bar_class->set_menu = set_menu;
+ search_bar_class->set_option = set_option;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_QUERY,
+ g_param_spec_string (
+ "query",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_STATE,
+ g_param_spec_string (
+ "state",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
}
static void
-init (EFilterBar *efb)
+filter_bar_init (EFilterBar *filter_bar)
{
- g_signal_connect (efb, "menu_activated", G_CALLBACK (menubar_activated), NULL);
- g_signal_connect (efb, "query_changed", G_CALLBACK (option_changed), NULL);
- g_signal_connect (efb, "search_activated", G_CALLBACK (option_changed), NULL);
+ g_signal_connect (filter_bar, "menu_activated", G_CALLBACK (menubar_activated), NULL);
+ g_signal_connect (filter_bar, "query_changed", G_CALLBACK (option_changed), NULL);
+ g_signal_connect (filter_bar, "search_activated", G_CALLBACK (option_changed), NULL);
- efb->menu_rules = g_ptr_array_new ();
- efb->option_rules = g_ptr_array_new ();
+ filter_bar->menu_rules = g_ptr_array_new ();
+ filter_bar->option_rules = g_ptr_array_new ();
}
-
-/* Object construction. */
-
-EFilterBar *
-e_filter_bar_new (RuleContext *context,
- const char *systemrules,
- const char *userrules,
- EFilterBarConfigRule config,
- void *data)
+GType
+e_filter_bar_get_type (void)
{
- EFilterBar *bar;
+ static GType type = 0;
- bar = g_object_new (e_filter_bar_get_type (), NULL);
- ((ESearchBar *)bar)->lite = FALSE;
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EFilterBarClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) filter_bar_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EFilterBar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) filter_bar_init,
+ NULL /* value_table */
+ };
- e_filter_bar_new_construct (context, systemrules, userrules, config, data, bar);
+ type = g_type_register_static (
+ E_TYPE_SEARCH_BAR, "EFilterBar", &type_info, 0);
+ }
- return bar;
+ return type;
}
EFilterBar *
@@ -988,12 +885,13 @@ e_filter_bar_new_construct (RuleContext *context,
const char *systemrules,
const char *userrules,
EFilterBarConfigRule config,
- void *data ,EFilterBar *bar )
+ gpointer data)
{
- ESearchBarItem item = { NULL, -1, 0 };
+ EFilterBar *bar;
+
+ bar = g_object_new (E_TYPE_FILTER_BAR, NULL);
- bar->context = context;
- g_object_ref (context);
+ bar->context = g_object_ref (context);
bar->config = config;
bar->config_data = data;
@@ -1005,35 +903,8 @@ e_filter_bar_new_construct (RuleContext *context,
bar->account_search_vf = NULL;
bar->account_search_cancel = NULL;
- e_search_bar_construct ((ESearchBar *)bar, &item, &item);
-
g_signal_connect (context, "changed", G_CALLBACK (context_changed), bar);
g_signal_connect (context, "rule_removed", G_CALLBACK (context_rule_removed), bar);
-}
-
-GType
-e_filter_bar_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EFilterBarClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EFilterBar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- e_search_bar_get_type (), "EFilterBar", &type_info, 0);
- }
-
- return type;
+ return bar;
}
diff --git a/widgets/misc/e-filter-bar.h b/widgets/misc/e-filter-bar.h
index 8f06c867ae..350a990890 100644
--- a/widgets/misc/e-filter-bar.h
+++ b/widgets/misc/e-filter-bar.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef __E_FILTER_BAR_H__
-#define __E_FILTER_BAR_H__
+#ifndef E_FILTER_BAR_H
+#define E_FILTER_BAR_H
#include <gtk/gtk.h>
#include <camel/camel-vee-folder.h>
@@ -32,11 +32,6 @@
#include "filter/rule-context.h"
#include "filter/filter-rule.h"
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
/* EFilterBar - A filter rule driven search bar.
*
* The following arguments are available:
@@ -47,14 +42,29 @@ extern "C" {
* state string RW XML string representing the state.
*/
-#define E_FILTER_BAR_TYPE (e_filter_bar_get_type ())
-#define E_FILTER_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_FILTER_BAR_TYPE, EFilterBar))
-#define E_FILTER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_FILTER_BAR_TYPE, EFilterBarClass))
-#define E_IS_FILTER_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_FILTER_BAR_TYPE))
-#define E_IS_FILTER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_FILTER_BAR_TYPE))
-
-typedef struct _EFilterBar EFilterBar;
-typedef struct _EFilterBarClass EFilterBarClass;
+/* Standard GObject macros */
+#define E_TYPE_FILTER_BAR \
+ (e_filter_bar_get_type ())
+#define E_FILTER_BAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_FILTER_BAR, EFilterBar))
+#define E_FILTER_BAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_FILTER_BAR, EFilterBarClass))
+#define E_IS_FILTER_BAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_FILTER_BAR))
+#define E_IS_FILTER_BAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), E_TYPE_FILTER_BAR))
+#define E_FILTER_BAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_FILTER_BAR, EFilterBarClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EFilterBar EFilterBar;
+typedef struct _EFilterBarClass EFilterBarClass;
typedef void (*EFilterBarConfigRule)(EFilterBar *, FilterRule *rule, int id, const char *query, void *data);
@@ -82,8 +92,7 @@ struct _EFilterBar {
CamelOperation *account_search_cancel;
};
-struct _EFilterBarClass
-{
+struct _EFilterBarClass {
ESearchBarClass parent_class;
};
@@ -141,5 +150,6 @@ e_filter_bar_new_construct (RuleContext *context,
}
#endif /* __cplusplus */
+G_END_DECLS
-#endif /* __E_FILTER_BAR_H__ */
+#endif /* E_FILTER_BAR_H */
diff --git a/widgets/misc/e-icon-entry.c b/widgets/misc/e-icon-entry.c
index 7f0dbaaaee..cfcce8f8c5 100644
--- a/widgets/misc/e-icon-entry.c
+++ b/widgets/misc/e-icon-entry.c
@@ -32,25 +32,75 @@
*
*/
-#include "config.h"
-
#include "e-icon-entry.h"
-#define E_ICON_ENTRY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), E_TYPE_ICON_ENTRY, EIconEntryPrivate))
+#define E_ICON_ENTRY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ICON_ENTRY, EIconEntryPrivate))
-struct _EIconEntryPrivate
-{
+struct _EIconEntryPrivate {
+ GtkStateType visual_state;
+ GtkWidget *entry;
GtkWidget *hbox;
};
-static GtkWidgetClass *parent_class = NULL;
+enum {
+ PROP_0,
+ PROP_VISUAL_STATE
+};
-/* private helper functions */
+static gpointer parent_class;
+
+static void
+icon_entry_proxy_set_cursor (GtkWidget *widget,
+ GdkEventCrossing *event)
+{
+ if (event->type == GDK_ENTER_NOTIFY) {
+ GdkCursor *cursor;
+
+ cursor = gdk_cursor_new (GDK_HAND1);
+ gdk_window_set_cursor (widget->window, cursor);
+ gdk_cursor_unref (cursor);
+ } else
+ gdk_window_set_cursor (widget->window, NULL);
+}
+static GtkWidget *
+icon_entry_create_proxy (GtkAction *action)
+{
+ GtkWidget *proxy;
+ GtkWidget *widget;
+ gchar *tooltip;
+
+ proxy = gtk_event_box_new ();
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (proxy), FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (proxy), 2);
+ gtk_widget_show (proxy);
+
+ widget = gtk_action_create_icon (action, GTK_ICON_SIZE_MENU);
+ gtk_container_add (GTK_CONTAINER (proxy), widget);
+ gtk_widget_show (widget);
+
+ g_object_get (action, "tooltip", &tooltip, NULL);
+ gtk_widget_set_tooltip_text (proxy, tooltip);
+ g_free (tooltip);
+
+ g_signal_connect_swapped (
+ proxy, "button-press-event",
+ G_CALLBACK (gtk_action_activate), action);
+ g_signal_connect_after (
+ proxy, "enter-notify-event",
+ G_CALLBACK (icon_entry_proxy_set_cursor), NULL);
+ g_signal_connect_after (
+ proxy, "leave-notify-event",
+ G_CALLBACK (icon_entry_proxy_set_cursor), NULL);
+
+ return proxy;
+}
static gboolean
-entry_focus_change_cb (GtkWidget *widget,
- GdkEventFocus *event,
- GtkWidget *entry)
+icon_entry_focus_change_cb (GtkWidget *widget,
+ GdkEventFocus *event,
+ GtkWidget *entry)
{
gtk_widget_queue_draw (entry);
@@ -58,111 +108,137 @@ entry_focus_change_cb (GtkWidget *widget,
}
static void
-e_icon_entry_get_borders (GtkWidget *widget,
- GtkWidget *entry,
- int *xborder,
- int *yborder)
+icon_entry_get_borders (GtkWidget *widget,
+ GtkWidget *entry,
+ gint *xborder,
+ gint *yborder)
{
- int focus_width;
+ gint focus_width;
gboolean interior_focus;
g_return_if_fail (entry->style != NULL);
- gtk_widget_style_get (entry,
- "focus-line-width", &focus_width,
- "interior-focus", &interior_focus,
- NULL);
+ gtk_widget_style_get (
+ entry, "focus-line-width", &focus_width,
+ "interior-focus", &interior_focus, NULL);
*xborder = entry->style->xthickness;
*yborder = entry->style->ythickness;
- if (!interior_focus)
- {
+ if (!interior_focus) {
*xborder += focus_width;
*yborder += focus_width;
}
}
static void
-e_icon_entry_paint (GtkWidget *widget,
- GdkEventExpose *event)
+icon_entry_paint (GtkWidget *widget,
+ GdkEventExpose *event)
{
EIconEntry *entry = E_ICON_ENTRY (widget);
- GtkWidget *entry_widget = entry->entry;
+ GtkWidget *entry_widget = entry->priv->entry;
int x = 0, y = 0, width, height, focus_width;
gboolean interior_focus;
- gtk_widget_style_get (entry_widget,
- "interior-focus", &interior_focus,
- "focus-line-width", &focus_width,
- NULL);
+ gtk_widget_style_get (
+ entry_widget,
+ "interior-focus", &interior_focus,
+ "focus-line-width", &focus_width, NULL);
gdk_drawable_get_size (widget->window, &width, &height);
- if (GTK_WIDGET_HAS_FOCUS (entry_widget) && !interior_focus)
- {
+ if (GTK_WIDGET_HAS_FOCUS (entry_widget) && !interior_focus) {
x += focus_width;
y += focus_width;
width -= 2 * focus_width;
height -= 2 * focus_width;
}
- gtk_paint_flat_box (entry_widget->style, widget->window,
- GTK_WIDGET_STATE (entry_widget), GTK_SHADOW_NONE,
- NULL, entry_widget, "entry_bg",
- /* FIXME: was 0, 0 in gtk_entry_expose, but I think this is correct: */
- x, y, width, height);
+ gtk_paint_flat_box (
+ entry_widget->style, widget->window,
+ GTK_WIDGET_STATE (entry_widget), GTK_SHADOW_NONE,
+ NULL, entry_widget, "entry_bg",
+ /* FIXME: was 0, 0 in gtk_entry_expose, but I think this is correct: */
+ x, y, width, height);
- gtk_paint_shadow (entry_widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_IN,
- NULL, entry_widget, "entry",
- x, y, width, height);
+ gtk_paint_shadow (
+ entry_widget->style, widget->window,
+ GTK_STATE_NORMAL, GTK_SHADOW_IN,
+ NULL, entry_widget, "entry",
+ x, y, width, height);
- if (GTK_WIDGET_HAS_FOCUS (entry_widget) && !interior_focus)
- {
+ if (GTK_WIDGET_HAS_FOCUS (entry_widget) && !interior_focus) {
x -= focus_width;
y -= focus_width;
width += 2 * focus_width;
height += 2 * focus_width;
- gtk_paint_focus (entry_widget->style, widget->window,
- GTK_WIDGET_STATE (entry_widget),
- NULL, entry_widget, "entry",
- /* FIXME: was 0, 0 in gtk_entry_draw_frame, but I think this is correct: */
- x, y, width, height);
+ gtk_paint_focus (
+ entry_widget->style, widget->window,
+ GTK_WIDGET_STATE (entry_widget),
+ NULL, entry_widget, "entry",
+ /* FIXME: was 0, 0 in gtk_entry_draw_frame, but I think this is correct: */
+ x, y, width, height);
}
}
-/* Class implementation */
+static void
+icon_entry_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_VISUAL_STATE:
+ e_icon_entry_set_visual_state (
+ E_ICON_ENTRY (object),
+ g_value_get_enum (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
static void
-e_icon_entry_init (EIconEntry *entry)
+icon_entry_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- EIconEntryPrivate *priv;
- GtkWidget *widget = (GtkWidget *) entry;
+ switch (property_id) {
+ case PROP_VISUAL_STATE:
+ g_value_set_enum (
+ value, e_icon_entry_get_visual_state (
+ E_ICON_ENTRY (object)));
+ return;
+ }
- priv = entry->priv = E_ICON_ENTRY_GET_PRIVATE (entry);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW);
+static void
+icon_entry_dispose (GObject *object)
+{
+ EIconEntryPrivate *priv;
- priv->hbox = gtk_hbox_new (FALSE, /* FIXME */ 0);
- gtk_container_add (GTK_CONTAINER (entry), priv->hbox);
+ priv = E_ICON_ENTRY_GET_PRIVATE (object);
- entry->entry = gtk_entry_new ();
- gtk_entry_set_has_frame (GTK_ENTRY (entry->entry), FALSE);
- gtk_box_pack_start (GTK_BOX (priv->hbox), entry->entry, TRUE, TRUE, /* FIXME */ 0);
+ if (priv->entry != NULL) {
+ g_object_unref (priv->entry);
+ priv->entry = NULL;
+ }
- /* We need to queue a redraw when focus changes, to comply with themes
- * (like Clearlooks) which draw focused and unfocused entries differently.
- */
- g_signal_connect_after (entry->entry, "focus-in-event",
- G_CALLBACK (entry_focus_change_cb), entry);
- g_signal_connect_after (entry->entry, "focus-out-event",
- G_CALLBACK (entry_focus_change_cb), entry);
+ if (priv->hbox != NULL) {
+ g_object_unref (priv->hbox);
+ priv->hbox = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-e_icon_entry_realize (GtkWidget *widget)
+icon_entry_realize (GtkWidget *widget)
{
GdkWindowAttr attributes;
gint attributes_mask;
@@ -185,34 +261,41 @@ e_icon_entry_realize (GtkWidget *widget)
attributes.wclass = GDK_INPUT_OUTPUT;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
+ widget->window = gdk_window_new (
+ gtk_widget_get_parent_window (widget),
+ &attributes, attributes_mask);
+
gdk_window_set_user_data (widget->window, widget);
widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ gtk_style_set_background (
+ widget->style, widget->window, GTK_STATE_NORMAL);
}
static void
-e_icon_entry_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+icon_entry_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
{
- EIconEntry *entry = E_ICON_ENTRY (widget);
- GtkContainer *container = GTK_CONTAINER (widget);
- GtkBin *bin = GTK_BIN (widget);
- int xborder, yborder;
+ EIconEntryPrivate *priv;
+ GtkContainer *container;
+ GtkWidget *child;
+ gint xborder, yborder;
- requisition->width = requisition->height = container->border_width * 2;
+ priv = E_ICON_ENTRY_GET_PRIVATE (widget);
+ container = GTK_CONTAINER (widget);
- gtk_widget_ensure_style (entry->entry);
- e_icon_entry_get_borders (widget, entry->entry, &xborder, &yborder);
+ requisition->width = container->border_width * 2;
+ requisition->height = container->border_width * 2;
- if (GTK_WIDGET_VISIBLE (bin->child))
- {
+ gtk_widget_ensure_style (priv->entry);
+ icon_entry_get_borders (widget, priv->entry, &xborder, &yborder);
+
+ child = GTK_BIN (widget)->child;
+ if (GTK_WIDGET_VISIBLE (child)) {
GtkRequisition child_requisition;
- gtk_widget_size_request (bin->child, &child_requisition);
+ gtk_widget_size_request (child, &child_requisition);
requisition->width += child_requisition.width;
requisition->height += child_requisition.height;
}
@@ -222,68 +305,126 @@ e_icon_entry_size_request (GtkWidget *widget,
}
static void
-e_icon_entry_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+icon_entry_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
{
- EIconEntry *entry = E_ICON_ENTRY (widget);
- GtkContainer *container = GTK_CONTAINER (widget);
- GtkBin *bin = GTK_BIN (widget);
+ EIconEntryPrivate *priv;
+ GtkContainer *container;
GtkAllocation child_allocation;
- int xborder, yborder;
+ gint xborder, yborder;
+ gint width, height;
+
+ priv = E_ICON_ENTRY_GET_PRIVATE (widget);
+ container = GTK_CONTAINER (widget);
widget->allocation = *allocation;
- e_icon_entry_get_borders (widget, entry->entry, &xborder, &yborder);
+ icon_entry_get_borders (widget, priv->entry, &xborder, &yborder);
+
+ if (GTK_WIDGET_REALIZED (widget)) {
+ width = allocation->width - container->border_width * 2;
+ height = allocation->height - container->border_width * 2;
- if (GTK_WIDGET_REALIZED (widget))
- {
child_allocation.x = container->border_width;
child_allocation.y = container->border_width;
- child_allocation.width = MAX (allocation->width - container->border_width * 2, 0);
- child_allocation.height = MAX (allocation->height - container->border_width * 2, 0);
-
- gdk_window_move_resize (widget->window,
- allocation->x + child_allocation.x,
- allocation->y + child_allocation.y,
- child_allocation.width,
- child_allocation.height);
+ child_allocation.width = MAX (width, 0);
+ child_allocation.height = MAX (height, 0);
+
+ gdk_window_move_resize (
+ widget->window,
+ allocation->x + child_allocation.x,
+ allocation->y + child_allocation.y,
+ child_allocation.width,
+ child_allocation.height);
}
+ width = allocation->width - (container->border_width + xborder) * 2;
+ height = allocation->height - (container->border_width + yborder) * 2;
+
child_allocation.x = container->border_width + xborder;
child_allocation.y = container->border_width + yborder;
- child_allocation.width = MAX (allocation->width - (container->border_width + xborder) * 2, 0);
- child_allocation.height = MAX (allocation->height - (container->border_width + yborder) * 2, 0);
+ child_allocation.width = MAX (width, 0);
+ child_allocation.height = MAX (height, 0);
- gtk_widget_size_allocate (bin->child, &child_allocation);
+ gtk_widget_size_allocate (GTK_BIN (widget)->child, &child_allocation);
}
static gboolean
-e_icon_entry_expose (GtkWidget *widget,
- GdkEventExpose *event)
+icon_entry_expose (GtkWidget *widget,
+ GdkEventExpose *event)
{
- if (GTK_WIDGET_DRAWABLE (widget) &&
- event->window == widget->window)
- {
- e_icon_entry_paint (widget, event);
- }
+ if (GTK_WIDGET_DRAWABLE (widget) && event->window == widget->window)
+ icon_entry_paint (widget, event);
- return parent_class->expose_event (widget, event);
+ /* Chain up to parent's expose() method. */
+ return GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
}
static void
-e_icon_entry_class_init (EIconEntryClass *klass)
+icon_entry_class_init (EIconEntryClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- parent_class = GTK_WIDGET_CLASS (g_type_class_peek_parent (klass));
-
- widget_class->realize = e_icon_entry_realize;
- widget_class->size_request = e_icon_entry_size_request;
- widget_class->size_allocate = e_icon_entry_size_allocate;
- widget_class->expose_event = e_icon_entry_expose;
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EIconEntryPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = icon_entry_set_property;
+ object_class->get_property = icon_entry_get_property;
+ object_class->dispose = icon_entry_dispose;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->realize = icon_entry_realize;
+ widget_class->size_request = icon_entry_size_request;
+ widget_class->size_allocate = icon_entry_size_allocate;
+ widget_class->expose_event = icon_entry_expose;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_VISUAL_STATE,
+ g_param_spec_enum (
+ "visual-state",
+ NULL,
+ NULL,
+ GTK_TYPE_STATE_TYPE,
+ GTK_STATE_NORMAL,
+ G_PARAM_READWRITE));
+}
- g_type_class_add_private (object_class, sizeof (EIconEntryPrivate));
+static void
+icon_entry_init (EIconEntry *icon_entry)
+{
+ GtkWidget *widget;
+ GtkWidget *container;
+
+ icon_entry->priv = E_ICON_ENTRY_GET_PRIVATE (icon_entry);
+ icon_entry->priv->visual_state = GTK_STATE_NORMAL;
+
+ GTK_WIDGET_UNSET_FLAGS (icon_entry, GTK_NO_WINDOW);
+
+ widget = gtk_hbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (icon_entry), widget);
+ icon_entry->priv->hbox = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_entry_new ();
+ gtk_entry_set_has_frame (GTK_ENTRY (widget), FALSE);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ icon_entry->priv->entry = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* We need to queue a redraw when focus changes, to comply with
+ * themes (like Clearlooks) which draw focused and unfocused
+ * entries differently. */
+ g_signal_connect_after (
+ widget, "focus-in-event",
+ G_CALLBACK (icon_entry_focus_change_cb), icon_entry);
+ g_signal_connect_after (
+ widget, "focus-out-event",
+ G_CALLBACK (icon_entry_focus_change_cb), icon_entry);
}
GType
@@ -293,92 +434,110 @@ e_icon_entry_get_type (void)
if (G_UNLIKELY (type == 0))
{
- static const GTypeInfo our_info =
- {
+ static const GTypeInfo type_info = {
sizeof (EIconEntryClass),
- NULL,
- NULL,
- (GClassInitFunc) e_icon_entry_class_init,
- NULL,
- NULL,
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) icon_entry_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
sizeof (EIconEntry),
- 0,
- (GInstanceInitFunc) e_icon_entry_init
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) icon_entry_init,
+ NULL /* value_table */
};
- type = g_type_register_static (GTK_TYPE_BIN,
- "EIconEntry",
- &our_info, 0);
+ type = g_type_register_static (
+ GTK_TYPE_BIN, "EIconEntry", &type_info, 0);
}
return type;
}
-/* public functions */
-
GtkWidget *
e_icon_entry_new (void)
{
return GTK_WIDGET (g_object_new (E_TYPE_ICON_ENTRY, NULL));
}
-void
-e_icon_entry_pack_widget (EIconEntry *entry,
- GtkWidget *widget,
- gboolean start)
+GtkWidget *
+e_icon_entry_get_entry (EIconEntry *icon_entry)
{
- EIconEntryPrivate *priv;
+ g_return_val_if_fail (E_IS_ICON_ENTRY (icon_entry), NULL);
- g_return_if_fail (E_IS_ICON_ENTRY (entry));
+ return icon_entry->priv->entry;
+}
- priv = entry->priv;
+void
+e_icon_entry_add_action_start (EIconEntry *icon_entry,
+ GtkAction *action)
+{
+ GtkWidget *proxy;
+ GtkBox *box;
- if (start)
- {
- gtk_box_pack_start (GTK_BOX (priv->hbox), widget, FALSE, FALSE, /* FIXME */ 2);
- gtk_box_reorder_child (GTK_BOX (priv->hbox), widget, 0);
- }
- else
- {
- gtk_box_pack_end (GTK_BOX (priv->hbox), widget, FALSE, FALSE, /* FIXME */ 2);
- }
+ g_return_if_fail (E_IS_ICON_ENTRY (icon_entry));
+ g_return_if_fail (GTK_IS_ACTION (action));
+
+ box = GTK_BOX (icon_entry->priv->hbox);
+ proxy = icon_entry_create_proxy (action);
+ gtk_box_pack_start (box, proxy, FALSE, FALSE, 2);
+ gtk_box_reorder_child (box, proxy, 0);
}
-static void
-set_cursor (GtkWidget *widget, GdkEventCrossing *event, gpointer dummy)
+void
+e_icon_entry_add_action_end (EIconEntry *icon_entry,
+ GtkAction *action)
{
+ GtkWidget *proxy;
+ GtkBox *box;
+
+ g_return_if_fail (E_IS_ICON_ENTRY (icon_entry));
+ g_return_if_fail (GTK_IS_ACTION (action));
- if (event->type == GDK_ENTER_NOTIFY)
- gdk_window_set_cursor (widget->window, gdk_cursor_new (GDK_HAND1));
- else
- gdk_window_set_cursor (widget->window, gdk_cursor_new (GDK_LEFT_PTR));
+ box = GTK_BOX (icon_entry->priv->hbox);
+ proxy = icon_entry_create_proxy (action);
+ gtk_box_pack_end (box, proxy, FALSE, FALSE, 2);
+}
+GtkStateType
+e_icon_entry_get_visual_state (EIconEntry *icon_entry)
+{
+ g_return_val_if_fail (E_IS_ICON_ENTRY (icon_entry), GTK_STATE_NORMAL);
+ return icon_entry->priv->visual_state;
}
-GtkWidget *
-e_icon_entry_create_button (const char *stock)
+void
+e_icon_entry_set_visual_state (EIconEntry *icon_entry,
+ GtkStateType visual_state)
{
- GtkWidget *eventbox;
- GtkWidget *image;
+ GtkWidget *widget;
+ const GdkColor *base_color;
+ const GdkColor *text_color;
- eventbox = gtk_event_box_new ();
- gtk_container_set_border_width (GTK_CONTAINER (eventbox), 2);
- gtk_event_box_set_visible_window (GTK_EVENT_BOX (eventbox), FALSE);
+ g_return_if_fail (E_IS_ICON_ENTRY (icon_entry));
- image = gtk_image_new_from_stock (stock, GTK_ICON_SIZE_MENU);
- gtk_container_add (GTK_CONTAINER (eventbox), image);
+ if (visual_state == GTK_STATE_NORMAL) {
+ base_color = NULL;
+ text_color = NULL;
+ } else {
+ GtkStyle *style;
- g_signal_connect_after (eventbox, "enter-notify-event", (GCallback) set_cursor, NULL);
- g_signal_connect_after (eventbox, "leave-notify-event", (GCallback) set_cursor, NULL);
+ style = gtk_widget_get_default_style ();
+ base_color = &style->base[visual_state];
+ text_color = &style->text[visual_state];
+ }
- return eventbox;
-}
+ widget = GTK_WIDGET (icon_entry);
+ gtk_widget_modify_base (widget, GTK_STATE_NORMAL, base_color);
-GtkWidget *
-e_icon_entry_get_entry (EIconEntry *entry)
-{
- g_return_val_if_fail (E_IS_ICON_ENTRY (entry), NULL);
+ widget = icon_entry->priv->entry;
+ gtk_widget_modify_base (widget, GTK_STATE_NORMAL, base_color);
+ gtk_widget_modify_text (widget, GTK_STATE_NORMAL, text_color);
+
+ widget = icon_entry->priv->hbox;
+ gtk_widget_modify_base (widget, GTK_STATE_NORMAL, base_color);
- return entry->entry;
+ icon_entry->priv->visual_state = visual_state;
+ g_object_notify (G_OBJECT (icon_entry), "visual-state");
}
diff --git a/widgets/misc/e-icon-entry.h b/widgets/misc/e-icon-entry.h
index 894cb16c4f..e18b0fdbe0 100644
--- a/widgets/misc/e-icon-entry.h
+++ b/widgets/misc/e-icon-entry.h
@@ -41,44 +41,50 @@
G_BEGIN_DECLS
-#define E_TYPE_ICON_ENTRY (e_icon_entry_get_type())
-#define E_ICON_ENTRY(object) (G_TYPE_CHECK_INSTANCE_CAST((object), E_TYPE_ICON_ENTRY, EIconEntry))
-#define E_ICON_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), E_TYPE_ICON_ENTRY, EIconEntryClass))
-#define E_IS_ICON_ENTRY(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), E_TYPE_ICON_ENTRY))
-#define E_IS_ICON_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), E_TYPE_ICON_ENTRY))
-#define E_ICON_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), E_TYPE_ICON_ENTRY, EIconEntryClass))
-
+/* Standard GObject macros */
+#define E_TYPE_ICON_ENTRY \
+ (e_icon_entry_get_type())
+#define E_ICON_ENTRY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ICON_ENTRY, EIconEntry))
+#define E_ICON_ENTRY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ICON_ENTRY, EIconEntryClass))
+#define E_IS_ICON_ENTRY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ICON_ENTRY))
+#define E_IS_ICON_ENTRY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ICON_ENTRY))
+#define E_ICON_ENTRY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ICON_ENTRY, EIconEntryClass))
+
+typedef struct _EIconEntry EIconEntry;
typedef struct _EIconEntryClass EIconEntryClass;
-typedef struct _EIconEntry EIconEntry;
-typedef struct _EIconEntryPrivate EIconEntryPrivate;
-
-struct _EIconEntryClass
-{
- GtkBinClass parent_class;
-};
+typedef struct _EIconEntryPrivate EIconEntryPrivate;
struct _EIconEntry
{
- GtkBin parent_object;
-
- /*< public >*/
- GtkWidget *entry;
-
- /*< private >*/
+ GtkBin parent;
EIconEntryPrivate *priv;
};
-GType e_icon_entry_get_type (void);
-
-GtkWidget *e_icon_entry_new (void);
-
-void e_icon_entry_pack_widget (EIconEntry *entry,
- GtkWidget *widget,
- gboolean start);
-
-GtkWidget *e_icon_entry_get_entry (EIconEntry *entry);
+struct _EIconEntryClass
+{
+ GtkBinClass parent_class;
+};
-GtkWidget *e_icon_entry_create_button (const char *stock);
+GType e_icon_entry_get_type (void);
+GtkWidget * e_icon_entry_new (void);
+GtkWidget * e_icon_entry_get_entry (EIconEntry *entry);
+void e_icon_entry_add_action_start (EIconEntry *entry,
+ GtkAction *action);
+void e_icon_entry_add_action_end (EIconEntry *entry,
+ GtkAction *action);
+GtkStateType e_icon_entry_get_visual_state (EIconEntry *entry);
+void e_icon_entry_set_visual_state (EIconEntry *entry,
+ GtkStateType visual_state);
G_END_DECLS
diff --git a/widgets/misc/e-info-label.c b/widgets/misc/e-info-label.c
deleted file mode 100644
index e6db111a74..0000000000
--- a/widgets/misc/e-info-label.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include "e-info-label.h"
-
-static GtkHBoxClass *el_parent;
-
-static void
-el_init(GObject *o)
-{
- /*EInfoLabel *el = (EInfoLabel *)o;*/
-}
-
-static void
-el_finalise(GObject *o)
-{
- ((GObjectClass *)el_parent)->finalize(o);
-}
-
-static void
-el_destroy (GtkObject *o)
-{
- ((EInfoLabel *)o)->location = NULL;
- ((EInfoLabel *)o)->info = NULL;
-
- ((GtkObjectClass *)el_parent)->destroy(o);
-}
-
-static int
-el_expose_event(GtkWidget *w, GdkEventExpose *event)
-{
- int x = ((GtkContainer *)w)->border_width;
-
- /* This seems a hack to me, but playing with styles wouldn't affect the background */
- gtk_paint_flat_box(w->style, w->window,
- GTK_STATE_ACTIVE, GTK_SHADOW_NONE,
- &event->area, w, "EInfoLabel",
- w->allocation.x+x, w->allocation.y+x,
- w->allocation.width-x*2, w->allocation.height-x*2);
-
- return ((GtkWidgetClass *)el_parent)->expose_event(w, event);
-}
-
-static int
-get_text_full_width (GtkWidget *label)
-{
- PangoLayout *layout;
- PangoRectangle rect;
- int width;
-
- g_return_val_if_fail (GTK_IS_LABEL (label), 0);
-
- layout = gtk_label_get_layout (GTK_LABEL (label));
-
- if (!layout)
- return 0;
-
- width = pango_layout_get_width (layout);
- pango_layout_set_width (layout, -1);
- pango_layout_get_extents (layout, NULL, &rect);
- pango_layout_set_width (layout, width);
-
- return PANGO_PIXELS (rect.width);
-}
-
-static void
-el_size_allocate (GtkWidget *widget, GtkAllocation *pallocation)
-{
- EInfoLabel *el;
- GtkAllocation allocation;
- int full_loc, full_nfo;
- gint diff;
-
- /* let calculate parent class first, and then just make it not divide evenly */
- ((GtkWidgetClass *)el_parent)->size_allocate (widget, pallocation);
-
- g_return_if_fail (widget!= NULL);
-
- el = (EInfoLabel*) widget;
-
- if (!el->location)
- return;
-
- full_loc = get_text_full_width (el->location) + 1;
- full_nfo = get_text_full_width (el->info) + 1;
-
- /* do not know the width of text, thus return */
- if (full_loc == 1 && full_nfo == 1)
- return;
-
- if (el->location->allocation.width + el->info->allocation.width >= full_loc + full_nfo) {
- /* allocate for location only as many pixels as it requires to not ellipsize
- and keep rest for the info part */
- diff = el->location->allocation.width - full_loc;
- } else {
- /* make both shorter, but based on the ratio of its full widths */
- gint total_have = el->location->allocation.width + el->info->allocation.width;
- gint total_full = full_loc + full_nfo;
-
- diff = el->location->allocation.width - full_loc * total_have / total_full;
- }
-
- if (!diff)
- return;
-
- allocation = el->location->allocation;
- allocation.width -= diff;
- gtk_widget_size_allocate (el->location, &allocation);
-
- allocation = el->info->allocation;
- allocation.x -= diff;
- allocation.width += diff;
- gtk_widget_size_allocate (el->info, &allocation);
-}
-
-static void
-el_class_init(GObjectClass *klass)
-{
- klass->finalize = el_finalise;
-
- ((GtkObjectClass *)klass)->destroy = el_destroy;
- ((GtkWidgetClass *)klass)->expose_event = el_expose_event;
- ((GtkWidgetClass *)klass)->size_allocate = el_size_allocate;
-}
-
-GType
-e_info_label_get_type(void)
-{
- static GType type = 0;
-
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(EInfoLabelClass),
- NULL, NULL,
- (GClassInitFunc)el_class_init,
- NULL, NULL,
- sizeof(EInfoLabel), 0,
- (GInstanceInitFunc)el_init
- };
- el_parent = g_type_class_ref(gtk_hbox_get_type());
- type = g_type_register_static(gtk_hbox_get_type(), "EInfoLabel", &info, 0);
- }
-
- return type;
-}
-
-/**
- * e_info_label_new:
- * @icon:
- *
- * Create a new info label widget. @icon is the name of the icon
- * (from the icon theme) to use for the icon image.
- *
- * Return value:
- **/
-GtkWidget *
-e_info_label_new(const char *icon)
-{
- EInfoLabel *el = g_object_new(e_info_label_get_type(), NULL);
- GtkWidget *image;
-
- image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_MENU);
- gtk_misc_set_padding((GtkMisc *)image, 6, 6);
- gtk_box_pack_start((GtkBox *)el, image, FALSE, TRUE, 0);
- gtk_widget_show(image);
-
- gtk_container_set_border_width((GtkContainer *)el, 3);
-
- return (GtkWidget *)el;
-}
-
-/**
- * e_info_label_set_info:
- * @el:
- * @location:
- * @info:
- *
- * Set the information to show on the label. @location is some
- * context about the current view. e.g. the folder name. If the
- * label is too wide, this will be truncated.
- *
- * @info is some info about this location.
- **/
-void
-e_info_label_set_info(EInfoLabel *el, const char *location, const char *info)
-{
- gchar *markup;
-
- if (el->location == NULL) {
- el->location = gtk_label_new (NULL);
- el->info = gtk_label_new (NULL);
-
- gtk_label_set_ellipsize (GTK_LABEL (el->location), PANGO_ELLIPSIZE_END);
- gtk_misc_set_alignment (GTK_MISC (el->location), 0.0, 0.5);
- gtk_misc_set_padding (GTK_MISC (el->location), 0, 6);
-
- gtk_label_set_ellipsize (GTK_LABEL (el->info), PANGO_ELLIPSIZE_MIDDLE);
- gtk_misc_set_alignment (GTK_MISC (el->info), 1.0, 0.5);
- gtk_misc_set_padding (GTK_MISC (el->info), 0, 6);
-
- gtk_widget_show (el->location);
- gtk_widget_show (el->info);
-
- gtk_box_pack_start (
- GTK_BOX (el), GTK_WIDGET (el->location),
- TRUE, TRUE, 0);
- gtk_box_pack_end (
- GTK_BOX (el), GTK_WIDGET (el->info),
- TRUE, TRUE, 6);
- gtk_widget_set_state (GTK_WIDGET (el), GTK_STATE_ACTIVE);
- }
-
- markup = g_markup_printf_escaped ("<b>%s</b>", location);
- gtk_label_set_markup (GTK_LABEL (el->location), markup);
- g_free (markup);
-
- markup = g_markup_printf_escaped ("<small>%s</small>", info);
- gtk_label_set_markup (GTK_LABEL (el->info), markup);
- g_free (markup);
-}
-
diff --git a/widgets/misc/e-info-label.h b/widgets/misc/e-info-label.h
deleted file mode 100644
index d4dd16e395..0000000000
--- a/widgets/misc/e-info-label.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_INFO_LABEL_H
-#define _E_INFO_LABEL_H
-
-#include <gtk/gtk.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_INFO_LABEL_GET_CLASS(emfv) ((EInfoLabelClass *) G_OBJECT_GET_CLASS (emfv))
-
-typedef struct _EInfoLabel EInfoLabel;
-typedef struct _EInfoLabelClass EInfoLabelClass;
-
-struct _EInfoLabel {
- GtkHBox parent;
-
- struct _GtkWidget *location;
- struct _GtkWidget *info;
-};
-
-struct _EInfoLabelClass {
- GtkHBoxClass parent_class;
-};
-
-GType e_info_label_get_type(void);
-
-GtkWidget *e_info_label_new(const char *icon);
-void e_info_label_set_info(EInfoLabel *, const char *loc, const char *info);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* ! _E_INFO_LABEL_H */
diff --git a/widgets/misc/e-menu-tool-button.c b/widgets/misc/e-menu-tool-button.c
new file mode 100644
index 0000000000..53778e6678
--- /dev/null
+++ b/widgets/misc/e-menu-tool-button.c
@@ -0,0 +1,157 @@
+/*
+ * e-menu-tool-button.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-menu-tool-button.h"
+
+static gpointer parent_class;
+
+static GtkWidget *
+menu_tool_button_clone_image (GtkWidget *source)
+{
+ GtkIconSize size;
+ GtkImageType image_type;
+ const gchar *icon_name;
+
+ /* XXX This isn't general purpose because it requires that the
+ * source image be using a named icon. Somewhat surprised
+ * GTK+ doesn't offer something like this. */
+ image_type = gtk_image_get_storage_type (GTK_IMAGE (source));
+ g_return_val_if_fail (image_type == GTK_IMAGE_ICON_NAME, NULL);
+ gtk_image_get_icon_name (GTK_IMAGE (source), &icon_name, &size);
+
+ return gtk_image_new_from_icon_name (icon_name, size);
+}
+
+static GtkMenuItem *
+menu_tool_button_get_first_menu_item (GtkMenuToolButton *menu_tool_button)
+{
+ GtkWidget *menu;
+ GList *children;
+
+ menu = gtk_menu_tool_button_get_menu (menu_tool_button);
+ if (!GTK_IS_MENU (menu))
+ return NULL;
+
+ /* XXX GTK+ 2.12 provides no accessor function. */
+ children = GTK_MENU_SHELL (menu)->children;
+ if (children == NULL)
+ return NULL;
+
+ return GTK_MENU_ITEM (children->data);
+}
+
+static void
+menu_tool_button_update_button (GtkToolButton *tool_button)
+{
+ GtkMenuItem *menu_item;
+ GtkMenuToolButton *menu_tool_button;
+ GtkImageMenuItem *image_menu_item;
+ GtkAction *action;
+ GtkWidget *image;
+ gchar *tooltip = NULL;
+
+ menu_tool_button = GTK_MENU_TOOL_BUTTON (tool_button);
+ menu_item = menu_tool_button_get_first_menu_item (menu_tool_button);
+ if (!GTK_IS_IMAGE_MENU_ITEM (menu_item))
+ return;
+
+ image_menu_item = GTK_IMAGE_MENU_ITEM (menu_item);
+ image = gtk_image_menu_item_get_image (image_menu_item);
+ if (!GTK_IS_IMAGE (image))
+ return;
+
+ image = menu_tool_button_clone_image (image);
+ gtk_tool_button_set_icon_widget (tool_button, image);
+ gtk_widget_show (image);
+
+ /* If the menu item is a proxy for a GtkAction, extract
+ * the action's tooltip and use it as our own tooltip. */
+ action = gtk_widget_get_action (GTK_WIDGET (menu_item));
+ if (action != NULL)
+ g_object_get (action, "tooltip", &tooltip, NULL);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (tool_button), tooltip);
+ g_free (tooltip);
+}
+
+static void
+menu_tool_button_clicked (GtkToolButton *tool_button)
+{
+ GtkMenuItem *menu_item;
+ GtkMenuToolButton *menu_tool_button;
+
+ menu_tool_button = GTK_MENU_TOOL_BUTTON (tool_button);
+ menu_item = menu_tool_button_get_first_menu_item (menu_tool_button);
+
+ if (GTK_IS_MENU_ITEM (menu_item))
+ gtk_menu_item_activate (menu_item);
+}
+
+static void
+menu_tool_button_class_init (EMenuToolButtonClass *class)
+{
+ GtkToolButtonClass *tool_button_class;
+
+ parent_class = g_type_class_peek_parent (class);
+
+ tool_button_class = GTK_TOOL_BUTTON_CLASS (class);
+ tool_button_class->clicked = menu_tool_button_clicked;
+}
+
+static void
+menu_tool_button_init (EMenuToolButton *button)
+{
+ g_signal_connect (
+ button, "notify::menu",
+ G_CALLBACK (menu_tool_button_update_button), NULL);
+}
+
+GType
+e_menu_tool_button_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (EMenuToolButtonClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) menu_tool_button_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMenuToolButton),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) menu_tool_button_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_MENU_TOOL_BUTTON, "EMenuToolButton",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkToolItem *
+e_menu_tool_button_new (const gchar *label)
+{
+ return g_object_new (E_TYPE_MENU_TOOL_BUTTON, "label", label, NULL);
+}
diff --git a/widgets/misc/e-menu-tool-button.h b/widgets/misc/e-menu-tool-button.h
new file mode 100644
index 0000000000..214f5ab217
--- /dev/null
+++ b/widgets/misc/e-menu-tool-button.h
@@ -0,0 +1,68 @@
+/*
+ * e-menu-tool-button.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+/* EMenuToolButton is a variation of GtkMenuToolButton where the
+ * button icon always reflects the first menu item, and clicking
+ * the button activates the first menu item. */
+
+#ifndef E_MENU_TOOL_BUTTON_H
+#define E_MENU_TOOL_BUTTON_H
+
+#include <gtk/gtk.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MENU_TOOL_BUTTON \
+ (e_menu_tool_button_get_type ())
+#define E_MENU_TOOL_BUTTON(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MENU_TOOL_BUTTON, EMenuToolButton))
+#define E_MENU_TOOL_BUTTON_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MENU_TOOL_BUTTON, EMenuToolButtonClass))
+#define E_IS_MENU_TOOL_BUTTON(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MENU_TOOL_BUTTON))
+#define E_IS_MENU_TOOL_BUTTON_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MENU_TOOL_BUTTON))
+#define E_MENU_TOOL_BUTTON_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MENU_TOOL_BUTTON, EMenuToolButtonClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMenuToolButton EMenuToolButton;
+typedef struct _EMenuToolButtonClass EMenuToolButtonClass;
+
+struct _EMenuToolButton {
+ GtkMenuToolButton parent;
+};
+
+struct _EMenuToolButtonClass {
+ GtkMenuToolButtonClass parent_class;
+};
+
+GType e_menu_tool_button_get_type (void);
+GtkToolItem * e_menu_tool_button_new (const gchar *label);
+
+G_END_DECLS
+
+#endif /* E_MENU_TOOL_BUTTON_H */
diff --git a/widgets/misc/e-multi-config-dialog.c b/widgets/misc/e-multi-config-dialog.c
deleted file mode 100644
index f78f764f03..0000000000
--- a/widgets/misc/e-multi-config-dialog.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-multi-config-dialog.h"
-
-#include <e-util/e-util.h>
-#include <table/e-table-scrolled.h>
-#include <table/e-table-memory-store.h>
-#include <table/e-cell-pixbuf.h>
-#include <table/e-cell-vbox.h>
-#include <table/e-cell-text.h>
-
-#define SWITCH_PAGE_INTERVAL 250
-
-struct _EMultiConfigDialogPrivate {
- GSList *pages;
-
- GtkWidget *list_e_table;
- ETableModel *list_e_table_model;
-
- GtkWidget *notebook;
-
- int set_page_timeout_id;
- int set_page_timeout_page;
-};
-
-G_DEFINE_TYPE (EMultiConfigDialog, e_multi_config_dialog, GTK_TYPE_DIALOG)
-
-
-/* ETable stuff. */
-
-static const gchar *list_e_table_spec =
- "<ETableSpecification cursor-mode=\"line\""
- " selection-mode=\"browse\""
- " no-headers=\"true\""
- " alternating-row-colors=\"false\""
- " horizontal-resize=\"true\""
- ">"
- " <ETableColumn model_col=\"0\""
- " expansion=\"1.0\""
- " cell=\"vbox\""
- " minimum_width=\"32\""
- " resizable=\"true\""
- " _title=\"Category\""
- " compare=\"string\"/>"
- " <ETableState>"
- " <column source=\"0\"/>"
- " <grouping>"
- " </grouping>"
- " </ETableState>"
- "</ETableSpecification>";
-
-/* Page handling. */
-
-static GtkWidget *
-create_page_container (const char *description,
- GtkWidget *widget)
-{
- GtkWidget *vbox;
-
- vbox = gtk_vbox_new (FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0);
-
- gtk_widget_show (widget);
- gtk_widget_show (vbox);
-
- return vbox;
-}
-
-/* Timeout for switching pages (so it's more comfortable navigating with the
- keyboard). */
-
-static int
-set_page_timeout_callback (void *data)
-{
- EMultiConfigDialog *multi_config_dialog;
- EMultiConfigDialogPrivate *priv;
-
- multi_config_dialog = E_MULTI_CONFIG_DIALOG (data);
- priv = multi_config_dialog->priv;
-
- gtk_notebook_set_current_page (
- GTK_NOTEBOOK (priv->notebook), priv->set_page_timeout_page);
-
- priv->set_page_timeout_id = 0;
- gtk_widget_grab_focus(priv->list_e_table);
- return FALSE;
-}
-
-
-/* Button handling. */
-
-static void
-do_close (EMultiConfigDialog *dialog)
-{
- gtk_widget_destroy (GTK_WIDGET (dialog));
-}
-
-
-/* ETable signals. */
-
-static void
-table_cursor_change_callback (ETable *etable,
- int row,
- void *data)
-{
- EMultiConfigDialog *dialog;
- EMultiConfigDialogPrivate *priv;
-
- dialog = E_MULTI_CONFIG_DIALOG (data);
- priv = dialog->priv;
-
- if (priv->set_page_timeout_id == 0)
- priv->set_page_timeout_id = g_timeout_add (SWITCH_PAGE_INTERVAL,
- set_page_timeout_callback,
- dialog);
-
- priv->set_page_timeout_page = row;
-}
-
-
-/* GObject methods. */
-
-static void
-impl_finalize (GObject *object)
-{
- EMultiConfigDialog *dialog;
- EMultiConfigDialogPrivate *priv;
-
- dialog = E_MULTI_CONFIG_DIALOG (object);
- priv = dialog->priv;
-
- if (priv->set_page_timeout_id != 0)
- g_source_remove (priv->set_page_timeout_id);
-
- g_slist_free (priv->pages);
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (e_multi_config_dialog_parent_class)->finalize) (object);
-}
-
-
-/* GtkDialog methods. */
-
-static void
-impl_response (GtkDialog *dialog, int response_id)
-{
- EMultiConfigDialog *multi_config_dialog;
-
- multi_config_dialog = E_MULTI_CONFIG_DIALOG (dialog);
-
- switch (response_id) {
- case GTK_RESPONSE_HELP:
- e_display_help (GTK_WINDOW (dialog), "config-prefs");
- break;
- case GTK_RESPONSE_CLOSE:
- default:
- do_close (multi_config_dialog);
- break;
- }
-}
-
-
-/* GObject ctors. */
-
-static void
-e_multi_config_dialog_class_init (EMultiConfigDialogClass *class)
-{
- GObjectClass *object_class;
- GtkDialogClass *dialog_class;
-
- object_class = G_OBJECT_CLASS (class);
- object_class->finalize = impl_finalize;
-
- dialog_class = GTK_DIALOG_CLASS (class);
- dialog_class->response = impl_response;
-}
-
-#define RGB_COLOR(color) (((color).red & 0xff00) << 8 | \
- ((color).green & 0xff00) | \
- ((color).blue & 0xff00) >> 8)
-
-static void
-canvas_realize (GtkWidget *widget, EMultiConfigDialog *dialog)
-{
-}
-
-
-static ETableMemoryStoreColumnInfo columns[] = {
- E_TABLE_MEMORY_STORE_STRING,
- E_TABLE_MEMORY_STORE_PIXBUF,
- E_TABLE_MEMORY_STORE_PIXBUF,
- E_TABLE_MEMORY_STORE_PIXBUF,
- E_TABLE_MEMORY_STORE_PIXBUF,
- E_TABLE_MEMORY_STORE_TERMINATOR
-};
-
-static void
-e_multi_config_dialog_init (EMultiConfigDialog *multi_config_dialog)
-{
- EMultiConfigDialogPrivate *priv;
- ETableModel *list_e_table_model;
- GtkWidget *dialog_vbox;
- GtkWidget *hbox;
- GtkWidget *notebook;
- GtkWidget *list_e_table;
- ETableExtras *extras;
- ECell *pixbuf;
- ECell *text;
- ECell *vbox;
-
- gtk_dialog_set_has_separator (GTK_DIALOG (multi_config_dialog), FALSE);
- gtk_widget_realize (GTK_WIDGET (multi_config_dialog));
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (multi_config_dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (multi_config_dialog)->action_area), 12);
-
- hbox = gtk_hbox_new (FALSE, 6);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
- dialog_vbox = GTK_DIALOG (multi_config_dialog)->vbox;
-
- gtk_container_add (GTK_CONTAINER (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);
- e_cell_vbox_append (E_CELL_VBOX (vbox), pixbuf, 1);
- g_object_unref (pixbuf);
-
- text = e_cell_text_new (NULL, GTK_JUSTIFY_CENTER);
- e_cell_vbox_append (E_CELL_VBOX (vbox), text, 0);
- g_object_unref (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);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (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);
-
- g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table))->table_canvas,
- "realize", G_CALLBACK (canvas_realize), multi_config_dialog);
-
- g_object_unref (extras);
-
- gtk_box_pack_start (GTK_BOX (hbox), list_e_table, FALSE, TRUE, 0);
-
- notebook = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
- gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0);
-
- gtk_widget_show (hbox);
- gtk_widget_show (notebook);
- gtk_widget_show (list_e_table);
-
- gtk_dialog_add_buttons (GTK_DIALOG (multi_config_dialog),
- GTK_STOCK_HELP, GTK_RESPONSE_HELP,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
- NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (multi_config_dialog), GTK_RESPONSE_OK);
-
- gtk_window_set_resizable (GTK_WINDOW (multi_config_dialog), TRUE);
-
- priv = g_new (EMultiConfigDialogPrivate, 1);
- priv->pages = NULL;
- priv->list_e_table = list_e_table;
- priv->list_e_table_model = list_e_table_model;
- priv->notebook = notebook;
- priv->set_page_timeout_id = 0;
- priv->set_page_timeout_page = 0;
-
- multi_config_dialog->priv = priv;
-}
-
-
-GtkWidget *
-e_multi_config_dialog_new (void)
-{
- return g_object_new (e_multi_config_dialog_get_type (), NULL);
-}
-
-
-void
-e_multi_config_dialog_add_page (EMultiConfigDialog *dialog,
- const char *title,
- const char *description,
- GdkPixbuf *icon,
- EConfigPage *page_widget)
-{
- EMultiConfigDialogPrivate *priv;
- AtkObject *a11y;
- AtkObject *a11yPage;
- gint page_no;
-
- g_return_if_fail (E_IS_MULTI_CONFIG_DIALOG (dialog));
- g_return_if_fail (title != NULL);
- g_return_if_fail (description != NULL);
- g_return_if_fail (E_IS_CONFIG_PAGE (page_widget));
-
- priv = dialog->priv;
-
- priv->pages = g_slist_append (priv->pages, page_widget);
-
- e_table_memory_store_insert (E_TABLE_MEMORY_STORE (priv->list_e_table_model), -1, NULL, title, icon, NULL, NULL, NULL);
-
- page_no = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
- create_page_container (description, GTK_WIDGET (page_widget)),
- NULL);
-
- a11y = gtk_widget_get_accessible (GTK_WIDGET(priv->notebook));
- a11yPage = atk_object_ref_accessible_child (a11y, page_no);
- if (a11yPage != NULL) {
- if (atk_object_get_role (a11yPage) == ATK_ROLE_PAGE_TAB)
- atk_object_set_name (a11yPage, title);
- g_object_unref (a11yPage);
- }
- if (priv->pages->next == NULL) {
- ETable *table;
-
- /* FIXME: This is supposed to select the first entry by default
- but it doesn't seem to work at all. */
- table = e_table_scrolled_get_table (E_TABLE_SCROLLED (priv->list_e_table));
- e_table_set_cursor_row (table, 0);
- e_selection_model_select_all (e_table_get_selection_model (table));
- }
-}
-
-void
-e_multi_config_dialog_show_page (EMultiConfigDialog *dialog, int page)
-{
- EMultiConfigDialogPrivate *priv;
-
- g_return_if_fail (dialog != NULL);
- g_return_if_fail (E_IS_MULTI_CONFIG_DIALOG (dialog));
-
- priv = dialog->priv;
-
- e_table_set_cursor_row (e_table_scrolled_get_table (E_TABLE_SCROLLED (priv->list_e_table)), page);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), page);
-}
-
diff --git a/widgets/misc/e-multi-config-dialog.h b/widgets/misc/e-multi-config-dialog.h
deleted file mode 100644
index e8d9896d55..0000000000
--- a/widgets/misc/e-multi-config-dialog.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_MULTI_CONFIG_DIALOG_H_
-#define _E_MULTI_CONFIG_DIALOG_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-config-page.h"
-
-#include <gtk/gtk.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_MULTI_CONFIG_DIALOG (e_multi_config_dialog_get_type ())
-#define E_MULTI_CONFIG_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MULTI_CONFIG_DIALOG, EMultiConfigDialog))
-#define E_MULTI_CONFIG_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MULTI_CONFIG_DIALOG, EMultiConfigDialogClass))
-#define E_IS_MULTI_CONFIG_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MULTI_CONFIG_DIALOG))
-#define E_IS_MULTI_CONFIG_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MULTI_CONFIG_DIALOG))
-
-
-typedef struct _EMultiConfigDialog EMultiConfigDialog;
-typedef struct _EMultiConfigDialogPrivate EMultiConfigDialogPrivate;
-typedef struct _EMultiConfigDialogClass EMultiConfigDialogClass;
-
-struct _EMultiConfigDialog {
- GtkDialog parent;
-
- EMultiConfigDialogPrivate *priv;
-};
-
-struct _EMultiConfigDialogClass {
- GtkDialogClass parent_class;
-};
-
-
-GType e_multi_config_dialog_get_type (void);
-GtkWidget *e_multi_config_dialog_new (void);
-
-void e_multi_config_dialog_add_page (EMultiConfigDialog *dialog,
- const char *title,
- const char *description,
- GdkPixbuf *icon,
- EConfigPage *page);
-void e_multi_config_dialog_show_page (EMultiConfigDialog *dialog,
- int page);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_MULTI_CONFIG_DIALOG_H_ */
diff --git a/widgets/misc/e-online-button.c b/widgets/misc/e-online-button.c
index 114d76ac32..c14114b9c3 100644
--- a/widgets/misc/e-online-button.c
+++ b/widgets/misc/e-online-button.c
@@ -23,6 +23,12 @@
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_ONLINE_BUTTON, EOnlineButtonPrivate))
+#define ONLINE_TOOLTIP \
+ "Evolution is currently online. Click this button to work offline."
+
+#define OFFLINE_TOOLTIP \
+ "Evolution is currently offline. Click this button to work online."
+
struct _EOnlineButtonPrivate {
GtkWidget *image;
gboolean online;
@@ -175,6 +181,7 @@ e_online_button_set_online (EOnlineButton *button,
GtkIconTheme *icon_theme;
const gchar *filename;
const gchar *icon_name;
+ const gchar *tooltip;
g_return_if_fail (E_IS_ONLINE_BUTTON (button));
@@ -191,5 +198,8 @@ e_online_button_set_online (EOnlineButton *button,
gtk_image_set_from_file (image, filename);
gtk_icon_info_free (icon_info);
+ tooltip = _(online ? ONLINE_TOOLTIP : OFFLINE_TOOLTIP);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (button), tooltip);
+
g_object_notify (G_OBJECT (button), "online");
}
diff --git a/widgets/misc/e-popup-action.c b/widgets/misc/e-popup-action.c
new file mode 100644
index 0000000000..e856a1fc24
--- /dev/null
+++ b/widgets/misc/e-popup-action.c
@@ -0,0 +1,285 @@
+/*
+ * e-popup-action.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-popup-action.h"
+
+#include <glib/gi18n.h>
+#include "e-util/e-binding.h"
+
+#define E_POPUP_ACTION_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_POPUP_ACTION, EPopupActionPrivate))
+
+enum {
+ PROP_0,
+ PROP_SOURCE
+};
+
+struct _EPopupActionPrivate {
+ GtkAction *source;
+};
+
+static gpointer parent_class;
+
+static void
+popup_action_set_source (EPopupAction *popup_action,
+ GtkAction *source)
+{
+ g_return_if_fail (popup_action->priv->source == NULL);
+ g_return_if_fail (GTK_IS_ACTION (source));
+
+ popup_action->priv->source = g_object_ref (source);
+}
+
+static void
+popup_action_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SOURCE:
+ popup_action_set_source (
+ E_POPUP_ACTION (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+popup_action_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SOURCE:
+ g_value_set_object (
+ value, e_popup_action_get_source (
+ E_POPUP_ACTION (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+popup_action_dispose (GObject *object)
+{
+ EPopupActionPrivate *priv;
+
+ priv = E_POPUP_ACTION_GET_PRIVATE (object);
+
+ if (priv->source != NULL) {
+ g_object_unref (priv->source);
+ priv->source = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+popup_action_constructed (GObject *object)
+{
+ EPopupActionPrivate *priv;
+ GObject *source;
+ gchar *icon_name;
+ gchar *label;
+ gchar *stock_id;
+ gchar *tooltip;
+
+ priv = E_POPUP_ACTION_GET_PRIVATE (object);
+
+ source = G_OBJECT (priv->source);
+
+ g_object_get (
+ object, "icon-name", &icon_name, "label", &label,
+ "stock-id", &stock_id, "tooltip", &tooltip, NULL);
+
+ if (label == NULL)
+ e_binding_new (source, "label", object, "label");
+
+ if (tooltip == NULL)
+ e_binding_new (source, "tooltip", object, "tooltip");
+
+ if (icon_name == NULL && stock_id == NULL) {
+ g_free (icon_name);
+ g_free (stock_id);
+
+ g_object_get (
+ source, "icon-name", &icon_name,
+ "stock-id", &stock_id, NULL);
+
+ if (icon_name == NULL) {
+ e_binding_new (
+ source, "icon-name", object, "icon-name");
+ e_binding_new (
+ source, "stock-id", object, "stock-id");
+ } else {
+ e_binding_new (
+ source, "stock-id", object, "stock-id");
+ e_binding_new (
+ source, "icon-name", object, "icon-name");
+ }
+ }
+
+ e_binding_new (source, "sensitive", object, "visible");
+
+ g_free (icon_name);
+ g_free (label);
+ g_free (stock_id);
+ g_free (tooltip);
+}
+
+static void
+popup_action_class_init (EPopupActionClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EPopupActionPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = popup_action_set_property;
+ object_class->get_property = popup_action_get_property;
+ object_class->dispose = popup_action_dispose;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SOURCE,
+ g_param_spec_object (
+ "source",
+ _("Source Action"),
+ _("The source action to proxy"),
+ GTK_TYPE_ACTION,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+popup_action_init (EPopupAction *popup_action)
+{
+ popup_action->priv = E_POPUP_ACTION_GET_PRIVATE (popup_action);
+}
+
+GType
+e_popup_action_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EPopupActionClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) popup_action_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EPopupAction),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) popup_action_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_ACTION, "EPopupAction", &type_info, 0);
+ }
+
+ return type;
+}
+
+EPopupAction *
+e_popup_action_new (const gchar *name,
+ const gchar *label,
+ GtkAction *source)
+{
+ EPopupAction *popup_action;
+
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (GTK_IS_ACTION (source), NULL);
+
+ popup_action = g_object_new (
+ E_TYPE_POPUP_ACTION, "name", name,
+ "label", label, "source", source, NULL);
+
+ /* XXX This is a hack to work around the fact that GtkAction's
+ * "label" and "tooltip" properties are not constructor
+ * properties, even though they're supplied upfront.
+ *
+ * See: http://bugzilla.gnome.org/show_bug.cgi?id=568334 */
+ popup_action_constructed (G_OBJECT (popup_action));
+
+ return popup_action;
+}
+
+GtkAction *
+e_popup_action_get_source (EPopupAction *popup_action)
+{
+ g_return_val_if_fail (E_IS_POPUP_ACTION (popup_action), NULL);
+
+ return popup_action->priv->source;
+}
+
+void
+e_action_group_add_popup_actions (GtkActionGroup *action_group,
+ const EPopupActionEntry *entries,
+ guint n_entries)
+{
+ guint ii;
+
+ g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
+
+ for (ii = 0; ii < n_entries; ii++) {
+ EPopupAction *popup_action;
+ GtkAction *source;
+ const gchar *label;
+
+ label = gtk_action_group_translate_string (
+ action_group, entries[ii].label);
+
+ source = gtk_action_group_get_action (
+ action_group, entries[ii].source);
+
+ if (source == NULL) {
+ g_warning (
+ "Source action '%s' not found in "
+ "action group '%s'", entries[ii].source,
+ gtk_action_group_get_name (action_group));
+ continue;
+ }
+
+ popup_action = e_popup_action_new (
+ entries[ii].name, label, source);
+
+ g_signal_connect_swapped (
+ popup_action, "activate",
+ G_CALLBACK (gtk_action_activate),
+ popup_action->priv->source);
+
+ gtk_action_group_add_action (
+ action_group, GTK_ACTION (popup_action));
+
+ g_object_unref (popup_action);
+ }
+}
diff --git a/widgets/misc/e-popup-action.h b/widgets/misc/e-popup-action.h
new file mode 100644
index 0000000000..d19971f303
--- /dev/null
+++ b/widgets/misc/e-popup-action.h
@@ -0,0 +1,95 @@
+/*
+ * e-popup-action.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+/* A popup action is an action that lives in a popup menu. It proxies an
+ * equivalent action in the main menu, with two differences:
+ *
+ * 1) If the main menu action is insensitive, the popup action is invisible.
+ * 2) The popup action may have a different label than the main menu action.
+ *
+ * To use:
+ *
+ * Create an array of EPopupActionEntry structs. Add the main menu actions
+ * that serve as "sources" for the popup actions to an action group first.
+ * Then pass the same action group and the EPopupActionEntry array to
+ * e_action_group_add_popup_actions() to add popup actions.
+ */
+
+#ifndef E_POPUP_ACTION_H
+#define E_POPUP_ACTION_H
+
+#include <gtk/gtk.h>
+
+/* Standard GObject macros */
+#define E_TYPE_POPUP_ACTION \
+ (e_popup_action_get_type ())
+#define E_POPUP_ACTION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_POPUP_ACTION, EPopupAction))
+#define E_POPUP_ACTION_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_POPUP_ACTION, EPopupActionClass))
+#define E_IS_POPUP_ACTION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_POPUP_ACTION))
+#define E_IS_POPUP_ACTION_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_POPUP_ACTION))
+#define E_POPUP_ACTION_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_POPUP_ACTION, EPopupActionClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EPopupAction EPopupAction;
+typedef struct _EPopupActionClass EPopupActionClass;
+typedef struct _EPopupActionPrivate EPopupActionPrivate;
+typedef struct _EPopupActionEntry EPopupActionEntry;
+
+struct _EPopupAction {
+ GtkAction parent;
+ EPopupActionPrivate *priv;
+};
+
+struct _EPopupActionClass {
+ GtkActionClass parent_class;
+};
+
+struct _EPopupActionEntry {
+ const gchar *name;
+ const gchar *label; /* optional: overrides the source action */
+ const gchar *source; /* name of the source action */
+};
+
+GType e_popup_action_get_type (void);
+EPopupAction * e_popup_action_new (const gchar *name,
+ const gchar *label,
+ GtkAction *source);
+GtkAction * e_popup_action_get_source (EPopupAction *popup_action);
+
+void e_action_group_add_popup_actions
+ (GtkActionGroup *action_group,
+ const EPopupActionEntry *entries,
+ guint n_entries);
+
+G_END_DECLS
+
+#endif /* E_POPUP_ACTION_H */
diff --git a/widgets/misc/e-preferences-window.c b/widgets/misc/e-preferences-window.c
new file mode 100644
index 0000000000..af2d07d871
--- /dev/null
+++ b/widgets/misc/e-preferences-window.c
@@ -0,0 +1,393 @@
+/*
+ * e-preferences-window.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-preferences-window.h"
+
+#include <glib/gi18n.h>
+#include <e-util/e-util.h>
+
+#define SWITCH_PAGE_INTERVAL 250
+
+#define E_PREFERENCES_WINDOW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_PREFERENCES_WINDOW, EPreferencesWindowPrivate))
+
+struct _EPreferencesWindowPrivate {
+ GtkWidget *icon_view;
+ GtkWidget *notebook;
+ GHashTable *index;
+};
+
+enum {
+ COLUMN_TEXT, /* G_TYPE_STRING */
+ COLUMN_PIXBUF, /* GDK_TYPE_PIXBUF */
+ COLUMN_PAGE, /* G_TYPE_INT */
+ COLUMN_SORT /* G_TYPE_INT */
+};
+
+static gpointer parent_class;
+
+static GdkPixbuf *
+preferences_window_load_pixbuf (const gchar *icon_name)
+{
+ GtkIconTheme *icon_theme;
+ GtkIconInfo *icon_info;
+ GdkPixbuf *pixbuf;
+ const gchar *filename;
+ gint size;
+ GError *error = NULL;
+
+ icon_theme = gtk_icon_theme_get_default ();
+
+ if (!gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &size, 0))
+ return NULL;
+
+ icon_info = gtk_icon_theme_lookup_icon (
+ icon_theme, icon_name, size, 0);
+
+ if (icon_info == NULL)
+ return NULL;
+
+ filename = gtk_icon_info_get_filename (icon_info);
+
+ pixbuf = gdk_pixbuf_new_from_file (filename, &error);
+
+ gtk_icon_info_free (icon_info);
+
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+
+ return pixbuf;
+}
+
+static void
+preferences_window_help_clicked_cb (GtkWindow *window)
+{
+ e_display_help (window, "config-prefs");
+}
+
+static void
+preferences_window_selection_changed_cb (EPreferencesWindow *window)
+{
+ GtkIconView *icon_view;
+ GtkNotebook *notebook;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GList *list;
+ gint page;
+
+ icon_view = GTK_ICON_VIEW (window->priv->icon_view);
+ list = gtk_icon_view_get_selected_items (icon_view);
+ if (list == NULL)
+ return;
+
+ model = gtk_icon_view_get_model (icon_view);
+ gtk_tree_model_get_iter (model, &iter, list->data);
+ gtk_tree_model_get (model, &iter, COLUMN_PAGE, &page, -1);
+
+ notebook = GTK_NOTEBOOK (window->priv->notebook);
+ gtk_notebook_set_current_page (notebook, page);
+
+ g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
+ g_list_free (list);
+
+ gtk_widget_grab_focus (GTK_WIDGET (icon_view));
+}
+
+static void
+preferences_window_dispose (GObject *object)
+{
+ EPreferencesWindowPrivate *priv;
+
+ priv = E_PREFERENCES_WINDOW_GET_PRIVATE (object);
+
+ if (priv->icon_view != NULL) {
+ g_object_unref (priv->icon_view);
+ priv->icon_view = NULL;
+ }
+
+ if (priv->notebook != NULL) {
+ g_object_unref (priv->notebook);
+ priv->notebook = NULL;
+ }
+
+ g_hash_table_remove_all (priv->index);
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+preferences_window_finalize (GObject *object)
+{
+ EPreferencesWindowPrivate *priv;
+
+ priv = E_PREFERENCES_WINDOW_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->index);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+preferences_window_show (GtkWidget *widget)
+{
+ EPreferencesWindowPrivate *priv;
+ GtkIconView *icon_view;
+ GtkTreePath *path;
+
+ priv = E_PREFERENCES_WINDOW_GET_PRIVATE (widget);
+
+ icon_view = GTK_ICON_VIEW (priv->icon_view);
+
+ path = gtk_tree_path_new_first ();
+ gtk_icon_view_select_path (icon_view, path);
+ gtk_icon_view_scroll_to_path (icon_view, path, FALSE, 0.0, 0.0);
+ gtk_tree_path_free (path);
+
+ gtk_widget_grab_focus (priv->icon_view);
+
+ /* Chain up to parent's show() method. */
+ GTK_WIDGET_CLASS (parent_class)->show (widget);
+}
+
+static void
+preferences_window_class_init (EPreferencesWindowClass *class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EPreferencesWindowPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = preferences_window_dispose;
+ object_class->finalize = preferences_window_finalize;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->show = preferences_window_show;
+}
+
+static void
+preferences_window_init (EPreferencesWindow *window)
+{
+ GtkListStore *store;
+ GtkWidget *container;
+ GtkWidget *hbox;
+ GtkWidget *vbox;
+ GtkWidget *widget;
+ GHashTable *index;
+ const gchar *title;
+
+ index = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) gtk_tree_row_reference_free);
+
+ window->priv = E_PREFERENCES_WINDOW_GET_PRIVATE (window);
+ window->priv->index = index;
+
+ store = gtk_list_store_new (
+ 4, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_INT, G_TYPE_INT);
+ gtk_tree_sortable_set_sort_column_id (
+ GTK_TREE_SORTABLE (store), COLUMN_SORT, GTK_SORT_ASCENDING);
+
+ title = _("Evolution Preferences");
+ gtk_window_set_title (GTK_WINDOW (window), title);
+ gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
+ gtk_container_set_border_width (GTK_CONTAINER (window), 12);
+
+ g_signal_connect (
+ window, "delete-event",
+ G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+
+ widget = gtk_vbox_new (FALSE, 12);
+ gtk_container_add (GTK_CONTAINER (window), widget);
+ gtk_widget_show (widget);
+
+ vbox = widget;
+
+ widget = gtk_hbox_new (FALSE, 12);
+ gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0);
+ gtk_widget_show (widget);
+
+ hbox = widget;
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, TRUE, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store));
+ gtk_icon_view_set_columns (GTK_ICON_VIEW (widget), 1);
+ gtk_icon_view_set_text_column (GTK_ICON_VIEW (widget), COLUMN_TEXT);
+ gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (widget), COLUMN_PIXBUF);
+ g_signal_connect_swapped (
+ widget, "selection-changed",
+ G_CALLBACK (preferences_window_selection_changed_cb), window);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ window->priv->icon_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+ g_object_unref (store);
+
+ widget = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
+ gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
+ window->priv->notebook = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_hbutton_box_new ();
+ gtk_button_box_set_layout (
+ GTK_BUTTON_BOX (widget), GTK_BUTTONBOX_END);
+ gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_HELP);
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (preferences_window_help_clicked_cb), window);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_button_box_set_child_secondary (
+ GTK_BUTTON_BOX (container), widget, TRUE);
+ gtk_widget_show (widget);
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (gtk_widget_hide), window);
+ GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_DEFAULT);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_grab_default (widget);
+ gtk_widget_show (widget);
+}
+
+GType
+e_preferences_window_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (EPreferencesWindowClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) preferences_window_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EPreferencesWindow),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) preferences_window_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_WINDOW, "EPreferencesWindow", &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_preferences_window_new (void)
+{
+ return g_object_new (E_TYPE_PREFERENCES_WINDOW, NULL);
+}
+
+void
+e_preferences_window_add_page (EPreferencesWindow *window,
+ const gchar *page_name,
+ const gchar *icon_name,
+ const gchar *caption,
+ GtkWidget *widget,
+ gint sort_order)
+{
+ GtkTreeRowReference *reference;
+ GtkIconView *icon_view;
+ GtkNotebook *notebook;
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GHashTable *index;
+ GdkPixbuf *pixbuf;
+ GtkTreeIter iter;
+ gint page;
+
+ g_return_if_fail (E_IS_PREFERENCES_WINDOW (window));
+ g_return_if_fail (page_name != NULL);
+ g_return_if_fail (icon_name != NULL);
+ g_return_if_fail (caption != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ icon_view = GTK_ICON_VIEW (window->priv->icon_view);
+ notebook = GTK_NOTEBOOK (window->priv->notebook);
+
+ page = gtk_notebook_get_n_pages (notebook);
+ model = gtk_icon_view_get_model (icon_view);
+ pixbuf = preferences_window_load_pixbuf (icon_name);
+
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+
+ gtk_list_store_set (
+ GTK_LIST_STORE (model), &iter,
+ COLUMN_TEXT, caption, COLUMN_PIXBUF, pixbuf,
+ COLUMN_PAGE, page, COLUMN_SORT, sort_order, -1);
+
+ index = window->priv->index;
+ path = gtk_tree_model_get_path (model, &iter);
+ reference = gtk_tree_row_reference_new (model, path);
+ g_hash_table_insert (index, g_strdup (page_name), reference);
+ gtk_tree_path_free (path);
+
+ gtk_widget_show (widget);
+ gtk_notebook_append_page (notebook, widget, NULL);
+}
+
+void
+e_preferences_window_show_page (EPreferencesWindow *window,
+ const gchar *page_name)
+{
+ GtkTreeRowReference *reference;
+ GtkIconView *icon_view;
+ GtkTreePath *path;
+
+ g_return_if_fail (E_IS_PREFERENCES_WINDOW (window));
+ g_return_if_fail (page_name != NULL);
+
+ icon_view = GTK_ICON_VIEW (window->priv->icon_view);
+ reference = g_hash_table_lookup (window->priv->index, page_name);
+ g_return_if_fail (reference != NULL);
+
+ path = gtk_tree_row_reference_get_path (reference);
+ gtk_icon_view_select_path (icon_view, path);
+ gtk_icon_view_scroll_to_path (icon_view, path, FALSE, 0.0, 0.0);
+ gtk_tree_path_free (path);
+}
diff --git a/widgets/misc/e-preferences-window.h b/widgets/misc/e-preferences-window.h
new file mode 100644
index 0000000000..4944a89e58
--- /dev/null
+++ b/widgets/misc/e-preferences-window.h
@@ -0,0 +1,74 @@
+/*
+ * e-preferences-window.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_PREFERENCES_WINDOW_H
+#define E_PREFERENCES_WINDOW_H
+
+#include <gtk/gtk.h>
+
+/* Standard GObject macros */
+#define E_TYPE_PREFERENCES_WINDOW \
+ (e_preferences_window_get_type ())
+#define E_PREFERENCES_WINDOW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_PREFERENCES_WINDOW, EPreferencesWindow))
+#define E_PREFERENCES_WINDOW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_PREFERENCES_WINDOW, EPreferencesWindowClass))
+#define E_IS_PREFERENCES_WINDOW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_PREFERENCES_WINDOW))
+#define E_IS_PREFERENCES_WINDOW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), E_TYPE_PREFERENCES_WINDOW))
+#define E_PREFERENCES_WINDOW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_TYPE \
+ ((obj), E_TYPE_PREFERENCES_WINDOW, EPreferencesWindowClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EPreferencesWindow EPreferencesWindow;
+typedef struct _EPreferencesWindowClass EPreferencesWindowClass;
+typedef struct _EPreferencesWindowPrivate EPreferencesWindowPrivate;
+
+struct _EPreferencesWindow {
+ GtkWindow parent;
+ EPreferencesWindowPrivate *priv;
+};
+
+struct _EPreferencesWindowClass {
+ GtkWindowClass parent_class;
+};
+
+GType e_preferences_window_get_type (void);
+GtkWidget * e_preferences_window_new (void);
+void e_preferences_window_add_page (EPreferencesWindow *window,
+ const gchar *page_name,
+ const gchar *icon_name,
+ const gchar *caption,
+ GtkWidget *widget,
+ gint sort_order);
+void e_preferences_window_show_page (EPreferencesWindow *window,
+ const gchar *page_name);
+
+G_END_DECLS
+
+#endif /* E_PREFERENCES_WINDOW_H */
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index 2bbbc91a00..9abc60442a 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -22,78 +22,72 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gdk/gdkkeysyms.h>
+#include "e-search-bar.h"
-#include <misc/e-unicode.h>
-#include <misc/e-gui-utils.h>
+#include "config.h"
+#include <stdlib.h>
+#include <string.h>
#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
+#include <e-util/e-util.h>
+#include <e-util/e-unicode.h>
-#include <bonobo/bonobo-ui-util.h>
+#include <e-action-combo-box.h>
+#include <e-gui-utils.h>
+#include <e-icon-entry.h>
-#include <stdlib.h>
-#include <string.h>
+#define E_SEARCH_BAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SEARCH_BAR, ESearchBarPrivate))
-#include "e-icon-entry.h"
-#include "e-search-bar.h"
-#include "e-util/e-util.h"
+struct _ESearchBarPrivate {
+ RuleContext *context;
+ FilterRule *current_query;
-
-enum {
- QUERY_CHANGED,
- MENU_ACTIVATED,
- SEARCH_ACTIVATED,
- SEARCH_CLEARED,
- LAST_SIGNAL
-};
+ GtkWidget *filter_label;
+ GtkWidget *filter_combo_box;
+ GtkWidget *search_label;
+ GtkWidget *search_entry;
+ GtkWidget *scope_label;
+ GtkWidget *scope_combo_box;
-static gint esb_signals [LAST_SIGNAL] = { 0, };
+ GtkRadioAction *search_action;
+ GtkWidget *search_popup_menu;
-static GtkHBoxClass *parent_class = NULL;
+ GtkActionGroup *action_group;
+};
-/* The arguments we take */
enum {
PROP_0,
- PROP_ITEM_ID,
- PROP_SUBITEM_ID,
- PROP_TEXT
+ PROP_CONTEXT,
+ PROP_FILTER_ACTION,
+ PROP_FILTER_VALUE,
+ PROP_FILTER_VISIBLE,
+ PROP_SEARCH_ACTION,
+ PROP_SEARCH_TEXT,
+ PROP_SEARCH_VALUE,
+ PROP_SEARCH_VISIBLE,
+ PROP_SCOPE_ACTION,
+ PROP_SCOPE_VALUE,
+ PROP_SCOPE_VISIBLE
};
-
-/* Forward decls. */
-
-static int find_id (GtkWidget *menu, int idin, const char *type, GtkWidget **widget);
-
-static void emit_search_activated (ESearchBar *esb);
-static void emit_query_changed (ESearchBar *esb);
-
-
-/* Utility functions. */
+static gpointer parent_class;
static void
-set_find_now_sensitive (ESearchBar *search_bar,
- gboolean sensitive)
+action_search_clear_cb (GtkAction *action,
+ ESearchBar *search_bar)
{
- if (search_bar->ui_component != NULL)
- bonobo_ui_component_set_prop (search_bar->ui_component,
- "/commands/ESearchBar:FindNow",
- "sensitive", sensitive ? "1" : "0", NULL);
+ e_search_bar_set_search_text (search_bar, "");
+ gtk_action_set_sensitive (action, FALSE);
}
static void
-update_clear_menuitem_sensitive (ESearchBar *search_bar)
+action_search_find_cb (GtkAction *action,
+ ESearchBar *search_bar)
{
- if (search_bar->ui_component != NULL) {
- gboolean sensitive = GTK_WIDGET_SENSITIVE (search_bar->clear_button) || search_bar->viewitem_id != 0;
-
- bonobo_ui_component_set_prop (search_bar->ui_component,
- "/commands/ESearchBar:Clear",
- "sensitive", sensitive ? "1" : "0", NULL);
- }
+ gtk_action_set_sensitive (action, FALSE);
}
static void
@@ -162,14 +156,12 @@ emit_query_changed (ESearchBar *esb)
}
static void
-emit_search_activated(ESearchBar *esb)
+search_bar_rule_changed (FilterRule *rule,
+ GtkDialog *dialog)
{
- if (esb->pending_activate) {
- g_source_remove (esb->pending_activate);
- esb->pending_activate = 0;
- }
+ gboolean sensitive;
- g_signal_emit (esb, esb_signals [SEARCH_ACTIVATED], 0);
+ sensitive = (rule != NULL && rule->parts != NULL);
if (!esb->lite) {
set_find_now_sensitive (esb, FALSE);
@@ -178,152 +170,60 @@ emit_search_activated(ESearchBar *esb)
}
static void
-emit_menu_activated (ESearchBar *esb, int item)
+search_bar_update_search_popup (ESearchBar *search_bar)
{
- g_signal_emit (esb,
- esb_signals [MENU_ACTIVATED], 0,
- item);
-}
+ GtkAction *action;
+ GtkMenuShell *menu_shell;
+ GSList *list, *iter;
-
-/* Callbacks -- Standard verbs. */
+ action = gtk_action_group_get_action (
+ search_bar->priv->action_group, "search-type");
-static void
-search_now_verb_cb (BonoboUIComponent *ui_component,
- void *data,
- const char *verb_name)
-{
- ESearchBar *esb;
- GtkStyle *style = gtk_widget_get_default_style ();
- char *text;
-
- esb = E_SEARCH_BAR (data);
- text = e_search_bar_get_text (esb);
-
- if (text && *text) {
- gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED]));
- gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
- gtk_widget_modify_base (esb->viewoption, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
- } else {
- gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_set_sensitive (esb->clear_button, FALSE);
+ if (search_bar->priv->search_popup_menu != NULL) {
+ g_object_unref (search_bar->priv->search_popup_menu);
+ search_bar->priv->search_popup_menu = NULL;
}
- g_free (text);
- emit_search_activated (esb);
-}
-
-static void
-clear_verb_cb (BonoboUIComponent *ui_component,
- void *data,
- const char *verb_name)
-{
- ESearchBar *esb;
- esb = E_SEARCH_BAR (data);
-
- gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_set_sensitive (esb->clear_button, FALSE);
-
- clear_search (esb);
- gtk_entry_set_text (GTK_ENTRY (esb->entry), "");
- gtk_widget_grab_focus (esb->entry);
-}
-
-static void
-setup_standard_verbs (ESearchBar *search_bar)
-{
- bonobo_ui_component_add_verb (search_bar->ui_component, "ESearchBar:Clear",
- clear_verb_cb, search_bar);
- bonobo_ui_component_add_verb (search_bar->ui_component, "ESearchBar:FindNow",
- search_now_verb_cb, search_bar);
-
- bonobo_ui_component_set (search_bar->ui_component, "/",
- ("<commands>"
- " <cmd name=\"ESearchBar:Clear\"/>"
- " <cmd name=\"ESearchBar:FindNow\"/>"
- "</commands>"),
- NULL);
-
- /* Make sure the entries are created with the correct sensitivity. */
- set_find_now_sensitive (search_bar, FALSE);
- update_clear_menuitem_sensitive (search_bar);
-}
-
-/* Callbacks -- The verbs for all the definable items. */
-
-static void
-search_verb_cb (BonoboUIComponent *ui_component,
- void *data,
- const char *verb_name)
-{
- ESearchBar *esb;
- const char *p;
- int id;
-
- esb = E_SEARCH_BAR (data);
-
- p = strrchr (verb_name, ':');
- g_return_if_fail (p != NULL);
-
- id = atoi (p + 1);
-
- emit_menu_activated (esb, id);
-}
-
-/* Get the selected menu item's label */
-static const gchar *
-get_selected_item_label (GtkWidget *menu)
-{
- GtkWidget *label, *item;
- const gchar *text = NULL;
-
- item = gtk_menu_get_active ((GtkMenu *)menu);
- label = gtk_bin_get_child ((GtkBin *)item);
-
- if (GTK_IS_LABEL (label))
- text = gtk_label_get_text ((GtkLabel *)label);
-
- return text;
-}
+ if (search_bar->priv->search_action == NULL) {
+ gtk_action_set_sensitive (action, FALSE);
+ return;
+ }
-static gboolean
-entry_focus_in_cb (GtkWidget *widget,
- GdkEventFocus *event,
- ESearchBar *esb)
-{
- GtkStyle *entry_style, *default_style;
+ search_bar->priv->search_popup_menu = gtk_menu_new ();
+ menu_shell = GTK_MENU_SHELL (search_bar->priv->search_popup_menu);
+ list = gtk_radio_action_get_group (search_bar->priv->search_action);
- entry_style = gtk_widget_get_style (esb->entry);
- default_style = gtk_widget_get_default_style ();
+ for (iter = list; iter != NULL; iter = iter->next) {
+ GtkAction *action = iter->data;
+ GtkWidget *widget;
- if (gdk_color_equal (&(entry_style->text[GTK_STATE_NORMAL]), &(default_style->text[GTK_STATE_INSENSITIVE]))) {
- gtk_entry_set_text (GTK_ENTRY (esb->entry), "");
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
+ widget = gtk_action_create_menu_item (action);
+ gtk_menu_shell_append (menu_shell, widget);
+ gtk_widget_show (widget);
}
- return FALSE;
+ gtk_action_set_sensitive (action, TRUE);
}
static gboolean
-paint_search_text (GtkWidget *widget, ESearchBar *esb)
+paint_search_text (GtkWidget *widget,
+ ESearchBar *search_bar)
{
+#if 0
GtkStyle *style = gtk_widget_get_default_style ();
- const gchar *text = NULL;
- GtkWidget *menu_widget = esb->option_menu;
+ const gchar *text;
+ GtkWidget *menu_widget = search_bar->option_menu;
text = gtk_entry_get_text (GTK_ENTRY (widget));
if (text && *text)
return FALSE;
- if (!GTK_WIDGET_SENSITIVE (esb->option_button)) {
- menu_widget = esb->scopeoption_menu;
- text = g_object_get_data (G_OBJECT(gtk_menu_get_active ( GTK_MENU (esb->scopeoption_menu))),"string");
- } else if (!GTK_IS_RADIO_MENU_ITEM (gtk_menu_get_active ( GTK_MENU (esb->option_menu))))
+ style = gtk_widget_get_default_style ();
+
+ if (!GTK_WIDGET_SENSITIVE (search_bar->option_button)) {
+ menu_widget = search_bar->scopeoption_menu;
+ text = g_object_get_data (G_OBJECT(gtk_menu_get_active ( GTK_MENU (search_bar->scopeoption_menu))),"string");
+ } else if (!GTK_IS_RADIO_MENU_ITEM (gtk_menu_get_active ( GTK_MENU (search_bar->option_menu))))
return FALSE;
else /* no query in search entry .. so set the current option */
text = get_selected_item_label (menu_widget);
@@ -332,19 +232,22 @@ paint_search_text (GtkWidget *widget, ESearchBar *esb)
if (text && *text) {
gchar *t;
- if (!GTK_WIDGET_HAS_FOCUS(esb->entry)) {
- gtk_entry_set_text (GTK_ENTRY (esb->entry), text);
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_INSENSITIVE]));
+ if (!GTK_WIDGET_HAS_FOCUS(search_bar->entry)) {
+ gtk_entry_set_text (GTK_ENTRY (search_bar->entry), text);
+ gtk_widget_modify_text (search_bar->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_INSENSITIVE]));
}
t = g_strdup_printf ("%s: %s\n%s", _("Search"), text, _("Click here to change the search type"));
- gtk_widget_set_tooltip_text (esb->option_button, t);
+ gtk_widget_set_tooltip_text (search_bar->option_button, t);
g_free (t);
- gtk_widget_set_sensitive (esb->clear_button, FALSE);
+ gtk_widget_set_sensitive (search_bar->clear_button, FALSE);
}
return FALSE;
+#endif
+
+ return FALSE;
}
void
@@ -382,293 +285,319 @@ entry_activated_cb (GtkWidget *widget,
gtk_widget_set_sensitive (esb->clear_button, FALSE);
}
- emit_search_activated (esb);
+ icon_entry = E_ICON_ENTRY (search_bar->priv->search_entry);
+ entry = e_icon_entry_get_entry (icon_entry);
+ paint_search_text (entry, search_bar);
}
static void
-entry_changed_cb (GtkWidget *widget,
- ESearchBar *esb)
+search_bar_entry_activated_cb (ESearchBar *search_bar,
+ GtkWidget *entry)
{
- const char *text = gtk_entry_get_text (GTK_ENTRY (esb->entry));
- GtkStyle *entry_style, *default_style;
+ GtkStyle *style;
+ GtkAction *action;
+ GtkActionGroup *action_group;
+ gboolean sensitive;
+ const gchar *text;
- entry_style = gtk_widget_get_style (esb->entry);
- default_style = gtk_widget_get_default_style ();
+ style = gtk_widget_get_default_style ();
+ text = gtk_entry_get_text (GTK_ENTRY (entry));
+ action_group = e_search_bar_get_action_group (search_bar);
if (text && *text) {
- if (gdk_color_equal (&(entry_style->text[GTK_STATE_NORMAL]), &(default_style->text[GTK_STATE_INSENSITIVE])))
- gtk_widget_set_sensitive (esb->clear_button, FALSE);
- else
- gtk_widget_set_sensitive (esb->clear_button, TRUE);
+ gtk_widget_modify_base (
+ entry, GTK_STATE_NORMAL,
+ &(style->base[GTK_STATE_SELECTED]));
+ gtk_widget_modify_text (
+ entry, GTK_STATE_NORMAL,
+ &(style->text[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (
+ search_bar->priv->search_entry,
+ GTK_STATE_NORMAL,
+ &(style->base[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (
+ search_bar->priv->filter_combo_box,
+ GTK_STATE_NORMAL,
+ &(style->base[GTK_STATE_SELECTED]));
+ sensitive = TRUE;
} else {
- /* selected color means some search text is active */
- gtk_widget_set_sensitive (esb->clear_button, gdk_color_equal (&(entry_style->base[GTK_STATE_NORMAL]), &(default_style->base[GTK_STATE_SELECTED])));
+ gtk_widget_modify_base (
+ entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_modify_text (
+ entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_modify_base (
+ search_bar->priv->search_entry,
+ GTK_STATE_NORMAL, NULL);
+ sensitive = FALSE;
}
-}
-
-static void
-viewitem_activated_cb(GtkWidget *widget, ESearchBar *esb)
-{
- gint viewid;
- GtkStyle *entry_style, *default_style;
- widget = gtk_menu_get_active (GTK_MENU (esb->viewoption_menu));
+ action = gtk_action_group_get_action (
+ action_group, E_SEARCH_BAR_ACTION_CLEAR);
+ gtk_action_set_sensitive (action, sensitive);
- viewid = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbItemId"));
- esb->viewitem_id = viewid;
-
- entry_style = gtk_widget_get_style (esb->entry);
- default_style = gtk_widget_get_default_style ();
-
- /* If the text is grayed, Its not the query string */
- if (gdk_color_equal (&(entry_style->text[GTK_STATE_NORMAL]), &(default_style->text[GTK_STATE_INSENSITIVE]))) {
- gtk_entry_set_text (GTK_ENTRY (esb->entry), "");
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
- }
-
- esb->block_search = TRUE;
- emit_search_activated (esb);
- esb->block_search = FALSE;
+ action = gtk_action_group_get_action (
+ action_group, E_SEARCH_BAR_ACTION_FIND);
+ gtk_action_activate (action);
}
static void
-scopeitem_activated_cb(GtkWidget *widget, ESearchBar *esb)
-{
- gint scopeid;
- GtkStyle *entry_style, *default_style;
-
- widget = gtk_menu_get_active (GTK_MENU (esb->scopeoption_menu));
-
- scopeid = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbItemId"));
- esb->scopeitem_id = scopeid;
-
- entry_style = gtk_widget_get_style (esb->entry);
- default_style = gtk_widget_get_default_style ();
-
- /* If the text is grayed, Its not the query string */
- if (gdk_color_equal (&(entry_style->text[GTK_STATE_NORMAL]), &(default_style->text[GTK_STATE_INSENSITIVE]))) {
- gtk_widget_grab_focus (esb->entry);
- gtk_entry_set_text (GTK_ENTRY (esb->entry), "");
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
+search_bar_entry_changed_cb (ESearchBar *search_bar,
+ GtkWidget *entry)
+{
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ GtkStyle *style1;
+ GtkStyle *style2;
+ GdkColor *color1;
+ GdkColor *color2;
+ gboolean sensitive;
+ const gchar *text;
+
+ style1 = gtk_widget_get_style (entry);
+ style2 = gtk_widget_get_default_style ();
+
+ text = gtk_entry_get_text (GTK_ENTRY (entry));
+
+ if (text != NULL && *text != '\0') {
+ color1 = &style1->text[GTK_STATE_NORMAL];
+ color2 = &style2->text[GTK_STATE_INSENSITIVE];
+ sensitive = !gdk_color_equal (color1, color2);
+ } else {
+ color1 = &style1->text[GTK_STATE_NORMAL];
+ color2 = &style2->text[GTK_STATE_SELECTED];
+ sensitive = gdk_color_equal (color1, color2);
}
- esb->block_search = TRUE;
- emit_search_activated (esb);
- esb->block_search = FALSE;
+ action_group = search_bar->priv->action_group;
+ action = gtk_action_group_get_action (
+ action_group, E_SEARCH_BAR_ACTION_CLEAR);
+ gtk_action_set_sensitive (action, sensitive);
}
-static void
-option_activated_cb (GtkWidget *widget,
- ESearchBar *esb)
+static gboolean
+search_bar_entry_focus_in_cb (ESearchBar *search_bar,
+ GdkEventFocus *event,
+ GtkWidget *entry)
{
- int id;
- const char *text;
+ GtkStyle *style1;
+ GtkStyle *style2;
+ GdkColor *color1;
+ GdkColor *color2;
- id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbItemId"));
+ style1 = gtk_widget_get_style (entry);
+ style2 = gtk_widget_get_default_style ();
- e_search_bar_set_item_id (esb, id);
+ color1 = &style1->text[GTK_STATE_NORMAL];
+ color2 = &style2->text[GTK_STATE_INSENSITIVE];
- if (GTK_IS_RADIO_MENU_ITEM (gtk_menu_get_active ( GTK_MENU (esb->option_menu)))) {
- gchar *t;
- text = get_selected_item_label (esb->option_menu);
- if (text && *text)
- t = g_strdup_printf ("%s: %s\n%s", _("Search"), text, _("Click here to change the search type"));
- else
- t = g_strdup_printf ("%s: %s", _("Search"), _("Click here to change the search type"));
-
- gtk_widget_set_tooltip_text (esb->option_button, t);
- g_free (t);
+ if (gdk_color_equal (color1, color2)) {
+ gtk_entry_set_text (GTK_ENTRY (entry), "");
+ gtk_widget_modify_text (entry, GTK_STATE_NORMAL, NULL);
}
- if (!esb->block_search) {
- emit_query_changed (esb);
- }
- if (!esb->block_search && id > 0) {
- emit_search_activated (esb);
- }
-}
-
-static void
-option_button_clicked_cb (GtkWidget *widget, GdkEventButton *event,
- ESearchBar *esb)
-{
- gtk_menu_popup (GTK_MENU (esb->option_menu), NULL, NULL, NULL, NULL,1,gtk_get_current_event_time());
-
- gtk_widget_grab_focus (esb->entry);
-}
-
-static void
-clear_button_clicked_cb (GtkWidget *widget, GdkEventButton *event,
- ESearchBar *esb)
-{
- gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_set_sensitive (esb->clear_button, FALSE);
-
- clear_search (esb);
- gtk_entry_set_text (GTK_ENTRY (esb->entry), "");
- gtk_widget_grab_focus (esb->entry);
+ return FALSE;
}
static gboolean
-entry_key_press_cb (GtkWidget *widget,
- GdkEventKey *key_event,
- ESearchBar *esb)
+search_bar_entry_focus_out_cb (ESearchBar *search_bar,
+ GdkEventFocus *event,
+ GtkWidget *entry)
{
- if (((key_event->state & gtk_accelerator_get_default_mod_mask ()) ==
- GDK_MOD1_MASK) && (key_event->keyval == GDK_Down)) {
- option_button_clicked_cb (NULL, NULL, esb);
- return TRUE;
- }
-
- return FALSE;
+ return paint_search_text (entry, search_bar);
}
-#if 0
-static void
-scopeoption_changed_cb (GtkWidget *option_menu, ESearchBar *search_bar)
+static gboolean
+search_bar_entry_key_press_cb (ESearchBar *search_bar,
+ GdkEventKey *key_event,
+ GtkWidget *entry)
{
- char *text = NULL;
-
- text = e_search_bar_get_text (search_bar);
- if (!(text && *text))
- gtk_widget_grab_focus (search_bar->entry);
-
- if(!search_bar->block_search)
- emit_query_changed (search_bar);
+ guint state;
- g_free (text);
-}
+#if 0 /* FIXME */
+ state = key_event->state & gtk_accelerator_get_default_mod_mask ();
+ if (state == GDK_MOD1_MASK && key_event->keyval == GDK_Down) {
+ search_bar_option_clicked_cb (search_bar, NULL, NULL);
+ return TRUE;
+ }
#endif
-
-/* Widgetry creation. */
-
-#if 0
-/* This function exists to fix the irreparable GtkOptionMenu stupidity. In
- fact, this lame-ass widget adds a 1-pixel-wide empty border around the
- button for no reason. So we have add a 1-pixel-wide border around the the
- buttons we have in the search bar to make things look right. This is done
- through an event box. */
-static GtkWidget *
-put_in_spacer_widget (GtkWidget *widget)
-{
- GtkWidget *holder;
-
- holder = gtk_event_box_new ();
- gtk_container_set_border_width (GTK_CONTAINER (holder), 1);
- gtk_container_add (GTK_CONTAINER (holder), widget);
- return holder;
+ return FALSE;
}
-#endif
static void
-append_xml_menu_item (GString *xml,
- const char *name,
- const char *label,
- const char *stock,
- const char *verb,
- const char *accelerator)
-{
- char *encoded_label;
-
- encoded_label = bonobo_ui_util_encode_str (label);
- g_string_append_printf (xml, "<menuitem name=\"%s\" verb=\"%s\" label=\"%s\"",
- name, verb, encoded_label);
- g_free (encoded_label);
-
- if (accelerator != NULL)
- g_string_append_printf (xml, " accel=\"%s\"", accelerator);
- if (stock != NULL)
- g_string_append_printf (xml, " pixtype=\"stock\" pixname=\"%s\"", stock);
+search_bar_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CONTEXT:
+ e_search_bar_set_context (
+ E_SEARCH_BAR (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_FILTER_ACTION:
+ e_search_bar_set_filter_action (
+ E_SEARCH_BAR (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_FILTER_VALUE:
+ e_search_bar_set_filter_value (
+ E_SEARCH_BAR (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_FILTER_VISIBLE:
+ e_search_bar_set_filter_visible (
+ E_SEARCH_BAR (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_SEARCH_ACTION:
+ e_search_bar_set_search_action (
+ E_SEARCH_BAR (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SEARCH_TEXT:
+ e_search_bar_set_search_text (
+ E_SEARCH_BAR (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_SEARCH_VALUE:
+ e_search_bar_set_search_value (
+ E_SEARCH_BAR (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_SEARCH_VISIBLE:
+ e_search_bar_set_search_visible (
+ E_SEARCH_BAR (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_SCOPE_ACTION:
+ e_search_bar_set_scope_action (
+ E_SEARCH_BAR (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SCOPE_VALUE:
+ e_search_bar_set_scope_value (
+ E_SEARCH_BAR (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_SCOPE_VISIBLE:
+ e_search_bar_set_scope_visible (
+ E_SEARCH_BAR (object),
+ g_value_get_boolean (value));
+ return;
+ }
- g_string_append (xml, "/>");
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-remove_bonobo_menus (ESearchBar *esb)
-{
- if (bonobo_ui_component_get_container (esb->ui_component) == CORBA_OBJECT_NIL)
- return;
+search_bar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CONTEXT:
+ g_value_set_object (
+ value, e_search_bar_get_context (
+ E_SEARCH_BAR (object)));
+ return;
+
+ case PROP_FILTER_ACTION:
+ g_value_set_object (
+ value, e_search_bar_get_filter_action (
+ E_SEARCH_BAR (object)));
+ return;
+
+ case PROP_FILTER_VALUE:
+ g_value_set_int (
+ value, e_search_bar_get_filter_value (
+ E_SEARCH_BAR (object)));
+ return;
+
+ case PROP_FILTER_VISIBLE:
+ g_value_set_boolean (
+ value, e_search_bar_get_filter_visible (
+ E_SEARCH_BAR (object)));
+ return;
+
+ case PROP_SEARCH_ACTION:
+ g_value_set_object (
+ value, e_search_bar_get_search_action (
+ E_SEARCH_BAR (object)));
+ return;
+
+ case PROP_SEARCH_TEXT:
+ g_value_set_string (
+ value, e_search_bar_get_search_text (
+ E_SEARCH_BAR (object)));
+ return;
+
+ case PROP_SEARCH_VALUE:
+ g_value_set_int (
+ value, e_search_bar_get_search_value (
+ E_SEARCH_BAR (object)));
+ return;
+
+ case PROP_SEARCH_VISIBLE:
+ g_value_set_boolean (
+ value, e_search_bar_get_search_visible (
+ E_SEARCH_BAR (object)));
+ return;
+
+ case PROP_SCOPE_ACTION:
+ g_value_set_object (
+ value, e_search_bar_get_scope_action (
+ E_SEARCH_BAR (object)));
+ return;
+
+ case PROP_SCOPE_VALUE:
+ g_value_set_int (
+ value, e_search_bar_get_scope_value (
+ E_SEARCH_BAR (object)));
+ return;
+
+ case PROP_SCOPE_VISIBLE:
+ g_value_set_boolean (
+ value, e_search_bar_get_scope_visible (
+ E_SEARCH_BAR (object)));
+ return;
+ }
- bonobo_ui_component_rm (esb->ui_component, "/menu/SearchPlaceholder", NULL);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-setup_bonobo_menus (ESearchBar *esb)
+search_bar_dispose (GObject *object)
{
- GString *xml;
- GSList *p;
- char *verb_name;
- char *encoded_title;
+ ESearchBarPrivate *priv;
- xml = g_string_new ("");
+ priv = E_SEARCH_BAR_GET_PRIVATE (object);
- encoded_title = bonobo_ui_util_encode_str (_("_Search"));
- g_string_append_printf (xml, "<submenu name=\"Search\" label=\"%s\">", encoded_title);
- g_free (encoded_title);
-
- g_string_append (xml, "<placeholder name=\"SearchBar\">");
-
- append_xml_menu_item (xml, "FindNow", _("_Find Now"), "gtk-find", "ESearchBar:FindNow", NULL);
- append_xml_menu_item (xml, "Clear", _("_Clear"), "gtk-clear", "ESearchBar:Clear", "*Control**Shift*q");
-
- for (p = esb->menu_items; p != NULL; p = p->next) {
- const ESearchBarItem *item;
-
- item = (const ESearchBarItem *) p->data;
-
- verb_name = verb_name_from_id (item->id);
- bonobo_ui_component_add_verb (esb->ui_component, verb_name, search_verb_cb, esb);
-
- if (item->text == NULL)
- g_string_append (xml, "<separator/>");
- else
- append_xml_menu_item (xml, verb_name, item->text, NULL, verb_name, NULL);
-
- g_free (verb_name);
+ if (priv->context != NULL) {
+ g_object_unref (priv->context);
+ priv->context = NULL;
}
- g_string_append (xml, "</placeholder>");
- g_string_append (xml, "</submenu>");
-
- remove_bonobo_menus (esb);
- bonobo_ui_component_set (esb->ui_component, "/menu/SearchPlaceholder", xml->str, NULL);
-
- g_string_free (xml, TRUE);
-
- if (esb->clear_button) {
- g_signal_connect (esb->clear_button, "state-changed", G_CALLBACK (clear_button_state_changed), esb);
+ if (priv->filter_label != NULL) {
+ g_object_unref (priv->filter_label);
+ priv->filter_label = NULL;
}
-}
-
-static void
-update_bonobo_menus (ESearchBar *esb)
-{
- setup_bonobo_menus (esb);
-}
-
-static void
-set_menu (ESearchBar *esb,
- ESearchBarItem *items)
-{
- int i;
-
- free_menu_items (esb);
- if (items == NULL)
- return;
-
- for (i = 0; items[i].id != -1; i++) {
- ESearchBarItem *new_item;
-
- new_item = g_new (ESearchBarItem, 1);
- new_item->text = items[i].text ? g_strdup (_(items[i].text)) : NULL;
- new_item->id = items[i].id;
- new_item->type = items[i].type;
-
- esb->menu_items = g_slist_append (esb->menu_items, new_item);
+ if (priv->filter_combo_box != NULL) {
+ g_object_unref (priv->filter_combo_box);
+ priv->filter_combo_box = NULL;
}
if (!esb->lite && esb->ui_component != NULL)
@@ -734,95 +663,277 @@ set_option (ESearchBar *esb, ESearchBarItem *items)
gtk_widget_set_sensitive (item, FALSE);
}
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+ if (priv->search_entry != NULL) {
+ g_object_unref (priv->search_entry);
+ priv->search_entry = NULL;
+ }
- g_object_set_data (G_OBJECT (item), "EsbItemId", GINT_TO_POINTER(items[i].id));
+ if (priv->scope_label != NULL) {
+ g_object_unref (priv->scope_label);
+ priv->scope_label = NULL;
+ }
- g_signal_connect (item, "activate",
- G_CALLBACK (option_activated_cb),
- esb);
+ if (priv->scope_combo_box != NULL) {
+ g_object_unref (priv->scope_combo_box);
+ priv->scope_combo_box = NULL;
}
- gtk_widget_show_all (menu);
- g_object_set_data (G_OBJECT(esb->option_menu), "group", group);
- entry_focus_out_cb (esb->entry, NULL, esb);
-}
+ if (priv->search_action != NULL) {
+ g_object_unref (priv->search_action);
+ priv->search_action = NULL;
+ }
-static int
-find_id (GtkWidget *menu, int idin, const char *type, GtkWidget **widget)
-{
- GList *l = GTK_MENU_SHELL (menu)->children;
- int row = -1, i = 0, id;
-
- if (widget)
- *widget = NULL;
- while (l) {
- id = GPOINTER_TO_INT (g_object_get_data (l->data, type));
- if (id == idin) {
- row = i;
- if (widget)
- *widget = l->data;
- break;
- }
- i++;
- l = l->next;
+ if (priv->action_group != NULL) {
+ g_object_unref (priv->action_group);
+ priv->action_group = NULL;
}
- return row;
-}
-
-/* GtkObject methods. */
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
static void
-impl_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+search_bar_class_init (ESearchBarClass *class)
{
- ESearchBar *esb = E_SEARCH_BAR (object);
-
- switch (prop_id) {
- case PROP_ITEM_ID:
- g_value_set_int (value, e_search_bar_get_item_id (esb));
- break;
-
- case PROP_TEXT:
- g_value_take_string (value, e_search_bar_get_text (esb));
- break;
+ GObjectClass *object_class;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ESearchBarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = search_bar_set_property;
+ object_class->get_property = search_bar_get_property;
+ object_class->dispose = search_bar_dispose;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CONTEXT,
+ g_param_spec_object (
+ "context",
+ NULL,
+ NULL,
+ RULE_TYPE_CONTEXT,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FILTER_ACTION,
+ g_param_spec_object (
+ "filter-action",
+ NULL,
+ NULL,
+ GTK_TYPE_RADIO_ACTION,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FILTER_VALUE,
+ g_param_spec_int (
+ "filter-value",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FILTER_VISIBLE,
+ g_param_spec_boolean (
+ "filter-visible",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SEARCH_ACTION,
+ g_param_spec_object (
+ "search-action",
+ NULL,
+ NULL,
+ GTK_TYPE_RADIO_ACTION,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SEARCH_TEXT,
+ g_param_spec_string (
+ "search-text",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SEARCH_VALUE,
+ g_param_spec_int (
+ "search-value",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SEARCH_VISIBLE,
+ g_param_spec_boolean (
+ "search-visible",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SCOPE_ACTION,
+ g_param_spec_object (
+ "scope-action",
+ NULL,
+ NULL,
+ GTK_TYPE_RADIO_ACTION,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SCOPE_VALUE,
+ g_param_spec_int (
+ "scope-value",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SCOPE_VISIBLE,
+ g_param_spec_boolean (
+ "scope-visible",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
}
static void
-impl_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+search_bar_init (ESearchBar *search_bar)
{
- ESearchBar *esb = E_SEARCH_BAR(object);
+ EIconEntry *icon_entry;
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ GtkLabel *label;
+ GtkWidget *mnemonic;
+ GtkWidget *widget;
- switch (prop_id) {
- case PROP_ITEM_ID:
- e_search_bar_set_item_id (esb, g_value_get_int (value));
- break;
+ search_bar->priv = E_SEARCH_BAR_GET_PRIVATE (search_bar);
- case PROP_TEXT:
- e_search_bar_set_text (esb, g_value_get_string (value));
- break;
+ gtk_box_set_spacing (GTK_BOX (search_bar), 3);
+ gtk_box_set_homogeneous (GTK_BOX (search_bar), FALSE);
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ /*** Filter Widgets ***/
+
+ /* Translators: The "Show: " label is followed by the Quick Search
+ * Dropdown Menu where you can choose to display "All Messages",
+ * "Unread Messages", "Message with 'Important' Label" and so on... */
+ widget = gtk_label_new_with_mnemonic (_("Sho_w: "));
+ gtk_box_pack_start (GTK_BOX (search_bar), widget, FALSE, FALSE, 0);
+ search_bar->priv->filter_label = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ label = GTK_LABEL (widget);
+
+ widget = e_action_combo_box_new ();
+ gtk_label_set_mnemonic_widget (label, widget);
+ gtk_box_pack_start (GTK_BOX (search_bar), widget, FALSE, TRUE, 0);
+ search_bar->priv->filter_combo_box = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /*** Scope Widgets ***/
+
+ widget = e_action_combo_box_new ();
+ gtk_box_pack_end (GTK_BOX (search_bar), widget, FALSE, FALSE, 0);
+ search_bar->priv->scope_combo_box = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ mnemonic = widget;
+
+ /* Translators: The " in " label is part of the Quick Search Bar,
+ * example: Search: [_________________] in [ Current Folder ] */
+ widget = gtk_label_new_with_mnemonic (_(" i_n "));
+ gtk_label_set_mnemonic_widget (GTK_LABEL (widget), mnemonic);
+ gtk_box_pack_end (GTK_BOX (search_bar), widget, FALSE, FALSE, 0);
+ search_bar->priv->scope_label = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /*** Search Widgets ***/
+
+ widget = e_icon_entry_new ();
+ gtk_box_pack_end (GTK_BOX (search_bar), widget, FALSE, FALSE, 0);
+ search_bar->priv->search_entry = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ icon_entry = E_ICON_ENTRY (widget);
+
+ /* Translators: The "Search: " label is followed by the Quick Search
+ * Text input field where one enters the term to search for. */
+ widget = gtk_label_new_with_mnemonic (_("Sear_ch: "));
+ gtk_box_pack_end (GTK_BOX (search_bar), widget, FALSE, FALSE, 0);
+ search_bar->priv->search_label = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ label = GTK_LABEL (widget);
+
+ widget = e_icon_entry_get_entry (icon_entry);
+ gtk_label_set_mnemonic_widget (label, widget);
+ g_signal_connect_swapped (
+ widget, "activate",
+ G_CALLBACK (search_bar_entry_activated_cb), search_bar);
+ g_signal_connect_swapped (
+ widget, "changed",
+ G_CALLBACK (search_bar_entry_changed_cb), search_bar);
+ g_signal_connect_swapped (
+ widget, "focus-in-event",
+ G_CALLBACK (search_bar_entry_focus_in_cb), search_bar);
+ g_signal_connect_swapped (
+ widget, "focus-out-event",
+ G_CALLBACK (search_bar_entry_focus_out_cb), search_bar);
+ g_signal_connect_swapped (
+ widget, "key-press-event",
+ G_CALLBACK (search_bar_entry_key_press_cb), search_bar);
+
+ action_group = gtk_action_group_new ("search");
+ gtk_action_group_set_translation_domain (
+ action_group, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions (
+ action_group, search_entries,
+ G_N_ELEMENTS (search_entries), search_bar);
+ search_bar->priv->action_group = action_group;
+
+ action = gtk_action_group_get_action (
+ action_group, E_SEARCH_BAR_ACTION_TYPE);
+ e_icon_entry_add_action_start (icon_entry, action);
+ gtk_action_set_sensitive (action, FALSE);
+
+ action = gtk_action_group_get_action (
+ action_group, E_SEARCH_BAR_ACTION_CLEAR);
+ e_icon_entry_add_action_end (icon_entry, action);
+ gtk_action_set_sensitive (action, FALSE);
}
-static void
-impl_dispose (GObject *object)
+GType
+e_search_bar_get_type (void)
{
- ESearchBar *esb = E_SEARCH_BAR (object);
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_SEARCH_BAR (object));
-
- /* These three we do need to unref, because we explicitly hold
- references to them. */
+ static GType type = 0;
if (!esb->lite && esb->ui_component != NULL) {
bonobo_object_unref (BONOBO_OBJECT (esb->ui_component));
@@ -837,139 +948,44 @@ impl_dispose (GObject *object)
esb->suboption = NULL;
}
- if (esb->pending_activate) {
- g_source_remove (esb->pending_activate);
- esb->pending_activate = 0;
+ type = g_type_register_static (
+ GTK_TYPE_HBOX, "ESearchBar", &type_info, 0);
}
- free_menu_items (esb);
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ return type;
}
-
-static void
-class_init (ESearchBarClass *klass)
+GtkWidget *
+e_search_bar_new (void)
{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (gtk_hbox_get_type ());
-
- object_class->set_property = impl_set_property;
- object_class->get_property = impl_get_property;
- object_class->dispose = impl_dispose;
-
- klass->set_menu = set_menu;
- klass->set_option = set_option;
-
- g_object_class_install_property (object_class, PROP_ITEM_ID,
- g_param_spec_int ("item_id",
- _("Item ID"),
- /*_( */"XXX blurb" /*)*/,
- 0, 0, 0,
- G_PARAM_READWRITE | G_PARAM_LAX_VALIDATION));
-
- g_object_class_install_property (object_class, PROP_TEXT,
- g_param_spec_string ("text",
- _("Text"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- esb_signals [QUERY_CHANGED] =
- g_signal_new ("query_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESearchBarClass, query_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- esb_signals [MENU_ACTIVATED] =
- g_signal_new ("menu_activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESearchBarClass, menu_activated),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- esb_signals [SEARCH_ACTIVATED] =
- g_signal_new ("search_activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESearchBarClass, search_activated),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- esb_signals [SEARCH_CLEARED] =
- g_signal_new ("search_cleared",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESearchBarClass, search_cleared),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ return g_object_new (E_TYPE_SEARCH_BAR, NULL);
}
-static void
-init (ESearchBar *esb)
+GtkActionGroup *
+e_search_bar_get_action_group (ESearchBar *search_bar)
{
- esb->ui_component = NULL;
- esb->menu_items = NULL;
-
- esb->option = NULL;
- esb->entry = NULL;
- esb->suboption = NULL;
-
- esb->option_menu = NULL;
- esb->suboption_menu = NULL;
- esb->option_button = NULL;
- esb->clear_button = NULL;
- esb->entry_box = NULL;
-
- esb->scopeoption_menu = NULL;
- esb->scopeoption = NULL;
- esb->scopeoption_box = NULL;
-
- esb->pending_activate = 0;
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), NULL);
- esb->item_id = 0;
- esb->scopeitem_id = 0;
- esb->last_search_option = 0;
- esb->block_search = FALSE;
+ return search_bar->priv->action_group;
}
-
-/* Object construction. */
-
-static gint
-idle_activate_hack (gpointer ptr)
+RuleContext *
+e_search_bar_get_context (ESearchBar *search_bar)
{
- ESearchBar *esb = E_SEARCH_BAR (ptr);
- esb->pending_activate = 0;
- emit_search_activated (esb);
- return FALSE;
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), NULL);
+
+ return search_bar->priv->context;
}
void
-e_search_bar_construct (ESearchBar *search_bar,
- ESearchBarItem *menu_items,
- ESearchBarItem *option_items)
+e_search_bar_set_context (ESearchBar *search_bar,
+ RuleContext *context)
{
- GtkWidget *label, *hbox, *bighbox;
-
- g_return_if_fail (search_bar != NULL);
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
- g_return_if_fail (option_items != NULL);
+ g_return_if_fail (IS_RULE_CONTEXT (context));
- gtk_box_set_spacing (GTK_BOX (search_bar), 3);
-
- gtk_box_set_homogeneous (GTK_BOX (search_bar), FALSE);
+ if (search_bar->priv->context != NULL)
+ g_object_unref (search_bar->priv->context);
bighbox = gtk_hbox_new (FALSE, 0);
search_bar->entry_box = gtk_hbox_new (0, FALSE);
@@ -1082,201 +1098,131 @@ e_search_bar_construct (ESearchBar *search_bar,
search_bar->pending_activate = g_idle_add (idle_activate_hack, search_bar);
}
-void
-e_search_bar_set_menu (ESearchBar *search_bar, ESearchBarItem *menu_items)
+GtkRadioAction *
+e_search_bar_get_filter_action (ESearchBar *search_bar)
{
- g_return_if_fail (search_bar != NULL);
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
+ EActionComboBox *combo_box;
- ((ESearchBarClass *) GTK_OBJECT_GET_CLASS (search_bar))->set_menu (search_bar, menu_items);
-}
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), NULL);
-void
-e_search_bar_add_menu (ESearchBar *search_bar, ESearchBarItem *menu_item)
-{
- g_return_if_fail (search_bar != NULL);
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
+ combo_box = E_ACTION_COMBO_BOX (search_bar->priv->filter_combo_box);
- set_menu (search_bar, menu_item);
+ return e_action_combo_box_get_action (combo_box);
}
void
-e_search_bar_set_option (ESearchBar *search_bar, ESearchBarItem *option_items)
+e_search_bar_set_filter_action (ESearchBar *search_bar,
+ GtkRadioAction *action)
{
- g_return_if_fail (search_bar != NULL);
+ EActionComboBox *combo_box;
+
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
- g_return_if_fail (option_items != NULL);
- ((ESearchBarClass *) GTK_OBJECT_GET_CLASS (search_bar))->set_option (search_bar, option_items);
+ combo_box = E_ACTION_COMBO_BOX (search_bar->priv->filter_combo_box);
+
+ e_action_combo_box_set_action (combo_box, action);
+ g_object_notify (G_OBJECT (search_bar), "filter-action");
}
-void
-e_search_bar_set_viewoption_menufunc (ESearchBar *search_bar, ESearchBarMenuFunc *menu_gen_func, void *data)
+gint
+e_search_bar_get_filter_value (ESearchBar *search_bar)
{
- g_signal_connect (search_bar->viewoption, "button_press_event", G_CALLBACK (menu_gen_func), data);
+ EActionComboBox *combo_box;
+
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), 0);
+
+ combo_box = E_ACTION_COMBO_BOX (search_bar->priv->filter_combo_box);
+
+ return e_action_combo_box_get_current_value (combo_box);
}
-/**
- * e_search_bar_set_viewoption_menu:
- * @search_bar: A search bar.
- * @option_id: Identifier of the main option menu item under which the subitems
- * are to be set.
- * @subitems: Array of subitem information.
- *
- * Sets the items for the secondary option menu of a search bar.
- **/
void
-e_search_bar_set_viewoption_menu (ESearchBar *search_bar, GtkWidget *menu)
+e_search_bar_set_filter_value (ESearchBar *search_bar,
+ gint value)
{
+ EActionComboBox *combo_box;
- if (search_bar->viewoption_menu != NULL)
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (search_bar->viewoption));
+ g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
- search_bar->viewoption_menu = menu;
- gtk_option_menu_set_menu (GTK_OPTION_MENU (search_bar->viewoption), search_bar->viewoption_menu);
+ combo_box = E_ACTION_COMBO_BOX (search_bar->priv->filter_combo_box);
- g_signal_connect (search_bar->viewoption_menu,
- "selection-done",
- G_CALLBACK (viewitem_activated_cb),
- search_bar);
+ e_action_combo_box_set_current_value (combo_box, value);
+ g_object_notify (G_OBJECT (search_bar), "filter-value");
}
-GtkWidget *
-e_search_bar_get_selected_viewitem (ESearchBar *search_bar)
+gboolean
+e_search_bar_get_filter_visible (ESearchBar *search_bar)
{
- GtkWidget *widget = NULL;
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), FALSE);
- widget = gtk_menu_get_active (GTK_MENU (search_bar->viewoption_menu));
-
- return widget;
+ return GTK_WIDGET_VISIBLE (search_bar->priv->filter_combo_box);
}
-/**
- * e_search_bar_set_viewoption:
- * @search_bar: A search bar.
- * @option_id: Identifier of the main option menu item under which the subitems
- * are to be set.
- * @subitems: Array of subitem information.
- *
- * Sets the items for the secondary option menu of a search bar.
- **/
void
-e_search_bar_set_viewoption (ESearchBar *search_bar, int option_id, ESearchBarItem *subitems)
+e_search_bar_set_filter_visible (ESearchBar *search_bar,
+ gboolean visible)
{
- GtkWidget *menu;
- GtkWidget *menu_item;
- gint i;
-
- /* Create the menu if it is not there. right scenario ????*/
+ g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
- if (search_bar->viewoption_menu == NULL) {
- search_bar->viewoption_menu = menu = gtk_menu_new ();
+ if (visible) {
+ gtk_widget_show (search_bar->priv->filter_label);
+ gtk_widget_show (search_bar->priv->filter_combo_box);
} else {
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (search_bar->viewoption));
- search_bar->viewoption_menu = menu = gtk_menu_new ();
+ gtk_widget_hide (search_bar->priv->filter_label);
+ gtk_widget_hide (search_bar->priv->filter_combo_box);
}
- /* Create the items */
-
- for (i = 0; subitems[i].id != -1; ++i) {
- if (subitems[i].text) {
- char *str = NULL;
- str = e_str_without_underscores (subitems[i].text);
- menu_item = gtk_menu_item_new_with_label (str);
- g_free (str);
- } else {
- menu_item = gtk_menu_item_new ();
- gtk_widget_set_sensitive (menu_item, FALSE);
- }
-
- g_object_set_data (G_OBJECT (menu_item), "EsbItemId",
- GINT_TO_POINTER (subitems[i].id));
-
- g_signal_connect (menu_item,
- "activate",
- G_CALLBACK (viewitem_activated_cb),
- search_bar);
+ g_object_notify (G_OBJECT (search_bar), "filter-visible");
+}
- gtk_widget_show (menu_item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (search_bar->viewoption), menu);
+GtkRadioAction *
+e_search_bar_get_search_action (ESearchBar *search_bar)
+{
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), NULL);
+ return search_bar->priv->search_action;
}
-/**
- * e_search_bar_set_scopeoption:
- * @search_bar: A search bar.
- * are to be set.
- * @scopeitems: Array of scope information.
- *
- * Sets the items for the search scope option menu of a search bar.
- **/
void
-e_search_bar_set_scopeoption (ESearchBar *search_bar, ESearchBarItem *scopeitems)
+e_search_bar_set_search_action (ESearchBar *search_bar,
+ GtkRadioAction *action)
{
- GtkWidget *menu;
- GtkWidget *menu_item;
- gint i;
+ g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
- gtk_widget_show (search_bar->scopeoption_box);
- if (search_bar->scopeoption_menu != NULL) {
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (search_bar->scopeoption));
+ if (action != NULL) {
+ g_return_if_fail (GTK_IS_RADIO_ACTION (action));
+ g_object_ref (action);
}
- search_bar->scopeoption_menu = menu = gtk_menu_new ();
-
- /* Generate items */
- for (i = 0; scopeitems[i].id != -1; ++i) {
- if (scopeitems[i].text) {
- char *str;
- str = e_str_without_underscores (_(scopeitems[i].text));
- menu_item = gtk_menu_item_new_with_label (str);
- g_object_set_data_full (G_OBJECT (menu_item), "string",str, g_free);
- } else {
- menu_item = gtk_menu_item_new ();
- gtk_widget_set_sensitive (menu_item, FALSE);
- }
-
- g_object_set_data (G_OBJECT (menu_item), "EsbItemId",
- GINT_TO_POINTER (scopeitems[i].id));
+ search_bar->priv->search_action = action;
+ search_bar_update_search_popup (search_bar);
- g_signal_connect (menu_item,
- "activate",
- G_CALLBACK (scopeitem_activated_cb),
- search_bar);
-
- gtk_widget_show (menu_item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (search_bar->scopeoption), menu);
+ g_object_notify (G_OBJECT (search_bar), "search-action");
}
-/**
- * e_search_bar_set_scopeoption_menu:
- * @search_bar: A search bar.
- * @menu: the scope option menu
- *
- * Sets the items for the secondary option menu of a search bar.
- **/
-void
-e_search_bar_set_scopeoption_menu (ESearchBar *search_bar, GtkMenu *menu)
+const gchar *
+e_search_bar_get_search_text (ESearchBar *search_bar)
{
+ EIconEntry *icon_entry;
+ GtkWidget *entry;
+ GtkStyle *style1;
+ GtkStyle *style2;
+ GdkColor *color1;
+ GdkColor *color2;
- if (search_bar->scopeoption_menu != NULL)
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (search_bar->scopeoption));
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), NULL);
- search_bar->scopeoption_menu = GTK_WIDGET (menu);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (search_bar->scopeoption), search_bar->scopeoption_menu);
+ icon_entry = E_ICON_ENTRY (search_bar->priv->search_entry);
+ entry = e_icon_entry_get_entry (icon_entry);
- g_signal_connect (search_bar->scopeoption_menu,
- "selection-done",
- G_CALLBACK (scopeitem_activated_cb),
- search_bar);
-}
+ style1 = gtk_widget_get_style (entry);
+ style2 = gtk_widget_get_default_style ();
+
+ color1 = &style1->text[GTK_STATE_NORMAL];
+ color2 = &style2->text[GTK_STATE_INSENSITIVE];
GtkWidget *
-e_search_bar_new (ESearchBarItem *menu_items,
+e_search_bar_lite_new (ESearchBarItem *menu_items,
ESearchBarItem *option_items)
{
GtkWidget *widget;
@@ -1284,6 +1230,7 @@ e_search_bar_new (ESearchBarItem *menu_items,
g_return_val_if_fail (option_items != NULL, NULL);
widget = g_object_new (e_search_bar_get_type (), NULL);
+ E_SEARCH_BAR(widget)->lite = TRUE;
e_search_bar_construct (E_SEARCH_BAR (widget), menu_items, option_items);
@@ -1329,10 +1276,14 @@ e_search_bar_set_ui_component (ESearchBar *search_bar,
}
void
-e_search_bar_set_menu_sensitive (ESearchBar *search_bar, int id, gboolean state)
+e_search_bar_set_search_text (ESearchBar *search_bar,
+ const gchar *text)
{
- char *verb_name;
- char *path;
+ EIconEntry *icon_entry;
+ GtkWidget *entry;
+
+ if (search_bar->lite)
+ return;
if (search_bar->lite)
return;
@@ -1341,68 +1292,40 @@ e_search_bar_set_menu_sensitive (ESearchBar *search_bar, int id, gboolean state)
path = g_strconcat ("/commands/", verb_name, NULL);
g_free (verb_name);
- bonobo_ui_component_set_prop (search_bar->ui_component, path,
- "sensitive", state ? "1" : "0",
- NULL);
+ icon_entry = E_ICON_ENTRY (search_bar->priv->search_entry);
+ entry = e_icon_entry_get_entry (icon_entry);
- g_free (path);
+ text = (text != NULL) ? text : "";
+ gtk_entry_set_text (GTK_ENTRY (entry), text);
+ g_object_notify (G_OBJECT (search_bar), "search-text");
}
-GType
-e_search_bar_get_type (void)
+gint
+e_search_bar_get_search_value (ESearchBar *search_bar)
{
- static GType type = 0;
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), 0);
- if (!type) {
- static const GTypeInfo info = {
- sizeof (ESearchBarClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (ESearchBar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) init,
- };
-
- type = g_type_register_static (gtk_hbox_get_type (), "ESearchBar", &info, 0);
- }
-
- return type;
+ /* FIXME */
+ return 0;
}
void
-e_search_bar_set_viewitem_id (ESearchBar *search_bar, int id)
+e_search_bar_set_search_value (ESearchBar *search_bar,
+ gint value)
{
- int row;
-
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
if (!search_bar->viewoption_menu)
return;
- row = find_id (search_bar->viewoption_menu, id, "EsbItemId", NULL);
- if (row == -1)
- return;
- search_bar->viewitem_id = id;
- gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->viewoption), row);
+ /* FIXME */
- emit_query_changed (search_bar);
+ g_object_notify (G_OBJECT (search_bar), "search-value");
}
-/**
- * e_search_bar_set_item_id:
- * @search_bar: A search bar.
- * @id: Identifier of the item to set.
- *
- * Sets the active item in the options menu of a search bar.
- **/
-void
-e_search_bar_set_item_id (ESearchBar *search_bar, int id)
+gboolean
+e_search_bar_get_search_visible (ESearchBar *search_bar)
{
- int row;
-
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), FALSE);
if (!search_bar->option_menu)
return;
@@ -1423,217 +1346,170 @@ e_search_bar_set_item_id (ESearchBar *search_bar, int id)
}
void
-e_search_bar_set_item_menu (ESearchBar *search_bar, int id)
+e_search_bar_set_search_visible (ESearchBar *search_bar,
+ gboolean visible)
{
- int row;
- GtkWidget *item;
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
- row = find_id (search_bar->option_menu, id, "EsbItemId", &item);
- if (row == -1)
- return;
+ if (visible) {
+ gtk_widget_show (search_bar->priv->search_label);
+ gtk_widget_show (search_bar->priv->search_entry);
+ } else {
+ gtk_widget_hide (search_bar->priv->search_label);
+ gtk_widget_hide (search_bar->priv->search_entry);
+ }
- gtk_menu_set_active ((GtkMenu *)search_bar->option_menu, row);
- if (id>=0)
- gtk_check_menu_item_set_active ((GtkCheckMenuItem *)item, TRUE);
+ g_object_notify (G_OBJECT (search_bar), "search-visible");
}
-/**
- * e_search_bar_set_search_scope:
- * @search_bar: A search bar.
- * @id: Identifier of the item to set.
- *
- * Sets the active item in the options menu of a search bar.
- **/
-void
-e_search_bar_set_search_scope (ESearchBar *search_bar, int id)
+GtkRadioAction *
+e_search_bar_get_scope_action (ESearchBar *search_bar)
{
- int row;
+ EActionComboBox *combo_box;
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
-
- row = find_id (search_bar->scopeoption_menu, id, "EsbItemId", NULL);
- if (row == -1)
- return;
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), NULL);
- search_bar->scopeitem_id = id;
- gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->scopeoption), row);
+ combo_box = E_ACTION_COMBO_BOX (search_bar->priv->scope_combo_box);
- if (!search_bar->block_search)
- emit_query_changed (search_bar);
+ return e_action_combo_box_get_action (combo_box);
}
-
-/**
- * e_search_bar_get_item_id:
- * @search_bar: A search bar.
- *
- * Queries the currently selected item in the options menu of a search bar.
- *
- * Return value: Identifier of the selected item in the options menu.
- **/
-int
-e_search_bar_get_item_id (ESearchBar *search_bar)
+void
+e_search_bar_set_scope_action (ESearchBar *search_bar,
+ GtkRadioAction *action)
{
- GtkWidget *menu_item;
- gint item_id;
+ EActionComboBox *combo_box;
- g_return_val_if_fail (search_bar != NULL, -1);
- g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), -1);
+ g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
+ g_return_if_fail (GTK_IS_RADIO_ACTION (action));
- menu_item = gtk_menu_get_active (GTK_MENU (search_bar->option_menu));
- item_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "EsbItemId"));
- search_bar->item_id = item_id;
+ combo_box = E_ACTION_COMBO_BOX (search_bar->priv->scope_combo_box);
- return search_bar->item_id;
+ e_action_combo_box_set_action (combo_box, action);
+ g_object_notify (G_OBJECT (search_bar), "scope-action");
}
-/**
- * e_search_bar_get_search_scope:
- * @search_bar: A search bar.
- *
- * Queries the currently selected search type in the options menu of a search bar.
- *
- * Return value: Identifier of the selected item in the options menu.
- **/
-int
-e_search_bar_get_search_scope (ESearchBar *search_bar)
+gint
+e_search_bar_get_scope_value (ESearchBar *search_bar)
{
- GtkWidget *menu_item;
- gint scopeitem_id;
+ EActionComboBox *combo_box;
- g_return_val_if_fail (search_bar != NULL, -1);
- g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), -1);
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), 0);
- menu_item = gtk_menu_get_active (GTK_MENU (search_bar->scopeoption_menu));
- scopeitem_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "EsbItemId"));
+ combo_box = E_ACTION_COMBO_BOX (search_bar->priv->scope_combo_box);
- search_bar->scopeitem_id = scopeitem_id;
-
- return search_bar->scopeitem_id;
+ return e_action_combo_box_get_current_value (combo_box);
}
-/**
- * e_search_bar_get_viewitem_id:
- * @search_bar: A search bar.
- *
- * Queries the currently selected item in the viewoptions menu of a search bar.
- *
- * Return value: Identifier of the selected item in the viewoptions menu.
- * If the search bar currently contains an entry rather than a a viewoption menu,
- * a value less than zero is returned.
- **/
-int
-e_search_bar_get_viewitem_id (ESearchBar *search_bar)
+void
+e_search_bar_set_scope_value (ESearchBar *search_bar,
+ gint value)
{
- GtkWidget *menu_item;
- gint viewitem_id;
+ EActionComboBox *combo_box;
- g_return_val_if_fail (search_bar != NULL, -1);
- g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), -1);
+ g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
- if (!search_bar->viewoption_menu)
- return -1;
+ combo_box = E_ACTION_COMBO_BOX (search_bar->priv->scope_combo_box);
- menu_item = gtk_menu_get_active (GTK_MENU (search_bar->viewoption_menu));
- viewitem_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "EsbItemId"));
+ e_action_combo_box_set_current_value (combo_box, value);
+ g_object_notify (G_OBJECT (search_bar), "scope-value");
+}
- search_bar->viewitem_id = viewitem_id;
+gboolean
+e_search_bar_get_scope_visible (ESearchBar *search_bar)
+{
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), FALSE);
- return search_bar->viewitem_id;
+ return GTK_WIDGET_VISIBLE (search_bar->priv->scope_combo_box);
}
-/**
- * e_search_bar_set_ids:
- * @search_bar: A search bar.
- * @item_id: Identifier of the item to set.
- * @subitem_id: Identifier of the subitem to set.
- *
- * Sets the item and subitem ids for a search bar. This is intended to switch
- * to an item that has subitems.
- **/
void
-e_search_bar_set_ids (ESearchBar *search_bar, int item_id, int subitem_id)
+e_search_bar_set_scope_visible (ESearchBar *search_bar,
+ gboolean visible)
{
- int item_row;
- GtkWidget *item_widget;
-
- g_return_if_fail (search_bar != NULL);
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
- item_row = find_id (search_bar->option_menu, item_id, "EsbChoiceId", &item_widget);
- if (item_row == -1 || !item_widget)
- return;
-
- search_bar->item_id = item_id;
- gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->option), item_row);
+ if (visible) {
+ gtk_widget_show (search_bar->priv->scope_label);
+ gtk_widget_show (search_bar->priv->scope_combo_box);
+ } else {
+ gtk_widget_hide (search_bar->priv->scope_label);
+ gtk_widget_hide (search_bar->priv->scope_combo_box);
+ }
+ g_object_notify (G_OBJECT (search_bar), "scope-visible");
}
-/**
- * e_search_bar_set_text:
- * @search_bar: A search bar.
- * @text: Text to set in the search bar's entry line.
- *
- * Sets the text string inside the entry line of a search bar.
- **/
-void
-e_search_bar_set_text (ESearchBar *search_bar, const char *text)
+static void
+search_bar_rule_changed_cb (FilterRule *rule,
+ GtkDialog *dialog)
{
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
- gtk_entry_set_text (GTK_ENTRY (search_bar->entry), text);
+ /* FIXME Think this does something with sensitivity. */
}
-/**
- * e_search_bar_get_text:
- * @search_bar: A search bar.
- *
- * Queries the text of the entry line in a search bar.
- *
- * Return value: The text string that is in the entry line of the search bar.
- * This must be freed using g_free(). If a suboption menu is active instead
- * of an entry, NULL is returned.
- **/
-char *
-e_search_bar_get_text (ESearchBar *search_bar)
+void
+e_search_bar_save_search_dialog (ESearchBar *search_bar,
+ const gchar *filename)
{
- GtkStyle *entry_style, *default_style;
-
- g_return_val_if_fail (search_bar != NULL, NULL);
- g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), NULL);
-
- entry_style = gtk_widget_get_style (search_bar->entry);
- default_style = gtk_widget_get_default_style ();
-
- if (gdk_color_equal (&(entry_style->text[GTK_STATE_NORMAL]), &(default_style->text[GTK_STATE_INSENSITIVE])))
- return g_strdup ("");
-
- return g_strdup (gtk_entry_get_text (GTK_ENTRY (search_bar->entry)));
-}
+ RuleContext *context;
+ FilterRule *rule;
+ GtkWidget *dialog;
+ GtkWidget *parent;
+ GtkWidget *widget;
+ const gchar *search_text;
+ gchar *rule_name;
-void e_search_bar_scope_enable (ESearchBar *esb, int did, gboolean state)
-{
- GtkWidget *widget=NULL;
- GList *l ;
- int id;
- gpointer *pointer;
-
- g_return_if_fail (esb != NULL);
- g_return_if_fail (E_IS_SEARCH_BAR (esb));
-
- l = GTK_MENU_SHELL (esb->scopeoption_menu)->children;
- while (l) {
- pointer = g_object_get_data (l->data, "EsbItemId");
- if (pointer) {
- id = GPOINTER_TO_INT (pointer);
- if (id == did) {
- widget = l->data;
- break;
- }
+ g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
+ g_return_if_fail (filename != NULL);
+
+ g_return_if_fail (search_bar->priv->current_query != NULL);
+
+ rule = filter_rule_clone (search_bar->priv->current_query);
+ search_text = e_search_bar_get_search_text (search_bar);
+ if (search_text == NULL || *search_text == '\0')
+ search_text = "''";
+
+ rule_name = g_strdup_printf ("%s %s", rule->name, search_text);
+ filter_rule_set_name (rule, rule_name);
+ g_free (rule_name);
+
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (search_bar));
+
+ dialog = gtk_dialog_new_with_buttons (
+ _("Save Search"), GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+
+ gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300);
+ gtk_container_set_border_width (
+ GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0);
+ gtk_container_set_border_width (
+ GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
+
+ context = search_bar->priv->context;
+ widget = filter_rule_get_widget (rule, context);
+ filter_rule_set_source (rule, FILTER_SOURCE_INCOMING);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
+ gtk_box_pack_start (
+ GTK_BOX (GTK_DIALOG (dialog)->vbox),
+ widget, TRUE, TRUE, 0);
+
+ g_signal_connect (
+ rule, "changed",
+ G_CALLBACK (search_bar_rule_changed_cb),
+ dialog);
+
+ search_bar_rule_changed_cb (rule, GTK_DIALOG (dialog));
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
+ if (filter_rule_validate (rule)) {
+ rule_context_add_rule (context, rule);
+ rule_context_save (context, filename);
}
- l = l->next;
}
- if (widget)
- gtk_widget_set_sensitive (widget, state);
+ gtk_widget_destroy (dialog);
}
diff --git a/widgets/misc/e-search-bar.h b/widgets/misc/e-search-bar.h
index fd91068ebd..aadfc42ab5 100644
--- a/widgets/misc/e-search-bar.h
+++ b/widgets/misc/e-search-bar.h
@@ -1,71 +1,60 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* e-search-bar.h
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ * Author: Chris Lahey <clahey@ximian.com>
+ *
+ * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ * General Public License for more details.
*
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
-#ifndef __E_SEARCH_BAR_H__
-#define __E_SEARCH_BAR_H__
+#ifndef E_SEARCH_BAR_H
+#define E_SEARCH_BAR_H
#include <gtk/gtk.h>
-
-#include <bonobo/bonobo-ui-component.h>
+#include <filter/rule-context.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SEARCH_BAR \
+ (e_search_bar_get_type ())
+#define E_SEARCH_BAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SEARCH_BAR, ESearchBar))
+#define E_SEARCH_BAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SEARCH_BAR, ESearchBarClass))
+#define E_IS_SEARCH_BAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SEARCH_BAR))
+#define E_IS_SEARCH_BAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SEARCH_BAR))
+#define E_SEARCH_BAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SEARCH_BAR, ESearchBarClass))
+
+/* Action Names */
+#define E_SEARCH_BAR_ACTION_CLEAR "search-clear"
+#define E_SEARCH_BAR_ACTION_FIND "search-find"
+#define E_SEARCH_BAR_ACTION_TYPE "search-type"
G_BEGIN_DECLS
-/* ESearchBar - A card displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * ---------------------------------------------------------------------------------
- * item_id int RW Which option item is currently selected.
- * subitem_id int RW Which option subitem is currently selected.
- * text string RW Text in the entry box.
- */
-
-#define E_SEARCH_BAR_TYPE (e_search_bar_get_type ())
-#define E_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_SEARCH_BAR_TYPE, ESearchBar))
-#define E_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_SEARCH_BAR_TYPE, ESearchBarClass))
-#define E_IS_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_SEARCH_BAR_TYPE))
-#define E_IS_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_SEARCH_BAR_TYPE))
-
-enum _ESearchBarItemType {
- ESB_ITEMTYPE_NORMAL,
- ESB_ITEMTYPE_CHECK,
- ESB_ITEMTYPE_RADIO
-};
-typedef enum _ESearchBarItemType ESearchBarItemType;
-
-typedef struct {
- gchar *text;
- gint id;
- gint type;
-} ESearchBarItem;
-
-typedef struct _ESearchBar ESearchBar;
-typedef struct _ESearchBarClass ESearchBarClass;
+typedef struct _ESearchBar ESearchBar;
+typedef struct _ESearchBarClass ESearchBarClass;
+typedef struct _ESearchBarPrivate ESearchBarPrivate;
-typedef void (*ESearchBarMenuFunc)(ESearchBar *esb, ESearchBarItem *menu_items);
-
-struct _ESearchBar
-{
+struct _ESearchBar {
GtkHBox parent;
BonoboUIComponent *ui_component;
@@ -108,23 +97,8 @@ struct _ESearchBar
gboolean lite;
};
-struct _ESearchBarClass
-{
+struct _ESearchBarClass {
GtkHBoxClass parent_class;
-
- void (*set_menu) (ESearchBar *, ESearchBarItem *);
- void (*set_option) (ESearchBar *, ESearchBarItem *);
-
- /* signals */
- void (*search_activated) (ESearchBar *search);
- void (*search_cleared) (ESearchBar *search);
- void (*query_changed) (ESearchBar *search);
- void (*menu_activated) (ESearchBar *search, int item);
-};
-
-enum {
- E_SEARCHBAR_FIND_NOW_ID = -1,
- E_SEARCHBAR_CLEAR_ID = -2
};
@@ -162,33 +136,6 @@ void e_search_bar_set_item_menu (ESearchBar *search_bar,
int id);
int e_search_bar_get_item_id (ESearchBar *search_bar);
-int e_search_bar_get_viewitem_id (ESearchBar *search_bar);
-
-void e_search_bar_set_viewitem_id (ESearchBar *search_bar, int id);
-
-void e_search_bar_set_ids (ESearchBar *search_bar,
- int item_id,
- int subitem_id);
-
-void e_search_bar_set_scopeoption (ESearchBar *search_bar, ESearchBarItem *scopeitems);
-
-void e_search_bar_set_scopeoption_menu (ESearchBar *search_bar, GtkMenu *menu);
-
-void e_search_bar_set_search_scope (ESearchBar *search_bar, int id);
-
-void e_search_bar_set_viewoption_menu (ESearchBar *search_bar, GtkWidget *menu);
-
-void e_search_bar_set_viewoption_menufunc (ESearchBar *search_bar, ESearchBarMenuFunc *menu_gen_func, void *data);
-
-GtkWidget *e_search_bar_get_selected_viewitem (ESearchBar *search_bar);
-
-int e_search_bar_get_search_scope (ESearchBar *search_bar);
-
-void e_search_bar_set_text (ESearchBar *search_bar,
- const char *text);
-char *e_search_bar_get_text (ESearchBar *search_bar);
-void e_search_bar_scope_enable (ESearchBar *search_bar, int did, gboolean state);
G_END_DECLS
-
-#endif /* __E_SEARCH_BAR_H__ */
+#endif /* E_SEARCH_BAR_H */
diff --git a/widgets/misc/e-signature-combo-box.c b/widgets/misc/e-signature-combo-box.c
index cb11ba632f..d447cccb8e 100644
--- a/widgets/misc/e-signature-combo-box.c
+++ b/widgets/misc/e-signature-combo-box.c
@@ -1,4 +1,5 @@
/*
+ * e-signature-combo-box.c
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/widgets/misc/e-signature-combo-box.h b/widgets/misc/e-signature-combo-box.h
index fac47518e1..dd81eb55c3 100644
--- a/widgets/misc/e-signature-combo-box.h
+++ b/widgets/misc/e-signature-combo-box.h
@@ -1,4 +1,5 @@
/*
+ * e-signature-combo-box.h
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/mail/mail-signature-editor.c b/widgets/misc/e-signature-editor.c
index 401f26feed..53cb34906b 100644
--- a/mail/mail-signature-editor.c
+++ b/widgets/misc/e-signature-editor.c
@@ -1,4 +1,6 @@
/*
+ * e-signature-editor.c
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,24 +15,17 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Radek Doulik <rodo@ximian.com>
- * Jeffrey Stedfast <fejj@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#include "mail-signature-editor.h"
+#include "e-signature-editor.h"
#include <string.h>
#include <glib/gi18n.h>
#include <e-util/e-error.h>
-#include <e-util/e-signature-list.h>
-#include <composer/e-msg-composer.h>
-
-#include "mail-config.h"
+#include <e-util/e-signature-utils.h>
#define E_SIGNATURE_EDITOR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -128,9 +123,15 @@ action_save_and_close_cb (GtkAction *action,
entry = editor->priv->entry;
html = gtkhtml_editor_get_html_mode (GTKHTML_EDITOR (editor));
- if (editor->priv->signature == NULL)
- signature = mail_config_signature_new (NULL, FALSE, html);
- else {
+ if (editor->priv->signature == NULL) {
+ signature = e_signature_new ();
+ signature->name = g_strdup (_("Unnamed"));
+ signature->script = FALSE;
+ signature->html = html;
+
+ /* FIXME Pass a GError and deal with it. */
+ signature->filename = e_create_signature_file (NULL);
+ } else {
signature = g_object_ref (editor->priv->signature);
signature->html = html;
}
@@ -147,7 +148,7 @@ action_save_and_close_cb (GtkAction *action,
return;
}
- signature_list = mail_config_get_signatures ();
+ signature_list = e_get_signature_list ();
signature_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
g_strstrip (signature_name);
@@ -182,7 +183,8 @@ action_save_and_close_cb (GtkAction *action,
if (editor->priv->signature != NULL)
e_signature_list_change (signature_list, signature);
else
- mail_config_add_signature (signature);
+ e_signature_list_add (signature_list, signature);
+ e_signature_list_save (signature_list);
gtk_widget_destroy (GTK_WIDGET (editor));
}
@@ -454,8 +456,11 @@ e_signature_editor_set_signature (ESignatureEditor *editor,
else {
gchar *data;
- data = e_msg_composer_get_sig_file_content (filename, FALSE);
- contents = g_strdup_printf ("<PRE>\n%s", data);
+ data = e_read_signature_file (signature, FALSE, &error);
+ if (data != NULL)
+ contents = g_strdup_printf ("<PRE>\n%s", data);
+ else
+ contents = NULL;
length = -1;
g_free (data);
}
diff --git a/mail/mail-signature-editor.h b/widgets/misc/e-signature-editor.h
index 82c786c90e..1e8b88a909 100644
--- a/mail/mail-signature-editor.h
+++ b/widgets/misc/e-signature-editor.h
@@ -1,4 +1,5 @@
/*
+ * e-signature-editor.h
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -14,15 +15,12 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Radek Doulik <rodo@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#ifndef MAIL_SIGNATURE_EDITOR_H
-#define MAIL_SIGNATURE_EDITOR_H
+#ifndef E_SIGNATURE_EDITOR_H
+#define E_SIGNATURE_EDITOR_H
#include <gtkhtml-editor.h>
#include <e-util/e-signature.h>
@@ -69,4 +67,4 @@ void e_signature_editor_set_signature (ESignatureEditor *editor,
G_END_DECLS
-#endif /* MAIL_SIGNATURE_EDITOR_H */
+#endif /* E_SIGNATURE_EDITOR_H */
diff --git a/widgets/misc/e-signature-manager.c b/widgets/misc/e-signature-manager.c
new file mode 100644
index 0000000000..a70bc1dc60
--- /dev/null
+++ b/widgets/misc/e-signature-manager.c
@@ -0,0 +1,746 @@
+/*
+ * e-signature-manager.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-signature-manager.h"
+
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gdk/gdkkeysyms.h>
+#include "e-util/e-binding.h"
+#include "e-signature-tree-view.h"
+#include "e-signature-script-dialog.h"
+
+#define E_SIGNATURE_MANAGER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SIGNATURE_MANAGER, ESignatureManagerPrivate))
+
+struct _ESignatureManagerPrivate {
+ ESignatureList *signature_list;
+
+ GtkWidget *tree_view;
+ GtkWidget *add_button;
+ GtkWidget *add_script_button;
+ GtkWidget *edit_button;
+ GtkWidget *remove_button;
+
+ guint allow_scripts : 1;
+ guint prefer_html : 1;
+};
+
+enum {
+ PROP_0,
+ PROP_ALLOW_SCRIPTS,
+ PROP_PREFER_HTML,
+ PROP_SIGNATURE_LIST
+};
+
+enum {
+ ADD_SIGNATURE,
+ ADD_SIGNATURE_SCRIPT,
+ EDITOR_CREATED,
+ EDIT_SIGNATURE,
+ REMOVE_SIGNATURE,
+ LAST_SIGNAL
+};
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+
+static void
+signature_manager_emit_editor_created (ESignatureManager *manager,
+ GtkWidget *editor)
+{
+ g_return_if_fail (E_IS_SIGNATURE_EDITOR (editor));
+
+ g_signal_emit (manager, signals[EDITOR_CREATED], 0, editor);
+}
+
+static gboolean
+signature_manager_key_press_event_cb (ESignatureManager *manager,
+ GdkEventKey *event)
+{
+ if (event->keyval == GDK_Delete) {
+ e_signature_manager_remove_signature (manager);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+signature_manager_run_script_dialog (ESignatureManager *manager,
+ ESignature *signature,
+ const gchar *title)
+{
+ GtkWidget *dialog;
+ GFile *script_file;
+ const gchar *script_name;
+ gboolean success = FALSE;
+ gpointer parent;
+
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+ parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
+ dialog = e_signature_script_dialog_new (parent);
+ gtk_window_set_title (GTK_WINDOW (dialog), title);
+
+ if (signature->filename != NULL && signature->name != NULL) {
+
+ script_file = g_file_new_for_path (signature->filename);
+ script_name = signature->name;
+
+ e_signature_script_dialog_set_script_file (
+ E_SIGNATURE_SCRIPT_DIALOG (dialog), script_file);
+ e_signature_script_dialog_set_script_name (
+ E_SIGNATURE_SCRIPT_DIALOG (dialog), script_name);
+
+ g_object_unref (script_file);
+ }
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+ goto exit;
+
+ script_file = e_signature_script_dialog_get_script_file (
+ E_SIGNATURE_SCRIPT_DIALOG (dialog));
+ script_name = e_signature_script_dialog_get_script_name (
+ E_SIGNATURE_SCRIPT_DIALOG (dialog));
+
+ g_free (signature->filename);
+ signature->filename = g_file_get_path (script_file);
+
+ g_free (signature->name);
+ signature->name = g_strdup (script_name);
+
+ g_object_unref (script_file);
+
+ success = TRUE;
+
+exit:
+ gtk_widget_destroy (dialog);
+
+ return success;
+}
+
+static void
+signature_manager_selection_changed_cb (ESignatureManager *manager,
+ GtkTreeSelection *selection)
+{
+ ESignatureTreeView *tree_view;
+ ESignature *signature;
+ GtkWidget *edit_button;
+ GtkWidget *remove_button;
+ gboolean sensitive;
+
+ edit_button = manager->priv->edit_button;
+ remove_button = manager->priv->remove_button;
+
+ tree_view = e_signature_manager_get_tree_view (manager);
+ signature = e_signature_tree_view_get_selected (tree_view);
+ sensitive = (signature != NULL);
+
+ gtk_widget_set_sensitive (edit_button, sensitive);
+ gtk_widget_set_sensitive (remove_button, sensitive);
+}
+
+static void
+signature_manager_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ALLOW_SCRIPTS:
+ e_signature_manager_set_allow_scripts (
+ E_SIGNATURE_MANAGER (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_PREFER_HTML:
+ e_signature_manager_set_prefer_html (
+ E_SIGNATURE_MANAGER (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_SIGNATURE_LIST:
+ e_signature_manager_set_signature_list (
+ E_SIGNATURE_MANAGER (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+signature_manager_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ALLOW_SCRIPTS:
+ g_value_set_boolean (
+ value,
+ e_signature_manager_get_allow_scripts (
+ E_SIGNATURE_MANAGER (object)));
+ return;
+
+ case PROP_PREFER_HTML:
+ g_value_set_boolean (
+ value,
+ e_signature_manager_get_prefer_html (
+ E_SIGNATURE_MANAGER (object)));
+ return;
+
+ case PROP_SIGNATURE_LIST:
+ g_value_set_object (
+ value,
+ e_signature_manager_get_signature_list (
+ E_SIGNATURE_MANAGER (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+signature_manager_dispose (GObject *object)
+{
+ ESignatureManagerPrivate *priv;
+
+ priv = E_SIGNATURE_MANAGER_GET_PRIVATE (object);
+
+ if (priv->signature_list != NULL) {
+ g_object_unref (priv->signature_list);
+ priv->signature_list = NULL;
+ }
+
+ if (priv->tree_view != NULL) {
+ g_object_unref (priv->tree_view);
+ priv->tree_view = NULL;
+ }
+
+ if (priv->add_button != NULL) {
+ g_object_unref (priv->add_button);
+ priv->add_button = NULL;
+ }
+
+ if (priv->add_script_button != NULL) {
+ g_object_unref (priv->add_script_button);
+ priv->add_script_button = NULL;
+ }
+
+ if (priv->edit_button != NULL) {
+ g_object_unref (priv->edit_button);
+ priv->edit_button = NULL;
+ }
+
+ if (priv->remove_button != NULL) {
+ g_object_unref (priv->remove_button);
+ priv->remove_button = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+signature_manager_add_signature (ESignatureManager *manager)
+{
+ ESignatureTreeView *tree_view;
+ GtkWidget *editor;
+
+ tree_view = e_signature_manager_get_tree_view (manager);
+
+ editor = e_signature_editor_new ();
+ gtkhtml_editor_set_html_mode (
+ GTKHTML_EDITOR (editor), manager->priv->prefer_html);
+ signature_manager_emit_editor_created (manager, editor);
+
+ gtk_widget_grab_focus (GTK_WIDGET (tree_view));
+}
+
+static void
+signature_manager_add_signature_script (ESignatureManager *manager)
+{
+ ESignatureTreeView *tree_view;
+ ESignatureList *signature_list;
+ ESignature *signature;
+ const gchar *title;
+
+ title = _("Add Signature Script");
+ tree_view = e_signature_manager_get_tree_view (manager);
+ signature_list = e_signature_manager_get_signature_list (manager);
+
+ signature = e_signature_new ();
+ signature->script = TRUE;
+ signature->html = TRUE;
+
+ if (signature_manager_run_script_dialog (manager, signature, title))
+ e_signature_list_add (signature_list, signature);
+
+ e_signature_list_save (signature_list);
+ g_object_unref (signature);
+
+ gtk_widget_grab_focus (GTK_WIDGET (tree_view));
+}
+
+static void
+signature_manager_editor_created (ESignatureManager *manager,
+ ESignatureEditor *editor)
+{
+ GtkWindowPosition position;
+ gpointer parent;
+
+ position = GTK_WIN_POS_CENTER_ON_PARENT;
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+ parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
+ gtk_window_set_transient_for (GTK_WINDOW (editor), parent);
+ gtk_window_set_position (GTK_WINDOW (editor), position);
+ gtk_widget_show (GTK_WIDGET (editor));
+}
+
+static void
+signature_manager_edit_signature (ESignatureManager *manager)
+{
+ ESignatureTreeView *tree_view;
+ ESignatureList *signature_list;
+ ESignature *signature;
+ GtkWidget *editor;
+ const gchar *title;
+ gchar *filename;
+
+ tree_view = e_signature_manager_get_tree_view (manager);
+ signature = e_signature_tree_view_get_selected (tree_view);
+ signature_list = e_signature_manager_get_signature_list (manager);
+
+ if (signature == NULL)
+ return;
+
+ if (signature->script)
+ goto script;
+
+ filename = signature->filename;
+ if (filename == NULL || *filename == '\0') {
+ g_free (filename);
+ filename = g_strdup (_("Unnamed"));
+ signature->filename = filename;
+ }
+
+ editor = e_signature_editor_new ();
+ e_signature_editor_set_signature (
+ E_SIGNATURE_EDITOR (editor), signature);
+ signature_manager_emit_editor_created (manager, editor);
+
+ goto exit;
+
+script:
+ title = _("Edit Signature Script");
+
+ if (signature_manager_run_script_dialog (manager, signature, title))
+ e_signature_list_change (signature_list, signature);
+
+ e_signature_list_save (signature_list);
+
+exit:
+ gtk_widget_grab_focus (GTK_WIDGET (tree_view));
+
+ g_object_unref (signature);
+}
+
+static void
+signature_manager_remove_signature (ESignatureManager *manager)
+{
+ ESignatureTreeView *tree_view;
+ ESignatureList *signature_list;
+ ESignature *signature;
+
+ tree_view = e_signature_manager_get_tree_view (manager);
+ signature = e_signature_tree_view_get_selected (tree_view);
+ signature_list = e_signature_tree_view_get_signature_list (tree_view);
+
+ if (signature == NULL)
+ return;
+
+ if (signature->filename != NULL && !signature->script)
+ g_unlink (signature->filename);
+
+ e_signature_list_remove (signature_list, signature);
+ e_signature_list_save (signature_list);
+
+ gtk_widget_grab_focus (GTK_WIDGET (tree_view));
+}
+
+static void
+signature_manager_class_init (ESignatureManagerClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ESignatureManagerPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = signature_manager_set_property;
+ object_class->get_property = signature_manager_get_property;
+ object_class->dispose = signature_manager_dispose;
+
+ class->add_signature = signature_manager_add_signature;
+ class->add_signature_script = signature_manager_add_signature_script;
+ class->editor_created = signature_manager_editor_created;
+ class->edit_signature = signature_manager_edit_signature;
+ class->remove_signature = signature_manager_remove_signature;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ALLOW_SCRIPTS,
+ g_param_spec_boolean (
+ "allow-scripts",
+ "Allow Scripts",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PREFER_HTML,
+ g_param_spec_boolean (
+ "prefer-html",
+ "Prefer HTML",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SIGNATURE_LIST,
+ g_param_spec_object (
+ "signature-list",
+ "Signature List",
+ NULL,
+ E_TYPE_SIGNATURE_LIST,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ signals[ADD_SIGNATURE] = g_signal_new (
+ "add-signature",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ESignatureManagerClass, add_signature),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[ADD_SIGNATURE_SCRIPT] = g_signal_new (
+ "add-signature-script",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ESignatureManagerClass, add_signature_script),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[EDITOR_CREATED] = g_signal_new (
+ "editor-created",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ESignatureManagerClass, editor_created),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_SIGNATURE_EDITOR);
+
+ signals[EDIT_SIGNATURE] = g_signal_new (
+ "edit-signature",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ESignatureManagerClass, edit_signature),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[REMOVE_SIGNATURE] = g_signal_new (
+ "remove-signature",
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ESignatureManagerClass, remove_signature),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void
+signature_manager_init (ESignatureManager *manager)
+{
+ GtkTreeSelection *selection;
+ GtkWidget *container;
+ GtkWidget *widget;
+
+ manager->priv = E_SIGNATURE_MANAGER_GET_PRIVATE (manager);
+
+ gtk_table_resize (GTK_TABLE (manager), 1, 2);
+ gtk_table_set_col_spacings (GTK_TABLE (manager), 6);
+ gtk_table_set_row_spacings (GTK_TABLE (manager), 12);
+
+ container = GTK_WIDGET (manager);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_table_attach (
+ GTK_TABLE (container), widget, 0, 1, 0, 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = e_signature_tree_view_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ manager->priv->tree_view = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ e_mutual_binding_new (
+ G_OBJECT (manager), "signature-list",
+ G_OBJECT (widget), "signature-list");
+
+ g_signal_connect_swapped (
+ widget, "key-press-event",
+ G_CALLBACK (signature_manager_key_press_event_cb),
+ manager);
+
+ g_signal_connect_swapped (
+ widget, "row-activated",
+ G_CALLBACK (e_signature_manager_edit_signature),
+ manager);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+
+ g_signal_connect_swapped (
+ selection, "changed",
+ G_CALLBACK (signature_manager_selection_changed_cb),
+ manager);
+
+ container = GTK_WIDGET (manager);
+
+ widget = gtk_vbutton_box_new ();
+ gtk_button_box_set_layout (
+ GTK_BUTTON_BOX (widget), GTK_BUTTONBOX_START);
+ gtk_box_set_spacing (GTK_BOX (widget), 6);
+ gtk_table_attach (
+ GTK_TABLE (container), widget,
+ 1, 2, 0, 2, 0, GTK_FILL, 0, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_ADD);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ manager->priv->add_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (e_signature_manager_add_signature),
+ manager);
+
+ widget = gtk_button_new_with_mnemonic (_("Add _Script"));
+ gtk_button_set_image (
+ GTK_BUTTON (widget), gtk_image_new_from_stock (
+ GTK_STOCK_EXECUTE, GTK_ICON_SIZE_BUTTON));
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ manager->priv->add_script_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ e_binding_new (
+ G_OBJECT (manager), "allow-scripts",
+ G_OBJECT (widget), "sensitive");
+
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (e_signature_manager_add_signature_script),
+ manager);
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_EDIT);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ manager->priv->edit_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (e_signature_manager_edit_signature),
+ manager);
+
+ widget = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ manager->priv->remove_button = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (e_signature_manager_remove_signature),
+ manager);
+}
+
+GType
+e_signature_manager_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ESignatureManagerClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) signature_manager_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_init */
+ sizeof (ESignatureManager),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) signature_manager_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_TABLE, "ESignatureManager", &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_signature_manager_new (ESignatureList *signature_list)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE_LIST (signature_list), NULL);
+
+ return g_object_new (
+ E_TYPE_SIGNATURE_MANAGER,
+ "signature-list", signature_list, NULL);
+}
+
+void
+e_signature_manager_add_signature (ESignatureManager *manager)
+{
+ g_return_if_fail (E_IS_SIGNATURE_MANAGER (manager));
+
+ g_signal_emit (manager, signals[ADD_SIGNATURE], 0);
+}
+
+void
+e_signature_manager_add_signature_script (ESignatureManager *manager)
+{
+ g_return_if_fail (E_IS_SIGNATURE_MANAGER (manager));
+
+ g_signal_emit (manager, signals[ADD_SIGNATURE_SCRIPT], 0);
+}
+
+void
+e_signature_manager_edit_signature (ESignatureManager *manager)
+{
+ g_return_if_fail (E_IS_SIGNATURE_MANAGER (manager));
+
+ g_signal_emit (manager, signals[EDIT_SIGNATURE], 0);
+}
+
+void
+e_signature_manager_remove_signature (ESignatureManager *manager)
+{
+ g_return_if_fail (E_IS_SIGNATURE_MANAGER (manager));
+
+ g_signal_emit (manager, signals[REMOVE_SIGNATURE], 0);
+}
+
+gboolean
+e_signature_manager_get_allow_scripts (ESignatureManager *manager)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE_MANAGER (manager), FALSE);
+
+ return manager->priv->allow_scripts;
+}
+
+void
+e_signature_manager_set_allow_scripts (ESignatureManager *manager,
+ gboolean allow_scripts)
+{
+ g_return_if_fail (E_IS_SIGNATURE_MANAGER (manager));
+
+ manager->priv->allow_scripts = allow_scripts;
+
+ g_object_notify (G_OBJECT (manager), "allow-scripts");
+}
+
+gboolean
+e_signature_manager_get_prefer_html (ESignatureManager *manager)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE_MANAGER (manager), FALSE);
+
+ return manager->priv->prefer_html;
+}
+
+void
+e_signature_manager_set_prefer_html (ESignatureManager *manager,
+ gboolean prefer_html)
+{
+ g_return_if_fail (E_IS_SIGNATURE_MANAGER (manager));
+
+ manager->priv->prefer_html = prefer_html;
+
+ g_object_notify (G_OBJECT (manager), "prefer-html");
+}
+
+ESignatureList *
+e_signature_manager_get_signature_list (ESignatureManager *manager)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE_MANAGER (manager), NULL);
+
+ return manager->priv->signature_list;
+}
+
+void
+e_signature_manager_set_signature_list (ESignatureManager *manager,
+ ESignatureList *signature_list)
+{
+ g_return_if_fail (E_IS_SIGNATURE_MANAGER (manager));
+
+ if (signature_list != NULL) {
+ g_return_if_fail (E_IS_SIGNATURE_LIST (signature_list));
+ g_object_ref (signature_list);
+ }
+
+ if (manager->priv->signature_list != NULL)
+ g_object_unref (manager->priv->signature_list);
+
+ manager->priv->signature_list = signature_list;
+
+ g_object_notify (G_OBJECT (manager), "signature-list");
+}
+
+ESignatureTreeView *
+e_signature_manager_get_tree_view (ESignatureManager *manager)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE_MANAGER (manager), NULL);
+
+ return E_SIGNATURE_TREE_VIEW (manager->priv->tree_view);
+}
diff --git a/widgets/misc/e-signature-manager.h b/widgets/misc/e-signature-manager.h
new file mode 100644
index 0000000000..662836e4ef
--- /dev/null
+++ b/widgets/misc/e-signature-manager.h
@@ -0,0 +1,100 @@
+/*
+ * e-signature-manager.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_SIGNATURE_MANAGER_H
+#define E_SIGNATURE_MANAGER_H
+
+#include <gtk/gtk.h>
+#include <e-util/e-signature-list.h>
+#include <misc/e-signature-editor.h>
+#include <misc/e-signature-tree-view.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SIGNATURE_MANAGER \
+ (e_signature_manager_get_type ())
+#define E_SIGNATURE_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SIGNATURE_MANAGER, ESignatureManager))
+#define E_SIGNATURE_MANAGER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SIGNATURE_MANAGER, ESignatureManagerClass))
+#define E_IS_SIGNATURE_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SIGNATURE_MANAGER))
+#define E_IS_SIGNATURE_MANAGER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SIGNATURE_MANAGER))
+#define E_SIGNATURE_MANAGER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SIGNATURE_MANAGER, ESignatureManagerClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ESignatureManager ESignatureManager;
+typedef struct _ESignatureManagerClass ESignatureManagerClass;
+typedef struct _ESignatureManagerPrivate ESignatureManagerPrivate;
+
+struct _ESignatureManager {
+ GtkTable parent;
+ ESignatureManagerPrivate *priv;
+};
+
+struct _ESignatureManagerClass {
+ GtkTableClass parent_class;
+
+ void (*add_signature) (ESignatureManager *manager);
+ void (*add_signature_script) (ESignatureManager *manager);
+ void (*editor_created) (ESignatureManager *manager,
+ ESignatureEditor *editor);
+ void (*edit_signature) (ESignatureManager *manager);
+ void (*remove_signature) (ESignatureManager *manager);
+};
+
+GType e_signature_manager_get_type (void);
+GtkWidget * e_signature_manager_new (ESignatureList *signature_list);
+void e_signature_manager_add_signature
+ (ESignatureManager *manager);
+void e_signature_manager_add_signature_script
+ (ESignatureManager *manager);
+void e_signature_manager_edit_signature
+ (ESignatureManager *manager);
+void e_signature_manager_remove_signature
+ (ESignatureManager *manager);
+gboolean e_signature_manager_get_allow_scripts
+ (ESignatureManager *manager);
+void e_signature_manager_set_allow_scripts
+ (ESignatureManager *manager,
+ gboolean allow_scripts);
+gboolean e_signature_manager_get_prefer_html
+ (ESignatureManager *manager);
+void e_signature_manager_set_prefer_html
+ (ESignatureManager *manager,
+ gboolean prefer_html);
+ESignatureList *e_signature_manager_get_signature_list
+ (ESignatureManager *manager);
+void e_signature_manager_set_signature_list
+ (ESignatureManager *manager,
+ ESignatureList *signature_list);
+ESignatureTreeView *
+ e_signature_manager_get_tree_view
+ (ESignatureManager *manager);
+
+#endif /* E_SIGNATURE_MANAGER_H */
diff --git a/widgets/misc/e-signature-preview.c b/widgets/misc/e-signature-preview.c
new file mode 100644
index 0000000000..f8e168cd5a
--- /dev/null
+++ b/widgets/misc/e-signature-preview.c
@@ -0,0 +1,344 @@
+/*
+ * e-signature-preview.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-signature-preview.h"
+
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <glib/gstdio.h>
+#include "e-util/e-signature-utils.h"
+
+#define E_SIGNATURE_PREVIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SIGNATURE_PREVIEW, ESignaturePreviewPrivate))
+
+enum {
+ PROP_0,
+ PROP_ALLOW_SCRIPTS,
+ PROP_SIGNATURE
+};
+
+enum {
+ REFRESH,
+ LAST_SIGNAL
+};
+
+struct _ESignaturePreviewPrivate {
+ ESignature *signature;
+ guint allow_scripts : 1;
+};
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+
+static void
+signature_preview_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ALLOW_SCRIPTS:
+ e_signature_preview_set_allow_scripts (
+ E_SIGNATURE_PREVIEW (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_SIGNATURE:
+ e_signature_preview_set_signature (
+ E_SIGNATURE_PREVIEW (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+signature_preview_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_ALLOW_SCRIPTS:
+ g_value_set_boolean (
+ value, e_signature_preview_get_allow_scripts (
+ E_SIGNATURE_PREVIEW (object)));
+ return;
+
+ case PROP_SIGNATURE:
+ g_value_set_object (
+ value, e_signature_preview_get_signature (
+ E_SIGNATURE_PREVIEW (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+signature_preview_dispose (GObject *object)
+{
+ ESignaturePreviewPrivate *priv;
+
+ priv = E_SIGNATURE_PREVIEW_GET_PRIVATE (object);
+
+ if (priv->signature != NULL) {
+ g_object_unref (priv->signature);
+ priv->signature = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+signature_preview_url_requested (GtkHTML *html,
+ const gchar *url,
+ GtkHTMLStream *handle)
+{
+ GtkHTMLStreamStatus status;
+ gchar buffer[128];
+ gchar *filename;
+ gssize size;
+ gint fd;
+
+ /* FIXME Use GInputStream for this. */
+
+ if (g_str_has_prefix (url, "file:"))
+ filename = g_filename_from_uri (url, NULL, NULL);
+ else
+ filename = g_strdup (url);
+ fd = g_open (filename, O_RDONLY, 0);
+ g_free (filename);
+
+ status = GTK_HTML_STREAM_OK;
+ if (fd != -1) {
+ while ((size = read (fd, buffer, sizeof (buffer)))) {
+ if (size == -1) {
+ status = GTK_HTML_STREAM_ERROR;
+ break;
+ } else
+ gtk_html_write (html, handle, buffer, size);
+ }
+ } else
+ status = GTK_HTML_STREAM_ERROR;
+
+ gtk_html_end (html, handle, status);
+
+ if (fd > 0)
+ close (fd);
+}
+
+static void
+signature_preview_refresh (ESignaturePreview *preview)
+{
+ GtkHTML *html;
+ ESignature *signature;
+ gchar *content = NULL;
+ gsize length;
+
+ /* XXX We should show error messages in the preview. */
+
+ html = GTK_HTML (preview);
+ signature = e_signature_preview_get_signature (preview);
+
+ if (signature == NULL)
+ goto clear;
+
+ if (signature->script && !preview->priv->allow_scripts)
+ goto clear;
+
+ if (signature->script)
+ content = e_run_signature_script (signature->filename);
+ else
+ content = e_read_signature_file (signature, FALSE, NULL);
+
+ if (content == NULL || *content == '\0')
+ goto clear;
+
+ length = strlen (content);
+
+ if (signature->html)
+ gtk_html_load_from_string (html, content, length);
+ else {
+ GtkHTMLStream *stream;
+
+ stream = gtk_html_begin_content (
+ html, "text/html; charset=utf-8");
+ gtk_html_write (html, stream, "<PRE>", 5);
+ if (length > 0)
+ gtk_html_write (html, stream, content, length);
+ gtk_html_write (html, stream, "</PRE>", 6);
+ gtk_html_end (html, stream, GTK_HTML_STREAM_OK);
+ }
+
+ g_free (content);
+ return;
+
+clear:
+ gtk_html_load_from_string (html, " ", 1);
+ g_free (content);
+}
+
+static void
+signature_preview_class_init (ESignaturePreviewClass *class)
+{
+ GObjectClass *object_class;
+ GtkHTMLClass *html_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ESignaturePreviewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = signature_preview_set_property;
+ object_class->get_property = signature_preview_get_property;
+ object_class->dispose = signature_preview_dispose;
+
+ html_class = GTK_HTML_CLASS (class);
+ html_class->url_requested = signature_preview_url_requested;
+
+ class->refresh = signature_preview_refresh;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ALLOW_SCRIPTS,
+ g_param_spec_boolean (
+ "allow-scripts",
+ "Allow Scripts",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SIGNATURE,
+ g_param_spec_object (
+ "signature",
+ "Signature",
+ NULL,
+ E_TYPE_SIGNATURE,
+ G_PARAM_READWRITE));
+
+ signals[REFRESH] = g_signal_new (
+ "refresh",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ESignaturePreviewClass, refresh),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void
+signature_preview_init (ESignaturePreview *preview)
+{
+ preview->priv = E_SIGNATURE_PREVIEW_GET_PRIVATE (preview);
+}
+
+GType
+e_signature_preview_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ESignaturePreviewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) signature_preview_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ESignaturePreview),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) signature_preview_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_HTML, "ESignaturePreview", &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_signature_preview_new (void)
+{
+ return g_object_new (E_TYPE_SIGNATURE_PREVIEW, NULL);
+}
+
+void
+e_signature_preview_refresh (ESignaturePreview *preview)
+{
+ g_return_if_fail (E_IS_SIGNATURE_PREVIEW (preview));
+
+ g_signal_emit (preview, signals[REFRESH], 0);
+}
+
+gboolean
+e_signature_preview_get_allow_scripts (ESignaturePreview *preview)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE_PREVIEW (preview), FALSE);
+
+ return preview->priv->allow_scripts;
+}
+
+void
+e_signature_preview_set_allow_scripts (ESignaturePreview *preview,
+ gboolean allow_scripts)
+{
+ g_return_if_fail (E_IS_SIGNATURE_PREVIEW (preview));
+
+ preview->priv->allow_scripts = allow_scripts;
+ g_object_notify (G_OBJECT (preview), "allow-scripts");
+}
+
+ESignature *
+e_signature_preview_get_signature (ESignaturePreview *preview)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE_PREVIEW (preview), NULL);
+
+ return preview->priv->signature;
+}
+
+void
+e_signature_preview_set_signature (ESignaturePreview *preview,
+ ESignature *signature)
+{
+ g_return_if_fail (E_IS_SIGNATURE_PREVIEW (preview));
+
+ if (signature != NULL) {
+ g_return_if_fail (E_IS_SIGNATURE (signature));
+ g_object_ref (signature);
+ }
+
+ if (preview->priv->signature != NULL)
+ g_object_unref (preview->priv->signature);
+
+ preview->priv->signature = signature;
+ g_object_notify (G_OBJECT (preview), "signature");
+
+ e_signature_preview_refresh (preview);
+}
diff --git a/widgets/misc/e-signature-preview.h b/widgets/misc/e-signature-preview.h
new file mode 100644
index 0000000000..a4221832c2
--- /dev/null
+++ b/widgets/misc/e-signature-preview.h
@@ -0,0 +1,81 @@
+/*
+ * e-signature-preview.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_SIGNATURE_PREVIEW_H
+#define E_SIGNATURE_PREVIEW_H
+
+#include <gtkhtml/gtkhtml.h>
+#include <e-util/e-signature.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SIGNATURE_PREVIEW \
+ (e_signature_preview_get_type ())
+#define E_SIGNATURE_PREVIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SIGNATURE_PREVIEW, ESignaturePreview))
+#define E_SIGNATURE_PREVIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SIGNATURE_PREVIEW, ESignaturePreviewClass))
+#define E_IS_SIGNATURE_PREVIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SIGNATURE_PREVIEW))
+#define E_IS_SIGNATURE_PREVIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SIGNATURE_PREVIEW))
+#define E_SIGNATURE_PREVIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SIGNATURE_PREVIEW, ESignaturePreview))
+
+G_BEGIN_DECLS
+
+typedef struct _ESignaturePreview ESignaturePreview;
+typedef struct _ESignaturePreviewClass ESignaturePreviewClass;
+typedef struct _ESignaturePreviewPrivate ESignaturePreviewPrivate;
+
+struct _ESignaturePreview {
+ GtkHTML parent;
+ ESignaturePreviewPrivate *priv;
+};
+
+struct _ESignaturePreviewClass {
+ GtkHTMLClass parent_class;
+
+ /* Signals */
+ void (*refresh) (ESignaturePreview *preview);
+};
+
+GType e_signature_preview_get_type (void);
+GtkWidget * e_signature_preview_new (void);
+void e_signature_preview_refresh (ESignaturePreview *preview);
+gboolean e_signature_preview_get_allow_scripts
+ (ESignaturePreview *preview);
+void e_signature_preview_set_allow_scripts
+ (ESignaturePreview *preview,
+ gboolean allow_scripts);
+ESignature * e_signature_preview_get_signature
+ (ESignaturePreview *preview);
+void e_signature_preview_set_signature
+ (ESignaturePreview *preview,
+ ESignature *signature);
+
+G_END_DECLS
+
+#endif /* E_SIGNATURE_PREVIEW_H */
diff --git a/widgets/misc/e-signature-script-dialog.c b/widgets/misc/e-signature-script-dialog.c
new file mode 100644
index 0000000000..777d064f09
--- /dev/null
+++ b/widgets/misc/e-signature-script-dialog.c
@@ -0,0 +1,463 @@
+/*
+ * e-signature-script-dialog.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-signature-script-dialog.h"
+
+#include <glib/gi18n.h>
+#include "e-util/e-binding.h"
+
+#define E_SIGNATURE_SCRIPT_DIALOG_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SIGNATURE_SCRIPT_DIALOG, ESignatureScriptDialogPrivate))
+
+struct _ESignatureScriptDialogPrivate {
+ GtkWidget *entry;
+ GtkWidget *file_chooser;
+ GtkWidget *alert;
+};
+
+enum {
+ PROP_0,
+ PROP_SCRIPT_FILE,
+ PROP_SCRIPT_NAME
+};
+
+static gpointer parent_class;
+
+static gboolean
+signature_script_dialog_filter_cb (const GtkFileFilterInfo *filter_info)
+{
+ const gchar *filename = filter_info->filename;
+
+ return g_file_test (filename, G_FILE_TEST_IS_EXECUTABLE);
+}
+
+static void
+signature_script_dialog_update_status (ESignatureScriptDialog *dialog)
+{
+ GFile *script_file;
+ const gchar *script_name;
+ gboolean show_alert;
+ gboolean sensitive;
+
+ script_file = e_signature_script_dialog_get_script_file (dialog);
+ script_name = e_signature_script_dialog_get_script_name (dialog);
+
+ sensitive = (script_name != NULL && *script_name != '\0');
+
+ if (script_file != NULL) {
+ gboolean executable;
+ gchar *filename;
+
+ filename = g_file_get_path (script_file);
+ executable = g_file_test (filename, G_FILE_TEST_IS_EXECUTABLE);
+ g_free (filename);
+
+ show_alert = !executable;
+ sensitive &= executable;
+
+ g_object_unref (script_file);
+ } else {
+ sensitive = FALSE;
+ show_alert = FALSE;
+ }
+
+ if (show_alert)
+ gtk_widget_show (dialog->priv->alert);
+ else
+ gtk_widget_hide (dialog->priv->alert);
+
+ gtk_dialog_set_response_sensitive (
+ GTK_DIALOG (dialog), GTK_RESPONSE_OK, sensitive);
+}
+
+static void
+signature_script_dialog_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SCRIPT_FILE:
+ e_signature_script_dialog_set_script_file (
+ E_SIGNATURE_SCRIPT_DIALOG (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SCRIPT_NAME:
+ e_signature_script_dialog_set_script_name (
+ E_SIGNATURE_SCRIPT_DIALOG (object),
+ g_value_get_string (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+signature_script_dialog_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SCRIPT_FILE:
+ g_value_set_object (
+ value,
+ e_signature_script_dialog_get_script_file (
+ E_SIGNATURE_SCRIPT_DIALOG (object)));
+ return;
+
+ case PROP_SCRIPT_NAME:
+ g_value_set_string (
+ value,
+ e_signature_script_dialog_get_script_name (
+ E_SIGNATURE_SCRIPT_DIALOG (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+signature_script_dialog_dispose (GObject *object)
+{
+ ESignatureScriptDialogPrivate *priv;
+
+ priv = E_SIGNATURE_SCRIPT_DIALOG_GET_PRIVATE (object);
+
+ if (priv->entry != NULL) {
+ g_object_unref (priv->entry);
+ priv->entry = NULL;
+ }
+
+ if (priv->file_chooser != NULL) {
+ g_object_unref (priv->file_chooser);
+ priv->file_chooser = NULL;
+ }
+
+ if (priv->alert != NULL) {
+ g_object_unref (priv->alert);
+ priv->alert = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+signature_script_dialog_map (GtkWidget *widget)
+{
+ GtkWidget *action_area;
+ GtkWidget *content_area;
+
+ /* Chain up to parent's map() method. */
+ GTK_WIDGET_CLASS (parent_class)->map (widget);
+
+ /* XXX Override GtkDialog's broken style property defaults. */
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (widget));
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (widget));
+
+ gtk_box_set_spacing (GTK_BOX (content_area), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (content_area), 12);
+}
+
+static void
+signature_script_dialog_class_init (ESignatureScriptDialogClass *class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ESignatureScriptDialogPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = signature_script_dialog_set_property;
+ object_class->get_property = signature_script_dialog_get_property;
+ object_class->dispose = signature_script_dialog_dispose;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->map = signature_script_dialog_map;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SCRIPT_FILE,
+ g_param_spec_object (
+ "script-file",
+ "Script File",
+ NULL,
+ G_TYPE_FILE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SCRIPT_NAME,
+ g_param_spec_string (
+ "script-name",
+ "Script Name",
+ NULL,
+ _("Unnamed"),
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+}
+
+static void
+signature_script_dialog_init (ESignatureScriptDialog *dialog)
+{
+ GtkFileFilter *filter;
+ GtkWidget *content_area;
+ GtkWidget *container;
+ GtkWidget *widget;
+ gchar *markup;
+
+ dialog->priv = E_SIGNATURE_SCRIPT_DIALOG_GET_PRIVATE (dialog);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+ gtk_dialog_add_button (
+ GTK_DIALOG (dialog),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+
+ gtk_dialog_add_button (
+ GTK_DIALOG (dialog),
+ GTK_STOCK_SAVE, GTK_RESPONSE_OK);
+
+ gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+ container = content_area;
+
+ widget = gtk_table_new (4, 2, FALSE);
+ gtk_table_set_col_spacings (GTK_TABLE (widget), 6);
+ gtk_table_set_row_spacings (GTK_TABLE (widget), 6);
+ gtk_table_set_row_spacing (GTK_TABLE (widget), 0, 12);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_image_new_from_stock (
+ GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
+ gtk_table_attach (
+ GTK_TABLE (container), widget,
+ 0, 1, 0, 1, 0, 0, 0, 0);
+ gtk_widget_show (widget);
+
+ widget = gtk_label_new (_(
+ "The output of this script will be used as your\n"
+ "signature. The name you specify will be used\n"
+ "for display purposes only."));
+ gtk_table_attach (
+ GTK_TABLE (container), widget,
+ 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
+ gtk_widget_show (widget);
+
+ widget = gtk_entry_new ();
+ gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
+ gtk_table_attach (
+ GTK_TABLE (container), widget,
+ 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0);
+ dialog->priv->entry = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_label_new_with_mnemonic (_("_Name:"));
+ gtk_label_set_mnemonic_widget (
+ GTK_LABEL (widget), dialog->priv->entry);
+ gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
+ gtk_table_attach (
+ GTK_TABLE (container), widget,
+ 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
+ gtk_widget_show (widget);
+
+ widget = gtk_file_chooser_button_new (
+ NULL, GTK_FILE_CHOOSER_ACTION_OPEN);
+ gtk_table_attach (
+ GTK_TABLE (container), widget,
+ 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, 0, 0, 0);
+ dialog->priv->file_chooser = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Restrict file selection to executable files. */
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_add_custom (
+ filter, GTK_FILE_FILTER_FILENAME,
+ (GtkFileFilterFunc) signature_script_dialog_filter_cb,
+ NULL, NULL);
+ gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (widget), filter);
+
+ /* XXX ESignature stores a filename instead of a URI,
+ * so we have to restrict it to local files only. */
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), TRUE);
+
+ widget = gtk_label_new_with_mnemonic (_("S_cript:"));
+ gtk_label_set_mnemonic_widget (
+ GTK_LABEL (widget), dialog->priv->file_chooser);
+ gtk_table_attach (
+ GTK_TABLE (container), widget,
+ 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
+ gtk_widget_show (widget);
+
+ /* This is just a placeholder. */
+ widget = gtk_label_new (NULL);
+ gtk_table_attach (
+ GTK_TABLE (container), widget,
+ 0, 1, 3, 4, GTK_FILL, 0, 0, 0);
+ gtk_widget_show (widget);
+
+ widget = gtk_hbox_new (FALSE, 6);
+ gtk_table_attach (
+ GTK_TABLE (container), widget,
+ 1, 2, 3, 4, 0, 0, 0, 0);
+ dialog->priv->alert = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_image_new_from_stock (
+ GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ markup = g_markup_printf_escaped (
+ "<small>%s</small>",
+ _("Script file must be executable."));
+ widget = gtk_label_new (markup);
+ gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ gtk_widget_show (widget);
+ g_free (markup);
+
+ g_signal_connect (
+ dialog, "notify::script-file",
+ G_CALLBACK (signature_script_dialog_update_status), NULL);
+
+ g_signal_connect (
+ dialog, "notify::script-name",
+ G_CALLBACK (signature_script_dialog_update_status), NULL);
+
+ g_signal_connect_swapped (
+ dialog->priv->entry, "changed",
+ G_CALLBACK (signature_script_dialog_update_status), dialog);
+
+ g_signal_connect_swapped (
+ dialog->priv->file_chooser, "file-set",
+ G_CALLBACK (signature_script_dialog_update_status), dialog);
+
+ signature_script_dialog_update_status (dialog);
+}
+
+GType
+e_signature_script_dialog_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ESignatureScriptDialogClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) signature_script_dialog_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ESignatureScriptDialog),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) signature_script_dialog_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_DIALOG, "ESignatureScriptDialog",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_signature_script_dialog_new (GtkWindow *parent)
+{
+ return g_object_new (
+ E_TYPE_SIGNATURE_SCRIPT_DIALOG,
+ "transient-for", parent, NULL);
+}
+
+GFile *
+e_signature_script_dialog_get_script_file (ESignatureScriptDialog *dialog)
+{
+ GtkFileChooser *file_chooser;
+
+ g_return_val_if_fail (E_IS_SIGNATURE_SCRIPT_DIALOG (dialog), NULL);
+
+ file_chooser = GTK_FILE_CHOOSER (dialog->priv->file_chooser);
+
+ return gtk_file_chooser_get_file (file_chooser);
+}
+
+void
+e_signature_script_dialog_set_script_file (ESignatureScriptDialog *dialog,
+ GFile *script_file)
+{
+ GtkFileChooser *file_chooser;
+ GError *error = NULL;
+
+ g_return_if_fail (E_IS_SIGNATURE_SCRIPT_DIALOG (dialog));
+ g_return_if_fail (G_IS_FILE (script_file));
+
+ file_chooser = GTK_FILE_CHOOSER (dialog->priv->file_chooser);
+
+ if (gtk_file_chooser_set_file (file_chooser, script_file, &error))
+ g_object_notify (G_OBJECT (dialog), "script-file");
+ else {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+}
+
+const gchar *
+e_signature_script_dialog_get_script_name (ESignatureScriptDialog *dialog)
+{
+ GtkEntry *entry;
+
+ g_return_val_if_fail (E_IS_SIGNATURE_SCRIPT_DIALOG (dialog), NULL);
+
+ entry = GTK_ENTRY (dialog->priv->entry);
+
+ return gtk_entry_get_text (entry);
+}
+
+void
+e_signature_script_dialog_set_script_name (ESignatureScriptDialog *dialog,
+ const gchar *script_name)
+{
+ GtkEntry *entry;
+
+ g_return_if_fail (E_IS_SIGNATURE_SCRIPT_DIALOG (dialog));
+
+ if (script_name == NULL)
+ script_name = "";
+
+ entry = GTK_ENTRY (dialog->priv->entry);
+ gtk_entry_set_text (entry, script_name);
+
+ g_object_notify (G_OBJECT (dialog), "script-name");
+}
diff --git a/widgets/misc/e-signature-script-dialog.h b/widgets/misc/e-signature-script-dialog.h
new file mode 100644
index 0000000000..3967ae60c3
--- /dev/null
+++ b/widgets/misc/e-signature-script-dialog.h
@@ -0,0 +1,76 @@
+/*
+ * e-signature-script-dialog.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_SIGNATURE_SCRIPT_DIALOG_H
+#define E_SIGNATURE_SCRIPT_DIALOG_H
+
+#include <gtk/gtk.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SIGNATURE_SCRIPT_DIALOG \
+ (e_signature_script_dialog_get_type ())
+#define E_SIGNATURE_SCRIPT_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SIGNATURE_SCRIPT_DIALOG, ESignatureScriptDialog))
+#define E_SIGNATURE_SCRIPT_DIALOG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SIGNATURE_SCRIPT_DIALOG, ESignatureScriptDialogClass))
+#define E_IS_SIGNATURE_SCRIPT_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SIGNATURE_SCRIPT_DIALOG))
+#define E_IS_SIGNATURE_SCRIPT_DIALOG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SIGNATURE_SCRIPT_DIALOG))
+#define E_SIGNATURE_SCRIPT_DIALOG_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SIGNATURE_SCRIPT_DIALOG, ESignatureScriptDialogClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ESignatureScriptDialog ESignatureScriptDialog;
+typedef struct _ESignatureScriptDialogClass ESignatureScriptDialogClass;
+typedef struct _ESignatureScriptDialogPrivate ESignatureScriptDialogPrivate;
+
+struct _ESignatureScriptDialog {
+ GtkDialog parent;
+ ESignatureScriptDialogPrivate *priv;
+};
+
+struct _ESignatureScriptDialogClass {
+ GtkDialogClass parent_class;
+};
+
+GType e_signature_script_dialog_get_type (void);
+GtkWidget * e_signature_script_dialog_new (GtkWindow *parent);
+GFile * e_signature_script_dialog_get_script_file
+ (ESignatureScriptDialog *dialog);
+void e_signature_script_dialog_set_script_file
+ (ESignatureScriptDialog *dialog,
+ GFile *script_file);
+const gchar * e_signature_script_dialog_get_script_name
+ (ESignatureScriptDialog *dialog);
+void e_signature_script_dialog_set_script_name
+ (ESignatureScriptDialog *dialog,
+ const gchar *script_name);
+
+G_END_DECLS
+
+#endif /* E_SIGNATURE_SCRIPT_DIALOG_H */
diff --git a/widgets/misc/e-signature-tree-view.c b/widgets/misc/e-signature-tree-view.c
new file mode 100644
index 0000000000..b2cc9d6f66
--- /dev/null
+++ b/widgets/misc/e-signature-tree-view.c
@@ -0,0 +1,445 @@
+/*
+ * e-signature-tree-view.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-signature-tree-view.h"
+
+#define E_SIGNATURE_TREE_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SIGNATURE_TREE_VIEW, ESignatureTreeViewPrivate))
+
+enum {
+ COLUMN_STRING,
+ COLUMN_SIGNATURE
+};
+
+enum {
+ PROP_0,
+ PROP_SELECTED,
+ PROP_SIGNATURE_LIST
+};
+
+enum {
+ REFRESHED,
+ LAST_SIGNAL
+};
+
+struct _ESignatureTreeViewPrivate {
+ ESignatureList *signature_list;
+ GHashTable *index;
+};
+
+static gpointer parent_class;
+static guint signals[LAST_SIGNAL];
+
+static void
+signature_tree_view_refresh_cb (ESignatureList *signature_list,
+ ESignature *unused,
+ ESignatureTreeView *tree_view)
+{
+ GtkListStore *store;
+ GtkTreeModel *model;
+ GtkTreeIter tree_iter;
+ EIterator *signature_iter;
+ ESignature *signature;
+ GHashTable *index;
+ GList *list = NULL;
+ GList *iter;
+
+ store = gtk_list_store_new (2, G_TYPE_STRING, E_TYPE_SIGNATURE);
+ model = GTK_TREE_MODEL (store);
+ index = tree_view->priv->index;
+
+ g_hash_table_remove_all (index);
+
+ if (signature_list == NULL)
+ goto skip;
+
+ /* Build a list of ESignatures to display. */
+ signature_iter = e_list_get_iterator (E_LIST (signature_list));
+ while (e_iterator_is_valid (signature_iter)) {
+
+ /* XXX EIterator misuses const. */
+ signature = (ESignature *) e_iterator_get (signature_iter);
+ list = g_list_prepend (list, signature);
+ e_iterator_next (signature_iter);
+ }
+ g_object_unref (signature_iter);
+
+ list = g_list_reverse (list);
+
+ /* Populate the list store and index. */
+ for (iter = list; iter != NULL; iter = iter->next) {
+ GtkTreeRowReference *reference;
+ GtkTreePath *path;
+
+ signature = iter->data;
+
+ /* Skip autogenerated signatures. */
+ if (signature->autogen)
+ continue;
+
+ gtk_list_store_append (store, &tree_iter);
+ gtk_list_store_set (
+ store, &tree_iter,
+ COLUMN_STRING, signature->name,
+ COLUMN_SIGNATURE, signature, -1);
+
+ path = gtk_tree_model_get_path (model, &tree_iter);
+ reference = gtk_tree_row_reference_new (model, path);
+ g_hash_table_insert (index, signature, reference);
+ gtk_tree_path_free (path);
+ }
+
+skip:
+ /* Restore the previously selected signature. */
+ signature = e_signature_tree_view_get_selected (tree_view);
+ if (signature != NULL)
+ g_object_ref (signature);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), model);
+ e_signature_tree_view_set_selected (tree_view, signature);
+ if (signature != NULL)
+ g_object_unref (signature);
+
+ g_signal_emit (tree_view, signals[REFRESHED], 0);
+}
+
+static void
+signature_tree_view_selection_changed_cb (ESignatureTreeView *tree_view)
+{
+ g_object_notify (G_OBJECT (tree_view), "selected");
+}
+
+static GObject *
+signature_tree_view_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
+{
+ GObject *object;
+ GtkTreeView *tree_view;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+
+ /* Chain up to parent's constructor() method. */
+ object = G_OBJECT_CLASS (parent_class)->constructor (
+ type, n_construct_properties, construct_properties);
+
+ tree_view = GTK_TREE_VIEW (object);
+ gtk_tree_view_set_headers_visible (tree_view, FALSE);
+
+ column = gtk_tree_view_column_new ();
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_tree_view_column_add_attribute (
+ column, renderer, "text", COLUMN_STRING);
+ gtk_tree_view_append_column (tree_view, column);
+
+ return object;
+}
+
+static void
+signature_tree_view_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SELECTED:
+ e_signature_tree_view_set_selected (
+ E_SIGNATURE_TREE_VIEW (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SIGNATURE_LIST:
+ e_signature_tree_view_set_signature_list (
+ E_SIGNATURE_TREE_VIEW (object),
+ g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+signature_tree_view_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SELECTED:
+ g_value_set_object (
+ value,
+ e_signature_tree_view_get_selected (
+ E_SIGNATURE_TREE_VIEW (object)));
+ return;
+
+ case PROP_SIGNATURE_LIST:
+ g_value_set_object (
+ value,
+ e_signature_tree_view_get_signature_list (
+ E_SIGNATURE_TREE_VIEW (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+signature_tree_view_dispose (GObject *object)
+{
+ ESignatureTreeViewPrivate *priv;
+
+ priv = E_SIGNATURE_TREE_VIEW_GET_PRIVATE (object);
+
+ if (priv->signature_list != NULL) {
+ g_signal_handlers_disconnect_by_func (
+ priv->signature_list,
+ signature_tree_view_refresh_cb, object);
+ g_object_unref (priv->signature_list);
+ priv->signature_list = NULL;
+ }
+
+ g_hash_table_remove_all (priv->index);
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+signature_tree_view_finalize (GObject *object)
+{
+ ESignatureTreeViewPrivate *priv;
+
+ priv = E_SIGNATURE_TREE_VIEW_GET_PRIVATE (object);
+
+ g_hash_table_destroy (priv->index);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+signature_tree_view_class_init (ESignatureTreeViewClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ESignatureTreeViewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructor = signature_tree_view_constructor;
+ object_class->set_property = signature_tree_view_set_property;
+ object_class->get_property = signature_tree_view_get_property;
+ object_class->dispose = signature_tree_view_dispose;
+ object_class->finalize = signature_tree_view_finalize;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SELECTED,
+ g_param_spec_object (
+ "selected",
+ "Selected Signature",
+ NULL,
+ E_TYPE_SIGNATURE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SIGNATURE_LIST,
+ g_param_spec_object (
+ "signature-list",
+ "Signature List",
+ NULL,
+ E_TYPE_SIGNATURE_LIST,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ signals[REFRESHED] = g_signal_new (
+ "refreshed",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void
+signature_tree_view_init (ESignatureTreeView *tree_view)
+{
+ GHashTable *index;
+ GtkTreeSelection *selection;
+
+ /* Reverse-lookup index */
+ index = g_hash_table_new_full (
+ g_direct_hash, g_direct_equal,
+ (GDestroyNotify) g_object_unref,
+ (GDestroyNotify) gtk_tree_row_reference_free);
+
+ tree_view->priv = E_SIGNATURE_TREE_VIEW_GET_PRIVATE (tree_view);
+ tree_view->priv->index = index;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
+
+ g_signal_connect_swapped (
+ selection, "changed",
+ G_CALLBACK (signature_tree_view_selection_changed_cb),
+ tree_view);
+}
+
+GType
+e_signature_tree_view_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ESignatureTreeViewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) signature_tree_view_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ESignatureTreeView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) signature_tree_view_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_TREE_VIEW, "ESignatureTreeView",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_signature_tree_view_new (void)
+{
+ return g_object_new (E_TYPE_SIGNATURE_TREE_VIEW, NULL);
+}
+
+ESignatureList *
+e_signature_tree_view_get_signature_list (ESignatureTreeView *tree_view)
+{
+ g_return_val_if_fail (E_IS_SIGNATURE_TREE_VIEW (tree_view), NULL);
+
+ return tree_view->priv->signature_list;
+}
+
+void
+e_signature_tree_view_set_signature_list (ESignatureTreeView *tree_view,
+ ESignatureList *signature_list)
+{
+ ESignatureTreeViewPrivate *priv;
+
+ g_return_if_fail (E_IS_SIGNATURE_TREE_VIEW (tree_view));
+
+ if (signature_list != NULL)
+ g_return_if_fail (E_IS_SIGNATURE_LIST (signature_list));
+
+ priv = E_SIGNATURE_TREE_VIEW_GET_PRIVATE (tree_view);
+
+ if (priv->signature_list != NULL) {
+ g_signal_handlers_disconnect_by_func (
+ priv->signature_list,
+ signature_tree_view_refresh_cb, tree_view);
+ g_object_unref (priv->signature_list);
+ priv->signature_list = NULL;
+ }
+
+ if (signature_list != NULL) {
+ priv->signature_list = g_object_ref (signature_list);
+
+ /* Listen for changes to the signature list. */
+ g_signal_connect (
+ priv->signature_list, "signature-added",
+ G_CALLBACK (signature_tree_view_refresh_cb),
+ tree_view);
+ g_signal_connect (
+ priv->signature_list, "signature-changed",
+ G_CALLBACK (signature_tree_view_refresh_cb),
+ tree_view);
+ g_signal_connect (
+ priv->signature_list, "signature-removed",
+ G_CALLBACK (signature_tree_view_refresh_cb),
+ tree_view);
+ }
+
+ signature_tree_view_refresh_cb (signature_list, NULL, tree_view);
+
+ g_object_notify (G_OBJECT (tree_view), "signature-list");
+}
+
+ESignature *
+e_signature_tree_view_get_selected (ESignatureTreeView *tree_view)
+{
+ ESignature *signature;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ g_return_val_if_fail (E_IS_SIGNATURE_TREE_VIEW (tree_view), NULL);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return NULL;
+
+ gtk_tree_model_get (model, &iter, COLUMN_SIGNATURE, &signature, -1);
+
+ return signature;
+}
+
+gboolean
+e_signature_tree_view_set_selected (ESignatureTreeView *tree_view,
+ ESignature *signature)
+{
+ GtkTreeRowReference *reference;
+ GtkTreeSelection *selection;
+ GtkTreePath *path;
+
+ g_return_val_if_fail (E_IS_SIGNATURE_TREE_VIEW (tree_view), FALSE);
+
+ if (signature != NULL)
+ g_return_val_if_fail (E_IS_SIGNATURE (signature), FALSE);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
+
+ /* NULL means clear the selection. */
+ if (signature == NULL) {
+ gtk_tree_selection_unselect_all (selection);
+ return TRUE;
+ }
+
+ /* Lookup the tree row reference for the signature. */
+ reference = g_hash_table_lookup (tree_view->priv->index, signature);
+ if (reference == NULL)
+ return FALSE;
+
+ /* Select the referenced path. */
+ path = gtk_tree_row_reference_get_path (reference);
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_path_free (path);
+
+ g_object_notify (G_OBJECT (tree_view), "selected");
+
+ return TRUE;
+}
diff --git a/widgets/misc/e-signature-tree-view.h b/widgets/misc/e-signature-tree-view.h
new file mode 100644
index 0000000000..50d1e11905
--- /dev/null
+++ b/widgets/misc/e-signature-tree-view.h
@@ -0,0 +1,78 @@
+/*
+ * e-signature-tree-view.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_SIGNATURE_TREE_VIEW_H
+#define E_SIGNATURE_TREE_VIEW_H
+
+#include <gtk/gtk.h>
+#include <e-util/e-signature.h>
+#include <e-util/e-signature-list.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SIGNATURE_TREE_VIEW \
+ (e_signature_tree_view_get_type ())
+#define E_SIGNATURE_TREE_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SIGNATURE_TREE_VIEW, ESignatureTreeView))
+#define E_SIGNATURE_TREE_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SIGNATURE_TREE_VIEW, ESignatureTreeViewClass))
+#define E_IS_SIGNATURE_TREE_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SIGNATURE_TREE_VIEW))
+#define E_IS_SIGNATURE_TREE_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SIGNATURE_TREE_VIEW))
+#define E_SIGNATURE_TREE_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SIGNATURE_TREE_VIEW, ESignatureTreeViewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ESignatureTreeView ESignatureTreeView;
+typedef struct _ESignatureTreeViewClass ESignatureTreeViewClass;
+typedef struct _ESignatureTreeViewPrivate ESignatureTreeViewPrivate;
+
+struct _ESignatureTreeView {
+ GtkTreeView parent;
+ ESignatureTreeViewPrivate *priv;
+};
+
+struct _ESignatureTreeViewClass {
+ GtkTreeViewClass parent_class;
+};
+
+GType e_signature_tree_view_get_type (void);
+GtkWidget * e_signature_tree_view_new (void);
+ESignatureList *e_signature_tree_view_get_signature_list
+ (ESignatureTreeView *tree_view);
+void e_signature_tree_view_set_signature_list
+ (ESignatureTreeView *tree_view,
+ ESignatureList *signature_list);
+ESignature * e_signature_tree_view_get_selected
+ (ESignatureTreeView *tree_view);
+gboolean e_signature_tree_view_set_selected
+ (ESignatureTreeView *tree_view,
+ ESignature *signature);
+
+G_END_DECLS
+
+#endif /* E_SIGNATURE_TREE_VIEW_H */
diff --git a/widgets/misc/e-task-bar.c b/widgets/misc/e-task-bar.c
deleted file mode 100644
index c7a715decd..0000000000
--- a/widgets/misc/e-task-bar.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-task-bar.h"
-
-struct _ETaskBarPrivate
-{
- GtkWidget *message_label;
- GtkHBox *hbox;
-};
-
-/* WARNING: Ugly hack starts here. */
-#define MAX_ACTIVITIES_PER_COMPONENT 2
-
-G_DEFINE_TYPE (ETaskBar, e_task_bar, GTK_TYPE_HBOX)
-
-#if 0
-static void
-reduce_displayed_activities_per_component (ETaskBar *task_bar)
-{
- GHashTable *component_ids_hash;
- GtkBox *box;
- GList *p;
-
- component_ids_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- box = GTK_BOX (task_bar->priv->hbox);
-
- for (p = box->children; p != NULL; p = p->next) {
- GtkBoxChild *child;
- const char *component_id;
- void *hash_item;
-
- child = (GtkBoxChild *) p->data;
- component_id = e_task_widget_get_component_id (E_TASK_WIDGET (child->widget));
-
- hash_item = g_hash_table_lookup (component_ids_hash, component_id);
-
- if (hash_item == NULL) {
- gtk_widget_show (child->widget);
- g_hash_table_insert (component_ids_hash, (void *) component_id, GINT_TO_POINTER (1));
- } else {
- int num_items;
-
- num_items = GPOINTER_TO_INT (hash_item);
- g_return_if_fail (num_items <= MAX_ACTIVITIES_PER_COMPONENT);
-
- if (num_items == MAX_ACTIVITIES_PER_COMPONENT) {
- gtk_widget_hide (child->widget);
- } else {
- num_items ++;
- gtk_widget_show (child->widget);
- g_hash_table_insert (component_ids_hash, (void *) component_id, GINT_TO_POINTER (num_items));
- }
- }
- }
-
- g_hash_table_destroy (component_ids_hash);
-}
-#endif
-
-
-static void impl_finalize (GObject *object);
-
-static void
-e_task_bar_class_init (ETaskBarClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = impl_finalize;
-}
-
-static void
-e_task_bar_init (ETaskBar *task_bar)
-{
- GtkWidget *label, *hbox;
- gint height;
-
- task_bar->priv = g_new (ETaskBarPrivate, 1);
-
- gtk_box_set_spacing (GTK_BOX (task_bar), 10);
-
- label = gtk_label_new (NULL);
- gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
- gtk_box_pack_start (GTK_BOX (task_bar), label, TRUE, TRUE, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- task_bar->priv->message_label = label;
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (task_bar), hbox);
- task_bar->priv->hbox = GTK_HBOX (hbox);
-
- /* Make the task bar large enough to accomodate a small icon.
- * XXX The "* 2" is a fudge factor to allow for some padding.
- * The true value is probably buried in a style property. */
- gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &height);
- gtk_widget_set_size_request (GTK_WIDGET (task_bar), -1, height * 2);
-}
-
-static void
-impl_finalize (GObject *object)
-{
- ETaskBar *task_bar;
- ETaskBarPrivate *priv;
-
- task_bar = E_TASK_BAR (object);
- priv = task_bar->priv;
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (e_task_bar_parent_class)->finalize) (object);
-}
-
-
-void
-e_task_bar_construct (ETaskBar *task_bar)
-{
- g_return_if_fail (task_bar != NULL);
- g_return_if_fail (E_IS_TASK_BAR (task_bar));
-
- /* Nothing to do here. */
-}
-
-GtkWidget *
-e_task_bar_new (void)
-{
- ETaskBar *task_bar;
-
- task_bar = g_object_new (e_task_bar_get_type (), NULL);
- e_task_bar_construct (task_bar);
-
- return GTK_WIDGET (task_bar);
-}
-
-void
-e_task_bar_set_message (ETaskBar *task_bar,
- const char *message)
-{
- if (message) {
- gtk_label_set_text (
- GTK_LABEL (task_bar->priv->message_label), message);
- gtk_widget_show (task_bar->priv->message_label);
- } else {
- e_task_bar_unset_message (task_bar);
- }
-}
-
-void
-e_task_bar_unset_message (ETaskBar *task_bar)
-{
- gtk_widget_hide (task_bar->priv->message_label);
-}
-
-void
-e_task_bar_prepend_task (ETaskBar *task_bar,
- ETaskWidget *task_widget)
-{
- GtkBoxChild *child_info;
- GtkBox *box;
-
- g_return_if_fail (task_bar != NULL);
- g_return_if_fail (E_IS_TASK_BAR (task_bar));
- g_return_if_fail (task_widget != NULL);
- g_return_if_fail (E_IS_TASK_WIDGET (task_widget));
-
- /* Hah hah. GTK+ sucks. This is adapted from `gtkhbox.c'. */
-
- child_info = g_new (GtkBoxChild, 1);
- child_info->widget = GTK_WIDGET (task_widget);
- child_info->padding = 0;
- child_info->expand = TRUE;
- child_info->fill = TRUE;
- child_info->pack = GTK_PACK_START;
-
- box = GTK_BOX (task_bar->priv->hbox);
-
- box->children = g_list_prepend (box->children, child_info);
-
- gtk_widget_set_parent (GTK_WIDGET (task_widget), GTK_WIDGET (task_bar->priv->hbox));
-
- if (GTK_WIDGET_REALIZED (task_bar))
- gtk_widget_realize (GTK_WIDGET (task_widget));
-
- if (GTK_WIDGET_VISIBLE (task_bar) && GTK_WIDGET_VISIBLE (task_widget)) {
- if (GTK_WIDGET_MAPPED (task_bar))
- gtk_widget_map (GTK_WIDGET (task_widget));
- gtk_widget_queue_resize (GTK_WIDGET (task_widget));
- }
-
- /* We don't restrict */
- /* reduce_displayed_activities_per_component (task_bar);*/
-
- gtk_widget_show (GTK_WIDGET (task_bar->priv->hbox));
-}
-
-void
-e_task_bar_remove_task_from_id (ETaskBar *task_bar,
- guint id)
-{
- ETaskWidget *task_widget;
-
- g_return_if_fail (task_bar != NULL);
- g_return_if_fail (E_IS_TASK_BAR (task_bar));
-
- task_widget = e_task_bar_get_task_widget_from_id (task_bar, id);
- if (!task_widget) {
- printf("Failed...\n");
- return;
- }
-
- gtk_widget_destroy (GTK_WIDGET (task_widget));
-
- /* We don't restrict here on */
- /* reduce_displayed_activities_per_component (task_bar); */
-
- if (g_list_length (GTK_BOX (task_bar->priv->hbox)->children) == 0)
- gtk_widget_hide (GTK_WIDGET (task_bar->priv->hbox));
-}
-
-void
-e_task_bar_remove_task (ETaskBar *task_bar,
- int n)
-{
- ETaskWidget *task_widget;
-
- g_return_if_fail (task_bar != NULL);
- g_return_if_fail (E_IS_TASK_BAR (task_bar));
- g_return_if_fail (n >= 0);
-
- task_widget = e_task_bar_get_task_widget (task_bar, n);
- gtk_widget_destroy (GTK_WIDGET (task_widget));
-
- /* We don't restrict here on */
- /* reduce_displayed_activities_per_component (task_bar); */
-
- if (g_list_length (GTK_BOX (task_bar->priv->hbox)->children) == 0)
- gtk_widget_hide (GTK_WIDGET (task_bar->priv->hbox));
-}
-
-ETaskWidget *
-e_task_bar_get_task_widget_from_id (ETaskBar *task_bar,
- guint id)
-{
- GtkBoxChild *child_info;
- ETaskWidget *w = NULL;
- GList *list;
-
- g_return_val_if_fail (task_bar != NULL, NULL);
- g_return_val_if_fail (E_IS_TASK_BAR (task_bar), NULL);
-
- list = GTK_BOX (task_bar->priv->hbox)->children;
- while (list) {
- child_info = list->data;
- w = (ETaskWidget *) child_info->widget;
- if (w && w->id == id)
- break;
-
- w = NULL;
- list = list->next;
- }
-
- return w;
-}
-
-ETaskWidget *
-
-e_task_bar_get_task_widget (ETaskBar *task_bar,
- int n)
-{
- GtkBoxChild *child_info;
-
- g_return_val_if_fail (task_bar != NULL, NULL);
- g_return_val_if_fail (E_IS_TASK_BAR (task_bar), NULL);
-
- child_info = (GtkBoxChild *) g_list_nth (GTK_BOX (task_bar->priv->hbox)->children, n)->data;
-
- return E_TASK_WIDGET (child_info->widget);
-}
-
diff --git a/widgets/misc/e-task-bar.h b/widgets/misc/e-task-bar.h
deleted file mode 100644
index d36898ebb8..0000000000
--- a/widgets/misc/e-task-bar.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_TASK_BAR_H_
-#define _E_TASK_BAR_H_
-
-#include "e-task-widget.h"
-
-#include <gtk/gtk.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_TASK_BAR (e_task_bar_get_type ())
-#define E_TASK_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TASK_BAR, ETaskBar))
-#define E_TASK_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TASK_BAR, ETaskBarClass))
-#define E_IS_TASK_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TASK_BAR))
-#define E_IS_TASK_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_TASK_BAR))
-
-
-typedef struct _ETaskBar ETaskBar;
-typedef struct _ETaskBarPrivate ETaskBarPrivate;
-typedef struct _ETaskBarClass ETaskBarClass;
-
-struct _ETaskBar {
- GtkHBox parent;
-
- ETaskBarPrivate *priv;
-};
-
-struct _ETaskBarClass {
- GtkHBoxClass parent_class;
-};
-
-
-GType e_task_bar_get_type (void);
-void e_task_bar_construct (ETaskBar *task_bar);
-GtkWidget *e_task_bar_new (void);
-
-void e_task_bar_set_message (ETaskBar *task_bar,
- const char *message);
-void e_task_bar_unset_message (ETaskBar *task_bar);
-
-void e_task_bar_prepend_task (ETaskBar *task_bar,
- ETaskWidget *task_widget);
-void e_task_bar_remove_task (ETaskBar *task_bar,
- int n);
-ETaskWidget * e_task_bar_get_task_widget_from_id (ETaskBar *task_bar,
- guint id);
-
-void e_task_bar_remove_task_from_id (ETaskBar *task_bar,
- guint id);
-ETaskWidget *e_task_bar_get_task_widget (ETaskBar *task_bar,
- int n);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TASK_BAR_H_ */
diff --git a/widgets/misc/e-task-widget.c b/widgets/misc/e-task-widget.c
deleted file mode 100644
index 2569a46557..0000000000
--- a/widgets/misc/e-task-widget.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-task-widget.h"
-#include "e-spinner.h"
-
-#include <glib/gi18n.h>
-
-
-#define SPACING 2
-
-struct _ETaskWidgetPrivate {
- char *component_id;
-
- GtkWidget *label;
- GtkWidget *box;
- GtkWidget *image;
-
- void (*cancel_func) (gpointer data);
- gpointer data;
-};
-
-G_DEFINE_TYPE (ETaskWidget, e_task_widget, GTK_TYPE_EVENT_BOX)
-
-/* GObject methods. */
-
-static void
-impl_finalize (GObject *object)
-{
- ETaskWidget *task_widget;
- ETaskWidgetPrivate *priv;
-
- task_widget = E_TASK_WIDGET (object);
- priv = task_widget->priv;
-
- g_free (priv->component_id);
- g_free (priv);
-
- (* G_OBJECT_CLASS (e_task_widget_parent_class)->finalize) (object);
-}
-
-
-static void
-e_task_widget_class_init (ETaskWidgetClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = impl_finalize;
-}
-
-static void
-e_task_widget_init (ETaskWidget *task_widget)
-{
- ETaskWidgetPrivate *priv;
-
- priv = g_new (ETaskWidgetPrivate, 1);
-
- priv->component_id = NULL;
- priv->label = NULL;
- priv->image = NULL;
- priv->box = NULL;
-
- task_widget->priv = priv;
- task_widget->id = 0;
-}
-
-static gboolean
-button_press_event_cb (GtkWidget *w, gpointer data)
-{
- ETaskWidget *tw = (ETaskWidget *) data;
- ETaskWidgetPrivate *priv = tw->priv;
-
- priv->cancel_func (priv->data);
-
- return TRUE;
-}
-
-static gboolean
-prepare_popup (ETaskWidget *widget, GdkEventButton *event)
-{
- if (event->type != GDK_BUTTON_PRESS)
- return FALSE;
-
- if (event->button != 3)
- return FALSE;
-
- /* FIXME: Implement Cancel */
-
- return TRUE;
-}
-
-
-void
-e_task_widget_construct (ETaskWidget *task_widget,
- const char *component_id,
- const char *information,
- void (*cancel_func) (gpointer data),
- gpointer data)
-{
- ETaskWidgetPrivate *priv;
- GtkWidget *box;
- GtkWidget *frame;
-
- g_return_if_fail (task_widget != NULL);
- g_return_if_fail (E_IS_TASK_WIDGET (task_widget));
- g_return_if_fail (component_id != NULL);
- g_return_if_fail (information != NULL);
-
- priv = task_widget->priv;
-
- priv->component_id = g_strdup (component_id);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (task_widget), frame);
- gtk_widget_show (frame);
-
- box = gtk_hbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (frame), box);
- gtk_widget_show (box);
-
- gtk_widget_set_size_request (box, 1, -1);
-
- priv->box = gtk_hbox_new (FALSE, 0);
- priv->image = e_spinner_new_spinning_small_shown ();
- gtk_widget_show (priv->box);
- gtk_box_pack_start (GTK_BOX (priv->box), priv->image, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (box), priv->box, FALSE, TRUE, 0);
- priv->label = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5);
- gtk_widget_show (priv->label);
- gtk_box_pack_start (GTK_BOX (box), priv->label, TRUE, TRUE, 0);
- if (cancel_func) {
- GdkPixbuf *pixbuf;
- GtkWidget *image;
- GtkWidget *tool;
-
- pixbuf = gtk_icon_theme_load_icon (
- gtk_icon_theme_get_default (),
- "gtk-stop", 16, 0, NULL);
- image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref (pixbuf);
-
- tool = (GtkWidget *) gtk_tool_button_new (image, NULL);
- gtk_box_pack_end (GTK_BOX (box), tool, FALSE, TRUE, 0);
- gtk_widget_show_all (tool);
-
- gtk_widget_set_sensitive (tool, cancel_func != NULL);
- priv->cancel_func = cancel_func;
- priv->data = data;
- g_signal_connect (tool, "clicked", G_CALLBACK (button_press_event_cb), task_widget);
- g_signal_connect (task_widget, "button-press-event", G_CALLBACK (prepare_popup), task_widget);
-
- }
-
- e_task_widget_update (task_widget, information, -1.0);
-}
-
-GtkWidget *
-e_task_widget_new_with_cancel (const char *component_id,
- const char *information,
- void (*cancel_func) (gpointer data),
- gpointer data)
-{
- ETaskWidget *task_widget;
-
- g_return_val_if_fail (information != NULL, NULL);
-
- task_widget = g_object_new (e_task_widget_get_type (), NULL);
- e_task_widget_construct (task_widget, component_id, information, cancel_func, data);
-
- return GTK_WIDGET (task_widget);
-}
-
-GtkWidget *
-e_task_widget_new (const char *component_id,
- const char *information)
-{
- ETaskWidget *task_widget;
-
- g_return_val_if_fail (information != NULL, NULL);
-
- task_widget = g_object_new (e_task_widget_get_type (), NULL);
- e_task_widget_construct (task_widget, component_id, information, NULL, NULL);
-
- return GTK_WIDGET (task_widget);
-}
-
-GtkWidget *
-e_task_widget_update_image (ETaskWidget *task_widget,
- const char *stock, const char *text)
-{
- GtkWidget *image, *tool;
- GdkPixbuf *pixbuf;
-
- pixbuf = gtk_icon_theme_load_icon (
- gtk_icon_theme_get_default (),
- stock, 16, 0, NULL);
- image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref (pixbuf);
-
- tool = (GtkWidget *) gtk_tool_button_new (image, NULL);
- gtk_box_pack_start (GTK_BOX(task_widget->priv->box), tool, FALSE, TRUE, 0);
- gtk_widget_show_all (task_widget->priv->box);
- gtk_widget_hide (task_widget->priv->image);
- task_widget->priv->image = image;
- gtk_label_set_text (GTK_LABEL (task_widget->priv->label), text);
-
- return tool;
-}
-
-
-void
-e_task_widget_update (ETaskWidget *task_widget,
- const char *information,
- double completion)
-{
- ETaskWidgetPrivate *priv;
- char *text;
-
- g_return_if_fail (task_widget != NULL);
- g_return_if_fail (E_IS_TASK_WIDGET (task_widget));
- g_return_if_fail (information != NULL);
-
- priv = task_widget->priv;
-
- if (completion < 0.0) {
- /* For Translator only: %s is status message that is displayed (eg "moving items", "updating objects") */
- text = g_strdup_printf (_("%s (...)"), information);
- } else {
- int percent_complete;
- percent_complete = (int) (completion * 100.0 + .5);
- /* For Translator only: %s is status message that is displayed (eg "moving items", "updating objects");
- %d is a number between 0 and 100, describing the percentage of operation complete */
- text = g_strdup_printf (_("%s (%d%% complete)"), information, percent_complete);
- }
-
- gtk_label_set_text (GTK_LABEL (priv->label), text);
-
- gtk_widget_set_tooltip_text (GTK_WIDGET (task_widget), text);
-
- g_free (text);
-}
-
-void
-e_task_wiget_alert (ETaskWidget *task_widget)
-{
- g_return_if_fail (task_widget != NULL);
- g_return_if_fail (E_IS_TASK_WIDGET (task_widget));
-}
-
-void
-e_task_wiget_unalert (ETaskWidget *task_widget)
-{
- g_return_if_fail (task_widget != NULL);
- g_return_if_fail (E_IS_TASK_WIDGET (task_widget));
-}
-
-
-const char *
-e_task_widget_get_component_id (ETaskWidget *task_widget)
-{
- g_return_val_if_fail (task_widget != NULL, NULL);
- g_return_val_if_fail (E_IS_TASK_WIDGET (task_widget), NULL);
-
- return task_widget->priv->component_id;
-}
-
diff --git a/widgets/misc/e-task-widget.h b/widgets/misc/e-task-widget.h
deleted file mode 100644
index 4770b9d108..0000000000
--- a/widgets/misc/e-task-widget.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_TASK_WIDGET_H_
-#define _E_TASK_WIDGET_H_
-
-#include <gtk/gtk.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_TASK_WIDGET (e_task_widget_get_type ())
-#define E_TASK_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TASK_WIDGET, ETaskWidget))
-#define E_TASK_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TASK_WIDGET, ETaskWidgetClass))
-#define E_IS_TASK_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TASK_WIDGET))
-#define E_IS_TASK_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_TASK_WIDGET))
-
-
-typedef struct _ETaskWidget ETaskWidget;
-typedef struct _ETaskWidgetPrivate ETaskWidgetPrivate;
-typedef struct _ETaskWidgetClass ETaskWidgetClass;
-
-struct _ETaskWidget {
- GtkEventBox parent;
-
- ETaskWidgetPrivate *priv;
- guint id;
-};
-
-struct _ETaskWidgetClass {
- GtkEventBoxClass parent_class;
-};
-
-
-GType e_task_widget_get_type (void);
-void e_task_widget_construct (ETaskWidget *task_widget,
- const char *component_id,
- const char *information,
- void (*cancel_func) (gpointer data),
- gpointer data);
-GtkWidget * e_task_widget_new (const char *component_id,
- const char *information);
-GtkWidget * e_task_widget_new_with_cancel (const char *component_id,
- const char *information,
- void (*cancel_func) (gpointer data),
- gpointer data);
-void e_task_widget_update (ETaskWidget *task_widget,
- const char *information,
- double completion);
-GtkWidget * e_task_widget_update_image (ETaskWidget *task_widget,
- const char *stock,
- const char *text);
-void e_task_wiget_alert (ETaskWidget *task_widget);
-void e_task_wiget_unalert (ETaskWidget *task_widget);
-const char * e_task_widget_get_component_id (ETaskWidget *task_widget);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TASK_WIDGET_H_ */
diff --git a/widgets/misc/e-timeout-activity.c b/widgets/misc/e-timeout-activity.c
new file mode 100644
index 0000000000..aa57960fe0
--- /dev/null
+++ b/widgets/misc/e-timeout-activity.c
@@ -0,0 +1,198 @@
+/*
+ * e-timeout-activity.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-timeout-activity.h"
+
+#include <stdarg.h>
+
+#define E_TIMEOUT_ACTIVITY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TIMEOUT_ACTIVITY, ETimeoutActivityPrivate))
+
+struct _ETimeoutActivityPrivate {
+ guint timeout_id;
+};
+
+enum {
+ TIMEOUT,
+ LAST_SIGNAL
+};
+
+static gpointer parent_class;
+static gulong signals[LAST_SIGNAL];
+
+static gboolean
+timeout_activity_cb (ETimeoutActivity *timeout_activity)
+{
+ g_signal_emit (timeout_activity, signals[TIMEOUT], 0);
+
+ return FALSE;
+}
+
+static void
+timeout_activity_finalize (GObject *object)
+{
+ ETimeoutActivityPrivate *priv;
+
+ priv = E_TIMEOUT_ACTIVITY_GET_PRIVATE (object);
+
+ if (priv->timeout_id > 0)
+ g_source_remove (priv->timeout_id);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+timeout_activity_cancelled (EActivity *activity)
+{
+ ETimeoutActivityPrivate *priv;
+
+ priv = E_TIMEOUT_ACTIVITY_GET_PRIVATE (activity);
+
+ if (priv->timeout_id > 0) {
+ g_source_remove (priv->timeout_id);
+ priv->timeout_id = 0;
+ }
+
+ /* Chain up to parent's cancelled() method. */
+ E_ACTIVITY_CLASS (parent_class)->cancelled (activity);
+}
+
+static void
+timeout_activity_completed (EActivity *activity)
+{
+ ETimeoutActivityPrivate *priv;
+
+ priv = E_TIMEOUT_ACTIVITY_GET_PRIVATE (activity);
+
+ if (priv->timeout_id > 0) {
+ g_source_remove (priv->timeout_id);
+ priv->timeout_id = 0;
+ }
+
+ /* Chain up to parent's completed() method. */
+ E_ACTIVITY_CLASS (parent_class)->completed (activity);
+}
+
+static void
+timeout_activity_timeout (ETimeoutActivity *timeout_activity)
+{
+ /* Allow subclasses to safely chain up. */
+}
+
+static void
+timeout_activity_class_init (ETimeoutActivityClass *class)
+{
+ GObjectClass *object_class;
+ EActivityClass *activity_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ETimeoutActivityPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = timeout_activity_finalize;
+
+ activity_class = E_ACTIVITY_CLASS (class);
+ activity_class->cancelled = timeout_activity_cancelled;
+ activity_class->completed = timeout_activity_completed;
+
+ class->timeout = timeout_activity_timeout;
+
+ signals[TIMEOUT] = g_signal_new (
+ "timeout",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ETimeoutActivityClass, timeout),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void
+timeout_activity_init (ETimeoutActivity *timeout_activity)
+{
+ timeout_activity->priv =
+ E_TIMEOUT_ACTIVITY_GET_PRIVATE (timeout_activity);
+}
+
+GType
+e_timeout_activity_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (ETimeoutActivityClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) timeout_activity_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ETimeoutActivity),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) timeout_activity_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_ACTIVITY, "ETimeoutActivity", &type_info, 0);
+ }
+
+ return type;
+}
+
+EActivity *
+e_timeout_activity_new (const gchar *primary_text)
+{
+ return g_object_new (
+ E_TYPE_TIMEOUT_ACTIVITY,
+ "primary-text", primary_text, NULL);
+}
+
+EActivity *
+e_timeout_activity_newv (const gchar *format, ...)
+{
+ EActivity *activity;
+ gchar *primary_text;
+ va_list args;
+
+ va_start (args, format);
+ primary_text = g_strdup_vprintf (format, args);
+ activity = e_timeout_activity_new (primary_text);
+ g_free (primary_text);
+ va_end (args);
+
+ return activity;
+}
+
+void
+e_timeout_activity_set_timeout (ETimeoutActivity *timeout_activity,
+ guint seconds)
+{
+ g_return_if_fail (E_IS_TIMEOUT_ACTIVITY (timeout_activity));
+
+ if (timeout_activity->priv->timeout_id > 0)
+ e_activity_cancel (E_ACTIVITY (timeout_activity));
+
+ timeout_activity->priv->timeout_id = g_timeout_add_seconds (
+ seconds, (GSourceFunc) timeout_activity_cb, timeout_activity);
+}
diff --git a/widgets/misc/e-timeout-activity.h b/widgets/misc/e-timeout-activity.h
new file mode 100644
index 0000000000..82dd1138c2
--- /dev/null
+++ b/widgets/misc/e-timeout-activity.h
@@ -0,0 +1,73 @@
+/*
+ * e-timeout-activity.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_TIMEOUT_ACTIVITY_H
+#define E_TIMEOUT_ACTIVITY_H
+
+#include <e-activity.h>
+
+/* Standard GObject macros */
+#define E_TYPE_TIMEOUT_ACTIVITY \
+ (e_timeout_activity_get_type ())
+#define E_TIMEOUT_ACTIVITY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_TIMEOUT_ACTIVITY, ETimeoutActivity))
+#define E_TIMEOUT_ACTIVITY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_TIMEOUT_ACTIVITY, ETimeoutActivityClass))
+#define E_IS_TIMEOUT_ACTIVITY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_TIMEOUT_ACTIVITY))
+#define E_IS_TIMEOUT_ACTIVITY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_TIMEOUT_ACTIVITY))
+#define E_TIMEOUT_ACTIVITY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_TIMEOUT_ACTIVITY, ETimeoutActivityClass))
+
+G_BEGIN_DECLS
+
+typedef struct _ETimeoutActivity ETimeoutActivity;
+typedef struct _ETimeoutActivityClass ETimeoutActivityClass;
+typedef struct _ETimeoutActivityPrivate ETimeoutActivityPrivate;
+
+struct _ETimeoutActivity {
+ EActivity parent;
+ ETimeoutActivityPrivate *priv;
+};
+
+struct _ETimeoutActivityClass {
+ EActivityClass parent_class;
+
+ /* Signals */
+ void (*timeout) (ETimeoutActivity *timeout_activity);
+};
+
+GType e_timeout_activity_get_type (void);
+EActivity * e_timeout_activity_new (const gchar *primary_text);
+EActivity * e_timeout_activity_newv (const gchar *format,
+ ...) G_GNUC_PRINTF (1, 2);
+void e_timeout_activity_set_timeout (ETimeoutActivity *timeout_activity,
+ guint seconds);
+
+G_END_DECLS
+
+#endif /* E_TIMEOUT_ACTIVITY_H */
diff --git a/widgets/misc/test-calendar.c b/widgets/misc/test-calendar.c
index 6852010b24..20f34d8ba8 100644
--- a/widgets/misc/test-calendar.c
+++ b/widgets/misc/test-calendar.c
@@ -118,7 +118,7 @@ on_date_range_changed (ECalendarItem *calitem)
start_day, start_month + 1, start_year,
end_day, end_month + 1, end_year);
- /* These days should appear bold. Remember month is 0 to 11. */
+ /* These days should windowear bold. Remember month is 0 to 11. */
e_calendar_item_mark_day (calitem, 2000, 7, 26, /* 26th Aug 2000. */
E_CALENDAR_ITEM_MARK_BOLD);
e_calendar_item_mark_day (calitem, 2000, 8, 13, /* 13th Sep 2000. */
diff --git a/widgets/misc/test-dropdown-button.c b/widgets/misc/test-dropdown-button.c
deleted file mode 100644
index b76174fb0e..0000000000
--- a/widgets/misc/test-dropdown-button.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <gtk/gtk.h>
-
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-app-helper.h>
-#include <libgnomeui/gnome-ui-init.h>
-
-#include "e-dropdown-button.h"
-
-
-/* (The following is shameless stolen from `testgnome.c'. */
-
-static void
-item_activated (GtkWidget *widget,
- void *data)
-{
- printf ("%s activated.\n", (char *) data);
-}
-
-static GnomeUIInfo ui_info[] = {
- { GNOME_APP_UI_ITEM, "_New", "Create a new file", item_activated, (gpointer) "file/new", NULL,
- GNOME_APP_PIXMAP_STOCK, GTK_STOCK_NEW, 'n', GDK_CONTROL_MASK, NULL },
- { GNOME_APP_UI_ITEM, "_Open...", "Open an existing file", item_activated, (gpointer) "file/open", NULL,
- GNOME_APP_PIXMAP_STOCK, GTK_STOCK_OPEN, 'o', GDK_CONTROL_MASK, NULL },
- { GNOME_APP_UI_ITEM, "_Save", "Save the current file", item_activated, (gpointer) "file/save", NULL,
- GNOME_APP_PIXMAP_STOCK, GTK_STOCK_SAVE, 's', GDK_CONTROL_MASK, NULL },
- { GNOME_APP_UI_ITEM, "Save _as...", "Save the current file with a new name", item_activated, (gpointer) "file/save as", NULL,
- GNOME_APP_PIXMAP_STOCK, GTK_STOCK_SAVE_AS, 0, 0, NULL },
-
- GNOMEUIINFO_SEPARATOR,
-
- { GNOME_APP_UI_ITEM, "_Print...", "Print the current file", item_activated, (gpointer) "file/print", NULL,
- GNOME_APP_PIXMAP_STOCK, GTK_STOCK_PRINT, 'p', GDK_CONTROL_MASK, NULL },
-
- GNOMEUIINFO_SEPARATOR,
-
- { GNOME_APP_UI_ITEM, "_Close", "Close the current file", item_activated, (gpointer) "file/close", NULL,
- GNOME_APP_PIXMAP_STOCK, GTK_STOCK_CLOSE, 0, 0, NULL },
- { GNOME_APP_UI_ITEM, "E_xit", "Exit the program", item_activated, (gpointer) "file/exit", NULL,
- GNOME_APP_PIXMAP_STOCK, GTK_STOCK_QUIT, 'q', GDK_CONTROL_MASK, NULL },
- GNOMEUIINFO_END
-};
-
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window;
- GtkWidget *menu;
- GtkWidget *dropdown_button;
-
- gnome_program_init (
- "test-dropdown-button", "0.0", LIBGNOMEUI_MODULE,
- argc, argv, GNOME_PARAM_NONE);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (window), 1, 1);
-
- menu = gtk_menu_new ();
-
- gnome_app_fill_menu (GTK_MENU_SHELL (menu), ui_info, NULL, TRUE, 0);
-
- dropdown_button = e_dropdown_button_new ("Me_nu", GTK_MENU (menu));
- gtk_container_add (GTK_CONTAINER (window), dropdown_button);
-
- gtk_widget_show (window);
- gtk_widget_show (dropdown_button);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/widgets/misc/test-error.c b/widgets/misc/test-error.c
deleted file mode 100644
index e67e6985f5..0000000000
--- a/widgets/misc/test-error.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-error.h"
-
-int
-main (int argc, char **argv)
-{
- gtk_init (&argc, &argv);
-
- argc--;
- switch (argc) {
- case 1:
- e_error_run(NULL, argv[1], NULL);
- break;
- case 2:
- e_error_run(NULL, argv[1], argv[2], NULL);
- break;
- case 3:
- e_error_run(NULL, argv[1], argv[2], argv[3], NULL);
- break;
- case 4:
- e_error_run(NULL, argv[1], argv[2], argv[3], argv[4], NULL);
- break;
- case 5:
- e_error_run(NULL, argv[1], argv[2], argv[3], argv[4], argv[5], NULL);
- break;
- case 6:
- e_error_run(NULL, argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], NULL);
- break;
- default:
- printf("Error: too many or too few arguments\n");
- printf("Usage:\n %s domain:error-id [ args ... ]\n", argv[0]);
- }
-
- return 0;
-}
diff --git a/widgets/misc/test-info-label.c b/widgets/misc/test-info-label.c
deleted file mode 100644
index 31298ed7c1..0000000000
--- a/widgets/misc/test-info-label.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-#include "e-info-label.h"
-
-static void
-delete_event_cb (GtkWidget *widget,
- GdkEventAny *event,
- gpointer data)
-{
- gtk_main_quit ();
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window;
- GtkWidget *info_label;
- GtkWidget *label;
- GtkWidget *vbox;
-
- gtk_init (&argc, &argv);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window), "EInfoLabel Test");
- gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
- gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
-
- g_signal_connect (window, "delete_event",
- G_CALLBACK (delete_event_cb), NULL);
-
- info_label = e_info_label_new ("stock_default-folder");
- e_info_label_set_info ((EInfoLabel *) info_label, "Component Name", "An annoyingly long component message");
- gtk_widget_show (info_label);
-
- label = gtk_label_new ("boo");
- gtk_widget_show (label);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), info_label, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_widget_show (window);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/widgets/misc/test-multi-config-dialog.c b/widgets/misc/test-preferences-window.c
index 34a7624a39..c0f13f5845 100644
--- a/widgets/misc/test-multi-config-dialog.c
+++ b/widgets/misc/test-preferences-window.c
@@ -1,4 +1,6 @@
/*
+ * test-preferences-window.c
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -13,49 +15,38 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
-#include "e-multi-config-dialog.c"
+#include "e-preferences-window.c"
#include <gtk/gtk.h>
-
#define NUM_PAGES 10
-
static void
-add_pages (EMultiConfigDialog *multi_config_dialog)
+add_pages (EPreferencesWindow *preferences_window)
{
int i;
for (i = 0; i < NUM_PAGES; i ++) {
GtkWidget *widget;
- GtkWidget *page;
- char *string;
- char *title;
- char *description;
+ char *caption;
+ char *page_name;
- string = g_strdup_printf ("This is page %d", i);
- description = g_strdup_printf ("Description of page %d", i);
- title = g_strdup_printf ("Title of page %d", i);
+ caption = g_strdup_printf ("Title of page %d", i);
+ page_name = g_strdup_printf ("page-%d", i);
- widget = gtk_label_new (string);
+ widget = gtk_label_new (caption);
gtk_widget_show (widget);
- page = e_config_page_new ();
- gtk_container_add (GTK_CONTAINER (page), widget);
-
- e_multi_config_dialog_add_page (multi_config_dialog, title, description, NULL,
- E_CONFIG_PAGE (page));
+ e_preferences_window_add_page (
+ preferences_window, page_name,
+ "gtk-properties", caption, widget, i);
- g_free (string);
- g_free (title);
- g_free (description);
+ g_free (caption);
+ g_free (page_name);
}
}
@@ -69,23 +60,23 @@ delete_event_callback (GtkWidget *widget,
return TRUE;
}
-
int
main (int argc, char **argv)
{
- GtkWidget *dialog;
+ GtkWidget *window;
gtk_init (&argc, &argv);
- dialog = e_multi_config_dialog_new ();
+ window = e_preferences_window_new ();
+ gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_signal_connect(
- dialog, "delete-event",
+ window, "delete-event",
G_CALLBACK (delete_event_callback), NULL);
- add_pages (E_MULTI_CONFIG_DIALOG (dialog));
+ add_pages (E_PREFERENCES_WINDOW (window));
- gtk_widget_show (dialog);
+ gtk_widget_show (window);
gtk_main ();
diff --git a/widgets/table/Makefile.am b/widgets/table/Makefile.am
index 0dbe1e6fe3..a53b249ce4 100644
--- a/widgets/table/Makefile.am
+++ b/widgets/table/Makefile.am
@@ -1,16 +1,11 @@
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = \
- $(top_builddir)/win32/libemiscwidgets.la \
- $(top_builddir)/win32/libetext.la
-endif
-
glade_DATA = \
e-table-config.glade \
e-table-field-chooser.glade
INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/widgets \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/widgets \
+ $(E_UTIL_CFLAGS) \
$(E_WIDGETS_CFLAGS) \
$(GNOME_PLATFORM_CFLAGS) \
-DEVOLUTION_GLADEDIR=\"$(gladedir)\" \
@@ -23,7 +18,9 @@ libetable_la_SOURCES = \
e-cell-checkbox.c \
e-cell-combo.c \
e-cell-date.c \
+ e-cell-date-edit.c \
e-cell-number.c \
+ e-cell-percent.c \
e-cell-pixbuf.c \
e-cell-popup.c \
e-cell-size.c \
@@ -75,7 +72,23 @@ libetable_la_SOURCES = \
e-tree-selection-model.c \
e-tree-sorted.c \
e-tree-table-adapter.c \
- e-tree.c
+ e-tree.c \
+ a11y/gal-a11y-e-cell.c \
+ a11y/gal-a11y-e-cell-popup.c \
+ a11y/gal-a11y-e-cell-registry.c \
+ a11y/gal-a11y-e-cell-text.c \
+ a11y/gal-a11y-e-cell-toggle.c \
+ a11y/gal-a11y-e-cell-tree.c \
+ a11y/gal-a11y-e-cell-vbox.c \
+ a11y/gal-a11y-e-table.c \
+ a11y/gal-a11y-e-table-click-to-add.c \
+ a11y/gal-a11y-e-table-click-to-add-factory.c \
+ a11y/gal-a11y-e-table-column-header.c \
+ a11y/gal-a11y-e-table-factory.c \
+ a11y/gal-a11y-e-table-item.c \
+ a11y/gal-a11y-e-table-item-factory.c \
+ a11y/gal-a11y-e-tree.c \
+ a11y/gal-a11y-e-tree-factory.c
libetableincludedir = $(privincludedir)/table
@@ -84,7 +97,9 @@ libetableinclude_HEADERS = \
e-cell-checkbox.h \
e-cell-combo.h \
e-cell-date.h \
+ e-cell-date-edit.h \
e-cell-number.h \
+ e-cell-percent.h \
e-cell-pixbuf.h \
e-cell-popup.h \
e-cell-size.h \
@@ -139,15 +154,34 @@ libetableinclude_HEADERS = \
e-tree-selection-model.h \
e-tree-sorted.h \
e-tree-table-adapter.h \
- e-tree.h
+ e-tree.h \
+ a11y/gal-a11y-e-cell.h \
+ a11y/gal-a11y-e-cell-popup.h \
+ a11y/gal-a11y-e-cell-registry.h \
+ a11y/gal-a11y-e-cell-text.h \
+ a11y/gal-a11y-e-cell-toggle.h \
+ a11y/gal-a11y-e-cell-tree.h \
+ a11y/gal-a11y-e-cell-vbox.h \
+ a11y/gal-a11y-e-table.h \
+ a11y/gal-a11y-e-table-click-to-add.h \
+ a11y/gal-a11y-e-table-click-to-add-factory.h \
+ a11y/gal-a11y-e-table-column-header.h \
+ a11y/gal-a11y-e-table-factory.h \
+ a11y/gal-a11y-e-table-item.h \
+ a11y/gal-a11y-e-table-item-factory.h \
+ a11y/gal-a11y-e-tree.h \
+ a11y/gal-a11y-e-tree-factory.h
libetable_la_LDFLAGS = $(NO_UNDEFINED)
libetable_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
- $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/a11y/libevolution-a11y.la \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/widgets/text/libetext.la \
+ $(E_UTIL_LIBS) \
$(E_WIDGETS_LIBS) \
+ $(MATH_LIB) \
$(GNOME_PLATFORM_LIBS)
icons = \
diff --git a/a11y/e-table/gal-a11y-e-cell-popup.c b/widgets/table/a11y/gal-a11y-e-cell-popup.c
index 5ae3cef686..5ae3cef686 100644
--- a/a11y/e-table/gal-a11y-e-cell-popup.c
+++ b/widgets/table/a11y/gal-a11y-e-cell-popup.c
diff --git a/a11y/e-table/gal-a11y-e-cell-popup.h b/widgets/table/a11y/gal-a11y-e-cell-popup.h
index 4bee17e8ce..52e0066d19 100644
--- a/a11y/e-table/gal-a11y-e-cell-popup.h
+++ b/widgets/table/a11y/gal-a11y-e-cell-popup.h
@@ -26,7 +26,7 @@
#include <glib-object.h>
#include <table/e-table-item.h>
-#include <a11y/e-table/gal-a11y-e-cell.h>
+#include <table/a11y/gal-a11y-e-cell.h>
#include <atk/atkgobjectaccessible.h>
#define GAL_A11Y_TYPE_E_CELL_POPUP (gal_a11y_e_cell_popup_get_type ())
diff --git a/a11y/e-table/gal-a11y-e-cell-registry.c b/widgets/table/a11y/gal-a11y-e-cell-registry.c
index 1da241fea9..1da241fea9 100644
--- a/a11y/e-table/gal-a11y-e-cell-registry.c
+++ b/widgets/table/a11y/gal-a11y-e-cell-registry.c
diff --git a/a11y/e-table/gal-a11y-e-cell-registry.h b/widgets/table/a11y/gal-a11y-e-cell-registry.h
index bc43a662cc..bc43a662cc 100644
--- a/a11y/e-table/gal-a11y-e-cell-registry.h
+++ b/widgets/table/a11y/gal-a11y-e-cell-registry.h
diff --git a/a11y/e-table/gal-a11y-e-cell-text.c b/widgets/table/a11y/gal-a11y-e-cell-text.c
index a2b9f715f8..a2b9f715f8 100644
--- a/a11y/e-table/gal-a11y-e-cell-text.c
+++ b/widgets/table/a11y/gal-a11y-e-cell-text.c
diff --git a/a11y/e-table/gal-a11y-e-cell-text.h b/widgets/table/a11y/gal-a11y-e-cell-text.h
index fe404169a1..32fce8771c 100644
--- a/a11y/e-table/gal-a11y-e-cell-text.h
+++ b/widgets/table/a11y/gal-a11y-e-cell-text.h
@@ -26,7 +26,7 @@
#include <glib-object.h>
#include <table/e-table-item.h>
#include <table/e-cell-text.h>
-#include <a11y/e-table/gal-a11y-e-cell.h>
+#include <table/a11y/gal-a11y-e-cell.h>
#define GAL_A11Y_TYPE_E_CELL_TEXT (gal_a11y_e_cell_text_get_type ())
#define GAL_A11Y_E_CELL_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_CELL_TEXT, GalA11yECellText))
diff --git a/a11y/e-table/gal-a11y-e-cell-toggle.c b/widgets/table/a11y/gal-a11y-e-cell-toggle.c
index c0425a0cbb..c0425a0cbb 100644
--- a/a11y/e-table/gal-a11y-e-cell-toggle.c
+++ b/widgets/table/a11y/gal-a11y-e-cell-toggle.c
diff --git a/a11y/e-table/gal-a11y-e-cell-toggle.h b/widgets/table/a11y/gal-a11y-e-cell-toggle.h
index 769e0b4200..769e0b4200 100644
--- a/a11y/e-table/gal-a11y-e-cell-toggle.h
+++ b/widgets/table/a11y/gal-a11y-e-cell-toggle.h
diff --git a/a11y/e-table/gal-a11y-e-cell-tree.c b/widgets/table/a11y/gal-a11y-e-cell-tree.c
index 0a5f8e2019..0a5f8e2019 100644
--- a/a11y/e-table/gal-a11y-e-cell-tree.c
+++ b/widgets/table/a11y/gal-a11y-e-cell-tree.c
diff --git a/a11y/e-table/gal-a11y-e-cell-tree.h b/widgets/table/a11y/gal-a11y-e-cell-tree.h
index 43169c2f28..43169c2f28 100644
--- a/a11y/e-table/gal-a11y-e-cell-tree.h
+++ b/widgets/table/a11y/gal-a11y-e-cell-tree.h
diff --git a/a11y/e-table/gal-a11y-e-cell-vbox.c b/widgets/table/a11y/gal-a11y-e-cell-vbox.c
index 7a5eadba52..7a5eadba52 100644
--- a/a11y/e-table/gal-a11y-e-cell-vbox.c
+++ b/widgets/table/a11y/gal-a11y-e-cell-vbox.c
diff --git a/a11y/e-table/gal-a11y-e-cell-vbox.h b/widgets/table/a11y/gal-a11y-e-cell-vbox.h
index 2055ac3195..2055ac3195 100644
--- a/a11y/e-table/gal-a11y-e-cell-vbox.h
+++ b/widgets/table/a11y/gal-a11y-e-cell-vbox.h
diff --git a/a11y/e-table/gal-a11y-e-cell.c b/widgets/table/a11y/gal-a11y-e-cell.c
index 3b74675ae5..3b74675ae5 100644
--- a/a11y/e-table/gal-a11y-e-cell.c
+++ b/widgets/table/a11y/gal-a11y-e-cell.c
diff --git a/a11y/e-table/gal-a11y-e-cell.h b/widgets/table/a11y/gal-a11y-e-cell.h
index af96c69d47..af96c69d47 100644
--- a/a11y/e-table/gal-a11y-e-cell.h
+++ b/widgets/table/a11y/gal-a11y-e-cell.h
diff --git a/a11y/e-table/gal-a11y-e-table-click-to-add-factory.c b/widgets/table/a11y/gal-a11y-e-table-click-to-add-factory.c
index 0ebb3c4621..0ebb3c4621 100644
--- a/a11y/e-table/gal-a11y-e-table-click-to-add-factory.c
+++ b/widgets/table/a11y/gal-a11y-e-table-click-to-add-factory.c
diff --git a/a11y/e-table/gal-a11y-e-table-click-to-add-factory.h b/widgets/table/a11y/gal-a11y-e-table-click-to-add-factory.h
index 9f249f0178..9f249f0178 100644
--- a/a11y/e-table/gal-a11y-e-table-click-to-add-factory.h
+++ b/widgets/table/a11y/gal-a11y-e-table-click-to-add-factory.h
diff --git a/a11y/e-table/gal-a11y-e-table-click-to-add.c b/widgets/table/a11y/gal-a11y-e-table-click-to-add.c
index ed417e1601..ed417e1601 100644
--- a/a11y/e-table/gal-a11y-e-table-click-to-add.c
+++ b/widgets/table/a11y/gal-a11y-e-table-click-to-add.c
diff --git a/a11y/e-table/gal-a11y-e-table-click-to-add.h b/widgets/table/a11y/gal-a11y-e-table-click-to-add.h
index 17d6940d08..17d6940d08 100644
--- a/a11y/e-table/gal-a11y-e-table-click-to-add.h
+++ b/widgets/table/a11y/gal-a11y-e-table-click-to-add.h
diff --git a/a11y/e-table/gal-a11y-e-table-column-header.c b/widgets/table/a11y/gal-a11y-e-table-column-header.c
index 4df75cc564..4df75cc564 100644
--- a/a11y/e-table/gal-a11y-e-table-column-header.c
+++ b/widgets/table/a11y/gal-a11y-e-table-column-header.c
diff --git a/a11y/e-table/gal-a11y-e-table-column-header.h b/widgets/table/a11y/gal-a11y-e-table-column-header.h
index d0b1ff5aeb..d0b1ff5aeb 100644
--- a/a11y/e-table/gal-a11y-e-table-column-header.h
+++ b/widgets/table/a11y/gal-a11y-e-table-column-header.h
diff --git a/a11y/e-table/gal-a11y-e-table-factory.c b/widgets/table/a11y/gal-a11y-e-table-factory.c
index f459f3b67c..f459f3b67c 100644
--- a/a11y/e-table/gal-a11y-e-table-factory.c
+++ b/widgets/table/a11y/gal-a11y-e-table-factory.c
diff --git a/a11y/e-table/gal-a11y-e-table-factory.h b/widgets/table/a11y/gal-a11y-e-table-factory.h
index 3439cf0bdc..3439cf0bdc 100644
--- a/a11y/e-table/gal-a11y-e-table-factory.h
+++ b/widgets/table/a11y/gal-a11y-e-table-factory.h
diff --git a/a11y/e-table/gal-a11y-e-table-item-factory.c b/widgets/table/a11y/gal-a11y-e-table-item-factory.c
index fa14652788..fa14652788 100644
--- a/a11y/e-table/gal-a11y-e-table-item-factory.c
+++ b/widgets/table/a11y/gal-a11y-e-table-item-factory.c
diff --git a/a11y/e-table/gal-a11y-e-table-item-factory.h b/widgets/table/a11y/gal-a11y-e-table-item-factory.h
index f27c491a4d..f27c491a4d 100644
--- a/a11y/e-table/gal-a11y-e-table-item-factory.h
+++ b/widgets/table/a11y/gal-a11y-e-table-item-factory.h
diff --git a/a11y/e-table/gal-a11y-e-table-item.c b/widgets/table/a11y/gal-a11y-e-table-item.c
index 935f53b83b..935f53b83b 100644
--- a/a11y/e-table/gal-a11y-e-table-item.c
+++ b/widgets/table/a11y/gal-a11y-e-table-item.c
diff --git a/a11y/e-table/gal-a11y-e-table-item.h b/widgets/table/a11y/gal-a11y-e-table-item.h
index 27d6a8244b..27d6a8244b 100644
--- a/a11y/e-table/gal-a11y-e-table-item.h
+++ b/widgets/table/a11y/gal-a11y-e-table-item.h
diff --git a/a11y/e-table/gal-a11y-e-table.c b/widgets/table/a11y/gal-a11y-e-table.c
index 1966fb29ee..1966fb29ee 100644
--- a/a11y/e-table/gal-a11y-e-table.c
+++ b/widgets/table/a11y/gal-a11y-e-table.c
diff --git a/a11y/e-table/gal-a11y-e-table.h b/widgets/table/a11y/gal-a11y-e-table.h
index d8f972df81..d8f972df81 100644
--- a/a11y/e-table/gal-a11y-e-table.h
+++ b/widgets/table/a11y/gal-a11y-e-table.h
diff --git a/a11y/e-table/gal-a11y-e-tree-factory.c b/widgets/table/a11y/gal-a11y-e-tree-factory.c
index 8dc06e2936..8dc06e2936 100644
--- a/a11y/e-table/gal-a11y-e-tree-factory.c
+++ b/widgets/table/a11y/gal-a11y-e-tree-factory.c
diff --git a/a11y/e-table/gal-a11y-e-tree-factory.h b/widgets/table/a11y/gal-a11y-e-tree-factory.h
index 3d97c7a3b1..3d97c7a3b1 100644
--- a/a11y/e-table/gal-a11y-e-tree-factory.h
+++ b/widgets/table/a11y/gal-a11y-e-tree-factory.h
diff --git a/a11y/e-table/gal-a11y-e-tree.c b/widgets/table/a11y/gal-a11y-e-tree.c
index 4ecce81501..4ecce81501 100644
--- a/a11y/e-table/gal-a11y-e-tree.c
+++ b/widgets/table/a11y/gal-a11y-e-tree.c
diff --git a/a11y/e-table/gal-a11y-e-tree.h b/widgets/table/a11y/gal-a11y-e-tree.h
index d2aa8a0d2a..d2aa8a0d2a 100644
--- a/a11y/e-table/gal-a11y-e-tree.h
+++ b/widgets/table/a11y/gal-a11y-e-tree.h
diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c
index 80d6294b2d..688bb1a508 100644
--- a/widgets/table/e-cell-combo.c
+++ b/widgets/table/e-cell-combo.c
@@ -62,7 +62,7 @@
#include <glib/gi18n.h>
#include "e-util/e-util.h"
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
#include "e-table-item.h"
#include "e-cell-combo.h"
diff --git a/widgets/misc/e-cell-date-edit.c b/widgets/table/e-cell-date-edit.c
index e994120b33..2bee6f54a8 100644
--- a/widgets/misc/e-cell-date-edit.c
+++ b/widgets/table/e-cell-date-edit.c
@@ -39,15 +39,15 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
-#include <table/e-table-item.h>
-#include <table/e-cell-text.h>
+#include "e-table-item.h"
+#include "e-cell-text.h"
#include <glib/gi18n.h>
#include <libedataserver/e-time-utils.h>
/* This depends on ECalendar which is why I didn't put it in gal. */
-#include "e-calendar.h"
+#include <misc/e-calendar.h>
static void e_cell_date_edit_destroy (GtkObject *object);
static void e_cell_date_edit_get_property (GObject *object,
diff --git a/widgets/misc/e-cell-date-edit.h b/widgets/table/e-cell-date-edit.h
index 2e125fece3..2e125fece3 100644
--- a/widgets/misc/e-cell-date-edit.h
+++ b/widgets/table/e-cell-date-edit.h
diff --git a/widgets/table/e-cell-date.c b/widgets/table/e-cell-date.c
index 92c0dd98b6..53bceb557d 100644
--- a/widgets/table/e-cell-date.c
+++ b/widgets/table/e-cell-date.c
@@ -29,7 +29,7 @@
#include <glib/gi18n.h>
#include "e-util/e-util.h"
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
#include "e-cell-date.h"
diff --git a/widgets/table/e-cell-hbox.c b/widgets/table/e-cell-hbox.c
index f84d8761c7..963e446738 100644
--- a/widgets/table/e-cell-hbox.c
+++ b/widgets/table/e-cell-hbox.c
@@ -32,8 +32,8 @@
#include <gtk/gtk.h>
-/* #include "a11y/e-table/gal-a11y-e-cell-registry.h" */
-/* #include "a11y/e-table/gal-a11y-e-cell-vbox.h" */
+/* #include "a11y/gal-a11y-e-cell-registry.h" */
+/* #include "a11y/gal-a11y-e-cell-vbox.h" */
#include "e-util/e-util.h"
#include "e-cell-hbox.h"
diff --git a/widgets/misc/e-cell-percent.c b/widgets/table/e-cell-percent.c
index 194a7bd6b6..194a7bd6b6 100644
--- a/widgets/misc/e-cell-percent.c
+++ b/widgets/table/e-cell-percent.c
diff --git a/widgets/misc/e-cell-percent.h b/widgets/table/e-cell-percent.h
index 5e202dfa82..5e202dfa82 100644
--- a/widgets/misc/e-cell-percent.h
+++ b/widgets/table/e-cell-percent.h
diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c
index 8a8918dc70..83fe9cb087 100644
--- a/widgets/table/e-cell-popup.c
+++ b/widgets/table/e-cell-popup.c
@@ -33,8 +33,8 @@
#include <gdk/gdkkeysyms.h>
-#include "a11y/e-table/gal-a11y-e-cell-popup.h"
-#include "a11y/e-table/gal-a11y-e-cell-registry.h"
+#include "a11y/gal-a11y-e-cell-popup.h"
+#include "a11y/gal-a11y-e-cell-registry.h"
#include "e-util/e-util.h"
#include "e-cell-popup.h"
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 3a03fe51e7..f330d64392 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -45,15 +45,15 @@
#include <libgnomecanvas/gnome-canvas.h>
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
-#include "a11y/e-table/gal-a11y-e-cell-registry.h"
-#include "a11y/e-table/gal-a11y-e-cell-text.h"
+#include "a11y/gal-a11y-e-cell-registry.h"
+#include "a11y/gal-a11y-e-cell-text.h"
#include "text/e-text.h"
#include <glib/gi18n.h>
#include "e-util/e-text-event-processor.h"
#include "e-util/e-text-event-processor-emacs-like.h"
#include "e-util/e-util.h"
#include "misc/e-canvas.h"
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
#include "e-cell-text.h"
#include "e-table-item.h"
diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c
index 69dc1b27bb..f441d5ea17 100644
--- a/widgets/table/e-cell-toggle.c
+++ b/widgets/table/e-cell-toggle.c
@@ -28,8 +28,8 @@
#include <gtk/gtk.h>
#include <libgnomecanvas/gnome-canvas.h>
-#include "a11y/e-table/gal-a11y-e-cell-toggle.h"
-#include "a11y/e-table/gal-a11y-e-cell-registry.h"
+#include "a11y/gal-a11y-e-cell-toggle.h"
+#include "a11y/gal-a11y-e-cell-registry.h"
#include "e-util/e-util.h"
#include "misc/e-hsv-utils.h"
diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c
index eb7e428fb9..e9cb30bb23 100644
--- a/widgets/table/e-cell-tree.c
+++ b/widgets/table/e-cell-tree.c
@@ -38,8 +38,8 @@
#include <gtk/gtk.h>
#include <libgnomecanvas/gnome-canvas.h>
-#include "a11y/e-table/gal-a11y-e-cell-registry.h"
-#include "a11y/e-table/gal-a11y-e-cell-tree.h"
+#include "a11y/gal-a11y-e-cell-registry.h"
+#include "a11y/gal-a11y-e-cell-tree.h"
#include "e-util/e-util.h"
#include "e-cell-tree.h"
diff --git a/widgets/table/e-cell-vbox.c b/widgets/table/e-cell-vbox.c
index 1fd770ab6a..7fb74c9ae1 100644
--- a/widgets/table/e-cell-vbox.c
+++ b/widgets/table/e-cell-vbox.c
@@ -29,8 +29,8 @@
#include <gtk/gtk.h>
-#include "a11y/e-table/gal-a11y-e-cell-registry.h"
-#include "a11y/e-table/gal-a11y-e-cell-vbox.h"
+#include "a11y/gal-a11y-e-cell-registry.h"
+#include "a11y/gal-a11y-e-cell-vbox.h"
#include "e-util/e-util.h"
#include "e-cell-vbox.h"
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c
index 879b8c34af..1c608bd607 100644
--- a/widgets/table/e-table-click-to-add.c
+++ b/widgets/table/e-table-click-to-add.c
@@ -29,7 +29,7 @@
#include <libgnomecanvas/gnome-canvas-util.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "a11y/e-table/gal-a11y-e-table-click-to-add.h"
+#include "a11y/gal-a11y-e-table-click-to-add.h"
#include "text/e-text.h"
#include <glib/gi18n.h>
#include "e-util/e-util.h"
diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c
index 06f98066bb..d9506d0a9f 100644
--- a/widgets/table/e-table-config.c
+++ b/widgets/table/e-table-config.c
@@ -38,7 +38,7 @@
#include <glib/gi18n.h>
#include "e-util/e-util-private.h"
#include "e-util/e-util.h"
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
#include "e-table-config.h"
#include "e-table-memory-store.h"
diff --git a/widgets/table/e-table-example-1.c b/widgets/table/e-table-example-1.c
deleted file mode 100644
index b1eae4cc40..0000000000
--- a/widgets/table/e-table-example-1.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#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_size_request (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_colormap (gdk_rgb_get_colormap ());
-
- create_table ();
-
- gtk_main ();
-
- e_cursors_shutdown ();
- return 0;
-}
-
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index 5af40532f8..2d3d32e138 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -31,7 +31,7 @@
#include "e-util/e-util.h"
#include "misc/e-canvas-utils.h"
#include "misc/e-canvas.h"
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
#include "e-table-defines.h"
#include "e-table-group-container.h"
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 62c00f94a4..e25e8da79f 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -913,7 +913,10 @@ ethi_unrealize (GnomeCanvasItem *item)
{
ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
- pango_font_description_free (ethi->font_desc);
+ if (ethi->font_desc != NULL) {
+ pango_font_description_free (ethi->font_desc);
+ ethi->font_desc = NULL;
+ }
g_signal_handler_disconnect (item->canvas, ethi->drag_motion_id);
g_signal_handler_disconnect (item->canvas, ethi->drag_leave_id);
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
index ae5ebf871f..a8a533f35d 100644
--- a/widgets/table/e-table-header-utils.c
+++ b/widgets/table/e-table-header-utils.c
@@ -29,7 +29,7 @@
#include <gtk/gtk.h>
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
#include "e-table-defines.h"
#include "e-table-header-utils.h"
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index ce2484cafb..f423e75c2a 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -36,8 +36,8 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
-#include "a11y/e-table/gal-a11y-e-table-item-factory.h"
-#include "a11y/e-table/gal-a11y-e-table-item.h"
+#include "a11y/gal-a11y-e-table-item-factory.h"
+#include "a11y/gal-a11y-e-table-item.h"
#include <glib/gi18n.h>
#include "e-util/e-util.h"
#include "misc/e-canvas.h"
diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c
index 6e87a2a6ce..a7a449d1b7 100644
--- a/widgets/table/e-table-utils.c
+++ b/widgets/table/e-table-utils.c
@@ -27,7 +27,7 @@
#include <string.h>
#include "e-util/e-util.h"
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
#include "e-table-utils.h"
#include "e-table-header-utils.h"
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index b48fd454f1..d0c8519435 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -36,13 +36,13 @@
#include <libgnomecanvas/gnome-canvas.h>
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
-#include "a11y/e-table/gal-a11y-e-table.h"
+#include "a11y/gal-a11y-e-table.h"
#include <glib/gi18n.h>
#include "e-util/e-util.h"
#include "misc/e-canvas.h"
#include "misc/e-canvas-background.h"
#include "misc/e-canvas-vbox.h"
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
#include "e-table.h"
#include "e-table-click-to-add.h"
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index e58ac1bdd9..2ec7c8ba09 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -30,7 +30,7 @@
#include <gtk/gtk.h>
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
-#include "a11y/e-table/gal-a11y-e-tree.h"
+#include "a11y/gal-a11y-e-tree.h"
#include <glib/gi18n.h>
#include "e-util/e-util.h"
#include "misc/e-canvas.h"
diff --git a/widgets/text/Makefile.am b/widgets/text/Makefile.am
index fbe03c828f..e035d8714d 100644
--- a/widgets/text/Makefile.am
+++ b/widgets/text/Makefile.am
@@ -1,7 +1,3 @@
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = $(top_builddir)/win32/libemiscwidgets.la
-endif
-
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/widgets \
@@ -15,22 +11,29 @@ privsolib_LTLIBRARIES = libetext.la
libetext_la_SOURCES = \
e-text-model-repos.c \
e-text-model.c \
- e-text.c
+ e-text.c \
+ e-reflow.c \
+ e-reflow-model.c \
+ a11y/gal-a11y-e-text-factory.c \
+ a11y/gal-a11y-e-text.c
libetextincludedir = $(privincludedir)/text
libetextinclude_HEADERS = \
e-text-model-repos.h \
e-text-model.h \
- e-text.h
+ e-text.h \
+ e-reflow.h \
+ e-reflow-model.h \
+ a11y/gal-a11y-e-text-factory.h \
+ a11y/gal-a11y-e-text.h
libetext_la_LDFLAGS = $(NO_UNDEFINED)
libetext_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
- $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/a11y/libevolution-a11y.la \
- $(top_builddir)/widgets/table/libetable.la \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
$(E_UTIL_LIBS) \
$(GNOME_PLATFORM_LIBS) \
$(REGEX_LIBS)
diff --git a/a11y/e-text/gal-a11y-e-text-factory.c b/widgets/text/a11y/gal-a11y-e-text-factory.c
index 2df9241014..2df9241014 100644
--- a/a11y/e-text/gal-a11y-e-text-factory.c
+++ b/widgets/text/a11y/gal-a11y-e-text-factory.c
diff --git a/a11y/e-text/gal-a11y-e-text-factory.h b/widgets/text/a11y/gal-a11y-e-text-factory.h
index df7638f64f..df7638f64f 100644
--- a/a11y/e-text/gal-a11y-e-text-factory.h
+++ b/widgets/text/a11y/gal-a11y-e-text-factory.h
diff --git a/a11y/e-text/gal-a11y-e-text.c b/widgets/text/a11y/gal-a11y-e-text.c
index 98484949ff..98484949ff 100644
--- a/a11y/e-text/gal-a11y-e-text.c
+++ b/widgets/text/a11y/gal-a11y-e-text.c
diff --git a/a11y/e-text/gal-a11y-e-text.h b/widgets/text/a11y/gal-a11y-e-text.h
index 6a5bb80de0..6a5bb80de0 100644
--- a/a11y/e-text/gal-a11y-e-text.h
+++ b/widgets/text/a11y/gal-a11y-e-text.h
diff --git a/widgets/misc/e-reflow-model.c b/widgets/text/e-reflow-model.c
index d24b915e6e..d24b915e6e 100644
--- a/widgets/misc/e-reflow-model.c
+++ b/widgets/text/e-reflow-model.c
diff --git a/widgets/misc/e-reflow-model.h b/widgets/text/e-reflow-model.h
index c772621d07..c772621d07 100644
--- a/widgets/misc/e-reflow-model.h
+++ b/widgets/text/e-reflow-model.h
diff --git a/widgets/misc/e-reflow.c b/widgets/text/e-reflow.c
index 129046a89e..95f3f89bab 100644
--- a/widgets/misc/e-reflow.c
+++ b/widgets/text/e-reflow.c
@@ -30,12 +30,12 @@
#include "text/e-text.h"
#include <glib/gi18n.h>
#include "e-util/e-util.h"
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
-#include "e-canvas.h"
-#include "e-canvas-utils.h"
+#include "misc/e-canvas.h"
+#include "misc/e-canvas-utils.h"
#include "e-reflow.h"
-#include "e-selection-model-simple.h"
+#include "misc/e-selection-model-simple.h"
static gboolean e_reflow_event (GnomeCanvasItem *item, GdkEvent *event);
static void e_reflow_realize (GnomeCanvasItem *item);
diff --git a/widgets/misc/e-reflow.h b/widgets/text/e-reflow.h
index 69f34d0fd9..3ea840d358 100644
--- a/widgets/misc/e-reflow.h
+++ b/widgets/text/e-reflow.h
@@ -24,7 +24,7 @@
#define __E_REFLOW_H__
#include <libgnomecanvas/gnome-canvas.h>
-#include <misc/e-reflow-model.h>
+#include <text/e-reflow-model.h>
#include <misc/e-selection-model.h>
#include <e-util/e-sorter-array.h>
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index c225636885..b30cf05b0c 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -46,10 +46,10 @@
#include <gtk/gtk.h>
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
-#include "a11y/e-text/gal-a11y-e-text.h"
+#include "a11y/gal-a11y-e-text.h"
#include "misc/e-canvas.h"
#include "misc/e-canvas-utils.h"
-#include "misc/e-unicode.h"
+#include "e-util/e-unicode.h"
#include <glib/gi18n.h>
#include "e-util/e-text-event-processor-emacs-like.h"
#include "e-util/e-util.h"