diff options
308 files changed, 3951 insertions, 66051 deletions
diff --git a/.cvsignore b/.cvsignore index 6df7b90c42..22eb595076 100644 --- a/.cvsignore +++ b/.cvsignore @@ -22,7 +22,6 @@ stamp-h.in stamp.h xlibtool xltmain.sh -evolution.desktop evolution.spec xml-i18n-* - +evolution.desktop @@ -1,87 +1,48 @@ -2001-03-13 Chris Toshok <toshok@ximian.com> +2001-03-13 Ettore Perazzoli <ettore@ximian.com> - * configure.in: add -lresolv to LDAP_LIBS if it's there. + * configure.in: Don't autogen the Makefiles in `camel/tests'. -2001-03-13 Iain Holmes <iain@ximian.com> + * art/Makefile.am (EXTRA_DIST): Add `$(conduits_DATA)', + `$(buttons_DATA)'. - * configure.in: Added the mail/importers dir. + * configure.in: Remove `calendar/gui/alarm-notify/Makefile' from + `AC_OUTPUT()'. -2001-03-12 Jeffrey Stedfast <fejj@ximian.com> + * Makefile.am (SUBDIRS): Add `doc'. - * README: Rearranged some of the dependencies to try to get them - into a more correct order (needed for people building all of these - packages by hand). +2001-03-13 Ettore Perazzoli <ettore@ximian.com> -2001-03-12 JP Rosevear <jpr@ximian.com> + * configure.in: Refined the GNOME VFS check a bit: don't spit out + an extra `AC_MSG_RESULT()'/`AC_MSG_ERROR()', and be consistent + about the version number in the message. - * README: Update +2001-03-13 Ettore Perazzoli <ettore@ximian.com> -2001-03-09 Dan Winship <danw@ximian.com> + * configure.in: Check for `Editor.idl' using `$GNOME_PATH' as + well. - * configure.in (EVOLUTION_MICRO_VERSION): Hm... probably would be - clever to be calling this 0.9 rather than 0.8, since it's almost - 0.10. +2001-03-12 Ettore Perazzoli <ettore@ximian.com> -2001-03-09 Christopher James Lahey <clahey@ximian.com> + * NEWS: Updated again for the release. - * libversit/vcc.y: Changed int to char when returning a character - from a stream (since it needs to be able to hold EOF.) +2001-03-12 Ettore Perazzoli <ettore@ximian.com> -2001-03-07 Jeffrey Stedfast <fejj@ximian.com> + * configure.in: Require Bonobo 0.37 and gnome-vfs 0.6.2. - * configure.in: Removed --enable-assbarn-security and replaced it - with the real options: - --with-nspr-includes=PREFIX - --with-nspr-libs=PREFIX - --with-nss=PREFIX + * README: Updated accordingly. - * acconfig.h: #undef HAVE_NSS - -2001-03-07 Ettore Perazzoli <ettore@ximian.com> - - * configure.in: Require GAL 0.5.99.6 or later. - -2001-03-07 Kjartan Maraas <kmaraas@gnome.org> +2001-03-12 JP Rosevear <jpr@ximian.com> - * shell/main: /* xgettext:no-c-format */ before the welcome - message. - * configure.in: Don't try to generate a Makefile in - camel/providers/vee as it's empty. + * art/Makefile.am: install conduit images -2001-03-05 JP Rosevear <jpr@ximian.com> - - * README: Update pilot instructions - -2001-03-05 Christopher James Lahey <clahey@ximian.com> - - * configure.in: Check for gal 0.5.99.4. - -2001-03-04 Dan Winship <danw@ximian.com> - - * configure.in: Reorganize a bit to get rid of warnings about - AC_TRY_COMPILE being used before AC_ISC_POSIX - -2001-03-04 Christopher James Lahey <clahey@ximian.com> - - * configure.in: Added views/addressbook/Makefile. - -2001-03-02 JP Rosevear <jpr@ximian.com> - - * art/Makefile.am: install conduit icons - -2001-03-02 Chris Toshok <toshok@ximian.com> - - * configure.in: add logic to make sure we're building against OpenLDAP >= 2 - -2001-03-01 Christopher James Lahey <clahey@ximian.com> +2001-03-12 JP Rosevear <jpr@ximian.com> - * Makefile.am (SUBDIRS), configure.in: Added views stuff. + * README: Update -2001-03-01 Dan Winship <danw@ximian.com> +2001-03-09 Christopher James Lahey <clahey@ximian.com> - * configure.in: Redo the Kerberos stuff again to deal with the - stuff currently on my machine. I think it should deal with both - the MIT and KTH versions of both krb4 and krb5 now. + * libversit/vcc.y: Changed int to char when returning a character + from a stream (since it needs to be able to hold EOF.) 2001-03-01 Jakub Steiner <jimmac@ximian.com> @@ -94,62 +55,47 @@ * art/48_evo-calendar-conduit.png: for new gnomecc * art/16_evo-calendar-conduit.png: for old gnomecc -2001-03-01 Christopher James Lahey <clahey@ximian.com> - - * configure.in: Check for gal 0.5.99.2. +2001-02-27 Christopher James Lahey <clahey@ximian.com> -2001-02-19 Christopher James Lahey <clahey@ximian.com> + * NEWS (Addressbook): Updated NEWS. - * configure.in: Check for gal 0.5.99.1. +2001-02-27 Ettore Perazzoli <ettore@ximian.com> -2001-02-15 Christopher James Lahey <clahey@ximian.com> + * configure.in: `executive-summary/widgets' doesn't need to be + built anymore. - * configure.in: Check for gal 0.5.99.0. +2001-02-27 JP Rosevear <jpr@ximian.com> -2001-02-14 Dan Winship <danw@ximian.com> + * NEWS: add a little pilot info - * various .cvsignore files: Ignore generated .oaf files +2001-02-27 Ettore Perazzoli <ettore@ximian.com> -2001-02-13 JP Rosevear <jpr@ximian.com> + * configure.in (EVOLUTION_MICRO_VERSION): Bump up to 9. - * art/Makefile.am: install new files +2001-02-15 Ettore Perazzoli <ettore@ximian.com> - * art/*view.xpm: add files from calendar/gui + * configure.in: Add `doc/devel/executive-summary/Makefile'. -2001-02-11 Chris Toshok <toshok@ximian.com> - - * configure.in: rework ldap check logic so it'll work to - --disable-ldap if you've previously configured with --enable-ldap. - -2001-02-11 Gediminas Paulauskas <menesis@delfi.lt> +2001-02-11 Gediminas Paulauskas <menesis@delfi.lt> * data/evolution.keys, evolution.desktop: removed, they are generated. * data/evolution.keys.in, evolution.desktop.in: new untranslated files. - * data/evolution.desktop: removed, it duplicates above. - * Makefile.am, data/Makefile.am: reflect above changes, merge - translations. - -2001-02-09 Jeffrey Stedfast <fejj@ximian.com> - - * configure.in: Added hacks to check for Mozilla libs like nspr - and nss that we will need for SSL and S/MIME. + * data/evolution.desktop: removed, it duplicates above. + * Makefile.am, data/Makefile.am: reflect above changes, merge + translations. 2001-02-09 Michael Meeks <michael@ximian.com> - * configure.in: depend on bonobo >= 0.36 + * configure.in: depend on bonobo >= 0.36 and gal >= 0.5 -2001-02-08 Christopher James Lahey <clahey@ximian.com> - - * configure.in: Upped the version number of gal required to 0.5. +2001-02-07 Kjartan Maraas <kmaraas@gnome.org> + * Makefile.am: xml-i18n-tools adjustment. + 2001-02-07 JP Rosevear <jpr@ximian.com> * README: Update to latest requirements -2001-02-05 Jeffrey Stedfast <fejj@ximian.com> - - * .cvsignore: Added xml-* files. - 2001-02-05 Gustavo Maciel Dias Vieira <gdvieira@zaz.com.br> * configure.in (ALL_LINGUAS): Added pt_BR to ALL_LINGUAS. diff --git a/Makefile.am b/Makefile.am index 065e218ad5..60e20931f1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,6 +44,6 @@ SUBDIRS = \ art \ ui \ default_user \ - views \ tools \ + doc \ po @@ -1,5 +1,5 @@ -Version 0.9 ------------ +Version 0.9 "Platypus", 2001-03-12 +---------------------------------- Shell: @@ -16,54 +16,143 @@ Shell: - Pre-select a newly created folder in the folder selection dialog. (Ettore) +Mail: + + - GPG/PGP support is now mostly working and sort of configurable. + Except that the pretty pictures are missing. (Jeff) + + - Exciting new configuration druid (Anna, Jeff) and configuration + editor-of-the-month (Jeff). You can now have multiple identities + that use different transports. (Jeff) + + - The folder-tree unread message counts now work much better. But + vfolders only display their unread message counts *after you've + looked at the folder for the first time*. (Dan) + + - New mail send/receive stuff with status dialog. (NotZed) + + - "Stop" button and support for cancelling operations. (NotZed) + + - Various fixes involving IMAP folders and subscriptions. (Dan) + + - Fake messages to root threads in the message list are now gone. (NotZed) + + - NNTP support is no longer configured by default, as this code is + not expected to be completed by 1.0. + + - Interface for hiding messages matching certain criteria. (NotZed) + + - Quick search bar now includes "Sender contains" option (Tuomas? Eek!) + + - The mailer now properly launches "gnome_segv" when it crashes. I + mean, if it were to crash. (Dan) + + - IMAP attachments are now not loaded unless you look at them. (Dan) + + - The X-Mailer header can now include a compile-time-specified + string (for specifying package version, etc). (Dan) + + - The Date header in the message list now formats dates differently + depending on how long ago they are. (Chris) + + - The composer doesn't ask if you want to save before closing if you + haven't changed anything. Also, it has more useful window titles + (Jason Leach) And you can now turn off the "are you sure you + didn't mean to enter a subject?" dialog box. (Jeff) + + - The "Menu" key on a Windows keyboard (the one with the picture of + a pop-up menu) now pops up the message list right-click menu. + (Dan) + + - Lots of internal stuff that doesn't much affect the user-visible + functionality, particularly involving multithreading, message + threading, filters/searching, and regression testing. (NotZed) + + - Importers for Outlook Express 4 and mbox (used by most mailers like + Netscape, Pine, Elm, Eudora) (Iain & Jeff) + +Addressbook: + + - Fixed crashing bug on PPC. (Clahey) + + - Updated to work with both OpenLDAP 1 and OpenLDAP 2. (Toshok) + + - Added configuration dialog for LDAP. (Toshok) + + - Plenty of bug fixes. (Clahey, Toshok, Meeks, JP, Larry, Jason, + Federico, Dan, Zucchi, Gediminas Paulauskas, Ettore) + + - Moved category dialog to gal. (JP) + + - Worked on LDAP authentication. (Toshok) + + - Worked on status messages. (Toshok) + + - Worked on GalView stuff. (Clahey) + + - Improved the select names dialog GUI. (Clahey) + Calendar: - - New "go to date" dialog (JP). + - New "go to date" dialog. (JP) - - Categories support for appointments (JP). + - Categories support for appointments. (JP) - - New alarms page in event editor (Anna, JP) + - New alarms page in event editor. (Anna, JP) - - Weekday picker now follows the week start setting (Federico). + - Weekday picker now follows the week start setting. (Federico) - - Date-editing widgets are more consistent with each other - (Federico). + - Date-editing widgets are more consistent with each other. + (Federico) - - Colorization fixes to the views (Damon). + - Colorization fixes to the views. (Damon) - - Optimizations to the views (Damon). + - Optimizations to the views. (Damon) - - New, simpler loading interface for calendars in the Wombat (Federico). + - New, simpler loading interface for calendars in the Wombat. (Federico) - - Removal of lots of old Gnomecal code (Federico, JP). + - Removal of lots of old Gnomecal code. (Federico, JP) - - Alarm instance generation support for the Wombat (Federico). + - Alarm instance generation support for the Wombat. (Federico) - - Alarm trigger queueing for the GUI (Federico). + - Alarm trigger queueing for the GUI. (Federico) - - More robust launching and registration of the components (Federico). + - More robust launching and registration of the components. (Federico) - - More i18n friendliness (JP, Federico). + - More i18n friendliness. (JP, Federico) - - Start of the alarm notification daemon (Federico). + - Start of the alarm notification daemon. (Federico) - - Cosmetic and focus fixes all over the place (Federico, JP). + - Cosmetic and focus fixes all over the place. (Federico, JP) Tasks: - - New, stand-alone tasks component (Damon). + - New, stand-alone tasks component. (Damon) - - Categories support (JP, Damon). + - Categories support. (JP, Damon) - - Your old tasks are migrated automatically to the new tasks folder - (Federico). + - Your old tasks are migrated automatically to the new tasks folder. + (Federico) - - You get asked for confirmation when trying to delete a task entry - (Federico). + - You get asked for confirmation when trying to delete a task entry. + (Federico) Conduits: - - Many bug fixes and cleanups (JP) + - Many bug fixes and cleanups. (JP) + +Executive Summary: + + - Bugfixes and memory leaks removed. (Iain) + + - Calendar summary component. (Iain) + + - RDF Summary saves it's state. (Iain) + + - Mail summary shows vFolder summaries as well. (Iain) + + - User changable number of columns. (Iain) + Version 0.8 "Archaeopteryx", 2000-12-14 --------------------------------------- @@ -97,15 +97,15 @@ the Ximian GNOME evolution preview mirror. If installing from packages, remember that you need both the runtime and -devel packages for each library. - - xml-i18n-tools - 0.7 or later (*) + - xml-i18n-tools - 0.8.1 - gnome-xml - 1.8.10 or later in the 1.0 series, but not from the 2.0 series (If you get this from GNOME CVS, use the tag "LIB_XML_1_X".) (*) - - gnome-print - 0.20 or later (*) + - gnome-print - 0.25 or later (*) - - gdk-pixbuf - 0.8.0 or later (*) + - gdk-pixbuf - 0.9.0 or later (*) - ORBit - 0.5.6 or later (*) (If you get this from GNOME CVS, use the tag "orbit-stable-0-5".) @@ -117,30 +117,30 @@ and -devel packages for each library. *** "--disable-more-warnings" when configure, or it may fail to *** build. - - gconf - 0.6 or later. - - - gnome-vfs - 0.4.2 or later. (If you get this from GNOME CVS, use - the tag "gnome-vfs-1") + - gnome-vfs - 0.4.2 or later (If you get this from GNOME CVS, use + the tag "gnome-vfs-1-0") *** If you are using gnome-vfs from CVS, you should use the flag *** "--disable-more-warnings" when configuring, or it may fail to *** build. - - libglade (*) - - bonobo - 0.37 or later *** Note that bonobo must be installed with the same --prefix as *** either gnome-libs or evolution for the Makefiles to work *** properly. - - libunicode - 0.4 or later, available from - http://www.pango.org/download.shtml + - libunicode - 0.4.gnome (*) + + - gconf - 0.6 or later - - gal (GNOME Application Library) - 0.5.99.5 or later + - gal (GNOME Application Library) - 0.5 (If you get this from + GNOME CVS, use the tag "GAL_0_5") - gtkhtml - 0.8.2 or later + - libglade (*) + If you want support for PalmPilot syncing (currently experimental so please back up your pilot) you will also need to do the following: @@ -166,7 +166,6 @@ make make install - The layout of the source tree is: addressbook: the Address Book UI diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 8821a28a09..d40336885c 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,625 +1,17 @@ -2001-03-13 Christopher James Lahey <clahey@ximian.com> +2001-03-13 Ettore Perazzoli <ettore@ximian.com> - * backend/pas/pas-backend-file.c - (pas_backend_file_process_get_book_view): Moved where we call - pas_book_respond_get_book_view. - -2001-03-12 Chris Toshok <toshok@ximian.com> - - * backend/pas/pas-backend-ldap.c: add E_STRING_PROP for - categories. - - * backend/pas/evolutionperson.schema: add categories attribute. - - * backend/ebook/e-card-simple.c (field_data): add - E_CARD_SIMPLE_FIELD_CATEGORIES. - - * backend/ebook/e-card-simple.h: add - E_CARD_SIMPLE_FIELD_CATEGORIES. - -2001-03-12 Chris Toshok <toshok@ximian.com> - - * gui/widgets/e-minicard.c (supported_fields_cb): add is_read_only - param. - - * gui/widgets/e-minicard-view.c (supported_fields_cb): add - is_read_only param. - - * gui/widgets/e-addressbook-view.c (supported_fields_cb): add - is_read_only param. - - * gui/component/select-names/e-select-names-text-model.c - (e_select_names_text_model_activate_obj): add is_read_only param. - also, include a little policy here and make it TRUE, as the user - shouldn't be editting in this context anyway (imo). - - * gui/component/addressbook.c (supported_fields_cb): add - is_read_only param. - - * contact-editor/test-editor.c (main): add is_read_only param. - - * contact-editor/e-contact-editor.c (set_read_only): new function, - that either enables or disables all the text fields, combo boxes, - and some buttons, depending on the state of is_read_only. - (e_contact_editor_class_init): add read/write arg "is_read_only". - (full_name_clicked): set the is_read_only of the fullname dialog - to the editor's. - (full_addr_clicked): same. - (e_contact_editor_new): add is_read_only param, that gets set - along with the other params. - (e_contact_editor_set_arg): add setter for is_read_only. - (e_contact_editor_get_arg): add getter for is_read_only. - (_phone_arrow_pressed): change TRUE to !editor->is_read_only for - entry. - (_email_arrow_pressed): same. - (_address_arrow_pressed): same. - (enable_writable_fields): same. - - * contact-editor/e-contact-editor-fullname.c - (e_contact_editor_fullname_class_init): add read/write arg - "is_read_only". - (e_contact_editor_fullname_set_arg): add setter for is_read_only - that enables/disables all the entries/combos. - (e_contact_editor_fullname_get_arg): add getter for is_read_only. - - * contact-editor/e-contact-editor-fullname.h (struct - _EContactEditorFullname): add is_read_only flag. - - * contact-editor/e-contact-editor-address.c - (e_contact_editor_address_class_init): add read/write arg - "is_read_only". - (e_contact_editor_address_set_arg): add setter for is_read_only - that disables/enables all the entries/combos. - (e_contact_editor_address_get_arg): add getter for is_read_only. - - * contact-editor/e-contact-editor-address.h (struct - _EContactEditorAddress): add is_read_only flag. - -2001-03-13 Iain Holmes <iain@ximian.com> - - * backend/ebook/Makefile.am: Change the importer includes around a bit. - - * backend/ebook/evolution-gnomecard-importer.c: Correctly add the includes. + * conduit/Makefile.am (INCLUDES): Use `$(PISOCK_INCLUDEDIR)' + instead of `$(PISOCK_CFLAGS)'. 2001-03-09 JP Rosevear <jpr@ximian.com> * conduit/Makefile.am: PISOCK_INCLUDEDIR has become PISOCK_CFLAGS in gnome-pilot.m4 and remove capplet foo -2001-03-11 Jon Trowbridge <trow@ximian.com> - - * backend/ebook/e-book.c (e_book_simple_query): Added. A - simplified, cancellable query mechanism that lets you avoid - dealing with EBookView. - (e_book_simple_query_cancel): Added. Cancels a running query. - - * backend/ebook/e-book-types.h: Add enum EBookSimpleQueryStatus. - - -2001-03-08 Jon Trowbridge <trow@ximian.com> - - * gui/component/select-names/e-select-names-popup.c - (quick_add_cb): Switched to use e_contact_quick_add_free_form. - Removed debugging code, hopefully without introducing any bugs - in the process. - - * gui/component/select-names/e-select-names-text-model.c - (e_select_names_text_model_insert_length): Fix bug with commas - inside of name/address combos. As long as the comma is inside of - quotes, it will be treated as part of the name rather than as a - break between addresses. - - * gui/component/select-names/e-select-names-completion.c - (match_nickname): Use e_card_name_to_string for nickname match - strings. - (match_email): Use e_card_name_to_string for email match strings. - (e_select_names_completion_begin): Strip quotes out of query text, - so we don't produce malformed sexps. - Added William Blake quote easter egg. - - * contact-editor/e-contact-quick-add.c: Further attempts to fix... - mostly unsuccessful. - (e_contact_quick_add_free_form): Added. Takes a single string - and tries to parse out (using some simple, loose rules) the - name and e-mail -- then calls e_contact_quick_add. An attempt to - get the computer to automatically Do The Right Thing. - - * backend/ebook/e-book.c: Fixed some broken indentation. Yes, I'm - anal. - - * gui/component/GNOME_Evolution_Addressbook.oafinfo: Added oaf_server - info for EAddressWidget. - - * gui/component/GNOME_Evolution_Addressbook.oaf.in: Added oaf_server - info for EAddressWidget. - - * gui/component/addressbook-factory.c (main): Add call to - e_address_widget_factory_init. - - * gui/component/e-address-widget.h: - * gui/component/e-address-widget.c: Added. A little widget (and a - Bonobo control, BTW) for displaying addresses, with a left-click - menu. Used to display addresses in the mail viewer (as embedded - GtkHTML objects, replacing the text previously used). Still quite - incomplete. - -2001-03-08 Ettore Perazzoli <ettore@ximian.com> - - * gui/component/addressbook-component.c (factory_fn): Specify a - NULL `EvolutionShellComponentGetDndSelectionFn'. - -2001-03-06 Jon Trowbridge <trow@ximian.com> - - * gui/component/select-names/e-select-names-text-model.c - (e_select_names_text_model_insert_length): Fix glitch with - inserting comma-delimited stuff when length > 1. - -2001-03-06 Jon Trowbridge <trow@ximian.com> - - * backend/ebook/e-book.c (e_book_load_local_address_book): Added. - Just encapsulates opening - file://~username/evolution/local/Contactes/addressbook.db, so that - path doesn't need to be hardwired in throughout the code. - -2001-03-06 Benjamin Kahn <xkahn@cybersites.com> - - * contact-editor/e-contact-quick-add.c (clicked_cb): - Added the third argument to e_contact_editor_new. (Cheated - and send NULL for the field argument, which is probably - troublesome. It will be fixed soon by either clahey or - toshok.) - -2001-03-06 Jon Trowbridge <trow@ximian.com> - - * gui/component/select-names/e-select-names-model.c - (e_select_names_model_replace): Fix a reference counting bug. - - * gui/component/select-names/e-select-names-manager.c (popup_cb): - A callback for creating the appropriate popup by calling - e_select_names_popup. - (e_select_names_manager_create_entry): Connect popup_cb to the - entry's popup signal - - * gui/component/select-names/e-select-names-popup.c: Added. Code - for popup right-click menus for recipient entries. Still a bit - incomplete. - - * backend/ebook/e-destination.c (e_destination_get_email_num): - Added. - - * contact-editor/e-contact-quick-add.c: Added. Some code and a - dialog for very quickly adding entries to the address book. - Still not fully working. - -2001-03-04 Christopher James Lahey <clahey@ximian.com> - - * backend/ebook/e-card-simple.c: Cleaned up the formatting in this - file a bit. - - * contact-editor/e-contact-editor.c (e_contact_editor_set_arg): - Made it so that passing in NULL to the writable_fields arg sets - the set of writable fields to the empty set. - - * gui/component/select-names/e-select-names-text-model.c - (e_select_names_text_model_activate_obj): Pass NULL as the - writable_fields argument here. - - * gui/widgets/e-addressbook-model.c: Don't offset by one here. - This way we will get the file_as field as one of our - ETableColumns. - - * gui/widgets/e-addressbook-view.c (SPEC): Updated this for the - changes in ECardSimple. - - * gui/widgets/e-minicard.c (remodel): Don't remodel if the item - isn't realized. - -2001-03-02 Chris Toshok <toshok@ximian.com> - - * backend/pas/pas-backend-ldap.c: doh, track renaming of - objectclass from evolvePerson to evolutionPerson. - -2001-03-02 Chris Toshok <toshok@ximian.com> - - * backend/pas/evolutionperson.schema: rename evolveperson.schema - to this, and add remaining attributes. - - * backend/pas/pas-backend-ldap.c: add remaining fields, and fix up - ones that were incorrent (either the ldap_attr or the query prop). - -2001-03-02 JP Rosevear <jpr@ximian.com> - - * conduit/Makefile.am: update sed script - - * conduit/e-address.conduit.in: update for new pilot foo - -2001-03-02 Chris Toshok <toshok@ximian.com> - - * gui/component/select-names/e-select-names-text-model.c - (e_select_names_text_model_activate_obj): track change to - e_contact_editor_new. - -2001-03-02 Chris Toshok <toshok@ximian.com> - - * backend/pas/pas-backend-ldap.c (add_objectclass_mod): add - objectclasses for "person", "organizationalPerson", and "top" as - well, just to be complete. - (check_schema_support): rename check_for_evolve_person to this, to - reflect that we're doing more than just checking for that - objectClass. - (add_oc_attributes_to_supported_fields): new function. - (add_to_supported_fields): new function. - (pas_backend_ldap_destroy): unref supported_fields. - -2001-03-02 Chris Toshok <toshok@ximian.com> - - * gui/widgets/e-minicard-view.c (supported_fields_cb): new - function. - (e_minicard_view_event): split out the creation of the contact - editor to the supported_fields callback. - - * gui/widgets/e-minicard.c (supported_fields_cb): new function. - (e_minicard_event): split out the creation of the contact editor - to the supported_fields callback. - - * gui/widgets/e-addressbook-view.c (table_double_click): split - function into two functions, since e_book_get_supported_fields - requires a callback now. - (supported_fields_cb): new function. - - * gui/component/addressbook.c (new_contact_cb): split this into - two functions, since e_book_get_supported_fields requires a - callback now. - (supported_fields_cb): new function. - - * contact-editor/test-editor.c (main): track change to - e_contact_editor_new (pass NULL for the writable_fields arg.) - - * contact-editor/contact-editor.glade: fix several labels so they - make better sense (since we look them up in e-contact-editor.c.) - - * contact-editor/e-contact-editor.h (struct _EContactEditor): add - writable_fields. also, add it to e_contact_editor_new. - - * contact-editor/e-contact-editor.c (e_contact_editor_class_init): - add writable_fields arg. - (e_contact_editor_destroy): unref the writable_fields list. - (e_contact_editor_new): pass @fields as the writable_fields arg. - (e_contact_editor_set_arg): add writable_fields support. - (enable_writable_fields): new (very hairy) function, to disable - everything and reenable just the fields listed in the - writable_fields list. - (_email_arrow_pressed): set label-email1, entry-email1, and - checkbutton-htmlmail to be sensitive since the only way to get - here is to activate a writable field in the menu. - (_address_arrow_pressed): set label-address, button-fulladdr, and - text-address to be sensitive for the same reason. - (_phone_arrow_pressed): sensitize the label and entry for the same - reason. - -2001-03-02 Chris Toshok <toshok@ximian.com> - - * backend/ebook/e-card-simple.c (field_data): add new entries for - phone enums, and fill in the ecard_field with (bogus in all but a - few cases) strings. these are the strings sent from wombat to - evolution-addressbook for supported_fields. - (e_card_simple_get_ecard_field): new function. - (e_card_simple_map_phone_to_field): new function. - (e_card_simple_map_email_to_field): new function. - (e_card_simple_map_address_to_field): new function. - - * backend/ebook/e-card-simple.h: add a few phone entries to the - ECardSimpleField enum, and add prototypes for mapping the list - types (phone, email, address) to ECardSimpleField. Also, add - prototype for e_card_simple_get_ecard_field. - - * backend/ebook/e-book.c - (e_book_do_response_get_supported_fields): don't build the EList - here, it's already built. - - * backend/ebook/e-book-listener.h: change fields from the CORBA - sequence to the EList in our reponse struct. - - * backend/ebook/e-book-listener.c - (e_book_listener_queue_get_supported_fields_response): we make the - EList here, since after we return the CORBA list is freed up. - -2001-03-02 Chris Toshok <toshok@ximian.com> - - * backend/pas/pas-backend-file.c - (pas_backend_file_process_get_supported_fields): implement - properly, we support everything. - -2001-03-01 Jon Trowbridge <trow@ximian.com> - - * gui/component/select-names/e-select-names-bonobo.c - (entry_set_property_fn): Oops, we do need to be able to write to - "text" after all (for things like Reply-to: to work properly). - Fixed. - (impl_SelectNames_get_entry_for_section): Made "text" a writeable - property again. - - * gui/component/select-names/e-select-names-text-model.c - (e_select_names_text_model_insert_length): Increment pos so that - we don't reverse strings when length > 1 (a particularly amusing - bug). - - * gui/component/select-names/e-select-names-completion.c - (e_select_names_completion_destroy): Check for NULL before calling - gtk_object_unref (GTK_OBJECT (---)), to get rid of annoying error - messages. - -2001-03-01 Jon Trowbridge <trow@ximian.com> - - * gui/component/select-names/e-select-names-completion.c: I am an - idiot. - -2001-03-01 Jon Trowbridge <trow@ximian.com> - - * gui/component/select-names/e-select-names-table-model.c - (fill_in_info): Change for new EDestination/ESelectNamesModel API. - - * gui/component/select-names/e-select-names-manager.c - (e_select_names_manager_get_source): Added. A function for - looking up the ESelectNamesModel by id. (I didn't end up using - this function, but it might come in handy later.) - (e_select_names_manager_get_cards): #if 0/#endif out this - function. - (e_select_names_manager_create_entry): Modified to attach an - ESelectNamesCompletion to the entry we create. - (completion_handler): A post-completion handler for our EEntry, to - take the completion's extra data (an EDestination) and properly - stick it into our ESelectNamesModel. - - * gui/component/select-names/e-select-names.c - (real_add_address_cb): Changed to operate on EDestinations rather - than ECards and to use the new ESelectNamesModel API. This leads - to a rather nice code simplication. - (remove_address): Changed for new ESelectNamesModel API. - - * gui/component/select-names/e-select-names-bonobo.c - (entry_get_property_fn): Rather than just passing the entry's text - through the property bag, get the "address text" from the model. - This returns a nice, verbose string of addresses with names - expanded when the address is tied to an ECard (i.e. "Jon - Trowbridge <trow@ximian.com>"). - (impl_SelectNames_get_entry_for_section): Make the text property - read-only. - (entry_set_property_fn): ...and since it is read-only now, chop - out the setter code. - - * gui/component/select-names/e-select-names-text-model.h: - * gui/component/select-names/e-select-names-text-model.c: Again, - this code has been (pretty much) totally rewritten to convert all - text operations into changes on the ESelectNamesModel. This lets - us give the associated EEntry some (IMHO) nice semantics regarding - whitespace, etc. Includes object activation, so destinations tied - to ECards are underlined and can be double-clicked to bring up a - contact editor. - - * gui/component/select-names/e-select-names-model.h: - * gui/component/select-names/e-select-names-model.c: I've heavily - modified this object to both hide all implementation details - (which the old version exposed a bit too much for my peculiar - tastes) and to act as an EDestination container. The old code put - the text model operations here. I've moved them all to - ESelectNamesTextModel --- so the text model actions (insert, - delete, etc.) are all done through the API rather than operating on - ESelectNamesModel internals. - - * gui/component/select-names/e-select-names-completion.c: Added. A - fairly complicated object derived from ECompletion that searches - our local addressbook in various and sundry ways. - - * gui/component/select-names/e-select-names-completion.h: - - * backend/ebook/e-destination.h: - * backend/ebook/e-destination.c: Added. This object encapsulates - a place to sent an email to, which can either be just a address as - a string ("trow@ximian.com"), a fancier string ("Jon Trowbridge - <trow@ximian.com>"), or an ECard and a specific address within - that ECard. - -2001-03-01 Christopher James Lahey <clahey@ximian.com> - - * gui/widgets/e-minicard-view.c, gui/widgets/e-minicard-view.h, - gui/widgets/e-minicard.c, gui/widgets/e-minicard.h: Used - ESelectionModelSimple and the changes to EReflow and EReflowSorted - to get multiple selection in the minicard view. - - * gui/widgets/test-reflow.c: Changed this to get it to compile - with the changes to EReflow. - -2001-02-21 Christopher James Lahey <clahey@ximian.com> - - * backend/pas/pas-backend-file.c (pas_backend_file_search): Made - this pay attention to the return value of e_sexp_parse. - - * gui/component/select-names/e-select-names-text-model.c - (e_select_names_text_model_activate_obj): Fixed a const - inconsistency here. - -2001-02-21 Chris Toshok <toshok@ximian.com> - - * backend/pas/pas-book.c (pas_book_queue_get_supported_fields): - new function. - (impl_GNOME_Evolution_Addressbook_Book_getSupportedFields): track - change to idl. - (pas_book_respond_get_supported_fields): new function. - - * backend/pas/pas-book.h: add GetSupportedFields to the - PASOperation enum. Also, add a stringlist field to the PASRequest - struct. lastly, add a prototype for - pas_book_respond_get_supported_fields. - - * backend/pas/pas-backend.h: remove prototype for - pas_backend_get_supported_fields, and remove it from the vtable. - - * backend/pas/pas-backend.c (pas_backend_get_supported_fields): - remove. - (pas_backend_class_init): no vtable entry for get_supported_fields - anymore. - - * backend/pas/pas-backend-ldap.c - (pas_backend_ldap_process_get_supported_fields): new function. - (pas_backend_ldap_process_client_requests): add case for - GetSupportedFields. - (pas_backend_ldap_class_init): get_supported_fields isn't in - vtable anymore. - - * backend/pas/pas-backend-file.c - (pas_backend_file_process_get_supported_fields): new function. - (pas_backend_file_process_client_requests): add case for - GetSupportedFields. - (pas_backend_file_class_init): get_supported_fields isn't in - vtable anymore. - - * backend/idl/addressbook.idl: Book::getSupportedFields now - returns void and add BookListener::notifySupportedFields. - - * backend/ebook/test-client.c (get_fields_cb): new function. - (auth_user_cb): track change to e_book_get_supported_fields. - - * backend/ebook/e-book.c - (e_book_do_response_get_supported_fields): new function. - (e_book_check_listener_queue): add case - GetSupportedFieldsResponse. - (e_book_get_supported_fields): switch to async model. - - * backend/ebook/e-book.h: switch e_book_get_supported_fields to an - async model. - - * backend/ebook/e-book-listener.c - (e_book_listener_queue_get_supported_fields_response): new - function. - (impl_BookListener_response_get_supported_fields): new function. - (e_book_listener_get_epv): fill in epv's "notifySupportedFields" - - * backend/ebook/e-book-listener.h: add an async response for - GetSupportedFields and add a stringlist member to the - EBookListenerResponse struct. - -2001-02-20 Federico Mena Quintero <federico@ximian.com> - - * backend/pas/pas-book-factory.c (pas_book_factory_activate): - Moved the register_factory() code to here, since it was the only - thing being called anyways. - (PasBookFactoryPrivate): Added a "registered" flag. - (pas_book_factory_activate): Set the registered flag. - (pas_book_factory_destroy): Deactivate the factory when we go away. - -2001-02-20 Chris Toshok <toshok@ximian.com> - - * backend/ebook/e-book.c (e_book_get_supported_fields): new function. - - * backend/ebook/e-book.h: add e-book interface to getting - supported fields. - - * backend/ebook/test-client.c (auth_user_cb): shoe-horn in some - spew about supported fields. +2001-02-12 Ettore Perazzoli <ettore@ximian.com> -2001-02-19 JP Rosevear <jpr@ximian.com> - - * conduit/Makefile.am: Remove PISOCK_LIBDIR - -2001-02-19 Jon Trowbridge <trow@ximian.com> - - * gui/component/select-names/e-select-names-manager.c - (e_select_names_manager_create_entry): When creating the entry, - open up an ebook (corresponding to the local addressbook) and make - the entry use an EAddressCompletion. - (completion_handler): Added; this is the actual completion - handler, which manipulates the entry when the user selects - something from the drop-down. - - * gui/component/select-names/e-select-names-model.c: Various hacks - by clahey to unbreak e_select_names_model_add_item, - e_select_names_model_replace_item (which I added) and - e_select_names_model_remove_item. - - * gui/component/select-names/e-select-names-text-model.c - (e_select_names_text_model_obj_count, - e_select_names_text_model_get_nth_obj): Make chunks of text that - correspond to ECards in the ESelectNamesModel be embedded objects. - (e_select_names_text_model_activate_obj): On activation, pop up a - contact editor for the embedded object's card. - (e_select_names_text_model_model_changed): Fixed to work with - ETextModel API changes. - (e_select_names_text_model_set_text): Make const correct. - (e_select_names_text_model_insert): Make const correct. - (e_select_names_text_model_insert_length): Make const correct. - - * backend/ebook/e-address-completion.h, - backend/ebook/e-address-completion.c: Added. EAddressCompletion - is a derived class of ECompletion that does asynchronous address - lookups for completions. - -2001-02-17 Chris Toshok <toshok@ximian.com> - - * backend/idl/addressbook.idl: add sequence<string> typedef, and - add getSupportedFields method. - - * backend/pas/pas-book.c - (impl_GNOME_Evolution_Addressbook_Book_getSupportedFields): new - function. - - * backend/pas/pas-backend.c (pas_backend_class_init): init - get_supported_fields = NULL. - (pas_backend_get_supported_fields): new function. - - * backend/pas/pas-backend.h: add prototype for - pas_backend_get_supported_fields. - - * backend/pas/pas-backend-file.c - (pas_backend_file_get_supported_fields): new function. - (pas_backend_file_class_init): fill in get_supported_fields. - - * backend/pas/pas-backend-ldap.c - (pas_backend_ldap_get_supported_fields): new function. - (pas_backend_ldap_class_init): fill in get_supported_fields. - -2001-02-14 Christopher James Lahey <clahey@ximian.com> - - * backend/pas/pas-backend-ldap.c: Undefine E_STRING_PROP and - E_LIST_PROP here. - - * contact-editor/e-contact-editor.c, - contact-editor/e-contact-editor.h (e_contact_editor_raise): Added - this function. - - * gui/widgets/e-minicard.c, gui/widgets/e-minicard.h - (e_minicard_event): Added an editor field to the EMinicard object. - Made it so that if you double click on the same card twice, it - doesn't open a new window, but instead raises the old. - -2001-02-08 Iain Holmes <iain@ximian.com> - - * gui/component/addressbook-storage.c (addressbook_source_free): - Free the ldap.binddn. - - * gui/widgets/e-addressbook-view.c - (e_addressbook_view_setup_menus): Free the dir strings. - -2001-02-08 Christopher James Lahey <clahey@ximian.com> - - * contact-editor/e-contact-editor.c (categories_clicked): Set the - header on the category dialog we pop up. - -2001-02-12 Kjartan Maraas <kmaraas@gnome.org> - - * backend/ebook/GNOME_Evolution_Addressbook_GnomeCard_Importer.oaf.in: Translations. - * gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oaf.in: - Marked strings for translation in this newly created file. - * gui/component/select-names/Makefile.am: Hook up the .oaf.in files in the - xml-i18n-tools framework. - * gui/component/Makefile.am: Same as above. - * gui/component/GNOME_Evolution_Addressbook.oaf.in: Marked stuff for translation here - too. - -2001-02-11 Jason Leach <jasonleach@usa.net> - - * gui/component/addressbook.c: Removed an ancient #include - <libgnorba/gnorba.h> + * conduit/Makefile.am (INCLUDES): `-I$(top_srcdir)/e-util', not + `-I$(top_builddir)/e-util'. 2001-02-11 Gediminas Paulauskas <menesis@delfi.lt> @@ -635,8 +27,7 @@ gui/component/select-names/select-names.glade.h: removed these files, xml-i18n-extract takes care of strings itself. - * contact-editor/*.glade, - gui/component/select-names/select-names.glade, + * contact-editor/*.glade, gui/component/select-names/select-names.glade, gui/widgets/alphabet.glade, printing/e-contact-print.glade: changed project options to not output_translatable_strings. @@ -644,94 +35,6 @@ gui/component/select-names/Makefile.am, printing/Makefile.am: do not include removed files in EXTRA_DIST. -2001-02-07 Chris Toshok <toshok@ximian.com> - - * backend/pas/pas-backend-ldap.c (check_for_evolve_person): flesh - out this check. #ifdef the entire thing OPENLDAP2, as it only - works with the new schema stuff in openldap 2.x (both on server - and client, so upgrade your server.) - -2001-02-07 Christopher James Lahey <clahey@ximian.com> - - * gui/widgets/e-addressbook-view.c: Added N_("* Click here to add - a contact *"). - -2001-02-07 Chris Toshok <toshok@ximian.com> - - * backend/pas/pas-backend-ldap.c (pas_backend_ldap_connect): only - set the DEBUG_LEVEL if we're OPENLDAP2. - -2001-02-06 Chris Toshok <toshok@ximian.com> - - * backend/pas/pas-backend-ldap.c (email_compare): return TRUE if - equal, FALSE otherwise. - (business_compare): same. - (homephone_compare): same. - (email_ber): return NULL if there are no elements in our list. - (homephone_ber): same. - (business_ber): same. - (build_mods_from_ecards): add smarts to handle list elements - properly (like email, business_phone, home_phone.) now we'll - properly send updates if any element in the list changes. - -2001-02-06 Christopher James Lahey <clahey@ximian.com> - - * gui/widgets/Makefile.am (INCLUDES): Added - -DEVOLUTION_DATADIR=\""$(datadir)"\". - - * gui/widgets/e-addressbook-view.c - (e_addressbook_view_setup_menus): Changed the local and system - directories. - -2001-02-06 Chris Toshok <toshok@ximian.com> - - * backend/pas/pas-backend-ldap.c (create_card_handler): doh, - didn't mean to commit this. - -2001-02-06 Chris Toshok <toshok@ximian.com> - - * backend/pas/evolveperson.schema: new file. this will eventually - form the suggested additions to an existing openldap server that, - along with support for inetorgperson, will allow people to store - all evolution attributes in ldap. - -2001-02-06 Chris Toshok <toshok@ximian.com> - - * backend/pas/pas-backend-ldap.c (pas_backend_ldap_init): don't - need the = NULL's since we g_new0. - (check_for_evolve_person): new function. - (pas_backend_ldap_connect): check to see if the evolvePerson - objectclass is there. - (build_mods_from_ecards): right now, just silently skip the extra - attributes if we don't support evolvePerson. - (add_objectclass_mod): new function, add both inetOrgPerson and - (if it's available) evolvePerson as objectclasses. - (pas_backend_ldap_process_authenticate_user): also check to see if - evolvePerson is there, if we couldn't do it (due to auth reasons) - in the connect method. - (prop_info): change the telephoneNumber LDAP attribute to be used - for evolution's business phone numbers. the primary phone number - will be a single valued attribute on evolvePerson. - (business_populate): new function. - (business_ber): new function. - (business_compare): new function. - -2001-02-05 Chris Toshok <toshok@ximian.com> - - * backend/pas/pas-backend-ldap.c (create_card_handler): err, - allocate 2 char*s when i assign 2 char*s. - -2001-02-05 Chris Toshok <toshok@ximian.com> - - * backend/pas/pas-backend-ldap.c (modify_card_handler): switch to - ldap_modify_ext_s if OPENLDAP2, as ldap_modify_s is deprecated. - (build_mods_from_ecards): don't include the mod if the value is "" - - this isn't valid on schema checking ldap servers. - (homephone_populate): new function. - (homephone_ber): new function. - (homephone_compare): new function. - (create_card_handler): add spew when adding cards so I can see - what's going on. 2001-02-05 Christopher James Lahey <clahey@helixcode.com> * gui/component/addressbook-config.c (table_add_elem): Save the diff --git a/addressbook/contact-editor/Makefile.am b/addressbook/contact-editor/Makefile.am index 700be0ff35..d5ed7feeaa 100644 --- a/addressbook/contact-editor/Makefile.am +++ b/addressbook/contact-editor/Makefile.am @@ -22,9 +22,7 @@ libecontacteditor_a_SOURCES = \ e-contact-editor.c \ e-contact-editor.h \ e-contact-save-as.c \ - e-contact-save-as.h \ - e-contact-quick-add.c \ - e-contact-quick-add.h + e-contact-save-as.h noinst_PROGRAMS = \ contact-editor-test diff --git a/addressbook/contact-editor/contact-editor.glade b/addressbook/contact-editor/contact-editor.glade index 30f7feb1a5..ddcc058ab2 100644 --- a/addressbook/contact-editor/contact-editor.glade +++ b/addressbook/contact-editor/contact-editor.glade @@ -1494,7 +1494,7 @@ <widget> <class>GtkLabel</class> - <name>label-jobtitle</name> + <name>label34</name> <cxx_use_heap>True</cxx_use_heap> <label>_Job title:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1691,7 +1691,7 @@ <widget> <class>GtkLabel</class> - <name>label-company</name> + <name>label35</name> <cxx_use_heap>True</cxx_use_heap> <label>_Company:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1767,7 +1767,7 @@ <widget> <class>GtkLabel</class> - <name>label-department</name> + <name>label21</name> <cxx_use_heap>True</cxx_use_heap> <label>_Department:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1795,7 +1795,7 @@ <widget> <class>GtkLabel</class> - <name>label-office</name> + <name>label22</name> <cxx_use_heap>True</cxx_use_heap> <label>_Office:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1823,7 +1823,7 @@ <widget> <class>GtkLabel</class> - <name>label-profession</name> + <name>label23</name> <cxx_use_heap>True</cxx_use_heap> <label>_Profession:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1851,7 +1851,7 @@ <widget> <class>GtkLabel</class> - <name>label-nickname</name> + <name>label24</name> <cxx_use_heap>True</cxx_use_heap> <label>_Nickname:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1879,7 +1879,7 @@ <widget> <class>GtkLabel</class> - <name>label-spouse</name> + <name>label25</name> <cxx_use_heap>True</cxx_use_heap> <label>_Spouse:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1907,7 +1907,7 @@ <widget> <class>GtkLabel</class> - <name>label-birthday</name> + <name>label31</name> <cxx_use_heap>True</cxx_use_heap> <label>_Birthday:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1934,7 +1934,7 @@ <widget> <class>GtkLabel</class> - <name>label-assistant</name> + <name>label30</name> <cxx_use_heap>True</cxx_use_heap> <label>_Assistant's name:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1962,7 +1962,7 @@ <widget> <class>GtkLabel</class> - <name>label-manager</name> + <name>label29</name> <cxx_use_heap>True</cxx_use_heap> <label>_Manager's Name:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1990,7 +1990,7 @@ <widget> <class>GtkLabel</class> - <name>label-anniversary</name> + <name>label32</name> <cxx_use_heap>True</cxx_use_heap> <label>Anni_versary:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -2262,7 +2262,7 @@ <widget> <class>GtkLabel</class> - <name>label-comments</name> + <name>label33</name> <cxx_use_heap>True</cxx_use_heap> <label>No_tes:</label> <justify>GTK_JUSTIFY_CENTER</justify> diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am index 59b1d4c394..dee94188db 100644 --- a/addressbook/gui/component/Makefile.am +++ b/addressbook/gui/component/Makefile.am @@ -36,9 +36,7 @@ evolution_addressbook_SOURCES = \ addressbook.c \ addressbook.h \ e-cardlist-model.c \ - e-cardlist-model.h \ - e-address-widget.h \ - e-address-widget.c + e-cardlist-model.h evolution_addressbook_LDADD = \ select-names/libeselectnames.la \ @@ -59,20 +57,15 @@ evolution_addressbook_LDADD = \ evolution_addressbook_LDFLAGS = `gnome-config --libs gdk_pixbuf` -export-dynamic -@XML_I18N_MERGE_OAF_RULE@ - oafdir = $(datadir)/oaf -oaf_in_files = GNOME_Evolution_Addressbook.oaf.in -oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) +oaf_DATA = GNOME_Evolution_Addressbook.oafinfo gladedir = $(datadir)/evolution/glade glade_DATA = addressbook-config.glade EXTRA_DIST = \ $(glade_DATA) \ - $(oaf_DATA) \ - addressbook-config.glade\ - $(oaf_in_files) + $(oaf_DATA) if ENABLE_PURIFY PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ diff --git a/addressbook/gui/component/select-names/Makefile.am b/addressbook/gui/component/select-names/Makefile.am index 4010ca1f8e..e1c8795707 100644 --- a/addressbook/gui/component/select-names/Makefile.am +++ b/addressbook/gui/component/select-names/Makefile.am @@ -16,12 +16,9 @@ $(IDL_GENERATED): $(IDLS) $(srcdir)/Evolution-Addressbook-SelectNames.idl oafdir = $(datadir)/oaf +oaf_DATA = GNOME_Evolution_Addressbook_SelectNames.oafinfo -oaf_in_files = GNOME_Evolution_Addressbook_SelectNames.oaf.in -oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) - -@XML_I18N_MERGE_OAF_RULE@ - +# INCLUDES = \ -DG_LOG_DOMAIN=\"evolution-addressbook\" \ @@ -51,16 +48,12 @@ libeselectnames_la_SOURCES = \ $(IDL_GENERATED) \ e-select-names-bonobo.c \ e-select-names-bonobo.h \ - e-select-names-completion.c \ - e-select-names-completion.h \ e-select-names-factory.c \ e-select-names-factory.h \ e-select-names-manager.c \ e-select-names-manager.h \ e-select-names-model.c \ e-select-names-model.h \ - e-select-names-popup.c \ - e-select-names-popup.h \ e-select-names-table-model.c \ e-select-names-table-model.h \ e-select-names-text-model.c \ @@ -71,11 +64,8 @@ libeselectnames_la_SOURCES = \ gladedir = $(datadir)/evolution/glade glade_DATA = select-names.glade - - EXTRA_DIST = \ $(glade_DATA) \ - $(oaf_in_files) \ $(oaf_DATA) \ $(IDLS) diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am index 700be0ff35..d5ed7feeaa 100644 --- a/addressbook/gui/contact-editor/Makefile.am +++ b/addressbook/gui/contact-editor/Makefile.am @@ -22,9 +22,7 @@ libecontacteditor_a_SOURCES = \ e-contact-editor.c \ e-contact-editor.h \ e-contact-save-as.c \ - e-contact-save-as.h \ - e-contact-quick-add.c \ - e-contact-quick-add.h + e-contact-save-as.h noinst_PROGRAMS = \ contact-editor-test diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade index 30f7feb1a5..ddcc058ab2 100644 --- a/addressbook/gui/contact-editor/contact-editor.glade +++ b/addressbook/gui/contact-editor/contact-editor.glade @@ -1494,7 +1494,7 @@ <widget> <class>GtkLabel</class> - <name>label-jobtitle</name> + <name>label34</name> <cxx_use_heap>True</cxx_use_heap> <label>_Job title:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1691,7 +1691,7 @@ <widget> <class>GtkLabel</class> - <name>label-company</name> + <name>label35</name> <cxx_use_heap>True</cxx_use_heap> <label>_Company:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1767,7 +1767,7 @@ <widget> <class>GtkLabel</class> - <name>label-department</name> + <name>label21</name> <cxx_use_heap>True</cxx_use_heap> <label>_Department:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1795,7 +1795,7 @@ <widget> <class>GtkLabel</class> - <name>label-office</name> + <name>label22</name> <cxx_use_heap>True</cxx_use_heap> <label>_Office:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1823,7 +1823,7 @@ <widget> <class>GtkLabel</class> - <name>label-profession</name> + <name>label23</name> <cxx_use_heap>True</cxx_use_heap> <label>_Profession:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1851,7 +1851,7 @@ <widget> <class>GtkLabel</class> - <name>label-nickname</name> + <name>label24</name> <cxx_use_heap>True</cxx_use_heap> <label>_Nickname:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1879,7 +1879,7 @@ <widget> <class>GtkLabel</class> - <name>label-spouse</name> + <name>label25</name> <cxx_use_heap>True</cxx_use_heap> <label>_Spouse:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1907,7 +1907,7 @@ <widget> <class>GtkLabel</class> - <name>label-birthday</name> + <name>label31</name> <cxx_use_heap>True</cxx_use_heap> <label>_Birthday:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1934,7 +1934,7 @@ <widget> <class>GtkLabel</class> - <name>label-assistant</name> + <name>label30</name> <cxx_use_heap>True</cxx_use_heap> <label>_Assistant's name:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1962,7 +1962,7 @@ <widget> <class>GtkLabel</class> - <name>label-manager</name> + <name>label29</name> <cxx_use_heap>True</cxx_use_heap> <label>_Manager's Name:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -1990,7 +1990,7 @@ <widget> <class>GtkLabel</class> - <name>label-anniversary</name> + <name>label32</name> <cxx_use_heap>True</cxx_use_heap> <label>Anni_versary:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -2262,7 +2262,7 @@ <widget> <class>GtkLabel</class> - <name>label-comments</name> + <name>label33</name> <cxx_use_heap>True</cxx_use_heap> <label>No_tes:</label> <justify>GTK_JUSTIFY_CENTER</justify> diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am index 00f851da72..60a04cb355 100644 --- a/addressbook/gui/widgets/Makefile.am +++ b/addressbook/gui/widgets/Makefile.am @@ -1,7 +1,6 @@ INCLUDES = \ -DG_LOG_DOMAIN=\"e-minicard\" \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ -I$(top_srcdir) \ -I$(top_srcdir)/addressbook/backend/ebook \ -I$(top_srcdir)/addressbook/contact-editor \ diff --git a/art/Makefile.am b/art/Makefile.am index c0ef0a2ab3..7bb09aee32 100644 --- a/art/Makefile.am +++ b/art/Makefile.am @@ -37,7 +37,6 @@ images_DATA = \ globe.png \ house.png \ malehead.png \ - new_contact.xpm \ service-close.png \ service-configure.png \ service-down.png \ @@ -55,17 +54,11 @@ buttons_DATA = \ add-service.png \ compose-message.png \ copy-message.png \ - dayview.xpm \ fetch-mail.png \ forward.png \ - monthview.xpm \ move-message.png \ - new_appointment.png \ reply-to-all.png \ - reply.png \ - weekview.xpm \ - workweekview.xpm \ - yearview.xpm + reply.png conduitsdir = $(datadir)/images/evolution/conduits conduits_DATA = \ @@ -103,4 +96,6 @@ EXTRA_DIST = \ score-high.xpm \ score-higher.xpm \ score-highest.xpm \ + $(conduits_DATA) \ + $(buttons_DATA) \ $(images_DATA) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index f114a406ce..8d5f0a5465 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,232 +1,34 @@ -2001-03-09 JP Rosevear <jpr@ximian.com> - - * conduits/todo/Makefile.am: PISOCK_INCLUDEDIR has become - PISOCK_CFLAGS in gnome-pilot.m4 and remove capplet foo - - * conduits/calendar/Makefile.am: ditto - -2001-03-08 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (factory_fn): Specify a NULL - `EvolutionShellComponentGetDndSelectionFn'. - -2001-02-27 Miguel de Icaza <miguel@ximian.com> - - * gui/e-day-view.c (e_day_view_on_event_right_click): Reorganize - the menus to have entries always in a consistent fashion, as - reported to the genepool mailing list. - (e_day_view_on_event_right_click): Added a FIXME comment to the - FIXME comment without a FIXME. - - Now we use e_popup_menu. This allows us to hide/show items on - demand, and to sensitize/de-sensitize items depending on their - state. - - This will also let us add icon support (when we get nice icons for - this) - - * gui/e-week-view.c (e_week_view_show_popup_menu): Ditto. - - The files popup-menu.c and popup-menu.h can now be removed. - -2001-03-05 Damon Chaplin <damon@ximian.com> - - * gui/e-tasks.c: keep list of all Tasks folders so we can update the - preference settings when necessary. - - * gui/gnome-cal.c: configure the TaskPad according to the settings. - - * gui/e-calendar-table.c: use ECellCombo and ECellDateEdit for fields, - so the tasks folders is almost usable now. - - * gui/calendar-model.c: added support for the Status property. - - * gui/calendar-config.[hc]: added convenience functions to setup - ECalendarTable and ECellDateEdit objects. - - * gui/calendar-commands.c: connected to "destroy" signal of calendars - so we can remove them from all_calendars list. - - * gui/dialogs/cal-prefs-dialog.c (cal_prefs_dialog_update_config): - call e_tasks_update_all_config_settings() to update all the settings - in the Tasks folders as well. - - * cal-util/cal-component.h: added CAL_COMPONENT_FIELD_STATUS. - - * cal-util/cal-component.c (cal_component_get_transparency): fixed - calls to strcasecmp so they check for '== 0'. - - Applied patch from Miguel... - -2001-02-27 Miguel de Icaza <miguel@ximian.com> - - * gui/e-day-view.c (e_day_view_on_event_right_click): Reorganize - the menus to have entries always in a consistent fashion, as - reported to the genepool mailing list. - (e_day_view_on_event_right_click): Added a FIXME comment to the - FIXME comment without a FIXME. - - Now we use e_popup_menu. This allows us to hide/show items on - demand, and to sensitize/de-sensitize items depending on their - state. - - This will also let us add icon support (when we get nice icons for - this) - - * gui/e-week-view.c (e_week_view_show_popup_menu): Ditto. - - The files popup-menu.c and popup-menu.h can now be removed. - -2001-03-02 JP Rosevear <jpr@ximian.com> - - * conduits/todo/e-todo.conduit.in: update for new pilot foo +2001-03-13 Ettore Perazzoli <ettore@ximian.com> - * conduits/calendar/e-calendar.conduit.in: ditto + * conduits/todo/Makefile.am (INCLUDES): Use `$(PISOCK_INCLUDEDIR)' + instead of `$(PISOCK_CFLAGS)'. - * conduits/todo/Makefile.am: update sed script + * conduits/calendar/Makefile.am (INCLUDES): Use + `$(PISOCK_INCLUDEDIR)' instead of `$(PISOCK_CFLAGS)'. - * conduits/calendar/Makefile.am: ditto - -2001-02-28 Federico Mena Quintero <federico@ximian.com> - - * gui/event-editor.c (recurrence_exception_select_row_cb): New - function to set the EDateEdit's value when a row is selected in - the exception date list. Fixes bug #1638. - (append_exception): Set the value as well. Block/unblock signals - from the clist as appropriate. Gotta love non-model/view widgets. - (recurrence_exception_delete_cb): Be more paranoid about the - contents of the list row's data. - (recur_to_comp_object): Likewise. - (fill_exception_widgets): Select the first row after we are done - appending the exception dates. - -2001-02-26 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/Makefile.am (libalarm_a_SOURCES): Create a - little stand-alone library for the low-level alarm trigger - mechanism. This is so that the GUI parts of the calendar can use - it in addition to the alarm daemon. - - * gui/main.c: #include "alarm-notify/alarm.h". - - * gui/calendar-summary.c: Likewise. - (alarm_fn): Do not remove the previous alarm; it is removed - automatically when it is triggered. - - * gui/Makefile.am (evolution_calendar_SOURCES): Removed alarm.[ch] - from the sources. - - * gui/alarm.[ch]: Removed obsolete files. - -2001-02-23 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/alarm-notify.c (AlarmNotify_addCalendar): - Switched to using our own refcounted structure for loaded clients. - (AlarmNotify_removeCalendar): Ditto. Also, do the full - destruction of the client. - (alarm_notify_destroy): Destroy each element in the hash table. - - * cal-client/cal-client.c (cal_client_construct): Test for - exceptions from OAF when activating the Wombat calendar factory. - - * gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.oaf.in: - New .oaf.in file. - - * gui/alarm-notify/Makefile.am (oaf_in_files): Updated. - - * gui/GNOME_Evolution_Calendar.oaf.in: Put all the servers here - instead of in a million files. - - * gui/GNOME_Evolution_Calendar_Control.oaf.in: Removed file. - - * gui/GNOME_Evolution_Calendar_gnomecal.oaf.in: Removed *REALLY* - obsolete file. - - * gui/Makefile.am (oaf_in_files): Updated. - -2001-02-23 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-db.c (add_history): fixed generation of history records - -2001-02-16 Federico Mena Quintero <federico@ximian.com> - - * pcs/cal-factory.c (CalFactoryPrivate): Added a `registered' - field. - (cal_factory_oaf_register): New function; now the factory performs - its own registration with OAF. - (cal_factory_destroy): Unregister from OAF if appropriate. - -2001-02-19 JP Rosevear <jpr@ximian.com> +2001-03-09 JP Rosevear <jpr@ximian.com> - * conduits/todo/Makefile.am: Remove PISOCK_LIBDIR + * conduits/todo/Makefile.am: PISOCK_INCLUDEDIR has become + PISOCK_CFLAGS in gnome-pilot.m4 and remove capplet foo * conduits/calendar/Makefile.am: ditto - -2001-02-16 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/calbackend-db.c (cal_backend_db_destroy): close DB environment. - Some compilation warnings removed - -2001-02-13 Christopher James Lahey <clahey@ximian.com> - - * gui/Makefile.am (evolution_calendar_LDADD): Added libmenus.la. - - * gui/e-calendar-table.c, gui/e-calendar-table.h - (e_calendar_table_get_spec): Added this function. - - * gui/e-tasks.c, gui/e-tasks.h (e_tasks_setup_menus): Added this - function. - - * gui/tasks-control.c (tasks_control_activate): Call - e_tasks_setup_menus. - -2001-02-13 JP Rosevear <jpr@ximian.com> - - * gui/e-tasks.c (e_tasks_new_task): call task_editor_focus 2001-02-13 JP Rosevear <jpr@ximian.com> - * gui/calendar-commands.c (update_pixmaps): Set toolbar new - appointment icon - (set_pixmap): load files rather than create from xpm file - - * gui/*view.xpm: move to the art directory - -2001-02-13 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-db.c (cal_backend_db_get_alarms_for_object): - implemented - -2001-02-13 JP Rosevear <jpr@ximian.com> - - * gui/calendar-commands.c (update_pixmaps): Set toolbar new command - - * gui/e-calendar-table.c: Add titles to pixbuf column for grouping + * gui/e-tasks.c (e_tasks_new_task): call task_editor_focus - * gui/calendar-model.c (calendar_model_class_init): override value - to string virtual method - (calendar_model_value_to_string): implement value to string for - etable (necessary for group by) +2001-02-08 Iain Holmes <iain@ximian.com> -2001-02-12 Rodrigo Moya <rodrigo@ximian.com> + * gui/calendar-summary.c: Load the tasks.ics file as well, so that tasks are + displayed again. - * pcs/cal-backend-file.c: - cal_backend_db_update_object(): manage both updates and additions/add notification - cal_backend_db_get_object(): don't use DB cursors - cal_backend_db_get_type_by_uid(): don't use DB cursors - cal_backend_db_remove_object(): don't use DB cursors/add notification - cal_backend_db_get_alarms_in_range(): implemented +2001-02-12 Ettore Perazzoli <ettore@ximian.com> -2001-02-12 Kjartan Maraas <kmaraas@gnome.org> + * conduits/todo/Makefile.am (INCLUDES): `-I$(top_srcdir)/e-util', + not `-I$(top_builddir)/e-util'. - * gui/Makefile.am: Hook up the xml-i18n-tools + .oaf.in stuff. - * gui/GNOME_Evolution_Calendar*.oaf.in: Marked strings for translation. - -2001-02-11 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-db.c: added DB3 transactions support - * pcs/cal-backend-db.[ch]: added the new DB3-based backend. This is just - the beginning, there are some missing things still. + * conduits/calendar/Makefile.am (INCLUDES): + `-I$(top_srcdir)/e-util', not `-I$(top_builddir)/e-util'. 2001-02-11 Gediminas Paulauskas <menesis@delfi.lt> @@ -251,49 +53,11 @@ 2001-02-08 JP Rosevear <jpr@ximian.com> - * gui/dialogs/task-editor-dialog.glade: Oops, remove old widget - -2001-02-08 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/task-editor.c (fill_widgets): fill in new - classification stuff properly - (get_widgets): load new class. widgets - (init_widgets): if the class. widgets change, mark the dialog - dirty - (dialog_to_comp_object): set the comp class. from the new widgets - - * gui/dialogs/task-editor-dialog.glade: Make more consistent, - fixing bugs 1247 and 1249 - - * gui/dialogs/task-editor.c (fill_widgets): - - * gui/event-editor-dialog.glade: Gui tidying - - * gui/event-editor.c: Remove old alarm cruft - * cal-util/cal-component.c (cal_component_set_url): Don't try and write an empty string as a property - -2001-02-08 JP Rosevear <jpr@ximian.com> - - * pcs/cal-backend-file.c: Move the get_change code here - - * pcs/cal-backend.c: Remove get_changes related stuff and - implement by calling the virtual method instead - - * pcs/cal-backend.h: New virtual method. - - * pcs/cal-backend-file.c (compute_alarm_range): Use - icaldurationtype_as_int (replace _as_timet) - (add_alarm_occurrences_cb): ditto - 2001-02-08 JP Rosevear <jpr@ximian.com> - * pcs/cal-backend-file.c (compute_alarm_range): Use - icaldurationtype_as_int (replace _as_timet) - (add_alarm_occurrences_cb): ditto - * gui/e-week-view.c (e_week_view_on_schedule_meet): new routine to throw up the meeting schedule dialog (e_week_view_show_popup_menu): add schedule meeting to the @@ -302,6 +66,11 @@ 2001-02-08 JP Rosevear <jpr@ximian.com> * gui/event-editor.c: Remove assorted menu/bonobo stuff + (ee_apply_event_cb): listen for apply signal and save object + (ee_close_event_cb): listen for close signal and prompt to save if + need be + (event_editor_construct): no longer suck out the glade contents + into a bonobo win, listen for apply and close signals * gui/dialogs/task-editor.c: Remove assorted menu/bonobo stuff (task_editor_construct): no longer suck out the glade contents @@ -336,28 +105,8 @@ 2001-02-07 Iain Holmes <iain@ximian.com> - * gui/calendar-summary.c (create_summary_view): Add a setter to the - property bag. - (set_property): The setter. - (generate_html_summary): Sort the UIDs accodring to time. - -2001-02-06 JP Rosevear <jpr@ximian.com> - - * gui/event-editor.c (fill_reminder_widgets): Match new - append_alarm signature - (reminder_to_comp_object): only add alarms tagged as new, no - longer delete all alarms first - (append_reminder): the row data is now of type ReminderData, - rename from append_alarm - (reminder_add_cb): math new append_alarm signature - (reminder_delete_cb): if the alarm existed before the dialog was - loaded, delete it immediately from the cal component - -2001-02-06 JP Rosevear <jpr@ximian.com> - - * gui/event-editor-dialog.glade: Gui tweaks for bugs 1248 and 1246 - - * gui/dialogs/task-editor-dialog.glade: ditto + * gui/calendar-summary.c (create_summary_view): Add a setter + for the property bag. Fixes the title bug. 2001-02-07 JP Rosevear <jpr@ximian.com> @@ -386,6 +135,18 @@ format in libical (set_period_list): ditto +2001-02-06 JP Rosevear <jpr@ximian.com> + + * gui/event-editor.c (fill_reminder_widgets): Match new + append_alarm signature + (reminder_to_comp_object): only add alarms tagged as new, no + longer delete all alarms first + (append_reminder): the row data is now of type ReminderData, + rename from append_alarm + (reminder_add_cb): math new append_alarm signature + (reminder_delete_cb): if the alarm existed before the dialog was + loaded, delete it immediately from the cal component + 2001-02-05 JP Rosevear <jpr@ximian.com> * cal-util/cal-component.c (cal_component_alarm_set_trigger): Set diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c index 43c6841b2c..b0269ba262 100644 --- a/calendar/cal-util/cal-component.c +++ b/calendar/cal-util/cal-component.c @@ -3100,9 +3100,9 @@ cal_component_get_transparency (CalComponent *comp, CalComponentTransparency *tr val = icalproperty_get_transp (priv->transparency); - if (strcasecmp (val, "TRANSPARENT") == 0) + if (strcasecmp (val, "TRANSPARENT")) *transp = CAL_COMPONENT_TRANSP_TRANSPARENT; - else if (strcasecmp (val, "OPAQUE") == 0) + else if (strcasecmp (val, "OPAQUE")) *transp = CAL_COMPONENT_TRANSP_OPAQUE; else *transp = CAL_COMPONENT_TRANSP_UNKNOWN; diff --git a/calendar/conduits/calendar/Makefile.am b/calendar/conduits/calendar/Makefile.am index 8d8b81a9ee..9f794c1123 100644 --- a/calendar/conduits/calendar/Makefile.am +++ b/calendar/conduits/calendar/Makefile.am @@ -3,9 +3,9 @@ INCLUDES = \ -I$(top_srcdir)/calendar \ -I$(top_srcdir)/libical/src/libical \ -I$(top_builddir)/libical/src/libical \ - -I$(top_builddir)/e-util \ + -I$(top_srcdir)/e-util \ $(BONOBO_GNOME_CFLAGS) \ - $(PISOCK_CFLAGS) \ + $(PISOCK_INCLUDEDIR) \ $(GNOME_PILOT_CFLAGS) # Calendar Conduit diff --git a/calendar/conduits/todo/Makefile.am b/calendar/conduits/todo/Makefile.am index df97d306a4..98aa9ee735 100644 --- a/calendar/conduits/todo/Makefile.am +++ b/calendar/conduits/todo/Makefile.am @@ -3,9 +3,9 @@ INCLUDES = \ -I$(top_srcdir)/calendar \ -I$(top_srcdir)/libical/src/libical \ -I$(top_builddir)/libical/src/libical \ - -I$(top_builddir)/e-util \ + -I$(top_srcdir)/e-util \ $(BONOBO_GNOME_CFLAGS) \ - $(PISOCK_CFLAGS) \ + $(PISOCK_INCLUDEDIR) \ $(GNOME_PILOT_CFLAGS) # ToDo Conduit diff --git a/calendar/gui/Evolution-Composer.h b/calendar/gui/Evolution-Composer.h deleted file mode 100644 index 557a8dcdd4..0000000000 --- a/calendar/gui/Evolution-Composer.h +++ /dev/null @@ -1,353 +0,0 @@ -/* - * This file was generated by orbit-idl - DO NOT EDIT! - */ - -#include <glib.h> -#define ORBIT_IDL_SERIAL 9 -#include <orb/orbit.h> - -#ifndef Evolution_Composer_H -#define Evolution_Composer_H 1 -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/** typedefs **/ -#include <bonobo/Bonobo.h> -# 13 "/usr/share/idl/Bonobo.idl" -#if !defined(ORBIT_DECL_GNOME_Evolution_Composer) && !defined(_GNOME_Evolution_Composer_defined) -#define ORBIT_DECL_GNOME_Evolution_Composer 1 -#define _GNOME_Evolution_Composer_defined 1 -#define GNOME_Evolution_Composer__free CORBA_Object__free - typedef CORBA_Object GNOME_Evolution_Composer; - extern CORBA_unsigned_long GNOME_Evolution_Composer__classid; -#if !defined(TC_IMPL_TC_GNOME_Evolution_Composer_0) -#define TC_IMPL_TC_GNOME_Evolution_Composer_0 'E' -#define TC_IMPL_TC_GNOME_Evolution_Composer_1 'v' -#define TC_IMPL_TC_GNOME_Evolution_Composer_2 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_3 'l' -#define TC_IMPL_TC_GNOME_Evolution_Composer_4 'u' -#define TC_IMPL_TC_GNOME_Evolution_Composer_5 't' -#define TC_IMPL_TC_GNOME_Evolution_Composer_6 'i' -#define TC_IMPL_TC_GNOME_Evolution_Composer_7 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_8 'n' -#define TC_IMPL_TC_GNOME_Evolution_Composer_9 '_' -#define TC_IMPL_TC_GNOME_Evolution_Composer_10 'C' -#define TC_IMPL_TC_GNOME_Evolution_Composer_11 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_12 'm' -#define TC_IMPL_TC_GNOME_Evolution_Composer_13 'p' -#define TC_IMPL_TC_GNOME_Evolution_Composer_14 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_15 's' -#define TC_IMPL_TC_GNOME_Evolution_Composer_16 'e' -#define TC_IMPL_TC_GNOME_Evolution_Composer_17 'r' - extern const struct CORBA_TypeCode_struct - TC_GNOME_Evolution_Composer_struct; -#define TC_GNOME_Evolution_Composer ((CORBA_TypeCode)&TC_GNOME_Evolution_Composer_struct) -#endif -#endif -#if !defined(_GNOME_Evolution_Composer_Recipient_defined) -#define _GNOME_Evolution_Composer_Recipient_defined 1 - typedef struct - { - CORBA_char *name; - CORBA_char *address; - } - GNOME_Evolution_Composer_Recipient; - -#if !defined(TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_0) -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_0 'E' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_1 'v' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_2 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_3 'l' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_4 'u' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_5 't' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_6 'i' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_7 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_8 'n' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_9 '_' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_10 'C' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_11 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_12 'm' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_13 'p' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_14 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_15 's' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_16 'e' -#define TC_IMPL_TC_GNOME_Evolution_Composer_Recipient_17 'r' - extern const struct CORBA_TypeCode_struct - TC_GNOME_Evolution_Composer_Recipient_struct; -#define TC_GNOME_Evolution_Composer_Recipient ((CORBA_TypeCode)&TC_GNOME_Evolution_Composer_Recipient_struct) -#endif - extern GNOME_Evolution_Composer_Recipient - *GNOME_Evolution_Composer_Recipient__alloc(void); - extern gpointer GNOME_Evolution_Composer_Recipient__free(gpointer mem, - gpointer dat, - CORBA_boolean free_strings); /* ORBit internal use */ -#endif -#if !defined(ORBIT_DECL_CORBA_sequence_GNOME_Evolution_Composer_Recipient) && !defined(_CORBA_sequence_GNOME_Evolution_Composer_Recipient_defined) -#define ORBIT_DECL_CORBA_sequence_GNOME_Evolution_Composer_Recipient 1 -#define _CORBA_sequence_GNOME_Evolution_Composer_Recipient_defined 1 -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_0 'E' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_1 'v' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_2 'o' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_3 'l' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_4 'u' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_5 't' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_6 'i' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_7 'o' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_8 'n' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_9 '_' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_10 'C' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_11 'o' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_12 'm' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_13 'p' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_14 'o' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_15 's' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_16 'e' -#define ORBIT_IMPL_CORBA_sequence_GNOME_Evolution_Composer_Recipient_17 'r' - typedef struct - { - CORBA_unsigned_long _maximum, - _length; - GNOME_Evolution_Composer_Recipient *_buffer; - CORBA_boolean _release; - } - CORBA_sequence_GNOME_Evolution_Composer_Recipient; -#if !defined(TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_0) -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_0 'E' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_1 'v' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_2 'o' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_3 'l' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_4 'u' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_5 't' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_6 'i' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_7 'o' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_8 'n' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_9 '_' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_10 'C' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_11 'o' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_12 'm' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_13 'p' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_14 'o' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_15 's' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_16 'e' -#define TC_IMPL_TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_17 'r' - extern const struct CORBA_TypeCode_struct - TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_struct; -#define TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient ((CORBA_TypeCode)&TC_CORBA_sequence_GNOME_Evolution_Composer_Recipient_struct) -#endif - extern CORBA_sequence_GNOME_Evolution_Composer_Recipient - *CORBA_sequence_GNOME_Evolution_Composer_Recipient__alloc(void); - extern gpointer - CORBA_sequence_GNOME_Evolution_Composer_Recipient__free(gpointer mem, - gpointer dat, - CORBA_boolean free_strings); /* ORBit internal use */ - GNOME_Evolution_Composer_Recipient - *CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf - (CORBA_unsigned_long len); -#endif -#if !defined(_GNOME_Evolution_Composer_RecipientList_defined) -#define _GNOME_Evolution_Composer_RecipientList_defined 1 - typedef CORBA_sequence_GNOME_Evolution_Composer_Recipient - GNOME_Evolution_Composer_RecipientList; -#if !defined(TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_0) -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_0 'E' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_1 'v' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_2 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_3 'l' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_4 'u' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_5 't' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_6 'i' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_7 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_8 'n' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_9 '_' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_10 'C' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_11 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_12 'm' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_13 'p' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_14 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_15 's' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_16 'e' -#define TC_IMPL_TC_GNOME_Evolution_Composer_RecipientList_17 'r' - extern const struct CORBA_TypeCode_struct - TC_GNOME_Evolution_Composer_RecipientList_struct; -#define TC_GNOME_Evolution_Composer_RecipientList ((CORBA_TypeCode)&TC_GNOME_Evolution_Composer_RecipientList_struct) -#endif - extern GNOME_Evolution_Composer_RecipientList - *GNOME_Evolution_Composer_RecipientList__alloc(void); - extern gpointer GNOME_Evolution_Composer_RecipientList__free(gpointer mem, - gpointer dat, - CORBA_boolean free_strings); /* ORBit internal use */ -#endif -#define ex_GNOME_Evolution_Composer_CouldNotParse "IDL:GNOME/Evolution/Composer/CouldNotParse:1.0" - void _ORBIT_GNOME_Evolution_Composer_CouldNotParse_demarshal(GIOPRecvBuffer - * - _ORBIT_recv_buffer, - CORBA_Environment - * ev); - void _ORBIT_GNOME_Evolution_Composer_CouldNotParse_marshal(GIOPSendBuffer * - _ORBIT_send_buffer, - CORBA_Environment - * ev); -#if !defined(_GNOME_Evolution_Composer_CouldNotParse_defined) -#define _GNOME_Evolution_Composer_CouldNotParse_defined 1 - typedef struct - { - int dummy; - } - GNOME_Evolution_Composer_CouldNotParse; - -#if !defined(TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_0) -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_0 'E' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_1 'v' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_2 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_3 'l' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_4 'u' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_5 't' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_6 'i' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_7 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_8 'n' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_9 '_' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_10 'C' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_11 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_12 'm' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_13 'p' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_14 'o' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_15 's' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_16 'e' -#define TC_IMPL_TC_GNOME_Evolution_Composer_CouldNotParse_17 'r' - extern const struct CORBA_TypeCode_struct - TC_GNOME_Evolution_Composer_CouldNotParse_struct; -#define TC_GNOME_Evolution_Composer_CouldNotParse ((CORBA_TypeCode)&TC_GNOME_Evolution_Composer_CouldNotParse_struct) -#endif -#define GNOME_Evolution_Composer_CouldNotParse__alloc() NULL - extern gpointer GNOME_Evolution_Composer_CouldNotParse__free(gpointer mem, - gpointer dat, - CORBA_boolean free_strings); /* ORBit internal use */ -#endif - -/** POA structures **/ - typedef struct - { - void *_private; - void (*setHeaders) (PortableServer_Servant _servant, - const GNOME_Evolution_Composer_RecipientList * to, - const GNOME_Evolution_Composer_RecipientList * cc, - const GNOME_Evolution_Composer_RecipientList * bcc, - const CORBA_char * subject, CORBA_Environment * ev); - void (*setBodyText) (PortableServer_Servant _servant, - const CORBA_char * body, CORBA_Environment * ev); - void (*attachMIME) (PortableServer_Servant _servant, - const CORBA_char * data, CORBA_Environment * ev); - void (*attachData) (PortableServer_Servant _servant, - const CORBA_char * content_type, - const CORBA_char * filename, - const CORBA_char * description, - const CORBA_boolean show_inline, - const CORBA_char * data, CORBA_Environment * ev); - void (*show) (PortableServer_Servant _servant, CORBA_Environment * ev); - } - POA_GNOME_Evolution_Composer__epv; - typedef struct - { - PortableServer_ServantBase__epv *_base_epv; - POA_Bonobo_Unknown__epv *Bonobo_Unknown_epv; - POA_GNOME_Evolution_Composer__epv *GNOME_Evolution_Composer_epv; - } - POA_GNOME_Evolution_Composer__vepv; - typedef struct - { - void *_private; - POA_GNOME_Evolution_Composer__vepv *vepv; - } - POA_GNOME_Evolution_Composer; - extern void POA_GNOME_Evolution_Composer__init(PortableServer_Servant - servant, - CORBA_Environment * ev); - extern void POA_GNOME_Evolution_Composer__fini(PortableServer_Servant - servant, - CORBA_Environment * ev); - -/** prototypes **/ -#define GNOME_Evolution_Composer_ref Bonobo_Unknown_ref -#define GNOME_Evolution_Composer_unref Bonobo_Unknown_unref -#define GNOME_Evolution_Composer_queryInterface Bonobo_Unknown_queryInterface - void GNOME_Evolution_Composer_setHeaders(GNOME_Evolution_Composer _obj, - const - GNOME_Evolution_Composer_RecipientList - * to, - const - GNOME_Evolution_Composer_RecipientList - * cc, - const - GNOME_Evolution_Composer_RecipientList - * bcc, const CORBA_char * subject, - CORBA_Environment * ev); - void GNOME_Evolution_Composer_setBodyText(GNOME_Evolution_Composer _obj, - const CORBA_char * body, - CORBA_Environment * ev); - void GNOME_Evolution_Composer_attachMIME(GNOME_Evolution_Composer _obj, - const CORBA_char * data, - CORBA_Environment * ev); - void GNOME_Evolution_Composer_attachData(GNOME_Evolution_Composer _obj, - const CORBA_char * content_type, - const CORBA_char * filename, - const CORBA_char * description, - const CORBA_boolean show_inline, - const CORBA_char * data, - CORBA_Environment * ev); - void GNOME_Evolution_Composer_show(GNOME_Evolution_Composer _obj, - CORBA_Environment * ev); - - void - _ORBIT_skel_GNOME_Evolution_Composer_setHeaders - (POA_GNOME_Evolution_Composer * _ORBIT_servant, - GIOPRecvBuffer * _ORBIT_recv_buffer, CORBA_Environment * ev, - void (*_impl_setHeaders) (PortableServer_Servant _servant, - const GNOME_Evolution_Composer_RecipientList - * to, - const GNOME_Evolution_Composer_RecipientList - * cc, - const GNOME_Evolution_Composer_RecipientList - * bcc, const CORBA_char * subject, - CORBA_Environment * ev)); - void - _ORBIT_skel_GNOME_Evolution_Composer_setBodyText - (POA_GNOME_Evolution_Composer * _ORBIT_servant, - GIOPRecvBuffer * _ORBIT_recv_buffer, CORBA_Environment * ev, - void (*_impl_setBodyText) (PortableServer_Servant _servant, - const CORBA_char * body, - CORBA_Environment * ev)); - void - _ORBIT_skel_GNOME_Evolution_Composer_attachMIME - (POA_GNOME_Evolution_Composer * _ORBIT_servant, - GIOPRecvBuffer * _ORBIT_recv_buffer, CORBA_Environment * ev, - void (*_impl_attachMIME) (PortableServer_Servant _servant, - const CORBA_char * data, - CORBA_Environment * ev)); - void - _ORBIT_skel_GNOME_Evolution_Composer_attachData - (POA_GNOME_Evolution_Composer * _ORBIT_servant, - GIOPRecvBuffer * _ORBIT_recv_buffer, CORBA_Environment * ev, - void (*_impl_attachData) (PortableServer_Servant _servant, - const CORBA_char * content_type, - const CORBA_char * filename, - const CORBA_char * description, - const CORBA_boolean show_inline, - const CORBA_char * data, - CORBA_Environment * ev)); - void _ORBIT_skel_GNOME_Evolution_Composer_show(POA_GNOME_Evolution_Composer - * _ORBIT_servant, - GIOPRecvBuffer * - _ORBIT_recv_buffer, - CORBA_Environment * ev, - void (*_impl_show) - (PortableServer_Servant - _servant, - CORBA_Environment * ev)); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif -#undef ORBIT_IDL_SERIAL diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 7c4a862b15..351194da4f 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -13,7 +13,8 @@ $(IDL_GENERATED): $(IDLS) $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ $(srcdir)/../../composer/Evolution-Composer.idl -SUBDIRS = alarm-notify dialogs +#SUBDIRS = alarm-notify dialogs +SUBDIRS = dialogs help_base = $(datadir)/gnome/help/cal @@ -46,6 +47,8 @@ glade_DATA = \ evolution_calendar_SOURCES = \ $(IDL_GENERATED) \ + alarm.c \ + alarm.h \ calendar-config.c \ calendar-config.h \ calendar-commands.c \ @@ -93,6 +96,8 @@ evolution_calendar_SOURCES = \ itip-utils.c \ itip-utils.h \ main.c \ + popup-menu.c \ + popup-menu.h \ print.c \ print.h \ tag-calendar.c \ @@ -109,7 +114,6 @@ evolution_calendar_SOURCES = \ widget-util.h evolution_calendar_LDADD = \ - alarm-notify/libalarm.a \ $(top_builddir)/shell/libeshell.a \ $(top_builddir)/calendar/cal-client/libcal-client.la \ $(top_builddir)/calendar/cal-util/libcal-util.la \ @@ -119,7 +123,6 @@ evolution_calendar_LDADD = \ $(top_builddir)/libical/src/libical/libical.la \ $(top_builddir)/widgets/meeting-time-sel/libevolutionmtsel.a \ $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/widgets/menus/libmenus.la \ dialogs/libcal-dialogs.a \ $(BONOBO_HTML_GNOME_LIBS) \ $(BONOBO_VFS_GNOME_LIBS) \ @@ -129,12 +132,7 @@ evolution_calendar_LDADD = \ #evolution_calendar_LDFLAGS = `gnome-config --libs gdk_pixbuf` oafdir = $(datadir)/oaf -oaf_in_files = \ - GNOME_Evolution_Calendar.oaf.in - -oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) - -@XML_I18N_MERGE_OAF_RULE@ +oaf_DATA = GNOME_Evolution_Calendar_Control.oafinfo GNOME_Evolution_Calendar.oafinfo EXTRA_DIST = \ $(glade_DATA) \ @@ -151,7 +149,7 @@ EXTRA_DIST = \ weekview.xpm \ workweekview.xpm \ yearview.xpm \ - $(oaf_in_files) $(oaf_DATA) + $(oaf_DATA) install-data-local: $(mkinstalldirs) $(DESTDIR)$(help_base)/C diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c deleted file mode 100644 index fbd8c1f097..0000000000 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.c +++ /dev/null @@ -1,226 +0,0 @@ -/* Evolution calendar - alarm notification dialog - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <gnome.h> -#include <glade/glade.h> -#include "alarm-notify-dialog.h" - - - -/* The useful contents of the alarm notify dialog */ -typedef struct { - GladeXML *xml; - - GtkWidget *dialog; - GtkWidget *close; - GtkWidget *snooze; - GtkWidget *edit; - GtkWidget *heading; - GtkWidget *summary; - GtkWidget *snooze_time; - - AlarmNotifyFunc func; - gpointer func_data; -} AlarmNotify; - - - -/* Callback used when the notify dialog is destroyed */ -static void -dialog_destroy_cb (GtkObject *object, gpointer data) -{ - AlarmNotify *an; - - an = data; - gtk_object_unref (GTK_OBJECT (an->xml)); - g_free (an); -} - -/* Delete_event handler for the alarm notify dialog */ -static gint -delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - AlarmNotify *an; - - an = data; - g_assert (an->func != NULL); - - (* an->func) (ALARM_NOTIFY_CLOSE, -1, an->func_data); - - gtk_widget_destroy (widget); - return TRUE; -} - -/* Callback for the close button */ -static void -close_clicked_cb (GtkWidget *widget, gpointer data) -{ - AlarmNotify *an; - - an = data; - g_assert (an->func != NULL); - - (* an->func) (ALARM_NOTIFY_CLOSE, -1, an->func_data); - - gtk_widget_destroy (an->dialog); -} - -/* Callback for the snooze button */ -static void -snooze_clicked_cb (GtkWidget *widget, gpointer data) -{ - AlarmNotify *an; - int snooze_time; - - an = data; - g_assert (an->func != NULL); - - snooze_time = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (an->snooze_time)); - (* an->func) (ALARM_NOTIFY_SNOOZE, snooze_time, an->func_data); - - gtk_widget_destroy (an->dialog); -} - -/* Callback for the edit button */ -static void -edit_clicked_cb (GtkWidget *widget, gpointer data) -{ - AlarmNotify *an; - - an = data; - g_assert (an->func != NULL); - - (* an->func) (ALARM_NOTIFY_EDIT, -1, an->func_data); - - gtk_widget_destroy (an->dialog); -} - -/** - * alarm_notify_dialog: - * @trigger: Trigger time for the alarm. - * @occur: Occurrence time for the event. - * @comp: Calendar component object which corresponds to the alarm. - * @func: Function to be called when a dialog action is invoked. - * @func_data: Closure data for @func. - * - * Runs the alarm notification dialog. The specified @func will be used to - * notify the client about result of the actions in the dialog. - * - * Return value: TRUE on success, FALSE if the dialog could not be created. - **/ -gboolean -alarm_notify_dialog (time_t trigger, time_t occur, CalComponent *comp, - AlarmNotifyFunc func, gpointer func_data) -{ - AlarmNotify *an; - char buf[256]; - struct tm tm_trigger; - struct tm tm_occur; - CalComponentText summary; - - g_return_val_if_fail (trigger != -1, FALSE); - g_return_val_if_fail (occur != -1, FALSE); - g_return_val_if_fail (comp != NULL, FALSE); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); - g_return_val_if_fail (func != NULL, FALSE); - - an = g_new0 (AlarmNotify, 1); - - an->func = func; - an->func_data = func_data; - - an->xml = glade_xml_new (EVOLUTION_GLADEDIR "/alarm-notify.glade", NULL); - if (!an->xml) { - g_message ("alarm_notify_dialog(): Could not load the Glade XML file!"); - g_free (an); - return FALSE; - } - - an->dialog = glade_xml_get_widget (an->xml, "alarm-notify"); - an->close = glade_xml_get_widget (an->xml, "close"); - an->snooze = glade_xml_get_widget (an->xml, "snooze"); - an->edit = glade_xml_get_widget (an->xml, "edit"); - an->heading = glade_xml_get_widget (an->xml, "heading"); - an->summary = glade_xml_get_widget (an->xml, "summary"); - an->snooze_time = glade_xml_get_widget (an->xml, "snooze-time"); - - if (!(an->dialog && an->close && an->snooze && an->edit && an->heading && an->summary - && an->snooze_time)) { - g_message ("alarm_notify_dialog(): Could not find all widgets in Glade file!"); - gtk_object_unref (GTK_OBJECT (an->xml)); - g_free (an); - return FALSE; - } - - gtk_object_set_data (GTK_OBJECT (an->dialog), "alarm-notify", an); - gtk_signal_connect (GTK_OBJECT (an->dialog), "destroy", - GTK_SIGNAL_FUNC (dialog_destroy_cb), an); - - /* Title */ - - /* FIXME: use am_pm_flag or 24-hour time */ - - tm_trigger = *localtime (&trigger); - strftime (buf, sizeof (buf), _("Alarm on %A %b %d %Y %H:%M"), &tm_trigger); - gtk_window_set_title (GTK_WINDOW (an->dialog), buf); - - /* Heading */ - - tm_occur = *localtime (&occur); - strftime (buf, sizeof (buf), - _("Notification about your appointment on %A %b %d %Y %H:%M"), - &tm_occur); - gtk_label_set_text (GTK_LABEL (an->heading), buf); - - /* Summary */ - - cal_component_get_summary (comp, &summary); - - if (summary.value) - gtk_label_set_text (GTK_LABEL (an->summary), summary.value); - else - gtk_label_set_text (GTK_LABEL (an->summary), _("No summary available.")); - - /* Connect actions */ - - gtk_signal_connect (GTK_OBJECT (an->dialog), "delete_event", - GTK_SIGNAL_FUNC (delete_event_cb), - an); - - gtk_signal_connect (GTK_OBJECT (an->close), "clicked", - GTK_SIGNAL_FUNC (close_clicked_cb), - an); - - gtk_signal_connect (GTK_OBJECT (an->snooze), "clicked", - GTK_SIGNAL_FUNC (snooze_clicked_cb), - an); - - gtk_signal_connect (GTK_OBJECT (an->edit), "clicked", - GTK_SIGNAL_FUNC (edit_clicked_cb), - an); - - /* Run! */ - - gtk_widget_show (an->dialog); - return TRUE; -} diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.h b/calendar/gui/alarm-notify/alarm-notify-dialog.h deleted file mode 100644 index f2c938c495..0000000000 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Evolution calendar - alarm notification dialog - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef ALARM_NOTIFY_DIALOG_H -#define ALARM_NOTIFY_DIALOG_H - -#include <time.h> -#include <glib.h> -#include <cal-util/cal-component.h> - - - -typedef enum { - ALARM_NOTIFY_CLOSE, - ALARM_NOTIFY_SNOOZE, - ALARM_NOTIFY_EDIT -} AlarmNotifyResult; - -typedef void (* AlarmNotifyFunc) (AlarmNotifyResult result, int snooze_mins, gpointer data); - -gboolean alarm_notify_dialog (time_t trigger, time_t occur, CalComponent *comp, - AlarmNotifyFunc func, gpointer func_data); - - - -#endif diff --git a/calendar/gui/alarm-notify/alarm-notify.glade b/calendar/gui/alarm-notify/alarm-notify.glade deleted file mode 100644 index 41718d0572..0000000000 --- a/calendar/gui/alarm-notify/alarm-notify.glade +++ /dev/null @@ -1,228 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Evolution Calendar</name> - <program_name>evolution-calendar</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <use_widget_names>False</use_widget_names> - <output_main_file>True</output_main_file> - <output_support_files>True</output_support_files> - <output_build_files>True</output_build_files> - <backup_source_files>True</backup_source_files> - <main_source_file>interface.c</main_source_file> - <main_header_file>interface.h</main_header_file> - <handler_source_file>callbacks.c</handler_source_file> - <handler_header_file>callbacks.h</handler_header_file> - <support_source_file>support.c</support_source_file> - <support_header_file>support.h</support_header_file> -</project> - -<widget> - <class>GtkWindow</class> - <name>alarm-notify</name> - <cxx_use_heap>True</cxx_use_heap> - <title></title> - <type>GTK_WINDOW_DIALOG</type> - <position>GTK_WIN_POS_CENTER</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>False</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkVBox</class> - <name>vbox2</name> - <border_width>4</border_width> - <cxx_use_heap>True</cxx_use_heap> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox3</name> - <cxx_use_heap>True</cxx_use_heap> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox5</name> - <cxx_use_heap>True</cxx_use_heap> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>heading</name> - <cxx_use_heap>True</cxx_use_heap> - <label></label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>True</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>summary</name> - <cxx_use_heap>True</cxx_use_heap> - <label></label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>True</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox4</name> - <cxx_use_heap>True</cxx_use_heap> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>close</name> - <cxx_use_heap>True</cxx_use_heap> - <can_focus>True</can_focus> - <label>Close</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>snooze</name> - <cxx_use_heap>True</cxx_use_heap> - <can_focus>True</can_focus> - <label>Snooze</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>edit</name> - <cxx_use_heap>True</cxx_use_heap> - <can_focus>True</can_focus> - <label>Edit appointment</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHSeparator</class> - <name>hseparator1</name> - <cxx_use_heap>True</cxx_use_heap> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox4</name> - <cxx_use_heap>True</cxx_use_heap> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label4</name> - <cxx_use_heap>True</cxx_use_heap> - <label>Snooze time (minutes)</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkSpinButton</class> - <name>snooze-time</name> - <cxx_use_heap>True</cxx_use_heap> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>False</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>5</value> - <lower>1</lower> - <upper>1440</upper> - <step>1</step> - <page>5</page> - <page_size>5</page_size> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/calendar/gui/calendar-summary.c b/calendar/gui/calendar-summary.c index 163d56f524..fa3c48c0a9 100644 --- a/calendar/gui/calendar-summary.c +++ b/calendar/gui/calendar-summary.c @@ -39,17 +39,18 @@ #include <gnome-xml/parser.h> #include <gnome-xml/xmlmemory.h> -#include <cal-util/cal-component.h> -#include <cal-util/timeutil.h> -#include "alarm-notify/alarm.h" +#include "cal-util/cal-component.h" +#include "cal-util/timeutil.h" +#include "alarm.h" #include "calendar-model.h" + #include "calendar-summary.h" typedef struct { ExecutiveSummaryComponent *component; ExecutiveSummaryHtmlView *view; BonoboPropertyControl *property_control; - CalClient *client; + CalClient *client, *task_client; GtkWidget *show_appointments; GtkWidget *show_tasks; @@ -63,6 +64,8 @@ typedef struct { guint32 idle; gpointer alarm; + + gboolean calendar_ready, task_ready; } CalSummary; enum { @@ -76,106 +79,6 @@ static int running_views = 0; static BonoboGenericFactory *factory; #define CALENDAR_SUMMARY_ID "OAFIID:GNOME_Evolution_Calendar_Summary_ComponentFactory" -/* list_sort_merge, and list_sort are copied from GNOME-VFS. - Author: Sven Oliver <sven.over@ob.kamp.net> - Modified by Ettore Perazzoli <ettore@comm2000.it> to let the compare - functions get an additional gpointer parameter. - - Included here as using gnome-vfs for 1 20 line function - seems a bit of overkill. -*/ - -typedef gint (* CalSummaryListCompareFunc) (gconstpointer a, - gconstpointer b, - gpointer data); -static GList * -cal_list_sort_merge (GList *l1, - GList *l2, - CalSummaryListCompareFunc compare_func, - gpointer data) -{ - GList list, *l, *lprev; - - l = &list; - lprev = NULL; - - while (l1 && l2) { - if (compare_func (l1->data, l2->data, data) < 0) { - l->next = l1; - l = l->next; - l->prev = lprev; - lprev = l; - l1 = l1->next; - } else { - l->next = l2; - l = l->next; - l->prev = lprev; - lprev = l; - l2 = l2->next; - } - } - - l->next = l1 ? l1 : l2; - l->next->prev = l; - - return list.next; -} - -static GList * -cal_list_sort (GList *list, - CalSummaryListCompareFunc compare_func, - gpointer data) -{ - GList *l1, *l2; - - if (!list) - return NULL; - if (!list->next) - return list; - - l1 = list; - l2 = list->next; - - while ((l2 = l2->next) != NULL) { - if ((l2 = l2->next) == NULL) - break; - l1 = l1->next; - } - - l2 = l1->next; - l1->next = NULL; - - return cal_list_sort_merge (cal_list_sort (list, compare_func, data), - cal_list_sort (l2, compare_func, data), - compare_func, data); -} - -static int -sort_uids (gconstpointer a, - gconstpointer b, - gpointer user_data) -{ - CalComponent *comp_a, *comp_b; - CalSummary *summary = user_data; - CalClientGetStatus status; - CalComponentDateTime start_a, start_b; - - /* a after b then return > 0 */ - - status = cal_client_get_object (summary->client, a, &comp_a); - if (status != CAL_CLIENT_GET_SUCCESS) - return -1; - - status = cal_client_get_object (summary->client, b, &comp_b); - if (status != CAL_CLIENT_GET_SUCCESS) - return 1; - - cal_component_get_dtstart (comp_a, &start_a); - cal_component_get_dtstart (comp_b, &start_b); - - return icaltime_compare (*start_a.value, *start_b.value); -} - static gboolean generate_html_summary (gpointer data) { @@ -206,8 +109,6 @@ generate_html_summary (gpointer data) uids = cal_client_get_objects_in_range (summary->client, CALOBJ_TYPE_EVENT, day_begin, day_end); - uids = cal_list_sort (uids, sort_uids, summary); - for (l = uids; l; l = l->next){ CalComponent *comp; CalComponentText text; @@ -272,7 +173,7 @@ generate_html_summary (gpointer data) g_free (tmp); /* Generate a list of tasks */ - uids = cal_client_get_uids (summary->client, CALOBJ_TYPE_TODO); + uids = cal_client_get_uids (summary->task_client, CALOBJ_TYPE_TODO); for (l = uids; l; l = l->next){ CalComponent *comp; CalComponentText text; @@ -282,7 +183,7 @@ generate_html_summary (gpointer data) char *tmp2; uid = l->data; - status = cal_client_get_object (summary->client, uid, &comp); + status = cal_client_get_object (summary->task_client, uid, &comp); if (status != CAL_CLIENT_GET_SUCCESS) continue; @@ -328,7 +229,6 @@ get_property (BonoboPropertyBag *bag, switch (arg_id) { case PROPERTY_TITLE: - g_warning ("Get property: %s", summary->title); BONOBO_ARG_SET_STRING (arg, summary->title); break; @@ -363,12 +263,12 @@ set_property (BonoboPropertyBag *bag, case PROPERTY_ICON: if (summary->icon) g_free (summary->icon); - + summary->icon = g_strdup (BONOBO_ARG_GET_STRING (arg)); bonobo_property_bag_notify_listeners (bag, "window_icon", arg, NULL); break; - + default: break; } @@ -426,6 +326,14 @@ cal_opened_cb (CalClient *client, { switch (status) { case CAL_CLIENT_OPEN_SUCCESS: + if (client == summary->client) + summary->calendar_ready = TRUE; + else + summary->task_ready = TRUE; + + if (! (summary->calendar_ready && summary->task_ready)) + return; + if (summary->idle != 0) return; @@ -456,7 +364,7 @@ cal_opened_cb (CalClient *client, static void alarm_fn (gpointer alarm_id, - time_t trigger, + time_t old_t, gpointer data) { CalSummary *summary; @@ -464,6 +372,9 @@ alarm_fn (gpointer alarm_id, summary = data; + /* Remove the old alarm, and start a new one for the next midnight */ + alarm_remove (alarm_id); + t = time (NULL); day_end = time_day_end (t); summary->alarm = alarm_add (day_end, alarm_fn, summary, NULL); @@ -673,8 +584,6 @@ create_summary_view (ExecutiveSummaryComponentFactory *_factory, char *file; time_t t, day_end; - file = g_concat_dir_and_file (evolution_dir, "local/Calendar/calendar.ics"); - /* Create the component object */ component = executive_summary_component_new (); @@ -683,6 +592,23 @@ create_summary_view (ExecutiveSummaryComponentFactory *_factory, summary->icon = g_strdup ("evolution-calendar.png"); summary->title = g_strdup ("Things to do"); summary->client = cal_client_new (); + summary->calendar_ready = FALSE; + gtk_signal_connect (GTK_OBJECT (summary->client), "cal-opened", + GTK_SIGNAL_FUNC (cal_opened_cb), summary); + gtk_signal_connect (GTK_OBJECT (summary->client), "obj-updated", + GTK_SIGNAL_FUNC (obj_updated_cb), summary); + gtk_signal_connect (GTK_OBJECT (summary->client), "obj-removed", + GTK_SIGNAL_FUNC (obj_removed_cb), summary); + + summary->task_client = cal_client_new (); + summary->task_ready = FALSE; + gtk_signal_connect (GTK_OBJECT (summary->task_client), "cal-opened", + GTK_SIGNAL_FUNC (cal_opened_cb), summary); + gtk_signal_connect (GTK_OBJECT (summary->task_client), "obj-updated", + GTK_SIGNAL_FUNC (obj_updated_cb), summary); + gtk_signal_connect (GTK_OBJECT (summary->task_client), "obj-removed", + GTK_SIGNAL_FUNC (obj_removed_cb), summary); + summary->idle = 0; summary->appointments = TRUE; summary->tasks = TRUE; @@ -692,16 +618,15 @@ create_summary_view (ExecutiveSummaryComponentFactory *_factory, summary->alarm = alarm_add (day_end, alarm_fn, summary, NULL); /* Load calendar */ + file = g_concat_dir_and_file (evolution_dir, "local/Calendar/calendar.ics"); cal_client_open_calendar (summary->client, file, FALSE); g_free (file); - gtk_signal_connect (GTK_OBJECT (summary->client), "cal-opened", - GTK_SIGNAL_FUNC (cal_opened_cb), summary); - gtk_signal_connect (GTK_OBJECT (summary->client), "obj-updated", - GTK_SIGNAL_FUNC (obj_updated_cb), summary); - gtk_signal_connect (GTK_OBJECT (summary->client), "obj-removed", - GTK_SIGNAL_FUNC (obj_removed_cb), summary); - + /* Load tasks */ + file = g_concat_dir_and_file (evolution_dir, "local/Tasks/tasks.ics"); + cal_client_open_calendar (summary->task_client, file, FALSE); + g_free (file); + gtk_signal_connect (GTK_OBJECT (component), "destroy", GTK_SIGNAL_FUNC (component_destroyed), summary); diff --git a/calendar/gui/dialogs/task-editor-dialog.glade b/calendar/gui/dialogs/task-editor-dialog.glade index ae7ea9681a..4227273a69 100644 --- a/calendar/gui/dialogs/task-editor-dialog.glade +++ b/calendar/gui/dialogs/task-editor-dialog.glade @@ -35,6 +35,11 @@ <tab_hborder>2</tab_hborder> <tab_vborder>2</tab_vborder> <popup_enable>False</popup_enable> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> <widget> <class>GtkVBox</class> @@ -60,7 +65,7 @@ <widget> <class>GtkLabel</class> <name>label3</name> - <label>Su_mmary:</label> + <label>Su_mmary</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> <xalign>0.5</xalign> @@ -110,168 +115,20 @@ </widget> <widget> - <class>GtkFrame</class> - <name>frame2</name> - <label>Date & Time</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> + <class>GtkHSeparator</class> + <name>hseparator1</name> <child> <padding>0</padding> <expand>False</expand> <fill>True</fill> </child> - - <widget> - <class>GtkHBox</class> - <name>hbox4</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkTable</class> - <name>table1</name> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>2</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label6</name> - <label>Sta_rt Date:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label5</name> - <label>_Due Date:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>due-date</name> - <creation_function>task_editor_create_date_edit</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Sun, 10 Sep 2000 17:32:18 GMT</last_modification_time> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>start-date</name> - <creation_function>task_editor_create_date_edit</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Sun, 10 Sep 2000 17:33:31 GMT</last_modification_time> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> </widget> <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkText</class> - <name>description</name> - <height>80</height> - <can_focus>True</can_focus> - <editable>True</editable> - <text></text> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame23</name> - <label>Progress</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> + <class>GtkHBox</class> + <name>hbox4</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> <child> <padding>0</padding> <expand>False</expand> @@ -279,79 +136,68 @@ </child> <widget> - <class>GtkHBox</class> - <name>hbox3</name> - <border_width>4</border_width> + <class>GtkTable</class> + <name>table1</name> + <rows>2</rows> + <columns>4</columns> <homogeneous>False</homogeneous> - <spacing>4</spacing> + <row_spacing>2</row_spacing> + <column_spacing>4</column_spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + </child> <widget> <class>GtkLabel</class> - <name>label7</name> - <label>_Status:</label> + <name>label6</name> + <label>Sta_rt Date:</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> - <xalign>0.5</xalign> + <xalign>0</xalign> <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <default_focus_target>status</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>status</name> - <can_focus>True</can_focus> - <items>Not Started -In Progress -Completed -Cancelled -</items> - <initial_choice>0</initial_choice> <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> </child> </widget> <widget> <class>GtkLabel</class> - <name>label8</name> - <label>_Priority:</label> + <name>label5</name> + <label>_Due Date:</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> - <xalign>0.5</xalign> + <xalign>0</xalign> <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <default_focus_target>priority</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>priority</name> - <can_focus>True</can_focus> - <items>High -Normal -Low -Undefined -</items> - <initial_choice>0</initial_choice> <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> </child> </widget> @@ -367,9 +213,18 @@ Undefined <ypad>0</ypad> <default_focus_target>percent-complete</default_focus_target> <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> </child> </widget> @@ -391,20 +246,84 @@ Undefined <page>10</page> <page_size>10</page_size> <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> + <left_attach>3</left_attach> + <right_attach>4</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>Custom</class> + <name>due-date</name> + <creation_function>task_editor_create_date_edit</creation_function> + <int1>0</int1> + <int2>0</int2> + <last_modification_time>Sun, 10 Sep 2000 17:32:18 GMT</last_modification_time> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>Custom</class> + <name>start-date</name> + <creation_function>task_editor_create_date_edit</creation_function> + <int1>0</int1> + <int2>0</int2> + <last_modification_time>Sun, 10 Sep 2000 17:33:31 GMT</last_modification_time> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> </child> </widget> </widget> </widget> <widget> - <class>GtkFrame</class> - <name>frame24</name> - <label>Classification</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> + <class>GtkHSeparator</class> + <name>hseparator2</name> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + </child> + </widget> + + <widget> + <class>GtkHBox</class> + <name>hbox3</name> + <homogeneous>False</homogeneous> + <spacing>4</spacing> <child> <padding>0</padding> <expand>False</expand> @@ -412,56 +331,131 @@ Undefined </child> <widget> - <class>GtkHBox</class> - <name>hbox6</name> - <border_width>2</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> + <class>GtkLabel</class> + <name>label7</name> + <label>_Status:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <default_focus_target>status</default_focus_target> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> - <widget> - <class>GtkRadioButton</class> - <name>classification-public</name> - <can_focus>True</can_focus> - <label>Pu_blic</label> - <active>True</active> - <draw_indicator>True</draw_indicator> - <group>classification_radio_group</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> + <widget> + <class>GtkOptionMenu</class> + <name>status</name> + <can_focus>True</can_focus> + <items>Not Started +In Progress +Completed +Cancelled +</items> + <initial_choice>0</initial_choice> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> - <widget> - <class>GtkRadioButton</class> - <name>classification-private</name> - <can_focus>True</can_focus> - <label>Pri_vate</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>classification_radio_group</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> + <widget> + <class>GtkLabel</class> + <name>label8</name> + <label>_Priority:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <default_focus_target>priority</default_focus_target> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> - <widget> - <class>GtkRadioButton</class> - <name>classification-confidential</name> - <can_focus>True</can_focus> - <label>_Confidential</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>classification_radio_group</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> + <widget> + <class>GtkOptionMenu</class> + <name>priority</name> + <can_focus>True</can_focus> + <items>High +Normal +Low +Undefined +</items> + <initial_choice>0</initial_choice> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label18</name> + <label>C_lassification:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <default_focus_target>classification</default_focus_target> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkOptionMenu</class> + <name>classification</name> + <can_focus>True</can_focus> + <items>None +Public +Private +Confidential +</items> + <initial_choice>0</initial_choice> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + </widget> + + <widget> + <class>GtkScrolledWindow</class> + <name>scrolledwindow1</name> + <height>150</height> + <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> + <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy> + <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> + <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkText</class> + <name>description</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text></text> </widget> </widget> @@ -472,7 +466,7 @@ Undefined <spacing>2</spacing> <child> <padding>0</padding> - <expand>True</expand> + <expand>False</expand> <fill>True</fill> </child> diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 64e73e30f5..936da0f8db 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -75,13 +75,10 @@ typedef struct { GtkWidget *status; GtkWidget *priority; + GtkWidget *classification; GtkWidget *description; - GtkWidget *classification_public; - GtkWidget *classification_private; - GtkWidget *classification_confidential; - GtkWidget *contacts; GtkWidget *categories_btn; GtkWidget *categories; @@ -121,12 +118,14 @@ static const int priority_map[] = { }; static const int classification_map[] = { + CAL_COMPONENT_CLASS_NONE, CAL_COMPONENT_CLASS_PUBLIC, CAL_COMPONENT_CLASS_PRIVATE, CAL_COMPONENT_CLASS_CONFIDENTIAL, -1 }; + static void task_editor_class_init (TaskEditorClass *class); static void task_editor_init (TaskEditor *tedit); static void tedit_apply_event_cb (GtkWidget *widget, gint page_num, gpointer data); @@ -162,7 +161,6 @@ static void field_changed (GtkWidget *widget, static void task_editor_set_changed (TaskEditor *tedit, gboolean changed); static gboolean prompt_to_save_changes (TaskEditor *tedit); -static CalComponentClassification classification_get (GtkWidget *widget); static void categories_clicked (GtkWidget *button, TaskEditor *editor); @@ -372,13 +370,10 @@ get_widgets (TaskEditor *tedit) priv->status = GW ("status"); priv->priority = GW ("priority"); + priv->classification = GW ("classification"); priv->description = GW ("description"); - priv->classification_public = GW ("classification-public"); - priv->classification_private = GW ("classification-private"); - priv->classification_confidential = GW ("classification-confidential"); - priv->contacts = GW ("contacts"); priv->categories_btn = GW ("categories-button"); priv->categories = GW ("categories"); @@ -395,14 +390,12 @@ get_widgets (TaskEditor *tedit) && priv->percent_complete && priv->status && priv->priority - && priv->classification_public - && priv->classification_private - && priv->classification_confidential + && priv->classification && priv->description && priv->contacts && priv->categories_btn && priv->categories - && priv->completed_date + && priv->completed_date && priv->url); } @@ -429,19 +422,6 @@ init_widgets (TaskEditor *tedit) "value_changed", GTK_SIGNAL_FUNC (percent_complete_changed), tedit); - /* Classification */ - gtk_signal_connect (GTK_OBJECT (priv->description), "changed", - GTK_SIGNAL_FUNC (field_changed), tedit); - gtk_signal_connect (GTK_OBJECT (priv->classification_public), - "toggled", - GTK_SIGNAL_FUNC (field_changed), tedit); - gtk_signal_connect (GTK_OBJECT (priv->classification_private), - "toggled", - GTK_SIGNAL_FUNC (field_changed), tedit); - gtk_signal_connect (GTK_OBJECT (priv->classification_confidential), - "toggled", - GTK_SIGNAL_FUNC (field_changed), tedit); - /* Connect the default signal handler to use to make sure the "changed" field gets set whenever a field is changed. */ gtk_signal_connect (GTK_OBJECT (priv->summary), "changed", @@ -453,6 +433,9 @@ init_widgets (TaskEditor *tedit) gtk_signal_connect (GTK_OBJECT (GTK_OPTION_MENU (priv->priority)->menu), "deactivate", GTK_SIGNAL_FUNC (field_changed), tedit); + gtk_signal_connect (GTK_OBJECT (GTK_OPTION_MENU (priv->classification)->menu), + "deactivate", + GTK_SIGNAL_FUNC (field_changed), tedit); gtk_signal_connect (GTK_OBJECT (priv->description), "changed", GTK_SIGNAL_FUNC (field_changed), tedit); gtk_signal_connect (GTK_OBJECT (priv->contacts), "changed", @@ -752,8 +735,8 @@ fill_widgets (TaskEditor *tedit) TaskEditorPrivate *priv; CalComponentText text; CalComponentDateTime d; - CalComponentClassification cl; struct icaltimetype *completed; + CalComponentClassification classification; GSList *l; time_t t; int *priority_value, *percent; @@ -853,23 +836,9 @@ fill_widgets (TaskEditor *tedit) /* Classification. */ - cal_component_get_classification (priv->comp, &cl); - - switch (cl) { - case CAL_COMPONENT_CLASS_PUBLIC: - e_dialog_radio_set (priv->classification_public, CAL_COMPONENT_CLASS_PUBLIC, - classification_map); - case CAL_COMPONENT_CLASS_PRIVATE: - e_dialog_radio_set (priv->classification_public, CAL_COMPONENT_CLASS_PRIVATE, - classification_map); - case CAL_COMPONENT_CLASS_CONFIDENTIAL: - e_dialog_radio_set (priv->classification_public, CAL_COMPONENT_CLASS_CONFIDENTIAL, - classification_map); - default: - /* What do do? We can't g_assert_not_reached() since it is a - * value from an external file. - */ - } + cal_component_get_classification (priv->comp, &classification); + e_dialog_option_menu_set (priv->classification, classification, + classification_map); /* Categories */ cal_component_get_categories (priv->comp, &categories); @@ -916,6 +885,7 @@ dialog_to_comp_object (TaskEditor *tedit) icalproperty_status status; TaskEditorPriority priority; int priority_value, percent; + CalComponentClassification classification; char *url, *cat; char *str; @@ -1007,7 +977,9 @@ dialog_to_comp_object (TaskEditor *tedit) cal_component_set_priority (comp, &priority_value); /* Classification. */ - cal_component_set_classification (comp, classification_get (priv->classification_public)); + classification = e_dialog_option_menu_get (priv->classification, + classification_map); + cal_component_set_classification (comp, classification); /* Categories */ cat = e_dialog_editable_get (priv->categories); @@ -1178,13 +1150,6 @@ percent_complete_changed (GtkAdjustment *adj, priv->ignore_callbacks = FALSE; } -/* Decode the radio button group for classifications */ -static CalComponentClassification -classification_get (GtkWidget *widget) -{ - return e_dialog_radio_get (widget, classification_map); -} - /* This is called when all fields except those handled above (status, percent complete & completed date) are changed. It just sets the "changed" flag. */ diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade index ae7ea9681a..4227273a69 100644 --- a/calendar/gui/dialogs/task-page.glade +++ b/calendar/gui/dialogs/task-page.glade @@ -35,6 +35,11 @@ <tab_hborder>2</tab_hborder> <tab_vborder>2</tab_vborder> <popup_enable>False</popup_enable> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> <widget> <class>GtkVBox</class> @@ -60,7 +65,7 @@ <widget> <class>GtkLabel</class> <name>label3</name> - <label>Su_mmary:</label> + <label>Su_mmary</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> <xalign>0.5</xalign> @@ -110,168 +115,20 @@ </widget> <widget> - <class>GtkFrame</class> - <name>frame2</name> - <label>Date & Time</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> + <class>GtkHSeparator</class> + <name>hseparator1</name> <child> <padding>0</padding> <expand>False</expand> <fill>True</fill> </child> - - <widget> - <class>GtkHBox</class> - <name>hbox4</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkTable</class> - <name>table1</name> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>2</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label6</name> - <label>Sta_rt Date:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label5</name> - <label>_Due Date:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>due-date</name> - <creation_function>task_editor_create_date_edit</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Sun, 10 Sep 2000 17:32:18 GMT</last_modification_time> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>start-date</name> - <creation_function>task_editor_create_date_edit</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Sun, 10 Sep 2000 17:33:31 GMT</last_modification_time> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> </widget> <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkText</class> - <name>description</name> - <height>80</height> - <can_focus>True</can_focus> - <editable>True</editable> - <text></text> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame23</name> - <label>Progress</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> + <class>GtkHBox</class> + <name>hbox4</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> <child> <padding>0</padding> <expand>False</expand> @@ -279,79 +136,68 @@ </child> <widget> - <class>GtkHBox</class> - <name>hbox3</name> - <border_width>4</border_width> + <class>GtkTable</class> + <name>table1</name> + <rows>2</rows> + <columns>4</columns> <homogeneous>False</homogeneous> - <spacing>4</spacing> + <row_spacing>2</row_spacing> + <column_spacing>4</column_spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + </child> <widget> <class>GtkLabel</class> - <name>label7</name> - <label>_Status:</label> + <name>label6</name> + <label>Sta_rt Date:</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> - <xalign>0.5</xalign> + <xalign>0</xalign> <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <default_focus_target>status</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>status</name> - <can_focus>True</can_focus> - <items>Not Started -In Progress -Completed -Cancelled -</items> - <initial_choice>0</initial_choice> <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> </child> </widget> <widget> <class>GtkLabel</class> - <name>label8</name> - <label>_Priority:</label> + <name>label5</name> + <label>_Due Date:</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> - <xalign>0.5</xalign> + <xalign>0</xalign> <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <default_focus_target>priority</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>priority</name> - <can_focus>True</can_focus> - <items>High -Normal -Low -Undefined -</items> - <initial_choice>0</initial_choice> <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> </child> </widget> @@ -367,9 +213,18 @@ Undefined <ypad>0</ypad> <default_focus_target>percent-complete</default_focus_target> <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> </child> </widget> @@ -391,20 +246,84 @@ Undefined <page>10</page> <page_size>10</page_size> <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> + <left_attach>3</left_attach> + <right_attach>4</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>Custom</class> + <name>due-date</name> + <creation_function>task_editor_create_date_edit</creation_function> + <int1>0</int1> + <int2>0</int2> + <last_modification_time>Sun, 10 Sep 2000 17:32:18 GMT</last_modification_time> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>Custom</class> + <name>start-date</name> + <creation_function>task_editor_create_date_edit</creation_function> + <int1>0</int1> + <int2>0</int2> + <last_modification_time>Sun, 10 Sep 2000 17:33:31 GMT</last_modification_time> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> </child> </widget> </widget> </widget> <widget> - <class>GtkFrame</class> - <name>frame24</name> - <label>Classification</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> + <class>GtkHSeparator</class> + <name>hseparator2</name> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + </child> + </widget> + + <widget> + <class>GtkHBox</class> + <name>hbox3</name> + <homogeneous>False</homogeneous> + <spacing>4</spacing> <child> <padding>0</padding> <expand>False</expand> @@ -412,56 +331,131 @@ Undefined </child> <widget> - <class>GtkHBox</class> - <name>hbox6</name> - <border_width>2</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> + <class>GtkLabel</class> + <name>label7</name> + <label>_Status:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <default_focus_target>status</default_focus_target> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> - <widget> - <class>GtkRadioButton</class> - <name>classification-public</name> - <can_focus>True</can_focus> - <label>Pu_blic</label> - <active>True</active> - <draw_indicator>True</draw_indicator> - <group>classification_radio_group</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> + <widget> + <class>GtkOptionMenu</class> + <name>status</name> + <can_focus>True</can_focus> + <items>Not Started +In Progress +Completed +Cancelled +</items> + <initial_choice>0</initial_choice> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> - <widget> - <class>GtkRadioButton</class> - <name>classification-private</name> - <can_focus>True</can_focus> - <label>Pri_vate</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>classification_radio_group</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> + <widget> + <class>GtkLabel</class> + <name>label8</name> + <label>_Priority:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <default_focus_target>priority</default_focus_target> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> - <widget> - <class>GtkRadioButton</class> - <name>classification-confidential</name> - <can_focus>True</can_focus> - <label>_Confidential</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>classification_radio_group</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> + <widget> + <class>GtkOptionMenu</class> + <name>priority</name> + <can_focus>True</can_focus> + <items>High +Normal +Low +Undefined +</items> + <initial_choice>0</initial_choice> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label18</name> + <label>C_lassification:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <default_focus_target>classification</default_focus_target> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkOptionMenu</class> + <name>classification</name> + <can_focus>True</can_focus> + <items>None +Public +Private +Confidential +</items> + <initial_choice>0</initial_choice> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + </widget> + + <widget> + <class>GtkScrolledWindow</class> + <name>scrolledwindow1</name> + <height>150</height> + <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> + <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy> + <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> + <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkText</class> + <name>description</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text></text> </widget> </widget> @@ -472,7 +466,7 @@ Undefined <spacing>2</spacing> <child> <padding>0</padding> - <expand>True</expand> + <expand>False</expand> <fill>True</fill> </child> diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index f173ac3783..eb3bf5e2b4 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -36,8 +36,6 @@ #include <gal/e-table/e-cell-checkbox.h> #include <gal/e-table/e-cell-toggle.h> #include <gal/e-table/e-cell-text.h> -#include <gal/e-table/e-cell-combo.h> -#include <widgets/misc/e-cell-date-edit.h> #include "e-calendar-table.h" #include "calendar-model.h" #include "dialogs/delete-comp.h" @@ -160,7 +158,7 @@ static char *list [] = { N_("Start Date"), N_("Due Date"), N_("Geographical Position"), - N_("Percent complete"), + N_("Precent complete"), N_("Priority"), N_("Summary"), N_("Transparency"), @@ -179,49 +177,46 @@ static char *list [] = { " cell=\"calstring\" compare=\"string\"/>" \ " <ETableColumn model_col= \"1\" _title=\"Classification\" " \ " expansion=\"1.0\" minimum_width=\"10\" resizable=\"true\" " \ - " cell=\"classification\" compare=\"string\"/>" \ + " cell=\"calstring\" compare=\"string\"/>" \ " <ETableColumn model_col= \"2\" _title=\"Completion Date\" " \ " expansion=\"2.0\" minimum_width=\"10\" resizable=\"true\" " \ - " cell=\"dateedit\" compare=\"string\"/>" \ + " cell=\"calstring\" compare=\"string\"/>" \ " <ETableColumn model_col= \"3\" _title=\"End Date\" " \ " expansion=\"2.0\" minimum_width=\"10\" resizable=\"true\" " \ - " cell=\"dateedit\" compare=\"string\"/>" \ + " cell=\"calstring\" compare=\"string\"/>" \ " <ETableColumn model_col= \"4\" _title=\"Start Date\" " \ " expansion=\"2.0\" minimum_width=\"10\" resizable=\"true\" " \ - " cell=\"dateedit\" compare=\"string\"/>" \ + " cell=\"calstring\" compare=\"string\"/>" \ " <ETableColumn model_col= \"5\" _title=\"Due Date\" " \ " expansion=\"2.0\" minimum_width=\"10\" resizable=\"true\" " \ - " cell=\"dateedit\" compare=\"string\"/>" \ + " cell=\"calstring\" compare=\"string\"/>" \ " <ETableColumn model_col= \"6\" _title=\"Geographical Position\" " \ " expansion=\"1.0\" minimum_width=\"10\" resizable=\"true\" " \ " cell=\"calstring\" compare=\"string\"/>" \ " <ETableColumn model_col= \"7\" _title=\"% Complete\" " \ " expansion=\"1.0\" minimum_width=\"10\" resizable=\"true\" " \ - " cell=\"percent\" compare=\"string\"/>" \ + " cell=\"calstring\" compare=\"string\"/>" \ " <ETableColumn model_col= \"8\" _title=\"Priority\" " \ " expansion=\"1.0\" minimum_width=\"10\" resizable=\"true\" " \ - " cell=\"priority\" compare=\"string\"/>" \ + " cell=\"calstring\" compare=\"string\"/>" \ " <ETableColumn model_col= \"9\" _title=\"Summary\" " \ " expansion=\"3.0\" minimum_width=\"10\" resizable=\"true\" " \ " cell=\"calstring\" compare=\"string\"/>" \ " <ETableColumn model_col=\"10\" _title=\"Transparency\" " \ " expansion=\"1.0\" minimum_width=\"10\" resizable=\"true\" " \ - " cell=\"transparency\" compare=\"string\"/>" \ + " cell=\"calstring\" compare=\"string\"/>" \ " <ETableColumn model_col=\"11\" _title=\"URL\" " \ " expansion=\"2.0\" minimum_width=\"10\" resizable=\"true\" " \ " cell=\"calstring\" compare=\"string\"/>" \ " <ETableColumn model_col=\"12\" _title=\"Alarms\" " \ " expansion=\"1.0\" minimum_width=\"10\" resizable=\"true\" " \ " cell=\"calstring\" compare=\"string\"/>" \ - " <ETableColumn model_col=\"13\" pixbuf=\"icon\" _title=\"Type\" "\ + " <ETableColumn model_col=\"13\" pixbuf=\"icon\" " \ " expansion=\"1.0\" minimum_width=\"16\" resizable=\"false\" "\ " cell=\"icon\" compare=\"integer\"/>" \ - " <ETableColumn model_col=\"14\" pixbuf=\"complete\" _title=\"Complete\" " \ + " <ETableColumn model_col=\"14\" pixbuf=\"complete\" " \ " expansion=\"1.0\" minimum_width=\"16\" resizable=\"false\" "\ " cell=\"checkbox\" compare=\"integer\"/>" \ - " <ETableColumn model_col=\"18\" _title=\"Status\" " \ - " expansion=\"1.0\" minimum_width=\"10\" resizable=\"true\" " \ - " cell=\"calstatus\" compare=\"string\"/>" \ " <ETableState>" \ " <column source=\"13\"/>" \ " <column source=\"14\"/>" \ @@ -235,14 +230,13 @@ e_calendar_table_init (ECalendarTable *cal_table) { GtkWidget *table; ETable *e_table; - ECell *cell, *popup_cell; + ECell *cell; ETableExtras *extras; gint i; GdkPixbuf *pixbuf; GdkColormap *colormap; gboolean success[E_CALENDAR_TABLE_COLOR_LAST]; gint nfailed; - GList *strings; /* Allocate the colors we need. */ @@ -277,160 +271,14 @@ e_calendar_table_init (ECalendarTable *cal_table) extras = e_table_extras_new(); - /* - * Normal string fields. - */ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); gtk_object_set (GTK_OBJECT (cell), "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE, "bold_column", CAL_COMPONENT_FIELD_OVERDUE, "color_column", CAL_COMPONENT_FIELD_COLOR, NULL); - e_table_extras_add_cell (extras, "calstring", cell); - - /* - * Date fields. - */ - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE, - "bold_column", CAL_COMPONENT_FIELD_OVERDUE, - "color_column", CAL_COMPONENT_FIELD_COLOR, - NULL); - - popup_cell = e_cell_date_edit_new (); - e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); - gtk_object_unref (GTK_OBJECT (cell)); - e_table_extras_add_cell (extras, "dateedit", popup_cell); - cal_table->dates_cell = E_CELL_DATE_EDIT (popup_cell); - - - /* - * Combo fields. - */ - - /* Classification field. */ - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE, - "bold_column", CAL_COMPONENT_FIELD_OVERDUE, - "color_column", CAL_COMPONENT_FIELD_COLOR, - "editable", FALSE, - NULL); - - popup_cell = e_cell_combo_new (); - e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); - gtk_object_unref (GTK_OBJECT (cell)); - - strings = NULL; - strings = g_list_append (strings, _("None")); - strings = g_list_append (strings, _("Public")); - strings = g_list_append (strings, _("Private")); - strings = g_list_append (strings, _("Confidential")); - e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), - strings); - - e_table_extras_add_cell (extras, "classification", popup_cell); - - /* Priority field. */ - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE, - "bold_column", CAL_COMPONENT_FIELD_OVERDUE, - "color_column", CAL_COMPONENT_FIELD_COLOR, - "editable", FALSE, - NULL); - - popup_cell = e_cell_combo_new (); - e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); - gtk_object_unref (GTK_OBJECT (cell)); - - strings = NULL; - strings = g_list_append (strings, _("High")); - strings = g_list_append (strings, _("Normal")); - strings = g_list_append (strings, _("Low")); - strings = g_list_append (strings, _("Undefined")); - e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), - strings); - - e_table_extras_add_cell (extras, "priority", popup_cell); - - /* Percent field. */ - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE, - "bold_column", CAL_COMPONENT_FIELD_OVERDUE, - "color_column", CAL_COMPONENT_FIELD_COLOR, - NULL); - - popup_cell = e_cell_combo_new (); - e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); - gtk_object_unref (GTK_OBJECT (cell)); - - strings = NULL; - strings = g_list_append (strings, _("0%")); - strings = g_list_append (strings, _("10%")); - strings = g_list_append (strings, _("20%")); - strings = g_list_append (strings, _("30%")); - strings = g_list_append (strings, _("40%")); - strings = g_list_append (strings, _("50%")); - strings = g_list_append (strings, _("60%")); - strings = g_list_append (strings, _("70%")); - strings = g_list_append (strings, _("80%")); - strings = g_list_append (strings, _("90%")); - strings = g_list_append (strings, _("100%")); - e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), - strings); - - e_table_extras_add_cell (extras, "percent", popup_cell); - - /* Transparency field. */ - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE, - "bold_column", CAL_COMPONENT_FIELD_OVERDUE, - "color_column", CAL_COMPONENT_FIELD_COLOR, - "editable", FALSE, - NULL); - - popup_cell = e_cell_combo_new (); - e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); - gtk_object_unref (GTK_OBJECT (cell)); - - strings = NULL; - strings = g_list_append (strings, _("None")); - strings = g_list_append (strings, _("Opaque")); - strings = g_list_append (strings, _("Transparent")); - e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), - strings); - - e_table_extras_add_cell (extras, "transparency", popup_cell); - - /* Status field. */ - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - gtk_object_set (GTK_OBJECT (cell), - "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE, - "bold_column", CAL_COMPONENT_FIELD_OVERDUE, - "color_column", CAL_COMPONENT_FIELD_COLOR, - "editable", FALSE, - NULL); - - popup_cell = e_cell_combo_new (); - e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); - gtk_object_unref (GTK_OBJECT (cell)); - - strings = NULL; - strings = g_list_append (strings, _("Not Started")); - strings = g_list_append (strings, _("In Progress")); - strings = g_list_append (strings, _("Completed")); - strings = g_list_append (strings, _("Cancelled")); - e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), - strings); - - e_table_extras_add_cell (extras, "calstatus", popup_cell); - /* Create pixmaps */ if (!icon_pixbufs[0]) @@ -834,9 +682,3 @@ e_calendar_table_on_row_deleted (ETableModel *model, being efficient. It doesn't happen often. */ e_calendar_table_apply_filter (cal_table); } - -const gchar * -e_calendar_table_get_spec (void) -{ - return E_CALENDAR_TABLE_SPEC; -} diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 537ef44ebc..bbf0732122 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -38,11 +38,10 @@ #include "e-day-view-top-item.h" #include "e-day-view-main-item.h" #include "calendar-commands.h" +#include "popup-menu.h" #include <gal/widgets/e-canvas.h> #include <gal/e-text/e-text.h> #include <gal/widgets/e-canvas-utils.h> -#include <gal/widgets/e-gui-utils.h> -#include <gal/widgets/e-popup-menu.h> #include "e-meeting-edit.h" /* Images */ @@ -2990,96 +2989,63 @@ e_day_view_on_event_double_click (EDayView *day_view, gint day, gint event_num) { +#if 0 + g_print ("In e_day_view_on_event_double_click\n"); +#endif + } -enum { - /* - * This is used to "flag" events that can not be editted - */ - MASK_EDITABLE = 1, - /* - * To disable recurring actions to be displayed - */ - MASK_RECURRING = 2, +static void +e_day_view_on_event_right_click (EDayView *day_view, + GdkEventButton *bevent, + gint day, + gint event_num) +{ + EDayViewEvent *event; + int have_selection, not_being_edited, items, i; + struct menu_item *context_menu; - /* - * To disable actions for non-recurring items to be displayed - */ - MASK_SINGLE = 4, + static struct menu_item main_items[] = { + { N_("New appointment..."), (GtkSignalFunc) e_day_view_on_new_appointment, NULL, TRUE } + }; - /* - * This is used to when an event is currently being edited - * in another window and we want to disable the event - * from being edited twice - */ - MASK_EDITING = 8 -}; + static struct menu_item child_items[] = { + { N_("Schedule meeting"), (GtkSignalFunc) e_day_view_on_schedule_meet, NULL, TRUE }, -static EPopupMenu main_items [] = { - { N_("New Appointment..."), NULL, - e_day_view_on_new_appointment, NULL, 0 }, - { NULL, NULL, NULL, NULL, 0 } -}; + { NULL, NULL, NULL, TRUE}, -static EPopupMenu child_items [] = { - { N_("Open"), NULL, - e_day_view_on_edit_appointment, NULL, MASK_EDITABLE | MASK_EDITING }, - { N_("Delete this Appointment"), NULL, - e_day_view_on_delete_appointment, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING }, - { N_("Schedule Meeting"), NULL, - e_day_view_on_schedule_meet, NULL, MASK_EDITING }, - { "", NULL, NULL, NULL, 0}, + { N_("Edit this appointment..."), (GtkSignalFunc) e_day_view_on_edit_appointment, NULL, TRUE }, + { N_("Delete this appointment"), (GtkSignalFunc) e_day_view_on_delete_appointment, NULL, TRUE }, - { N_("New Appointment..."), NULL, - e_day_view_on_new_appointment, NULL, 0 }, + { NULL, NULL, NULL, TRUE}, + + { N_("New appointment..."), (GtkSignalFunc) e_day_view_on_new_appointment, NULL, TRUE } + }; - { "", NULL, NULL, NULL, MASK_SINGLE}, + static struct menu_item recur_child_items[] = { + { N_("Make this appointment movable"), (GtkSignalFunc) e_day_view_on_unrecur_appointment, NULL, TRUE }, + { N_("Schedule meeting"), (GtkSignalFunc) e_day_view_on_schedule_meet, NULL, TRUE }, - /* - * The following are only shown if this is a recurring event - */ - { "", NULL, NULL, NULL, MASK_SINGLE}, - { N_("Make this Occurrence Movable"), NULL, - e_day_view_on_unrecur_appointment, NULL, MASK_RECURRING | MASK_EDITING }, - { N_("Delete this Occurrence"), NULL, - e_day_view_on_delete_occurrence, NULL, MASK_RECURRING | MASK_EDITING }, - { N_("Delete all Occurrences"), NULL, - e_day_view_on_delete_appointment, NULL, MASK_RECURRING | MASK_EDITING }, - - { NULL, NULL, NULL, NULL, 0 } -}; + { NULL, NULL, NULL, TRUE}, -static void -e_day_view_on_event_right_click (EDayView *day_view, - GdkEventButton *bevent, - gint day, - gint event_num) -{ - EDayViewEvent *event; - int have_selection; - gboolean being_edited; - EPopupMenu *context_menu; - int hide_mask = 0; - int disable_mask = 0; + { N_("Edit this appointment..."), (GtkSignalFunc) e_day_view_on_edit_appointment, NULL, TRUE }, + { N_("Delete this occurrence"), (GtkSignalFunc) e_day_view_on_delete_occurrence, NULL, TRUE }, + { N_("Delete all occurrences"), (GtkSignalFunc) e_day_view_on_delete_appointment, NULL, TRUE }, + + { NULL, NULL, NULL, TRUE}, + + { N_("New appointment..."), (GtkSignalFunc) e_day_view_on_new_appointment, NULL, TRUE }, + }; - /* - * FIXME: - * This used to be set only if the event wasn't being edited - * in the event editor, but we can't check that at present. - * We could possibly set up another method of checking it. - */ - - being_edited = FALSE; - have_selection = GTK_WIDGET_HAS_FOCUS (day_view) && day_view->selection_start_day != -1; - if (event_num == -1) - context_menu = main_items; - else { - context_menu = child_items; - + if (event_num == -1) { + items = 1; + context_menu = &main_items[0]; + context_menu[0].sensitive = have_selection; + } else { if (day == E_DAY_VIEW_LONG_EVENT) event = &g_array_index (day_view->long_events, EDayViewEvent, event_num); @@ -3087,19 +3053,36 @@ e_day_view_on_event_right_click (EDayView *day_view, event = &g_array_index (day_view->events[day], EDayViewEvent, event_num); - if (cal_component_has_recurrences (event->comp)) - hide_mask |= MASK_SINGLE; - else - hide_mask |= MASK_RECURRING; + /* This used to be set only if the event wasn't being edited + in the event editor, but we can't check that at present. + We could possibly set up another method of checking it. */ + not_being_edited = TRUE; + + if (cal_component_has_recurrences (event->comp)) { + items = 8; + context_menu = &recur_child_items[0]; + context_menu[0].sensitive = not_being_edited; + context_menu[1].sensitive = not_being_edited; + context_menu[3].sensitive = not_being_edited; + context_menu[4].sensitive = not_being_edited; + context_menu[5].sensitive = not_being_edited; + context_menu[7].sensitive = have_selection; + } else { + items = 6; + context_menu = &child_items[0]; + context_menu[0].sensitive = not_being_edited; + context_menu[2].sensitive = not_being_edited; + context_menu[3].sensitive = not_being_edited; + context_menu[5].sensitive = have_selection; + } } - if (being_edited) - disable_mask |= MASK_EDITING; + for (i = 0; i < items; i++) + context_menu[i].data = day_view; day_view->popup_event_day = day; day_view->popup_event_num = event_num; - - e_popup_menu_run (context_menu, (GdkEvent *) bevent, disable_mask, hide_mask, day_view); + popup_menu (context_menu, items, bevent); } diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index 237f90959e..f098a2011b 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -27,20 +27,12 @@ #include <gnome.h> #include <gal/util/e-util.h> #include <gal/e-table/e-table-scrolled.h> -#include <gal/menus/gal-view-collection.h> -#include <gal/menus/gal-view-factory-etable.h> -#include <gal/menus/gal-view-etable.h> -#include "widgets/menus/gal-view-menus.h" #include "dialogs/task-editor.h" #include "e-calendar-table.h" #include "component-factory.h" #include "e-tasks.h" -/* A list of all of the ETasks widgets in use. We use this to update the - user preference settings. This will change when we switch to GConf. */ -static GList *all_tasks = NULL; - /* Private part of the GnomeCalendar structure */ struct _ETasksPrivate { @@ -164,7 +156,6 @@ setup_widgets (ETasks *tasks) gtk_table_attach (GTK_TABLE (tasks), priv->tasks_view, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (priv->tasks_view); - calendar_config_configure_e_calendar_table (E_CALENDAR_TABLE (priv->tasks_view)); gtk_signal_connect (GTK_OBJECT (E_CALENDAR_TABLE (priv->tasks_view)->model), "categories-changed", @@ -217,8 +208,6 @@ e_tasks_new (void) return NULL; } - all_tasks = g_list_prepend (all_tasks, tasks); - return GTK_WIDGET (tasks); } @@ -253,8 +242,6 @@ e_tasks_destroy (GtkObject *object) g_free (priv); tasks->priv = NULL; - all_tasks = g_list_remove (all_tasks, tasks); - if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -531,63 +518,3 @@ e_tasks_add_menu_item (gpointer key, return FALSE; } -static void -display_view(GalViewCollection *collection, - GalView *view, - gpointer data) -{ - ETasks *tasks = data; - if (GAL_IS_VIEW_ETABLE(view)) { - e_table_set_state_object (e_table_scrolled_get_table (E_TABLE_SCROLLED (E_CALENDAR_TABLE (tasks->priv->tasks_view)->etable)), GAL_VIEW_ETABLE (view)->state); - } -} - -void -e_tasks_setup_menus (ETasks *tasks, - BonoboUIComponent *uic) -{ - GalViewCollection *collection; - GalViewMenus *views; - GalViewFactory *factory; - ETableSpecification *spec; - - collection = gal_view_collection_new(); - /* FIXME: Memory leak. */ - gal_view_collection_set_storage_directories (collection, - EVOLUTION_DATADIR "/evolution/views/tasks/", - gnome_util_prepend_user_home ("/evolution/views/tasks/")); - - spec = e_table_specification_new (); - e_table_specification_load_from_string (spec, e_calendar_table_get_spec()); - - factory = gal_view_factory_etable_new (spec); - gal_view_collection_add_factory (collection, factory); - gtk_object_sink (GTK_OBJECT (factory)); - - gal_view_collection_load (collection); - - views = gal_view_menus_new (collection); - gal_view_menus_apply (views, uic, NULL); /* This function probably needs to sink the views object. */ - gtk_signal_connect (GTK_OBJECT (collection), "display_view", - display_view, tasks); - /* gtk_object_sink(GTK_OBJECT(views)); */ - - gtk_object_sink (GTK_OBJECT (collection)); -} - - -/* This updates all the preference settings for all the ETasks widgets in use. - */ -void -e_tasks_update_all_config_settings () -{ - ETasks *tasks; - ETasksPrivate *priv; - GList *elem; - - for (elem = all_tasks; elem; elem = elem->next) { - tasks = E_TASKS (elem->data); - priv = tasks->priv; - calendar_config_configure_e_calendar (E_CALENDAR_TABLE (priv->tasks_view)); - } -} diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 91a5219c87..74c0df4f9c 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -39,10 +39,9 @@ #include "e-week-view-main-item.h" #include "e-week-view-titles-item.h" #include <cal-util/timeutil.h> +#include "popup-menu.h" #include <gal/widgets/e-canvas.h> #include <gal/e-text/e-text.h> -#include <gal/widgets/e-popup-menu.h> -#include <gal/widgets/e-gui-utils.h> #include <gal/widgets/e-canvas-utils.h> #include "e-meeting-edit.h" @@ -3200,102 +3199,86 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event) return TRUE; } -enum { - /* - * This is used to "flag" events that can not be editted - */ - MASK_EDITABLE = 1, - /* - * To disable recurring actions to be displayed - */ - MASK_RECURRING = 2, +void +e_week_view_show_popup_menu (EWeekView *week_view, + GdkEventButton *bevent, + gint event_num) +{ + EWeekViewEvent *event; + int have_selection, not_being_edited, num_items, i; + struct menu_item *context_menu; - /* - * To disable actions for non-recurring items to be displayed - */ - MASK_SINGLE = 4, + static struct menu_item items[] = { + { N_("New appointment..."), (GtkSignalFunc) e_week_view_on_new_appointment, NULL, TRUE } + }; - /* - * This is used to when an event is currently being edited - * in another window and we want to disable the event - * from being edited twice - */ - MASK_EDITING = 8 -}; + static struct menu_item child_items[] = { + { N_("Schedule meeting"), (GtkSignalFunc) e_week_view_on_schedule_meet, NULL, TRUE }, -static EPopupMenu main_items [] = { - { N_("New Appointment..."), NULL, - e_week_view_on_new_appointment, NULL, 0 }, - { NULL, NULL, NULL, NULL, 0 } -}; + { NULL, NULL, NULL, TRUE}, -static EPopupMenu child_items [] = { - { N_("Open"), NULL, - e_week_view_on_edit_appointment, NULL, MASK_EDITABLE | MASK_EDITING }, - { N_("Delete this Appointment"), NULL, - e_week_view_on_delete_appointment, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING }, - { N_("Schedule Meeting"), NULL, - e_week_view_on_schedule_meet, NULL, MASK_EDITING }, - { "", NULL, NULL, NULL, 0}, + { N_("Edit this appointment..."), (GtkSignalFunc) e_week_view_on_edit_appointment, NULL, TRUE }, + { N_("Delete this appointment"), (GtkSignalFunc) e_week_view_on_delete_appointment, NULL, TRUE }, - { N_("New Appointment..."), NULL, - e_week_view_on_new_appointment, NULL, 0 }, + { NULL, NULL, NULL, TRUE }, - { "", NULL, NULL, NULL, MASK_SINGLE }, + { N_("New appointment..."), (GtkSignalFunc) e_week_view_on_new_appointment, NULL, TRUE } + }; - /* - * The following are only shown if this is a recurring event - */ - { "", NULL, NULL, NULL, MASK_SINGLE}, - { N_("Make this Occurrence Movable"), NULL, - e_week_view_on_unrecur_appointment, NULL, MASK_RECURRING | MASK_EDITING }, - { N_("Delete this Occurrence"), NULL, - e_week_view_on_delete_occurrence, NULL, MASK_RECURRING | MASK_EDITING }, - { N_("Delete All Occurrences"), NULL, - e_week_view_on_delete_appointment, NULL, MASK_RECURRING | MASK_EDITING }, - - { NULL, NULL, NULL, NULL, 0 } -}; + static struct menu_item recur_child_items[] = { + { N_("Make this appointment movable"), (GtkSignalFunc) e_week_view_on_unrecur_appointment, NULL, TRUE }, + { N_("Schedule meeting"), (GtkSignalFunc) e_week_view_on_schedule_meet, NULL, TRUE }, -void -e_week_view_show_popup_menu (EWeekView *week_view, - GdkEventButton *bevent, - gint event_num) -{ - EWeekViewEvent *event; - int have_selection; - gboolean being_edited; - guint32 disable_mask = 0, hide_mask = 0; - EPopupMenu *context_menu; + { NULL, NULL, NULL, TRUE }, + + { N_("Edit this appointment..."), (GtkSignalFunc) e_week_view_on_edit_appointment, NULL, TRUE }, + { N_("Delete this occurrence"), (GtkSignalFunc) e_week_view_on_delete_occurrence, NULL, TRUE }, + { N_("Delete all occurrences"), (GtkSignalFunc) e_week_view_on_delete_appointment, NULL, TRUE }, + + { NULL, NULL, NULL, TRUE }, + + { N_("New appointment..."), (GtkSignalFunc) e_week_view_on_new_appointment, NULL, TRUE } + }; have_selection = GTK_WIDGET_HAS_FOCUS (week_view) && week_view->selection_start_day != -1; - /* - * This used to be set only if the event wasn't being edited - * in the event editor, but we can't check that at present. - * We could possibly set up another method of checking it. - */ - being_edited = FALSE; - if (event_num == -1) { - context_menu = main_items; + num_items = 1; + context_menu = &items[0]; + context_menu[0].sensitive = have_selection; } else { - context_menu = child_items; event = &g_array_index (week_view->events, EWeekViewEvent, event_num); - if (cal_component_has_recurrences (event->comp)) - hide_mask |= MASK_SINGLE; - else - hide_mask |= MASK_RECURRING; + + /* This used to be set only if the event wasn't being edited + in the event editor, but we can't check that at present. + We could possibly set up another method of checking it. */ + not_being_edited = TRUE; + + if (cal_component_has_recurrences (event->comp)) { + num_items = 7; + context_menu = &recur_child_items[0]; + context_menu[0].sensitive = not_being_edited; + context_menu[2].sensitive = not_being_edited; + context_menu[3].sensitive = not_being_edited; + context_menu[4].sensitive = not_being_edited; + context_menu[6].sensitive = have_selection; + } else { + num_items = 4; + context_menu = &child_items[0]; + context_menu[0].sensitive = not_being_edited; + context_menu[1].sensitive = not_being_edited; + context_menu[3].sensitive = have_selection; + } } - if (being_edited) - disable_mask |= MASK_EDITING; - week_view->popup_event_num = event_num; + for (i = 0; i < num_items; i++) + context_menu[i].data = week_view; - e_popup_menu_run (context_menu, (GdkEvent *) bevent, disable_mask, hide_mask, week_view); + week_view->popup_event_num = event_num; + popup_menu (context_menu, num_items, bevent); } diff --git a/calendar/gui/event-editor-dialog.glade b/calendar/gui/event-editor-dialog.glade index 615bd3eed3..e27b187da3 100644 --- a/calendar/gui/event-editor-dialog.glade +++ b/calendar/gui/event-editor-dialog.glade @@ -38,6 +38,11 @@ <tab_hborder>2</tab_hborder> <tab_vborder>2</tab_vborder> <popup_enable>False</popup_enable> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> <widget> <class>GtkVBox</class> @@ -115,7 +120,7 @@ <widget> <class>GtkFrame</class> <name>frame31</name> - <label>Date & Time</label> + <label>Time</label> <label_xalign>0</label_xalign> <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> <child> @@ -371,7 +376,7 @@ <widget> <class>GtkLabel</class> <name>label59</name> - <label>_Contacts...</label> + <label>_Contacts</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> <xalign>0.5</xalign> diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c index 55b3b9865a..37bee3752f 100644 --- a/calendar/gui/event-editor.c +++ b/calendar/gui/event-editor.c @@ -231,8 +231,6 @@ static void reminder_delete_cb (GtkWidget *widget, EventEditor *ee); static void recurrence_exception_add_cb (GtkWidget *widget, EventEditor *ee); static void recurrence_exception_modify_cb (GtkWidget *widget, EventEditor *ee); static void recurrence_exception_delete_cb (GtkWidget *widget, EventEditor *ee); -static void recurrence_exception_select_row_cb (GtkCList *clist, gint row, gint col, GdkEvent *event, - gpointer data); static void field_changed (GtkWidget *widget, EventEditor *ee); static void event_editor_set_changed (EventEditor *ee, @@ -1225,17 +1223,13 @@ init_widgets (EventEditor *ee) gtk_signal_connect (GTK_OBJECT (priv->recurrence_exception_delete), "clicked", GTK_SIGNAL_FUNC (recurrence_exception_delete_cb), ee); - /* Selections in the exceptions list */ - - gtk_signal_connect (GTK_OBJECT (priv->recurrence_exception_list), "select_row", - GTK_SIGNAL_FUNC (recurrence_exception_select_row_cb), ee); /* * Connect the default signal handler to use to make sure the "changed" * field gets set whenever a field is changed. */ - /* Appointment Page */ + /* General Page. */ gtk_signal_connect (GTK_OBJECT (priv->general_summary), "changed", GTK_SIGNAL_FUNC (field_changed), ee); gtk_signal_connect (GTK_OBJECT (priv->description), "changed", @@ -1249,6 +1243,9 @@ init_widgets (EventEditor *ee) gtk_signal_connect (GTK_OBJECT (priv->classification_confidential), "toggled", GTK_SIGNAL_FUNC (field_changed), ee); + + + /* Recurrence Page. */ } static const int classification_map[] = { @@ -1258,6 +1255,27 @@ static const int classification_map[] = { -1 }; +#if 0 +static const int alarm_unit_map[] = { + ALARM_MINUTES, + ALARM_HOURS, + ALARM_DAYS, + -1 +}; + +static void +alarm_unit_set (GtkWidget *widget, enum AlarmUnit unit) +{ + e_dialog_option_menu_set (widget, unit, alarm_unit_map); +} + +static enum AlarmUnit +alarm_unit_get (GtkWidget *widget) +{ + return e_dialog_option_menu_get (widget, alarm_unit_map); +} +#endif + static const int month_pos_map[] = { 0, 1, 2, 3, 4, -1 }; static const int weekday_map[] = { 0, 1, 2, 3, 4, 5, 6, -1 }; @@ -1450,7 +1468,6 @@ fill_exception_widgets (EventEditor *ee) { EventEditorPrivate *priv; GSList *list, *l; - gboolean added; priv = ee->priv; g_assert (priv->comp != NULL); @@ -1459,23 +1476,16 @@ fill_exception_widgets (EventEditor *ee) cal_component_get_exdate_list (priv->comp, &list); - added = FALSE; - for (l = list; l; l = l->next) { CalComponentDateTime *cdt; time_t ext; - added = TRUE; - cdt = l->data; ext = icaltime_as_timet (*cdt->value); append_exception (ee, ext); } cal_component_free_exdate_list (list); - - if (added) - gtk_clist_select_row (GTK_CLIST (priv->recurrence_exception_list), 0, 0); } /* Computes a weekday mask for the start day of a calendar component, for use in @@ -2326,7 +2336,6 @@ recur_to_comp_object (EventEditor *ee, CalComponent *comp) cdt->tzid = NULL; tim = gtk_clist_get_row_data (exception_list, i); - g_assert (tim != NULL); *cdt->value = icaltime_from_timet (*tim, FALSE); list = g_slist_prepend (list, cdt); @@ -2468,6 +2477,7 @@ close_dialog (EventEditor *ee) + /* Callback used when the dialog box is "applied" */ static void ee_apply_event_cb (GtkWidget *widget, gint page_num, gpointer data) @@ -3131,17 +3141,11 @@ append_exception (EventEditor *ee, time_t t) clist = GTK_CLIST (priv->recurrence_exception_list); - gtk_signal_handler_block_by_data (GTK_OBJECT (clist), ee); - c[0] = get_exception_string (t); i = e_utf8_gtk_clist_append (clist, c); gtk_clist_set_row_data (clist, i, tt); - gtk_clist_select_row (clist, i, 0); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (clist), ee); - - e_date_edit_set_time (E_DATE_EDIT (priv->recurrence_exception_date), t); gtk_widget_set_sensitive (priv->recurrence_exception_modify, TRUE); gtk_widget_set_sensitive (priv->recurrence_exception_delete, TRUE); @@ -3197,7 +3201,6 @@ recurrence_exception_delete_cb (GtkWidget *widget, EventEditor *ee) EventEditorPrivate *priv; GtkCList *clist; int sel; - time_t *t; priv = ee->priv; @@ -3209,9 +3212,7 @@ recurrence_exception_delete_cb (GtkWidget *widget, EventEditor *ee) sel = GPOINTER_TO_INT (clist->selection->data); - t = gtk_clist_get_row_data (clist, sel); - g_assert (t != NULL); - g_free (t); + g_free (gtk_clist_get_row_data (clist, sel)); /* free the time_t stored there */ gtk_clist_remove (clist, sel); if (sel >= clist->rows) @@ -3227,25 +3228,6 @@ recurrence_exception_delete_cb (GtkWidget *widget, EventEditor *ee) preview_recur (ee); } -/* Callback used when a row is selected in the list of exception dates. We must - * update the date/time widgets to reflect the exception's value. - */ -static void -recurrence_exception_select_row_cb (GtkCList *clist, gint row, gint col, GdkEvent *event, - gpointer data) -{ - EventEditor *ee; - EventEditorPrivate *priv; - time_t *t; - - ee = EVENT_EDITOR (data); - priv = ee->priv; - - t = gtk_clist_get_row_data (clist, row); - g_assert (t != NULL); - - e_date_edit_set_time (E_DATE_EDIT (priv->recurrence_exception_date), *t); -} GtkWidget * make_date_edit (void) diff --git a/calendar/gui/evolution-calendar-control.c b/calendar/gui/evolution-calendar-control.c deleted file mode 100644 index 7ebe2b5f8e..0000000000 --- a/calendar/gui/evolution-calendar-control.c +++ /dev/null @@ -1,201 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#include <config.h> -#include <gnome.h> -#include <glade/glade.h> -#include <bonobo.h> -#include <bonobo/bonobo-control.h> -#include <glade/glade.h> - -#ifdef USING_OAF -#include <liboaf/liboaf.h> -#else -#include <libgnorba/gnorba.h> -#endif - -#include <cal-util/timeutil.h> -#include <gui/alarm.h> -#include <gui/gnome-cal.h> -#include <gui/calendar-commands.h> - -#define PROPERTY_CALENDAR_URI "folder_uri" - -#define PROPERTY_CALENDAR_URI_IDX 1 - -#ifdef USING_OAF -#define CONTROL_FACTORY_ID "OAFIID:control-factory:calendar:f4f90989-0f50-4af2-ad94-8bbdf331f0bc" -#else -#define CONTROL_FACTORY_ID "control-factory:calendar" -#endif - -CORBA_Environment ev; -CORBA_ORB orb; - - -static void -control_activate_cb (BonoboControl *control, - gboolean activate, - gpointer user_data) -{ - if (activate) - calendar_control_activate (control, user_data); - else - calendar_control_deactivate (control); -} - - - -static void -init_bonobo (int *argc, char **argv) -{ -#ifdef USING_OAF - /* FIXME: VERSION instead of "0.0". */ - gnome_init_with_popt_table ("evolution-calendar", "0.0", - *argc, argv, oaf_popt_options, - 0, NULL); - oaf_init (*argc, argv); -#else - gnome_CORBA_init_with_popt_table ( - "evolution-calendar", "0.0", - argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); -#endif - - if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) - g_error (_("Could not initialize Bonobo")); - - glade_gnome_init (); -} - - - -static void -get_prop (BonoboPropertyBag *bag, - BonoboArg *arg, - guint arg_id, - gpointer user_data) -{ - /*GnomeCalendar *gcal = user_data;*/ - - switch (arg_id) { - - case PROPERTY_CALENDAR_URI_IDX: - /* - if (fb && fb->uri) - BONOBO_ARG_SET_STRING (arg, fb->uri); - else - BONOBO_ARG_SET_STRING (arg, ""); - */ - break; - - default: - g_warning ("Unhandled arg %d\n", arg_id); - } -} - -static void -set_prop (BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - gpointer user_data) -{ - GnomeCalendar *gcal = user_data; - char *filename; - - switch (arg_id) { - - case PROPERTY_CALENDAR_URI_IDX: - printf ("set_prop: '%s'\n", BONOBO_ARG_GET_STRING (arg)); - filename = g_strdup_printf ("%s/calendar.vcf", - BONOBO_ARG_GET_STRING (arg)); - calendar_set_uri (gcal, filename); - g_free (filename); - break; - - default: - g_warning ("Unhandled arg %d\n", arg_id); - break; - } -} - - -static void -calendar_properties_init (GnomeCalendar *gcal) -{ - gcal->properties = bonobo_property_bag_new (get_prop, set_prop, gcal); - - bonobo_property_bag_add (gcal->properties, - PROPERTY_CALENDAR_URI, - PROPERTY_CALENDAR_URI_IDX, - BONOBO_ARG_STRING, - NULL, - _("The URI that the calendar will display"), - 0); - - bonobo_control_set_property_bag (gcal->control, gcal->properties); -} - - - -static BonoboObject * -calendar_control_factory (BonoboGenericFactory *Factory, void *closure) -{ - BonoboControl *control; - - /* Create the control. */ - GnomeCalendar *cal = new_calendar (full_name, NULL, NULL, 0); - - gtk_widget_show (GTK_WIDGET (cal)); - - control = bonobo_control_new (GTK_WIDGET (cal)); - cal->control = control; - - calendar_properties_init (cal); - - gtk_signal_connect (GTK_OBJECT (control), "activate", - control_activate_cb, cal); - - return BONOBO_OBJECT (control); -} - - -static void -calendar_control_factory_init (void) -{ - static BonoboGenericFactory *factory = NULL; - - if (factory != NULL) - return; - - puts ("XXXXXX - initializing calendar factory!!!"); - - factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID, calendar_control_factory, NULL); - - if (factory == NULL) - g_error ("I could not register a Calendar control factory."); -} - - -int -main (int argc, char **argv) -{ - init_bonobo (&argc, argv); - glade_gnome_init (); - alarm_init (); - e_cursors_init (); - - init_calendar (); - - //g_log_set_always_fatal ((GLogLevelFlags) 0xFFFF); - g_log_set_always_fatal (G_LOG_LEVEL_ERROR | - G_LOG_LEVEL_CRITICAL | - G_LOG_LEVEL_WARNING); - - CORBA_exception_init (&ev); - - calendar_control_factory_init (); - component_factory_init (); - - bonobo_main (); - - return 0; -} diff --git a/camel/ChangeLog b/camel/ChangeLog index c0b391e099..b7c3be3425 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,557 +1,27 @@ -2001-03-13 Jeffrey Stedfast <fejj@ximian.com> - - * camel-folder.c (camel_folder_copy_message_to): Don't allow the - user to copy a message to or from the vtrash folder. Set an - exception if they try. - (camel_folder_move_message_to): This one is a bit more - complicated: 1) If the user tried to move a message from the - vtrash into the original folder, just undelete the message. 2) If - the user tries to move the message to the vtrash folder, then just - mark the message as deleted. 3) If the user tries to move the - message from the vTrash to a folder other than the original, use - the original folder as the source. As another optimization, I've - made it so that if the user tries to move a message to the same - folder, just no-op. - (move_message_to): Unset the deleted flag before moving (assuming - it's there). - (copy_message_to): Same. - - * camel-vee-folder.c (camel_vee_folder_get_message_folder): New - convenience function to get the folder from which the message uid - is derived from. - -2001-03-13 Dan Winship <danw@ximian.com> - - * providers/imap/camel-imap-store.c (imap_connect): When trying - again after a failed password attempt, check if the connection got - dropped (which Courier will do) and deal accordingly. - - * providers/sendmail/camel-sendmail-transport.c (sendmail_send_to, - sendmail_send): More fixing for exim: It can't deal with "-tif", - you need to say "-t -i -f". - -2001-03-12 Jeffrey Stedfast <fejj@ximian.com> - - * camel-store.c (init_trash): Rename the folder to "Trash" and - i18nify it. - -2001-03-09 Jeffrey Stedfast <fejj@ximian.com> - - * camel-tcp-stream-ssl.h: Comment out everything unless HAVE_NSS - is defined. - - * camel-tcp-stream-ssl.c (stream_read): Don't use errno, use - nspr's error code stuff. - (stream_write): Same. - -2001-03-09 Jeffrey Stedfast <fejj@ximian.com> - - * camel-session.c (camel_session_query_authenticator): Created a - new mode (CAMEL_AUTHENTICATOR_ACCEPT) which is a Yes/No prompt to - the user. This will be needed by the SSL/TLS code to come. Also - changed the return value to a gpointer rather than a char* to - allow the returning of TRUE/FALSE values. - - * camel.c: Wrap stuff with HAVE_NSS - -2001-03-09 Dan Winship <danw@ximian.com> - - * providers/sendmail/camel-sendmail-transport.c (sendmail_send, - sendmail_send_to): Remove the "-U" for now, because it breaks - exim's "sendmail" wrapper. (And it doesn't actually do all that - much to sendmail's behavior, and it was working fine before - anyway.) - - * camel-mime-utils.c (header_fold): Fix a bug that could make this - walk off the end of a string. (The bug has been there since - December... maybe this will fix some unreproduceable crashes?) - -2001-03-08 Jeffrey Stedfast <fejj@ximian.com> - - * camel-store.c (camel_store_get_folder): Changes so that the - folder gets added to the vtrash reguardless of whether or not the - store is holding it's own folder lookup hash. - (init_trash): Oops, lets try locking the cache before we go and - add all the cached folders to the vtrash. - -2001-03-08 Jeffrey Stedfast <fejj@ximian.com> - These fixes make it so that the CamelStore does not actually hold - a ref on it's vTrash folder. The vTrash folder is now created ONLY - when it is requested. This solves the problem of not being able to - unref a Store and have it disconnect/finalize like we expect it to. - - * camel-store.c (init_trash): When we create the vtrash, add all - previously opened folders to it and hook on to the finalize event - so that we can then set the store->vtrash to NULL. - (get_trash): If a vtrash folder for the store doesn't exist, - init_trash() and then try. - (construct): No longer need this. - (camel_store_class_init): Don't override the construct method. - (camel_store_finalize): We no longer hold a ref on the vtrash so - don't unref it. - -2001-03-07 Jeffrey Stedfast <fejj@ximian.com> - - * providers/pop3/camel-pop3-store.c (init_trash): Implement. - (get_trash): Implement. - (camel_pop3_store_class_init): Override the default init_trash and - get_trash virtual functions. Hopefully this should fix the problem - of pop3 sotre's not disconnecting after the send&recv code - finishes downloading mail. - - Wonder if I should override the default implementation for the - mbox, mh, and maildir too? - -2001-03-07 Dan Winship <danw@ximian.com> - - * camel-remote-store.c (camel_remote_store_connected): Return the - return value of camel_service_connect rather than returning - !camel_exception_is_set(), since that will be wrong if ex==NULL... - Fixes a crash in the IMAP keepalive code, but this same problem - probably exists in other places too... - (remote_recv_line): Fix another problem... - - * providers/local/camel-mbox-provider.c: - * providers/vee/.cvsignore: - * providers/vee/libcamelvee.urls: Remove some unused stuff - -2001-03-06 Jeffrey Stedfast <fejj@ximian.com> - - * camel-sasl-digest-md5.c (compute_response): Redone so as to save - on memory allocations and speed. - -2001-03-05 Jeffrey Stedfast <fejj@ximian.com> - - * camel-sasl-plain.c (plain_challenge): Don't return NULL if the - token is non-NULL. This is why: - - sending : AUTH PLAIN - received: 334 ok. go on. <-- this is why - sending : ZGZPaQpAZ214Lm5ldBBnb29jYXI= - received: 235 {mp005-rz3} go ahead - - * camel-sasl.c (camel_sasl_authtype): Add the PLAIN type here. - (camel_sasl_authtype_list): And here too. - - * camel-sasl-plain.c: Initialize the camel_sasl_plain_authtype. - - * camel-sasl-plain.h: extern the camel_sasl_plain_authtype. - -2001-03-05 Jeffrey Stedfast <fejj@ximian.com> - - * providers/imap/camel-imap-store.c (imap_connect): i18n'd some - strings in here. - - * providers/smtp/camel-smtp-transport.c (smtp_connect): Keep - trying to authenticate until either we succeed or until the user - cancels. - -2001-03-04 Jeffrey Stedfast <fejj@ximian.com> - - * camel-mime-utils.c: Wrote a new version of header_fold() that - takes a 'force' option and uses another new function called - header_fold_next_space() in place of strchr(inptr, ' ') to get the - next whitespace char. The idea of header_fold_next_space() is to - not treat spaces between a set of quotes as a space - this way it - will be possible to fold (for example) the Content-Type MIME - header without worrying about breaking up a boundary string. - Note: This code is #if 0'd out until Zucchi approves of the patch. - Another Note: We will probably still want to use the "don't fold - this header" hash lookup for headers like the Message-Id and - possibly a few others. - -2001-03-04 Jeffrey Stedfast <fejj@ximian.com> - - * camel-internet-address.c - (camel_internet_address_encode_address): Make sure there is a - space between the name and the address tokens. - - * camel-mime-utils.c (rfc2047_decode_word): encoded string - segments need to be at least 8 chars (7 doesn't leave room for an - ecoding value. To be more realistic, even 8 chars isn't enough as - this assumes there is no charset nor any encoded text. If the - encoding value is not 'Q' or 'B', then return NULL. This fixes bug - #1689. - -2001-03-03 Not Zed <NotZed@Ximian.com> - - * camel-vee-folder.c (vee_folder_remove_folder): New function to - remove a folder from a vfolder. - (camel_vee_folder_remove_folder): New public function to remove a - folder from a vfolder. - -2001-03-02 Jeffrey Stedfast <fejj@ximian.com> - - * providers/smtp/camel-smtp-provider.c: Doh! Set the - CAMEL_URL_ALLOW_AUTH flag. - - * providers/smtp/camel-smtp-transport.c (get_smtp_error_string): - Updated with the extended AUTH return codes. - -2001-03-02 Jeffrey Stedfast <fejj@ximian.com> - - * providers/imap/camel-imap-store.c (try_auth): Don't forget to - unref the SASL object. - - * providers/smtp/camel-smtp-transport.c (query_auth_types): - Implemented. - (smtp_auth): Implemented. - (smtp_helo): Don't bother parsing the authtypes if we already have - them. - (smtp_connect): call smtp_auth() here if we found any authtypes. - (smtp_disconnect): Updated as I now use a hash table for the - supported authtypes rather than a linked list. - (esmtp_get_authtypes): modify to use a hash table instead of a - linked list and also use isspace() rather than == ' '. - -2001-03-02 Dan Winship <danw@ximian.com> - - * providers/sendmail/camel-sendmail-transport.c (sendmail_send_to, - sendmail_send): Use "-f" to set the envelope from address so - bounces go to the right place. Also, pass "-U" since the man page - says we're supposed to... - -2001-03-01 Jeffrey Stedfast <fejj@ximian.com> - - * camel-sasl.c: #include "camel-sasl-digest-md5.h" - (camel_sasl_authtype_list): add DIGEST-MD5 stuff here. - (camel_sasl_authtype): And here too. - (camel_sasl_new): And here... - - * camel-sasl-digest-md5.[c,h]: new SASL class for DIGEST-MD5 (has - been tested and proven to work). - -2001-03-01 Dan Winship <danw@ximian.com> - - * camel-sasl.c (camel_sasl_challenge): Take a GByteArray as input - as well. Comment that you can pass %NULL for @token to get the - initial auth data for mechanisms that are client-initiated. - (camel_sasl_challenge_base64): Convenience function for protocols - that use base64-encoded SASL. - (camel_sasl_authenticated): Implement this... (it was prototyped - already) - (camel_sasl_new): Function to take a service name, a mechanism - name, and a CamelService, and return a CamelSasl for it. - (camel_sasl_authtype, camel_sasl_authtype_list): Functions to - return CamelServiceAuthType information about SASL mechanisms, to - allow providers to deal with them generically. - - * camel-sasl-anonymous.c, camel-sasl-plain.c: Update/simplify for - CamelSasl changes. Both of these are single-round - (client-initiated) mechanisms, so they don't need to keep state. - (camel_sasl_plain_new): Removed; use camel_sasl_new instead. - (Can't get rid of camel_sasl_anonymous_new though...) - - * camel-sasl-cram-md5.c: Update/simplify for CamelSasl changes. - (camel_sasl_cram_md5_new): Removed; use camel_sasl_new instead. - (cram_md5_challenge): Use md5_get_digest where possible, and - various other minor simplifications. CRAM-MD5 only has a single - round, so there's no need to keep track of state. This code is now - tested (against Cyrus IMAPd) and known to work. - - * camel-sasl-kerberos4.h: Update/simplify for CamelSasl changes. - Make only a single #ifdef HAVE_KRB4. Remove stuff from priv that - isn't needed between rounds. - (camel_sasl_kerberos4_new): Removed; use camel_sasl_new instead - (krb4_challenge): Fix up the logic I broke in my previous "at - least make it compile" fixes, update to match other changes, and - remove IMAP-isms that shouldn't be in the generic code. This still - isn't tested, because we're stuck behind a NAT right now... - - * providers/imap/camel-imap-store.c: Add an "authtypes" hash table - to CamelImapStore recording the supported authtypes. - (connect_to_server): Record supported authtypes in the authtypes - hash rather than the capabilities bitmask, since now the IMAP code - is no longer responsible for keeping track of which authtypes we - support. - (query_auth_types): Use camel_sasl_authtype_list to get the - SASL-supported authtypes. - (try_auth): New function to try a SASL auth mechanism. Sort of - formerly imap_try_kerberos_v4_auth. - (imap_connect): Get rid of the krb4-specific bits and genericize - them for any SASL authtype. - - * providers/imap/Makefile.am: Remove camel-imap-auth.[ch] (moved - into camel-imap-store.c since it's now constant size) and the - KRB4_CFLAGS and KRB4_LDFLAGS references. - -2001-03-01 Jeffrey Stedfast <fejj@ximian.com> - - * camel-sasl-anonymous.c (anon_challenge): Don't base64 encode the - data, leave that up to the provider to do if it needs to. Also - save on some memory allocations and stuff. - - * camel-sasl-cram-md5.c (cram_md5_challenge): Same here. Also get - rid of the need for the temp buf as we can just write it to the - GByteArray. - -2001-03-02 Not Zed <NotZed@Ximian.com> - - * camel-mime-utils.c (rfc2047_encode_word, rfc2047_decode_word): - Reconstify variables to match iconv. - - * camel-search-private.c (camel_ustrstrcase): Change some - assertions back into valid returns. - -2001-03-01 Dan Winship <danw@ximian.com> - - * Makefile.am (libcamel_la_LIBADD, INCLUDES): camel depends on - krb4 now (where available), for camel-sasl-kerberos4.c - - * camel-sasl-kerberos4.[ch]: Make this at least compile. Dunno if - it works yet. - -2001-03-01 Peter Williams <peterw@ximian.com> - - * camel-url.c (camel_url_new): Assert url_string != NULL. - -2001-02-28 Jeffrey Stedfast <fejj@ximian.com> - - * Makefile.am: Added camel-sasl-anonymous.[c,h] to the build. - - * camel-sasl-anonymous.[c,h]: new SASL class for ANONYMOUS - - * camel-sasl-plain.c (plain_challenge): Oops, have a state for - setting sasl->authenticated = TRUE; - - * camel-sasl-cram-md5.c (cram_md5_challenge): Same here. - -2001-02-28 Jeffrey Stedfast <fejj@ximian.com> - - * camel-mime-utils.c (header_decode_date): A fix for broken - mailers that send 2-digit years (ie "Wed, 28 Feb 01 - 04:59:41"). Fixes bug #1633. - - * camel-filter-driver.c (camel_filter_driver_filter_folder): Check - to make sure message isn't NULL. - -2001-02-28 Dan Winship <danw@ximian.com> - - * camel-remote-store.c (remote_recv_line): If we get back 0 bytes - from camel_stream_buffer_gets, that means the socket got - disconnected, so set an exception. (Noticed because of a message - that crashes our IMAP server when you try to look at it. :) - -2001-02-28 Jeffrey Stedfast <fejj@ximian.com> - - * Makefile.am: Added camel-sasl*.[c,h] to the build. - - * camel-sasl.[c,h]: new "abstract" SASL class - - * camel-sasl-kerberos4.[c,h]: new SASL class for KERBEROS_V4 - - * camel-sasl-cram-md5.[c,h]: new SASL class for CRAM-MD5 - - * camel-sasl-plain.[c,h]: new SASL class for PLAIN - - * providers/imap/camel-imap-auth.c: Removed the base64 functions. - - * camel-mime-utils.c (base64_encode_simple): Moved here from - camel-imap-auth.c - (base64_decode_simple): Same. - -2001-02-26 Dan Winship <danw@ximian.com> - - * providers/imap/camel-imap-folder.c (imap_sync): Group messages - into sets with the same flags and use the IMAP message set - notation rather than doing a separate STORE FLAGS for each one. - This cuts the network traffic down to just a handful of commands - per sync rather than one per changed message. Removed the progress - notification stuff since it's no longer meaningful and should - hopefully be unnecessary. - (imap_copy_message_to): move the former sync_message function - into here, since it's no longer shared with imap_sync. - -2001-02-26 Jeffrey Stedfast <fejj@ximian.com> - - * camel-mime-utils.c: Made thread-safe and moved to above the test - code. - - * camel-mime-message.c (camel_mime_message_init): Set the - message_id to NULL. - (camel_mime_message_finalize): Free the message_id. - (camel_mime_message_set_message_id): New function to set the - Message-Id. - (camel_mime_message_get_message_id): New function to get the - Message-Id. - (process_header): Decode the message-id. - -2001-02-24 Jeffrey Stedfast <fejj@ximian.com> - - * camel-store.c (construct): init the vTrash folder here instead - of in store_init. - (camel_store_class_init): init service_class->construct. - (camel_store_finalize): We only need to unref the vtrash folder. - (init_trash): don't create a vstore since we don't need it. - -2001-02-23 Jeffrey Stedfast <fejj@ximian.com> - - * camel-store.c (camel_store_class_init): init get_trash and - init_trash. - (camel_store_init): call the virtual init_trash function. - (camel_store_finalize): unref the vtrash folder/store if present. - (camel_store_get_folder): Add the new folder to the vtrash - vfolder. - (init_trash): default implementation of init_trash. - (get_trash): default implementation of get_trash. - - * camel-vee-store.c (vee_init_trash): No-op. - (vee_get_trash): return NULL - -2001-02-23 Not Zed <NotZed@Ximian.com> +2001-03-13 Ettore Perazzoli <ettore@ximian.com> - * camel-folder-summary.c (camel_message_info_new_from_header): - Doh, cut and paste problem, use mlist not cc. + * Makefile.am (SUBDIRS): Remove `tests'. - * camel-folder.c (move_message_to): - (copy_message_to): If the source folder doesn't support a - summary, dont try and get the message info from it. + * tests/lib/Makefile.am (INCLUDES): Add `-I$(top_srcdir)'. - * camel-filter-search.c (check_header): Implement a pseudo-header - "x-camel-mlist" which just looks up in the message info for a - match. - - * camel-folder-search.c (check_header): Add pseudo-header - "x-camel-mlist" which can be used to match on mailing list. - - * providers/imap/camel-imap-folder.c (imap_sync): Add some - internal progress reporting. - (imap_rescan): Do some progress reporting. - - * camel-mime-part.c (init_header_name_table): Add the message-id - to the formatted table, so we dont try and wrap it, and break it. - -2001-02-22 Jeffrey Stedfast <fejj@ximian.com> - - * camel-folder.h: Remove the 'FIXME: remove because this isn't - required...' comment for copy_message_to since we now need and - cherish its existance in the filter-driver code ;-) - - * camel-filter-driver.c (camel_filter_driver_filter_message): Now - takes a UID and CamelFolder arguments (which can be NULL) to allow - for possible optimizations when copying messages between folders - on the same store. - (camel_filter_driver_filter_mbox): Updated (passes NULL for both - since this case can't be optimized anyway). - (camel_filter_driver_filter_folder): Updated to pass in the uid - and folder of the message. - -2001-02-22 Dan Winship <danw@ximian.com> - - * providers/imap/camel-imap-summary.h (CAMEL_IMAP_SERVER_FLAGS): - #define this as the set of all IMAP system flags - - * providers/imap/camel-imap-folder.c (sync_message): after syncing - flags, set server_flags to (flags & CAMEL_IMAP_SERVER_FLAGS) - rather than just "flags", since any other flags won't have been - synced. Prevents the CAMEL_MESSAGE_ATTACHMENTS flag from getting - lost. + * providers/vee/Makefile.am (INCLUDES): Add + `$(EXTRA_GNOME_CFLAGS)'. + * providers/sendmail/Makefile.am (INCLUDES): Likewise. + * providers/pop3/Makefile.am (INCLUDES): Likewise. + * providers/local/Makefile.am (INCLUDES): Likewise. + * providers/imap/Makefile.am (INCLUDES): Likewise. + * providers/cache/Makefile.am (INCLUDES): Likewise. -2001-02-22 Not Zed <NotZed@Ximian.com> +2001-03-13 Ettore Perazzoli <ettore@ximian.com> - * providers/vee/*: Removed all files. - - * camel-private.h: Move camel-vee-private.h stuff into here. - - * camel-session.c: Move the vee_provider here, and initialise it - always as part of a session. The vfolder provider is always - available. - - * providers/Makefile.am: Remove "vee" from the build list, now - built as part of the main library. - - * Makefile.am (libcamelinclude_HEADERS): - (libcamel_la_SOURCES): Added camel-vee-store.[ch], - camel-vee-folder.[ch]. - - * providers/vee/camel-vee-folder.c (vee_folder_build): Removed, - not used. - (camel_vee_folder_new): Removed call to build_folder. - (vee_get_message): Dont try and free the mi if we didn't get it. - - * camel-folder.c (camel_folder_change_info_new): Added a hash - table of what we have in the lists, plus moved private things into - private pointer. - (camel_folder_change_info_add_source): Fixed up private accesses. - (camel_folder_change_info_add_uid): Changed to use a hashtable to - see if we already have the uid, etc. - (camel_folder_change_info_remove_uid): Similar. - (change_info_remove): Likewise. - (camel_folder_change_info_clear): Fixes for privatisations. - (camel_folder_change_info_free): " + * providers/smtp/Makefile.am (INCLUDES): Add + `$(EXTRA_GNOME_CFLAGS)'. 2001-02-21 Dan Winship <danw@ximian.com> * providers/imap/camel-imap-folder.c (fetch_medium): Fixes for IMAP4-pre-rev1 from Torsten Schulz. -2001-02-20 Not Zed <NotZed@Ximian.com> - - * camel-mime-utils.c (mail_list_magic): Take the ^Header: part out - of the expression, since we look that up ourselves. - (header_raw_check_mailing_list): When getting the match, get match - 1, not match 0, we dont want the full string match. - - * camel-folder-summary.c (CAMEL_FOLDER_SUMMARY_VERSION): Bumped - for summary change. - (message_info_new): Extract the mlist info from the headers. - (message_info_load): Load mlist from summary. - (message_info_save): Save mlist to summary. - (message_info_free): Save the mlist entry. - (camel_message_info_new_from_header): Extract mailing list header. - (camel_message_info_dup_to): Copy the mlist entry. - (camel_message_info_free): Free mlist. - (message_info_dump): Dump the mlist. - - * camel-folder-summary.h: Add an mlist (mailing list) string to - the summary. - -2001-02-19 Not Zed <NotZed@Ximian.com> - - * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Added - flags argument. - (message_changed): Add support for the auto-update flag, in which - case we auto-match the content as it changes. - (camel_vee_folder_init): Remoive "DYNAMIC" optionality - (camel_vee_folder_finalise): " - (vee_expunge): As we expunge folders, re-sync their content by - rerunning the query. - - * providers/vee/camel-vee-store.c (vee_get_folder): Pass flags to - folder new. - -2001-02-18 Not Zed <NotZed@Ximian.com> - - * providers/vee/Makefile.am (noinst_HEADERS): Added - camel-vee-private.h. - - * providers/vee/camel-vee-private.h: New file to add locking stuff - for vee folders. - - * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Add - locking around unmatched setup. - (camel_vee_folder_init): Setup lock. - (camel_vee_folder_finalise): Free locks. - (folder_changed): Add locking. - (unmatched_finalise): " - (message_changed): " - (vee_folder_build): " - -2001-02-17 Not Zed <NotZed@Ximian.com> - - * providers/vee/camel-vee-folder.c (vee_folder_add): Check uid - doesn't exist before adding it. - -2001-02-16 Not Zed <NotZed@Ximian.com> - - * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Create - a new virtual virtual folder UNMATCHED, to store all messages that - dont match other vfolders. - (unmatched_folder_changed): When a vfolder issues a changed event, - use its info to update the unmatched folder info. - (unmatched_finalise): When a vfolder is finalised, remove any uids - it has as if we had a removed event for it. - 2001-02-16 Jeffrey Stedfast <fejj@ximian.com> * camel-filter-driver.c (camel_filter_driver_finalise): Thaw the @@ -559,25 +29,6 @@ (camel_filter_driver_set_default_folder): Thaw the defaultfolder we're about to replace, and freeze the new defaultfolder. -2001-02-15 Jeffrey Stedfast <fejj@ximian.com> - - * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Emit - the folder_created signal here. - - * providers/local/camel-local-folder.c - (camel_local_folder_construct): Emit the folder_created signal. - - * providers/local/camel-local-store.c (delete_folder): On error, - free the 'name' string so we don't leak. Also emit the - folder_deleted signal. - - * providers/imap/camel-imap-store.c (subscribe_folder): Emit the - folder_created signal. - (unsubscribe_folder): Emit the folder_deleted signal. - - * camel-store.c (camel_store_class_init): Added folder_created and - folder_deleted signal defs. - 2001-02-15 Dan Winship <danw@ximian.com> * camel-folder-thread.c (container_parent_child): Deal with @@ -588,173 +39,12 @@ (pre-rev1) doesn't allow BODY.PEEK[], so use RFC822.PEEK instead in that case. -2001-02-14 Christopher James Lahey <clahey@ximian.com> - - * camel-mime-filter-charset.c (complete, filter), - camel-mime-utils.c (rfc2047_decode_word, rfc2047_encode_word): - Changed this code to match the glibc iconv signature. - -2001-02-14 Dan Winship <danw@ximian.com> - - * camel-store.c (camel_store_create_folder): New method to create - a folder when you don't know its full name. - - * providers/imap/camel-imap-store.c (create_folder): Implement. - (create_folder): Oops, and fix bug involving namespaces - -2001-02-12 Not Zed <NotZed@Ximian.com> - - * camel-mime-part.c (init_header_name_table): Add address headers - to list that we dont fold when writing. The are properly - formatted as we build them. - (write_to_stream): DOH, lookup the header name in the formatted - hash table, not the value, that would never have worked. - - * camel-internet-address.c - (camel_internet_address_encode_address): Changed to take a - parameter saying how much we've printed so far. We now fold the - header as we format it. We dont fold addresses, even if they are - too long, we simply put them on another line by themselves: this - should make the result more parsable by mailers that can't handle - split up addresses (which are legal). - (internet_encode): Fix for changes to above. - -2001-02-12 Jeffrey Stedfast <fejj@ximian.com> - - * providers/local/camel-local-provider.c: mbox, mh, and maildir - camel-url's need absolute paths. - - * camel-provider.h (CAMEL_URL_PATH_IS_ABSOLUTE): New flaggy flag. - -2001-02-08 Dan Winship <danw@ximian.com> - - * camel-store.c: Rewrite a bunch. Replace the existing folder - cache stuff with much simpler code that still handles all the - existing cases. Now the folder hash table is always created by the - base class, using hash and compare functions provided by the class - implementation. (If they are set to NULL, CamelStore won't cache - folders.) lookup_folder, cache_folder, and uncache_folder are no - longer class methods, and get_name is gone completely. - - (camel_store_get_inbox): Renamed from - camel_store_get_default_folder, since that wasn't being used, and - this is what we actually need. - (camel_store_get_root_folder): Removed, since it's not needed for - anything given get_folder_info. - - * camel-remote-store.c: - * providers/local/camel-local-store.c: - * providers/local/camel-mbox-store.c: - * providers/local/camel-mh-store.c: - * providers/local/camel-maildir-store.c: - * providers/nntp/camel-nntp-store.c: - * providers/pop3/camel-pop3-store.c: - * providers/vee/camel-vee-store.c: Minor updates for CamelStore - changes - - * providers/imap/camel-imap-store.c (camel_imap_store_class_init): - Update for CamelStore changes. - (hash_folder_name, compare_folder_name): treat INBOX - case-insensitively, otherwise use g_str_hash and g_str_equal. - - * camel-service.c (camel_service_construct): Remove - camel_service_new and create camel_service_construct (as a class - method) in its place. - - * camel-session.c (camel_session_get_service): Use - camel_object_new and camel_service_construct to replace - camel_service_new. - - * providers/local/camel-local-store.c (construct): Append a '/' to - the URL path if it doesn't end with one - -2001-01-31 Jeffrey Stedfast <fejj@helixcode.com> - - * camel-tcp-stream-ssl.c: Oops, include the camel-tcp-stream-ssl - header instead of the raw one. - -2001-02-07 Not Zed <NotZed@Ximian.com> - - * camel-operation.c (camel_operation_start): Changed to push the - operation into a status stack. - (camel_operation_progress): Changed to only accept % complete. - (camel_operation_reset): Free status stack as well. - - * providers/pop3/camel-pop3-folder.c (pop3_get_message): Get the - octect count from the return line, and pass it to - get_additional_data(). - (pop3_refresh_info): Added status stuff. - - * providers/pop3/camel-pop3-store.c - (camel_pop3_command_get_additional_data): Added a total bytes - expected argument for progress reporting & fixed callers. - (camel_pop3_command_get_additional_data): Added progress - reporting. - - * providers/local/camel-mbox-summary.c (mbox_summary_sync_full): - (mbox_summary_sync_quick): - (summary_rebuild): Added progress reporting stuff. - -2001-02-07 Jeffrey Stedfast <fejj@ximian.com> - - * camel-search-private.c (CAMEL_SEARCH_COMPARE): Macro for making - comparisons easy. - (camel_ustrcasecmp): Use CAMEL_SEARCH_COMPARE and check for - end-of-string before the utf-8 error check. - (camel_ustrncasecmp): Same. - (camel_search_header_match): Strip leading spaces before doing - anything else. Also use vlen and mlen so as to not need to do 500 - strlen()'s. - (camel_ustrcasecmp): Don't get_utf8() for the 2 strings in the - comparison part of the loop because of short-circuit expression - evaluation. (blame JPR if this is the wrong term!) - (camel_ustrncasecmp): Same. - -2001-02-06 Jeffrey Stedfast <fejj@ximian.com> - - * camel-search-private.c (utf8_get): Rewrote using unicode_get_utf8(). - (camel_ustrcasecmp): Use unicode_char_t - (camel_ustrncasecmp): Same. - -2001-02-06 Christopher James Lahey <clahey@ximian.com> - - * camel-mime-filter-charset.c (complete, filter), - camel-mime-utils.c (rfc2047_decode_word, rfc2047_encode_word): - Made these pass char ** as the second parameter to iconv. - -2001-02-06 Not Zed <NotZed@Ximian.com> - - * camel-session.c: Removed all the camel_cancel stuff. - - * camel-stream-fs.c (stream_read): Change to use camel_operation. - (stream_write): " - - * camel-remote-store.c (socket_connect): Change to use - camel_operation rather than camel_cancel stuff. - Removed gal include, WTF is that doing there anyway? - - * Makefile.am (libcamel_la_SOURCES): - (libcamelinclude_HEADERS): Added camel-operation.[ch], stuff to - handle notification and cancellation. - - * camel-search-private.c: Removed unwanted header. It was never - put in for a reason. Stop fixing irrelevant warnings. - - (camel_ustrstrcase): Our own strstrcase impl for utf8 strings. - (camel_ustrcasecmp): Ditto for strcasecmp. - (camel_ustrncasecmp): And strncasecmp. - (utf8_get): Simpler interface to utf8 string processing. - (camel_search_header_match): Use the new things. - -2001-02-05 Not Zed <NotZed@Ximian.com> +2001-02-07 Iain Holmes <iain@ximian.com> - * camel-folder.c (get_summary): Removed some old variables/a small - memleak. - (free_summary): Removed old variables. + * camel-object.c (camel_object_hook_event): Don't strdup the key, + if the event name is already in the table. - * camel-mime-utils.c (header_raw_check_mailing_list): New utility - function to get the mailing list (if any) that a set of headers - came from. + * broken-date-parser.c (parse_broken_date): Free the list of tokens. 2001-02-05 Christopher James Lahey <clahey@helixcode.com> diff --git a/camel/Makefile.am b/camel/Makefile.am index da1bc24c43..cdc8fa5896 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = providers tests +SUBDIRS = providers libcamelincludedir = $(includedir)/camel providerdir = $(libdir)/evolution/camel-providers/$(VERSION) @@ -12,7 +12,6 @@ INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \ -I$(top_srcdir)/e-util \ $(GLIB_CFLAGS) \ $(UNICODE_CFLAGS) \ - $(KRB4_CFLAGS) \ -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \ -DG_LOG_DOMAIN=\"camel\" @@ -47,15 +46,8 @@ libcamel_la_SOURCES = \ camel-movemail.c \ camel-multipart.c \ camel-object.c \ - camel-operation.c \ camel-provider.c \ camel-remote-store.c \ - camel-sasl.c \ - camel-sasl-anonymous.c \ - camel-sasl-cram-md5.c \ - camel-sasl-digest-md5.c \ - camel-sasl-kerberos4.c \ - camel-sasl-plain.c \ camel-search-private.c \ camel-seekable-stream.c \ camel-seekable-substream.c \ @@ -71,8 +63,6 @@ libcamel_la_SOURCES = \ camel-transport.c \ camel-uid-cache.c \ camel-url.c \ - camel-vee-folder.c \ - camel-vee-store.c \ camel-charset-map.c \ camel.c \ gstring-util.c \ @@ -112,15 +102,8 @@ libcamelinclude_HEADERS = \ camel-movemail.h \ camel-multipart.h \ camel-object.h \ - camel-operation.h \ camel-provider.h \ camel-remote-store.h \ - camel-sasl.h \ - camel-sasl-anonymous.h \ - camel-sasl-cram-md5.h \ - camel-sasl-digest-md5.h \ - camel-sasl-kerberos4.h \ - camel-sasl-plain.h \ camel-seekable-stream.h \ camel-seekable-substream.h \ camel-service.h \ @@ -136,8 +119,6 @@ libcamelinclude_HEADERS = \ camel-types.h \ camel-uid-cache.h \ camel-url.h \ - camel-vee-folder.h \ - camel-vee-store.h \ camel.h \ gstring-util.h \ hash-table-utils.h \ @@ -145,9 +126,7 @@ libcamelinclude_HEADERS = \ libcamel_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir) -libcamel_la_LIBADD = $(top_builddir)/e-util/libeutil.la \ - $(UNICODE_LIBS) \ - $(KRB4_LDFLAGS) +libcamel_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(UNICODE_LIBS) noinst_HEADERS = \ diff --git a/camel/broken-date-parser.c b/camel/broken-date-parser.c index 544dc04e28..73a12485a4 100644 --- a/camel/broken-date-parser.c +++ b/camel/broken-date-parser.c @@ -155,7 +155,7 @@ get_month (gchar *str) gchar * parse_broken_date (const gchar *datestr) { - GList *tokens; + GList *tokens, *t; date_t date; gchar *token, *ptr, *newdatestr; guint len, i, retval; @@ -198,7 +198,10 @@ parse_broken_date (const gchar *datestr) tz = atoi (token) / 100.0; } } - + + for (t = tokens; t; t = t->next) + g_free (t->data); + g_list_free (tokens); /* adjust times based on time zones */ diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c index 20c93d3d61..ede9aa6936 100644 --- a/camel/camel-filter-driver.c +++ b/camel/camel-filter-driver.c @@ -71,7 +71,7 @@ struct _CamelFilterDriverPrivate { /* run-time data */ GHashTable *folders; /* folders that message has been copied to */ - int closed; /* close count */ + int closed; /* close count */ GHashTable *forwards; /* addresses that have been forwarded the message */ gboolean terminated; /* message processing was terminated */ @@ -80,12 +80,10 @@ struct _CamelFilterDriverPrivate { CamelMimeMessage *message; /* input message */ CamelMessageInfo *info; /* message summary info */ - const char *uid; /* message uid */ - CamelFolder *source; /* message source folder */ FILE *logfile; /* log file */ - EDList rules; /* list of _filter_rule structs */ + EDList rules; /* list of _filter_rule structs */ CamelException *ex; @@ -371,14 +369,10 @@ do_copy (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriv break; p->copied = TRUE; - if (p->uid && p->source) - camel_folder_copy_message_to (p->source, p->uid, outbox, p->ex); - else - camel_folder_append_message (outbox, p->message, p->info, p->ex); + camel_folder_append_message (outbox, p->message, p->info, p->ex); service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (outbox))); - camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to folder %s", - service_url); + camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to folder %s", service_url); g_free (service_url); } } @@ -408,14 +402,10 @@ do_move (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriv p->copied = TRUE; p->deleted = TRUE; /* a 'move' is a copy & delete */ - if (p->uid && p->source) - camel_folder_copy_message_to (p->source, p->uid, outbox, p->ex); - else - camel_folder_append_message (outbox, p->message, p->info, p->ex); + camel_folder_append_message (outbox, p->message, p->info, p->ex); service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (outbox))); - camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Move to folder %s", - service_url); + camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Move to folder %s", service_url); g_free (service_url); } } @@ -644,7 +634,7 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, Ca goto fail; } - camel_filter_driver_filter_message (driver, msg, NULL, NULL, NULL, source_url, ex); + camel_filter_driver_filter_message (driver, msg, NULL, source_url, ex); camel_object_unref (CAMEL_OBJECT (msg)); if (camel_exception_is_set (ex)) { report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed message %d", i); @@ -696,13 +686,11 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folde for (i = 0; i < uids->len; i++) { int pc = (100 * i)/uids->len; - report_status (driver, CAMEL_FILTER_STATUS_START, pc, "Getting message %d of %d", i+1, - uids->len); + report_status (driver, CAMEL_FILTER_STATUS_START, pc, "Getting message %d of %d", i+1, uids->len); message = camel_folder_get_message (folder, uids->pdata[i], ex); - if (!message || camel_exception_is_set (ex)) { - report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed at message %d of %d", - i+1, uids->len); + if (camel_exception_is_set (ex)) { + report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed at message %d of %d", i+1, uids->len); break; } @@ -711,15 +699,13 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folde else info = NULL; - camel_filter_driver_filter_message (driver, message, info, uids->pdata[i], - folder, source_url, ex); - + camel_filter_driver_filter_message (driver, message, info, source_url, ex); + if (camel_folder_has_summary_capability (folder)) camel_folder_free_message_info (folder, info); if (camel_exception_is_set (ex)) { - report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed at message %d of %d", - i+1, uids->len); + report_status (driver, CAMEL_FILTER_STATUS_END, 100, "Failed at message %d of %d", i+1, uids->len); break; } @@ -732,6 +718,7 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folde if (freeuids) camel_folder_free_uids (folder, uids); + if (p->defaultfolder) { report_status(driver, CAMEL_FILTER_STATUS_PROGRESS, 100, "Syncing folder"); @@ -746,10 +733,8 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver, CamelFolder *folde } void -camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage *message, - CamelMessageInfo *info, const char *uid, - CamelFolder *source, const char *source_url, - CamelException *ex) +camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage *message, CamelMessageInfo *info, + const char *source_url, CamelException *ex) { struct _CamelFilterDriverPrivate *p = _PRIVATE (driver); ESExpResult *r; @@ -773,9 +758,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage p->copied = FALSE; p->message = message; p->info = info; - p->uid = uid; - p->source = source; - + node = (struct _filter_rule *)p->rules.head; while (node->next) { d(fprintf (stderr, "applying rule %s\n action %s\n", node->match, node->action)); @@ -811,10 +794,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage /* copy it to the default inbox */ filtered = TRUE; camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to default folder"); - if (p->uid && p->source) - camel_folder_copy_message_to (p->source, p->uid, p->defaultfolder, p->ex); - else - camel_folder_append_message (p->defaultfolder, p->message, p->info, p->ex); + camel_folder_append_message (p->defaultfolder, p->message, p->info, p->ex); } error: diff --git a/camel/camel-object.c b/camel/camel-object.c index 75c14b8978..f823e019df 100644 --- a/camel/camel-object.c +++ b/camel/camel-object.c @@ -686,6 +686,7 @@ camel_object_hook_event (CamelObject * obj, const gchar * name, { GSList *hooklist; CamelHookPair *pair; + char *orig_key; g_return_if_fail (CAMEL_IS_OBJECT (obj)); g_return_if_fail (name); @@ -699,10 +700,16 @@ camel_object_hook_event (CamelObject * obj, const gchar * name, pair->func = hook; pair->user_data = user_data; - hooklist = g_hash_table_lookup (obj->event_to_hooklist, name); - hooklist = g_slist_prepend (hooklist, pair); - g_hash_table_insert (obj->event_to_hooklist, g_strdup (name), - hooklist); + if (g_hash_table_lookup_extended (obj->event_to_hooklist, name, + &orig_key, &hooklist)) { + hooklist = g_slist_prepend (hooklist, pair); + g_hash_table_insert (obj->event_to_hooklist, orig_key, + hooklist); + } else { + hooklist = g_slist_prepend (NULL, pair); + g_hash_table_insert (obj->event_to_hooklist, g_strdup (name), + hooklist); + } } void diff --git a/camel/providers/cache/Makefile.am b/camel/providers/cache/Makefile.am index 7f9f6a9df5..5427584605 100644 --- a/camel/providers/cache/Makefile.am +++ b/camel/providers/cache/Makefile.am @@ -15,6 +15,7 @@ INCLUDES = \ -I$(srcdir)/../../.. \ -I$(includedir) \ -I$(top_srcdir)/intl \ + $(EXTRA_GNOME_CFLAGS) \ $(GTK_INCLUDEDIR) \ -I$(top_srcdir)/camel \ -DG_LOG_DOMAIN=\"camel-cache-provider\" diff --git a/camel/providers/imap/Makefile.am b/camel/providers/imap/Makefile.am index 39e160c879..eb4e396448 100644 --- a/camel/providers/imap/Makefile.am +++ b/camel/providers/imap/Makefile.am @@ -17,9 +17,12 @@ INCLUDES = -I.. \ -I$(top_srcdir) \ -I$(includedir) \ $(GTK_INCLUDEDIR) \ + $(EXTRA_GNOME_CFLAGS) \ + $(KRB4_CFLAGS) \ -DG_LOG_DOMAIN=\"camel-imap-provider\" libcamelimap_la_SOURCES = \ + camel-imap-auth.c \ camel-imap-command.c \ camel-imap-folder.c \ camel-imap-provider.c \ @@ -30,6 +33,7 @@ libcamelimap_la_SOURCES = \ camel-imap-wrapper.c libcamelimapinclude_HEADERS = \ + camel-imap-auth.h \ camel-imap-command.h \ camel-imap-folder.h \ camel-imap-search.h \ @@ -39,7 +43,7 @@ libcamelimapinclude_HEADERS = \ camel-imap-utils.h \ camel-imap-wrapper.h -libcamelimap_la_LDFLAGS = -version-info 0:0:0 +libcamelimap_la_LDFLAGS = $(KRB4_LDFLAGS) -version-info 0:0:0 noinst_HEADERS = \ camel-imap-private.h diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index cf91bceb12..87807bcbe5 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -58,7 +58,6 @@ #include "camel-mime-utils.h" #include "camel-imap-private.h" #include "camel-multipart.h" -#include "camel-operation.h" #define d(x) x @@ -326,8 +325,6 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex) CamelImapMessageInfo *iinfo; GArray *removed; - camel_operation_start(NULL, _("Scanning IMAP folder")); - /* Get UIDs and flags of all messages. */ if (exists > 0) { response = camel_imap_command (store, folder, ex, @@ -367,10 +364,6 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex) removed = g_array_new (FALSE, FALSE, sizeof (int)); summary_len = camel_folder_summary_count (folder->summary); for (i = 0; i < summary_len && i < exists; i++) { - int pc = (i*100)/MIN(summary_len, exists); - - camel_operation_progress(NULL, pc); - /* Shouldn't happen, but... */ if (!new[i].uid) continue; @@ -420,66 +413,28 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex) /* And finally update the summary. */ camel_imap_folder_changed (folder, exists, removed, ex); g_array_free (removed, TRUE); - - camel_operation_end(NULL); } -/* Find all messages in @folder with flags matching @flags and @mask. - * If no messages match, returns %NULL. Otherwise, returns an array of - * CamelMessageInfo and sets *@set to a message set corresponding the - * UIDs of the matched messages. The caller must free the infos, the - * array, and the set string. - */ -static GPtrArray * -get_matching (CamelFolder *folder, guint32 flags, guint32 mask, char **set) +static void +sync_message (CamelImapStore *store, CamelFolder *folder, + CamelMessageInfo *mi, CamelException *ex) { - GPtrArray *matches; - CamelMessageInfo *info; - int i, max, range; - GString *gset; - - matches = g_ptr_array_new (); - gset = g_string_new (""); - max = camel_folder_summary_count (folder->summary); - range = -1; - for (i = 0; i < max; i++) { - info = camel_folder_summary_index (folder->summary, i); - if (!info) - continue; - if ((info->flags & mask) != flags) { - camel_folder_summary_info_free (folder->summary, info); - if (range != -1) { - if (range != i - 1) { - info = matches->pdata[matches->len - 1]; - g_string_sprintfa (gset, ":%s", camel_message_info_uid (info)); - } - range = -1; - } - continue; - } + CamelImapResponse *response; + char *flags; - g_ptr_array_add (matches, info); - if (range != -1) - continue; - range = i; - if (gset->len) - g_string_append_c (gset, ','); - g_string_sprintfa (gset, "%s", camel_message_info_uid (info)); - } - if (range != -1 && range != max - 1) { - info = matches->pdata[matches->len - 1]; - g_string_sprintfa (gset, ":%s", camel_message_info_uid (info)); - } + flags = imap_create_flag_list (mi->flags); + CAMEL_IMAP_STORE_LOCK (store, command_lock); + response = camel_imap_command (store, folder, ex, + "UID STORE %s FLAGS.SILENT %s", + camel_message_info_uid (mi), flags); + CAMEL_IMAP_STORE_UNLOCK (store, command_lock); + g_free (flags); + if (camel_exception_is_set (ex)) + return; + camel_imap_response_free (response); - if (matches->len) { - *set = gset->str; - g_string_free (gset, FALSE); - return matches; - } else { - g_string_free (gset, TRUE); - g_ptr_array_free (matches, TRUE); - return NULL; - } + mi->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED; + ((CamelImapMessageInfo *)mi)->server_flags = mi->flags; } static void @@ -487,80 +442,17 @@ imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex) { CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store); CamelImapResponse *response; - CamelMessageInfo *info; - GPtrArray *matches; - char *set, *flaglist; - int i, j, max; + int i, max; + /* Set the flags on any messages that have changed this session */ max = camel_folder_summary_count (folder->summary); - - /* If we're expunging then we don't need to be precise about the - * flags of deleted messages. Just add \Deleted to anything that - * should have it. - */ - if (expunge && (matches = get_matching (folder, CAMEL_MESSAGE_DELETED, - CAMEL_MESSAGE_DELETED, &set))) { - for (i = 0; i < matches->len; i++) { - info = matches->pdata[i]; - info->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED; - camel_folder_summary_info_free (folder->summary, info); - } - g_ptr_array_free (matches, TRUE); - camel_folder_summary_touch (folder->summary); - - CAMEL_IMAP_STORE_LOCK (store, command_lock); - response = camel_imap_command (store, folder, ex, - "UID STORE %s +FLAGS.SILENT \\Deleted", - set); - CAMEL_IMAP_STORE_UNLOCK (store, command_lock); - g_free (set); - if (response) - camel_imap_response_free (response); - if (camel_exception_is_set (ex)) - return; - } - - /* OK, now, find a message with changed flags, find all of the - * other messages like it, sync them as a group, mark them as - * updated, and continue. - */ for (i = 0; i < max; i++) { - info = camel_folder_summary_index (folder->summary, i); - if (!info) - continue; - if (!(info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED)) { - camel_folder_summary_info_free (folder->summary, info); - continue; - } - - flaglist = imap_create_flag_list (info->flags); - matches = get_matching (folder, info->flags & (CAMEL_IMAP_SERVER_FLAGS | CAMEL_MESSAGE_FOLDER_FLAGGED), - CAMEL_IMAP_SERVER_FLAGS | CAMEL_MESSAGE_FOLDER_FLAGGED, &set); - camel_folder_summary_info_free (folder->summary, info); + CamelMessageInfo *info; - CAMEL_IMAP_STORE_LOCK (store, command_lock); - response = camel_imap_command (store, folder, ex, - "UID STORE %s FLAGS.SILENT %s", - set, flaglist); - CAMEL_IMAP_STORE_UNLOCK (store, command_lock); - g_free (set); - g_free (flaglist); - if (response) - camel_imap_response_free (response); - if (!camel_exception_is_set (ex)) { - for (j = 0; j < matches->len; j++) { - info = matches->pdata[j]; - info->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED; - ((CamelImapMessageInfo*)info)->server_flags = - info->flags & CAMEL_IMAP_SERVER_FLAGS; - } - camel_folder_summary_touch (folder->summary); - } - for (j = 0; j < matches->len; j++) { - info = matches->pdata[j]; - camel_folder_summary_info_free (folder->summary, info); - } - g_ptr_array_free (matches, TRUE); + info = camel_folder_summary_index (folder->summary, i); + if (info && (info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED)) + sync_message (store, folder, info, ex); + camel_folder_summary_info_free(folder->summary, info); if (camel_exception_is_set (ex)) return; @@ -574,8 +466,6 @@ imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex) } camel_folder_summary_save (folder->summary); - - camel_operation_end(NULL); } static void @@ -674,27 +564,8 @@ imap_copy_message_to (CamelFolder *source, const char *uid, g_return_if_fail (mi != NULL); /* Sync message flags if needed. */ - if (mi->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) { - char *flaglist; - - flaglist = imap_create_flag_list (mi->flags); - CAMEL_IMAP_STORE_LOCK (store, command_lock); - response = camel_imap_command (store, source, ex, - "UID STORE %s FLAGS.SILENT %s", - camel_message_info_uid (mi), - flaglist); - CAMEL_IMAP_STORE_UNLOCK (store, command_lock); - g_free (flaglist); - if (camel_exception_is_set (ex)) { - camel_folder_summary_info_free (source->summary, mi); - return; - } - camel_imap_response_free (response); - - mi->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED; - ((CamelImapMessageInfo *)mi)->server_flags = - mi->flags & CAMEL_IMAP_SERVER_FLAGS; - } + if (mi->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) + sync_message (store, source, mi, ex); camel_folder_summary_info_free (source->summary, mi); if (camel_exception_is_set (ex)) diff --git a/camel/providers/local/Makefile.am b/camel/providers/local/Makefile.am index 2e95021334..e0bee4ff46 100644 --- a/camel/providers/local/Makefile.am +++ b/camel/providers/local/Makefile.am @@ -16,6 +16,7 @@ INCLUDES = -I.. \ -I$(top_srcdir) \ -I$(includedir) \ $(GTK_INCLUDEDIR) \ + $(EXTRA_GNOME_CFLAGS) \ -DG_LOG_DOMAIN=\"camel-local-provider\" libcamellocal_la_SOURCES = \ diff --git a/camel/providers/nntp/Makefile.am b/camel/providers/nntp/Makefile.am index 4b686735e3..268807e944 100644 --- a/camel/providers/nntp/Makefile.am +++ b/camel/providers/nntp/Makefile.am @@ -15,6 +15,7 @@ INCLUDES = -I../.. \ -I$(top_srcdir) \ -I$(includedir) \ $(GTK_INCLUDEDIR) \ + $(EXTRA_GNOME_CFLAGS) \ -DG_LOG_DOMAIN=\"camel-nntp-provider\" libcamelnntp_la_SOURCES = \ diff --git a/camel/providers/pop3/Makefile.am b/camel/providers/pop3/Makefile.am index 608e640cd9..bc12dfebcf 100644 --- a/camel/providers/pop3/Makefile.am +++ b/camel/providers/pop3/Makefile.am @@ -17,6 +17,7 @@ INCLUDES = \ -I$(top_srcdir)/e-util \ $(KRB4_CFLAGS) \ $(GTK_INCLUDEDIR) \ + $(EXTRA_GNOME_CFLAGS) \ -DG_LOG_DOMAIN=\"camel-pop3-provider\" libcamelpop3_la_SOURCES = \ diff --git a/camel/providers/sendmail/Makefile.am b/camel/providers/sendmail/Makefile.am index 965f56afb8..2fcd5add42 100644 --- a/camel/providers/sendmail/Makefile.am +++ b/camel/providers/sendmail/Makefile.am @@ -14,7 +14,9 @@ INCLUDES = \ -I$(srcdir)/../../.. \ -I$(includedir) \ -I$(top_srcdir)/intl \ - $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel \ + $(GTK_INCLUDEDIR) \ + $(EXTRA_GNOME_CFLAGS) \ + -I$(top_srcdir)/camel \ -DG_LOG_DOMAIN=\"camel-sendmail-provider\" libcamelsendmail_la_SOURCES = \ diff --git a/camel/providers/smtp/Makefile.am b/camel/providers/smtp/Makefile.am index 734a4e5128..bdde4eff60 100644 --- a/camel/providers/smtp/Makefile.am +++ b/camel/providers/smtp/Makefile.am @@ -15,6 +15,7 @@ INCLUDES = \ -I$(top_srcdir)/intl \ -I$(top_srcdir)/camel \ -I$(top_srcdir)/e-util \ + $(EXTRA_GNOME_CFLAGS) \ $(GTK_INCLUDEDIR) \ -DG_LOG_DOMAIN=\"camel-smtp-provider\" diff --git a/camel/providers/vee/Makefile.am b/camel/providers/vee/Makefile.am new file mode 100644 index 0000000000..71e6c7128f --- /dev/null +++ b/camel/providers/vee/Makefile.am @@ -0,0 +1,38 @@ +## Process this file with automake to produce Makefile.in + +libcamelveeincludedir = $(includedir)/camel + + +providerdir = $(pkglibdir)/camel-providers/$(VERSION) + +provider_LTLIBRARIES = libcamelvee.la +provider_DATA = libcamelvee.urls + +INCLUDES = -I.. \ + -I$(srcdir)/.. \ + -I$(top_srcdir)/camel \ + -I$(top_srcdir)/intl \ + -I$(top_srcdir)/libibex \ + -I$(top_srcdir)/e-util \ + -I$(top_srcdir) \ + -I$(includedir) \ + $(EXTRA_GNOME_CFLAGS) \ + $(GTK_INCLUDEDIR) \ + -DG_LOG_DOMAIN=\"camel-vee-provider\" + +libcamelvee_la_SOURCES = \ + camel-vee-folder.c \ + camel-vee-provider.c \ + camel-vee-store.c + +libcamelveeinclude_HEADERS = \ + camel-vee-folder.h \ + camel-vee-store.h + +libcamelvee_la_LDFLAGS = -version-info 0:0:0 + +libcamelvee_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS) +#libcamelvee_la_LIBADD = $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS) + +EXTRA_DIST = libcamelvee.urls + diff --git a/camel/tests/lib/Makefile.am b/camel/tests/lib/Makefile.am index ea51a2c28a..88e5b9926c 100644 --- a/camel/tests/lib/Makefile.am +++ b/camel/tests/lib/Makefile.am @@ -1,5 +1,5 @@ -INCLUDES = -I$(includedir) +INCLUDES = -I$(includedir) -I$(top_srcdir) check_LIBRARIES = libcameltest.a diff --git a/composer/ChangeLog b/composer/ChangeLog index ccdb44e096..b9601839b0 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,94 +1,3 @@ -2001-03-13 Dan Winship <danw@ximian.com> - - * e-msg-composer-attachment.c (update_mime_type): Use - gnome_vfs_mime_type_from_name rather than gnome_vfs_mime_info, - since the entered filename doesn't have to be a real file on disk. - Deal with it returning NULL too. - (e_msg_composer_attachment_edit): Select the right item in the - inline/attachment menu. - - * e-msg-composer-hdrs.c: s/Pair/EMsgComposerHdrPair/. Namespace! - -2001-03-12 Jeffrey Stedfast <fejj@ximian.com> - - * e-msg-composer.h: Added view_replyto member. - - * e-msg-composer.c (e_msg_composer_get_visible_flags): Find out if - we want to view the Reply-To header. - (e_msg_composer_set_view_replyto): A new function to set the state - of the replyto header. - (menu_view_replyto_cb): Callback for setting the ReplyTo state. - (set_config): Make static. - (setup_ui): Setup the ReplyTo bonobo stuff. - (load_from_property_bag): More defaults for the ReplyTo, yay. - (load_from_gnome_config): Again... - (e_msg_composer_get_view_bcc): Implemented. - (e_msg_composer_get_view_cc): Implemented. - (e_msg_composer_get_view_from): Implemented. - (e_msg_composer_get_view_replyto): Implemented. - - * e-msg-composer-hdrs.c (e_msg_composer_hdrs_get_reply_to_entry): - New function, yay. - (e_msg_composer_hdrs_get_reply_to): Another new function. - (e_msg_composer_hdrs_set_reply_to): Yet another new function... - (create_headers): Create the reply-to header. - (attach_headers): Attach the reply_to. - (headers_set_visibility): Set the reply_to visibility. - (e_msg_composer_hdrs_to_message): Set the message's reply-to here - based on the user-set reply-to header. - -2001-03-06 Miguel de Icaza <miguel@ximian.com> - - * e-msg-composer.c (set_config): New function. Used to store - integer values into the configuration engine. Handles the case of - Bonobo-conf being installed, or falls back to gnome_config. - - * e-msg-composer-hdrs.c (add_header): Renamed to be - header_new_recipient(). Now we take care of the other cases in - create_headers, which is a lot nicer now. - - (create_optionmenu): Removed extra "name" argument which was not - being used anyways (the only arg passed was From:). - (init): Removed all the redundant NULL initialization by using - nice g_new0 - - (create_headers): New function, much cleaner. - - Use of Pair structure everywhere instead of individual widgets to - keep track of which ones are visible and which ones are not. - - * e-msg-composer.c (setup_ui): Handle ViewFrom and ViewBCC - commands. - (menu_view_bcc_cb, menu_view_from_cb): New functions that - implement the features described. - - (menu_format_html_cb): Removed unrequired test, as - e_msg_composer_set_send_html already optimizes the case of the - state being the same. - (menu_security_pgp_encrypt_cb): Remove redundant code. - (menu_security_pgp_sign_cb): ditto. - -2001-03-02 Jeffrey Stedfast <fejj@ximian.com> - - * e-icon-list.c (icon_new_from_pixbuf): Added a comment reminding - us that we should probably not force a particular font in the icon - caption. - -2001-02-27 Dan Winship <danw@ximian.com> - - * evolution-composer.c (factory_fn): If - !mail_config_is_configured(), give an error and return NULL. - -2001-02-22 Ettore Perazzoli <ettore@ximian.com> - - * Makefile.am (INCLUDES): Add `-I$(top_srcdir)/shell'. - -2001-02-21 Not Zed <NotZed@Ximian.com> - - * e-msg-composer.c (menu_file_save_draft_cb): - (exit_dialog_cb): Use mail_append_mail to save to drafts instead - of custom thread handler. - 2001-02-19 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.c (build_message): Handle exceptions a little @@ -97,33 +6,6 @@ because we want to let the user decide what to do based on the error message he/she gets. -2001-02-15 Dan Winship <danw@ximian.com> - - * e-msg-composer-hdrs.c (e_msg_composer_hdrs_set_from_account): If - @account_name is NULL, pick the default account rather than giving - a g_warning. - - * e-msg-composer.c (e_msg_composer_set_headers): Note in the - doc comment that @from can be NULL if you want the default account - (since there is code that expects this). - -2001-02-13 Jeffrey Stedfast <fejj@ximian.com> - - * evolution-composer.c (corba_recipientlist_to_glist): Use the - camel-internet-address code to format the address rather than - doing it the broken way. - -2001-02-10 Jeffrey Stedfast <fejj@ximian.com> - - * evolution-composer.c (impl_Composer_set_headers): Updated. We - might want to change the corba interface for this to allow setting - the from-address as well. - - * e-msg-composer.c (e_msg_composer_new_with_message): Updated. - (e_msg_composer_set_headers): Now takes a 'From' argument so that - we can try to pre-determine the account the user will want to send - from. - 2001-02-11 Gediminas Paulauskas <menesis@delfi.lt> * e-msg-composer-attachment.glade.h: removed. @@ -135,12 +17,6 @@ * e-msg-composer-attachment-bar.c (attach_to_multipart): multipart/* is another mime type we DO NOT want to encode ;-) -2001-02-06 Christopher James Lahey <clahey@ximian.com> - - * e-msg-composer-hdrs.c (address_button_clicked_cb, add_header): - Set the default argument to - GNOME_Evolution_Addressbook_SelectNames_activateDialog correctly. - 2001-01-30 Larry Ewing <lewing@ximian.com> * e-msg-composer-hdrs.c (create_optionmenu): make sure we convert diff --git a/composer/Makefile.am b/composer/Makefile.am index db5c56dc26..89a4187583 100644 --- a/composer/Makefile.am +++ b/composer/Makefile.am @@ -50,7 +50,6 @@ INCLUDES = \ -I$(top_builddir)/camel \ -I$(top_builddir)/addressbook/gui/component/select-names \ -I$(top_builddir)/shell \ - -I$(top_srcdir)/shell \ $(EXTRA_GNOME_CFLAGS) \ $(GNOME_INCLUDEDIR) \ $(BONOBO_GNOME_CFLAGS) \ diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 7edc282f1e..be39d81761 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -18,11 +18,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Authors: - * Ettore Perazzoli (ettore@ximian.com) - * Jeffrey Stedfast (fejj@ximian.com) - * Miguel de Icaza (miguel@ximian.com) - * + * Authors: Ettore Perazzoli, Jeffrey Stedfast */ /* @@ -32,8 +28,6 @@ - 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 @@ -54,7 +48,7 @@ #include "mail/mail.h" #include "mail/mail-crypto.h" #include "mail/mail-tools.h" -#include "mail/mail-ops.h" +#include "mail/mail-threads.h" #include "e-util/e-html-utils.h" #include <gal/widgets/e-gui-utils.h> @@ -642,26 +636,6 @@ set_editor_text (EMsgComposer *composer, const char *sig_file, const char *text) bonobo_object_unref (BONOBO_OBJECT(stream)); } -static void -set_config (EMsgComposer *composer, char *key, int val) -{ - if (composer->property_bag){ - CORBA_Environment ev; - CORBA_exception_init (&ev); - - bonobo_property_bag_client_set_value_gint ( - composer->property_bag, key, val, &ev); - CORBA_exception_free (&ev); - return; - } else { - char *full_key; - - full_key = g_strconcat ("Evolution/Composer/", key, NULL); - gnome_config_set_int (full_key, val); - g_free (full_key); - } -} - /* Commands. */ @@ -743,62 +717,104 @@ load (EMsgComposer *composer, enum { REPLY_YES = 0, REPLY_NO, REPLY_CANCEL }; -struct _save_info { +typedef struct save_draft_input_s { EMsgComposer *composer; - int quitok; -}; - -static void -save_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data) -{ - struct _save_info *si = data; +} save_draft_input_t; - if (ok && si->quitok) - gtk_widget_destroy (GTK_WIDGET (si->composer)); - else - gtk_object_unref (GTK_OBJECT (si->composer)); +typedef struct save_draft_data_s { + CamelMimeMessage *msg; + CamelMessageInfo *info; +} save_draft_data_t; - g_free (info); - g_free (si); +static gchar * +describe_save_draft (gpointer in_data, gboolean gerund) +{ + if (gerund) { + return g_strdup (_("Saving changes to message...")); + } else { + return g_strdup (_("Save changes to message...")); + } } static void -save_draft (EMsgComposer *composer, int quitok) +setup_save_draft (gpointer in_data, gpointer op_data, CamelException *ex) { - CamelMimeMessage *msg; - CamelMessageInfo *info; - extern CamelFolder *drafts_folder; - struct _save_info *si; + save_draft_input_t *input = (save_draft_input_t *) in_data; + save_draft_data_t *data = (save_draft_data_t *) op_data; - composer->send_html = TRUE; /* always save drafts as HTML to keep formatting */ - msg = e_msg_composer_get_message (composer); + g_return_if_fail (input->composer != NULL); - info = g_new0 (CamelMessageInfo, 1); - info->flags = CAMEL_MESSAGE_DRAFT; + /* initialize op_data */ + input->composer->send_html = TRUE; /* always save drafts as HTML to keep formatting */ + data->msg = e_msg_composer_get_message (input->composer); + data->info = g_new0 (CamelMessageInfo, 1); + data->info->flags = CAMEL_MESSAGE_DRAFT; +} + +static void +do_save_draft (gpointer in_data, gpointer op_data, CamelException *ex) +{ + /*save_draft_input_t *input = (save_draft_input_t *) in_data;*/ + save_draft_data_t *data = (save_draft_data_t *) op_data; + extern CamelFolder *drafts_folder; - si = g_malloc (sizeof (*si)); - si->composer = composer; - gtk_object_ref (GTK_OBJECT (composer)); - si->quitok = quitok; + /* perform camel operations */ + mail_tool_camel_lock_up (); + camel_folder_append_message (drafts_folder, data->msg, data->info, ex); + mail_tool_camel_lock_down (); +} + +static void +cleanup_save_draft (gpointer in_data, gpointer op_data, CamelException *ex) +{ + save_draft_input_t *input = (save_draft_input_t *) in_data; + /*save_draft_data_t *data = (save_draft_data_t *) op_data;*/ - mail_append_mail (drafts_folder, msg, info, save_done, si); - camel_object_unref (CAMEL_OBJECT (msg)); + if (camel_exception_is_set (ex)) { + char *reason; + + reason = g_strdup_printf (_("Error saving composition to 'Drafts': %s"), + camel_exception_get_description (ex)); + + gnome_warning_dialog_parented (reason, GTK_WINDOW (input->composer)); + g_free (reason); + } else { + gtk_widget_destroy (GTK_WIDGET (input->composer)); + } } +static const mail_operation_spec op_save_draft = { + describe_save_draft, + sizeof (save_draft_data_t), + setup_save_draft, + do_save_draft, + cleanup_save_draft +}; + static void menu_file_save_draft_cb (BonoboUIComponent *uic, void *data, const char *path) { - save_draft (E_MSG_COMPOSER (data), FALSE); + EMsgComposer *composer; + save_draft_input_t *input; + + composer = E_MSG_COMPOSER (data); + + input = g_new0 (save_draft_input_t, 1); + input->composer = composer; + mail_operation_queue (&op_save_draft, input, TRUE); } static void exit_dialog_cb (int reply, EMsgComposer *composer) { + save_draft_input_t *input; + switch (reply) { case REPLY_YES: /* this has to be done async */ - save_draft(composer, TRUE); - break; + input = g_new0 (save_draft_input_t, 1); + input->composer = composer; + mail_operation_queue (&op_save_draft, input, TRUE); case REPLY_NO: gtk_widget_destroy (GTK_WIDGET (composer)); break; @@ -1089,8 +1105,8 @@ fs_selection_get (GtkWidget *widget, GtkSelectionData *sdata, g_free (buffer); gtk_object_remove_data (GTK_OBJECT (widget), "ev_file_buffer"); } -#endif +#endif static void menu_file_insert_file_cb (BonoboUIComponent *uic, void *data, @@ -1125,10 +1141,21 @@ menu_format_html_cb (BonoboUIComponent *component, gpointer user_data) { + EMsgComposer *composer; + gboolean new_state; + if (type != Bonobo_UIComponent_STATE_CHANGED) return; - e_msg_composer_set_send_html (E_MSG_COMPOSER (user_data), atoi (state)); + composer = E_MSG_COMPOSER (user_data); + + new_state = atoi (state); + + if ((new_state && composer->send_html) || + (! new_state && ! composer->send_html)) + return; + + e_msg_composer_set_send_html (composer, new_state); } static void @@ -1136,13 +1163,24 @@ menu_security_pgp_sign_cb (BonoboUIComponent *component, const char *path, Bonobo_UIComponent_EventType type, const char *state, - gpointer composer) + gpointer user_data) { + EMsgComposer *composer; + gboolean new_state; + if (type != Bonobo_UIComponent_STATE_CHANGED) return; - - e_msg_composer_set_pgp_sign (E_MSG_COMPOSER (composer), atoi (state)); + + composer = E_MSG_COMPOSER (user_data); + + new_state = atoi (state); + + if ((new_state && composer->pgp_sign) || + (!new_state && ! composer->pgp_sign)) + return; + + e_msg_composer_set_pgp_sign (composer, new_state); } static void @@ -1150,65 +1188,24 @@ menu_security_pgp_encrypt_cb (BonoboUIComponent *component, const char *path, Bonobo_UIComponent_EventType type, const char *state, - gpointer composer) + gpointer user_data) { - if (type != Bonobo_UIComponent_STATE_CHANGED) - return; + EMsgComposer *composer; + gboolean new_state; - e_msg_composer_set_pgp_encrypt (E_MSG_COMPOSER (composer), atoi (state)); -} - -static void -menu_view_from_cb (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) -{ - if (type != Bonobo_UIComponent_STATE_CHANGED) - return; - - e_msg_composer_set_view_from (E_MSG_COMPOSER (user_data), atoi (state)); -} - -static void -menu_view_replyto_cb (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) -{ - if (type != Bonobo_UIComponent_STATE_CHANGED) - return; - - e_msg_composer_set_view_replyto (E_MSG_COMPOSER (user_data), atoi (state)); -} - -static void -menu_view_bcc_cb (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) -{ if (type != Bonobo_UIComponent_STATE_CHANGED) return; - - e_msg_composer_set_view_bcc (E_MSG_COMPOSER (user_data), atoi (state)); -} - -static void -menu_view_cc_cb (BonoboUIComponent *component, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer user_data) -{ - if (type != Bonobo_UIComponent_STATE_CHANGED) + + composer = E_MSG_COMPOSER (user_data); + + new_state = atoi (state); + + if ((new_state && composer->pgp_encrypt) || + (!new_state && ! composer->pgp_encrypt)) return; - - e_msg_composer_set_view_cc (E_MSG_COMPOSER (user_data), atoi (state)); + + e_msg_composer_set_pgp_encrypt (composer, new_state); } @@ -1249,68 +1246,29 @@ setup_ui (EMsgComposer *composer) "evolution-message-composer"); /* Format -> HTML */ - bonobo_ui_component_set_prop ( - composer->uic, "/commands/FormatHtml", - "state", composer->send_html ? "1" : "0", NULL); - bonobo_ui_component_add_listener ( - composer->uic, "FormatHtml", - menu_format_html_cb, composer); - - /* View/From */ - bonobo_ui_component_set_prop ( - composer->uic, "/commands/ViewFrom", - "state", composer->view_from ? "1" : "0", NULL); - bonobo_ui_component_add_listener ( - composer->uic, "ViewFrom", - menu_view_from_cb, composer); - - /* View/ReplyTo */ - bonobo_ui_component_set_prop ( - composer->uic, "/commands/ViewReplyTo", - "state", composer->view_replyto ? "1" : "0", NULL); - bonobo_ui_component_add_listener ( - composer->uic, "ViewReplyTo", - menu_view_replyto_cb, composer); - - /* View/BCC */ - bonobo_ui_component_set_prop ( - composer->uic, "/commands/ViewBCC", - "state", composer->view_bcc ? "1" : "0", NULL); - bonobo_ui_component_add_listener ( - composer->uic, "ViewBCC", - menu_view_bcc_cb, composer); - - /* View/CC */ - bonobo_ui_component_set_prop ( - composer->uic, "/commands/ViewCC", - "state", composer->view_cc ? "1" : "0", NULL); - bonobo_ui_component_add_listener ( - composer->uic, "ViewCC", - menu_view_cc_cb, composer); + bonobo_ui_component_set_prop (composer->uic, "/commands/FormatHtml", + "state", composer->send_html ? "1" : "0", NULL); + + bonobo_ui_component_add_listener (composer->uic, "FormatHtml", + menu_format_html_cb, composer); - /* Security -> PGP Sign */ - bonobo_ui_component_set_prop ( - composer->uic, "/commands/SecurityPGPSign", - "state", composer->pgp_sign ? "1" : "0", NULL); + bonobo_ui_component_set_prop (composer->uic, "/commands/SecurityPGPSign", + "state", composer->pgp_sign ? "1" : "0", NULL); - bonobo_ui_component_add_listener ( - composer->uic, "SecurityPGPSign", - menu_security_pgp_sign_cb, composer); + bonobo_ui_component_add_listener (composer->uic, "SecurityPGPSign", + menu_security_pgp_sign_cb, composer); /* Security -> PGP Encrypt */ - bonobo_ui_component_set_prop ( - composer->uic, "/commands/SecurityPGPEncrypt", - "state", composer->pgp_encrypt ? "1" : "0", NULL); + bonobo_ui_component_set_prop (composer->uic, "/commands/SecurityPGPEncrypt", + "state", composer->pgp_encrypt ? "1" : "0", NULL); - bonobo_ui_component_add_listener ( - composer->uic, "SecurityPGPEncrypt", - menu_security_pgp_encrypt_cb, composer); + bonobo_ui_component_add_listener (composer->uic, "SecurityPGPEncrypt", + menu_security_pgp_encrypt_cb, composer); /* View -> Attachments */ - bonobo_ui_component_add_listener ( - composer->uic, "ViewAttach", - menu_view_attachments_activate_cb, composer); + bonobo_ui_component_add_listener (composer->uic, "ViewAttach", + menu_view_attachments_activate_cb, composer); } @@ -1372,8 +1330,6 @@ destroy (GtkObject *object) CORBA_Environment ev; composer = E_MSG_COMPOSER (object); - - gnome_config_sync (); if (composer->uic) bonobo_object_unref (BONOBO_OBJECT (composer->uic)); @@ -1561,100 +1517,6 @@ e_msg_composer_get_type (void) return type; } -static int -get_config_value (const char *key) -{ - char *full_key = g_strconcat ("/Evolution/Composer/", key, NULL); - int v; - - v = gnome_config_get_int (full_key); - g_free (full_key); - return v; -} - -static gint -load_with_failue_control (Bonobo_PropertyBag bag, char *key, gint default_if_fails) -{ - CORBA_Environment ev; - gint v; - - CORBA_exception_init (&ev); - v = bonobo_property_bag_client_get_value_gint (bag, key, &ev); - if (ev._major == CORBA_NO_EXCEPTION) - return v; - CORBA_exception_free (&ev); - - return default_if_fails; -} - -static void -load_from_property_bag (EMsgComposer *composer) -{ - Bonobo_PropertyBag bag = composer->property_bag; - - composer->view_from = load_with_failue_control (bag, "ViewFrom", 1); - composer->view_replyto = load_with_failue_control (bag, "ViewReplyTo", 0); - composer->view_bcc = load_with_failue_control (bag, "ViewBCC", 0); - composer->view_cc = load_with_failue_control (bag, "ViewCC", 1); - composer->view_subject = load_with_failue_control (bag, "ViewSubject", 1); -} - -static void -load_from_gnome_config (EMsgComposer *composer) -{ - composer->view_from = get_config_value ("ViewFrom=1"); - composer->view_replyto = get_config_value ("ViewReplyTo=0"); - composer->view_bcc = get_config_value ("ViewBCC=0"); - composer->view_cc = get_config_value ("ViewCC=1"); - composer->view_subject = get_config_value ("ViewSubject=1"); -} - -static void -e_msg_composer_load_config (EMsgComposer *composer) -{ - Bonobo_PropertyBag pbag; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - pbag = bonobo_get_object ( - "config:/Evolution/Mail/Composer", "IDL:Bonobo/PropertyBag:1.0", - &ev); - if (ev._major == CORBA_NO_EXCEPTION && pbag != CORBA_OBJECT_NIL){ - composer->property_bag = pbag; - load_from_property_bag (composer); - } else { - composer->property_bag = CORBA_OBJECT_NIL; - load_from_gnome_config (composer); - } - CORBA_exception_free (&ev); -} - -static gint -e_msg_composer_get_visible_flags (EMsgComposer *composer) -{ - int flags = 0; - - if (composer->view_from) - flags |= E_MSG_COMPOSER_VISIBLE_FROM; - if (composer->view_replyto) - flags |= E_MSG_COMPOSER_VISIBLE_REPLYTO; - if (composer->view_cc) - flags |= E_MSG_COMPOSER_VISIBLE_CC; - if (composer->view_bcc) - flags |= E_MSG_COMPOSER_VISIBLE_BCC; - if (composer->view_subject) - flags |= E_MSG_COMPOSER_VISIBLE_SUBJECT; - - /* - * Until we have a GUI way, lets make sure that - * even if the user screws up, we will do the right - * thing (screws up == edit the config file manually - * and screw up). - */ - flags |= E_MSG_COMPOSER_VISIBLE_SUBJECT; - return flags; -} - /** * e_msg_composer_construct: * @composer: A message composer widget @@ -1666,8 +1528,7 @@ e_msg_composer_construct (EMsgComposer *composer) { GtkWidget *vbox; BonoboObject *editor_server; - gint vis; - + static GtkTargetEntry drop_types[] = { {"text/uri-list", 0, 1} }; @@ -1685,15 +1546,12 @@ e_msg_composer_construct (EMsgComposer *composer) drop_types, 1, GDK_ACTION_COPY); gtk_signal_connect (GTK_OBJECT (composer), "drag_data_received", GTK_SIGNAL_FUNC (drag_data_received), NULL); - e_msg_composer_load_config (composer); setup_ui (composer); vbox = gtk_vbox_new (FALSE, 0); - - vis = e_msg_composer_get_visible_flags (composer); - composer->hdrs = e_msg_composer_hdrs_new (vis); + composer->hdrs = e_msg_composer_hdrs_new (); gtk_box_pack_start (GTK_BOX (vbox), composer->hdrs, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (composer->hdrs), "subject_changed", GTK_SIGNAL_FUNC (subject_changed_cb), composer); @@ -1982,7 +1840,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg) } } - e_msg_composer_set_headers (new, NULL, To, Cc, Bcc, subject); + e_msg_composer_set_headers (new, To, Cc, Bcc, subject); free_recipients (To); free_recipients (Cc); @@ -2203,8 +2061,6 @@ e_msg_composer_show_attachments (EMsgComposer *composer, /** * e_msg_composer_set_headers: * @composer: a composer object - * @from: the name of the account the user will send from, - * or %NULL for the default account * @to: the values for the "To" header * @cc: the values for the "Cc" header * @bcc: the values for the "Bcc" header @@ -2213,11 +2069,8 @@ e_msg_composer_show_attachments (EMsgComposer *composer, * Sets the headers in the composer to the given values. **/ void -e_msg_composer_set_headers (EMsgComposer *composer, - const char *from, - const GList *to, - const GList *cc, - const GList *bcc, +e_msg_composer_set_headers (EMsgComposer *composer, const GList *to, + const GList *cc, const GList *bcc, const char *subject) { EMsgComposerHdrs *hdrs; @@ -2225,7 +2078,6 @@ e_msg_composer_set_headers (EMsgComposer *composer, g_return_if_fail (E_IS_MSG_COMPOSER (composer)); hdrs = E_MSG_COMPOSER_HDRS (composer->hdrs); - e_msg_composer_hdrs_set_from_account (hdrs, from); e_msg_composer_hdrs_set_to (hdrs, to); e_msg_composer_hdrs_set_cc (hdrs, cc); e_msg_composer_hdrs_set_bcc (hdrs, bcc); @@ -2368,11 +2220,8 @@ e_msg_composer_set_send_html (EMsgComposer *composer, composer->send_html = send_html; - bonobo_ui_component_set_prop ( - composer->uic, "/commands/FormatHtml", - "state", composer->send_html ? "1" : "0", NULL); - - set_config (composer, "FormatHTML", composer->send_html); + bonobo_ui_component_set_prop (composer->uic, "/commands/FormatHtml", + "state", composer->send_html ? "1" : "0", NULL); } /** @@ -2437,6 +2286,7 @@ e_msg_composer_set_pgp_sign (EMsgComposer *composer, gboolean pgp_sign) "state", composer->pgp_sign ? "1" : "0", NULL); } + /** * e_msg_composer_get_pgp_sign: * @composer: A message composer widget @@ -2499,183 +2349,6 @@ e_msg_composer_get_pgp_encrypt (EMsgComposer *composer) /** - * e_msg_composer_set_view_bcc: - * @composer: A message composer widget - * @state: whether to show or hide the bcc view - * - * Controls the state of the BCC display - */ -void -e_msg_composer_set_view_bcc (EMsgComposer *composer, gboolean view_bcc) -{ - g_return_if_fail (composer != NULL); - g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - - if ((composer->view_bcc && view_bcc) || - (!composer->view_bcc && !view_bcc)) - return; - - composer->view_bcc = view_bcc; - bonobo_ui_component_set_prop ( - composer->uic, "/commands/ViewBCC", - "state", composer->view_bcc ? "1" : "0", NULL); - set_config (composer, "ViewBCC", composer->view_bcc); - e_msg_composer_set_hdrs_visible - (E_MSG_COMPOSER_HDRS (composer->hdrs), - e_msg_composer_get_visible_flags (composer)); - -} - -/** - * e_msg_composer_get_view_bcc: - * @composer: A message composer widget - * - * Get the status of the "View BCC header" flag. - * - * Return value: The status of the "View BCC header" flag. - **/ -gboolean -e_msg_composer_get_view_bcc (EMsgComposer *composer) -{ - g_return_val_if_fail (composer != NULL, FALSE); - g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - - return composer->view_bcc; -} - -/** - * e_msg_composer_set_view_cc: - * @composer: A message composer widget - * @state: whether to show or hide the cc view - * - * Controls the state of the CC display - */ -void -e_msg_composer_set_view_cc (EMsgComposer *composer, gboolean view_cc) -{ - g_return_if_fail (composer != NULL); - g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - - if ((composer->view_cc && view_cc) || - (!composer->view_cc && !view_cc)) - return; - - composer->view_cc = view_cc; - bonobo_ui_component_set_prop ( - composer->uic, "/commands/ViewCC", - "state", composer->view_cc ? "1" : "0", NULL); - set_config (composer, "ViewCC", composer->view_cc); - e_msg_composer_set_hdrs_visible - (E_MSG_COMPOSER_HDRS (composer->hdrs), - e_msg_composer_get_visible_flags (composer)); -} - -/** - * e_msg_composer_get_view_cc: - * @composer: A message composer widget - * - * Get the status of the "View CC header" flag. - * - * Return value: The status of the "View CC header" flag. - **/ -gboolean -e_msg_composer_get_view_cc (EMsgComposer *composer) -{ - g_return_val_if_fail (composer != NULL, FALSE); - g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - - return composer->view_cc; -} - -/** - * e_msg_composer_set_view_from: - * @composer: A message composer widget - * @state: whether to show or hide the From selector - * - * Controls the state of the From selector - */ -void -e_msg_composer_set_view_from (EMsgComposer *composer, gboolean view_from) -{ - g_return_if_fail (composer != NULL); - g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - - if ((composer->view_from && view_from) || - (!composer->view_from && !view_from)) - return; - - composer->view_from = view_from; - bonobo_ui_component_set_prop ( - composer->uic, "/commands/ViewFrom", - "state", composer->view_from ? "1" : "0", NULL); - set_config (composer, "ViewFrom", composer->view_from); - e_msg_composer_set_hdrs_visible - (E_MSG_COMPOSER_HDRS (composer->hdrs), - e_msg_composer_get_visible_flags (composer)); -} - -/** - * e_msg_composer_get_view_from: - * @composer: A message composer widget - * - * Get the status of the "View From header" flag. - * - * Return value: The status of the "View From header" flag. - **/ -gboolean -e_msg_composer_get_view_from (EMsgComposer *composer) -{ - g_return_val_if_fail (composer != NULL, FALSE); - g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - - return composer->view_from; -} - -/** - * e_msg_composer_set_view_from: - * @composer: A message composer widget - * @state: whether to show or hide the From selector - * - * Controls the state of the From selector - */ -void -e_msg_composer_set_view_replyto (EMsgComposer *composer, gboolean view_replyto) -{ - g_return_if_fail (composer != NULL); - g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - - if ((composer->view_replyto && view_replyto) || - (!composer->view_replyto && !view_replyto)) - return; - - composer->view_replyto = view_replyto; - bonobo_ui_component_set_prop ( - composer->uic, "/commands/ViewReplyTo", - "state", composer->view_replyto ? "1" : "0", NULL); - set_config (composer, "ViewReplyTo", composer->view_replyto); - e_msg_composer_set_hdrs_visible - (E_MSG_COMPOSER_HDRS (composer->hdrs), - e_msg_composer_get_visible_flags (composer)); -} - -/** - * e_msg_composer_get_view_replyto: - * @composer: A message composer widget - * - * Get the status of the "View Reply-To header" flag. - * - * Return value: The status of the "View Reply-To header" flag. - **/ -gboolean -e_msg_composer_get_view_replyto (EMsgComposer *composer) -{ - g_return_val_if_fail (composer != NULL, FALSE); - g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); - - return composer->view_replyto; -} - -/** * e_msg_composer_guess_mime_type: * @file_name: filename * diff --git a/configure.in b/configure.in index c8c62ea26d..557eca7050 100644 --- a/configure.in +++ b/configure.in @@ -13,9 +13,20 @@ PACKAGE=evolution AM_INIT_AUTOMAKE($PACKAGE, $VERSION) AC_SUBST(VERSION) +dnl Initialize xml-i18n-tools +AM_PROG_XML_I18N_TOOLS + +dnl Initialize libtool +AM_PROG_LIBTOOL + dnl Initialize maintainer mode AM_MAINTAINER_MODE +AC_CANONICAL_HOST + +AM_ACLOCAL_INCLUDE(macros) +GNOME_INIT(capplet) +GNOME_COMPILE_WARNINGS AC_ISC_POSIX AC_PROG_CC AC_PROG_CPP @@ -27,18 +38,6 @@ AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET -dnl Initialize xml-i18n-tools -AM_PROG_XML_I18N_TOOLS - -dnl Initialize libtool -AM_PROG_LIBTOOL - -AC_CANONICAL_HOST - -AM_ACLOCAL_INCLUDE(macros) -GNOME_INIT(capplet) -GNOME_COMPILE_WARNINGS - AC_PATH_PROG(SENDMAIL, sendmail, /usr/sbin/sendmail, /usr/sbin:/usr/lib) AC_DEFINE_UNQUOTED(SENDMAIL_PATH, "$SENDMAIL") @@ -153,40 +152,19 @@ dnl ************************************************** AC_ARG_ENABLE(ldap, [ --enable-ldap=[no/yes] Enable LDAP support in evolution],,enable_ldap=no) if test x$enable_ldap = xyes; then - LDAP_LIBS= - AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="-lresolv") - AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="-llber $LDAP_LIBS", ,$LDAP_LIBS) + AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="-llber") if test x$ac_cv_lib_lber_ber_get_tag = xyes; then - AC_CHECK_LIB(ldap, ldap_open, LDAP_LIBS="-lldap $LDAP_LIBS", ,$LDAP_LIBS) + AC_CHECK_LIB(ldap, ldap_open, LDAP_LIBS="-lldap $LDAP_LIBS", ,-llber) fi fi - - if test x$ac_cv_lib_ldap_ldap_open = xyes; then -dnl * -dnl * check for openldap version 2.x, since 1.x doesn't have the schema stuff -dnl * - AC_MSG_CHECKING(if openldap is version 2.x) - AC_EGREP_CPP(yes, - [#include "ldap.h" - #if LDAP_VENDOR_VERSION > 20000 - yes - #endif - ], is_2x=yes, is_2x=no) - - if test x$is_2x = xyes; then - AC_MSG_RESULT(yes) AC_DEFINE(HAVE_LDAP) AC_SUBST(LDAP_LIBS) - msg_ldap=yes - else - AC_MSG_ERROR(evolution requires OpenLDAP version >= 2) - fi + msg_ldap=Yes else - msg_ldap=no - enable_ldap=no + msg_ldap=No fi -AM_CONDITIONAL(ENABLE_LDAP, test x$enable_ldap = xyes) +AM_CONDITIONAL(ENABLE_LDAP, test x$ac_cv_lib_ldap_ldap_open = xyes) dnl ************************************************** dnl NNTP support. @@ -195,9 +173,9 @@ AC_ARG_ENABLE(nntp, [ --enable-nntp=[no/yes] Enable NNTP support in evolution],,enable_nntp=no) if test "x$enable_nntp" = "xyes"; then AC_DEFINE(ENABLE_NNTP) - msg_nntp=yes + msg_nntp=Yes else - msg_nntp=no + msg_nntp=No fi AM_CONDITIONAL(ENABLE_NNTP, test x$enable_nntp = xyes) @@ -235,9 +213,9 @@ AC_ARG_ENABLE(dot-locking, [ --enable-dot-locking=[yes/no] Enable support for locking mail files with dot locking],,enable_dot_locking=yes) if test "x$enable_dot_locking" = "xyes"; then AC_DEFINE(USE_DOT) - msg_dot=yes + msg_dot=Yes else - msg_dot=no + msg_dot=No fi AC_ARG_ENABLE(file-locking, @@ -250,7 +228,7 @@ else AC_DEFINE(USE_FLOCK) msg_file=flock else - msg_file=no + msg_file=No fi fi @@ -282,7 +260,7 @@ AC_SUBST(GNOME_PRINT_CFLAGS) dnl ****************************** dnl Check for Bonobo dnl ****************************** -AC_MSG_CHECKING(for Bonobo >= 0.36) +AC_MSG_CHECKING(for Bonobo >= 0.37) if gnome-config --libs bonobox > /dev/null 2>&1; then vers=`gnome-config --modversion bonobo | sed -e "s/bonobo-//" | \ awk 'BEGIN { FS = "."; } { printf "%d", $1 * 1000 + $2;}'` @@ -354,14 +332,14 @@ fi dnl ****************************** dnl Gnome App Lib checking dnl ****************************** -AC_MSG_CHECKING(for Gnome App libraries (GAL) >= 0.5.99.6) +AC_MSG_CHECKING(for Gnome App libraries (GAL) >= 0.5) if gnome-config --libs gal > /dev/null 2>&1; then vers=`gnome-config --modversion gal | sed -e "s/gal-//" -e 's/cvs$//' -e 's/pre$//' | \ awk 'BEGIN { FS = "."; } { print $1 * 1000000 + $2 * 10000 + $3 * 100 + $4;}'` - if test "$vers" -ge 59904; then + if test "$vers" -ge 50000; then AC_MSG_RESULT(found) else - AC_MSG_ERROR(You need at least GNOME Application libs 0.5.99.4 for this version of Evolution) + AC_MSG_ERROR(You need at least GNOME Application libs 0.5 for this version of Evolution) fi else AC_MSG_ERROR(Did not find GnomeAppLib (GAL) installed) @@ -424,6 +402,7 @@ if test x${prefix} = xNONE; then else html_prefix=$prefix fi + AC_MSG_CHECKING(for Editor.idl in `gnome-config --datadir`/gtkhtml or ${html_prefix}/share/gtkhtml) if test -f `gnome-config --datadir`/gtkhtml/Editor.idl; then GTK_HTML_EDITOR_IDL=`gnome-config --datadir`/gtkhtml/Editor.idl @@ -433,8 +412,24 @@ else GTK_HTML_EDITOR_IDL=${html_prefix}/share/gtkhtml/Editor.idl AC_MSG_RESULT(found) else - AC_MSG_ERROR(Editor.idl is required to compile Evolution composer, it's included in GtkHTML + AC_MSG_RESULT(not found) + if test "x$GNOME_PATH" != "x" ; then + for dir in `echo $GNOME_PATH | sed -e "s/:/ /" `; do + AC_MSG_CHECKING(for Editor.idl in ${dir}) + if test -f ${dir}/share/gtkhtml/Editor.idl ; then + GTK_HTML_EDITOR_IDL=${dir}/share/gtkhtml/Editor.idl + AC_MSG_RESULT(found) + break + else + AC_MSG_RESULT(not found) + fi + done + fi + + if test "x$GTK_HTML_EDITOR_IDL" = "x" ; then + AC_MSG_ERROR(Editor.idl is required to compile Evolution composer, it's included in GtkHTML You need GtkHTML build with html-editor-control) + fi fi fi @@ -443,22 +438,17 @@ AC_SUBST(GTK_HTML_EDITOR_IDL) dnl ****************************** dnl Gnome-VFS checking dnl ****************************** -AC_MSG_CHECKING(for GNOME-VFS) +AC_MSG_CHECKING(for GNOME-VFS >= 0.4.2) if gnome-config --libs vfs > /dev/null 2>&1; then - vers=`gnome-config --modversion vfs` - case $vers - in - gnome-vfs-0.[012]) vfs_ok=false ;; - *) vfs_ok=true ;; - esac -else - vfs_ok=false -fi - -if $vfs_ok; then - AC_MSG_RESULT($vers) + vers=`gnome-config --modversion vfs | sed -e "s/gnome-vfs-//" | \ + awk 'BEGIN { FS = "."; } { print $1 * 10000 + $2 * 100 + $3;}'` + if test "$vers" -ge 402; then + AC_MSG_RESULT(found) + else + AC_MSG_ERROR(not found) + fi else - AC_MSG_ERROR(GNOME-VFS 0.3 or newer is required to compile Evolution) + vfs_ok=false fi GNOME_VFS_LIBS="`gnome-config --libs vfs`" @@ -481,9 +471,9 @@ GNOME_PILOT_CHECK fi AM_CONDITIONAL(ENABLE_PILOT_CONDUITS, test "x$enable_pilot_conduits" = "xyes") if test x$enable_pilot_conduits = xyes; then - msg_pilot=yes + msg_pilot=Yes else - msg_pilot=no + msg_pilot=No fi dnl ****** @@ -506,81 +496,75 @@ dnl Kerberos dnl ******** AC_ARG_WITH(krb5, [ --with-krb5=PREFIX Location of Kerberos 5 libs/includes]) AC_ARG_WITH(krb4, [ --with-krb4=PREFIX Location of Kerberos 4 libs/includes]) -msg_krb5=no -if test ${with_krb5:=no} != no; then +msg_krb5=No +if test x${with_krb5:=no} != xno; then + CFLAGS_save="$CFLAGS" LDFLAGS_save="$LDFLAGS" - - mitlibs="-lkrb5 -lk5crypto -lcom_err" - heimlibs="-lkrb5 -lcrypto -lasn1 -lcom_err -lroken" - AC_CACHE_CHECK([for Kerberos 5], ac_cv_lib_kerberos5, + CFLAGS="-I$with_krb5/include/krb5" + LDFLAGS="-L$with_krb5/lib" + AC_CHECK_LIB(krb5, krb5_init_context, [ - LDFLAGS="$LDFLAGS -L$with_krb5/lib $mitlibs" - AC_TRY_LINK_FUNC(krb5_init_context, ac_cv_lib_kerberos5="$mitlibs", - [ - LDFLAGS="$LDFLAGS_save -L$with_krb5/lib $heimlibs" - AC_TRY_LINK_FUNC(krb5_init_context, ac_cv_lib_kerberos5="$heimlibs", ac_cv_lib_kerberos5=no) - ]) - LDFLAGS="$LDFLAGS_save" - ]) - if test "$ac_cv_lib_kerberos5" != no; then AC_DEFINE(HAVE_KRB5) - msg_krb5=yes - KRB5_CFLAGS="-I$with_krb5/include/krb5" - KRB5_LDFLAGS="-L$with_krb5/lib $ac_cv_lib_kerberos5" - fi + KRB5_CFLAGS="$CFLAGS" + KRB5_LDFLAGS="$LDFLAGS -lkrb5 -lk5crypto -lcom_err" + msg_krb5=Yes + ],[ + AC_MSG_WARN([A sample Kerberos 5 program could not be compiled with the +Kerberos found in $with_krb5. Please verify that the prefix is correct.]) + with_krb5=no + ], [-lk5crypto -lcom_err]) + CFLAGS="$CFLAGS_save" + LDFLAGS="$LIBS_save" else AC_MSG_CHECKING(for Kerberos 5) AC_MSG_RESULT($with_krb5) fi -msg_krb4=no +msg_krb4=No if test x${with_krb4:=no} != xno; then + CFLAGS_save="$CFLAGS" LDFLAGS_save="$LDFLAGS" - AC_CACHE_CHECK(for Kerberos 4, ac_cv_lib_kerberos4, + CFLAGS="-I$with_krb4/include/kerberosIV -I$with_krb4/include/kerberos" + test -f "$with_krb4/include/krb.h" && \ + CFLAGS="$CFLAGS -I$with_krb4/include" + test -f "$with_krb4/include/port-sockets.h" && \ + CFLAGS="$CFLAGS -I$with_krb4/include" + + LDFLAGS="-L$with_krb4/lib" + AC_CHECK_LIB(krb, krb_mk_req, [ - ac_cv_lib_kerberos4=no - - case $ac_cv_lib_kerberos5 in - *k5crypto*) - # Look for MIT krb5 compat krb4 - LDFLAGS="$LDFLAGS -L$with_krb4/lib -lkrb4 -ldes425 $KRB5_LDFLAGS" - AC_TRY_LINK_FUNC(krb_mk_req, ac_cv_lib_kerberos4="-lkrb4 -ldes425 $KRB5_LDFLAGS") - ;; - esac - - if test "$ac_cv_lib_kerberos4" = no; then - # Look for KTH krb4 - LDFLAGS="$LDFLAGS_save -L$with_krb4/lib -lkrb -lcrypto -lcom_err -lroken" - AC_TRY_LINK_FUNC(krb_mk_req, ac_cv_lib_kerberos4="-lkrb -lcrypto -lcom_err -lroken") - fi - if test "$ac_cv_lib_kerberos4" = no; then - # Look for old MIT krb4 - LDFLAGS="$LDFLAGS_save -L$with_krb4/lib -lkrb" - AC_TRY_LINK_FUNC(krb_mk_req, ac_cv_lib_kerberos4=-lkrb, + AC_DEFINE(HAVE_KRB4) + KRB4_CFLAGS="$CFLAGS" + KRB4_LDFLAGS="$LDFLAGS -lkrb" + msg_krb4=Yes + ],[ + AC_CHECK_LIB(krb, krb_rd_req, + [ + AC_DEFINE(HAVE_KRB4) + KRB4_CFLAGS="$CFLAGS" + KRB4_LDFLAGS="$LDFLAGS -lkrb -ldes" + msg_krb4=Yes + ],[ + AC_CHECK_LIB(krb4, krb_mk_req, [ - LDFLAGS="$LDFLAGS -ldes" - AC_TRY_LINK_FUNC(krb_mk_req, ac_cv_lib_kerberos4="-lkrb -ldes") - ]) - fi + AC_DEFINE(HAVE_KRB4) + KRB4_CFLAGS="$CFLAGS" + KRB4_LDFLAGS="$LDFLAGS -lkrb4 -ldes425 $KRB5_LDFLAGS" + msg_krb4=Yes + ],[ + AC_MSG_WARN([A sample Kerberos 4 program could not be compiled with the +Kerberos found in $with_krb4. Please verify that the prefix is correct.]) + with_krb4=no + ],[-ldes425 $KRB5_LDFLAGS]) + ],[-ldes]) ]) - LDFLAGS="$LDFLAGS_save" - if test "$ac_cv_lib_kerberos4" != no; then - AC_DEFINE(HAVE_KRB4) - msg_krb4=yes - if test -f "$with_krb4/include/krb.h" -o -f "$with_krb4/include/port-sockets.h"; then - KRB4_CFLAGS="-I$with_krb4/include" - else - KRB4_CFLAGS="-I$with_krb4/include/kerberosIV" - fi - KRB4_LDFLAGS="-L$with_krb4/lib $ac_cv_lib_kerberos4" - - CFLAGS_save="$CFLAGS" - CFLAGS="$CFLAGS $KRB4_CFLAGS" - AC_TRY_COMPILE([#include "krb.h" - int krb_sendauth; - ],[return 0],[AC_DEFINE(NEED_KRB_SENDAUTH_PROTO)],) - CFLAGS="$CFLAGS_save" - fi + + AC_TRY_COMPILE([#include "krb.h" + int krb_sendauth; + ],[return 0],[AC_DEFINE(NEED_KRB_SENDAUTH_PROTO)],) + + CFLAGS="$CFLAGS_save" + LDFLAGS="$LIBS_save" else AC_MSG_CHECKING(for Kerberos 4) AC_MSG_RESULT(${with_krb4}) @@ -592,89 +576,6 @@ AC_SUBST(KRB4_CFLAGS) AC_SUBST(KRB4_LDFLAGS) -dnl ==================================== -dnl = security extension support (SSL and S/MIME) -dnl = -dnl = The following voodoo does detection of mozilla libraries (nspr and nss) needed by -dnl = Camel (SSL) and Evolution (S/MIME). -dnl = -dnl = The Evolution security extensions are only built if these libraries are found -dnl ==================================== -with_nspr_includes=/usr/include -AC_ARG_WITH(nspr-includes, [ --with-nspr-includes=PREFIX Location of Mozilla nspr4 libs.]) -have_nspr_includes="no" -if test "x${with_nspr_includes}" != "xno"; then - CFLAGS_save="$CFLAGS" - - AC_MSG_CHECKING(for Mozilla nspr4 includes in $with_nspr_includes/mozilla) - AC_MSG_RESULT("") - CFLAGS="$CFLAGS -I$with_nspr_includes" - AC_CHECK_HEADERS(mozilla/prinit.h mozilla/prio.h, [ moz_nspr_includes="yes" ]) - CFLAGS="$CFLAGS_save" - - if test "x{$moz_nspr_includes}" != "xno"; then - have_nspr_includes="yes" - NSPR_CFLAGS="-I$with_nspr_includes" - fi -else - AC_MSG_CHECKING(for Mozilla nspr4 includes) - AC_MSG_RESULT(no) -fi - -with_nspr_libs=/usr/lib/mozilla -AC_ARG_WITH(nspr-libs, [ --with-nspr-libs=PREFIX Location of Mozilla nspr4 libs.]) -have_nspr_libs="no" -if test "x${with_nspr_libs}" != "xno" -a "x${have_nspr_includes}" != "xno"; then - CFLAGS_save="$CFLAGS" - LDFLAGS_save="$LDFLAGS" - - nsprlibs="-lnspr4" - AC_CACHE_CHECK([for Mozilla nspr libraries], moz_nspr_libs, - [ - CFLAGS="$CFLAGS $NSPR_CFLAGS" - LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs" - AC_TRY_LINK_FUNC(PR_Init, moz_nspr_libs="yes", moz_nspr_libs="no") - CFLAGS="$CFLAGS_save" - LDFLAGS="$LDFLAGS_save" - ]) - if test "x$moz_nspr_libs" != "xno"; then - have_nspr_libs="yes" - NSPR_LDFLAGS="-L$with_nspr_libs $nsprlibs" - fi -else - AC_MSG_CHECKING(for Mozilla nspr4 libraries) - AC_MSG_RESULT(no) -fi - -AC_ARG_WITH(nss, [ --with-nss=PREFIX Location of Mozilla nss3 libs/includes.]) -msg_nss="no" -if test "x${with_nss}" != "xno" -a "x${have_nspr_libs}" != "xno"; then - LDFLAGS_save="$LDFLAGS" - - nsprlibs="-lnspr4" - nsslibs="-lnss3 -lnssckbi -lssl3 -lsmime3" - AC_CACHE_CHECK([for Mozilla nss libraries], moz_nss_libs, - [ - LDFLAGS="$LDFLAGS -L$with_nss/lib $nsslibs" - AC_TRY_LINK_FUNC(NSS_Init, moz_nss_libs="yes", moz_nss_libs="no") - LDFLAGS="$LDFLAGS_save" - ]) - if test "$moz_nss_libs" != no; then - AC_DEFINE(HAVE_NSS) - msg_nss="yes" - NSS_CFLAGS="-I$with_nss/include" - NSS_LDFLAGS="-L$with_nss/lib $nsslibs" - fi -else - AC_MSG_CHECKING(for Mozilla nss libraries) - AC_MSG_RESULT(no) -fi - -dnl ==================================== -dnl = End mozilla hacks -dnl ==================================== - - dnl ****************************** dnl gtk-doc dnl ****************************** @@ -763,7 +664,6 @@ e-util/ename/Makefile libibex/Makefile executive-summary/Makefile executive-summary/evolution-services/Makefile -executive-summary/widgets/Makefile executive-summary/idl/Makefile executive-summary/component/Makefile executive-summary/test-service/Makefile @@ -772,14 +672,10 @@ camel/providers/Makefile camel/providers/pop3/Makefile camel/providers/sendmail/Makefile camel/providers/smtp/Makefile +camel/providers/vee/Makefile camel/providers/imap/Makefile camel/providers/nntp/Makefile camel/providers/local/Makefile -camel/tests/Makefile -camel/tests/lib/Makefile -camel/tests/message/Makefile -camel/tests/folder/Makefile -camel/tests/stream/Makefile composer/Makefile widgets/Makefile widgets/meeting-time-sel/Makefile @@ -801,7 +697,6 @@ addressbook/gui/component/select-names/Makefile shell/Makefile shell/glade/Makefile shell/importer/Makefile -mail/importers/Makefile mail/Makefile data/Makefile libversit/Makefile @@ -812,7 +707,6 @@ calendar/cal-util/Makefile calendar/cal-client/Makefile calendar/pcs/Makefile calendar/gui/Makefile -calendar/gui/alarm-notify/Makefile calendar/gui/dialogs/Makefile calendar/conduits/Makefile calendar/conduits/calendar/Makefile @@ -833,10 +727,6 @@ default_user/local/Outbox/Makefile default_user/local/Sent/Makefile default_user/local/Tasks/Makefile default_user/local/Trash/Makefile -views/Makefile -views/addressbook/Makefile -views/mail/Makefile -views/tasks/Makefile tools/Makefile doc/Makefile doc/C/Makefile @@ -845,6 +735,7 @@ doc/devel/calendar/Makefile doc/devel/calendar/cal-client/Makefile doc/devel/calendar/cal-util/Makefile doc/devel/importer/Makefile +doc/devel/executive-summary/Makefile ]) if test "x$with_sub_version" != "x"; then @@ -861,7 +752,6 @@ echo " NNTP support: $msg_nntp Pilot conduits: $msg_pilot Kerberos 4/5: $msg_krb4/$msg_krb5 - SSL support: $msg_nss Use movemail: $with_movemail Dot Locking: $msg_dot File Locking: $msg_file diff --git a/doc/C/Makefile.am b/doc/C/Makefile.am index 15f1e047b6..8bef9261e0 100644 --- a/doc/C/Makefile.am +++ b/doc/C/Makefile.am @@ -23,7 +23,7 @@ EXTRA_DIST = \ all: evolution-guide evolution-guide: $(SGML_FILES) - -db2html evolution-guide.sgml + cd $(srcdir) && db2html evolution-guide.sgml dist-hook: mkdir $(distdir)/evolution-guide diff --git a/doc/ChangeLog b/doc/ChangeLog index 407bbbdde6..3a8fcb257a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,57 +1,8 @@ -2001-02-23 Aaron Weber <aaron@helixcode.com> +2001-02-15 Ettore Perazzoli <ettore@ximian.com> - * C/usage-mail.sgml: IMAP subscriptions stuff. + * C/Makefile.am (evolution-guide): Use `$<' instead of hardcoded + `evolution-guide.sgml'. -2001-02-21 Aaron Weber <aaron@helixcode.com> - - * C/usage-mail.sgml: Advanced search/show all/save search stuff. - - * C/evolution.sgml: This file replaces evolution-guide.sgml, for Nautilus Readiness. - - * C/apx-gloss.sgml: glossterm conduit. - - * C/config-sync.sgml: Glossterm conduit. - - * C/preface.sgml: Checked over for Keyboard-Shortcut and other truthfulness. - -2001-02-15 Aaron Weber <aaron@helixcode.com> - - * C/evolution-guide.sgml: Validated. Verified. Markup fixed in - several individual files. - - * C/apx-gpl.sgml: cvs-removed for GNOME 1.4 compliance. - - * C/apx-fdl.sgml: cvs-removed for GNOME 1.4 compliance. - -2001-02-09 Aaron Weber <aaron@helixcode.com> - - * C/config-sync.sgml: Overhaul. Now accurate and truthful and clear. - - * C/usage-calendar.sgml: Minor Changes. - -2001-02-08 Aaron Weber <aaron@helixcode.com> - - * C/usage-contact.sgml: Minor Changes. - - * C/usage-mail.sgml: Minor Changes. - -2001-02-07 Aaron Weber <aaron@helixcode.com> - - * C/menuref.sgml: Added section, but left blank til UI stabilizes. - - * C/usage-exec-summary.sgml: A little functionality described. - - * C/usage-mainwindow.sgml: Added tasks and Exec-summary. - - * C/usage-calendar.sgml: Describe semi-autonomy of task pad. - -2001-02-06 Aaron Weber <aaron@ximian.com> - - * C/usage-contact.sgml: s/contact manager/address book/ and - revised text. - - * C/usage-exec-summary.sgml: New file. Describes Executive Summary. - 2001-01-19 Aaron Weber <aaron@helixcode.com> * C/usage-mail.sgml: More of Megan's revisions, and Field Chooser diff --git a/doc/devel/ChangeLog b/doc/devel/ChangeLog index d00a1df434..d12c496648 100644 --- a/doc/devel/ChangeLog +++ b/doc/devel/ChangeLog @@ -1,3 +1,12 @@ +2001-03-13 Ettore Perazzoli <ettore@ximian.com> + + * calendar/cal-client/Makefile.am (install-data-local): Use + `$(srcdir)' properly so it works when it's different from the + `$(builddir)'. + * calendar/cal-util/Makefile.am (install-data-local): Likewise. + * importer/Makefile.am (install-data-local): Likewise. + * executive-summary/Makefile.am (install-data-local): Likewise. + 2001-01-26 John R. Sheets <dusk@ravendusk.org> * importer/Makefile.am: Change (nonexistant) importer.sgml diff --git a/doc/devel/calendar/cal-client/Makefile.am b/doc/devel/calendar/cal-client/Makefile.am index f3a2b39ec6..23a05e6a43 100644 --- a/doc/devel/calendar/cal-client/Makefile.am +++ b/doc/devel/calendar/cal-client/Makefile.am @@ -117,8 +117,8 @@ maintainer-clean-local: clean install-data-local: $(mkinstalldirs) $(DOC_DIR) - for i in $(DOC_DIR_INSTALL_FILES); do \ - $(INSTALL_DATA) $$i $(DOC_DIR); \ + for i in $(DOC_DIR_INSTALL_FILES); do \ + $(INSTALL_DATA) $(srcdir)/$$i $(DOC_DIR); \ done dist-hook: diff --git a/doc/devel/calendar/cal-util/Makefile.am b/doc/devel/calendar/cal-util/Makefile.am index 7f567652ef..e6ef51c02c 100644 --- a/doc/devel/calendar/cal-util/Makefile.am +++ b/doc/devel/calendar/cal-util/Makefile.am @@ -128,8 +128,8 @@ maintainer-clean-local: clean install-data-local: $(mkinstalldirs) $(DOC_DIR) - for i in $(DOC_DIR_INSTALL_FILES); do \ - $(INSTALL_DATA) $$i $(DOC_DIR); \ + for i in $(DOC_DIR_INSTALL_FILES); do \ + $(INSTALL_DATA) $(srcdir)/$$i $(DOC_DIR); \ done dist-hook: diff --git a/doc/devel/executive-summary/Makefile.am b/doc/devel/executive-summary/Makefile.am index 9aa53af4ec..50246b4abb 100644 --- a/doc/devel/executive-summary/Makefile.am +++ b/doc/devel/executive-summary/Makefile.am @@ -27,22 +27,22 @@ DOC_DIR_INSTALL_FILES = \ evolution-services-decl.txt \ evolution-services-sections.txt -SOURCE_FILES = \ - $(top_srcdir)/executive-summary/evolution-services/executive-summary-component.c \ - $(top_srcdir)/executive-summary/evolution-services/executive-summary-component-factory-client.c \ +SOURCE_FILES = \ + $(top_srcdir)/executive-summary/evolution-services/executive-summary-component.c \ + $(top_srcdir)/executive-summary/evolution-services/executive-summary-component-factory-client.c \ $(top_srcdir)/executive-summary/evolution-services/executive-summary-html-view.c IGNORED_HEADER_FILES = \ Executive-Summary.h - -scan_generated = \ + +scan_generated = \ evolution-services-decl.txt \ evolution-services.args \ evolution-services.hierarchy \ evolution-services.signals \ evolution-services.types -tmpl_dependencies = \ +tmpl_dependencies = \ evolution-services-decl.txt \ evolution-services-sections.txt \ evolution-services.args \ @@ -112,7 +112,7 @@ maintainer-clean-local: clean install-data-local: $(mkinstalldirs) $(DOC_DIR) for i in $(DOC_DIR_INSTALL_FILES); do \ - $(INSTALL_DATA) $$i $(DOC_DIR); \ + $(INSTALL_DATA) $(srcdir)/$$i $(DOC_DIR); \ done dist-hook: diff --git a/doc/devel/importer/Makefile.am b/doc/devel/importer/Makefile.am index ef3b2b98ee..52c9ed598b 100644 --- a/doc/devel/importer/Makefile.am +++ b/doc/devel/importer/Makefile.am @@ -113,8 +113,8 @@ maintainer-clean-local: clean install-data-local: $(mkinstalldirs) $(DOC_DIR) - for i in $(DOC_DIR_INSTALL_FILES); do \ - $(INSTALL_DATA) $$i $(DOC_DIR); \ + for i in $(DOC_DIR_INSTALL_FILES); do \ + $(INSTALL_DATA) $(srcdir)/$$i $(DOC_DIR); \ done dist-hook: diff --git a/e-util/ChangeLog b/e-util/ChangeLog index ee35caf134..4555ffa682 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,42 +1,10 @@ -2001-03-12 JP Rosevear <jpr@ximian.com> +2001-02-28 JP Rosevear <jpr@ximian.com> - * Makefile.am: update cflag macros - -2001-03-07 Dan Winship <danw@ximian.com> - - * e-html-utils.c (url_extract): Fix an off-by-one in the "is this - for real?" check so that "http:// " won't get URLified - -2001-03-04 Damon Chaplin <damon@ximian.com> - - * e-time-utils.[hc]: new files to contain functions to parse and - format dates and times for various calendar widgets. - -2001-03-01 Dan Winship <danw@ximian.com> - - * e-path.c (e_path_to_physical): New function to turn foo/bar into - foo/subfolders/bar. The inverse function doesn't exist yet because - I didn't need it. Also, if the shell were going to use this, we'd - need a few more tools... - - * Makefile.am (libeutil_la_SOURCES): Add e-path.[ch] - -2001-03-01 Not Zed <NotZed@Ximian.com> - - * e-sexp.c (e_sexp_encode_string): Make it handle a NULL string as - an empty string. - -2001-02-23 Not Zed <NotZed@Ximian.com> - - * e-msgport.c (e_thread_destroy): Wait a lot lot longer for - threads to finish. - : Turned off some of the debug. - -2001-02-08 Not Zed <NotZed@Ximian.com> + * Makefile.am (EXTRA_DIST): can't fix conditionally + +2001-02-28 JP Rosevear <jpr@ximian.com> - * e-memory.c (EMemChunk): Changed to allocate raw blocks for the - data, and keep track of them with an array, this is so the native - malloc alignment is not lost at the allocation stage. + * Makefile.am (EXTRA_DIST): make sure all the files get disted 2001-01-30 Not Zed <NotZed@Ximian.com> diff --git a/e-util/Makefile.am b/e-util/Makefile.am index 2efec61ca3..30484d5408 100644 --- a/e-util/Makefile.am +++ b/e-util/Makefile.am @@ -7,7 +7,7 @@ INCLUDES = \ $(GNOME_INCLUDEDIR) \ $(EXTRA_GNOME_CFLAGS) \ $(UNICODE_CFLAGS) \ - $(PISOCK_CFLAGS) \ + $(PISOCK_INCLUDEDIR) \ -DEVOLUTION_IMAGES=\""$(imagesdir)"\" \ -DG_LOG_DOMAIN=\"e-utils\" @@ -35,12 +35,8 @@ libeutil_la_SOURCES = \ e-memory.h \ e-msgport.c \ e-msgport.h \ - e-path.c \ - e-path.h \ e-sexp.c \ e-sexp.h \ - e-time-utils.c \ - e-time-utils.h \ e-dbhash.c \ e-dbhash.h \ md5-utils.c \ @@ -65,5 +61,5 @@ libeconduit_la_SOURCES = \ libeconduit_static_la_SOURCES = $(libeconduit_la_SOURCES) libeconduit_static_la_LDFLAGS = --all-static - +EXTRA_DIST = e-pilot-util.c e-pilot-util.h diff --git a/e-util/e-i18n.h b/e-util/e-i18n.h deleted file mode 100644 index 58d3420be3..0000000000 --- a/e-util/e-i18n.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copied from gnome-i18nP.h, because this header is typically not installed - * - * This file has to be included before any file from the GNOME libraries - * to have this override the definitions that are pulled from the gnome-i18n.h - * - * the difference is that gnome-i18n.h is used for applications, and this is - * used by libraries (because libraries have to use dcgettext instead of - * gettext and they need to provide the translation domain, unlike apps). - * - * So you can just put this after you include config.h - */ - -#ifndef __E_I18N_H__ -#define __E_I18N_H__ - -#include <glib.h> -#include "libgnome/gnome-defs.h" - -BEGIN_GNOME_DECLS - -#ifdef ENABLE_NLS -# include <libintl.h> -# undef _ -# define _(String) dgettext (PACKAGE, String) -# ifdef gettext_noop -# define N_(String) gettext_noop (String) -# else -# define N_(String) (String) -# endif -#else -/* Stubs that do something close enough. */ -# define textdomain(String) (String) -# define gettext(String) (String) -# define dgettext(Domain,Message) (Message) -# define dcgettext(Domain,Message,Type) (Message) -# define bindtextdomain(Domain,Directory) (Domain) -# define _(String) (String) -# define N_(String) (String) -#endif - -/* - * Do not remove the following define, nor do surround it with ifdefs. - * - * If you get any `redefined' errors, it means that you are including - * -incorrectly- a header file provided by gnome-libs before this file. - * To correctly solve this issue include this file before any libgnome/ - * libgnomeui headers - */ - -#define __GNOME_I18N_H__ 1 - - -/* This is copied staight out of the prototypes for gnome-i18n.h */ -const char *gnome_i18n_get_language(void); -GList *gnome_i18n_get_language_list (const gchar *category_name); -void gnome_i18n_set_preferred_language (const char *val); -const char *gnome_i18n_get_preferred_language (void); -void gnome_i18n_init (void); - -END_GNOME_DECLS - -#endif /* __E_I18N_H__ */ diff --git a/e-util/e-text-event-processor-emacs-like.c b/e-util/e-text-event-processor-emacs-like.c deleted file mode 100644 index c369177f6a..0000000000 --- a/e-util/e-text-event-processor-emacs-like.c +++ /dev/null @@ -1,497 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gnome.h> -#include "e-text-event-processor-emacs-like.h" - -static void e_text_event_processor_emacs_like_init (ETextEventProcessorEmacsLike *card); -static void e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass); -static gint e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event); - -static ETextEventProcessorClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0 -}; - -static const ETextEventProcessorCommand control_keys[26] = -{ - { E_TEP_START_OF_LINE, E_TEP_MOVE, 0, "" }, /* a */ - { E_TEP_BACKWARD_CHARACTER, E_TEP_MOVE, 0, "" }, /* b */ - { E_TEP_SELECTION, E_TEP_COPY, 0, "" }, /* c */ - { E_TEP_FORWARD_CHARACTER, E_TEP_DELETE, 0, "" }, /* d */ - { E_TEP_END_OF_LINE, E_TEP_MOVE, 0, "" }, /* e */ - { E_TEP_FORWARD_CHARACTER, E_TEP_MOVE, 0, "" }, /* f */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* g */ - { E_TEP_BACKWARD_CHARACTER, E_TEP_DELETE, 0, "" }, /* h */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* i */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* j */ - { E_TEP_END_OF_LINE, E_TEP_DELETE, 0, "" }, /* k */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* l */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* m */ - { E_TEP_FORWARD_LINE, E_TEP_MOVE, 0, "" }, /* n */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* o */ - { E_TEP_BACKWARD_LINE, E_TEP_MOVE, 0, "" }, /* p */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* q */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* r */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* s */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* t */ - { E_TEP_START_OF_LINE, E_TEP_DELETE, 0, "" }, /* u */ - { E_TEP_SELECTION, E_TEP_PASTE, 0, "" }, /* v */ - { E_TEP_SELECTION, E_TEP_DELETE, 0, "" }, /* w */ - { E_TEP_SELECTION, E_TEP_DELETE, 0, "" }, /* x */ - { E_TEP_SELECTION, E_TEP_PASTE, 0, "" }, /* y */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" } /* z */ -}; - -static const ETextEventProcessorCommand alt_keys[26] = -{ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* a */ - { E_TEP_BACKWARD_WORD, E_TEP_MOVE, 0, "" }, /* b */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* c */ - { E_TEP_FORWARD_WORD, E_TEP_DELETE, 0, "" }, /* d */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* e */ - { E_TEP_FORWARD_WORD, E_TEP_MOVE, 0, "" }, /* f */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* g */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* h */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* i */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* j */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* k */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* l */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* m */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* n */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* o */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* p */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* q */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* r */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* s */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* t */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* u */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* v */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* w */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* x */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* y */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" } /* z */ - -}; - -GtkType -e_text_event_processor_emacs_like_get_type (void) -{ - static GtkType text_event_processor_emacs_like_type = 0; - - if (!text_event_processor_emacs_like_type) - { - static const GtkTypeInfo text_event_processor_emacs_like_info = - { - "ETextEventProcessorEmacsLike", - sizeof (ETextEventProcessorEmacsLike), - sizeof (ETextEventProcessorEmacsLikeClass), - (GtkClassInitFunc) e_text_event_processor_emacs_like_class_init, - (GtkObjectInitFunc) e_text_event_processor_emacs_like_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - text_event_processor_emacs_like_type = gtk_type_unique (e_text_event_processor_get_type (), &text_event_processor_emacs_like_info); - } - - return text_event_processor_emacs_like_type; -} - -static void -e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass) -{ - GtkObjectClass *object_class; - ETextEventProcessorClass *processor_class; - - object_class = (GtkObjectClass*) klass; - processor_class = (ETextEventProcessorClass*) klass; - - parent_class = gtk_type_class (e_text_event_processor_get_type ()); - - processor_class->event = e_text_event_processor_emacs_like_event; -} - -static void -e_text_event_processor_emacs_like_init (ETextEventProcessorEmacsLike *tep) -{ -} - -static gint -e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event) -{ - ETextEventProcessorCommand command; - ETextEventProcessorEmacsLike *tep_el = E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(tep); - command.action = E_TEP_NOP; - switch (event->type) { - case GDK_BUTTON_PRESS: - if (event->button.button == 1) { - command.action = E_TEP_GRAB; - command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - if (event->button.state & GDK_SHIFT_MASK) - command.action = E_TEP_SELECT; - else - command.action = E_TEP_MOVE; - command.position = E_TEP_VALUE; - command.value = event->button.position; - command.time = event->button.time; - tep_el->mouse_down = TRUE; - } - break; - case GDK_2BUTTON_PRESS: - if (event->button.button == 1) { - command.action = E_TEP_SELECT; - command.position = E_TEP_SELECT_WORD; - command.time = event->button.time; - } - break; - case GDK_3BUTTON_PRESS: - if (event->button.button == 1) { - command.action = E_TEP_SELECT; - command.position = E_TEP_SELECT_ALL; - command.time = event->button.time; - } - break; - case GDK_BUTTON_RELEASE: - if (event->button.button == 1) { - command.action = E_TEP_UNGRAB; - command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - command.time = event->button.time; - tep_el->mouse_down = FALSE; - command.action = E_TEP_NOP; - } else if (event->button.button == 2) { - command.action = E_TEP_MOVE; - command.position = E_TEP_VALUE; - command.value = event->button.position; - command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - - command.action = E_TEP_GET_SELECTION; - command.position = E_TEP_SELECTION; - command.value = 0; - command.time = event->button.time; - } - break; - case GDK_MOTION_NOTIFY: - if (tep_el->mouse_down) { - command.action = E_TEP_SELECT; - command.position = E_TEP_VALUE; - command.time = event->motion.time; - command.value = event->motion.position; - } - break; - case GDK_KEY_PRESS: - { - ETextEventProcessorEventKey key = event->key; - command.time = event->key.time; - if (key.state & GDK_SHIFT_MASK) - command.action = E_TEP_SELECT; - else - command.action = E_TEP_MOVE; - switch(key.keyval) { - case GDK_Home: - case GDK_KP_Home: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_START_OF_BUFFER; - else - command.position = E_TEP_START_OF_LINE; - break; - case GDK_End: - case GDK_KP_End: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_END_OF_BUFFER; - else - command.position = E_TEP_END_OF_LINE; - break; - case GDK_Page_Up: - case GDK_KP_Page_Up: command.position = E_TEP_BACKWARD_PAGE; break; - - case GDK_Page_Down: - case GDK_KP_Page_Down: command.position = E_TEP_FORWARD_PAGE; break; - /* CUA has Ctrl-Up/Ctrl-Down as paragraph up down */ - case GDK_Up: - case GDK_KP_Up: command.position = E_TEP_BACKWARD_LINE; break; - - case GDK_Down: - case GDK_KP_Down: command.position = E_TEP_FORWARD_LINE; break; - - case GDK_Left: - case GDK_KP_Left: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_BACKWARD_WORD; - else - command.position = E_TEP_BACKWARD_CHARACTER; - break; - case GDK_Right: - case GDK_KP_Right: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_FORWARD_WORD; - else - command.position = E_TEP_FORWARD_CHARACTER; - break; - - case GDK_BackSpace: - command.action = E_TEP_DELETE; - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_BACKWARD_WORD; - else - command.position = E_TEP_BACKWARD_CHARACTER; - break; - case GDK_Clear: - command.action = E_TEP_DELETE; - command.position = E_TEP_END_OF_LINE; - break; - case GDK_Insert: - case GDK_KP_Insert: - if (key.state & GDK_SHIFT_MASK) { - command.action = E_TEP_PASTE; - command.position = E_TEP_SELECTION; - } else if (key.state & GDK_CONTROL_MASK) { - command.action = E_TEP_COPY; - command.position = E_TEP_SELECTION; - } else { - /* gtk_toggle_insert(text) -- IMPLEMENT -- FIXME */ - } - break; - case GDK_Delete: - case GDK_KP_Delete: - if (key.state & GDK_CONTROL_MASK){ - command.action = E_TEP_DELETE; - command.position = E_TEP_FORWARD_WORD; - } else if (key.state & GDK_SHIFT_MASK) { - command.action = E_TEP_COPY; - command.position = E_TEP_SELECTION; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - - command.action = E_TEP_DELETE; - command.position = E_TEP_SELECTION; - } else { - command.action = E_TEP_DELETE; - command.position = E_TEP_FORWARD_CHARACTER; - } - break; - case GDK_Tab: - case GDK_KP_Tab: - case GDK_ISO_Left_Tab: - case GDK_3270_BackTab: - /* Don't insert literally */ - command.action = E_TEP_NOP; - command.position = E_TEP_SELECTION; - break; - case GDK_Return: - case GDK_KP_Enter: - if (tep->allow_newlines) { - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "\n"; - } else { - command.action = E_TEP_ACTIVATE; - command.position = E_TEP_SELECTION; - } - break; - case GDK_Escape: - /* Don't insert literally */ - command.action = E_TEP_NOP; - command.position = E_TEP_SELECTION; - break; - - case GDK_KP_Space: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = " "; - break; - case GDK_KP_Equal: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "="; - break; - case GDK_KP_Multiply: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "*"; - break; - case GDK_KP_Add: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "+"; - break; - case GDK_KP_Subtract: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "-"; - break; - case GDK_KP_Decimal: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "."; - break; - case GDK_KP_Divide: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "/"; - break; - case GDK_KP_0: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "0"; - break; - case GDK_KP_1: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "1"; - break; - case GDK_KP_2: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "2"; - break; - case GDK_KP_3: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "3"; - break; - case GDK_KP_4: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "4"; - break; - case GDK_KP_5: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "5"; - break; - case GDK_KP_6: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "6"; - break; - case GDK_KP_7: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "7"; - break; - case GDK_KP_8: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "8"; - break; - case GDK_KP_9: - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "9"; - break; - - default: - if (key.state & GDK_CONTROL_MASK) { - if ((key.keyval >= 'A') && (key.keyval <= 'Z')) - key.keyval -= 'A' - 'a'; - - if ((key.keyval >= 'a') && (key.keyval <= 'z')) { - command.position = control_keys[(int) (key.keyval - 'a')].position; - if (control_keys[(int) (key.keyval - 'a')].action != E_TEP_MOVE) - command.action = control_keys[(int) (key.keyval - 'a')].action; - command.value = control_keys[(int) (key.keyval - 'a')].value; - command.string = control_keys[(int) (key.keyval - 'a')].string; - } - - if (key.keyval == 'x' || key.keyval == 'w') { - command.action = E_TEP_COPY; - command.position = E_TEP_SELECTION; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - - command.action = E_TEP_DELETE; - command.position = E_TEP_SELECTION; - } - - break; - } else if (key.state & GDK_MOD1_MASK) { - if ((key.keyval >= 'A') && (key.keyval <= 'Z')) - key.keyval -= 'A' - 'a'; - - if ((key.keyval >= 'a') && (key.keyval <= 'z')) { - command.position = alt_keys[(int) (key.keyval - 'a')].position; - if (alt_keys[(int) (key.keyval - 'a')].action != E_TEP_MOVE) - command.action = alt_keys[(int) (key.keyval - 'a')].action; - command.value = alt_keys[(int) (key.keyval - 'a')].value; - command.string = alt_keys[(int) (key.keyval - 'a')].string; - } - } else if (key.length > 0) { - if (key.keyval >= GDK_KP_0 && key.keyval <= GDK_KP_9) { - key.keyval = '0'; - key.string = "0"; - } - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = strlen(key.string); - command.string = key.string; - - } else { - command.action = E_TEP_NOP; - } - } - break; - case GDK_KEY_RELEASE: - command.time = event->key.time; - command.action = E_TEP_NOP; - break; - default: - command.action = E_TEP_NOP; - break; - } - } - if (command.action != E_TEP_NOP) { - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - return 1; - } - else - return 0; -} - -ETextEventProcessor * -e_text_event_processor_emacs_like_new (void) -{ - ETextEventProcessorEmacsLike *retval = gtk_type_new (e_text_event_processor_emacs_like_get_type ()); - return E_TEXT_EVENT_PROCESSOR (retval); -} - diff --git a/e-util/e-text-event-processor-emacs-like.h b/e-util/e-text-event-processor-emacs-like.h deleted file mode 100644 index dbc909e2c7..0000000000 --- a/e-util/e-text-event-processor-emacs-like.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor-emacs-like.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ -#define __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ - -#include <gnome.h> -#include <gal/util/e-text-event-processor.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ETextEventProcessorEmacsLike - Turns events on a text widget into commands. Uses an emacs-ish interface. - * - */ - -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE (e_text_event_processor_emacs_like_get_type ()) -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (GTK_CHECK_CAST ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLike)) -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLikeClass)) -#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (GTK_CHECK_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE)) -#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE)) - - -typedef struct _ETextEventProcessorEmacsLike ETextEventProcessorEmacsLike; -typedef struct _ETextEventProcessorEmacsLikeClass ETextEventProcessorEmacsLikeClass; - -struct _ETextEventProcessorEmacsLike -{ - ETextEventProcessor parent; - - /* object specific fields */ - guint mouse_down : 1; -}; - -struct _ETextEventProcessorEmacsLikeClass -{ - ETextEventProcessorClass parent_class; -}; - - -GtkType e_text_event_processor_emacs_like_get_type (void); -ETextEventProcessor *e_text_event_processor_emacs_like_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ */ diff --git a/e-util/e-text-event-processor-types.h b/e-util/e-text-event-processor-types.h deleted file mode 100644 index 1e012cdf1a..0000000000 --- a/e-util/e-text-event-processor-types.h +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __E_TEXT_EVENT_PROCESSOR_TYPES_H__ -#define __E_TEXT_EVENT_PROCESSOR_TYPES_H__ - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include <gdk/gdktypes.h> - -typedef union _ETextEventProcessorEvent ETextEventProcessorEvent; - -typedef enum { - E_TEP_VALUE, - E_TEP_SELECTION, - - E_TEP_START_OF_BUFFER, - E_TEP_END_OF_BUFFER, - - E_TEP_START_OF_LINE, - E_TEP_END_OF_LINE, - - E_TEP_FORWARD_CHARACTER, - E_TEP_BACKWARD_CHARACTER, - - E_TEP_FORWARD_WORD, - E_TEP_BACKWARD_WORD, - - E_TEP_FORWARD_LINE, - E_TEP_BACKWARD_LINE, - - E_TEP_FORWARD_PARAGRAPH, - E_TEP_BACKWARD_PARAGRAPH, - - E_TEP_FORWARD_PAGE, - E_TEP_BACKWARD_PAGE, - - E_TEP_SELECT_WORD, - E_TEP_SELECT_ALL - -} ETextEventProcessorCommandPosition; - -typedef enum { - E_TEP_MOVE, - E_TEP_SELECT, - E_TEP_DELETE, - E_TEP_INSERT, - - E_TEP_COPY, - E_TEP_PASTE, - E_TEP_GET_SELECTION, - E_TEP_SET_SELECT_BY_WORD, - E_TEP_ACTIVATE, - - E_TEP_GRAB, - E_TEP_UNGRAB, - - E_TEP_NOP -} ETextEventProcessorCommandAction; - -typedef struct { - ETextEventProcessorCommandPosition position; - ETextEventProcessorCommandAction action; - int value; - char *string; - guint32 time; -} ETextEventProcessorCommand; - -typedef struct { - GdkEventType type; - guint32 time; - guint state; - guint button; - gint position; -} ETextEventProcessorEventButton; - -typedef struct { - GdkEventType type; - guint32 time; - guint state; - guint keyval; - gint length; - gchar *string; -} ETextEventProcessorEventKey; - -typedef struct { - GdkEventType type; - guint32 time; - guint state; - gint position; -} ETextEventProcessorEventMotion; - -union _ETextEventProcessorEvent { - GdkEventType type; - ETextEventProcessorEventButton button; - ETextEventProcessorEventKey key; - ETextEventProcessorEventMotion motion; -}; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TEXT_EVENT_PROCESSOR_TYPES_H__ */ diff --git a/e-util/e-text-event-processor.c b/e-util/e-text-event-processor.c deleted file mode 100644 index 772ae5c12b..0000000000 --- a/e-util/e-text-event-processor.c +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gnome.h> -#include "e-text-event-processor.h" - -static void e_text_event_processor_init (ETextEventProcessor *card); -static void e_text_event_processor_class_init (ETextEventProcessorClass *klass); - -static void e_text_event_processor_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_text_event_processor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static GtkObjectClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_ALLOW_NEWLINES, -}; - -enum { - E_TEP_EVENT, - E_TEP_LAST_SIGNAL -}; - -static guint e_tep_signals[E_TEP_LAST_SIGNAL] = { 0 }; - -GtkType -e_text_event_processor_get_type (void) -{ - static GtkType text_event_processor_type = 0; - - if (!text_event_processor_type) - { - static const GtkTypeInfo text_event_processor_info = - { - "ETextEventProcessor", - sizeof (ETextEventProcessor), - sizeof (ETextEventProcessorClass), - (GtkClassInitFunc) e_text_event_processor_class_init, - (GtkObjectInitFunc) e_text_event_processor_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - text_event_processor_type = gtk_type_unique (gtk_object_get_type (), &text_event_processor_info); - } - - return text_event_processor_type; -} - -static void -e_text_event_processor_class_init (ETextEventProcessorClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - e_tep_signals[E_TEP_EVENT] = - gtk_signal_new ("command", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextEventProcessorClass, command), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, e_tep_signals, E_TEP_LAST_SIGNAL); - - gtk_object_add_arg_type ("ETextEventProcessor::allow_newlines", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_ALLOW_NEWLINES); - - klass->event = NULL; - klass->command = NULL; - - object_class->set_arg = e_text_event_processor_set_arg; - object_class->get_arg = e_text_event_processor_get_arg; -} - -static void -e_text_event_processor_init (ETextEventProcessor *tep) -{ - tep->allow_newlines = TRUE; -} - -gint -e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event) -{ - if (E_TEXT_EVENT_PROCESSOR_CLASS(GTK_OBJECT(tep)->klass)->event) { - return E_TEXT_EVENT_PROCESSOR_CLASS(GTK_OBJECT(tep)->klass)->event(tep, event); - } else { - return 0; - } -} - -/* Set_arg handler for the text item */ -static void -e_text_event_processor_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETextEventProcessor *tep = E_TEXT_EVENT_PROCESSOR (object); - - switch (arg_id) { - case ARG_ALLOW_NEWLINES: - tep->allow_newlines = GTK_VALUE_BOOL (*arg); - break; - default: - return; - } -} - -/* Get_arg handler for the text item */ -static void -e_text_event_processor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETextEventProcessor *tep = E_TEXT_EVENT_PROCESSOR (object); - - switch (arg_id) { - case ARG_ALLOW_NEWLINES: - GTK_VALUE_BOOL (*arg) = tep->allow_newlines; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} diff --git a/e-util/e-text-event-processor.h b/e-util/e-text-event-processor.h deleted file mode 100644 index e11c6451cc..0000000000 --- a/e-util/e-text-event-processor.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_TEXT_EVENT_PROCESSOR_H__ -#define __E_TEXT_EVENT_PROCESSOR_H__ - -#include <gnome.h> -#include <gal/util/e-text-event-processor-types.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ETextEventProcessor - Turns events on a text widget into commands. - * - */ - -#define E_TEXT_EVENT_PROCESSOR_TYPE (e_text_event_processor_get_type ()) -#define E_TEXT_EVENT_PROCESSOR(obj) (GTK_CHECK_CAST ((obj), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessor)) -#define E_TEXT_EVENT_PROCESSOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessorClass)) -#define E_IS_TEXT_EVENT_PROCESSOR(obj) (GTK_CHECK_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE)) -#define E_IS_TEXT_EVENT_PROCESSOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE)) - - -typedef struct _ETextEventProcessor ETextEventProcessor; -typedef struct _ETextEventProcessorClass ETextEventProcessorClass; - -struct _ETextEventProcessor -{ - GtkObject parent; - - /* object specific fields */ - guint allow_newlines : 1; -}; - -struct _ETextEventProcessorClass -{ - GtkObjectClass parent_class; - - /* signals */ - void (* command) (ETextEventProcessor *tep, ETextEventProcessorCommand *command); - - /* virtual functions */ - gint (* event) (ETextEventProcessor *tep, ETextEventProcessorEvent *event); -}; - - -GtkType e_text_event_processor_get_type (void); -gint e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TEXT_EVENT_PROCESSOR_H__ */ diff --git a/e-util/e-util.c b/e-util/e-util.c deleted file mode 100644 index 02092041f0..0000000000 --- a/e-util/e-util.c +++ /dev/null @@ -1,742 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-xml-utils.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <glib.h> -#include <gtk/gtkobject.h> -#include <errno.h> -#include <fcntl.h> -#include <unistd.h> -#include <ctype.h> -#include <sys/stat.h> -#include <string.h> -#include <locale.h> -#include <stdio.h> - -#include "e-util.h" -#if 0 -#include <libgnomevfs/gnome-vfs.h> -#endif - -int -g_str_compare(const void *x, const void *y) -{ - return strcmp(x, y); -} - -int -g_int_compare(const void *x, const void *y) -{ - if ( GPOINTER_TO_INT(x) < GPOINTER_TO_INT(y) ) - return -1; - else if ( GPOINTER_TO_INT(x) == GPOINTER_TO_INT(y) ) - return 0; - else - return 1; -} - -char * -e_strdup_strip(const char *string) -{ - int i; - int length = 0; - int initial = 0; - for ( i = 0; string[i]; i++ ) { - if (initial == i && isspace((unsigned char) string[i])) { - initial ++; - } - if (!isspace((unsigned char) string[i])) { - length = i - initial + 1; - } - } - return g_strndup(string + initial, length); -} - -void -e_free_object_list (GList *list) -{ - GList *p; - - for (p = list; p != NULL; p = p->next) - gtk_object_unref (GTK_OBJECT (p->data)); - - g_list_free (list); -} - -void -e_free_string_list (GList *list) -{ - GList *p; - - for (p = list; p != NULL; p = p->next) - g_free (p->data); - - g_list_free (list); -} - -#define BUFF_SIZE 1024 - -char * -e_read_file(const char *filename) -{ - int fd; - char buffer[BUFF_SIZE]; - GList *list = NULL, *list_iterator; - GList *lengths = NULL, *lengths_iterator; - int length = 0; - int bytes; - char *ret_val; - - fd = open(filename, O_RDONLY); - if (fd == -1) - return NULL; - bytes = read(fd, buffer, BUFF_SIZE); - while (bytes) { - if (bytes > 0) { - char *temp = g_malloc(bytes); - memcpy (temp, buffer, bytes); - list = g_list_prepend(list, temp); - lengths = g_list_prepend(lengths, GINT_TO_POINTER(bytes)); - length += bytes; - } else { - if (errno != EINTR) { - close(fd); - g_list_foreach(list, (GFunc) g_free, NULL); - g_list_free(list); - g_list_free(lengths); - return NULL; - } - } - bytes = read(fd, buffer, BUFF_SIZE); - } - ret_val = g_new(char, length + 1); - ret_val[length] = 0; - lengths_iterator = lengths; - list_iterator = list; - for ( ; list_iterator; list_iterator = list_iterator->next, lengths_iterator = lengths_iterator->next) { - int this_length = GPOINTER_TO_INT(lengths_iterator->data); - length -= this_length; - memcpy(ret_val + length, list_iterator->data, this_length); - } - close(fd); - g_list_foreach(list, (GFunc) g_free, NULL); - g_list_free(list); - g_list_free(lengths); - return ret_val; -} - -gint -e_write_file(const char *filename, const char *data, int flags) -{ - int fd; - int length = strlen(data); - int bytes; - fd = open(filename, flags, 0666); - if (fd == -1) - return errno; - while (length > 0) { - bytes = write(fd, data, length); - if (bytes > 0) { - length -= bytes; - data += bytes; - } else { - if (errno != EINTR && errno != EAGAIN) { - int save_errno = errno; - close(fd); - return save_errno; - } - } - } - close(fd); - return 0; -} - -/** - * e_mkdir_hier: - * @path: a directory path - * @mode: a mode, as for mkdir(2) - * - * This creates the named directory with the given @mode, creating - * any necessary intermediate directories (with the same @mode). - * - * Return value: 0 on success, -1 on error, in which case errno will - * be set as for mkdir(2). - **/ -int -e_mkdir_hier(const char *path, mode_t mode) -{ - char *copy, *p; - - p = copy = g_strdup (path); - do { - p = strchr (p + 1, '/'); - if (p) - *p = '\0'; - if (access (copy, F_OK) == -1) { - if (mkdir (copy, mode) == -1) { - g_free (copy); - return -1; - } - } - if (p) - *p = '/'; - } while (p); - - g_free (copy); - return 0; -} - -#if 0 -char * -e_read_uri(const char *uri) -{ - GnomeVFSHandle *handle; - GList *list = NULL, *list_iterator; - GList *lengths = NULL, *lengths_iterator; - gchar buffer[1025]; - gchar *ret_val; - int length = 0; - GnomeVFSFileSize bytes; - - gnome_vfs_open(&handle, uri, GNOME_VFS_OPEN_READ); - - gnome_vfs_read(handle, buffer, 1024, &bytes); - while (bytes) { - if (bytes) { - char *temp = g_malloc(bytes); - memcpy (temp, buffer, bytes); - list = g_list_prepend(list, temp); - lengths = g_list_prepend(lengths, GINT_TO_POINTER((gint) bytes)); - length += bytes; - } - gnome_vfs_read(handle, buffer, 1024, &bytes); - } - - ret_val = g_new(char, length + 1); - ret_val[length] = 0; - lengths_iterator = lengths; - list_iterator = list; - for ( ; list_iterator; list_iterator = list_iterator->next, lengths_iterator = lengths_iterator->next) { - int this_length = GPOINTER_TO_INT(lengths_iterator->data); - length -= this_length; - memcpy(ret_val + length, list_iterator->data, this_length); - } - gnome_vfs_close(handle); - g_list_foreach(list, (GFunc) g_free, NULL); - g_list_free(list); - g_list_free(lengths); - return ret_val; -} -#endif - -typedef gint (*GtkSignal_INT__INT_INT_POINTER) (GtkObject * object, - gint arg1, - gint arg2, - gpointer arg3, - gpointer user_data); - -void -e_marshal_INT__INT_INT_POINTER (GtkObject * object, - GtkSignalFunc func, - gpointer func_data, GtkArg * args) -{ - GtkSignal_INT__INT_INT_POINTER rfunc; - gint *return_val; - return_val = GTK_RETLOC_INT (args[3]); - rfunc = (GtkSignal_INT__INT_INT_POINTER) func; - *return_val = (*rfunc) (object, - GTK_VALUE_INT (args[0]), - GTK_VALUE_INT (args[1]), - GTK_VALUE_POINTER (args[2]), - func_data); -} - -typedef void (*GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object, - GtkObject *arg1, - gdouble arg2, - gdouble arg3, - gboolean arg4, - gpointer user_data); - -void -e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, - GtkSignalFunc func, - gpointer func_data, GtkArg * args) -{ - GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL rfunc; - rfunc = (GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL) func; - (*rfunc) (object, - GTK_VALUE_OBJECT (args[0]), - GTK_VALUE_DOUBLE (args[1]), - GTK_VALUE_DOUBLE (args[2]), - GTK_VALUE_BOOL (args[3]), - func_data); -} - -typedef gdouble (*GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object, - GtkObject *arg1, - gdouble arg2, - gdouble arg3, - gboolean arg4, - gpointer user_data); - -void -e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, - GtkSignalFunc func, - gpointer func_data, GtkArg * args) -{ - GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL rfunc; - gdouble *return_val; - return_val = GTK_RETLOC_DOUBLE (args[4]); - rfunc = (GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL) func; - *return_val = (*rfunc) (object, - GTK_VALUE_OBJECT (args[0]), - GTK_VALUE_DOUBLE (args[1]), - GTK_VALUE_DOUBLE (args[2]), - GTK_VALUE_BOOL (args[3]), - func_data); -} - -typedef gdouble (*GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object, - GtkObject *arg1, - gdouble arg2, - gdouble arg3, - gboolean arg4, - gpointer user_data); - -void -e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object, - GtkSignalFunc func, - gpointer func_data, GtkArg * args) -{ - GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL rfunc; - gboolean *return_val; - return_val = GTK_RETLOC_BOOL (args[4]); - rfunc = (GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL) func; - *return_val = (*rfunc) (object, - GTK_VALUE_OBJECT (args[0]), - GTK_VALUE_DOUBLE (args[1]), - GTK_VALUE_DOUBLE (args[2]), - GTK_VALUE_BOOL (args[3]), - func_data); -} - -typedef void (*GtkSignal_NONE__INT_INT_POINTER_POINTER_INT_INT) (GtkObject * object, - gint arg1, - gint arg2, - gpointer arg3, - gpointer arg4, - gint arg5, - gint arg6, - gpointer user_data); -void -e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT (GtkObject * object, - GtkSignalFunc func, - gpointer func_data, GtkArg * args) -{ - GtkSignal_NONE__INT_INT_POINTER_POINTER_INT_INT rfunc; - rfunc = (GtkSignal_NONE__INT_INT_POINTER_POINTER_INT_INT) func; - (*rfunc) (object, - GTK_VALUE_INT (args[0]), GTK_VALUE_INT (args[1]), - GTK_VALUE_POINTER (args[2]), - GTK_VALUE_POINTER (args[3]), - GTK_VALUE_INT (args[4]), GTK_VALUE_INT (args[5]), func_data); -} - -typedef void (*GtkSignal_NONE__INT_INT_POINTER_INT) (GtkObject * object, - gint arg1, - gint arg2, - gpointer arg3, - gint arg4, gpointer user_data); -void -e_marshal_NONE__INT_INT_POINTER_INT (GtkObject * object, - GtkSignalFunc func, - gpointer func_data, GtkArg * args) -{ - GtkSignal_NONE__INT_INT_POINTER_INT rfunc; - rfunc = (GtkSignal_NONE__INT_INT_POINTER_INT) func; - (*rfunc) (object, - GTK_VALUE_INT (args[0]), GTK_VALUE_INT (args[1]), - GTK_VALUE_POINTER (args[2]), GTK_VALUE_INT (args[3]), func_data); -} - -typedef gboolean (*GtkSignal_BOOL__INT_INT_POINTER_INT_INT_INT) (GtkObject * object, - gint arg1, - gint arg2, - gpointer arg3, - gint arg4, - gint arg5, - gint arg6, - gpointer user_data); -void -e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT (GtkObject * object, - GtkSignalFunc func, - gpointer func_data, GtkArg * args) -{ - GtkSignal_BOOL__INT_INT_POINTER_INT_INT_INT rfunc; - gboolean *return_val; - return_val = GTK_RETLOC_BOOL (args[6]); - rfunc = (GtkSignal_BOOL__INT_INT_POINTER_INT_INT_INT) func; - *return_val = (*rfunc) (object, - GTK_VALUE_INT (args[0]), - GTK_VALUE_INT (args[1]), - GTK_VALUE_POINTER (args[2]), - GTK_VALUE_INT (args[3]), - GTK_VALUE_INT (args[4]), - GTK_VALUE_INT (args[5]), func_data); -} - -typedef void (*GtkSignal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT) (GtkObject * - object, - gint arg1, - gint arg2, - gpointer - arg3, - gint arg4, - gint arg5, - gpointer - arg6, - gint arg7, - gint arg8, - gpointer - user_data); - -void -e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject * object, - GtkSignalFunc func, - gpointer func_data, - GtkArg * args) -{ - GtkSignal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT rfunc; - rfunc = (GtkSignal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT) func; - (*rfunc) (object, - GTK_VALUE_INT (args[0]), GTK_VALUE_INT (args[1]), - GTK_VALUE_POINTER (args[2]), - GTK_VALUE_INT (args[3]), - GTK_VALUE_INT (args[4]), - GTK_VALUE_POINTER (args[5]), - GTK_VALUE_INT (args[6]), GTK_VALUE_INT (args[7]), func_data); -} - -typedef void (*GtkSignal_NONE__POINTER_POINTER_INT) (GtkObject *, gpointer, - gpointer, gint, gpointer); - -void -e_marshal_NONE__POINTER_POINTER_INT (GtkObject * object, GtkSignalFunc func, - gpointer func_data, GtkArg * args) -{ - GtkSignal_NONE__POINTER_POINTER_INT rfunc; - rfunc = (GtkSignal_NONE__POINTER_POINTER_INT) func; - (*rfunc) (object, GTK_VALUE_POINTER (args[0]), GTK_VALUE_POINTER (args[1]), - GTK_VALUE_INT (args[2]), func_data); -} - -typedef int (*GtkSignal_INT__POINTER_POINTER) (GtkObject *, - gpointer, gpointer, - gpointer user_data); -void -e_marshal_INT__POINTER_POINTER (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args) -{ - GtkSignal_INT__POINTER_POINTER rfunc; - int *return_val; - - rfunc = (GtkSignal_INT__POINTER_POINTER) func; - return_val = GTK_RETLOC_INT (args[2]); - - *return_val = (*rfunc) (object, - GTK_VALUE_POINTER (args[0]), - GTK_VALUE_POINTER (args[1]), - func_data); -} - -typedef int (*GtkSignal_INT__POINTER_POINTER_POINTER) (GtkObject *, - gpointer, gpointer, gpointer, - gpointer user_data); -void -e_marshal_INT__POINTER_POINTER_POINTER (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args) -{ - GtkSignal_INT__POINTER_POINTER_POINTER rfunc; - int *return_val; - - rfunc = (GtkSignal_INT__POINTER_POINTER_POINTER) func; - return_val = GTK_RETLOC_INT (args[3]); - - *return_val = (*rfunc) (object, - GTK_VALUE_POINTER (args[0]), - GTK_VALUE_POINTER (args[1]), - GTK_VALUE_POINTER (args[2]), - func_data); -} - -typedef int (*GtkSignal_INT__POINTER_POINTER_POINTER_POINTER) (GtkObject *, - gpointer, gpointer, gpointer, gpointer, - gpointer user_data); -void -e_marshal_INT__POINTER_POINTER_POINTER_POINTER (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args) -{ - GtkSignal_INT__POINTER_POINTER_POINTER_POINTER rfunc; - int *return_val; - - rfunc = (GtkSignal_INT__POINTER_POINTER_POINTER_POINTER) func; - return_val = GTK_RETLOC_INT (args[4]); - - *return_val = (*rfunc) (object, - GTK_VALUE_POINTER (args[0]), - GTK_VALUE_POINTER (args[1]), - GTK_VALUE_POINTER (args[2]), - GTK_VALUE_POINTER (args[3]), - func_data); -} - -gchar** -e_strsplit (const gchar *string, - const gchar *delimiter, - gint max_tokens) -{ - GSList *string_list = NULL, *slist; - gchar **str_array, *s; - guint i, n = 1; - - g_return_val_if_fail (string != NULL, NULL); - g_return_val_if_fail (delimiter != NULL, NULL); - - if (max_tokens < 1) - max_tokens = G_MAXINT; - - s = strstr (string, delimiter); - if (s) - { - guint delimiter_len = strlen (delimiter); - - do - { - guint len; - gchar *new_string; - - len = s - string; - new_string = g_new (gchar, len + 1); - strncpy (new_string, string, len); - new_string[len] = 0; - string_list = g_slist_prepend (string_list, new_string); - n++; - string = s + delimiter_len; - s = strstr (string, delimiter); - } - while (--max_tokens && s); - } - - n++; - string_list = g_slist_prepend (string_list, g_strdup (string)); - - str_array = g_new (gchar*, n); - - i = n - 1; - - str_array[i--] = NULL; - for (slist = string_list; slist; slist = slist->next) - str_array[i--] = slist->data; - - g_slist_free (string_list); - - return str_array; -} - -gchar * -e_strstrcase (const gchar *haystack, const gchar *needle) -{ - /* find the needle in the haystack neglecting case */ - const gchar *ptr; - guint len; - - g_return_val_if_fail (haystack != NULL, NULL); - g_return_val_if_fail (needle != NULL, NULL); - - len = strlen(needle); - if (len > strlen(haystack)) - return NULL; - - if (len == 0) - return (gchar *) haystack; - - for (ptr = haystack; *(ptr + len - 1) != '\0'; ptr++) - if (!g_strncasecmp (ptr, needle, len)) - return (gchar *) ptr; - - return NULL; -} - -void -e_filename_make_safe (gchar *string) -{ - gchar *p; - - g_return_if_fail (string != NULL); - - for (p = string; *p; p++) { - if (!isprint ((unsigned char)*p) || strchr (" /'\"`&();|<>${}!", *p)) - *p = '_'; - } -} - -static gint -epow10 (gint number) { - gint value; - - for (value = 1; number > 0; number --) { - value *= 10; - } - return value; -} - -gchar * -e_format_number (gint number) -{ - GList *iterator, *list = NULL; - struct lconv *locality; - gint char_length = 0; - gint group_count = 0; - guchar *grouping; - int last_count = 3; - int divider; - char *value; - char *value_iterator; - int initial_grouping; - - locality = localeconv(); - grouping = locality->grouping; - initial_grouping = *grouping; - while (number) { - char *group; - switch (*grouping) { - default: - last_count = *grouping; - grouping++; - case 0: - divider = epow10(last_count); - if(!list && (number/divider) > 0) { - group = g_strdup_printf("%0*d", initial_grouping, number % divider); - } else { - group = g_strdup_printf("%d", number % divider); - } - number /= divider; - break; - case CHAR_MAX: - group = g_strdup_printf("%d", number); - number = 0; - break; - } - char_length += strlen(group); - list = g_list_prepend(list, group); - group_count ++; - } - - if (list) { - value = g_new(char, char_length + (group_count - 1) * strlen(locality->thousands_sep)); - - iterator = list; - value_iterator = value; - - strcpy(value_iterator, iterator->data); - value_iterator += strlen(iterator->data); - for (iterator = iterator->next; iterator; iterator = iterator->next) { - strcpy(value_iterator, locality->thousands_sep); - value_iterator += strlen(locality->thousands_sep); - - strcpy(value_iterator, iterator->data); - value_iterator += strlen(iterator->data); - } - e_free_string_list (list); - return value; - } else { - return g_strdup("0"); - } -} - -gboolean -e_create_directory (gchar *directory) -{ - gchar *full_name; - gchar *position; - gchar *current_dir = g_get_current_dir(); - struct stat info; - gboolean return_value = TRUE; - - if (directory[0] == '/') { - full_name = g_malloc0 (strlen (directory) + 1); - strcpy (full_name, directory); - } else { - full_name = g_malloc0 (strlen (directory) + strlen (current_dir) + 2); - sprintf (full_name, "%s/%s", current_dir, directory); - } - - if ((position = strrchr (full_name, '/')) == full_name) { - if (stat (full_name, &info)) { - switch (errno) { - case ENOENT: - if (mkdir (full_name, 0777)) { - switch (errno) { - default: - return_value = FALSE; - break; - } - } - break; - default: - return_value = FALSE; - break; - } - } - } else { - *position = 0; - e_create_directory (full_name); - *position = '/'; - if (stat (full_name, &info)) { - switch (errno) { - case ENOENT: - if (mkdir (full_name, 0777)) { - switch (errno) { - default: - return_value = FALSE; - break; - } - } - break; - default: - return_value = FALSE; - break; - } - } - } - - g_free (current_dir); - g_free (full_name); - - return (return_value); -} diff --git a/e-util/e-util.h b/e-util/e-util.h deleted file mode 100644 index 77d056b051..0000000000 --- a/e-util/e-util.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef _E_UTIL_H_ -#define _E_UTIL_H_ - -#include <glib.h> -#include <gtk/gtktypeutils.h> -#include <sys/types.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_MAKE_TYPE(l,str,t,ci,i,parent) \ -GtkType l##_get_type(void)\ -{\ - static GtkType type = 0;\ - if (!type){\ - GtkTypeInfo info = {\ - str,\ - sizeof (t),\ - sizeof (t##Class),\ - (GtkClassInitFunc) ci,\ - (GtkObjectInitFunc) i,\ - NULL, /* reserved 1 */\ - NULL, /* reserved 2 */\ - (GtkClassInitFunc) NULL\ - };\ - type = gtk_type_unique (parent, &info);\ - }\ - return type;\ -} - - -#define E_MAKE_X_TYPE(l,str,t,ci,i,parent,poa_init,offset) \ -GtkType l##_get_type(void)\ -{\ - static GtkType type = 0;\ - if (!type){\ - GtkTypeInfo info = {\ - str,\ - sizeof (t),\ - sizeof (t##Class),\ - (GtkClassInitFunc) ci,\ - (GtkObjectInitFunc) i,\ - NULL, /* reserved 1 */\ - NULL, /* reserved 2 */\ - (GtkClassInitFunc) NULL\ - };\ - type = bonobo_x_type_unique (\ - parent, poa_init, NULL,\ - offset, &info);\ - }\ - return type;\ -} - -typedef enum { - E_FOCUS_NONE, - E_FOCUS_CURRENT, - E_FOCUS_START, - E_FOCUS_END -} EFocus; -int g_str_compare (const void *x, - const void *y); -int g_int_compare (const void *x, - const void *y); -char *e_strdup_strip (const char *string); -void e_free_object_list (GList *list); -void e_free_string_list (GList *list); -char *e_read_file (const char *filename); -int e_write_file (const char *filename, - const char *data, - int flags); -int e_mkdir_hier (const char *path, - mode_t mode); - -gchar **e_strsplit (const gchar *string, - const gchar *delimiter, - gint max_tokens); -gchar *e_strstrcase (const gchar *haystack, - const gchar *needle); -void e_filename_make_safe (gchar *string); -gchar *e_format_number (gint number); -gboolean e_create_directory (gchar *directory); -void e_marshal_INT__INT_INT_POINTER (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); -void e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); -void e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); -void e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); - -#define e_marshal_NONE__INT_INT_POINTER_POINTER_UINT_UINT e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT -void e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); - -#define e_marshal_NONE__INT_INT_POINTER_UINT e_marshal_NONE__INT_INT_POINTER_INT -void e_marshal_NONE__INT_INT_POINTER_INT (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); - -#define e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT -void e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#define e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_UINT_UINT e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT - -void e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); -void e_marshal_NONE__POINTER_POINTER_INT (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); - -void e_marshal_INT__POINTER_POINTER (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); -void e_marshal_INT__POINTER_POINTER_POINTER (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); -void e_marshal_INT__POINTER_POINTER_POINTER_POINTER (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); - -#endif /* _E_UTIL_H_ */ diff --git a/e-util/e-xml-utils.c b/e-util/e-xml-utils.c deleted file mode 100644 index 4f13a616b4..0000000000 --- a/e-util/e-xml-utils.c +++ /dev/null @@ -1,382 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-xml-utils.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include "gal/util/e-i18n.h" -#include <locale.h> -#include <libgnome/libgnome.h> -#include <math.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> -#include "e-xml-utils.h" - -xmlNode * -e_xml_get_child_by_name (const xmlNode *parent, const xmlChar *child_name) -{ - xmlNode *child; - - g_return_val_if_fail (parent != NULL, NULL); - g_return_val_if_fail (child_name != NULL, NULL); - - for (child = parent->childs; child != NULL; child = child->next) { - if (xmlStrcmp (child->name, child_name) == 0) { - return child; - } - } - return NULL; -} - -/* Returns the first child with the name child_name and the "lang" - * attribute that matches the current LC_MESSAGES, or else, the first - * child with the name child_name and no "lang" attribute. - */ -xmlNode * -e_xml_get_child_by_name_by_lang (const xmlNode *parent, const xmlChar *child_name, const gchar *lang) -{ - xmlNode *child; - /* This is the default version of the string. */ - xmlNode *C = NULL; - - g_return_val_if_fail (parent != NULL, NULL); - g_return_val_if_fail (child_name != NULL, NULL); - - if (lang == NULL) { -#ifdef HAVE_LC_MESSAGES - lang = setlocale (LC_MESSAGES, NULL); -#else - lang = setlocale (LC_CTYPE, NULL); -#endif - } - for (child = parent->childs; child != NULL; child = child->next) { - if (xmlStrcmp (child->name, child_name) == 0) { - xmlChar *this_lang = xmlGetProp (child, "lang"); - if (this_lang == NULL) { - C = child; - } else if (xmlStrcmp(this_lang, "lang") == 0) { - return child; - } - } - } - return C; -} - -static xmlNode * -e_xml_get_child_by_name_by_lang_list_with_score (const xmlNode *parent, const gchar *name, GList *lang_list, gint *best_lang_score) -{ - xmlNodePtr best_node = NULL, node; - - for (node = parent->childs; node != NULL; node = node->next) { - xmlChar *lang; - - if (node->name == NULL || strcmp (node->name, name) != 0) { - continue; - } - lang = xmlGetProp (node, "xml:lang"); - if (lang != NULL) { - GList *l; - gint i; - - for (l = lang_list, i = 0; l != NULL && i < *best_lang_score; l = l->next, i++) { - if (strcmp ((gchar *) l->data, lang) == 0) { - best_node = node; - *best_lang_score = i; - } - } - } else { - if (best_node == NULL) { - best_node = node; - } - } - xmlFree (lang); - if (*best_lang_score == 0) { - return best_node; - } - } - - return best_node; -} - -/* - * e_xml_get_child_by_name_by_lang_list: - * - */ -xmlNode * -e_xml_get_child_by_name_by_lang_list (const xmlNode *parent, const gchar *name, GList *lang_list) -{ - gint best_lang_score = INT_MAX; - - g_return_val_if_fail (parent != NULL, NULL); - g_return_val_if_fail (name != NULL, NULL); - - if (lang_list == NULL) { - lang_list = gnome_i18n_get_language_list ("LC_MESSAGES"); - } - return e_xml_get_child_by_name_by_lang_list_with_score (parent, name, lang_list, &best_lang_score); -} - -/* - * e_xml_get_child_by_name_no_lang - * - */ -xmlNode * -e_xml_get_child_by_name_no_lang (const xmlNode *parent, const gchar *name) -{ - xmlNodePtr node; - - g_return_val_if_fail (parent != NULL, NULL); - g_return_val_if_fail (name != NULL, NULL); - - for (node = parent->childs; node != NULL; node = node->next) { - xmlChar *lang; - - if (node->name == NULL || strcmp (node->name, name) != 0) { - continue; - } - lang = xmlGetProp (node, "xml:lang"); - if (lang == NULL) { - return node; - } - xmlFree (lang); - } - - return NULL; -} - -gint -e_xml_get_integer_prop_by_name (const xmlNode *parent, const xmlChar *prop_name) -{ - g_return_val_if_fail (parent != NULL, 0); - g_return_val_if_fail (prop_name != NULL, 0); - - return e_xml_get_integer_prop_by_name_with_default (parent, prop_name, 0); -} - -gint -e_xml_get_integer_prop_by_name_with_default (const xmlNode *parent, const xmlChar *prop_name, gint def) -{ - xmlChar *prop; - gint ret_val = def; - - g_return_val_if_fail (parent != NULL, 0); - g_return_val_if_fail (prop_name != NULL, 0); - - prop = xmlGetProp ((xmlNode *) parent, prop_name); - if (prop != NULL) { - (void) sscanf (prop, "%d", &ret_val); - xmlFree (prop); - } - return ret_val; -} - -void -e_xml_set_integer_prop_by_name (xmlNode *parent, const xmlChar *prop_name, gint value) -{ - gchar *valuestr; - - g_return_if_fail (parent != NULL); - g_return_if_fail (prop_name != NULL); - - valuestr = g_strdup_printf ("%d", value); - xmlSetProp (parent, prop_name, valuestr); - g_free (valuestr); -} - -guint -e_xml_get_uint_prop_by_name (const xmlNode *parent, const xmlChar *prop_name) -{ - g_return_val_if_fail (parent != NULL, 0); - g_return_val_if_fail (prop_name != NULL, 0); - - return e_xml_get_uint_prop_by_name_with_default (parent, prop_name, 0); -} - -guint -e_xml_get_uint_prop_by_name_with_default (const xmlNode *parent, const xmlChar *prop_name, guint def) -{ - xmlChar *prop; - guint ret_val = def; - - g_return_val_if_fail (parent != NULL, 0); - g_return_val_if_fail (prop_name != NULL, 0); - - prop = xmlGetProp ((xmlNode *) parent, prop_name); - if (prop != NULL) { - (void) sscanf (prop, "%u", &ret_val); - xmlFree (prop); - } - return ret_val; -} - -void -e_xml_set_uint_prop_by_name (xmlNode *parent, const xmlChar *prop_name, guint value) -{ - gchar *valuestr; - - g_return_if_fail (parent != NULL); - g_return_if_fail (prop_name != NULL); - - valuestr = g_strdup_printf ("%u", value); - xmlSetProp (parent, prop_name, valuestr); - g_free (valuestr); -} - -gboolean -e_xml_get_bool_prop_by_name (const xmlNode *parent, const xmlChar *prop_name) -{ - g_return_val_if_fail (parent != NULL, 0); - g_return_val_if_fail (prop_name != NULL, 0); - - return e_xml_get_bool_prop_by_name_with_default (parent, prop_name, FALSE); -} - -gboolean -e_xml_get_bool_prop_by_name_with_default(const xmlNode *parent, const xmlChar *prop_name, gboolean def) -{ - xmlChar *prop; - gboolean ret_val = def; - - g_return_val_if_fail (parent != NULL, 0); - g_return_val_if_fail (prop_name != NULL, 0); - - prop = xmlGetProp ((xmlNode *) parent, prop_name); - if (prop != NULL) { - if (strcasecmp (prop, "true") == 0) { - ret_val = TRUE; - } else if (strcasecmp (prop, "false") == 0) { - ret_val = FALSE; - } - xmlFree(prop); - } - return ret_val; -} - -void -e_xml_set_bool_prop_by_name (xmlNode *parent, const xmlChar *prop_name, gboolean value) -{ - g_return_if_fail (parent != NULL); - g_return_if_fail (prop_name != NULL); - - if (value) { - xmlSetProp (parent, prop_name, "true"); - } else { - xmlSetProp (parent, prop_name, "false"); - } -} - -gdouble -e_xml_get_double_prop_by_name (const xmlNode *parent, const xmlChar *prop_name) -{ - g_return_val_if_fail (parent != NULL, 0); - g_return_val_if_fail (prop_name != NULL, 0); - - return e_xml_get_double_prop_by_name_with_default (parent, prop_name, 0.0); -} - -gdouble -e_xml_get_double_prop_by_name_with_default (const xmlNode *parent, const xmlChar *prop_name, gdouble def) -{ - xmlChar *prop; - gdouble ret_val = def; - - g_return_val_if_fail (parent != NULL, 0); - g_return_val_if_fail (prop_name != NULL, 0); - - prop = xmlGetProp ((xmlNode *) parent, prop_name); - if (prop != NULL) { - (void) sscanf (prop, "%lf", &ret_val); - xmlFree (prop); - } - return ret_val; -} - -void -e_xml_set_double_prop_by_name(xmlNode *parent, const xmlChar *prop_name, gdouble value) -{ - gchar *valuestr; - - g_return_if_fail (parent != NULL); - g_return_if_fail (prop_name != NULL); - - if (fabs (value) < 1e9 && fabs (value) > 1e-5) { - valuestr = g_strdup_printf ("%f", value); - } else { - valuestr = g_strdup_printf ("%.*g", DBL_DIG, value); - } - xmlSetProp (parent, prop_name, valuestr); - g_free (valuestr); -} - -gchar * -e_xml_get_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name) -{ - g_return_val_if_fail (parent != NULL, 0); - g_return_val_if_fail (prop_name != NULL, 0); - - return e_xml_get_string_prop_by_name_with_default (parent, prop_name, NULL); -} - -gchar * -e_xml_get_string_prop_by_name_with_default (const xmlNode *parent, const xmlChar *prop_name, const gchar *def) -{ - xmlChar *prop; - gchar *ret_val; - - g_return_val_if_fail (parent != NULL, 0); - g_return_val_if_fail (prop_name != NULL, 0); - - prop = xmlGetProp ((xmlNode *) parent, prop_name); - if (prop != NULL) { - ret_val = g_strdup (prop); - xmlFree (prop); - } else { - ret_val = g_strdup (def); - } - return ret_val; -} - -void -e_xml_set_string_prop_by_name (xmlNode *parent, const xmlChar *prop_name, const gchar *value) -{ - g_return_if_fail (parent != NULL); - g_return_if_fail (prop_name != NULL); - - if (value != NULL) { - xmlSetProp (parent, prop_name, value); - } -} - -gchar * -e_xml_get_translated_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name) -{ - xmlChar *prop; - gchar *ret_val = NULL; - - g_return_val_if_fail (parent != NULL, 0); - g_return_val_if_fail (prop_name != NULL, 0); - - prop = xmlGetProp ((xmlNode *) parent, prop_name); - if (prop != NULL) { - ret_val = g_strdup (_(prop)); - xmlFree (prop); - } - return ret_val; -} diff --git a/e-util/e-xml-utils.h b/e-util/e-xml-utils.h deleted file mode 100644 index bdcd756f3b..0000000000 --- a/e-util/e-xml-utils.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-xml-utils.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __E_XML_UTILS__ -#define __E_XML_UTILS__ - -#include <gnome.h> -#include <gnome-xml/tree.h> - -BEGIN_GNOME_DECLS - -xmlNode *e_xml_get_child_by_name (const xmlNode *parent, - const xmlChar *child_name); -/* lang set to NULL means use the current locale. */ -xmlNode *e_xml_get_child_by_name_by_lang (const xmlNode *parent, - const xmlChar *child_name, - const gchar *lang); -/* lang_list set to NULL means use the current locale. */ -xmlNode *e_xml_get_child_by_name_by_lang_list (const xmlNode *parent, - const gchar *name, - GList *lang_list); -xmlNode *e_xml_get_child_by_name_no_lang (const xmlNode *parent, - const gchar *name); - -gint e_xml_get_integer_prop_by_name (const xmlNode *parent, - const xmlChar *prop_name); -gint e_xml_get_integer_prop_by_name_with_default (const xmlNode *parent, - const xmlChar *prop_name, - gint def); -void e_xml_set_integer_prop_by_name (xmlNode *parent, - const xmlChar *prop_name, - gint value); - -guint e_xml_get_uint_prop_by_name (const xmlNode *parent, - const xmlChar *prop_name); -guint e_xml_get_uint_prop_by_name_with_default (const xmlNode *parent, - const xmlChar *prop_name, - guint def); -void e_xml_set_uint_prop_by_name (xmlNode *parent, - const xmlChar *prop_name, - guint value); - -gboolean e_xml_get_bool_prop_by_name (const xmlNode *parent, - const xmlChar *prop_name); -gboolean e_xml_get_bool_prop_by_name_with_default (const xmlNode *parent, - const xmlChar *prop_name, - gboolean def); -void e_xml_set_bool_prop_by_name (xmlNode *parent, - const xmlChar *prop_name, - gboolean value); - -gdouble e_xml_get_double_prop_by_name (const xmlNode *parent, - const xmlChar *prop_name); -gdouble e_xml_get_double_prop_by_name_with_default (const xmlNode *parent, - const xmlChar *prop_name, - gdouble def); -void e_xml_set_double_prop_by_name ( xmlNode *parent, - const xmlChar *prop_name, - gdouble value); - -gchar *e_xml_get_string_prop_by_name (const xmlNode *parent, - const xmlChar *prop_name); -gchar *e_xml_get_string_prop_by_name_with_default (const xmlNode *parent, - const xmlChar *prop_name, - const gchar *def); -void e_xml_set_string_prop_by_name (xmlNode *parent, - const xmlChar *prop_name, - const gchar *value); - -gchar *e_xml_get_translated_string_prop_by_name (const xmlNode *parent, - const xmlChar *prop_name); - -END_GNOME_DECLS - -#endif /* __E_XML_UTILS__ */ diff --git a/executive-summary/ChangeLog b/executive-summary/ChangeLog index 8911e7154b..8a143acacf 100644 --- a/executive-summary/ChangeLog +++ b/executive-summary/ChangeLog @@ -1,58 +1,27 @@ -2001-03-08 Ettore Perazzoli <ettore@ximian.com> - - * component/component-factory.c (factory_fn): Specify a NULL - `EvolutionShellComponentGetDndSelectionFn'. - -2001-02-14 Iain Holmes <iain@ximian.com> - - * component/e-summary-url.c (e_summary_url_click): Remove the new - OTHER uri stuff. - -2001-02-14 Christopher James Lahey <clahey@ximian.com> - - * component/component-factory.c (component_destroy_cb): Removed - this unused function. +2001-02-27 Ettore Perazzoli <ettore@ximian.com> + + * Makefile.am (SUBDIRS): Remove `widgets'. - * evolution-services/executive-summary-html-view.c - (impl_GNOME_Evolution_Summary_HTMLView_handleURI): Changed the - declaration of this function to match the signature in the - generated header file. +2001-02-27 Ettore Perazzoli <ettore@ximian.com> - * test-service/rdf-summary.c (property_control): Added a cast here. + * Makefile.am (SUBDIRS): Add `widgets'. 2001-02-14 Iain Holmes <iain@ximian.com> - * evolution-services/executive-summary-html-view.c + * evolution-services/executive-summary-html-view.c (executive_summary_html_view_destroy): Don't unref the event source. - (impl_GNOME_Evolution_Summary_HTMLView_handleURI): Emit the signal. - (corba_class_init): Hook up the handleURI method. - (executive_summary_html_view_class_init): Create the signal. - - * idl/HTMLView.idl: Add the handleURI method. - -2001-02-13 Iain Holmes <iain@ximian.com> - * test-service/rdf-summary.c (property_control): Add an update now button. +2001-02-09 Iain Holmes <iain@ximian.com> -2001-02-12 Iain Holmes <iain@ximian.com> - - * test-service/rdf-summary.c (property_control): Add a "Update" spinner. - (property_action): Only download a new RDF if the URL changed. Use a cached - version otherwise. + * component/e-summary.c (e_summary_rebuild_page): Remove some debugging + prints. Stop some 0 length strings being passed to gtk_html_stream. 2001-02-08 Iain Holmes <iain@ximian.com> - * component/e-summary-url.c (e_summary_url_click): Close and remove the - window on an idle, so that the whole desktop isn't locked by a - GNOME-VFS bug. - -2001-02-13 Kjartan Maraas <kmaraas@gnome.org> + * component/e-summary-url.c (e_summary_url_click): Close and remove the + window on an idle, so that the whole desktop isn't locked by a + GNOME-VFS bug. - * Makefile.am: xml-i18n-tools setup for .oaf.in files. - * GNOME_Evolution_Summary.oaf.in: Mark strings for translation. - * test-service/Makefile.am: xml-i18n-tools setup for .oaf.in files. - * test-service/*.oaf.in: Mark strings for translation. - 2001-01-23 Iain Holmes <iain@ximian.com> * component/e-summary.c (e_summary_load_page): Don't strdup the NULL. diff --git a/executive-summary/component/e-summary-url.c b/executive-summary/component/e-summary-url.c index 4b26f1a85d..4a3ca724e3 100644 --- a/executive-summary/component/e-summary-url.c +++ b/executive-summary/component/e-summary-url.c @@ -25,16 +25,8 @@ #include <config.h> #endif -#include <bonobo/bonobo-property-control.h> -#include <bonobo/bonobo-event-source.h> -#include <bonobo/bonobo-widget.h> - -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-url.h> -#include <libgnome/gnome-exec.h> -#include <libgnomeui/gnome-propertybox.h> - -#include <stdlib.h> +#include <gnome.h> +#include <bonobo.h> #include <gtkhtml/gtkhtml.h> #include <gtkhtml/gtkhtml-stream.h> @@ -503,10 +495,10 @@ e_summary_url_click (GtkWidget *widget, id->window = window; id->esummary = esummary; - /* Close the window on an idle to work around a bug in - gnome-vfs which locks the e_summary_remove_window function - and as gtkhtml has a pointer grab on, this locks the whole - display. GAH! */ + /* Close the window on an idle to work around a bug in gnome-vfs + which locaks the e_summary_remove_window function and as + gtkhtml has a pointer grab on, this locks the whole display. + GAH! */ g_idle_add (idle_remove_window, id); break; @@ -598,8 +590,8 @@ e_summary_url_click (GtkWidget *widget, e_summary_queue_rebuild (esummary); break; - case PROTOCOL_OTHER: case PROTOCOL_NONE: + case PROTOCOL_OTHER: case PROTOCOL_HTTP: case PROTOCOL_FILE: default: diff --git a/executive-summary/component/e-summary.c b/executive-summary/component/e-summary.c index 0e5d613ad8..dca93283a0 100644 --- a/executive-summary/component/e-summary.c +++ b/executive-summary/component/e-summary.c @@ -25,11 +25,8 @@ #include <config.h> #endif -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-event-source.h> -#include <bonobo/bonobo-listener.h> -#include <bonobo/bonobo-property-bag.h> -#include <bonobo/bonobo-property-control.h> +#include <gnome.h> +#include <bonobo.h> #include <gtkhtml/gtkhtml.h> #include <gtkhtml/gtkhtml-embedded.h> @@ -517,7 +514,6 @@ e_summary_rebuild_page (ESummary *esummary) /* For each window on row i */ limit = MIN (columns, (numwindows - (i * columns))); for (k = 0; k < limit; k++) { - if (window == NULL) break; @@ -659,12 +655,7 @@ e_summary_add_service (ESummary *esummary, return NULL; } - unknown = Bonobo_Unknown_queryInterface (component, - "IDL:Bonobo/PropertyBag:1.0", - &ev); - window->propertybag = (Bonobo_PropertyBag) unknown; - - window->event_source = Bonobo_Unknown_queryInterface(window->propertybag, + window->event_source = Bonobo_Unknown_queryInterface(window->component, "IDL:Bonobo/EventSource:1.0", &ev); if (window->event_source == CORBA_OBJECT_NIL) { g_warning ("There is no Bonobo::EventSource interface"); @@ -681,6 +672,11 @@ e_summary_add_service (ESummary *esummary, window->listener_id = Bonobo_EventSource_addListener (window->event_source, listener, &ev); unknown = Bonobo_Unknown_queryInterface (component, + "IDL:Bonobo/PropertyBag:1.0", + &ev); + window->propertybag = (Bonobo_PropertyBag) unknown; + + unknown = Bonobo_Unknown_queryInterface (component, "IDL:Bonobo/PersistStream:1.0", &ev); window->persiststream = (Bonobo_PersistStream) unknown; @@ -694,10 +690,8 @@ e_summary_add_service (ESummary *esummary, window->title = bonobo_property_bag_client_get_value_string (window->propertybag, "window_title", NULL); - g_print ("title: %s\n", window->title); window->icon = bonobo_property_bag_client_get_value_string (window->propertybag, "window_icon", NULL); - g_print ("icon: %s\n", window->icon); CORBA_exception_free (&ev); priv->window_list = g_list_append (priv->window_list, window); @@ -751,7 +745,7 @@ e_summary_window_free (ESummaryWindow *window) if (ev._major != CORBA_NO_EXCEPTION) { g_warning ("CORBA ERROR: %s", CORBA_exception_id (&ev)); } - bonobo_object_release_unref (window->event_source, &ev); + bonobo_object_release_unref (window->event_source, &ev); } bonobo_object_release_unref (window->propertybag, &ev); @@ -759,9 +753,10 @@ e_summary_window_free (ESummaryWindow *window) bonobo_object_release_unref (window->propertycontrol, &ev); bonobo_object_unref (BONOBO_OBJECT (window->listener)); bonobo_object_release_unref (window->html, &ev); - + bonobo_object_release_unref (window->component, &ev); CORBA_exception_free (&ev); + g_free (window); } @@ -1213,6 +1208,7 @@ e_summary_save_state (ESummary *esummary, fullpath = g_strdup_printf("%s/Executive-Summary", path); g_print ("fullpath: %s\n", fullpath); + /* FIXME: Use RC's rmdir function */ e_summary_rm_dir (fullpath); storage = bonobo_storage_open (STORAGE_TYPE, fullpath, diff --git a/executive-summary/evolution-services/executive-summary-html-view.c b/executive-summary/evolution-services/executive-summary-html-view.c index 45f2e86c16..07da71c9e7 100644 --- a/executive-summary/evolution-services/executive-summary-html-view.c +++ b/executive-summary/evolution-services/executive-summary-html-view.c @@ -42,13 +42,6 @@ static void executive_summary_html_view_class_init (ExecutiveSummaryHtmlViewClas static BonoboObjectClass *parent_class; -enum { - HANDLE_URI, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - struct _ExecutiveSummaryHtmlViewPrivate { BonoboEventSource *event_source; @@ -95,18 +88,6 @@ impl_GNOME_Evolution_Summary_HTMLView_getHtml (PortableServer_Servant servant, return CORBA_string_dup (priv->html? priv->html: ""); } -static void -impl_GNOME_Evolution_Summary_HTMLView_handleURI (PortableServer_Servant servant, - const CORBA_char *uri, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - - bonobo_object = bonobo_object_from_servant (servant); - - gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[HANDLE_URI], uri); -} - /* GtkObject methods */ static void executive_summary_html_view_destroy (GtkObject *object) @@ -114,13 +95,13 @@ executive_summary_html_view_destroy (GtkObject *object) ExecutiveSummaryHtmlView *view; ExecutiveSummaryHtmlViewPrivate *priv; - g_print ("BANG!"); view = EXECUTIVE_SUMMARY_HTML_VIEW (object); priv = view->private; if (priv == NULL) return; +/* bonobo_object_unref (BONOBO_OBJECT (priv->event_source)); */ g_free (priv->html); g_free (priv); @@ -143,7 +124,6 @@ corba_class_init (void) epv = g_new0 (POA_GNOME_Evolution_Summary_HTMLView__epv, 1); epv->getHtml = impl_GNOME_Evolution_Summary_HTMLView_getHtml; - epv->handleURI = impl_GNOME_Evolution_Summary_HTMLView_handleURI; vepv = &HTMLView_vepv; vepv->_base_epv = base_epv; @@ -159,15 +139,6 @@ executive_summary_html_view_class_init (ExecutiveSummaryHtmlViewClass *klass) object_class = GTK_OBJECT_CLASS (klass); object_class->destroy = executive_summary_html_view_destroy; - signals[HANDLE_URI] = gtk_signal_new ("handle_uri", GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (ExecutiveSummaryHtmlViewClass, handle_uri), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - parent_class = gtk_type_class (PARENT_TYPE); corba_class_init (); diff --git a/filter/ChangeLog b/filter/ChangeLog index b3d403b812..bde9b4f311 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,43 +1,3 @@ -2001-03-12 Jeffrey Stedfast <fejj@ximian.com> - - * filtertypes.xml: Added an "Attachments" filter option where you - can filter messages that have (or do not have) attachments. This - does not allow you to filter based on the types of the - attachments. - -2001-03-08 Jeffrey Stedfast <fejj@ximian.com> - - * vfolder-editor.c (double_click): Make sure we have something - selected first ;-) - - * filter-editor.c (double_click): And here too. - -2001-03-03 Not Zed <NotZed@Ximian.com> - - * filter.glade: Added option menu to vfolder editor. - -2001-03-02 Not Zed <NotZed@Ximian.com> - - * vfolder-rule.c (get_widget): Setup the data on the base source - opiton menu, and make hte option menu reflect the source. - (select_source_with): Set the source type for this - rule. e.g. these folders, "with ..." - - * filter-editor.c: Removed the N_() stuff from the source_names - array, they must not be internationalised!!! - -2001-02-28 Not Zed <NotZed@Ximian.com> - - * filter-rule.c (filter_rule_clone): New function to clone rules. - -2001-02-23 Not Zed <NotZed@Ximian.com> - - * filtertypes.xml: Added mailing list matching rules. - renamed mailing list options to be more meaningful. - - * vfoldertypes.xml: Added mailing list rules. - renamed mailing list options to be more meaningful. - 2001-02-11 Gediminas Paulauskas <menesis@delfi.lt> * filter.glade.h: removed. diff --git a/filter/filter-driver.c b/filter/filter-driver.c deleted file mode 100644 index bc941a9c01..0000000000 --- a/filter/filter-driver.c +++ /dev/null @@ -1,778 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2000 Helix Code Inc. - * - * Authors: Michael Zucchi <notzed@helixcode.com> - * Jeffrey Stedfast <fejj@helixcode.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "filter-driver.h" -#include "filter-message-search.h" - -#include <glib.h> -#include <gtk/gtk.h> -#include <gnome.h> -#include <gtkhtml/gtkhtml.h> - -#include <time.h> - -#include <gnome-xml/tree.h> -#include <gnome-xml/parser.h> - -#include <camel/camel.h> -#include "filter-context.h" -#include "filter-filter.h" -#include "e-util/e-sexp.h" -#include "e-util/e-memory.h" - -#define d(x) - -/* type of status for a log report */ -enum filter_log_t { - FILTER_LOG_NONE, - FILTER_LOG_START, /* start of new log entry */ - FILTER_LOG_ACTION, /* an action performed */ - FILTER_LOG_END, /* end of log */ -}; - -struct _FilterDriverPrivate { - GHashTable *globals; /* global variables */ - - CamelFolder *defaultfolder; /* defualt folder */ - - FDStatusFunc *statusfunc; /* status callback */ - void *statusdata; /* status callback data */ - - FilterContext *context; - - /* for callback */ - FilterGetFolderFunc get_folder; - void *data; - - /* run-time data */ - GHashTable *folders; /* folders that message has been copied to */ - GHashTable *forwards; /* addresses that have been forwarded the message */ - - gboolean terminated; /* message processing was terminated */ - gboolean deleted; /* message was marked for deletion */ - gboolean copied; /* message was copied to some folder or another */ - - CamelMimeMessage *message; /* input message */ - CamelMessageInfo *info; /* message summary info */ - - FILE *logfile; /* log file */ - - CamelException *ex; - - /* evaluator */ - ESExp *eval; -}; - -#define _PRIVATE(o) (((FilterDriver *)(o))->priv) - -static void filter_driver_class_init (FilterDriverClass *klass); -static void filter_driver_init (FilterDriver *obj); -static void filter_driver_finalise (GtkObject *obj); - -static void filter_driver_log (FilterDriver *driver, enum filter_log_t status, const char *desc, ...); - -static CamelFolder *open_folder (FilterDriver *d, const char *folder_url); -static int close_folders (FilterDriver *d); - -static ESExpResult *do_delete (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); -static ESExpResult *mark_forward (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); -static ESExpResult *do_copy (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); -static ESExpResult *do_move (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); -static ESExpResult *do_stop (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); -static ESExpResult *do_colour (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); -static ESExpResult *do_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); -static ESExpResult *do_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); - -/* these are our filter actions - each must have a callback */ -static struct { - char *name; - ESExpFunc *func; - int type; /* set to 1 if a function can perform shortcut evaluation, or - doesn't execute everything, 0 otherwise */ -} symbols[] = { - { "delete", (ESExpFunc *) do_delete, 0 }, - { "forward-to", (ESExpFunc *) mark_forward, 0 }, - { "copy-to", (ESExpFunc *) do_copy, 0 }, - { "move-to", (ESExpFunc *) do_move, 0 }, - { "stop", (ESExpFunc *) do_stop, 0 }, - { "set-colour", (ESExpFunc *) do_colour, 0 }, - { "set-score", (ESExpFunc *) do_score, 0 }, - { "set-system-flag", (ESExpFunc *) do_flag, 0 } -}; - -static GtkObjectClass *filter_driver_parent; - -enum SIGNALS { - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -guint -filter_driver_get_type (void) -{ - static guint type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "FilterDriver", - sizeof (FilterDriver), - sizeof (FilterDriverClass), - (GtkClassInitFunc) filter_driver_class_init, - (GtkObjectInitFunc) filter_driver_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - type = gtk_type_unique (gtk_object_get_type (), &type_info); - } - - return type; -} - -static void -filter_driver_class_init (FilterDriverClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - filter_driver_parent = gtk_type_class (gtk_object_get_type ()); - - object_class->finalize = filter_driver_finalise; - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -filter_driver_init (FilterDriver *obj) -{ - struct _FilterDriverPrivate *p; - int i; - - p = _PRIVATE (obj) = g_malloc0 (sizeof (*p)); - - p->eval = e_sexp_new (); - /* Load in builtin symbols */ - for (i = 0; i < sizeof (symbols) / sizeof (symbols[0]); i++) { - if (symbols[i].type == 1) { - e_sexp_add_ifunction (p->eval, 0, symbols[i].name, (ESExpIFunc *)symbols[i].func, obj); - } else { - e_sexp_add_function (p->eval, 0, symbols[i].name, symbols[i].func, obj); - } - } - - p->globals = g_hash_table_new (g_str_hash, g_str_equal); - - p->folders = g_hash_table_new (g_str_hash, g_str_equal); -} - -static void -free_hash_strings (void *key, void *value, void *data) -{ - g_free (key); - g_free (value); -} - -static void -filter_driver_finalise (GtkObject *obj) -{ - FilterDriver *driver = (FilterDriver *) obj; - struct _FilterDriverPrivate *p = _PRIVATE (driver); - - /* close all folders that were opened for appending */ - close_folders (driver); - g_hash_table_destroy (p->folders); - - g_hash_table_foreach (p->globals, free_hash_strings, driver); - g_hash_table_destroy (p->globals); - - e_sexp_unref(p->eval); - - if (p->defaultfolder) - camel_object_unref (CAMEL_OBJECT (p->defaultfolder)); - - g_free (p); - - ((GtkObjectClass *)(filter_driver_parent))->finalize (GTK_OBJECT (obj)); -} - -/** - * filter_driver_new: - * @system: path to system rules - * @user: path to user rules - * @get_folder: function to call to fetch folders - * - * Create a new FilterDriver object. - * - * Return value: A new FilterDriver widget. - **/ -FilterDriver * -filter_driver_new (FilterContext *context, FilterGetFolderFunc get_folder, void *data) -{ - FilterDriver *new; - struct _FilterDriverPrivate *p; - - new = FILTER_DRIVER (gtk_type_new (filter_driver_get_type ())); - p = _PRIVATE (new); - - p->get_folder = get_folder; - p->data = data; - p->context = context; - gtk_object_ref (GTK_OBJECT (context)); - - return new; -} - -void -filter_driver_set_logfile (FilterDriver *d, FILE *logfile) -{ - struct _FilterDriverPrivate *p = _PRIVATE (d); - - p->logfile = logfile; -} - -void -filter_driver_set_status_func (FilterDriver *d, FDStatusFunc *func, void *data) -{ - struct _FilterDriverPrivate *p = _PRIVATE (d); - - p->statusfunc = func; - p->statusdata = data; -} - -void -filter_driver_set_default_folder (FilterDriver *d, CamelFolder *def) -{ - struct _FilterDriverPrivate *p = _PRIVATE (d); - - if (p->defaultfolder) - camel_object_unref (CAMEL_OBJECT (p->defaultfolder)); - - p->defaultfolder = def; - - if (p->defaultfolder) - camel_object_ref (CAMEL_OBJECT (p->defaultfolder)); -} - -static void -report_status (FilterDriver *driver, enum filter_status_t status, const char *desc, ...) -{ - /* call user-defined status report function */ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - va_list ap; - char *str; - - if (p->statusfunc) { - va_start (ap, desc); - str = g_strdup_vprintf (desc, ap); - p->statusfunc (driver, status, str, p->statusdata); - g_free (str); - } -} - - -#if 0 -void -filter_driver_set_global (FilterDriver *d, const char *name, const char *value) -{ - struct _FilterDriverPrivate *p = _PRIVATE (d); - char *oldkey, *oldvalue; - - if (g_hash_table_lookup_extended (p->globals, name, (void *)&oldkey, (void *)&oldvalue)) { - g_free (oldvalue); - g_hash_table_insert (p->globals, oldkey, g_strdup (value)); - } else { - g_hash_table_insert (p->globals, g_strdup (name), g_strdup (value)); - } -} -#endif - -static ESExpResult * -do_delete (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - - d(fprintf (stderr, "doing delete\n")); - p->deleted = TRUE; - filter_driver_log (driver, FILTER_LOG_ACTION, "Delete"); - - return NULL; -} - -static ESExpResult * -mark_forward (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver) -{ - /*struct _FilterDriverPrivate *p = _PRIVATE (driver);*/ - - d(fprintf (stderr, "marking message for forwarding\n")); - /* FIXME: do stuff here */ - filter_driver_log (driver, FILTER_LOG_ACTION, "Forward"); - - return NULL; -} - -static ESExpResult * -do_copy (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - int i; - - d(fprintf (stderr, "copying message...\n")); - - for (i = 0; i < argc; i++) { - if (argv[i]->type == ESEXP_RES_STRING) { - /* open folders we intent to copy to */ - char *folder = argv[i]->value.string; - char *service_url; - CamelFolder *outbox; - - outbox = open_folder (driver, folder); - if (!outbox) - continue; - - p->copied = TRUE; - camel_folder_append_message (outbox, p->message, p->info, p->ex); - - service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (outbox))); - filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to folder %s", service_url); - g_free (service_url); - } - } - - return NULL; -} - -static ESExpResult * -do_move (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - int i; - - d(fprintf (stderr, "moving message...\n")); - - for (i = 0; i < argc; i++) { - if (argv[i]->type == ESEXP_RES_STRING) { - /* open folders we intent to move to */ - char *folder = argv[i]->value.string; - char *service_url; - CamelFolder *outbox; - - outbox = open_folder (driver, folder); - if (!outbox) - continue; - - p->copied = TRUE; - p->deleted = TRUE; /* a 'move' is a copy & delete */ - - camel_folder_append_message (outbox, p->message, p->info, p->ex); - - service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (outbox))); - filter_driver_log (driver, FILTER_LOG_ACTION, "Move to folder %s", service_url); - g_free (service_url); - } - } - - return NULL; -} - -static ESExpResult * -do_stop (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - - filter_driver_log (driver, FILTER_LOG_ACTION, "Stopped processing"); - d(fprintf (stderr, "terminating message processing\n")); - p->terminated = TRUE; - - return NULL; -} - -static ESExpResult * -do_colour (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - - d(fprintf (stderr, "setting colour tag\n")); - if (argc > 0 && argv[0]->type == ESEXP_RES_STRING) { - camel_tag_set (&p->info->user_tags, "colour", argv[0]->value.string); - filter_driver_log (driver, FILTER_LOG_ACTION, "Set colour to %s", argv[0]->value.string); - } - - return NULL; -} - -static ESExpResult * -do_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - - d(fprintf (stderr, "setting score tag\n")); - if (argc > 0 && argv[0]->type == ESEXP_RES_INT) { - char *value; - - value = g_strdup_printf ("%d", argv[0]->value.number); - camel_tag_set (&p->info->user_tags, "score", value); - filter_driver_log (driver, FILTER_LOG_ACTION, "Set score to %d", argv[0]->value.number); - g_free (value); - } - - return NULL; -} - -static ESExpResult * -do_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - - d(fprintf (stderr, "setting flag\n")); - if (argc == 1 && argv[0]->type == ESEXP_RES_STRING) { - p->info->flags |= camel_system_flag (argv[0]->value.string) | CAMEL_MESSAGE_FOLDER_FLAGGED; - filter_driver_log (driver, FILTER_LOG_ACTION, "Set %s flag", argv[0]->value.string); - } - - return NULL; -} - -static CamelFolder * -open_folder (FilterDriver *driver, const char *folder_url) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - CamelFolder *camelfolder; - - /* we have a lookup table of currently open folders */ - camelfolder = g_hash_table_lookup (p->folders, folder_url); - if (camelfolder) - return camelfolder; - - camelfolder = p->get_folder (driver, folder_url, p->data); - - if (camelfolder) { - g_hash_table_insert (p->folders, g_strdup (folder_url), camelfolder); - camel_folder_freeze (camelfolder); - } - - return camelfolder; -} - -static void -close_folder (void *key, void *value, void *data) -{ - CamelFolder *folder = value; - FilterDriver *driver = data; - struct _FilterDriverPrivate *p = _PRIVATE (driver); - - g_free (key); - camel_folder_sync (folder, FALSE, p->ex); - camel_folder_thaw (folder); - camel_object_unref (CAMEL_OBJECT (folder)); -} - -/* flush/close all folders */ -static int -close_folders (FilterDriver *driver) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - - g_hash_table_foreach (p->folders, close_folder, driver); - g_hash_table_destroy (p->folders); - p->folders = g_hash_table_new (g_str_hash, g_str_equal); - - /* FIXME: status from driver */ - return 0; -} - -#if 0 -static void -free_key (gpointer key, gpointer value, gpointer user_data) -{ - g_free (key); -} -#endif - - -static void -filter_driver_log (FilterDriver *driver, enum filter_log_t status, const char *desc, ...) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - - if (p->logfile) { - char *str = NULL; - - if (desc) { - va_list ap; - - va_start (ap, desc); - str = g_strdup_vprintf (desc, ap); - } - - switch (status) { - case FILTER_LOG_START: { - /* write log header */ - const char *subject = NULL; - char *fromstr; - const CamelInternetAddress *from; - char date[50]; - time_t t; - - /* FIXME: does this need locking? Probably */ - - from = camel_mime_message_get_from (p->message); - fromstr = camel_address_format((CamelAddress *)from); - subject = camel_mime_message_get_subject (p->message); - - time (&t); - strftime (date, 49, "%a, %d %b %Y %H:%M:%S", localtime (&t)); - fprintf (p->logfile, "Applied filter \"%s\" to message from %s - \"%s\" at %s\n", - str, fromstr ? fromstr : "unknown", subject ? subject : "", date); - g_free(fromstr); - break; - } - case FILTER_LOG_ACTION: - fprintf (p->logfile, "Action: %s\n", str); - break; - case FILTER_LOG_END: - fprintf (p->logfile, "\n"); - break; - default: - /* nothing else is loggable */ - break; - } - - g_free (str); - } -} - - -/* will filter only an mbox - is more efficient as it doesn't need to open the folder through camel directly */ -void -filter_driver_filter_mbox (FilterDriver *driver, const char *mbox, const char *source, CamelException *ex) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - CamelMimeParser *mp = NULL; - char *source_url = NULL; - int fd = -1; - int i = 0; - struct stat st; - - fd = open (mbox, O_RDONLY); - if (fd == -1) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, "Unable to open spool folder"); - goto fail; - } - /* to get the filesize */ - fstat (fd, &st); - - mp = camel_mime_parser_new (); - camel_mime_parser_scan_from (mp, TRUE); - if (camel_mime_parser_init_with_fd (mp, fd) == -1) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, "Unable to process spool folder"); - goto fail; - } - fd = -1; - - source_url = g_strdup_printf ("file://%s", mbox); - - while (camel_mime_parser_step (mp, 0, 0) == HSCAN_FROM) { - CamelMimeMessage *msg; - int pc = 0; - - if (st.st_size > 0) - pc = (int)(100.0 * ((double)camel_mime_parser_tell (mp) / (double)st.st_size)); - - report_status (driver, FILTER_STATUS_START, "Getting message %d (%d%% of file)", i, pc); - - msg = camel_mime_message_new (); - if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (msg), mp) == -1) { - report_status (driver, FILTER_STATUS_END, "Failed message %d", i); - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, "Cannot open message"); - camel_object_unref (CAMEL_OBJECT (msg)); - goto fail; - } - - filter_driver_filter_message (driver, msg, NULL, source_url, source, ex); - camel_object_unref (CAMEL_OBJECT (msg)); - if (camel_exception_is_set (ex)) { - report_status (driver, FILTER_STATUS_END, "Failed message %d", i); - goto fail; - } - - report_status (driver, FILTER_STATUS_END, "Finished message %d", i); - i++; - - /* skip over the FROM_END state */ - camel_mime_parser_step (mp, 0, 0); - } - - if (p->defaultfolder) - camel_folder_sync (p->defaultfolder, FALSE, ex); - -fail: - g_free (source_url); - if (fd != -1) - close (fd); - if (mp) - camel_object_unref (CAMEL_OBJECT (mp)); -} - -/* will filter a folder */ -void -filter_driver_filter_folder (FilterDriver *driver, CamelFolder *folder, const char *source, - GPtrArray *uids, gboolean remove, CamelException *ex) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - int i; - int freeuids = FALSE; - CamelMimeMessage *message; - const CamelMessageInfo *info; - char *source_url, *service_url; - - service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (folder))); - source_url = g_strdup_printf ("%s%s", service_url, camel_folder_get_full_name (folder)); - g_free (service_url); - - if (uids == NULL) { - uids = camel_folder_get_uids (folder); - freeuids = TRUE; - } - - for (i = 0; i < uids->len; i++) { - report_status (driver, FILTER_STATUS_START, "Getting message %d of %d", i+1, uids->len); - - message = camel_folder_get_message (folder, uids->pdata[i], ex); - if (camel_exception_is_set (ex)) { - report_status (driver, FILTER_STATUS_END, "Failed at message %d of %d", i+1, uids->len); - break; - } - - if (camel_folder_has_summary_capability (folder)) - info = camel_folder_get_message_info (folder, uids->pdata[i]); - else - info = NULL; - - filter_driver_filter_message (driver, message, (CamelMessageInfo *)info, source_url, source, ex); - if (camel_exception_is_set (ex)) { - report_status (driver, FILTER_STATUS_END, "Failed at message %d of %d", i+1, uids->len); - break; - } - - if (remove) - camel_folder_set_message_flags (folder, uids->pdata[i], - CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED); - - camel_object_unref (CAMEL_OBJECT (message)); - } - - if (freeuids) - camel_folder_free_uids (folder, uids); - - if (p->defaultfolder) - camel_folder_sync (p->defaultfolder, FALSE, ex); - - g_free (source_url); -} - -void -filter_driver_filter_message (FilterDriver *driver, CamelMimeMessage *message, CamelMessageInfo *info, - const char *source_url, const char *source, CamelException *ex) -{ - struct _FilterDriverPrivate *p = _PRIVATE (driver); - ESExpResult *r; - GString *fsearch, *faction; - FilterFilter *rule; - gboolean freeinfo = FALSE; - gboolean filtered = FALSE; - - if (info == NULL) { - struct _header_raw *h = CAMEL_MIME_PART (message)->headers; - - info = camel_message_info_new_from_header (h); - freeinfo = TRUE; - } else { - if (info->flags & CAMEL_MESSAGE_DELETED) - return; - } - - p->ex = ex; - p->terminated = FALSE; - p->deleted = FALSE; - p->copied = FALSE; - p->message = message; - p->info = info; - - fsearch = g_string_new (""); - faction = g_string_new (""); - - rule = NULL; - while ((rule = (FilterFilter *)rule_context_next_rule ((RuleContext *)p->context, (FilterRule *)rule, source))) { - gboolean matched; - - g_string_truncate (fsearch, 0); - g_string_truncate (faction, 0); - - filter_rule_build_code (FILTER_RULE (rule), fsearch); - filter_filter_build_action (rule, faction); - - d(fprintf (stderr, "applying rule %s\n action %s\n", fsearch->str, faction->str)); - - matched = filter_message_search (p->message, p->info, source_url, fsearch->str, p->ex); - - if (matched) { - filtered = TRUE; - filter_driver_log (driver, FILTER_LOG_START, FILTER_RULE (rule)->name); -#ifndef NO_WARNINGS -#warning "Must check expression parsed and executed properly?" -#endif - /* perform necessary filtering actions */ - e_sexp_input_text (p->eval, faction->str, strlen (faction->str)); - e_sexp_parse (p->eval); - r = e_sexp_eval (p->eval); - e_sexp_result_free (r); - if (p->terminated) - break; - } - } - - g_string_free (fsearch, TRUE); - g_string_free (faction, TRUE); - - /* *Now* we can set the DELETED flag... */ - if (p->deleted) - info->flags = info->flags | CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_FOLDER_FLAGGED; - - /* Logic: if !Moved and there exists a default folder... */ - if (!(p->copied && p->deleted) && p->defaultfolder) { - /* copy it to the default inbox */ - filtered = TRUE; - filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to default folder"); - camel_folder_append_message (p->defaultfolder, p->message, p->info, p->ex); - } - - if (freeinfo) - camel_message_info_free (info); - - if (filtered) - filter_driver_log (driver, FILTER_LOG_END, NULL); -} diff --git a/filter/filter-message-search.c b/filter/filter-message-search.c deleted file mode 100644 index 415bdb170c..0000000000 --- a/filter/filter-message-search.c +++ /dev/null @@ -1,806 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@helixcode.com> - * - * Copyright 2000 Helix Code, Inc. (www.helixcode.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "filter-message-search.h" -#include <gal/widgets/e-unicode.h> -#include <e-util/e-sexp.h> -#include <regex.h> -#include <string.h> -#include <ctype.h> - -typedef struct { - CamelMimeMessage *message; - CamelMessageInfo *info; - const char *source; - CamelException *ex; -} FilterMessageSearch; - -/* ESExp callbacks */ -static ESExpResult *header_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *header_matches (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *header_starts_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *header_ends_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *header_exists (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *header_soundex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *header_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *header_full_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *match_all (struct _ESExp *f, int argc, struct _ESExpTerm **argv, FilterMessageSearch *fms); -static ESExpResult *body_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *body_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *user_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *user_tag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *system_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *get_sent_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *get_received_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *get_current_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *get_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *get_source (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); - -/* builtin functions */ -static struct { - char *name; - ESExpFunc *func; - int type; /* set to 1 if a function can perform shortcut evaluation, or - doesn't execute everything, 0 otherwise */ -} symbols[] = { - { "match-all", (ESExpFunc *) match_all, 0 }, - { "body-contains", (ESExpFunc *) body_contains, 0 }, - { "body-regex", (ESExpFunc *) body_regex, 0 }, - { "header-contains", (ESExpFunc *) header_contains, 0 }, - { "header-matches", (ESExpFunc *) header_matches, 0 }, - { "header-starts-with", (ESExpFunc *) header_starts_with, 0 }, - { "header-ends-with", (ESExpFunc *) header_ends_with, 0 }, - { "header-exists", (ESExpFunc *) header_exists, 0 }, - { "header-soundex", (ESExpFunc *) header_soundex, 0 }, - { "header-regex", (ESExpFunc *) header_regex, 0 }, - { "header-full-regex", (ESExpFunc *) header_full_regex, 0 }, - { "user-tag", (ESExpFunc *) user_tag, 0 }, - { "user-flag", (ESExpFunc *) user_flag, 0 }, - { "system-flag", (ESExpFunc *) system_flag, 0 }, - { "get-sent-date", (ESExpFunc *) get_sent_date, 0 }, - { "get-received-date", (ESExpFunc *) get_received_date, 0 }, - { "get-current-date", (ESExpFunc *) get_current_date, 0 }, - { "get-score", (ESExpFunc *) get_score, 0 }, - { "get-source", (ESExpFunc *) get_source, 0 }, -}; - -static ESExpResult * -header_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - gboolean matched = FALSE; - ESExpResult *r; - - if (argc == 2) { - char *header = (argv[0])->value.string; - char *match = (argv[1])->value.string; - const char *contents; - - contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header); - - if (contents) { - if (e_utf8_strstrcase (contents, match)) - matched = TRUE; - } - } - - r = e_sexp_result_new (ESEXP_RES_BOOL); - r->value.bool = matched; - - return r; -} - -static ESExpResult * -header_matches (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - gboolean matched = FALSE; - ESExpResult *r; - - if (argc == 2) { - char *header = (argv[0])->value.string; - char *match = (argv[1])->value.string; - const char *contents; - - contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header); - - if (contents) { - /* danw says to use search-engine style matching... - * This means that if the search match string is - * lowercase then compare case-insensitive else - * compare case-sensitive. */ - gboolean is_lowercase = TRUE; - char *c; - - /* remove any leading white space... */ - for ( ; *contents && isspace (*contents); contents++); - - for (c = match; *c; c++) { - if (isalpha (*c) && isupper (*c)) { - is_lowercase = FALSE; - break; - } - } - - if (is_lowercase) { - if (!g_strcasecmp (contents, match)) - matched = TRUE; - } else { - if (!strcmp (contents, match)) - matched = TRUE; - } - } - } - - r = e_sexp_result_new (ESEXP_RES_BOOL); - r->value.bool = matched; - - return r; -} - -static ESExpResult * -header_starts_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - gboolean matched = FALSE; - ESExpResult *r; - - if (argc == 2) { - char *header = (argv[0])->value.string; - char *match = (argv[1])->value.string; - const char *contents; - - contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header); - - if (contents && strlen (contents) >= strlen (match)) { - /* danw says to use search-engine style matching... - * This means that if the search match string is - * lowercase then compare case-insensitive else - * compare case-sensitive. */ - gboolean is_lowercase = TRUE; - char *c; - - /* remove any leading white space... */ - for ( ; *contents && isspace (*contents); contents++); - - for (c = match; *c; c++) { - if (isalpha (*c) && isupper (*c)) { - is_lowercase = FALSE; - break; - } - } - - if (is_lowercase) { - if (!g_strncasecmp (contents, match, strlen (match))) - matched = TRUE; - } else { - if (!strncmp (contents, match, strlen (match))) - matched = TRUE; - } - } - } - - r = e_sexp_result_new (ESEXP_RES_BOOL); - r->value.bool = matched; - - return r; -} - -static ESExpResult * -header_ends_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - gboolean matched = FALSE; - ESExpResult *r; - - if (argc == 2) { - char *header = (argv[0])->value.string; - char *match = (argv[1])->value.string; - const char *contents; - - contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header); - - if (contents && strlen (contents) >= strlen (match)) { - /* danw says to use search-engine style matching... - * This means that if the search match string is - * lowercase then compare case-insensitive else - * compare case-sensitive. */ - gboolean is_lowercase = TRUE; - char *c, *end; - - /* remove any leading white space... */ - for ( ; *contents && isspace (*contents); contents++); - - for (c = match; *c; c++) { - if (isalpha (*c) && isupper (*c)) { - is_lowercase = FALSE; - break; - } - } - - end = (char *) contents + strlen (contents) - strlen (match); - - if (is_lowercase) { - if (!g_strcasecmp (end, match)) - matched = TRUE; - } else { - if (!strcmp (end, match)) - matched = TRUE; - } - } - } - - r = e_sexp_result_new (ESEXP_RES_BOOL); - r->value.bool = matched; - - return r; -} - -static ESExpResult * -header_exists (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - gboolean matched = FALSE; - ESExpResult *r; - - if (argc == 1) { - char *header = (argv[0])->value.string; - const char *contents; - - contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header); - - if (contents) - matched = TRUE; - } - - r = e_sexp_result_new (ESEXP_RES_BOOL); - r->value.bool = matched; - - return r; -} - -static unsigned char soundex_table[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 49, 50, 51, 0, 49, 50, 0, 0, 50, 50, 52, 53, 53, 0, - 49, 50, 54, 50, 51, 0, 49, 0, 50, 0, 50, 0, 0, 0, 0, 0, - 0, 0, 49, 50, 51, 0, 49, 50, 0, 0, 50, 50, 52, 53, 53, 0, - 49, 50, 54, 50, 51, 0, 49, 0, 50, 0, 50, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -}; - -static void -soundexify (const gchar *sound, gchar code[5]) -{ - guchar *c, last = '\0'; - gint n; - - for (c = (guchar *) sound; *c && !isalpha (*c); c++); - code[0] = toupper (*c); - memset (code + 1, '0', 3); - for (n = 1; *c && n < 5; c++) { - guchar ch = soundex_table[*c]; - - if (ch && ch != last) { - code[n++] = ch; - last = ch; - } - } - code[4] = '\0'; -} - -static gint -soundexcmp (const gchar *sound1, const gchar *sound2) -{ - gchar code1[5], code2[5]; - - soundexify (sound1, code1); - soundexify (sound2, code2); - - return strcmp (code1, code2); -} - -static ESExpResult * -header_soundex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - gboolean matched = FALSE; - ESExpResult *r; - - if (argc == 2) { - char *header = (argv[0])->value.string; - char *match = (argv[1])->value.string; - const char *contents; - - contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header); - - if (contents) { - /* remove any leading white space... */ - for ( ; *contents && isspace (*contents); contents++); - - if (!soundexcmp (contents, match)) - matched = TRUE; - } - } - - r = e_sexp_result_new (ESEXP_RES_BOOL); - r->value.bool = matched; - - return r; -} - -static ESExpResult * -header_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - gboolean matched = FALSE; - ESExpResult *r; - - if (argc == 2) { - char *header = (argv[0])->value.string; - char *match = (argv[1])->value.string; - regex_t regexpat; /* regex patern */ - regmatch_t *fltmatch; - gint regerr = 0; - size_t reglen = 0; - gchar *regmsg; - const char *contents; - - contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header); - - regerr = regcomp (®expat, match, REG_EXTENDED | REG_NEWLINE | REG_ICASE); - if (regerr) { - /* regerror gets called twice to get the full error string - length to do proper posix error reporting */ - reglen = regerror (regerr, ®expat, 0, 0); - regmsg = g_malloc0 (reglen + 1); - regerror (regerr, ®expat, regmsg, reglen); - camel_exception_setv (fms->ex, CAMEL_EXCEPTION_SYSTEM, - _("Failed to perform regex search on message header: %s"), - regmsg); - g_free (regmsg); - regfree (®expat); - } else { - if (contents) { - fltmatch = g_new0 (regmatch_t, regexpat.re_nsub); - - if (!regexec (®expat, contents, regexpat.re_nsub, fltmatch, 0)) - matched = TRUE; - - g_free (fltmatch); - regfree (®expat); - } - } - } - - r = e_sexp_result_new (ESEXP_RES_BOOL); - r->value.bool = matched; - - return r; -} - -static gchar * -get_full_header (CamelMimeMessage *message) -{ - CamelMimePart *mp = CAMEL_MIME_PART (message); - GString *str = g_string_new (""); - char *ret; - struct _header_raw *h; - - for (h = mp->headers; h; h = h->next) { - if (h->value != NULL) - g_string_sprintfa (str, "%s%s%s\n", h->name, - isspace (h->value[0]) ? ":" : ": ", h->value); - } - - ret = str->str; - g_string_free (str, FALSE); - - return ret; -} - -static ESExpResult * -header_full_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - gboolean matched = FALSE; - ESExpResult *r; - - if (argc == 1) { - char *match = (argv[0])->value.string; - regex_t regexpat; /* regex patern */ - regmatch_t *fltmatch; - gint regerr = 0; - size_t reglen = 0; - gchar *regmsg; - char *contents; - - contents = get_full_header (fms->message); - - regerr = regcomp (®expat, match, REG_EXTENDED | REG_NEWLINE | REG_ICASE); - if (regerr) { - /* regerror gets called twice to get the full error string - length to do proper posix error reporting */ - reglen = regerror (regerr, ®expat, 0, 0); - regmsg = g_malloc0 (reglen + 1); - regerror (regerr, ®expat, regmsg, reglen); - camel_exception_setv (fms->ex, CAMEL_EXCEPTION_SYSTEM, - _("Failed to perform regex search on message header: %s"), - regmsg); - g_free (regmsg); - regfree (®expat); - } else { - if (contents) { - fltmatch = g_new0 (regmatch_t, regexpat.re_nsub); - - if (!regexec (®expat, contents, regexpat.re_nsub, fltmatch, 0)) - matched = TRUE; - - g_free (fltmatch); - regfree (®expat); - } - } - g_free (contents); - } - - r = e_sexp_result_new (ESEXP_RES_BOOL); - r->value.bool = matched; - - return r; -} - -static ESExpResult * -match_all (struct _ESExp *f, int argc, struct _ESExpTerm **argv, FilterMessageSearch *fms) -{ - /* match-all: when dealing with single messages is a no-op */ - ESExpResult *r; - - r = e_sexp_result_new (ESEXP_RES_BOOL); - if (argv[0]->type == ESEXP_RES_BOOL) - r->value.bool = argv[0]->value.bool; - else - r->value.bool = FALSE; - - return r; -} - -static gboolean -mime_part_matches (CamelMimePart *mime_part, const char *match, gboolean regex, CamelException *ex) -{ - CamelStream *stream; - GByteArray *array; - char *text; - regex_t regexpat; /* regex patern */ - regmatch_t *fltmatch; - gint regerr = 0; - size_t reglen = 0; - gchar *regmsg; - gboolean matched = FALSE; - - array = g_byte_array_new (); - stream = camel_stream_mem_new_with_byte_array (array); - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (mime_part), stream); - camel_object_unref (CAMEL_OBJECT (stream)); - - g_byte_array_append (array, "", 1); - - text = array->data; - - if (regex) { - regerr = regcomp (®expat, match, REG_EXTENDED | REG_NEWLINE | REG_ICASE); - if (regerr) { - /* regerror gets called twice to get the full error string - length to do proper posix error reporting */ - reglen = regerror (regerr, ®expat, 0, 0); - regmsg = g_malloc0 (reglen + 1); - regerror (regerr, ®expat, regmsg, reglen); - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - "Failed to perform regex search on message body: %s", - regmsg); - g_free (regmsg); - regfree (®expat); - } else { - fltmatch = g_new0 (regmatch_t, regexpat.re_nsub); - - if (!regexec (®expat, text, regexpat.re_nsub, fltmatch, 0)) - matched = TRUE; - - g_free (fltmatch); - regfree (®expat); - } - } else { - if (strstr (text, match)) - matched = TRUE; - } - - g_byte_array_free (array, TRUE); - - return matched; -} - -static gboolean -handle_multipart (CamelMultipart *multipart, const char *match, gboolean regex, CamelException *ex) -{ - gboolean matched = FALSE; - int i, nparts; - - nparts = camel_multipart_get_number (multipart); - - for (i = 0; i < nparts && !matched; i++) { - CamelContentType *content; - CamelMimePart *mime_part; - - mime_part = camel_multipart_get_part (multipart, i); - content = camel_mime_part_get_content_type (mime_part); - - if (header_content_type_is (content, "text", "*")) { - /* we only want to match text parts */ - matched = mime_part_matches (mime_part, match, regex, ex); - - if (camel_exception_is_set (ex)) - break; - } else if (header_content_type_is (content, "multipart", "*")) { - CamelDataWrapper *wrapper; - CamelMultipart *mpart; - - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); - mpart = CAMEL_MULTIPART (wrapper); - - matched = handle_multipart (mpart, match, regex, ex); - - if (camel_exception_is_set (ex)) - break; - } - } - - return matched; -} - -static ESExpResult * -body_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - gboolean matched = FALSE; - ESExpResult *r; - - if (argc > 0) { - CamelContentType *content; - char *match; - - match = (*argv)->value.string; - - content = camel_mime_part_get_content_type (CAMEL_MIME_PART (fms->message)); - - if (header_content_type_is (content, "multipart", "*")) { - CamelDataWrapper *wrapper; - CamelMultipart *multipart; - - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (CAMEL_MIME_PART (fms->message))); - multipart = CAMEL_MULTIPART (wrapper); - - matched = handle_multipart (multipart, match, FALSE, fms->ex); - } else { - /* single-part message so just search the entire message */ - matched = mime_part_matches (CAMEL_MIME_PART (fms->message), match, FALSE, fms->ex); - } - } - - r = e_sexp_result_new (ESEXP_RES_BOOL); - r->value.bool = matched; - - return r; -} - -static ESExpResult * -body_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - gboolean matched = FALSE; - ESExpResult *r; - - if (argc > 0) { - CamelContentType *content; - char *match; - - match = (*argv)->value.string; - - content = camel_mime_part_get_content_type (CAMEL_MIME_PART (fms->message)); - - if (header_content_type_is (content, "multipart", "*")) { - CamelDataWrapper *wrapper; - CamelMultipart *multipart; - - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (CAMEL_MIME_PART (fms->message))); - multipart = CAMEL_MULTIPART (wrapper); - - matched = handle_multipart (multipart, match, TRUE, fms->ex); - } else { - /* single-part message so just search the entire message */ - matched = mime_part_matches (CAMEL_MIME_PART (fms->message), match, TRUE, fms->ex); - } - } - - r = e_sexp_result_new (ESEXP_RES_BOOL); - r->value.bool = matched; - - return r; -} - -static ESExpResult * -user_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - ESExpResult *r; - gboolean truth = FALSE; - int i; - - /* performs an OR of all words */ - for (i = 0; i < argc && !truth; i++) { - if (argv[i]->type == ESEXP_RES_STRING - && camel_flag_get (&fms->info->user_flags, argv[i]->value.string)) { - truth = TRUE; - break; - } - } - - r = e_sexp_result_new (ESEXP_RES_BOOL); - r->value.bool = truth; - - return r; -} - -static ESExpResult * -system_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - ESExpResult *r; - gboolean truth = FALSE; - - if (argc == 1) - truth = camel_system_flag_get (fms->info->flags, argv[0]->value.string); - - r = e_sexp_result_new (ESEXP_RES_BOOL); - r->value.bool = truth; - - return r; -} - -static ESExpResult * -user_tag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - ESExpResult *r; - const char *tag; - - tag = camel_tag_get (&fms->info->user_tags, argv[0]->value.string); - - r = e_sexp_result_new (ESEXP_RES_STRING); - r->value.string = g_strdup (tag ? tag : ""); - - return r; -} - -static ESExpResult * -get_sent_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - ESExpResult *r; - - r = e_sexp_result_new(ESEXP_RES_INT); - r->value.number = camel_mime_message_get_date(fms->message, NULL); - - return r; -} - -static ESExpResult * -get_received_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - ESExpResult *r; - - r = e_sexp_result_new(ESEXP_RES_INT); - r->value.number = camel_mime_message_get_date_received(fms->message, NULL); - - return r; -} - -static ESExpResult * -get_current_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - ESExpResult *r; - - r = e_sexp_result_new (ESEXP_RES_INT); - r->value.number = time (NULL); - - return r; -} - -static ESExpResult * -get_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - ESExpResult *r; - const char *tag; - - tag = camel_tag_get (&fms->info->user_tags, "score"); - - r = e_sexp_result_new (ESEXP_RES_INT); - if (tag) - r->value.number = atoi (tag); - else - r->value.number = 0; - - return r; -} - -static ESExpResult * -get_source (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) -{ - ESExpResult *r; - - r = e_sexp_result_new (ESEXP_RES_STRING); - r->value.string = g_strdup (fms->source); - - return r; -} - -gboolean -filter_message_search (CamelMimeMessage *message, CamelMessageInfo *info, - const char *source, const char *expression, CamelException *ex) -{ - FilterMessageSearch *fms; - ESExp *sexp; - ESExpResult *result; - gboolean retval; - int i; - - fms = g_new (FilterMessageSearch, 1); - fms->message = message; - fms->info = info; - fms->source = source; - fms->ex = ex; - - sexp = e_sexp_new (); - - for (i = 0; i < sizeof (symbols) / sizeof (symbols[0]); i++) { - if (symbols[i].type == 1) { - e_sexp_add_ifunction (sexp, 0, symbols[i].name, - (ESExpIFunc *)symbols[i].func, fms); - } else { - e_sexp_add_function (sexp, 0, symbols[i].name, - symbols[i].func, fms); - } - } - - e_sexp_input_text (sexp, expression, strlen (expression)); - e_sexp_parse (sexp); - result = e_sexp_eval (sexp); - - g_free (fms); - - if (result->type == ESEXP_RES_BOOL) - retval = result->value.bool; - else - retval = FALSE; - - e_sexp_unref(sexp); - e_sexp_result_free (result); - - return retval; -} diff --git a/filter/filter.glade b/filter/filter.glade index 259234acbe..96eeb3dc63 100644 --- a/filter/filter.glade +++ b/filter/filter.glade @@ -459,72 +459,219 @@ Outgoing </child> <widget> - <class>GtkVBox</class> - <name>vbox3</name> + <class>GtkHBox</class> + <name>hbox3</name> <homogeneous>False</homogeneous> <spacing>0</spacing> <widget> - <class>GtkOptionMenu</class> - <name>source_option</name> - <can_focus>True</can_focus> - <items>specific folders only -with all local folders -with all active remote folders -with all local and active remote folders -</items> - <initial_choice>0</initial_choice> + <class>GtkScrolledWindow</class> + <name>scrolledwindow3</name> + <width>256</width> + <height>125</height> + <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> + <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> + <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> + <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> <child> <padding>0</padding> - <expand>False</expand> - <fill>False</fill> + <expand>True</expand> + <fill>True</fill> </child> + + <widget> + <class>GtkViewport</class> + <name>viewport3</name> + <shadow_type>GTK_SHADOW_IN</shadow_type> + + <widget> + <class>GtkList</class> + <name>source_list</name> + <selection_mode>GTK_SELECTION_SINGLE</selection_mode> + </widget> + </widget> </widget> <widget> - <class>GtkHBox</class> - <name>hbox3</name> + <class>GtkVBox</class> + <name>vbox3</name> <homogeneous>False</homogeneous> <spacing>0</spacing> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow3</name> - <width>256</width> - <height>125</height> - <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + <class>GtkVButtonBox</class> + <name>vbuttonbox3</name> + <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style> + <spacing>0</spacing> + <child_min_width>85</child_min_width> + <child_min_height>27</child_min_height> + <child_ipad_x>6</child_ipad_x> + <child_ipad_y>0</child_ipad_y> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> <widget> - <class>GtkViewport</class> - <name>viewport3</name> - <shadow_type>GTK_SHADOW_IN</shadow_type> - - <widget> - <class>GtkList</class> - <name>source_list</name> - <selection_mode>GTK_SELECTION_SINGLE</selection_mode> - </widget> + <class>GtkButton</class> + <name>source_add</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <label>Add</label> + </widget> + + <widget> + <class>GtkButton</class> + <name>source_remove</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <label>Remove</label> + </widget> + </widget> + </widget> + </widget> + </widget> + </widget> +</widget> + +<widget> + <class>GnomeDialog</class> + <name>vfolder_source</name> + <type>GTK_WINDOW_TOPLEVEL</type> + <position>GTK_WIN_POS_NONE</position> + <modal>False</modal> + <allow_shrink>False</allow_shrink> + <allow_grow>False</allow_grow> + <auto_shrink>False</auto_shrink> + <auto_close>False</auto_close> + <hide_on_close>False</hide_on_close> + + <widget> + <class>GtkVBox</class> + <child_name>GnomeDialog:vbox</child_name> + <name>dialog-vbox3</name> + <homogeneous>False</homogeneous> + <spacing>8</spacing> + <child> + <padding>4</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkHButtonBox</class> + <child_name>GnomeDialog:action_area</child_name> + <name>dialog-action_area3</name> + <layout_style>GTK_BUTTONBOX_END</layout_style> + <spacing>8</spacing> + <child_min_width>85</child_min_width> + <child_min_height>27</child_min_height> + <child_ipad_x>7</child_ipad_x> + <child_ipad_y>0</child_ipad_y> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + <pack>GTK_PACK_END</pack> + </child> + + <widget> + <class>GtkButton</class> + <name>button16</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> + </widget> + + <widget> + <class>GtkButton</class> + <name>button17</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button> + </widget> + + <widget> + <class>GtkButton</class> + <name>button18</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> + </widget> + </widget> + + <widget> + <class>GtkFrame</class> + <name>vfolder_source_frame</name> + <label>vFolder Sources</label> + <label_xalign>0</label_xalign> + <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkHBox</class> + <name>hbox3</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + + <widget> + <class>GtkScrolledWindow</class> + <name>scrolledwindow3</name> + <width>256</width> + <height>125</height> + <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> + <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> + <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> + <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkViewport</class> + <name>viewport3</name> + <shadow_type>GTK_SHADOW_IN</shadow_type> + + <widget> + <class>GtkList</class> + <name>source_list</name> + <selection_mode>GTK_SELECTION_SINGLE</selection_mode> </widget> </widget> + </widget> + + <widget> + <class>GtkVBox</class> + <name>vbox3</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> <widget> - <class>GtkVBox</class> - <name>vbox3</name> - <homogeneous>False</homogeneous> + <class>GtkVButtonBox</class> + <name>vbuttonbox3</name> + <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style> <spacing>0</spacing> + <child_min_width>85</child_min_width> + <child_min_height>27</child_min_height> + <child_ipad_x>6</child_ipad_x> + <child_ipad_y>0</child_ipad_y> <child> <padding>0</padding> <expand>False</expand> @@ -532,35 +679,19 @@ with all local and active remote folders </child> <widget> - <class>GtkVButtonBox</class> - <name>vbuttonbox3</name> - <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style> - <spacing>0</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>6</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>source_add</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>Add</label> - </widget> - - <widget> - <class>GtkButton</class> - <name>source_remove</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>Remove</label> - </widget> + <class>GtkButton</class> + <name>source_add</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <label>Add</label> + </widget> + + <widget> + <class>GtkButton</class> + <name>source_remove</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <label>Remove</label> </widget> </widget> </widget> diff --git a/help/C/Makefile.am b/help/C/Makefile.am index 15f1e047b6..8bef9261e0 100644 --- a/help/C/Makefile.am +++ b/help/C/Makefile.am @@ -23,7 +23,7 @@ EXTRA_DIST = \ all: evolution-guide evolution-guide: $(SGML_FILES) - -db2html evolution-guide.sgml + cd $(srcdir) && db2html evolution-guide.sgml dist-hook: mkdir $(distdir)/evolution-guide diff --git a/help/ChangeLog b/help/ChangeLog index 407bbbdde6..3a8fcb257a 100644 --- a/help/ChangeLog +++ b/help/ChangeLog @@ -1,57 +1,8 @@ -2001-02-23 Aaron Weber <aaron@helixcode.com> +2001-02-15 Ettore Perazzoli <ettore@ximian.com> - * C/usage-mail.sgml: IMAP subscriptions stuff. + * C/Makefile.am (evolution-guide): Use `$<' instead of hardcoded + `evolution-guide.sgml'. -2001-02-21 Aaron Weber <aaron@helixcode.com> - - * C/usage-mail.sgml: Advanced search/show all/save search stuff. - - * C/evolution.sgml: This file replaces evolution-guide.sgml, for Nautilus Readiness. - - * C/apx-gloss.sgml: glossterm conduit. - - * C/config-sync.sgml: Glossterm conduit. - - * C/preface.sgml: Checked over for Keyboard-Shortcut and other truthfulness. - -2001-02-15 Aaron Weber <aaron@helixcode.com> - - * C/evolution-guide.sgml: Validated. Verified. Markup fixed in - several individual files. - - * C/apx-gpl.sgml: cvs-removed for GNOME 1.4 compliance. - - * C/apx-fdl.sgml: cvs-removed for GNOME 1.4 compliance. - -2001-02-09 Aaron Weber <aaron@helixcode.com> - - * C/config-sync.sgml: Overhaul. Now accurate and truthful and clear. - - * C/usage-calendar.sgml: Minor Changes. - -2001-02-08 Aaron Weber <aaron@helixcode.com> - - * C/usage-contact.sgml: Minor Changes. - - * C/usage-mail.sgml: Minor Changes. - -2001-02-07 Aaron Weber <aaron@helixcode.com> - - * C/menuref.sgml: Added section, but left blank til UI stabilizes. - - * C/usage-exec-summary.sgml: A little functionality described. - - * C/usage-mainwindow.sgml: Added tasks and Exec-summary. - - * C/usage-calendar.sgml: Describe semi-autonomy of task pad. - -2001-02-06 Aaron Weber <aaron@ximian.com> - - * C/usage-contact.sgml: s/contact manager/address book/ and - revised text. - - * C/usage-exec-summary.sgml: New file. Describes Executive Summary. - 2001-01-19 Aaron Weber <aaron@helixcode.com> * C/usage-mail.sgml: More of Megan's revisions, and Field Chooser diff --git a/help/devel/ChangeLog b/help/devel/ChangeLog index d00a1df434..d12c496648 100644 --- a/help/devel/ChangeLog +++ b/help/devel/ChangeLog @@ -1,3 +1,12 @@ +2001-03-13 Ettore Perazzoli <ettore@ximian.com> + + * calendar/cal-client/Makefile.am (install-data-local): Use + `$(srcdir)' properly so it works when it's different from the + `$(builddir)'. + * calendar/cal-util/Makefile.am (install-data-local): Likewise. + * importer/Makefile.am (install-data-local): Likewise. + * executive-summary/Makefile.am (install-data-local): Likewise. + 2001-01-26 John R. Sheets <dusk@ravendusk.org> * importer/Makefile.am: Change (nonexistant) importer.sgml diff --git a/help/devel/calendar/cal-client/Makefile.am b/help/devel/calendar/cal-client/Makefile.am index f3a2b39ec6..23a05e6a43 100644 --- a/help/devel/calendar/cal-client/Makefile.am +++ b/help/devel/calendar/cal-client/Makefile.am @@ -117,8 +117,8 @@ maintainer-clean-local: clean install-data-local: $(mkinstalldirs) $(DOC_DIR) - for i in $(DOC_DIR_INSTALL_FILES); do \ - $(INSTALL_DATA) $$i $(DOC_DIR); \ + for i in $(DOC_DIR_INSTALL_FILES); do \ + $(INSTALL_DATA) $(srcdir)/$$i $(DOC_DIR); \ done dist-hook: diff --git a/help/devel/calendar/cal-util/Makefile.am b/help/devel/calendar/cal-util/Makefile.am index 7f567652ef..e6ef51c02c 100644 --- a/help/devel/calendar/cal-util/Makefile.am +++ b/help/devel/calendar/cal-util/Makefile.am @@ -128,8 +128,8 @@ maintainer-clean-local: clean install-data-local: $(mkinstalldirs) $(DOC_DIR) - for i in $(DOC_DIR_INSTALL_FILES); do \ - $(INSTALL_DATA) $$i $(DOC_DIR); \ + for i in $(DOC_DIR_INSTALL_FILES); do \ + $(INSTALL_DATA) $(srcdir)/$$i $(DOC_DIR); \ done dist-hook: diff --git a/help/devel/executive-summary/Makefile.am b/help/devel/executive-summary/Makefile.am index 9aa53af4ec..50246b4abb 100644 --- a/help/devel/executive-summary/Makefile.am +++ b/help/devel/executive-summary/Makefile.am @@ -27,22 +27,22 @@ DOC_DIR_INSTALL_FILES = \ evolution-services-decl.txt \ evolution-services-sections.txt -SOURCE_FILES = \ - $(top_srcdir)/executive-summary/evolution-services/executive-summary-component.c \ - $(top_srcdir)/executive-summary/evolution-services/executive-summary-component-factory-client.c \ +SOURCE_FILES = \ + $(top_srcdir)/executive-summary/evolution-services/executive-summary-component.c \ + $(top_srcdir)/executive-summary/evolution-services/executive-summary-component-factory-client.c \ $(top_srcdir)/executive-summary/evolution-services/executive-summary-html-view.c IGNORED_HEADER_FILES = \ Executive-Summary.h - -scan_generated = \ + +scan_generated = \ evolution-services-decl.txt \ evolution-services.args \ evolution-services.hierarchy \ evolution-services.signals \ evolution-services.types -tmpl_dependencies = \ +tmpl_dependencies = \ evolution-services-decl.txt \ evolution-services-sections.txt \ evolution-services.args \ @@ -112,7 +112,7 @@ maintainer-clean-local: clean install-data-local: $(mkinstalldirs) $(DOC_DIR) for i in $(DOC_DIR_INSTALL_FILES); do \ - $(INSTALL_DATA) $$i $(DOC_DIR); \ + $(INSTALL_DATA) $(srcdir)/$$i $(DOC_DIR); \ done dist-hook: diff --git a/help/devel/importer/Makefile.am b/help/devel/importer/Makefile.am index ef3b2b98ee..52c9ed598b 100644 --- a/help/devel/importer/Makefile.am +++ b/help/devel/importer/Makefile.am @@ -113,8 +113,8 @@ maintainer-clean-local: clean install-data-local: $(mkinstalldirs) $(DOC_DIR) - for i in $(DOC_DIR_INSTALL_FILES); do \ - $(INSTALL_DATA) $$i $(DOC_DIR); \ + for i in $(DOC_DIR_INSTALL_FILES); do \ + $(INSTALL_DATA) $(srcdir)/$$i $(DOC_DIR); \ done dist-hook: diff --git a/libical/ChangeLog b/libical/ChangeLog index 5deefa813c..857b35cc99 100644 --- a/libical/ChangeLog +++ b/libical/ChangeLog @@ -1,3 +1,10 @@ +2001-03-13 Ettore Perazzoli <ettore@ximian.com> + + * src/libical/Makefile.am (GENERATEDHEADERS): List all the built + sources except for `ical.h'. + (BUILT_SOURCES): Define as `$(GENERATEDHEADERS)' plus `ical.h'. + (ical.h): Depend on `$(GENERATEDHEADERS)'. + 2001-02-27 Ettore Perazzoli <ettore@ximian.com> * src/libical/Makefile.am (ical.h): Depend on `$(BUILT_SOURCES)', @@ -13,13 +20,6 @@ its NEEDS-ACTION rather than NEEDSACTION (icalparameter_as_ical_string): ditto -2001-02-06 Christopher James Lahey <clahey@ximian.com> - - * src/libical/icallangbind.c: Added a missing #include here. - - * src/libical/icalrecur.c (icalrecur_add_bydayrules): Copy the - passed in const vals since we change it. - 2001-02-05 JP Rosevear <jpr@ximian.com> * src/libical/icallangbind.c (icallangbind_get_property): Use the diff --git a/libical/src/libical/Makefile.am b/libical/src/libical/Makefile.am index 186e705060..bcfb08565a 100644 --- a/libical/src/libical/Makefile.am +++ b/libical/src/libical/Makefile.am @@ -82,8 +82,7 @@ COMBINEDHEADERS = \ $(top_srcdir)/src/libical/icalmime.h \ $(top_srcdir)/src/libical/icallangbind.h -BUILT_SOURCES = \ - ical.h \ +GENERATEDHEADERS = \ icalparameter.c \ icalparameter.h \ icalproperty.c \ @@ -92,7 +91,11 @@ BUILT_SOURCES = \ icalvalue.c \ icalvalue.h -ical.h: $(BUILT_SOURCES) +BUILT_SOURCES = \ + ical.h \ + $(GENERATEDHEADERS) + +ical.h: $(GENERATEDHEADERS) cat $(COMBINEDHEADERS) \ | egrep -v "#include.*\"ical" \ | egrep -v "#include.*\"pvl\.h\"" > ical.h diff --git a/libical/src/libical/icallangbind.c b/libical/src/libical/icallangbind.c index d52f491b93..56376bf5a2 100644 --- a/libical/src/libical/icallangbind.c +++ b/libical/src/libical/icallangbind.c @@ -19,7 +19,6 @@ ======================================================================*/ #include "ical.h" -#include <malloc.h> diff --git a/libical/src/libical/icalparameter.c.in b/libical/src/libical/icalparameter.c.in index 6ffb9b27eb..8c1448d73c 100644 --- a/libical/src/libical/icalparameter.c.in +++ b/libical/src/libical/icalparameter.c.in @@ -3,7 +3,7 @@ FILE: icalderivedparameters.{c,h} CREATOR: eric 09 May 1999 - $Id: icalparameter.c.in,v 1.4 2001/02/09 07:09:46 jpr Exp $ + $Id: icalparameter.c.in,v 1.3.2.1 2001/02/09 08:52:52 jpr Exp $ $Locker: $ diff --git a/mail/ChangeLog b/mail/ChangeLog index 3ccc35fc5e..d6b7aa8107 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,612 +1,11 @@ -2001-03-04 Michael Meeks <michael@ximian.com> - - * folder-browser-factory.c (free_pixmaps): impl. - (update_pixmaps): accelerate with cache. - -2001-03-13 Iain Holmes <iain@ximian.com> - - * Makefile.am: Removed the importers and created a subdirectory for them to - live happily as plugins. - - * mail-importer.c (mail_importer_create_folder): Modified the function to take - a BonoboListener for the callback. - (get_importer_list): Get a list of importer plugins. - (free_importer_list): Free the list of plugins. - (mail_importer_init): Initalise the list of plugins. - (main_importer_uninit): Unload the modules. - - * GNOME_Evolution_Mail.oaf.in: Remove the oaf_server entries for the importers. - - * importers/*: Copy the importers in here. - -2001-03-12 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_write): Make the transport save - whether or not it's supposed to use SSL as well. - (config_read): Read in whether or not we should remember the - transport password (for those that support SASL). - (mail_config_write): Save whether or not to save transport - passwords (needed for SASL enabled transports). - - * mail-ops.c (add_vtrash_info): Instead of always creating a new - vTrash folder, if the store already has a Trash folder, replace it - with the vTrash. Also, name the folder "Trash" instead of "vTrash" - and i18nify the name. - -2001-03-11 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.h: Added protection. - - * folder-browser-factory.c: Add ActionsEmptyTrash. By the way - - should we rename the bonobo verbs now that our menu structure has - changed? - - * mail-callbacks.c (empty_trash): New callback to empty ALL of the - trash folders. - -2001-03-10 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (send_queue_send): Remove our X-Evolution header - before we send. Also don't send messages that are marked for - deletion. - -2001-03-09 Jeffrey Stedfast <fejj@ximian.com> - - * mail-mt.c (mail_get_accept): New async function that will be - used for SSL certs later. - - * session.c (auth_callback): Changed to return a gpointer value. - (mail_session_accept_dialog): New function to handle the new - _ACCEPT authenticator mode. - -2001-03-08 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser-factory.c: Set the Forward->Quoted callback. - Also set the forward->Attachment callback. - - * mail-view.c (view_forward_msg): Specify FORWARD_ATTACHED. - - * mail-callbacks.c (forward_attached): Don't call - forward_messages() anymore...never really needed to. Just handle - it directly. - (forward_inlined): Specify FORWARD_INLINE as the flag argument. - (forward_quoted): New function sorta like forward_inlined except - this forwards the message quoted. - - * mail-tools.c (mail_tool_forward_message): New function to - prepare a message to be forwarded. - -2001-03-08 Jon Trowbridge <trow@ximian.com> - - * mail-format.c (write_field_row_begin): Added. Table row HTML - broken out into its own function. - (write_subject): Added. Emits the proper HTML for the subject - line. - (write_field_to_stream): #ifdef-ed out of existence. - (write_address): Take a CamelInternetAddress and spit out an - <object> tag with the appropriate <param>s. - - * mail-display.c (on_object_requested): Check for an "address" - object. If found, call... - (handle_embedded_address_object): ...this function, which creates - an AddressWidget bonobo control and passes in the necessary info. - I never really realized just quite how much GtkHTML kicks ass - until I figured out how to make this work. - -2001-03-08 Jeffrey Stedfast <fejj@ximian.com> - - * mail-vtrash.[c,h]: Removed from cvs - - * Makefile.am: Removed mail-vtrash.[c,h] - - * main.c: Don't #include "mail-vtrash" anymore. - - * component-factory.c: Add "vtrash" as a folder type we support. - (create_view): Kludgy-kludge around the vtrash type. - (owner_set_cb): Don't create the vTrash folder here anymore... - - * folder-browser.c (on_double_click): Call open_msg here so that - it does the Right Thing (tm). - -2001-03-08 Jeffrey Stedfast <fejj@ximian.com> - - * mail-local.c (mail_local_store_class_init): Override the default - init_trash() with the our custom one (since MailLocalStore doesn't - let the CamelStore keep a hash of opened folders and instead - keepts track of them itself). - (init_trash): custom implementation of the init_trash method for - MailLocalStores - (get_folder): i18nize. - (register_folder_registered): Don't add the folder to the vtrash - here. - -2001-03-08 Ettore Perazzoli <ettore@ximian.com> - - * component-factory.c (component_fn): Specify a NULL - `EvolutionShellComponentGetDndSelectionFn'. - -2001-03-07 Jeffrey Stedfast <fejj@ximian.com> - - * mail-autofilter.c (filter_rule_from_message): Add an action-part - widget. - (filter_rule_from_mlist): Same here. This should get rid of the - problem where people go to create a rule based on a message and - forget to fill-in the action part. - -2001-03-07 Jeffrey Stedfast <fejj@ximian.com> - - * mail-crypto.c (mail_crypto_is_smime_v3_signed): New function to - decide if a mime part is an S/MIME v3 signed part. - (mail_crypto_is_pkcs7_mime): New function to decide if a mime part - is an application/pkcs7-mime part (or an application/octet-stream - part with application/pkcs7-mime data). - - * mail-account-editor.c (source_auth_init): Move the signal - emittion to after the set_menu call so that it actually works. - (transport_type_changed): Updated to manipulate the user/passwd - fields for the transport. - (construct): Updated to init the user/passwd fields for the - transport. - (transport_auth_init): Renamed. Also fill in the user/passwd - fields if available. - -2001-03-06 Jeffrey Stedfast <fejj@ximian.com> - - * mail-accounts.c (construct): Disable the NNTP code if NNTP is - not enabled. This prevents some runtime warnings... - - * mail-config-druid.c: Updated to have a transport auth page. - -2001-03-01 Miguel de Icaza <miguel@ximian.com> - - * folder-browser.c (on_right_click): Move the context menus to - the toplevel code; Use enumerations for the various bitfield - constants. - - Add support for hiding items that are not required (read/unread - and delete/undelete). - - This requires my previous patch, as it assumes "Open" does the - right thing instead of having two operations: Open and Edit. - -2001-02-28 Miguel de Icaza <miguel@ximian.com> - - * folder-browser.c (on_right_click): Removed draft folders op - here, since open_msg now does the right thing (edit or view). - - * folder-browser-factory.c (update_pixmaps): Removed MessageEdit - from here. - - * mail-callbacks.c (open_msg): New function, does the "right - thing" to a message (either, edit or open). - - * folder-browser-factory.c: Register new command here. - (update_pixmaps): Rename keys that have been shuffled around. - (update_pixmaps): Rename to match new updates on xml file. - - Rename MessageOpenNewWindow to MessageOpen. Change action from - "view_message" to "open_message". - - * mail-callbacks.c (mark_all_as_seen): New command. Marks all - messages as seen. - -2001-03-06 Dan Winship <danw@ximian.com> - - * mail-ops.c (get_folderinfo_got): If the folderinfo has no URL - (ie, can't contain messages), don't add it as a vtrash source. - -2001-03-05 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config-druid.c: Don't access the `active` data member of a - GtkToggleButton directly - bad programming, shame on me. - - * mail-account-editor.c: Same here. - - * mail-accounts.c: And here too. - - * mail-callbacks.c (empty_subject_destroyed): And finally here. - - * mail-crypto.c (pgp_mime_part_sign): Correcty set the mime type - for the multipart. Hmmm, still doesn't wrap correctly. NotZed? - Ideas? - (pgp_mime_part_encrypt): Here too. - -2001-03-03 Not Zed <NotZed@Ximian.com> - - * mail-tools.c: Remove very old camel lock stuff. - - * mail-local.c (register_folder_registered): Add the local folder - as a potential vfolder source. - - * folder-browser.c (got_folder): When we have a new folder, - register it as a potential vfolder source. - - * mail-vfolder.c: Added the source rule to the vfolder_info. - (vfolder_refresh): Store the rule in the vfolder info, etc. - (vfolder_register_source): Function to register a newly opened - folder with us. - (vfolder_uri_to_folder): Save the folder in the vfolder_info too. - (source_finalise): Handle clenaup when the folder dies. - -2001-03-02 Not Zed <NotZed@Ximian.com> - - * mail-mt.c (set_stop): Check the container is not NIL before - trying to set thje prop. - -2001-03-01 Not Zed <NotZed@Ximian.com> - - * folder-browser.c (folder_browser_search_menu_activated): Fixes - for changes to search bar. - (search_save): Removed. - (search_full): Removed. - (search_full_clicked): Removed. - (folder_browser_search_option_items[]): Removed. - (folder_browser_search_query_changed): Changed for search bar - changes. - (folder_browser_clear_search): Removed. - - * mail-vfolder.c (vfolder_clone_rule): New function to clone a - filter/search rule into a matching vfolder rule. - - * mail-send-recv.c (mail_receive_uri): Setup a timeout for status - updates. - (build_dialogue): Setup timeout id for status updates. - (operation_status_timeout): New function to set the status via a - timeout. - (receive_done): Remove the timeout handler if we need to. - (operation_status): - (receive_status): Just update the info, and let the timeout - handler update the gui. - (do_free_status): - (do_show_status): Removed gui thread status message processing. - -2001-02-28 Not Zed <NotZed@Ximian.com> - - * folder-browser.c (folder_browser_config_search): New function to - configure the FilterRule for the search mechanism. - -2001-02-27 Not Zed <NotZed@Ximian.com> - - * folder-browser.c (folder_browser_gui_init): Setup the search bar - as a filterbar. - (got_folder): Set the whole search bar sensitive or not based on - the search capability of the folder. - - * folder-browser.h: Changed to use efilterbar instead of esearchbar. - -2001-02-27 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (configure_mail): Return TRUE if the user - configured his/her settings, else return FALSE. - (check_send_configuration): If configure_mail() returns TRUE, then - continue otherwise quit. - (send_receive_mail): Same. - 2001-02-26 Jeffrey Stedfast <fejj@ximian.com> - * mail-callbacks.c (mail_generate_reply): Set a "References" - header no matter what if we are able to get a Message-Id. Fixes - bug #1583. - - * mail-accounts.c (mail_delete): Confirm that the user REALLY - wants to delete this account. - (news_delete): Same. - - * mail-ops.c (mail_send_message): Changed the product string - - will change it to use User-Agent once I get the RFC/DRUMS draft or - whatever. Until then I'll stick with User-Agent. - -2001-02-26 Dan Winship <danw@ximian.com> - - * mail-callbacks.c (delete_msg): Mark deleted messages as "seen" - as well so they don't count towards the unread count. - - * mail-view.c (view_delete_msg): ditto - -2001-02-25 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (owner_set_cb): Re-add the - mail_vtrash_create() hack back in for LocalStores since there's no - better way to register a vTrash folder on the Local Storage yet. - - * mail-local.c (register_folder_registered): Add folders to the - vTrash folder here since the LocalStore does not let the parent - CamelStore class keep it's own hash of the folders. - -2001-02-25 Jeffrey Stedfast <fejj@ximian.com> - - * session.c (mail_session_forget_password): New function to force - the removal of a given password. - - * openpgp-utils.c (openpgp_decrypt): On failure, forget the - passphrase. - (openpgp_encrypt): Here too. (cleaned this up a bit too) - (openpgp_clearsign): And here. - (openpgp_sign): Again... - - * mail-callbacks.c (composer_postpone_cb): Abort if the message is - NULL (which is valid if an error occured). - (composer_send_cb): Same. - -2001-02-24 Jeffrey Stedfast <fejj@ximian.com> - - * folder-browser.c: Toss the mail_tool_camel_lock* stuff. - * mail-ops.c: Same. - * mail-summary.c: Here too. - - * mail-tools.c (mail_tool_uri_to_folder_noex): Blown away! - (mail_tool_filter_get_folder_func): *kapoosh* - (mail_tool_camel_lock_up): Same. - (mail_tool_camel_lock_down): Same. - (mail_tool_set_uid_flags): Don't need this rubbish anymore either. - -2001-02-24 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (mail_load_storages): No longer need to - construct the vTrash here. - (owner_set_cb): Don't make the vTrash for the local store here. - - * mail-ops.c (add_vtrash_info): New function to add a vTrash - folder info to a pre-constructed CamelFolderInfo for use in the - get_folder_info async function. - -2001-02-23 Jeffrey Stedfast <fejj@ximian.com> - - * main.c (main): No longer need to do a vtrash_cleanup() (it also - doesn't exist anymore). - - * component-factory.c (mail_load_storages): Updated to use the new - vtrash code. - (owner_set_cb): Same. - - * mail-tools.c (mail_tool_uri_to_folder): Update to handle the - "vtrash:" url prefix so that we can extract the REAL uri and know - to get the trash folder. - - * mail-vtrash.c (mail_vtrash_add): Add the vTrash folder to the - EvolutionStorage. - (mail_vtrash_create): Get the store based on the uri (async) and - then call mail_trash_add. - (vtrash_cleanup): Removed. - (vtrash_uri_to_folder): Removed. - (vtrash_create): Replaced by mail_vtrash_create() - -2001-02-23 Iain Holmes <iain@ximian.com> - - * component-factory.c (owner_set_cb): Init the importer here. - - * mail-importer.[ch] (mail_importer_create_folder): Add a function - that creates new folders in the shell. - (mail_importer_init): Take in an EvolutionShellClient, and get the - local_storage corba_object from it. - -2001-02-22 Jeffrey Stedfast <fejj@ximian.com> - - * mail-vtrash.c (create_trash_vfolder): Come up with a unique - store uri for each vtrash (using %p and the CamelStore we're gonna - place it on). - (get_trash_get): Pass in the store so we can use it for %p. - -2001-02-23 Not Zed <NotZed@Ximian.com> - - * mail-vfolder.c (vfolder_gui_add_from_mlist): Rule to add mlist - vfolder. - - * mail-autofilter.c (filter_gui_add_for_mailing_list): Removed. - (rule_from_mlist): Build a generic match rule from an mlist. - (vfolder_rule_from_mlist): Setup the vfolder rule for an mlist. - (filter_rule_from_mlist): Setup a filter rule fro an mlist. - (filter_gui_add_from_mlist): GUI thingy to do the work. - - * folder-browser.c (on_right_click): Added vfolder on mailing list - to filter menu. - (on_right_click): Use header_raw_check_mailign_list instead of - mlist magic to get the mailing list name. - (filter_mlist): Changed to use new add_from_mlist() call. - (vfolder_mlist): New function for vfolder from mlist. - - * mail-send-recv.c (build_dialogue): Only allow downloading if the - source is enabled at this time. - (mail_autoreceive_setup): Check for enabled sources before setting - up autodownload. - -2001-02-22 Jeffrey Stedfast <fejj@ximian.com> - - * mail-accounts.c (construct): Construct the PGP Path - GnomeFileEntry widget. - (pgp_path_changed): Try to auto-detect which PGP type the binary - file is based on the basename (yuck). - -2001-02-23 Not Zed <NotZed@Ximian.com> - - * mail-ops.c (create_folder_get): Make op cancellable/report - internals. - (get_folder_get): - (sync_folder_sync): - (get_folderinfo_get): Make op cancellable/report internals. - - * mail-vtrash.c (get_trash_get): Setup the operation registration, - and create a pseudo "start/stop" operation. - (get_trash_free): Free store if we have it. - (get_trash_got): Move vtrash add into here, so we execute in the - right thread. - - * component-factory.c (owner_set_cb): Make trash creation async. - - * mail-local.c (register_folder_desc): A description of what we're - doing. - - * mail-mt.c (mail_msg_new): Set status callback to operation_new. - (mail_operation_status): Operation status function, proxy messages - to main thread, and attempt to present a meaningful ui experience - for operations. - -2001-02-22 Jeffrey Stedfast <fejj@ximian.com> - - * openpgp-utils.c (openpgp_verify): Fixed memory corruption bug. - - * mail-format.c (try_inline_pgp_sig): Check to make sure the - validity isn't NULL. - (handle_multipart_signed): Check for NULL validities. - -2001-02-21 Jeffrey Stedfast <fejj@ximian.com> + * mail-accounts.c: Backported code to provide an OpenPGP GUI + config thingy. - * mail-tools.c (mail_tool_uri_to_folder): Protect against NULL - uri's. - - * mail-vtrash.c: Do mutex locking on the global hash table - this - should clear up some segfaults ;-) - - * mail-config-druid.c (druid_finish): Set the 'enabled' member of - the source to TRUE if the URL exists else set to FALSE. - (incoming_type_changed): If the provider chosen is "None" then - gray-out the auto-check widgets and the check-settings, otherwise - sensitize them. - - * mail-account-editor.c (construct): Added a few more settings. - (apply_changes): Save the new settings. - - * mail-config.c (service_copy): Updated. - (config_read): Read in whether or not the account is enabled. - (mail_config_write): Save if the account is enabled or not. - -2001-02-22 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (mail_send_message): Updated to reflect changes to - the filter-driver code. - -2001-02-22 Not Zed <NotZed@Ximian.com> - - * Makefile.am (CAMEL_OBJS_EXTRA): Removed, no longer link with - libcamelvee. - (evolution_mail_LDADD): Ditto. - - * mail-vtrash.c: Moved camel-vee-store header ot camel levle. - - * mail-tools.c: Moved camel-vee-folder header to camel. - - * mail-local.c (local_storage_new_folder_cb): started hack for - progress reporting, which is currently to the console. - - * mail-mt.c (set_stop): Set the stop button sensitivity. - (mail_msg_received): enable/disable stop button while we're - processing stuff in another thread. - - * message-list.c (ml_tree_value_at): If our uid entry vanishes - before w'ere ready, then make a fake. - -2001-02-21 Jeffrey Stedfast <fejj@ximian.com> - - * mail-crypto.c (pgp_mime_part_verify): Changed to use - PgpValidity. - - * openpgp-utils.c (openpgp_verify): Return a PgpValidity and set - the description as UTF-8 for later use in mail-format.c when - writing to GtkHTML. - - * mail-format.c (try_inline_pgp_sig): Updated to use the new - PgpValidity code. - (handle_multipart_signed): Updated. - -2001-02-21 Not Zed <NotZed@Ximian.com> - - * mail-callbacks.c (composer_postpone_cb): Fix for api changes to - append_mail. - - * Makefile.am (evolution_mail_SOURCES): Removed mail-threads.[ch]. - - * mail-threads.[ch]: Removed. - - * subscribe-dialog.c (subscribe_do_get_store): Chagned to use new - thread stuff. This is really getting boring. - (subscribe_do_subscribe_folder): Changed to use new thread stuff. - Last one at last, phew. - - * session.c (register_callback): Changed to use new thread stuff. - YUCK. I dropped some functionality, now the timeout callback - return is ignored, so basically it keeps running till finished. - - * mail-ops.c (mail_operation_run): Removed, no longer used/needed. - (mail_do_append_mail): Changed to use new thread stuff. - (mail_do_transfer_messages): ditto. - - * mail-local.c (local_storage_new_folder_cb): Use new thread - stuff, also only run synchronous for this operation. - (mail_local_reconfigure_folder): - (reconfigure_clicked): Changed to use new mail thread stuff. - - * mail-config.c (mail_config_check_service): Changed to use new - thread stuff. - -2001-02-20 Dan Winship <danw@ximian.com> - - * mail-vtrash.c (get_trash_get): Pass NULL, not "/" for @top. - - * mail-callbacks.c (create_folders): Make this work with - CamelStores where the separator character isn't /. folder_created - and folder_deleted are still broken. - -2001-02-20 Not Zed <NotZed@Ximian.com> - - * mail-vtrash.c: Include the camel-vee-store.h header from the - uninstalled copy. - -2001-02-19 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (mail_load_storages): Create vTrash folders - for all remote stores as well. - -2001-02-20 Not Zed <NotZed@Ximian.com> - - * mail-vtrash.c (create_trash_vfolder): Add the auto-update flag - to the folder open flags. - -2001-02-19 Jeffrey Stedfast <fejj@ximian.com> - - * mail-vfolder.c (mail_vfolder_get_vfolder_storage): New handy - dandy function to ref and return the vfolder storage (will - probably be disavowed once I figure out how to get the vTrash - folder to show up in the EvolutionLocalStorage). - - * main.c (main): Call vtrash_cleanup(). - - * mail-vtrash.c: New file. - (vtrash_uri_to_folder): vtrash: URI handler - (vtrash_create): Replacement async vtrash function for the old one - in mail-ops.c - (vtrash_cleanup): Cleanup code - unrefs the cached vtrash folders - and free's the hashtable. - - * Makefile.am: Added mail-vtrash.[c,h]. - - * mail-tools.c (mail_tool_uri_to_folder): If we have a vtrash: - URI, call the vtrash URI handler function rather than continuing - on. Yes, I know this is a hack and it needs to be fixed. - - * mail-ops.c (mail_do_setup_trash): Removed. - (mail_trash_get): Removed. - - * component-factory.c (owner_set_cb): Create the vTrash folder for - the LocalStore here. - - * mail-local.c (get_folder_info): Implement. - -2001-02-20 Not Zed <NotZed@Ximian.com> - - * mail-ops.c (fetch_mail_fetch): Unref the driver here, in the - subthread, so we dont block the gui while it sync's all the - folders. - (fetch_mail_fetched): Rewmoved above code from here. - -2001-02-16 Not Zed <NotZed@Ximian.com> - - * mail-send-recv.c (receive_status): Dont do the thaw/freeze set here. - (update_folders): " - - * mail-vfolder.c (vfolder_refresh): Setup the virtual - 'unmatched' folder by default. - (vfolder_uri_to_folder): HAndle UNMATCHED folder specially, it has - no explicit sources. + * mail-ops.c (fetch_mail_fetch): Backported a fix to fix bug #1344 + which had to do with not redownloading mail even after "keep mail + on server" had been disabled. 2001-02-16 Jeffrey Stedfast <fejj@ximian.com> @@ -614,282 +13,24 @@ difference, but lets ref the folder while the hash table is locked rather than after we unlock it. -2001-02-16 Jeffrey Stedfast <fejj@ximian.com> - - * main.c: * component-factory.c: Reverse the changes I made - yesterday. - -2001-02-15 Jeffrey Stedfast <fejj@ximian.com> - - * main.c (main): Have the mail-config and openpgp initialize here - instead. - - * component-factory.c (owner_set_cb): No need to have mail-config - and openpgp init here. - -2001-02-15 Jeffrey Stedfast <fejj@ximian.com> - - * mail-ops.c (do_scan_subfolders): Use mail_storage_create_folder - - * mail-callbacks.c (mail_storage_create_folder): Convenience - function so we can keep all the evolution_storage_add_new_folder() - code in one place as much as possible. - - * subscribe-dialog.c (recursive_add_folder): Use 'name' rather - than the no-description bs since that's what all the other places - do. - - * mail-callbacks.c (folder_created): New callback to handle the - "folder_created" signal - handles CamelFolderInfo's recursively. - (folder_deleted): Same but for "folder_deleted". - - * component-factory.c (storage_create_folder): Instead of doing - the evolution_storage_new_folder() stuff by hand, pass it off to - the new callback: folder_created(). At some point this will be - unecessary as we'll attach this callback to the "folder_created" - signal. - -2001-02-15 Jeffrey Stedfast <fejj@ximian.com> - - * message-list.c: Wrapped the address compare functions in a - #ifdef - (address_compare): #ifdef the use of the smart address sorting - code and provide a #else for using g_strcasecmp(). - -2001-02-14 Jeffrey Stedfast <fejj@ximian.com> - - * openpgp-utils.c (openpgp_verify): Add the --no-tty flag. - -2001-02-14 Dan Winship <danw@ximian.com> - - * mail-mlist-magic.c: Rewrite explanatory comments to use normal - regexps rather than procmail weirdness. - (check_sender): match "foo-owner" as well as "owner-foo". - (check_list_post): (New) Check for "List-Post: <mailto:..." - (mail_mlist_magic_detect_list): Iterate through an array of - function pointers rather than calling each checker explicitly. - - * component-factory.c (add_storage): Connect to the - "create_folder" signal on the storage. - (storage_create_folder): Do folder creation. - -2001-02-14 Jeffrey Stedfast <fejj@ximian.com> - - * component-factory.c (owner_set_cb): Setup the Trash folder. - - * mail-ops.c (create_trash_vfolder): Do better error handling. - (populate_folder_urls): Oops, helps to strdup the url into the - array if we plan on freeing the data. - (mail_get_trash): New async function that may eventually replace - mail_do_setup_trash(). - (do_setup_trash): Do better error handling. - - * mail-local.c (mail_local_store_class_init): Override - get_folder_info. - (get_folder_info): Implement. - -2001-02-13 Christopher James Lahey <clahey@ximian.com> - - * mail-local.c (do_reconfigure_folder): Fix some uninitialized - variables. - -2001-02-12 Not Zed <NotZed@Ximian.com> - - * message-list.c (build_tree): if doing a full update, save the - cursor pos and restore it afterwards. - (on_cursor_activated_cmd): Copy the current_uid to a new string. - I dont know why this is required, but it is. - (message_list_destroy): Free the cursor_uid as we're done with it. - (build_flat): IF the current uid disappeared from the list, then - unset the message. - (build_tree): Likewise. - -2001-02-12 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config.c (mail_config_write): Clean out the cruft in the - Accounts section before writing the current accounts out to the - config file. - - * mail-account-editor.c (construct): Strip the leading "/" from - the Namespace/Path entry if the provider doesn't require absolute - pathnames. - -2001-02-12 Kjartan Maraas <kmaraas@gnome.org> - - * Makefile.am: xml-i18n-tools setup. - * GNOME_Evolution_Mail.oaf.in: Mark strings for translation. - -2001-02-11 Dan Winship <danw@ximian.com> - - * mail-callbacks.[ch]: Re-add non-static forward_messages. - mail-view.c needs it. - -2001-02-11 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (forward_inlined): Don't leak memory. - (forward_messages): change doinline to be a gboolean argument. - -2001-02-10 Jeffrey Stedfast <fejj@ximian.com> - - * mail-callbacks.c (list_add_addresses): Check the full list of - IDs instead of just the default id and if we find an address - matching one of the user's ids, then save it. - (mail_generate_reply): Try to guess which account to use based - upon the list of To and Cc addresses and pass that as the 'From' - address to e_msg_composer_set_headers(). - (forward_get_composer): Updated to reflect changes to - e-msg-composer. - -2001-02-11 Gediminas Paulauskas <menesis@delfi.lt> +2001-02-11 Gediminas Paulauskas <menesis@delfi.lt> * mail-config.glade.h: removed, xml-i18n-extract's the strings itself. - * *.glade: do not output_translatable_strings - * Makefile.am: removed *.glade.h from EXTRA_DIST. - -2001-02-09 Dan Winship <danw@ximian.com> - - * mail-local.c: Updates for CamelStore changes, small memory leak - fixes. - (lookup_folder): Removed (and moved into the reconfigure code) - since this method no longer exists in CamelStore. - (do_reconfigure_folder, etc): Update the info in the - MailLocalStore after reconfiguring. - (mail_local_lookup_folder): Removed - - * local-config.glade: fix padding of the label_format - - * message-list.c (ml_tree_value_at): Don't keep message infos - reffed across calls, since this can cause badness after a - reconfigure. Instead, just strdup the needed values and free those - on the next call. - - * mail-tools.c (mail_tool_get_root_of_store): Unused, remove. - (mail_tool_get_inbox): use camel_store_get_inbox. - - * evolution-outlook-importer.c (load_file_fn): - * evolution-mbox-importer.c (load_file_fn): Use - mail_tool_get_local_inbox() instead of mail_importer_get_folder() - - * mail-importer.c (mail_importer_get_folder): Removed + * *.glade: do not output_translatable_strings + * Makefile.am: removed *.glade.h from EXTRA_DIST. 2001-02-08 Jeffrey Stedfast <fejj@ximian.com> - * mail-callbacks.c (mail_generate_reply): New location for this - function. - - * mail-format.c: Removed mail_generate_reply as it's ONLY ever - used in mail-callbacks.c. - - * mail-ops.c (fetch_mail_fetch): Reworked some keep-mail-on-server - logic so that we ALWAYS look for a cached array of UIDs that we - may have downloaded previously so as not to download them again - even if we will be deleting them off the server. This fixes bug - #1344. - -2001-02-09 Not Zed <NotZed@Ximian.com> - - * mail-ops.c (filter_folder_free): only free driver, if set. - (fetch_mail_fetched): Unref the driver here, so it can cleanup - before we call the 'done' callback. - - * component-factory.c (owner_set_cb): Add setup for mail - autoreceive stuff. - - * mail-send-recv.c (free_info_data): Free the send info's from teh - active hash, not the running list. - (receive_done): As we finish downloads, remove them and clean them - up, and also close the window. - (mail_autoreceive_setup): New function to setup & maintain - automatic download stuff. - -2001-02-08 Jeffrey Stedfast <fejj@ximian.com> - - * mail-config-druid.c (construct): Set the sensitivity of the spin - button based on the state of the checkbox. - * mail-config.c (config_read): Properly do defaults here. (mail_config_write): Removed some of the settings being saved here. (mail_config_write_on_exit): Save those settings here instead. -2001-02-08 Jeffrey Stedfast <fejj@ximian.com> - - * mail-display.c (on_object_requested): Cast the CamelMedium to a - CamelMimePart before performing actions on it as if it were a - CamelMimePart. - - * mail-config-druid.c (druid_finish): Save the auto-check settings. - (construct): Initialize auto-check widgets. - (mail_config_druid_get_auto_check): New function - (mail_config_druid_get_auto_check_minutes): New functions - - * mail-config.c (config_read): Read in whether or not to check - every x minutes. - (mail_config_write): Save auto-check config data and SSL. - -2001-02-07 Jeffrey Stedfast <fejj@ximian.com> - - * mail-autofilter.c (rule_add_subject): Use "contains" because the - subject might be broken into subparts and using the "is" rule will - then fail ;-) - -2001-02-08 Not Zed <NotZed@Ximian.com> - - * mail-send-recv.c (mail_send_receive): - (mail_receive_uri): Init active_downloads hash if it hasn't been yet. - -2001-02-07 Not Zed <NotZed@Ximian.com> - - * mail-send-recv.c (operation_status): Handle internal camel status return. - (receive_done): Remove active download when done. - (mail_receive_uri): Initiate download of a single source, with no gui. - (build_dialogue): Mark any new items as real active downloads. - (do_show_status): Make the progress bar optional. - -2001-02-06 Not Zed <NotZed@Ximian.com> - - * mail-send-recv.c: camel_cancel->camel_operation. - - * mail-ops.old.c: camel_cancel->camel_operation. - - * mail-ops.c: camel_cancel->camel_operation. - - * mail-mt.c: camel_cancel->camel_operation. - - * mail-callbacks.c (stop_threads): camel_cancel->camel_operation. - - * mail-mt.h: CamelCancel->CamelOperation. - -2001-02-07 Jeffrey Stedfast <fejj@ximian.com> - - * mail-mt.c (set_view_data): Check current_message for NULL - this - fixes a bug running under SunOS (not a major deal tho as it's in a - debug printf). - 2001-02-06 Jeffrey Stedfast <fejj@ximian.com> * mail-config.c (mail_config_write_on_exit): Oops, save the seen_timeout variable. -2001-02-06 Christopher James Lahey <clahey@ximian.com> - - * Makefile.am (evolution_mail_LDADD): Added libmenus.la. - - * folder-browser-factory.c (control_activate): Added GalView menus - here. - - * message-list.c, message-list.h (message_list_get_layout): Made - message_list_get_layout export. - -2001-02-06 Iain Holmes <iain@ximian.com> - - * mail-display.c (pixbuf_gen_idle): Set the size of the icon to 24x24 - always. - (button_press): Function to toggle the disposition of an attachment. - (on_object_requested): New way to indicate functions on attachments. - - * message-list.c (hide_load_state): Free the olduid. - 2001-02-06 Jeffrey Stedfast <fejj@ximian.com> * mail-config-druid.c (set_defaults): Updated to checkfor diff --git a/mail/Makefile.am b/mail/Makefile.am index 84591e5b88..f2396f92e5 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -1,11 +1,8 @@ -SUBDIRS = importers - bin_PROGRAMS = evolution-mail noinst_PROGRAMS = test-mail #test-thread providerdir = $(libdir)/evolution/camel-providers/$(VERSION) -importerdir = $(libdir)/evolution/evolution-mail-importers/$(VERSION) INCLUDES = \ -I$(top_srcdir)/widgets \ @@ -34,7 +31,6 @@ INCLUDES = \ -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ -DEVOLUTION_DATADIR=\""$(datadir)"\" \ -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \ - -DMAIL_IMPORTERSDIR=\""$(importerdir)"\" \ -DG_LOG_DOMAIN=\"evolution-mail\" EVOLUTION_MAIL_CORBA_GENERATED = \ @@ -43,6 +39,10 @@ EVOLUTION_MAIL_CORBA_GENERATED = \ Mail-skels.c \ Mail-stubs.c +# FIXME Is there any way around having to do this? +CAMEL_OBJS_EXTRA = \ + $(top_builddir)/camel/providers/vee/libcamelvee.la + evolution_mail_SOURCES = \ $(EVOLUTION_MAIL_CORBA_GENERATED) \ component-factory.c \ @@ -85,6 +85,8 @@ evolution_mail_SOURCES = \ mail-send-recv.h \ mail-summary.c \ mail-summary.h \ + mail-threads.c \ + mail-threads.h \ mail-tools.c \ mail-tools.h \ mail-types.h \ @@ -100,12 +102,17 @@ evolution_mail_SOURCES = \ mail-session.h \ subscribe-dialog.c \ subscribe-dialog.h \ - mail.h + mail.h \ + evolution-outlook-importer.c \ + evolution-outlook-importer.h \ + evolution-mbox-importer.c \ + evolution-mbox-importer.h evolution_mail_LDADD = \ $(top_builddir)/shell/libeshell.a \ $(top_builddir)/composer/libcomposer.a \ $(top_builddir)/widgets/misc/libemiscwidgets.a \ + $(CAMEL_OBJS_EXTRA) \ $(top_builddir)/camel/libcamel.la \ $(top_builddir)/e-util/libeutil.la \ $(top_builddir)/e-util/ename/libename.la \ @@ -113,12 +120,11 @@ evolution_mail_LDADD = \ $(top_builddir)/filter/libfilter.la \ $(top_builddir)/executive-summary/evolution-services/libevolution-services.la \ $(top_builddir)/shell/importer/libevolution-importer.la \ - $(top_builddir)/widgets/menus/libmenus.la \ $(BONOBO_VFS_GNOME_LIBS) \ $(EXTRA_GNOME_LIBS) \ $(GTKHTML_LIBS) \ $(THREADS_LIBS) \ - $(UNICODE_LIBS) + $(UNICODE_LIBS) evolution_mail_LDFLAGS = \ -export-dynamic @@ -156,11 +162,7 @@ test_mail_LDADD = \ #test_thread_CFLAGS = -g $(THREADS_CFLAGS) oafdir = $(datadir)/oaf -oaf_in_files = GNOME_Evolution_Mail.oaf.in -oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) - -@XML_I18N_MERGE_OAF_RULE@ - +oaf_DATA = GNOME_Evolution_Mail.oafinfo gladedir = $(datadir)/evolution/glade glade_DATA = mail-config.glade local-config.glade @@ -171,7 +173,7 @@ $(EVOLUTION_MAIL_CORBA_GENERATED): Mail.idl $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl -I `$(GNOME_CONFIG) --cflags idl` \ -I `$(GNOME_CONFIG) --datadir`/idl $(srcdir)/Mail.idl -EXTRA_DIST = Mail.idl $(glade_DATA) $(oaf_in_files) $(oaf_DATA) +EXTRA_DIST = Mail.idl $(glade_DATA) $(oaf_DATA) if ENABLE_PURIFY PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c index 0f7b605435..886b696218 100644 --- a/mail/mail-account-editor.c +++ b/mail/mail-account-editor.c @@ -194,15 +194,11 @@ apply_changes (MailAccountEditor *editor) str = gtk_entry_get_text (editor->source_path); source_url->path = str && *str ? g_strdup (str) : NULL; - account->source->save_passwd = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->source_save_passwd)); - account->source->keep_on_server = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->keep_on_server)); - - account->source->enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->source_enabled)); - account->source->auto_check = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->source_auto_check)); - account->source->auto_check_time = gtk_spin_button_get_value_as_int (editor->source_auto_timeout); + account->source->save_passwd = GTK_TOGGLE_BUTTON (editor->save_passwd)->active; + account->source->keep_on_server = GTK_TOGGLE_BUTTON (editor->keep_on_server)->active; if (editor->source_ssl) - account->source->use_ssl = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->source_ssl)); + account->source->use_ssl = GTK_TOGGLE_BUTTON (editor->source_ssl)->active; /* set the new source url */ g_free (account->source->url); @@ -226,14 +222,6 @@ apply_changes (MailAccountEditor *editor) str = gtk_object_get_data (GTK_OBJECT (editor), "transport_authmech"); transport_url->authmech = str && *str ? g_strdup (str) : NULL; - if (transport_url->authmech) { - str = gtk_entry_get_text (editor->transport_user); - transport_url->user = str && *str ? g_strdup (str) : NULL; - - str = gtk_entry_get_text (editor->transport_passwd); - transport_url->passwd = str && *str ? g_strdup (str) : NULL; - } - host = g_strdup (gtk_entry_get_text (editor->transport_host)); if (host && (pport = strchr (host, ':'))) { *pport = '\0'; @@ -245,14 +233,12 @@ apply_changes (MailAccountEditor *editor) transport_url->port = port; if (editor->transport_ssl) - account->transport->use_ssl = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->transport_ssl)); + account->transport->use_ssl = GTK_TOGGLE_BUTTON (editor->transport_ssl)->active; /* set the new transport url */ g_free (account->transport->url); account->transport->url = camel_url_to_string (transport_url, FALSE); - account->transport->save_passwd = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->transport_save_passwd)); - /* check to make sure the source works */ if (source_url) { if (mail_config_check_service (source_url, CAMEL_PROVIDER_STORE, FALSE, NULL)) { @@ -268,15 +254,8 @@ apply_changes (MailAccountEditor *editor) } /* check to make sure the transport works */ - if (mail_config_check_service (transport_url, CAMEL_PROVIDER_TRANSPORT, FALSE, NULL)) { - /* save the password if we were requested to do so */ - if (account->transport->save_passwd && transport_url->passwd) { - mail_session_set_password (account->transport->url, transport_url->passwd); - mail_session_remember_password (account->transport->url); - } - } else { + if (!mail_config_check_service (transport_url, CAMEL_PROVIDER_TRANSPORT, FALSE, NULL)) retval = FALSE; - } camel_url_free (transport_url); @@ -348,7 +327,7 @@ source_auth_type_changed (GtkWidget *widget, gpointer user_data) label = glade_xml_get_widget (editor->gui, "lblSourcePasswd"); gtk_widget_set_sensitive (label, sensitive); gtk_widget_set_sensitive (GTK_WIDGET (editor->source_passwd), sensitive); - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_save_passwd), sensitive); + gtk_widget_set_sensitive (GTK_WIDGET (editor->save_passwd), sensitive); } static void @@ -393,14 +372,14 @@ source_auth_init (MailAccountEditor *editor, CamelURL *url) l = l->next; i++; } + + if (authmech) { + gtk_signal_emit_by_name (GTK_OBJECT (authmech), "activate", editor); + gtk_option_menu_set_history (editor->source_auth, history); + } } gtk_option_menu_set_menu (editor->source_auth, menu); - - if (authmech) { - gtk_signal_emit_by_name (GTK_OBJECT (authmech), "activate", editor); - gtk_option_menu_set_history (editor->source_auth, history); - } } static void @@ -415,7 +394,7 @@ transport_auth_type_changed (GtkWidget *widget, gpointer user_data) } static void -transport_auth_init (MailAccountEditor *editor, CamelURL *url) +transport_construct_authmenu (MailAccountEditor *editor, CamelURL *url) { GtkWidget *authmech = NULL; GtkWidget *menu, *item; @@ -466,13 +445,6 @@ transport_auth_init (MailAccountEditor *editor, CamelURL *url) if (authmech) { gtk_signal_emit_by_name (GTK_OBJECT (authmech), "activate", editor); gtk_option_menu_set_history (editor->transport_auth, history); - if (url->authmech) { - gtk_entry_set_text (editor->transport_user, url->user ? url->user : ""); - gtk_entry_set_text (editor->transport_passwd, url->passwd ? url->passwd : ""); - } else { - gtk_entry_set_text (editor->transport_user, ""); - gtk_entry_set_text (editor->transport_passwd, ""); - } } } @@ -497,30 +469,6 @@ transport_type_changed (GtkWidget *widget, gpointer user_data) gtk_widget_set_sensitive (label, FALSE); } - /* username */ - label = glade_xml_get_widget (editor->gui, "lblTransportUser"); - if (provider->url_flags & CAMEL_URL_ALLOW_AUTH) { - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_user), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_entry_set_text (editor->transport_user, ""); - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_user), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* password */ - label = glade_xml_get_widget (editor->gui, "lblTransportPasswd"); - if (provider->url_flags & CAMEL_URL_ALLOW_AUTH) { - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_passwd), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_save_passwd), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_entry_set_text (editor->transport_passwd, ""); - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_passwd), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_save_passwd), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - /* auth */ label = glade_xml_get_widget (editor->gui, "lblTransportAuth"); if (provider->url_flags & CAMEL_URL_ALLOW_AUTH) { @@ -533,7 +481,7 @@ transport_type_changed (GtkWidget *widget, gpointer user_data) url = g_new0 (CamelURL, 1); url->protocol = g_strdup (provider->protocol); url->host = g_strdup (gtk_entry_get_text (editor->transport_host)); - transport_auth_init (editor, url); + transport_construct_authmenu (editor, url); camel_url_free (url); } else { gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_auth), FALSE); @@ -594,14 +542,6 @@ transport_type_init (MailAccountEditor *editor, CamelURL *url) } static void -auto_check_toggled (GtkToggleButton *button, gpointer data) -{ - MailAccountEditor *editor = data; - - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_auto_timeout), gtk_toggle_button_get_active (button)); -} - -static void source_check (MailAccountEditor *editor, CamelURL *url) { GList *providers, *l; @@ -670,11 +610,11 @@ source_check (MailAccountEditor *editor, CamelURL *url) label = glade_xml_get_widget (editor->gui, "lblSourcePasswd"); if (url && provider->url_flags & CAMEL_URL_ALLOW_PASSWORD) { gtk_widget_set_sensitive (GTK_WIDGET (editor->source_passwd), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_save_passwd), TRUE); + gtk_widget_set_sensitive (GTK_WIDGET (editor->save_passwd), TRUE); gtk_widget_set_sensitive (label, TRUE); } else { gtk_widget_set_sensitive (GTK_WIDGET (editor->source_passwd), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_save_passwd), FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (editor->save_passwd), FALSE); gtk_widget_set_sensitive (label, FALSE); } @@ -724,25 +664,24 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account) /* General */ editor->account_name = GTK_ENTRY (glade_xml_get_widget (gui, "txtAccountName")); - e_utf8_gtk_entry_set_text (editor->account_name, account->name ? account->name : _("Unspecified")); + e_utf8_gtk_entry_set_text (editor->account_name, account->name); gtk_signal_connect (GTK_OBJECT (editor->account_name), "changed", entry_changed, editor); editor->name = GTK_ENTRY (glade_xml_get_widget (gui, "txtName")); - e_utf8_gtk_entry_set_text (editor->name, account->id->name ? account->id->name : ""); + e_utf8_gtk_entry_set_text (editor->name, account->id->name); gtk_signal_connect (GTK_OBJECT (editor->name), "changed", entry_changed, editor); editor->email = GTK_ENTRY (glade_xml_get_widget (gui, "txtAddress")); - e_utf8_gtk_entry_set_text (editor->email, account->id->address ? account->id->address : ""); + e_utf8_gtk_entry_set_text (editor->email, account->id->address); gtk_signal_connect (GTK_OBJECT (editor->email), "changed", entry_changed, editor); editor->reply_to = GTK_ENTRY (glade_xml_get_widget (gui, "txtReplyTo")); if (editor->reply_to) e_utf8_gtk_entry_set_text (editor->reply_to, account->id->reply_to ? account->id->reply_to : ""); editor->organization = GTK_ENTRY (glade_xml_get_widget (gui, "txtOrganization")); if (editor->organization) - e_utf8_gtk_entry_set_text (editor->organization, account->id->organization ? - account->id->organization : ""); + e_utf8_gtk_entry_set_text (editor->organization, account->id->organization); editor->signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileSignature")); if (editor->signature) { entry = gnome_file_entry_gtk_entry (editor->signature); - gtk_entry_set_text (GTK_ENTRY (entry), account->id->signature ? account->id->signature : ""); + gtk_entry_set_text (GTK_ENTRY (entry), account->id->signature); } /* Servers */ @@ -769,54 +708,14 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account) editor->source_passwd = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourcePasswd")); gtk_entry_set_text (editor->source_passwd, url && url->passwd ? url->passwd : ""); editor->source_path = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourcePath")); - if (url && url->path && *(url->path)) { - GList *providers; - CamelProvider *provider = NULL; - - providers = camel_session_list_providers (session, TRUE); - while (providers) { - provider = providers->data; - - if (strcmp (provider->domain, "mail")) { - provider = NULL; - providers = providers->next; - continue; - } - - if (provider->object_types[CAMEL_PROVIDER_STORE] && provider->flags & CAMEL_PROVIDER_IS_SOURCE) - if (!url || !g_strcasecmp (provider->protocol, url->protocol)) - break; - - provider = NULL; - providers = providers->next; - } - - if (provider) { - if (provider->url_flags & CAMEL_URL_PATH_IS_ABSOLUTE) - gtk_entry_set_text (editor->source_path, url->path ? url->path : ""); - else - gtk_entry_set_text (editor->source_path, url->path + 1 ? url->path + 1 : ""); - } else { - /* we've got a serious problem if we ever get to here */ - g_assert_not_reached (); - } - } - editor->source_save_passwd = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkSourceSavePasswd")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_save_passwd), account->source->save_passwd); + gtk_entry_set_text (editor->source_path, url && url->path ? url->path : ""); + editor->save_passwd = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkSavePasswd")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->save_passwd), account->source->save_passwd); editor->source_auth = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuSourceAuth")); editor->source_ssl = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkSourceSSL")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_ssl), account->source->use_ssl); editor->keep_on_server = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkKeepMailOnServer")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->keep_on_server), account->source->keep_on_server); - editor->source_auto_timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinAutoCheckTimeout")); - gtk_spin_button_set_value (editor->source_auto_timeout, - (gfloat) (account->source->auto_check_time * 1.0)); - editor->source_auto_check = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkAutoCheckMail")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_auto_check), account->source->auto_check); - gtk_signal_connect (GTK_OBJECT (editor->source_auto_check), "toggled", auto_check_toggled, editor); - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_auto_timeout), account->source->auto_check); - editor->source_enabled = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkEnabled")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_enabled), account->source->enabled); source_check (editor, url); source_auth_init (editor, url); if (url) @@ -838,12 +737,6 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account) gtk_entry_append_text (editor->transport_host, port); } editor->transport_auth = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuTransportAuth")); - editor->transport_user = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportUser")); - gtk_entry_set_text (editor->transport_user, url && url->user ? url->user : ""); - editor->transport_passwd = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportPasswd")); - gtk_entry_set_text (editor->transport_passwd, url && url->passwd ? url->passwd : ""); - editor->transport_save_passwd = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkTransportSavePasswd")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->transport_save_passwd), account->transport->save_passwd); editor->transport_ssl = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkTransportSSL")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->transport_ssl), account->transport->use_ssl); if (GTK_IS_OPTION_MENU (editor->transport_type)) @@ -852,8 +745,6 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account) gtk_label_set_text (GTK_LABEL (editor->transport_type), url && url->protocol ? url->protocol : _("None")); - transport_auth_init (editor, url); - if (url) camel_url_free (url); diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index 76d91fabaa..03eb142cc4 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -214,25 +214,8 @@ mail_delete (GtkButton *button, gpointer data) { MailAccountsDialog *dialog = data; MailConfigAccount *account; - GnomeDialog *confirm; - GtkWidget *label; - int ans; - - if (dialog->accounts_row < 0) - return; - - confirm = GNOME_DIALOG (gnome_dialog_new (_("Are you sure you want to delete this account?"), - GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL)); - gtk_window_set_policy (GTK_WINDOW (confirm), TRUE, TRUE, TRUE); - gtk_window_set_modal (GTK_WINDOW (confirm), TRUE); - label = gtk_label_new (_("Are you sure you want to delete this account?")); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_box_pack_start (GTK_BOX (confirm->vbox), label, TRUE, TRUE, 0); - gtk_widget_show (label); - gnome_dialog_set_parent (confirm, GTK_WINDOW (dialog)); - ans = gnome_dialog_run_and_close (confirm); - - if (ans == 0) { + + if (dialog->accounts_row >= 0) { int sel, row, len; sel = dialog->accounts_row; @@ -324,25 +307,8 @@ news_delete (GtkButton *button, gpointer data) { MailAccountsDialog *dialog = data; MailConfigService *server; - GnomeDialog *confirm; - GtkWidget *label; - int ans; - - if (dialog->news_row < 0) - return; - - confirm = GNOME_DIALOG (gnome_dialog_new (_("Are you sure you want to delete this news account?"), - GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL)); - gtk_window_set_policy (GTK_WINDOW (confirm), TRUE, TRUE, TRUE); - gtk_window_set_modal (GTK_WINDOW (confirm), TRUE); - label = gtk_label_new (_("Are you sure you want to delete this news account?")); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_box_pack_start (GTK_BOX (confirm->vbox), label, TRUE, TRUE, 0); - gtk_widget_show (label); - gnome_dialog_set_parent (confirm, GTK_WINDOW (dialog)); - ans = gnome_dialog_run_and_close (confirm); - - if (ans == 0) { + + if (dialog->news_row >= 0) { int row, len; server = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row); @@ -369,7 +335,7 @@ news_delete (GtkButton *button, gpointer data) static void send_html_toggled (GtkToggleButton *button, gpointer data) { - mail_config_set_send_html (gtk_toggle_button_get_active (button)); + mail_config_set_send_html (button->active); } static void @@ -495,7 +461,6 @@ construct (MailAccountsDialog *dialog) gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE); } -#ifdef ENABLE_NNTP dialog->news_row = -1; dialog->news = mail_config_get_news (); if (dialog->news) { @@ -505,7 +470,6 @@ construct (MailAccountsDialog *dialog) gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE); } -#endif /* ENABLE_NNTP */ } MailAccountsDialog * diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c index 48f08b1c08..d33247d33a 100644 --- a/mail/mail-config-druid.c +++ b/mail/mail-config-druid.c @@ -43,8 +43,7 @@ static void mail_config_druid_class_init (MailConfigDruidClass *class); static void mail_config_druid_init (MailConfigDruid *druid); static void mail_config_druid_finalise (GtkObject *obj); -static void construct_source_auth_menu (MailConfigDruid *druid, GList *authtypes); -static void construct_transport_auth_menu (MailConfigDruid *druid, GList *authtypes); +static void construct_auth_menu (MailConfigDruid *druid, GList *authtypes); static GtkWindowClass *parent_class; @@ -108,12 +107,10 @@ static struct { "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." }, { "htmlIncoming", "Please enter information about your incoming mail server below. If you don't know what kind of server you use, contact your system administrator or Internet Service Provider." }, - { "htmlSourceAuthentication", + { "htmlAuthentication", "Your mail server supports the following types of authentication. Please select the type you want Evolution to use." }, { "htmlTransport", "Please enter information about your outgoing mail protocol below. If you don't know which protocol you use, contact your system administrator or Internet Service Provider." }, - { "htmlTransportAuthentication", - "Your mail transport supports the following types of authentication. Please select the type you want Evolution to use." }, { "htmlAccountInfo", "You are almost done with the mail configuration process. The identity, incoming mail server and outgoing mail transport method which you provided will be grouped together to make an Evolution mail account. Please enter a name for this account in the space below. This name will be used for display purposes only." } }; @@ -189,6 +186,7 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data) MailConfigService *source; MailConfigService *transport; CamelURL *url; + GSList *mini; char *str; account = g_new0 (MailConfigAccount, 1); @@ -205,9 +203,7 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data) /* construct the source */ source = g_new0 (MailConfigService, 1); source->keep_on_server = mail_config_druid_get_keep_mail_on_server (druid); - source->auto_check = mail_config_druid_get_auto_check (druid); - source->auto_check_time = mail_config_druid_get_auto_check_minutes (druid); - source->save_passwd = mail_config_druid_get_save_source_password (druid); + source->save_passwd = mail_config_druid_get_save_password (druid); str = mail_config_druid_get_source_url (druid); if (str) { /* cache the password and rewrite the url without the password part */ @@ -219,28 +215,13 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data) mail_session_remember_password (source->url); } camel_url_free (url); - source->enabled = TRUE; } else { source->url = NULL; - source->enabled = FALSE; } /* construct the transport */ transport = g_new0 (MailConfigService, 1); - transport->save_passwd = mail_config_druid_get_save_transport_password (druid); - str = mail_config_druid_get_transport_url (druid); - if (str) { - /* cache the password and rewrite the url without the password part */ - url = camel_url_new (str, NULL); - g_free (str); - transport->url = camel_url_to_string (url, FALSE); - if (transport->save_passwd && url->passwd) { - mail_session_set_password (transport->url, url->passwd); - mail_session_remember_password (transport->url); - } - camel_url_free (url); - transport->enabled = TRUE; - } + transport->url = mail_config_druid_get_transport_url (druid); account->id = id; account->source = source; @@ -249,13 +230,9 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data) mail_config_add_account (account); mail_config_write (); - if (source->url) { - GSList *mini; - - mini = g_slist_prepend (NULL, account); - mail_load_storages (druid->shell, mini, TRUE); - g_slist_free (mini); - } + mini = g_slist_prepend (NULL, account); + mail_load_storages (druid->shell, mini, TRUE); + g_slist_free (mini); gtk_widget_destroy (GTK_WIDGET (druid)); } @@ -341,15 +318,6 @@ incoming_check (MailConfigDruid *druid) } static void -auto_check_toggled (GtkToggleButton *button, gpointer data) -{ - MailConfigDruid *druid = data; - - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_auto_check_min), - gtk_toggle_button_get_active (button)); -} - -static void incoming_changed (GtkWidget *widget, gpointer data) { MailConfigDruid *druid = data; @@ -390,7 +358,7 @@ incoming_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) gboolean connect; CamelURL *url; - config->have_source_auth_page = TRUE; + config->have_auth_page = TRUE; source_url = mail_config_druid_get_source_url (config); if (!source_url) { @@ -398,7 +366,7 @@ incoming_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) * so jump past the auth page */ /* Skip to transport page. */ - config->have_source_auth_page = FALSE; + config->have_auth_page = FALSE; transport_page = glade_xml_get_widget (config->gui, "druidTransportPage"); gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (transport_page)); @@ -408,7 +376,7 @@ incoming_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) url = camel_url_new (source_url, NULL); g_free (source_url); - connect = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (config->incoming_check_settings)); + connect = GTK_TOGGLE_BUTTON (config->incoming_check_settings)->active; /* If we can't connect, warn them and continue on to the Transport page. */ if (!mail_config_check_service (url, CAMEL_PROVIDER_STORE, connect, &authtypes)) { @@ -433,12 +401,12 @@ incoming_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) /* If this service offers authentication, go to the next page. */ if (authtypes) { - construct_source_auth_menu (config, authtypes); + construct_auth_menu (config, authtypes); return FALSE; } /* Otherwise, skip to transport page. */ - config->have_source_auth_page = FALSE; + config->have_auth_page = FALSE; transport_page = glade_xml_get_widget (config->gui, "druidTransportPage"); gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (transport_page)); @@ -456,10 +424,6 @@ incoming_type_changed (GtkWidget *widget, gpointer user_data) druid->source_provider = provider; - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_auto_check), provider ? TRUE : FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_auto_check_min), provider ? TRUE : FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_check_settings), provider ? TRUE : FALSE); - /* hostname */ label = glade_xml_get_widget (druid->gui, "lblSourceHost"); if (provider && provider->url_flags & CAMEL_URL_ALLOW_HOST) { @@ -489,22 +453,22 @@ incoming_type_changed (GtkWidget *widget, gpointer user_data) label = glade_xml_get_widget (druid->gui, "lblSourcePasswd"); if (provider && provider->url_flags & CAMEL_URL_ALLOW_PASSWORD) { if (!dwidget) - dwidget = GTK_WIDGET (druid->source_password); - gtk_widget_set_sensitive (GTK_WIDGET (druid->source_password), TRUE); + dwidget = GTK_WIDGET (druid->password); + gtk_widget_set_sensitive (GTK_WIDGET (druid->password), TRUE); gtk_widget_set_sensitive (label, TRUE); } else { - gtk_entry_set_text (druid->source_password, ""); - gtk_widget_set_sensitive (GTK_WIDGET (druid->source_password), FALSE); + gtk_entry_set_text (druid->password, ""); + gtk_widget_set_sensitive (GTK_WIDGET (druid->password), FALSE); gtk_widget_set_sensitive (label, FALSE); } /* auth */ - label = glade_xml_get_widget (druid->gui, "lblSourceAuthType"); + label = glade_xml_get_widget (druid->gui, "lblSourceAuth"); if (provider && provider->url_flags & CAMEL_URL_ALLOW_AUTH) { - gtk_widget_set_sensitive (GTK_WIDGET (druid->source_auth_type), TRUE); + gtk_widget_set_sensitive (GTK_WIDGET (druid->auth_type), TRUE); gtk_widget_set_sensitive (label, TRUE); } else { - gtk_widget_set_sensitive (GTK_WIDGET (druid->source_auth_type), FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (druid->auth_type), FALSE); gtk_widget_set_sensitive (label, FALSE); } @@ -555,12 +519,12 @@ incoming_type_changed (GtkWidget *widget, gpointer user_data) gtk_widget_grab_focus (dwidget); } -/* Source Authentication Page */ +/* Authentication Page */ static void -source_auth_check (MailConfigDruid *druid) +authentication_check (MailConfigDruid *druid) { - if (mail_config_druid_get_save_source_password (druid)) { - char *passwd = gtk_entry_get_text (druid->source_password); + if (mail_config_druid_get_save_password (druid)) { + char *passwd = gtk_entry_get_text (druid->password); if (passwd && *passwd) gnome_druid_set_buttons_sensitive (druid->druid, TRUE, TRUE, TRUE); @@ -572,30 +536,30 @@ source_auth_check (MailConfigDruid *druid) } static void -source_auth_changed (GtkWidget *widget, gpointer data) +authentication_changed (GtkWidget *widget, gpointer data) { MailConfigDruid *druid = data; - source_auth_check (druid); + authentication_check (druid); } static void -source_auth_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) +authentication_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - source_auth_check (config); + authentication_check (config); } static gboolean -source_auth_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) +authentication_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { /* go to the next page */ return FALSE; } static void -source_auth_type_changed (GtkWidget *widget, gpointer user_data) +auth_type_changed (GtkWidget *widget, gpointer user_data) { MailConfigDruid *druid = user_data; CamelServiceAuthType *authtype; @@ -612,18 +576,18 @@ source_auth_type_changed (GtkWidget *widget, gpointer user_data) sensitive = FALSE; label = glade_xml_get_widget (druid->gui, "lblSourcePasswd"); - gtk_widget_set_sensitive (GTK_WIDGET (druid->source_password), sensitive); - gtk_widget_set_sensitive (GTK_WIDGET (druid->save_source_password), sensitive); + gtk_widget_set_sensitive (GTK_WIDGET (druid->password), sensitive); + gtk_widget_set_sensitive (GTK_WIDGET (druid->save_password), sensitive); gtk_widget_set_sensitive (label, sensitive); if (!sensitive) - gtk_entry_set_text (druid->source_password, ""); + gtk_entry_set_text (druid->password, ""); - source_auth_check (druid); + authentication_check (druid); } static void -construct_source_auth_menu (MailConfigDruid *druid, GList *authtypes) +construct_auth_menu (MailConfigDruid *druid, GList *authtypes) { GtkWidget *menu, *item, *first = NULL; CamelServiceAuthType *authtype; @@ -638,7 +602,7 @@ construct_source_auth_menu (MailConfigDruid *druid, GList *authtypes) item = gtk_menu_item_new_with_label (authtype->name); gtk_object_set_data (GTK_OBJECT (item), "authtype", authtype); gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (source_auth_type_changed), + GTK_SIGNAL_FUNC (auth_type_changed), druid); gtk_menu_append (GTK_MENU (menu), item); @@ -654,8 +618,8 @@ construct_source_auth_menu (MailConfigDruid *druid, GList *authtypes) if (first) gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", druid); - gtk_option_menu_remove_menu (druid->source_auth_type); - gtk_option_menu_set_menu (druid->source_auth_type, menu); + gtk_option_menu_remove_menu (druid->auth_type); + gtk_option_menu_set_menu (druid->auth_type, menu); } /* Transport Page */ @@ -683,23 +647,18 @@ static gboolean transport_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - GtkWidget *management_page; - GList *authtypes = NULL; gboolean connect; - char *xport_url; + gchar *xport_url; CamelURL *url; xport_url = mail_config_druid_get_transport_url (config); - if (!xport_url) - return TRUE; - url = camel_url_new (xport_url, NULL); g_free (xport_url); - connect = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (config->outgoing_check_settings)); + connect = GTK_TOGGLE_BUTTON (config->outgoing_check_settings)->active; /* If we can't connect, don't let them continue. */ - if (!mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, connect, &authtypes)) { + if (!mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, connect, NULL)) { GtkWidget *dialog; char *transport, *warning; @@ -717,18 +676,7 @@ transport_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) camel_url_free (url); - /* If this service offers authentication, go to the next page. */ - if (authtypes && mail_config_druid_get_transport_requires_auth (config)) { - construct_transport_auth_menu (config, authtypes); - return FALSE; - } - - /* Otherwise, skip to management page. */ - config->have_transport_auth_page = FALSE; - management_page = glade_xml_get_widget (config->gui, "druidManagementPage"); - gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (management_page)); - - return TRUE; + return FALSE; } static gboolean @@ -736,7 +684,7 @@ transport_back (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - if (config->have_source_auth_page) { + if (config->have_auth_page) { return FALSE; } else { /* jump to the source page, skipping over the auth page */ @@ -788,120 +736,6 @@ transport_type_changed (GtkWidget *widget, gpointer user_data) transport_check (druid); } -/* Transport Authentication Page */ -static void -transport_auth_check (MailConfigDruid *druid) -{ - char *user = gtk_entry_get_text (druid->transport_username); - gboolean sensitive = FALSE; - - if (user && *user) { - if (mail_config_druid_get_save_transport_password (druid)) { - char *passwd = gtk_entry_get_text (druid->transport_password); - - if (passwd && *passwd) - sensitive = TRUE; - } else { - sensitive = TRUE; - } - } - - gnome_druid_set_buttons_sensitive (druid->druid, TRUE, sensitive, TRUE); -} - -static void -transport_auth_changed (GtkWidget *widget, gpointer data) -{ - MailConfigDruid *druid = data; - - transport_auth_check (druid); -} - -static void -transport_auth_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) -{ - MailConfigDruid *config = data; - - transport_auth_check (config); -} - -static gboolean -transport_auth_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) -{ - /* go to the next page */ - return FALSE; -} - -static void -transport_auth_type_changed (GtkWidget *widget, gpointer user_data) -{ - MailConfigDruid *druid = user_data; - CamelServiceAuthType *authtype; - GtkWidget *label; - gboolean sensitive; - - authtype = gtk_object_get_data (GTK_OBJECT (widget), "authtype"); - - gtk_object_set_data (GTK_OBJECT (druid), "transport_authmech", authtype->authproto); - - if (authtype->need_password) - sensitive = TRUE; - else - sensitive = FALSE; - - label = glade_xml_get_widget (druid->gui, "lblTransportUsername"); - gtk_widget_set_sensitive (GTK_WIDGET (druid->transport_username), sensitive); - gtk_widget_set_sensitive (label, sensitive); - - label = glade_xml_get_widget (druid->gui, "lblTransportPasswd"); - gtk_widget_set_sensitive (GTK_WIDGET (druid->transport_password), sensitive); - gtk_widget_set_sensitive (GTK_WIDGET (druid->save_transport_password), sensitive); - gtk_widget_set_sensitive (label, sensitive); - - if (!sensitive) { - gtk_entry_set_text (druid->transport_username, ""); - gtk_entry_set_text (druid->transport_password, ""); - } - - transport_auth_check (druid); -} - -static void -construct_transport_auth_menu (MailConfigDruid *druid, GList *authtypes) -{ - GtkWidget *menu, *item, *first = NULL; - CamelServiceAuthType *authtype; - GList *l; - - menu = gtk_menu_new (); - - l = authtypes; - while (l) { - authtype = l->data; - - item = gtk_menu_item_new_with_label (authtype->name); - gtk_object_set_data (GTK_OBJECT (item), "authtype", authtype); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (transport_auth_type_changed), - druid); - - gtk_menu_append (GTK_MENU (menu), item); - - gtk_widget_show (item); - - if (!first) - first = item; - - l = l->next; - } - - if (first) - gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", druid); - - gtk_option_menu_remove_menu (druid->transport_auth_type); - gtk_option_menu_set_menu (druid->transport_auth_type, menu); -} - /* Management page */ static void management_check (MailConfigDruid *druid) @@ -942,24 +776,6 @@ management_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) return FALSE; } -static gboolean -management_back (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) -{ - MailConfigDruid *config = data; - - if (config->have_transport_auth_page) { - return FALSE; - } else { - /* jump to the source page, skipping over the auth page */ - GtkWidget *widget; - - widget = glade_xml_get_widget (config->gui, "druidTransportPage"); - gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (widget)); - - return TRUE; - } -} - static gint provider_compare (const CamelProvider *p1, const CamelProvider *p2) { @@ -1161,9 +977,9 @@ static struct { GTK_SIGNAL_FUNC (incoming_prepare), GTK_SIGNAL_FUNC (NULL), GTK_SIGNAL_FUNC (NULL) }, - { "druidSourceAuthPage", - GTK_SIGNAL_FUNC (source_auth_next), - GTK_SIGNAL_FUNC (source_auth_prepare), + { "druidAuthPage", + GTK_SIGNAL_FUNC (authentication_next), + GTK_SIGNAL_FUNC (authentication_prepare), GTK_SIGNAL_FUNC (NULL), GTK_SIGNAL_FUNC (NULL) }, { "druidTransportPage", @@ -1171,15 +987,10 @@ static struct { GTK_SIGNAL_FUNC (transport_prepare), GTK_SIGNAL_FUNC (transport_back), GTK_SIGNAL_FUNC (NULL) }, - { "druidTransportAuthPage", - GTK_SIGNAL_FUNC (transport_auth_next), - GTK_SIGNAL_FUNC (transport_auth_prepare), - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, { "druidManagementPage", GTK_SIGNAL_FUNC (management_next), GTK_SIGNAL_FUNC (management_prepare), - GTK_SIGNAL_FUNC (management_back), + GTK_SIGNAL_FUNC (NULL), GTK_SIGNAL_FUNC (NULL) }, { "druidFinishPage", GTK_SIGNAL_FUNC (NULL), @@ -1218,7 +1029,8 @@ construct (MailConfigDruid *druid) gtk_object_set (GTK_OBJECT (druid), "type", GTK_WINDOW_DIALOG, NULL); /* attach to druid page signals */ - for (i = 0; pages[i].name != NULL; i++) { + i = 0; + while (pages[i].name) { GnomeDruidPage *page; page = GNOME_DRUID_PAGE (glade_xml_get_widget (gui, pages[i].name)); @@ -1235,8 +1047,11 @@ construct (MailConfigDruid *druid) if (pages[i].finish_func) gtk_signal_connect (GTK_OBJECT (page), "finish", pages[i].finish_func, druid); + + i++; } - gtk_signal_connect (GTK_OBJECT (druid->druid), "cancel", druid_cancel, druid); + gtk_signal_connect (GTK_OBJECT (druid->druid), "cancel", + druid_cancel, druid); /* get our cared-about widgets */ druid->account_text = glade_xml_get_widget (gui, "htmlAccountInfo"); @@ -1261,20 +1076,15 @@ construct (MailConfigDruid *druid) druid->incoming_path = GTK_ENTRY (glade_xml_get_widget (gui, "txtIncomingPath")); gtk_signal_connect (GTK_OBJECT (druid->incoming_path), "changed", incoming_changed, druid); druid->incoming_keep_mail = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkIncomingKeepMail")); - druid->incoming_auto_check = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkAutoCheck")); - gtk_signal_connect (GTK_OBJECT (druid->incoming_auto_check), "toggled", auto_check_toggled, druid); - druid->incoming_auto_check_min = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinAutoCheckMinutes")); - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_auto_check_min), - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->incoming_auto_check))); druid->incoming_check_settings = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkIncomingCheckSettings")); - druid->have_source_auth_page = TRUE; - druid->source_auth_text = glade_xml_get_widget (gui, "htmlSourceAuthentication"); - druid->source_auth_type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuSourceAuthType")); - druid->source_password = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourceAuthPasswd")); - gtk_signal_connect (GTK_OBJECT (druid->source_password), "changed", source_auth_changed, druid); - druid->save_source_password = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkSourceAuthSavePasswd")); - gtk_signal_connect (GTK_OBJECT (druid->save_source_password), "toggled", source_auth_changed, druid); + druid->have_auth_page = TRUE; + druid->auth_text = glade_xml_get_widget (gui, "htmlAuthentication"); + druid->auth_type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuAuthType")); + druid->password = GTK_ENTRY (glade_xml_get_widget (gui, "txtAuthPasswd")); + gtk_signal_connect (GTK_OBJECT (druid->password), "changed", authentication_changed, druid); + druid->save_password = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkAuthSavePasswd")); + gtk_signal_connect (GTK_OBJECT (druid->save_password), "toggled", authentication_changed, druid); druid->outgoing_text = glade_xml_get_widget (gui, "htmlTransport"); druid->outgoing_type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuTransportType")); @@ -1283,16 +1093,6 @@ construct (MailConfigDruid *druid) druid->outgoing_requires_auth = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkTransportNeedsAuth")); druid->outgoing_check_settings = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkOutgoingCheckSettings")); - druid->have_transport_auth_page = FALSE; - druid->transport_auth_text = glade_xml_get_widget (gui, "htmlTransportAuthentication"); - druid->transport_auth_type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuTransportAuthType")); - druid->transport_username = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportAuthUsername")); - gtk_signal_connect (GTK_OBJECT (druid->transport_username), "changed", transport_auth_changed, druid); - druid->transport_password = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportAuthPasswd")); - gtk_signal_connect (GTK_OBJECT (druid->transport_password), "changed", transport_auth_changed, druid); - druid->save_transport_password = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkTransportAuthSavePasswd")); - gtk_signal_connect (GTK_OBJECT (druid->save_transport_password), "toggled", transport_auth_changed, druid); - set_defaults (druid); gnome_druid_set_buttons_sensitive (druid->druid, FALSE, TRUE, TRUE); @@ -1324,7 +1124,7 @@ mail_config_druid_get_default_account (MailConfigDruid *druid) { g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), FALSE); - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->default_account)); + return GTK_TOGGLE_BUTTON (druid->default_account)->active; } @@ -1369,7 +1169,6 @@ mail_config_druid_get_source_url (MailConfigDruid *druid) { char *source_url, *host, *pport, *str; const CamelProvider *provider; - gboolean show_passwd; CamelURL *url; int port = 0; @@ -1388,7 +1187,7 @@ mail_config_druid_get_source_url (MailConfigDruid *druid) str = gtk_object_get_data (GTK_OBJECT (druid), "source_authmech"); url->authmech = str && *str ? g_strdup (str) : NULL; - str = gtk_entry_get_text (druid->source_password); + str = gtk_entry_get_text (druid->password); url->passwd = str && *str ? g_strdup (str) : NULL; host = g_strdup (gtk_entry_get_text (druid->incoming_hostname)); @@ -1401,8 +1200,7 @@ mail_config_druid_get_source_url (MailConfigDruid *druid) url->path = g_strdup (gtk_entry_get_text (druid->incoming_path)); /* only 'show password' if we intend to save it */ - show_passwd = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->save_source_password)); - source_url = camel_url_to_string (url, show_passwd); + source_url = camel_url_to_string (url, GTK_TOGGLE_BUTTON (druid->save_password)->active); camel_url_free (url); return source_url; @@ -1414,41 +1212,24 @@ mail_config_druid_get_keep_mail_on_server (MailConfigDruid *druid) { g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), FALSE); - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->incoming_keep_mail)); + return GTK_TOGGLE_BUTTON (druid->incoming_keep_mail)->active; } gboolean -mail_config_druid_get_auto_check (MailConfigDruid *druid) +mail_config_druid_get_save_password (MailConfigDruid *druid) { g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), FALSE); - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->incoming_auto_check)); -} - - -gint -mail_config_druid_get_auto_check_minutes (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), 0); - - return gtk_spin_button_get_value_as_int (druid->incoming_auto_check_min); + return GTK_TOGGLE_BUTTON (druid->save_password)->active; } -gboolean -mail_config_druid_get_save_source_password (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), FALSE); - - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->save_source_password)); -} char * mail_config_druid_get_transport_url (MailConfigDruid *druid) { char *transport_url, *host, *pport; const CamelProvider *provider; - gboolean show_passwd; CamelURL *url; int port = 0; @@ -1460,22 +1241,6 @@ mail_config_druid_get_transport_url (MailConfigDruid *druid) url = g_new0 (CamelURL, 1); url->protocol = g_strdup (provider->protocol); - - if (mail_config_druid_get_transport_requires_auth (druid)) { - char *str; - - str = gtk_object_get_data (GTK_OBJECT (druid), "transport_authmech"); - if (str && *str) { - url->authmech = g_strdup (str); - - str = gtk_entry_get_text (druid->transport_username); - url->user = str && *str ? g_strdup (str) : NULL; - - str = gtk_entry_get_text (druid->transport_password); - url->passwd = str && *str ? g_strdup (str) : NULL; - } - } - host = g_strdup (gtk_entry_get_text (druid->outgoing_hostname)); if (host && (pport = strchr (host, ':'))) { port = atoi (pport + 1); @@ -1484,26 +1249,17 @@ mail_config_druid_get_transport_url (MailConfigDruid *druid) url->host = host; url->port = port; - /* only 'show password' if we intend to save it */ - show_passwd = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->save_transport_password)); - transport_url = camel_url_to_string (url, show_passwd); + transport_url = camel_url_to_string (url, FALSE); camel_url_free (url); return transport_url; } -gboolean -mail_config_druid_get_save_transport_password (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), FALSE); - - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->save_transport_password)); -} gboolean mail_config_druid_get_transport_requires_auth (MailConfigDruid *druid) { g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), FALSE); - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->outgoing_requires_auth)); + return GTK_TOGGLE_BUTTON (druid->outgoing_requires_auth)->active; } diff --git a/mail/mail-config.c b/mail/mail-config.c index 0d182cee02..be8b8a7b6c 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -33,7 +33,6 @@ #include "mail.h" #include "mail-config.h" #include "mail-ops.h" -#include "mail-mt.h" typedef struct { gboolean thread_list; @@ -102,7 +101,6 @@ service_copy (const MailConfigService *source) new->keep_on_server = source->keep_on_server; new->auto_check = source->auto_check; new->auto_check_time = source->auto_check_time; - new->enabled = source->enabled; new->save_passwd = source->save_passwd; new->use_ssl = source->use_ssl; @@ -275,11 +273,6 @@ config_read (void) if (source->auto_check && def) source->auto_check = FALSE; g_free (path); - path = g_strdup_printf ("source_enabled_%d", i); - source->enabled = gnome_config_get_bool_with_default (path, &def); - if (def) - source->enabled = TRUE; - g_free (path); path = g_strdup_printf ("source_save_passwd_%d", i); source->save_passwd = gnome_config_get_bool (path); g_free (path); @@ -293,10 +286,6 @@ config_read (void) transport->url = gnome_config_get_string (path); g_free (path); - path = g_strdup_printf ("transport_save_passwd_%d", i); - transport->save_passwd = gnome_config_get_bool (path); - g_free (path); - if (!*transport->url) { /* no transport associated with this account */ g_free (transport->url); @@ -398,8 +387,6 @@ mail_config_write (void) /* Accounts */ str = g_strdup_printf ("=%s/config/Mail=/Accounts/", evolution_dir); - gnome_config_clean_section (str); - gnome_config_sync (); gnome_config_push_prefix (str); g_free (str); @@ -446,9 +433,6 @@ mail_config_write (void) path = g_strdup_printf ("source_auto_check_time_%d", i); gnome_config_set_int (path, account->source->auto_check_time); g_free (path); - path = g_strdup_printf ("source_enabled_%d", i); - gnome_config_set_bool (path, account->source->enabled); - g_free (path); path = g_strdup_printf ("source_save_passwd_%d", i); gnome_config_set_bool (path, account->source->save_passwd); g_free (path); @@ -460,14 +444,6 @@ mail_config_write (void) path = g_strdup_printf ("transport_url_%d", i); gnome_config_set_string (path, account->transport->url ? account->transport->url : ""); g_free (path); - - path = g_strdup_printf ("transport_save_passwd_%d", i); - gnome_config_set_bool (path, account->transport->save_passwd); - g_free (path); - - path = g_strdup_printf ("transport_use_ssl_%d", i); - gnome_config_set_bool (path, account->transport->use_ssl); - g_free (path); } gnome_config_pop_prefix (); @@ -842,49 +818,53 @@ mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix) /* Async service-checking/authtype-lookup code. */ -struct _check_msg { - struct _mail_msg msg; +typedef struct { char *url; CamelProviderType type; gboolean connect; GList **authtypes; - gboolean *success; -}; + gboolean success; +} check_service_input_t; -static void check_service_check(struct _mail_msg *mm) +static char * +describe_check_service (gpointer in_data, gboolean gerund) { - struct _check_msg *m = (struct _check_msg *)mm; + if (gerund) + return g_strdup (_("Connecting to server")); + else + return g_strdup (_("Connect to server")); +} + +static void +do_check_service (gpointer in_data, gpointer op_data, CamelException *ex) +{ + check_service_input_t *input = in_data; CamelService *service = NULL; - if (m->authtypes) { - service = camel_session_get_service (session, m->url, m->type, &mm->ex); + if (input->authtypes) { + service = camel_session_get_service (session, input->url, input->type, ex); if (!service) return; - *m->authtypes = camel_service_query_auth_types (service, m->connect, &mm->ex); - } else if (m->connect) { - service = camel_session_get_service_connected (session, m->url, m->type, &mm->ex); + *input->authtypes = camel_service_query_auth_types (service, input->connect, ex); + } else if (input->connect) { + service = camel_session_get_service_connected (session, input->url, input->type, ex); } if (service) camel_object_unref (CAMEL_OBJECT (service)); - - *m->success = !camel_exception_is_set(&mm->ex); -} - -static void check_service_free(struct _mail_msg *mm) -{ - struct _check_msg *m = (struct _check_msg *)mm; - - g_free(m->url); + if (!camel_exception_is_set (ex)) + input->success = TRUE; } -static struct _mail_msg_op check_service_op = { - NULL, - check_service_check, +static const mail_operation_spec op_check_service = { + describe_check_service, + 0, NULL, - check_service_free + do_check_service, + NULL }; + /** * mail_config_check_service: * @url: service url @@ -905,20 +885,17 @@ static struct _mail_msg_op check_service_op = { gboolean mail_config_check_service (CamelURL *url, CamelProviderType type, gboolean connect, GList **authtypes) { - gboolean ret = FALSE; - struct _check_msg *m; - int id; - - m = mail_msg_new(&check_service_op, NULL, sizeof(*m)); - m->url = camel_url_to_string(url, TRUE); - m->type = type; - m->connect = connect; - m->authtypes = authtypes; - m->success = &ret; - - id = m->msg.seq; - e_thread_put(mail_thread_queued, (EMsg *)m); - mail_msg_wait(id); + check_service_input_t input; + + input.url = camel_url_to_string (url, TRUE); + input.type = type; + input.connect = connect; + input.authtypes = authtypes; + input.success = FALSE; + + mail_operation_queue (&op_check_service, &input, FALSE); + mail_operation_wait_for_finish (); + g_free (input.url); - return ret; + return input.success; } diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 5f5d6d0540..5c7753cfb9 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -795,16 +795,16 @@ Click "Next" to begin. </text> <widget> <class>GnomeDruidPageStandard</class> - <name>druidSourceAuthPage</name> + <name>druidAuthPage</name> <signal> <name>prepare</name> - <handler>source_auth_prepare</handler> - <last_modification_time>Tue, 06 Mar 2001 21:58:17 GMT</last_modification_time> + <handler>authentication_prepare</handler> + <last_modification_time>Tue, 07 Nov 2000 22:31:02 GMT</last_modification_time> </signal> <signal> <name>next</name> - <handler>source_auth_next</handler> - <last_modification_time>Tue, 06 Mar 2001 21:58:08 GMT</last_modification_time> + <handler>authentication_next</handler> + <last_modification_time>Tue, 07 Nov 2000 22:31:08 GMT</last_modification_time> </signal> <title>Authentication</title> <title_color>255,255,255</title_color> @@ -826,7 +826,7 @@ Click "Next" to begin. </text> <widget> <class>GtkVBox</class> - <name>vboxSourceAuth</name> + <name>vbox8</name> <border_width>6</border_width> <homogeneous>False</homogeneous> <spacing>0</spacing> @@ -838,7 +838,7 @@ Click "Next" to begin. </text> <widget> <class>Custom</class> - <name>htmlSourceAuthentication</name> + <name>htmlAuthentication</name> <creation_function>mail_config_create_html</creation_function> <int1>0</int1> <int2>0</int2> @@ -882,7 +882,7 @@ Click "Next" to begin. </text> <widget> <class>GtkLabel</class> - <name>lblSourceAuthType</name> + <name>authentication-type-label</name> <label>Authentication Type:</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> @@ -899,7 +899,7 @@ Click "Next" to begin. </text> <widget> <class>GtkOptionMenu</class> - <name>omenuSourceAuthType</name> + <name>omenuAuthType</name> <can_focus>True</can_focus> <items></items> <initial_choice>0</initial_choice> @@ -928,7 +928,7 @@ Click "Next" to begin. </text> <widget> <class>GtkEntry</class> - <name>txtSourceAuthPasswd</name> + <name>txtAuthPasswd</name> <can_focus>True</can_focus> <editable>True</editable> <text_visible>False</text_visible> @@ -979,7 +979,7 @@ Click "Next" to begin. </text> <widget> <class>GtkCheckButton</class> - <name>chkSourceAuthSavePasswd</name> + <name>chkAuthSavePasswd</name> <border_width>4</border_width> <can_focus>True</can_focus> <label>Remember my password</label> @@ -1251,260 +1251,6 @@ Click "Next" to begin. </text> <widget> <class>GnomeDruidPageStandard</class> - <name>druidTransportAuthPage</name> - <signal> - <name>prepare</name> - <handler>transport_auth_prepare</handler> - <last_modification_time>Tue, 07 Nov 2000 22:31:02 GMT</last_modification_time> - </signal> - <signal> - <name>next</name> - <handler>transport_auth_next</handler> - <last_modification_time>Tue, 07 Nov 2000 22:31:08 GMT</last_modification_time> - </signal> - <title>Transport Authentication</title> - <title_color>255,255,255</title_color> - <background_color>25,25,112</background_color> - <logo_background_color>25,25,112</logo_background_color> - <logo_image>registration.png</logo_image> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDruidPageStandard:vbox</child_name> - <name>druid-vbox4</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vboxTransportAuth</name> - <border_width>6</border_width> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Custom</class> - <name>htmlTransportAuthentication</name> - <creation_function>mail_config_create_html</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 02 Nov 2000 17:31:34 GMT</last_modification_time> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frmTransportAuth</name> - <label>Authentication</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox9</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox25</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>lblTransportAuthType</name> - <label>Authentication Type:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>omenuTransportAuthType</name> - <can_focus>True</can_focus> - <items></items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkTable</class> - <name>tableTransportAuth</name> - <border_width>4</border_width> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>lblTransportUsername</name> - <label>Username:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtTransportAuthUsername</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>False</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblTransportPasswd</name> - <label>Password:</label> - <justify>GTK_JUSTIFY_RIGHT</justify> - <wrap>False</wrap> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtTransportAuthPasswd</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>False</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>chkTransportAuthSavePasswd</name> - <border_width>4</border_width> - <can_focus>True</can_focus> - <label>Remember my password</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDruidPageStandard</class> <name>druidManagementPage</name> <signal> <name>prepare</name> @@ -1681,6 +1427,1397 @@ Click "Finish" to save your settings.</text> <widget> <class>GnomeDialog</class> + <name>mail-account-editor</name> + <visible>False</visible> + <title>Account Properties</title> + <type>GTK_WINDOW_TOPLEVEL</type> + <position>GTK_WIN_POS_CENTER</position> + <modal>True</modal> + <allow_shrink>False</allow_shrink> + <allow_grow>True</allow_grow> + <auto_shrink>True</auto_shrink> + <auto_close>False</auto_close> + <hide_on_close>False</hide_on_close> + + <widget> + <class>GtkVBox</class> + <child_name>GnomeDialog:vbox</child_name> + <name>dialog-vbox3</name> + <homogeneous>False</homogeneous> + <spacing>8</spacing> + <child> + <padding>4</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkHButtonBox</class> + <child_name>GnomeDialog:action_area</child_name> + <name>dialog-action_area3</name> + <layout_style>GTK_BUTTONBOX_END</layout_style> + <spacing>8</spacing> + <child_min_width>85</child_min_width> + <child_min_height>27</child_min_height> + <child_ipad_x>7</child_ipad_x> + <child_ipad_y>0</child_ipad_y> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + <pack>GTK_PACK_END</pack> + </child> + + <widget> + <class>GtkButton</class> + <name>cmdOK</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> + </widget> + + <widget> + <class>GtkButton</class> + <name>cmdApply</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button> + </widget> + + <widget> + <class>GtkButton</class> + <name>cmdCancel</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> + </widget> + </widget> + + <widget> + <class>GtkNotebook</class> + <name>toplevel</name> + <can_focus>True</can_focus> + <show_tabs>True</show_tabs> + <show_border>True</show_border> + <tab_pos>GTK_POS_TOP</tab_pos> + <scrollable>False</scrollable> + <tab_hborder>2</tab_hborder> + <tab_vborder>2</tab_vborder> + <popup_enable>False</popup_enable> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkVBox</class> + <name>vbox32</name> + <border_width>5</border_width> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + + <widget> + <class>GtkVBox</class> + <name>vbox33</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + + <widget> + <class>GtkHBox</class> + <name>hbox26</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <padding>5</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkLabel</class> + <name>lblMailAccount</name> + <label>Mail Account</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <padding>10</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkHSeparator</class> + <name>hseparator</name> + <child> + <padding>10</padding> + <expand>True</expand> + <fill>True</fill> + </child> + </widget> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblDirections</name> + <label>Type the name by which you would like to refer to these servers. For example: "Work" or "Home".</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>True</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>txtAccountName</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <padding>5</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + </widget> + + <widget> + <class>GtkTable</class> + <name>tableUserInfo</name> + <rows>6</rows> + <columns>10</columns> + <homogeneous>True</homogeneous> + <row_spacing>4</row_spacing> + <column_spacing>0</column_spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkHBox</class> + <name>hbox35</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <left_attach>0</left_attach> + <right_attach>10</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>True</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + + <widget> + <class>GtkLabel</class> + <name>lblUserInfo</name> + <label>User Information</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <padding>10</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkHSeparator</class> + <name>hseparator8</name> + <child> + <padding>10</padding> + <expand>True</expand> + <fill>True</fill> + </child> + </widget> + </widget> + + <widget> + <class>GtkEntry</class> + <name>txtName</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>4</left_attach> + <right_attach>10</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>txtAddress</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>4</left_attach> + <right_attach>10</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>txtReplyTo</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>4</left_attach> + <right_attach>10</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>txtOrganization</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>4</left_attach> + <right_attach>10</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GnomeFileEntry</class> + <name>fileSignature</name> + <max_saved>10</max_saved> + <title>Select signature file</title> + <directory>False</directory> + <modal>True</modal> + <child> + <left_attach>4</left_attach> + <right_attach>10</right_attach> + <top_attach>5</top_attach> + <bottom_attach>6</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + + <widget> + <class>GtkEntry</class> + <child_name>GnomeEntry:entry</child_name> + <name>txtSignature</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + </widget> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblName</name> + <label>Name:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblEMail</name> + <label>E-Mail Address:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblReplyTo</name> + <label>Reply-To:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblOrganization</name> + <label>Organization:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblSignature</name> + <label>Signature:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>5</top_attach> + <bottom_attach>6</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + </widget> + </widget> + + <widget> + <class>GtkLabel</class> + <child_name>Notebook:tab</child_name> + <name>lblGeneral</name> + <label>General</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + + <widget> + <class>GtkVBox</class> + <name>vbox34</name> + <border_width>5</border_width> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + + <widget> + <class>GtkTable</class> + <name>tableIncomingServer</name> + <rows>8</rows> + <columns>10</columns> + <homogeneous>True</homogeneous> + <row_spacing>0</row_spacing> + <column_spacing>0</column_spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + + <widget> + <class>GtkHBox</class> + <name>hbox31</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <left_attach>0</left_attach> + <right_attach>10</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>True</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + + <widget> + <class>GtkLabel</class> + <name>lblIncomingMailServer</name> + <label>Incoming Mail Server</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <padding>10</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkHSeparator</class> + <name>hseparator4</name> + <child> + <padding>10</padding> + <expand>True</expand> + <fill>True</fill> + </child> + </widget> + </widget> + + <widget> + <class>GtkCheckButton</class> + <name>chkSavePasswd</name> + <can_focus>True</can_focus> + <label>Save password</label> + <active>False</active> + <draw_indicator>True</draw_indicator> + <child> + <left_attach>4</left_attach> + <right_attach>10</right_attach> + <top_attach>5</top_attach> + <bottom_attach>6</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>txtSourceHost</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>3</left_attach> + <right_attach>10</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>txtSourceUser</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>3</left_attach> + <right_attach>10</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>txtSourcePasswd</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>False</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>3</left_attach> + <right_attach>10</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkCheckButton</class> + <name>chkSourceSSL</name> + <sensitive>False</sensitive> + <can_focus>True</can_focus> + <label>This server requires a secure connection (SSL)</label> + <active>False</active> + <draw_indicator>True</draw_indicator> + <child> + <left_attach>1</left_attach> + <right_attach>10</right_attach> + <top_attach>7</top_attach> + <bottom_attach>8</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblSourceUser</name> + <label>Username:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>3</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblSourcePasswd</name> + <label>Password:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>3</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblSourceAuth</name> + <label>Authentication:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>6</top_attach> + <bottom_attach>7</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblSourceHost</name> + <label>Hostname:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>3</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblIncomingServerType</name> + <label>Type:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>3</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>txtSourceType</name> + <sensitive>False</sensitive> + <can_focus>True</can_focus> + <editable>False</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>3</left_attach> + <right_attach>10</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkOptionMenu</class> + <name>omenuSourceAuth</name> + <can_focus>True</can_focus> + <items>Plain Text +Kerberos +CRAM-MD5 +DIGEST-MD5 +</items> + <initial_choice>0</initial_choice> + <child> + <left_attach>4</left_attach> + <right_attach>10</right_attach> + <top_attach>6</top_attach> + <bottom_attach>7</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + </widget> + + <widget> + <class>GtkTable</class> + <name>tableOutgoingServer</name> + <rows>5</rows> + <columns>10</columns> + <homogeneous>True</homogeneous> + <row_spacing>0</row_spacing> + <column_spacing>0</column_spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + + <widget> + <class>GtkHBox</class> + <name>hbox32</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <left_attach>0</left_attach> + <right_attach>10</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>True</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + + <widget> + <class>GtkLabel</class> + <name>lblOutgoingMailServer</name> + <label>Outgoing Mail Server</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <padding>10</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkHSeparator</class> + <name>hseparator5</name> + <child> + <padding>10</padding> + <expand>True</expand> + <fill>True</fill> + </child> + </widget> + </widget> + + <widget> + <class>GtkEntry</class> + <name>txtTransportHost</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>3</left_attach> + <right_attach>10</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkCheckButton</class> + <name>chkTransportSSL</name> + <sensitive>False</sensitive> + <can_focus>True</can_focus> + <label>This server requires a secure connection (SSL)</label> + <active>False</active> + <draw_indicator>True</draw_indicator> + <child> + <left_attach>1</left_attach> + <right_attach>10</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblOutgoingServerType</name> + <label>Type:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>3</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblTransportHost</name> + <label>Hostname:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>3</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblTransportAuth</name> + <label>Authentication:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkOptionMenu</class> + <name>omenuTransportAuth</name> + <can_focus>True</can_focus> + <items>None +CRAM-MD5 +</items> + <initial_choice>0</initial_choice> + <child> + <left_attach>4</left_attach> + <right_attach>10</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkOptionMenu</class> + <name>omenuTransportType</name> + <can_focus>True</can_focus> + <items>Sendmail +SMTP +</items> + <initial_choice>0</initial_choice> + <child> + <left_attach>3</left_attach> + <right_attach>10</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + </widget> + </widget> + + <widget> + <class>GtkLabel</class> + <child_name>Notebook:tab</child_name> + <name>lblServers</name> + <label>Servers</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + + <widget> + <class>GtkVBox</class> + <name>vbox36</name> + <border_width>5</border_width> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + + <widget> + <class>GtkTable</class> + <name>tableServerTimeouts</name> + <rows>5</rows> + <columns>10</columns> + <homogeneous>True</homogeneous> + <row_spacing>0</row_spacing> + <column_spacing>0</column_spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkHBox</class> + <name>hbox34</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <left_attach>0</left_attach> + <right_attach>10</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + + <widget> + <class>GtkLabel</class> + <name>lblMisc</name> + <label>Miscellaneous</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <padding>10</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkHSeparator</class> + <name>hseparator7</name> + <child> + <padding>10</padding> + <expand>True</expand> + <fill>True</fill> + </child> + </widget> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblSourcePath</name> + <label>Path:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>7.45058e-09</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>1</left_attach> + <right_attach>3</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkCheckButton</class> + <name>chkKeepMailOnServer</name> + <can_focus>True</can_focus> + <label>Keep mail on server</label> + <active>True</active> + <draw_indicator>True</draw_indicator> + <child> + <left_attach>1</left_attach> + <right_attach>10</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>txtSourcePath</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>3</left_attach> + <right_attach>10</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkCheckButton</class> + <name>chkEnabled</name> + <can_focus>True</can_focus> + <label>Include in "Get Mail" operations.</label> + <active>False</active> + <draw_indicator>True</draw_indicator> + <child> + <left_attach>1</left_attach> + <right_attach>10</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkHBox</class> + <name>hbox40</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <left_attach>1</left_attach> + <right_attach>10</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>True</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + + <widget> + <class>GtkCheckButton</class> + <name>chkAutoCheckMail</name> + <can_focus>True</can_focus> + <label>Automatically check mail every</label> + <active>False</active> + <draw_indicator>True</draw_indicator> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkSpinButton</class> + <name>spinAutoCheckTimeout</name> + <can_focus>True</can_focus> + <climb_rate>1</climb_rate> + <digits>0</digits> + <numeric>True</numeric> + <update_policy>GTK_UPDATE_ALWAYS</update_policy> + <snap>False</snap> + <wrap>False</wrap> + <value>10</value> + <lower>0</lower> + <upper>100</upper> + <step>1</step> + <page>10</page> + <page_size>10</page_size> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>lblMinutes</name> + <label>minutes.</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + </widget> + </widget> + </widget> + + <widget> + <class>GtkLabel</class> + <child_name>Notebook:tab</child_name> + <name>lblAdvanced</name> + <label>Advanced</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + </widget> + </widget> +</widget> + +<widget> + <class>GnomeDialog</class> <name>mail-accounts-dialog</name> <visible>False</visible> <title>Evolution Mail Configuration</title> @@ -1835,8 +2972,7 @@ Click "Finish" to save your settings.</text> <name>cmdMailAdd</name> <can_default>True</can_default> <can_focus>True</can_focus> - <label>_Add</label> - <relief>GTK_RELIEF_NORMAL</relief> + <label>Add</label> </widget> <widget> @@ -1844,8 +2980,7 @@ Click "Finish" to save your settings.</text> <name>cmdMailEdit</name> <can_default>True</can_default> <can_focus>True</can_focus> - <label>_Edit</label> - <relief>GTK_RELIEF_NORMAL</relief> + <label>Edit</label> </widget> <widget> @@ -1853,8 +2988,7 @@ Click "Finish" to save your settings.</text> <name>cmdMailDelete</name> <can_default>True</can_default> <can_focus>True</can_focus> - <label>_Delete</label> - <relief>GTK_RELIEF_NORMAL</relief> + <label>Delete</label> </widget> <widget> @@ -1862,8 +2996,7 @@ Click "Finish" to save your settings.</text> <name>cmdMailDefault</name> <can_default>True</can_default> <can_focus>True</can_focus> - <label>De_fault</label> - <relief>GTK_RELIEF_NORMAL</relief> + <label>Default</label> </widget> </widget> </widget> @@ -1946,7 +3079,6 @@ Click "Finish" to save your settings.</text> <can_default>True</can_default> <can_focus>True</can_focus> <label>Add</label> - <relief>GTK_RELIEF_NORMAL</relief> </widget> <widget> @@ -1955,7 +3087,6 @@ Click "Finish" to save your settings.</text> <can_default>True</can_default> <can_focus>True</can_focus> <label>Edit</label> - <relief>GTK_RELIEF_NORMAL</relief> </widget> <widget> @@ -1964,7 +3095,6 @@ Click "Finish" to save your settings.</text> <can_default>True</can_default> <can_focus>True</can_focus> <label>Delete</label> - <relief>GTK_RELIEF_NORMAL</relief> </widget> </widget> </widget> @@ -2144,12 +3274,12 @@ Click "Finish" to save your settings.</text> <widget> <class>GnomeDialog</class> - <name>mail-account-editor</name> + <name>editor</name> <visible>False</visible> <type>GTK_WINDOW_TOPLEVEL</type> <position>GTK_WIN_POS_NONE</position> <modal>True</modal> - <allow_shrink>True</allow_shrink> + <allow_shrink>False</allow_shrink> <allow_grow>True</allow_grow> <auto_shrink>True</auto_shrink> <auto_close>False</auto_close> @@ -2227,348 +3357,7 @@ Click "Finish" to save your settings.</text> </child> <widget> - <class>GtkVBox</class> - <name>vboxGeneral</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkFrame</class> - <name>frameMailAccount</name> - <border_width>4</border_width> - <label>Mail Account</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vboxMailAccount</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkLabel</class> - <name>labelDirections</name> - <label>Type the name by which you would like to refer to these servers. For example: "Work" or "Home".</label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>True</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>4</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtAccountName</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>2</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frameIdentity</name> - <border_width>4</border_width> - <label>User Information</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>tableIdentity</name> - <border_width>4</border_width> - <rows>5</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>lblName</name> - <label>Full Name:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblEmailAddress</name> - <label>Email address:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblReplyTo</name> - <label>Reply address:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblOrganization</name> - <label>Organization:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblSignature</name> - <label>Signature:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtName</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtAddress</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtReplyTo</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtOrganization</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GnomeFileEntry</class> - <name>fileSignature</name> - <max_saved>10</max_saved> - <title>Select signature file</title> - <directory>False</directory> - <modal>True</modal> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GnomeEntry:entry</child_name> - <name>txtSignature</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - </widget> - </widget> + <class>Placeholder</class> </widget> <widget> @@ -2585,364 +3374,7 @@ Click "Finish" to save your settings.</text> </widget> <widget> - <class>GtkTable</class> - <name>tableSource</name> - <border_width>4</border_width> - <rows>8</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>lblIncomingServerType</name> - <label>Server type:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblSourceHost</name> - <label>Hostname:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtSourceHost</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblSourceUser</name> - <label>Username:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtSourceUser</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblSourcePasswd</name> - <label>Password:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtSourcePasswd</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>False</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>chkSourceSavePasswd</name> - <can_focus>True</can_focus> - <label>Save password</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>5</top_attach> - <bottom_attach>6</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>chkSourceSSL</name> - <can_focus>True</can_focus> - <label>This server requires a secure connection (SSL)</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>0</left_attach> - <right_attach>2</right_attach> - <top_attach>7</top_attach> - <bottom_attach>8</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblSourcePath</name> - <label>Path:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>6</top_attach> - <bottom_attach>7</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtSourcePath</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>6</top_attach> - <bottom_attach>7</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblSourceAuth</name> - <label>Authentication:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>omenuSourceAuth</name> - <can_focus>True</can_focus> - <items>Plain Text -Kerberos -CRAM-MD5 -DIGEST-MD5 -</items> - <initial_choice>0</initial_choice> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>txtSourceType</name> - <label>IMAP</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> + <class>Placeholder</class> </widget> <widget> @@ -2959,310 +3391,7 @@ DIGEST-MD5 </widget> <widget> - <class>GtkTable</class> - <name>tableTransport</name> - <border_width>4</border_width> - <rows>7</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>lblOutgoingServerType</name> - <label>Server type:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>omenuTransportType</name> - <can_focus>True</can_focus> - <items>Sendmail -SMTP -</items> - <initial_choice>0</initial_choice> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblTransportHost</name> - <label>Hostname:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtTransportHost</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblTransportUser</name> - <label>Username:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtTransportUser</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblTransportPasswd</name> - <label>Password:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>txtTransportPasswd</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>False</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblTransportAuth</name> - <label>Authentication:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>omenuTransportAuth</name> - <can_focus>True</can_focus> - <items>None -CRAM-MD5 -</items> - <initial_choice>0</initial_choice> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>chkTransportSSL</name> - <can_focus>True</can_focus> - <label>This server requires a secure connection (SSL)</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>0</left_attach> - <right_attach>2</right_attach> - <top_attach>6</top_attach> - <bottom_attach>7</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>chkTransportSavePasswd</name> - <can_focus>True</can_focus> - <label>Save password</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>5</top_attach> - <bottom_attach>6</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> + <class>Placeholder</class> </widget> <widget> @@ -3277,121 +3406,6 @@ CRAM-MD5 <xpad>0</xpad> <ypad>0</ypad> </widget> - - <widget> - <class>GtkVBox</class> - <name>vboxAdvanced</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkHBox</class> - <name>hboxAutoCheckMail</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCheckButton</class> - <name>chkAutoCheckMail</name> - <can_focus>True</can_focus> - <label>Automatically check mail every</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkSpinButton</class> - <name>spinAutoCheckTimeout</name> - <sensitive>False</sensitive> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>True</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>10</value> - <lower>0</lower> - <upper>100</upper> - <step>1</step> - <page>10</page> - <page_size>10</page_size> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblMinutes</name> - <label>minutes.</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>chkKeepMailOnServer</name> - <can_focus>True</can_focus> - <label>Keep mail on server</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>chkEnabled</name> - <can_focus>True</can_focus> - <label>Include this account when receiving mail</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>lblAdvanced</name> - <label>Advanced</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> </widget> </widget> </widget> diff --git a/mail/mail-config.h b/mail/mail-config.h index 852049ccc0..ee9191a4c8 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -44,8 +44,6 @@ typedef struct { gboolean keep_on_server; gboolean auto_check; gint auto_check_time; - gboolean enabled; - gboolean save_passwd; gboolean use_ssl; } MailConfigService; diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 11ec9d3ab9..d3fb985775 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -30,11 +30,10 @@ #include <ctype.h> #include <errno.h> #include <camel/camel-mime-filter-from.h> -#include <camel/camel-operation.h> #include "mail.h" +#include "mail-threads.h" #include "mail-tools.h" #include "mail-ops.h" -#include "mail-vfolder.h" #include "composer/e-msg-composer.h" #include "folder-browser.h" #include "e-util/e-html-utils.h" @@ -45,6 +44,11 @@ #define d(x) x +int mail_operation_run(const mail_operation_spec *op, void *in, int free); + +#define mail_tool_camel_lock_down() +#define mail_tool_camel_lock_up() + FilterContext * mail_load_filter_context(void) { @@ -115,7 +119,7 @@ struct _filter_mail_msg { CamelFolder *source_folder; /* where they come from */ GPtrArray *source_uids; /* uids to copy, or NULL == copy all */ - CamelOperation *cancel; + CamelCancel *cancel; CamelFilterDriver *driver; int delete; /* delete messages after filtering them? */ CamelFolder *destination; /* default destination for any messages, NULL for none */ @@ -125,7 +129,7 @@ struct _filter_mail_msg { struct _fetch_mail_msg { struct _filter_mail_msg fmsg; - CamelOperation *cancel; /* we have our own cancellation struct, the other should be empty */ + CamelCancel *cancel; /* we have our own cancellation struct, the other should be empty */ int keep; /* keep on server? */ char *source_uri; @@ -144,13 +148,13 @@ filter_folder_filter(struct _mail_msg *mm) GPtrArray *uids, *folder_uids = NULL; if (m->cancel) - camel_operation_register(m->cancel); + camel_cancel_register(m->cancel); folder = m->source_folder; if (folder == NULL || camel_folder_get_message_count (folder) == 0) { if (m->cancel) - camel_operation_unregister(m->cancel); + camel_cancel_unregister(m->cancel); return; } @@ -179,7 +183,7 @@ filter_folder_filter(struct _mail_msg *mm) camel_folder_thaw(m->destination); if (m->cancel) - camel_operation_unregister(m->cancel); + camel_cancel_unregister(m->cancel); } static void @@ -201,11 +205,10 @@ filter_folder_free(struct _mail_msg *mm) g_ptr_array_free(m->source_uids, TRUE); } if (m->cancel) - camel_operation_unref(m->cancel); + camel_cancel_unref(m->cancel); if (m->destination) camel_object_unref((CamelObject *)m->destination); - if (m->driver) - camel_object_unref((CamelObject *)m->driver); + camel_object_unref((CamelObject *)m->driver); } static struct _mail_msg_op filter_folder_op = { @@ -218,7 +221,7 @@ static struct _mail_msg_op filter_folder_op = { void mail_filter_folder(CamelFolder *source_folder, GPtrArray *uids, FilterContext *fc, const char *type, - CamelOperation *cancel) + CamelCancel *cancel) { struct _filter_mail_msg *m; @@ -229,7 +232,7 @@ mail_filter_folder(CamelFolder *source_folder, GPtrArray *uids, m->delete = FALSE; if (cancel) { m->cancel = cancel; - camel_operation_ref(cancel); + camel_cancel_ref(cancel); } m->driver = camel_filter_driver_new(filter_get_folder, NULL); @@ -258,11 +261,11 @@ fetch_mail_fetch(struct _mail_msg *mm) int i; if (m->cancel) - camel_operation_register(m->cancel); + camel_cancel_register(m->cancel); if ( (fm->destination = mail_tool_get_local_inbox(&mm->ex)) == NULL) { if (m->cancel) - camel_operation_unregister(m->cancel); + camel_cancel_unregister(m->cancel); return; } @@ -283,7 +286,7 @@ fetch_mail_fetch(struct _mail_msg *mm) g_free (path); } else { CamelFolder *folder = fm->source_folder = mail_tool_get_inbox(m->source_uri, &mm->ex); - + if (folder) { /* this handles 'keep on server' stuff, if we have any new uid's to copy across, we need to copy them to a new array 'cause of the way fetch_mail_free works */ @@ -320,16 +323,11 @@ fetch_mail_fetch(struct _mail_msg *mm) filter_folder_filter (mm); } } + } if (m->cancel) - camel_operation_unregister(m->cancel); - - /* we unref this here as it may have more work to do (syncing - folders and whatnot) before we are really done */ - /* should this be cancellable too? (i.e. above unregister above) */ - camel_object_unref((CamelObject *)m->fmsg.driver); - m->fmsg.driver = NULL; + camel_cancel_unregister(m->cancel); } static void @@ -348,7 +346,7 @@ fetch_mail_free(struct _mail_msg *mm) g_free(m->source_uri); if (m->cancel) - camel_operation_unref(m->cancel); + camel_cancel_unref(m->cancel); filter_folder_free(mm); } @@ -363,7 +361,7 @@ static struct _mail_msg_op fetch_mail_op = { /* ouch, a 'do everything' interface ... */ void mail_fetch_mail(const char *source, int keep, FilterContext *fc, const char *type, - CamelOperation *cancel, + CamelCancel *cancel, CamelFilterGetFolderFunc get_folder, void *get_data, CamelFilterStatusFunc *status, void *status_data, void (*done)(char *source, void *data), void *data) @@ -377,7 +375,7 @@ void mail_fetch_mail(const char *source, int keep, fm->delete = !keep; if (cancel) { m->cancel = cancel; - camel_operation_ref(cancel); + camel_cancel_ref(cancel); } m->done = done; m->data = data; @@ -464,9 +462,9 @@ mail_send_message(CamelMimeMessage *message, const char *destination, CamelFilte const char *version; if (SUB_VERSION[0] == '\0') - version = "Evolution/" VERSION " (Preview Release)"; + version = "Evolution (" VERSION " - Preview Release)"; else - version = "Evolution/" VERSION SUB_VERSION " (Preview Release)"; + version = "Evolution (" VERSION "/" SUB_VERSION " - Preview Release)"; camel_medium_add_header(CAMEL_MEDIUM (message), "X-Mailer", version); camel_mime_message_set_date(message, CAMEL_MESSAGE_DATE_CURRENT, 0); @@ -484,8 +482,7 @@ mail_send_message(CamelMimeMessage *message, const char *destination, CamelFilte info->flags = CAMEL_MESSAGE_SEEN; if (driver) - camel_filter_driver_filter_message (driver, message, info, - NULL, NULL, "", ex); + camel_filter_driver_filter_message(driver, message, info, "", ex); if (sent_folder) camel_folder_append_message(sent_folder, message, info, ex); @@ -522,9 +519,9 @@ static void send_mail_send(struct _mail_msg *mm) { struct _send_mail_msg *m = (struct _send_mail_msg *)mm; - camel_operation_register(mm->cancel); + camel_cancel_register(mm->cancel); mail_send_message(m->message, m->destination, m->driver, &mm->ex); - camel_operation_unregister(mm->cancel); + camel_cancel_unregister(mm->cancel); } static void send_mail_sent(struct _mail_msg *mm) @@ -584,7 +581,7 @@ struct _send_queue_msg { char *destination; CamelFilterDriver *driver; - CamelOperation *cancel; + CamelCancel *cancel; /* we use camelfilterstatusfunc, even though its not the filter doing it */ CamelFilterStatusFunc *status; @@ -612,69 +609,61 @@ static void send_queue_send(struct _mail_msg *mm) { struct _send_queue_msg *m = (struct _send_queue_msg *)mm; - extern CamelFolder *sent_folder; /* FIXME */ GPtrArray *uids; int i; - + extern CamelFolder *sent_folder; /* FIXME */ + printf("sending queue\n"); - - uids = camel_folder_get_uids (m->queue); + + uids = camel_folder_get_uids(m->queue); if (uids == NULL || uids->len == 0) return; - + if (m->cancel) - camel_operation_register (m->cancel); + camel_cancel_register(m->cancel); - for (i = 0; i < uids->len; i++) { + for (i=0; i<uids->len; i++) { CamelMimeMessage *message; - CamelMessageInfo *info; char *destination; - int pc = (100 * i) / uids->len; - - report_status (m, CAMEL_FILTER_STATUS_START, pc, "Sending message %d of %d", i+1, uids->len); - - info = camel_folder_get_message_info (m->queue, uids->pdata[i]); - if (info && info->flags & CAMEL_MESSAGE_DELETED) - continue; + int pc = (100 * i)/uids->len; + + report_status(m, CAMEL_FILTER_STATUS_START, pc, "Sending message %d of %d", i+1, uids->len); - message = camel_folder_get_message (m->queue, uids->pdata[i], &mm->ex); - if (camel_exception_is_set (&mm->ex)) + message = camel_folder_get_message(m->queue, uids->pdata[i], &mm->ex); + if (camel_exception_is_set(&mm->ex)) break; - - /* Remove the X-Evolution header so we don't send our flags too ;-) */ - camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution"); - + /* Get the preferred transport URI */ - destination = (char *)camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Transport"); + destination = (char *)camel_medium_get_header(CAMEL_MEDIUM(message), "X-Evolution-Transport"); if (destination) { - destination = g_strdup (destination); - camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Transport"); - mail_send_message (message, g_strstrip (destination), m->driver, &mm->ex); - g_free (destination); + destination = g_strdup(destination); + camel_medium_remove_header(CAMEL_MEDIUM(message), "X-Evolution-Transport"); + mail_send_message(message, g_strstrip(destination), m->driver, &mm->ex); + g_free(destination); } else - mail_send_message (message, m->destination, m->driver, &mm->ex); - - if (camel_exception_is_set (&mm->ex)) + mail_send_message(message, m->destination, m->driver, &mm->ex); + + if (camel_exception_is_set(&mm->ex)) break; - - camel_folder_set_message_flags (m->queue, uids->pdata[i], CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED); + + camel_folder_set_message_flags(m->queue, uids->pdata[i], CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED); } - - if (camel_exception_is_set (&mm->ex)) - report_status (m, CAMEL_FILTER_STATUS_END, 100, "Failed on message %d of %d", i+1, uids->len); + + if (camel_exception_is_set(&mm->ex)) + report_status(m, CAMEL_FILTER_STATUS_END, 100, "Failed on message %d of %d", i+1, uids->len); else - report_status (m, CAMEL_FILTER_STATUS_END, 100, "Complete."); - - camel_folder_free_uids (m->queue, uids); - - if (!camel_exception_is_set (&mm->ex)) - camel_folder_expunge (m->queue, &mm->ex); + report_status(m, CAMEL_FILTER_STATUS_END, 100, "Complete."); + + camel_folder_free_uids(m->queue, uids); + + if (!camel_exception_is_set(&mm->ex)) + camel_folder_expunge(m->queue, &mm->ex); if (sent_folder) - camel_folder_sync (sent_folder, FALSE, &mm->ex); - + camel_folder_sync(sent_folder, FALSE, &mm->ex); + if (m->cancel) - camel_operation_unregister (m->cancel); + camel_cancel_unregister(m->cancel); } static void @@ -694,7 +683,7 @@ send_queue_free(struct _mail_msg *mm) camel_object_unref((CamelObject *)m->queue); g_free(m->destination); if (m->cancel) - camel_operation_unref(m->cancel); + camel_cancel_unref(m->cancel); } static struct _mail_msg_op send_queue_op = { @@ -708,7 +697,7 @@ static struct _mail_msg_op send_queue_op = { void mail_send_queue(CamelFolder *queue, const char *destination, FilterContext *fc, const char *type, - CamelOperation *cancel, + CamelCancel *cancel, CamelFilterGetFolderFunc get_folder, void *get_data, CamelFilterStatusFunc *status, void *status_data, void (*done)(char *destination, void *data), void *data) @@ -721,7 +710,7 @@ mail_send_queue(CamelFolder *queue, const char *destination, m->destination = g_strdup(destination); if (cancel) { m->cancel = cancel; - camel_operation_ref(cancel); + camel_cancel_ref(cancel); } m->status = status; m->status_data = status_data; @@ -736,108 +725,151 @@ mail_send_queue(CamelFolder *queue, const char *destination, /* ** APPEND MESSAGE TO FOLDER ******************************************** */ -struct _append_msg { - struct _mail_msg msg; - +typedef struct append_mail_input_s +{ CamelFolder *folder; CamelMimeMessage *message; CamelMessageInfo *info; +} +append_mail_input_t; - void (*done)(CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data); - void *data; -}; - -static char *append_mail_desc(struct _mail_msg *mm, int done) +static gchar * +describe_append_mail (gpointer in_data, gboolean gerund) { - return g_strdup(_("Saving message to folder")); + append_mail_input_t *input = (append_mail_input_t *) in_data; + + if (gerund) { + if (input->message->subject && input->message->subject[0]) + return g_strdup_printf (_("Appending \"%s\""), + input->message->subject); + else + return + g_strdup (_("Appending a message without a subject")); + } else { + if (input->message->subject && input->message->subject[0]) + return g_strdup_printf (_("Appending \"%s\""), + input->message->subject); + else + return g_strdup (_("Appending a message without a subject")); + } } -static void append_mail_append(struct _mail_msg *mm) +static void +setup_append_mail (gpointer in_data, gpointer op_data, CamelException *ex) { - struct _append_msg *m = (struct _append_msg *)mm; + append_mail_input_t *input = (append_mail_input_t *) in_data; - camel_mime_message_set_date(m->message, CAMEL_MESSAGE_DATE_CURRENT, 0); - camel_folder_append_message(m->folder, m->message, m->info, &mm->ex); + camel_object_ref (CAMEL_OBJECT (input->message)); + camel_object_ref (CAMEL_OBJECT (input->folder)); } -static void append_mail_appended(struct _mail_msg *mm) +static void +do_append_mail (gpointer in_data, gpointer op_data, CamelException *ex) { - struct _append_msg *m = (struct _append_msg *)mm; - - if (m->done) - m->done(m->folder, m->message, m->info, !camel_exception_is_set(&mm->ex), m->data); + append_mail_input_t *input = (append_mail_input_t *) in_data; + + camel_mime_message_set_date (input->message, + CAMEL_MESSAGE_DATE_CURRENT, 0); + + mail_tool_camel_lock_up (); + + /* now to save the message in the specified folder */ + camel_folder_append_message (input->folder, input->message, input->info, ex); + + mail_tool_camel_lock_down (); } -static void append_mail_free(struct _mail_msg *mm) +static void +cleanup_append_mail (gpointer in_data, gpointer op_data, CamelException *ex) { - struct _append_msg *m = (struct _append_msg *)mm; - - camel_object_unref((CamelObject *)m->message); - camel_object_unref((CamelObject *)m->folder); + append_mail_input_t *input = (append_mail_input_t *) in_data; + + camel_object_unref (CAMEL_OBJECT (input->message)); + camel_object_unref (CAMEL_OBJECT (input->folder)); } -static struct _mail_msg_op append_mail_op = { - append_mail_desc, - append_mail_append, - append_mail_appended, - append_mail_free +static const mail_operation_spec op_append_mail = { + describe_append_mail, + 0, + setup_append_mail, + do_append_mail, + cleanup_append_mail }; void -mail_append_mail (CamelFolder *folder, - CamelMimeMessage *message, - CamelMessageInfo *info, - void (*done)(CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data), void *data) +mail_do_append_mail (CamelFolder *folder, + CamelMimeMessage *message, + CamelMessageInfo *info) { - struct _append_msg *m; - + append_mail_input_t *input; + g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); - m = mail_msg_new(&append_mail_op, NULL, sizeof(*m)); - m->folder = folder; - camel_object_ref((CamelObject *)folder); - m->message = message; - camel_object_ref((CamelObject *)message); - m->info = info; - - m->done = done; - m->data = data; - - e_thread_put(mail_thread_new, (EMsg *)m); + input = g_new (append_mail_input_t, 1); + input->folder = folder; + input->message = message; + input->info = info; + + mail_operation_queue (&op_append_mail, input, TRUE); } /* ** TRANSFER MESSAGES **************************************************** */ -struct _transfer_msg { - struct _mail_msg msg; - +typedef struct transfer_messages_input_s +{ CamelFolder *source; GPtrArray *uids; - gboolean delete; - char *dest_uri; -}; + gboolean delete_from_source; + gchar *dest_uri; +} +transfer_messages_input_t; + +static gchar * +describe_transfer_messages (gpointer in_data, gboolean gerund) +{ + transfer_messages_input_t *input = (transfer_messages_input_t *) in_data; + char *format; + + if (gerund) { + if (input->delete_from_source) + format = _("Moving messages from \"%s\" into \"%s\""); + else + format = _("Copying messages from \"%s\" into \"%s\""); + } else { + if (input->delete_from_source) + format = _("Move messages from \"%s\" into \"%s\""); + else + format = _("Copy messages from \"%s\" into \"%s\""); + } + + return g_strdup_printf (format, + mail_tool_get_folder_name (input->source), + input->dest_uri); +} -static char *transfer_messages_desc(struct _mail_msg *mm, int done) +static void +setup_transfer_messages (gpointer in_data, gpointer op_data, + CamelException *ex) { - struct _transfer_msg *m = (struct _transfer_msg *)mm; + transfer_messages_input_t *input = (transfer_messages_input_t *) in_data; - return g_strdup_printf(m->delete?_("Moving messages to %s"):_("Copying messages to %s"), - m->dest_uri); - + camel_object_ref (CAMEL_OBJECT (input->source)); } -static void transfer_messages_transfer(struct _mail_msg *mm) +static void +do_transfer_messages (gpointer in_data, gpointer op_data, CamelException *ex) { - struct _transfer_msg *m = (struct _transfer_msg *)mm; + transfer_messages_input_t *input = (transfer_messages_input_t *) in_data; CamelFolder *dest; - int i; - char *desc; + gint i; + time_t last_update = 0; + gchar *desc; void (*func) (CamelFolder *, const char *, CamelFolder *, CamelException *); - if (m->delete) { + if (input->delete_from_source) { func = camel_folder_move_message_to; desc = _("Moving"); } else { @@ -845,45 +877,59 @@ static void transfer_messages_transfer(struct _mail_msg *mm) desc = _("Copying"); } - dest = mail_tool_uri_to_folder (m->dest_uri, &mm->ex); - if (camel_exception_is_set (&mm->ex)) + dest = mail_tool_uri_to_folder (input->dest_uri, ex); + if (camel_exception_is_set (ex)) return; - camel_folder_freeze (m->source); + mail_tool_camel_lock_up (); + camel_folder_freeze (input->source); camel_folder_freeze (dest); - for (i = 0; i < m->uids->len; i++) { - mail_statusf(_("%s message %d of %d (uid \"%s\")"), desc, - i + 1, m->uids->len, (char *)m->uids->pdata[i]); - - (func) (m->source, m->uids->pdata[i], dest, &mm->ex); - if (camel_exception_is_set (&mm->ex)) + for (i = 0; i < input->uids->len; i++) { + const gboolean last_message = (i+1 == input->uids->len); + time_t now; + + /* + * Update the time display every 2 seconds + */ + time (&now); + if (last_message || ((now - last_update) > 2)) { + mail_op_set_message (_("%s message %d of %d (uid \"%s\")"), desc, + i + 1, input->uids->len, (char *) input->uids->pdata[i]); + last_update = now; + } + + (func) (input->source, + input->uids->pdata[i], dest, + ex); + g_free (input->uids->pdata[i]); + if (camel_exception_is_set (ex)) break; } - camel_folder_thaw(m->source); - camel_folder_thaw(dest); - camel_object_unref((CamelObject *)dest); + camel_folder_thaw (input->source); + camel_folder_thaw (dest); + camel_object_unref (CAMEL_OBJECT (dest)); + mail_tool_camel_lock_down (); } -static void transfer_messages_free(struct _mail_msg *mm) +static void +cleanup_transfer_messages (gpointer in_data, gpointer op_data, + CamelException *ex) { - struct _transfer_msg *m = (struct _transfer_msg *)mm; - int i; - - camel_object_unref((CamelObject *)m->source); - g_free(m->dest_uri); - for (i=0;i<m->uids->len;i++) - g_free(m->uids->pdata[i]); - g_ptr_array_free(m->uids, TRUE); + transfer_messages_input_t *input = (transfer_messages_input_t *) in_data; + camel_object_unref (CAMEL_OBJECT (input->source)); + g_free (input->dest_uri); + g_ptr_array_free (input->uids, TRUE); } -static struct _mail_msg_op transfer_messages_op = { - transfer_messages_desc, - transfer_messages_transfer, - NULL, - transfer_messages_free, +static const mail_operation_spec op_transfer_messages = { + describe_transfer_messages, + 0, + setup_transfer_messages, + do_transfer_messages, + cleanup_transfer_messages }; void @@ -891,20 +937,19 @@ mail_do_transfer_messages (CamelFolder *source, GPtrArray *uids, gboolean delete_from_source, gchar *dest_uri) { - struct _transfer_msg *m; + transfer_messages_input_t *input; g_return_if_fail (CAMEL_IS_FOLDER (source)); g_return_if_fail (uids != NULL); g_return_if_fail (dest_uri != NULL); - m = mail_msg_new(&transfer_messages_op, NULL, sizeof(*m)); - m->source = source; - camel_object_ref((CamelObject *)source); - m->uids = uids; - m->delete = delete_from_source; - m->dest_uri = g_strdup (dest_uri); + input = g_new (transfer_messages_input_t, 1); + input->source = source; + input->uids = uids; + input->delete_from_source = delete_from_source; + input->dest_uri = g_strdup (dest_uri); - e_thread_put(mail_thread_queued, (EMsg *)m); + mail_operation_queue (&op_transfer_messages, input, TRUE); } /* ** SCAN SUBFOLDERS ***************************************************** */ @@ -929,57 +974,11 @@ static char *get_folderinfo_desc(struct _mail_msg *mm, int done) return ret; } -static void -add_vtrash_info (CamelFolderInfo *info) -{ - CamelFolderInfo *fi, *vtrash; - CamelURL *url; - char *uri; - - g_return_if_fail (info != NULL); - - for (fi = info; fi->sibling; fi = fi->sibling) { - if (!strcmp (fi->name, _("Trash"))) - break; - } - - /* create our vTrash URL */ - url = camel_url_new (info->url, NULL); - g_free (url->path); - url->path = g_strdup (_("Trash")); - uri = camel_url_to_string (url, FALSE); - camel_url_free (url); - - if (fi->sibling) { - /* We're going to replace the physical Trash folder with our vTrash folder */ - vtrash = fi; - g_free (vtrash->full_name); - g_free (vtrash->name); - g_free (vtrash->url); - } else { - /* There wasn't a Trash folder so create a new folder entry */ - vtrash = g_new0 (CamelFolderInfo, 1); - vtrash->parent = fi; - fi->sibling = vtrash; - } - - /* Fill in the new fields */ - vtrash->full_name = g_strdup (_("Trash")); - vtrash->name = g_strdup (_("Trash")); - vtrash->url = g_strdup_printf ("vtrash:%s", uri); - vtrash->unread_message_count = -1; - g_free (uri); -} - static void get_folderinfo_get(struct _mail_msg *mm) { struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; - - camel_operation_register(mm->cancel); + m->info = camel_store_get_folder_info(m->store, NULL, FALSE, TRUE, TRUE, &mm->ex); - if (m->info && m->info->url) - add_vtrash_info (m->info); - camel_operation_unregister(mm->cancel); } static void get_folderinfo_got(struct _mail_msg *mm) @@ -1025,14 +1024,33 @@ int mail_get_folderinfo(CamelStore *store, void (*done)(CamelStore *store, Camel /* ********************************************************************** */ -static void -do_scan_subfolders (CamelStore *store, CamelFolderInfo *info, void *data) +static void do_add_subfolders(CamelStore *store, CamelFolderInfo *info, EvolutionStorage *storage, const char *prefix) +{ + char *path, *name; + + path = g_strdup_printf("%s/%s", prefix, info->name); + if (info->unread_message_count > 0) + name = g_strdup_printf("%s (%d)", info->name, info->unread_message_count); + else + name = g_strdup(info->name); + + evolution_storage_new_folder(storage, path, name, "mail", info->url?info->url:"", + _("(No description)"), info->unread_message_count > 0); + g_free(name); + if (info->child) + do_add_subfolders(store, info->child, storage, path); + if (info->sibling) + do_add_subfolders(store, info->sibling, storage, prefix); + g_free(path); +} + +static void do_scan_subfolders(CamelStore *store, CamelFolderInfo *info, void *data) { EvolutionStorage *storage = data; if (info) { gtk_object_set_data((GtkObject *)storage, "connected", (void *)1); - mail_storage_create_folder (storage, store, info); + do_add_subfolders(store, info, storage, ""); } } @@ -1130,9 +1148,7 @@ static void get_folder_get(struct _mail_msg *mm) { struct _get_folder_msg *m = (struct _get_folder_msg *)mm; - camel_operation_register(mm->cancel); m->folder = mail_tool_uri_to_folder(m->uri, &mm->ex); - camel_operation_unregister(mm->cancel); } static void get_folder_got(struct _mail_msg *mm) @@ -1140,7 +1156,7 @@ static void get_folder_got(struct _mail_msg *mm) struct _get_folder_msg *m = (struct _get_folder_msg *)mm; if (m->done) - m->done (m->uri, m->folder, m->data); + m->done(m->uri, m->folder, m->data); } static void get_folder_free(struct _mail_msg *mm) @@ -1197,9 +1213,7 @@ static void get_store_get(struct _mail_msg *mm) { struct _get_store_msg *m = (struct _get_store_msg *)mm; - camel_operation_register(mm->cancel); m->store = camel_session_get_store(session, m->uri, &mm->ex); - camel_operation_unregister(mm->cancel); } static void get_store_got(struct _mail_msg *mm) @@ -1269,11 +1283,9 @@ static void create_folder_get(struct _mail_msg *mm) struct _create_folder_msg *m = (struct _create_folder_msg *)mm; /* FIXME: supply a way to make indexes optional */ - camel_operation_register(mm->cancel); m->folder = mail_tool_get_folder_from_urlname(m->uri, "mbox", CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX, &mm->ex); - camel_operation_unregister(mm->cancel); } static void create_folder_got(struct _mail_msg *mm) @@ -1332,9 +1344,7 @@ static void sync_folder_sync(struct _mail_msg *mm) { struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; - camel_operation_register(mm->cancel); camel_folder_sync(m->folder, FALSE, &mm->ex); - camel_operation_unregister(mm->cancel); } static void sync_folder_synced(struct _mail_msg *mm) @@ -1419,7 +1429,7 @@ struct _get_message_msg { void (*done) (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data); void *data; CamelMimeMessage *message; - CamelOperation *cancel; + CamelCancel *cancel; }; static char *get_message_desc(struct _mail_msg *mm, int done) @@ -1433,9 +1443,9 @@ static void get_message_get(struct _mail_msg *mm) { struct _get_message_msg *m = (struct _get_message_msg *)mm; - camel_operation_register(m->cancel); + camel_cancel_register(m->cancel); m->message = camel_folder_get_message(m->folder, m->uid, &mm->ex); - camel_operation_unregister(m->cancel); + camel_cancel_unregister(m->cancel); } static void get_message_got(struct _mail_msg *mm) @@ -1452,7 +1462,7 @@ static void get_message_free(struct _mail_msg *mm) g_free(m->uid); camel_object_unref((CamelObject *)m->folder); - camel_operation_unref(m->cancel); + camel_cancel_unref(m->cancel); } static struct _mail_msg_op get_message_op = { @@ -1473,7 +1483,7 @@ mail_get_message(CamelFolder *folder, const char *uid, void (*done) (CamelFolder m->uid = g_strdup(uid); m->data = data; m->done = done; - m->cancel = camel_operation_new(NULL, NULL); + m->cancel = camel_cancel_new(); e_thread_put(thread, (EMsg *)m); } @@ -1546,9 +1556,7 @@ static struct _mail_msg_op get_messages_op = { }; void -mail_get_messages(CamelFolder *folder, GPtrArray *uids, - void (*done) (CamelFolder *folder, GPtrArray *uids, GPtrArray *msgs, void *data), - void *data) +mail_get_messages(CamelFolder *folder, GPtrArray *uids, void (*done) (CamelFolder *folder, GPtrArray *uids, GPtrArray *msgs, void *data), void *data) { struct _get_messages_msg *m; @@ -1563,6 +1571,250 @@ mail_get_messages(CamelFolder *folder, GPtrArray *uids, e_thread_put(mail_thread_new, (EMsg *)m); } + +/* dum de dum, below is an entirely async 'operation' thingy */ +struct _op_data { + void *out; + void *in; + CamelException *ex; + const mail_operation_spec *op; + int pipe[2]; + int free; + GIOChannel *channel; +}; + +static void * +runthread(void *oin) +{ + struct _op_data *o = oin; + + o->op->callback(o->in, o->out, o->ex); + + printf("thread run, sending notificaiton\n"); + + write(o->pipe[1], "", 1); + + return oin; +} + +static gboolean +runcleanup(GIOChannel *source, GIOCondition cond, void *d) +{ + struct _op_data *o = d; + + printf("ggot notification, blup\n"); + + o->op->cleanup(o->in, o->out, o->ex); + + /*close(o->pipe[0]);*/ + close(o->pipe[1]); + + if (o->free) + g_free(o->in); + g_free(o->out); + camel_exception_free(o->ex); + g_free(o); + + g_io_channel_unref(source); + + return FALSE; +} + +#include <pthread.h> + +/* quick hack, like queue, but it runs it instantly in a new thread ! */ +int +mail_operation_run(const mail_operation_spec *op, void *in, int free) +{ + struct _op_data *o; + pthread_t id; + + o = g_malloc0(sizeof(*o)); + o->op = op; + o->in = in; + o->out = g_malloc0(op->datasize); + o->ex = camel_exception_new(); + o->free = free; + pipe(o->pipe); + + o->channel = g_io_channel_unix_new(o->pipe[0]); + g_io_add_watch(o->channel, G_IO_IN, (GIOFunc)runcleanup, o); + + o->op->setup(o->in, o->out, o->ex); + + pthread_create(&id, 0, runthread, o); + + return TRUE; +} + +/* ** SETUP TRASH VFOLDER ************************************************* */ + +typedef struct setup_trash_input_s { + gchar *name; + gchar *store_uri; + CamelFolder **folder; +} setup_trash_input_t; + +static gchar * +describe_setup_trash (gpointer in_data, gboolean gerund) +{ + setup_trash_input_t *input = (setup_trash_input_t *) in_data; + + if (gerund) + return g_strdup_printf (_("Loading %s Folder for %s"), input->name, input->store_uri); + else + return g_strdup_printf (_("Load %s Folder for %s"), input->name, input->store_uri); +} + +/* maps the shell's uri to the real vfolder uri and open the folder */ +static CamelFolder * +create_trash_vfolder (const char *name, GPtrArray *urls, CamelException *ex) +{ + void camel_vee_folder_add_folder (CamelFolder *, CamelFolder *); + + char *storeuri, *foldername; + CamelFolder *folder = NULL, *sourcefolder; + const char *sourceuri; + int source = 0; + + d(fprintf (stderr, "Creating Trash vfolder\n")); + + storeuri = g_strdup_printf ("vfolder:%s/vfolder/%s", evolution_dir, name); + foldername = g_strdup ("mbox?(match-all (system-flag Deleted))"); + + /* we dont have indexing on vfolders */ + folder = mail_tool_get_folder_from_urlname (storeuri, foldername, CAMEL_STORE_FOLDER_CREATE, ex); + + sourceuri = NULL; + while (source < urls->len) { + sourceuri = urls->pdata[source]; + fprintf (stderr, "adding vfolder source: %s\n", sourceuri); + + sourcefolder = mail_tool_uri_to_folder (sourceuri, ex); + d(fprintf (stderr, "source folder = %p\n", sourcefolder)); + + if (sourcefolder) { + mail_tool_camel_lock_up (); + camel_vee_folder_add_folder (folder, sourcefolder); + mail_tool_camel_lock_down (); + } else { + /* we'll just silently ignore now-missing sources */ + camel_exception_clear (ex); + } + + g_free (urls->pdata[source]); + source++; + } + + g_ptr_array_free (urls, TRUE); + + g_free (foldername); + g_free (storeuri); + + return folder; +} + +static void +populate_folder_urls (CamelFolderInfo *info, GPtrArray *urls) +{ + if (!info) + return; + + g_ptr_array_add (urls, info->url); + + if (info->child) + populate_folder_urls (info->child, urls); + + if (info->sibling) + populate_folder_urls (info->sibling, urls); +} + +static void +local_folder_urls (gpointer key, gpointer value, gpointer user_data) +{ + GPtrArray *urls = user_data; + CamelFolder *folder = value; + + g_ptr_array_add (urls, g_strdup_printf ("file://%s/local/%s", + evolution_dir, + folder->full_name)); +} + +static void +do_setup_trash (gpointer in_data, gpointer op_data, CamelException *ex) +{ + setup_trash_input_t *input = (setup_trash_input_t *) in_data; + EvolutionStorage *storage; + CamelFolderInfo *info; + CamelStore *store; + GPtrArray *urls; + + urls = g_ptr_array_new (); + + /* we don't want to connect */ + store = (CamelStore *) camel_session_get_service (session, input->store_uri, + CAMEL_PROVIDER_STORE, ex); + if (store == NULL) { + g_warning ("Couldn't get service %s: %s\n", input->store_uri, + camel_exception_get_description (ex)); + camel_exception_clear (ex); + } else { + char *path, *uri; + + if (!strcmp (input->store_uri, "file:/")) { + /* Yeah - this is a hack but then again so are local folders */ + g_hash_table_foreach (store->folders, local_folder_urls, urls); + } else { + info = camel_store_get_folder_info (store, "/", TRUE, TRUE, TRUE, ex); + populate_folder_urls (info, urls); + camel_store_free_folder_info (store, info); + } + + *(input->folder) = create_trash_vfolder (input->name, urls, ex); + + uri = g_strdup_printf ("vfolder:%s", input->name); + path = g_strdup_printf ("/%s", input->name); + storage = mail_lookup_storage (store); + evolution_storage_new_folder (storage, path, g_basename (path), + "mail", uri, input->name, FALSE); + gtk_object_unref (GTK_OBJECT (storage)); + g_free (path); + g_free (uri); + } +} + +static void +cleanup_setup_trash (gpointer in_data, gpointer op_data, CamelException *ex) +{ + setup_trash_input_t *input = (setup_trash_input_t *) in_data; + + g_free (input->name); + g_free (input->store_uri); +} + +static const mail_operation_spec op_setup_trash = { + describe_setup_trash, + 0, + NULL, + do_setup_trash, + cleanup_setup_trash +}; + +void +mail_do_setup_trash (const char *name, const char *store_uri, CamelFolder **folder) +{ + setup_trash_input_t *input; + + g_return_if_fail (name != NULL); + g_return_if_fail (folder != NULL); + + input = g_new (setup_trash_input_t, 1); + input->name = g_strdup (name); + input->store_uri = g_strdup (store_uri); + input->folder = folder; + mail_operation_queue (&op_setup_trash, input, TRUE); +} + /* ** SAVE MESSAGES ******************************************************* */ struct _save_messages_msg { diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index b9f51b65ac..c5a38f3949 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -30,7 +30,7 @@ #include "filter/filter-filter.h" #include "camel/camel-filter-driver.h" #include "camel/camel-folder.h" -#include "camel/camel-operation.h" +#include "camel/camel-session.h" #include "evolution-storage.h" @@ -48,11 +48,6 @@ #include <libgnomeui/gnome-dialog.h> #include <libgnomeui/gnome-window-icon.h> -#define d(x) - -/* ms between status updates to the gui */ -#define STATUS_TIMEOUT (250) - /* send/receive email */ /* ********************************************************************** */ @@ -70,16 +65,16 @@ struct _folder_info { struct _send_data { GList *infos; + int active; /* how many still active */ + GnomeDialog *gd; int cancelled; - CamelFolder *inbox; /* since we're never asked to update this one, do it ourselves */ + CamelFolder *inbox; /* since w'ere never asked to uypdate this one, do it ourselves */ time_t inbox_update; GMutex *lock; GHashTable *folders; - - GHashTable *active; /* send_info's by uri */ }; typedef enum { @@ -96,123 +91,84 @@ typedef enum { struct _send_info { send_info_t type; /* 0 = fetch, 1 = send */ - CamelOperation *cancel; + CamelCancel *cancel; char *uri; int keep; send_state_t state; GtkProgressBar *bar; GtkButton *stop; - - int timeout_id; - char *what; - int pc; - - /*time_t update;*/ + time_t update; struct _send_data *data; }; -static struct _send_data *send_data = NULL; - -static struct _send_data *setup_send_data(void) -{ - struct _send_data *data; - - if (send_data == NULL) { - send_data = data = g_malloc0(sizeof(*data)); - data->lock = g_mutex_new(); - data->folders = g_hash_table_new(g_str_hash, g_str_equal); - data->inbox = mail_tool_get_local_inbox(NULL); - data->active = g_hash_table_new(g_str_hash, g_str_equal); - } - return send_data; -} - static void receive_cancel(GtkButton *button, struct _send_info *info) { if (info->state == SEND_ACTIVE) { - camel_operation_cancel(info->cancel); - if (info->bar) - gtk_progress_set_format_string((GtkProgress *)info->bar, _("Cancelling ...")); + camel_cancel_cancel(info->cancel); + gtk_progress_set_format_string((GtkProgress *)info->bar, _("Cancelling ...")); info->state = SEND_CANCELLED; } - if (info->stop) - gtk_widget_set_sensitive((GtkWidget *)info->stop, FALSE); + gtk_widget_set_sensitive((GtkWidget *)info->stop, FALSE); } static void free_folder_info(void *key, struct _folder_info *info, void *data) { - /*camel_folder_thaw (info->folder); */ + camel_folder_thaw (info->folder); camel_object_unref((CamelObject *)info->folder); g_free(info->uri); } -static void free_send_info(void *key, struct _send_info *info, void *data) -{ - d(printf("Freeing send info %p\n", info)); - g_free(info->uri); - camel_operation_unref(info->cancel); - if (info->timeout_id != 0) - gtk_timeout_remove(info->timeout_id); - g_free(info); -} - static void -free_send_data(void) +free_info_data(void *datain) { - struct _send_data *data = send_data; - - g_assert(g_hash_table_size(data->active) == 0); + struct _send_data *data = datain; + GList *list = data->infos; + + while (list) { + struct _send_info *info = list->data; + g_free(info->uri); + camel_cancel_unref(info->cancel); + list = list->next; + } g_list_free(data->infos); - g_hash_table_foreach(data->active, (GHFunc)free_send_info, NULL); - g_hash_table_destroy(data->active); g_hash_table_foreach(data->folders, (GHFunc)free_folder_info, NULL); g_hash_table_destroy(data->folders); g_mutex_free(data->lock); if (data->inbox) { - /*camel_folder_thaw (data->inbox); */ + camel_folder_thaw (data->inbox); camel_object_unref((CamelObject *)data->inbox); } g_free(data); - send_data = NULL; -} - - -static void cancel_send_info(void *key, struct _send_info *info, void *data) -{ - receive_cancel(info->stop, info); -} - -static void hide_send_info(void *key, struct _send_info *info, void *data) -{ - info->stop = NULL; - info->bar = NULL; } static void dialogue_clicked(GnomeDialog *gd, int button, struct _send_data *data) { + GList *scan; + switch(button) { - case 0: - d(printf("cancelled whole thing\n")); + case 0: /* ok */ + gnome_dialog_close(gd); + break; + case 1: + printf("cancelled whole thing\n"); if (!data->cancelled) { data->cancelled = TRUE; - g_hash_table_foreach(data->active, (GHFunc)cancel_send_info, NULL); + scan = data->infos; + while (scan) { + struct _send_info *info = scan->data; + receive_cancel(info->stop, info); + scan = scan->next; + } } - gnome_dialog_set_sensitive(gd, 0, FALSE); - break; - case -1: /* dialogue vanished, so make out its just hidden */ - d(printf("hiding dialogue\n")); - g_hash_table_foreach(data->active, (GHFunc)hide_send_info, NULL); + gnome_dialog_set_sensitive(gd, 1, FALSE); break; } } -static void operation_status(CamelOperation *op, const char *what, int pc, void *data); -static int operation_status_timeout(void *data); - static struct _send_data *build_dialogue(GSList *sources, CamelFolder *outbox, const char *destination) { GnomeDialog *gd; @@ -225,10 +181,15 @@ static struct _send_data *build_dialogue(GSList *sources, CamelFolder *outbox, c GtkProgressBar *bar; GtkButton *stop; struct _send_info *info; - - data = setup_send_data(); - - gd = (GnomeDialog *)gnome_dialog_new(_("Send & Receive mail"), GNOME_STOCK_BUTTON_CANCEL, NULL); + + data = g_malloc0(sizeof(*data)); + data->lock = g_mutex_new(); + data->folders = g_hash_table_new(g_str_hash, g_str_equal); + data->inbox = mail_tool_get_local_inbox(NULL); + camel_folder_freeze (data->inbox); + + gd = (GnomeDialog *)gnome_dialog_new(_("Send & Receive mail"), GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); + gnome_dialog_set_sensitive(gd, 0, FALSE); gnome_window_icon_set_from_file((GtkWindow *)gd, EVOLUTION_DATADIR "images/evolution/evolution-inbox.png"); frame= (GtkFrame *)gtk_frame_new(_("Receiving")); @@ -241,44 +202,24 @@ static struct _send_data *build_dialogue(GSList *sources, CamelFolder *outbox, c while (sources) { MailConfigService *source = sources->data; - if (!source->url - || !source->enabled) { + if (!source->url) { sources = sources->next; continue; } - - /* see if we have an outstanding download active */ - info = g_hash_table_lookup(data->active, source->url); - if (info == NULL) { - info = g_malloc0(sizeof(*info)); - /* imap is handled differently */ - if (!strncmp(source->url, "imap:", 5)) - info->type = SEND_UPDATE; - else - info->type = SEND_RECEIVE; - d(printf("adding source %s\n", source->url)); - - info->uri = g_strdup(source->url); - info->keep = source->keep_on_server; - info->cancel = camel_operation_new(operation_status, info); - info->state = SEND_ACTIVE; - info->timeout_id = gtk_timeout_add(STATUS_TIMEOUT, operation_status_timeout, info); - - g_hash_table_insert(data->active, info->uri, info); - list = g_list_prepend(list, info); - } else if (info->bar != NULL) { - /* incase we get the same source pop up again */ - sources = sources->next; - continue; - } else if (info->timeout_id == 0) - info->timeout_id = gtk_timeout_add(STATUS_TIMEOUT, operation_status_timeout, info); + + info = g_malloc0(sizeof(*info)); + /* imap is handled differently */ + if (!strncmp(source->url, "imap:", 5)) + info->type = SEND_UPDATE; + else + info->type = SEND_RECEIVE; + printf("adding source %s\n", source->url); label = (GtkLabel *)gtk_label_new(source->url); bar = (GtkProgressBar *)gtk_progress_bar_new(); stop = (GtkButton *)gnome_stock_button(GNOME_STOCK_BUTTON_CANCEL); gtk_progress_set_show_text((GtkProgress *)bar, TRUE); - if (info->type == SEND_UPDATE) { gtk_progress_set_format_string((GtkProgress *)bar, _("Updating ...")); } else { @@ -290,8 +231,15 @@ static struct _send_data *build_dialogue(GSList *sources, CamelFolder *outbox, c gtk_table_attach(table, (GtkWidget *)stop, 2, 3, row, row+1, GTK_EXPAND|GTK_FILL, 0, 3, 1); info->bar = bar; + info->uri = g_strdup(source->url); + info->keep = source->keep_on_server; + info->cancel = camel_cancel_new(); info->stop = stop; info->data = data; + info->state = SEND_ACTIVE; + data->active++; + + list = g_list_prepend(list, info); gtk_signal_connect((GtkObject *)stop, "clicked", receive_cancel, info); sources = sources->next; @@ -307,23 +255,10 @@ static struct _send_data *build_dialogue(GSList *sources, CamelFolder *outbox, c gtk_container_add((GtkContainer *)frame, (GtkWidget *)table); gtk_widget_show((GtkWidget *)frame); - info = g_hash_table_lookup(data->active, destination); - if (info == NULL) { - info = g_malloc0(sizeof(*info)); - info->type = SEND_SEND; - d(printf("adding dest %s\n", destination)); - - info->uri = g_strdup(destination); - info->keep = FALSE; - info->cancel = camel_operation_new(operation_status, info); - info->state = SEND_ACTIVE; - info->timeout_id = gtk_timeout_add(STATUS_TIMEOUT, operation_status_timeout, info); - - g_hash_table_insert(data->active, info->uri, info); - list = g_list_prepend(list, info); - } else if (info->timeout_id == 0) - info->timeout_id = gtk_timeout_add(STATUS_TIMEOUT, operation_status_timeout, info); - + info = g_malloc0(sizeof(*info)); + info->type = SEND_SEND; + printf("adding dest %s\n", destination); + label = (GtkLabel *)gtk_label_new(destination); bar = (GtkProgressBar *)gtk_progress_bar_new(); stop = (GtkButton *)gnome_stock_button(GNOME_STOCK_BUTTON_CANCEL); @@ -336,9 +271,16 @@ static struct _send_data *build_dialogue(GSList *sources, CamelFolder *outbox, c gtk_table_attach(table, (GtkWidget *)stop, 2, 3, row, row+1, GTK_EXPAND|GTK_FILL, 0, 3, 1); info->bar = bar; + info->uri = g_strdup(destination); + info->keep = FALSE; + info->cancel = camel_cancel_new(); info->stop = stop; info->data = data; - + info->state = SEND_ACTIVE; + data->active++; + + list = g_list_prepend(list, info); + gtk_signal_connect((GtkObject *)stop, "clicked", receive_cancel, info); gtk_widget_show_all((GtkWidget *)table); } @@ -349,6 +291,7 @@ static struct _send_data *build_dialogue(GSList *sources, CamelFolder *outbox, c data->infos = list; data->gd = gd; + gtk_object_set_data_full((GtkObject *)gd, "info_data", data, free_info_data); return data; } @@ -358,54 +301,83 @@ update_folders(char *uri, struct _folder_info *info, void *data) { time_t now = *((time_t *)data); - d(printf("checking update for folder: %s\n", info->uri)); + printf("checking update for folder: %s\n", info->uri); /* let it flow through to the folders every 10 seconds */ /* we back off slowly as we progress */ if (now > info->update+10+info->count*5) { - d(printf("upating a folder: %s\n", info->uri)); - /*camel_folder_thaw(info->folder); - camel_folder_freeze(info->folder);*/ + printf("upating a folder: %s\n", info->uri); + camel_folder_thaw(info->folder); + camel_folder_freeze(info->folder); info->update = now; info->count++; } } -static void set_send_status(struct _send_info *info, const char *desc, int pc) +/* for forwarding stuff to the gui thread */ +struct _status_msg { + struct _mail_msg msg; + char *desc; + int pc; + struct _send_info *info; +}; + +static void +do_show_status(struct _mail_msg *mm) { - const char *p; - char *out, *o, c; + struct _status_msg *m = (struct _status_msg *)mm; + char *out, *p, *o, c; - out = alloca(strlen(desc)*2+1); + out = alloca(strlen(m->desc)*2+1); o = out; - p = desc; + p = m->desc; while ((c = *p++)) { if (c=='%') *o++ = '%'; *o++ = c; } *o = 0; - - /* FIXME: LOCK */ - g_free(info->what); - info->what = g_strdup(out); - info->pc = pc; + gtk_progress_set_percentage((GtkProgress *)m->info->bar, (gfloat)(m->pc/100.0)); + gtk_progress_set_format_string((GtkProgress *)m->info->bar, out); } static void +do_free_status(struct _mail_msg *mm) +{ + struct _status_msg *m = (struct _status_msg *)mm; + + g_free(m->desc); +} + +struct _mail_msg_op status_op = { + NULL, + do_show_status, + NULL, + do_free_status, +}; + +static void receive_status (CamelFilterDriver *driver, enum camel_filter_status_t status, int pc, const char *desc, void *data) { struct _send_info *info = data; time_t now; + struct _status_msg *m; + + /* only update every second */ + now = time(0); + if (now <= info->update) + return; + + info->update = now; /* let it flow through to the folder, every now and then too? */ g_hash_table_foreach(info->data->folders, (GHFunc)update_folders, &now); if (info->data->inbox && now > info->data->inbox_update+20) { - d(printf("updating inbox too\n")); + printf("updating inbox too\n"); /* this doesn't seem to work right :( */ - /*camel_folder_thaw(info->data->inbox); - camel_folder_freeze(info->data->inbox);*/ + camel_folder_thaw(info->data->inbox); + camel_folder_freeze(info->data->inbox); info->data->inbox_update = now; } @@ -416,83 +388,41 @@ receive_status (CamelFilterDriver *driver, enum camel_filter_status_t status, in switch (status) { case CAMEL_FILTER_STATUS_START: case CAMEL_FILTER_STATUS_END: - set_send_status(info, desc, pc); + m = mail_msg_new(&status_op, NULL, sizeof(*m)); + m->desc = g_strdup(desc); + m->pc = pc; + m->info = info; + e_msgport_put(mail_gui_port, (EMsg *)m); break; default: break; } } -static int operation_status_timeout(void *data) -{ - struct _send_info *info = data; - - if (info->bar) { - gtk_progress_set_percentage((GtkProgress *)info->bar, (gfloat)(info->pc/100.0)); - gtk_progress_set_format_string((GtkProgress *)info->bar, info->what); - - return TRUE; - } - - return FALSE; -} - -/* for camel operation status */ -static void operation_status(CamelOperation *op, const char *what, int pc, void *data) -{ - struct _send_info *info = data; - - /*printf("Operation '%s', percent %d\n");*/ - switch (pc) { - case CAMEL_OPERATION_START: - pc = 0; - break; - case CAMEL_OPERATION_END: - pc = 100; - break; - } - - set_send_status(info, what, pc); -} - /* when receive/send is complete */ static void receive_done (char *uri, void *data) { struct _send_info *info = data; - if (info->bar) { - gtk_progress_set_percentage((GtkProgress *)info->bar, (gfloat)1.0); + gtk_progress_set_percentage((GtkProgress *)info->bar, (gfloat)1.0); - switch(info->state) { - case SEND_CANCELLED: - gtk_progress_set_format_string((GtkProgress *)info->bar, _("Cancelled.")); - break; - default: - info->state = SEND_COMPLETE; - gtk_progress_set_format_string((GtkProgress *)info->bar, _("Complete.")); - } + switch(info->state) { + case SEND_CANCELLED: + gtk_progress_set_format_string((GtkProgress *)info->bar, _("Cancelled.")); + break; + default: + info->state = SEND_COMPLETE; + gtk_progress_set_format_string((GtkProgress *)info->bar, _("Complete.")); } - if (info->stop) - gtk_widget_set_sensitive((GtkWidget *)info->stop, FALSE); + gtk_widget_set_sensitive((GtkWidget *)info->stop, FALSE); - /* remove/free this active download */ - d(printf("%s: freeing info %p\n", __FUNCTION__, info)); - g_hash_table_remove(info->data->active, info->uri); - info->data->infos = g_list_remove(info->data->infos, info); - g_free(info->uri); - camel_operation_unref(info->cancel); - if (info->timeout_id) - gtk_timeout_remove(info->timeout_id); - - if (g_hash_table_size(info->data->active) == 0) { - if (info->data->gd) - gtk_object_unref((GtkObject *)info->data->gd); - free_send_data(); + info->data->active--; + if (info->data->active == 0) { + gnome_dialog_set_sensitive(info->data->gd, 0, TRUE); + gnome_dialog_set_sensitive(info->data->gd, 1, FALSE); } - - g_free(info); } /* same for updating */ @@ -533,7 +463,7 @@ receive_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelExcep camel_object_unref((CamelObject *)oldinfo->folder); oldinfo->folder = folder; } else { - /*camel_folder_freeze (folder); */ + camel_folder_freeze (folder); oldinfo = g_malloc0(sizeof(*oldinfo)); oldinfo->folder = folder; oldinfo->uri = g_strdup(uri); @@ -631,155 +561,3 @@ void mail_send_receive(void) gtk_object_unref((GtkObject *)fc); } -struct _auto_data { - char *uri; - int keep; /* keep on server flag */ - int period; /* in seconds */ - int timeout_id; -}; - -static GHashTable *auto_active; - -static gboolean -auto_timeout(void *data) -{ - struct _auto_data *info = data; - - mail_receive_uri(info->uri, info->keep); - - return TRUE; -} - -static void auto_setup_set(void *key, struct _auto_data *info, GHashTable *set) -{ - g_hash_table_insert(set, info->uri, info); -} - -static void auto_clean_set(void *key, struct _auto_data *info, GHashTable *set) -{ - d(printf("removing auto-check for %s %p\n", info->uri, info)); - g_hash_table_remove(set, info->uri); - gtk_timeout_remove(info->timeout_id); - g_free(info->uri); - g_free(info); -} - -/* 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_setup(void) -{ - GSList *sources; - GHashTable *set_hash; - - sources = mail_config_get_sources(); - if (!sources) - return; - - if (auto_active == NULL) - auto_active = g_hash_table_new(g_str_hash, g_str_equal); - - set_hash = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_foreach(auto_active, (GHFunc)auto_setup_set, set_hash); - - while (sources) { - MailConfigService *source = sources->data; - if (source->url && source->auto_check && source->enabled) { - struct _auto_data *info; - - d(printf("setting up auto-receive mail for : %s\n", source->url)); - - g_hash_table_remove(set_hash, source->url); - info = g_hash_table_lookup(auto_active, source->url); - if (info) { - info->keep = source->keep_on_server; - if (info->period != source->auto_check_time*60) { - info->period = source->auto_check_time*60; - gtk_timeout_remove(info->timeout_id); - info->timeout_id = gtk_timeout_add(info->period*1000, auto_timeout, info); - } - } else { - info = g_malloc0(sizeof(*info)); - info->uri = g_strdup(source->url); - info->keep = source->keep_on_server; - info->period = source->auto_check_time*60; - info->timeout_id = gtk_timeout_add(info->period*1000, auto_timeout, info); - g_hash_table_insert(auto_active, info->uri, info); - /* If we do this at startup, it can cause the logon dialogue to be hidden, - so lets not */ - /*mail_receive_uri(source->url, source->keep_on_server);*/ - } - } - - sources = sources->next; - } - - g_hash_table_foreach(set_hash, (GHFunc)auto_clean_set, auto_active); - g_hash_table_destroy(set_hash); -} - -/* we setup the download info's in a hashtable, if we later need to build the gui, we insert - them in to add them. */ -void mail_receive_uri(const char *uri, int keep) -{ - FilterContext *fc; - struct _send_info *info; - struct _send_data *data; - extern CamelFolder *outbox_folder; - - data = setup_send_data(); - info = g_hash_table_lookup(data->active, uri); - if (info != NULL) { - d(printf("download of %s still in progress\n", uri)); - return; - } - - d(printf("starting non-interactive download of '%s'\n", uri)); - - info = g_malloc0(sizeof(*info)); - /* imap is handled differently */ - if (!strncmp(uri, "imap:", 5)) - info->type = SEND_UPDATE; - else - info->type = SEND_RECEIVE; - - info->bar = NULL; - info->uri = g_strdup(uri); - info->keep = keep; - info->cancel = camel_operation_new(operation_status, info); - info->stop = NULL; - info->data = data; - info->state = SEND_ACTIVE; - info->timeout_id = 0; - - d(printf("Adding new info %p\n", info)); - - g_hash_table_insert(data->active, info->uri, info); - - fc = mail_load_filter_context(); - switch(info->type) { - case SEND_RECEIVE: - mail_fetch_mail(info->uri, info->keep, - fc, FILTER_SOURCE_INCOMING, - info->cancel, - receive_get_folder, info, - receive_status, info, - receive_done, info); - break; - case SEND_SEND: - /* todo, store the folder in info? */ - mail_send_queue(outbox_folder, info->uri, - fc, FILTER_SOURCE_OUTGOING, - info->cancel, - receive_get_folder, info, - receive_status, info, - receive_done, info); - break; - case SEND_UPDATE: - /* FIXME: error reporting? */ - mail_get_store(info->uri, receive_update_got_store, info); - break; - } - gtk_object_unref((GtkObject *)fc); -} - diff --git a/shell/ChangeLog b/shell/ChangeLog index 1640522206..18dc60e0f4 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,177 +1,13 @@ -2001-03-13 Iain Holmes <iain@ximian.com> +2001-03-13 Ettore Perazzoli <ettore@ximian.com> - * importer/intelligent.c (start_importer): Add a "Don't ask me again" - checkbox and don't ask about an importer if the box was ticked. - -2001-03-12 Iain Holmes <iain@ximian.com> - - * Evolution-Storage.idl: Add a FolderResult structure. - - * e-local-storage.c (struct _AsyncCreateFolderCallbackData): Add a - Bonobo_Listener. - (notify_listener): Function to...notify the listener. - (component_async_create_folder_callback): Use the notify_listener - function. - (real_do_folder_create): New prototype. Replace all returns with - a call to notify_listener. Make the directory with a call to - e_mkdir_hier instead of multiple calls to mkdir. Only emit a fail - on a bad error, not on EEXIST. - (bonobo_interface_create_folder_cb): Namespace create_folder_cb to match - the others. - - e-shell.c: Run the intelligent importer. - - evolution-storage.c (impl_Storage_async_create_folder): Just emit the signal, - not the callback. - (e_marshal_NONE__POINTER_POINTER_POINTER_POINTER_POINTER): Lovely signal - marshaller. - (class_init): Change the signal definition for the create_folder signal. - - importer/GNOME_Evolution_Importer.idl: Add an IntelligentImporter inteface. - - importer/Makefile.am: Add the evolution-intelligent-importer.c, intelligent.c - and evolution-intelligent-importer.h to the files. - - importer/evolution-importer-listener.[ch]: Convert to BonoboXObject. - - importer/evolution-importer.[ch]: BonoboXObjectification. - - importer/evolution-intelligent-importer.[ch]: BonoboXObject for the - GNOME:Evolution:IntelligentImporter interface. - - importer/intelligent.c: Code for running the intelligent importers. - -2001-03-08 Ettore Perazzoli <ettore@ximian.com> - - * e-storage-set-view.c (get_folder_at_row): New helper function. - (create_target_list_for_row): Use it. - (table_drag_data_get): Get the selection from the shell component - using `evolution_shell_component_client_get_dnd_selection()'. - (set_e_shortcut_selection): Turn a `g_return_if_fail()' into a - `g_assert()'. - - * evolution-shell-component.c: New member `get_dnd_selection_fn' - in `EvolutionShellComponentPrivate'. - (evolution_shell_component_construct): New arg - @get_dnd_selection_fn. - (evolution_shell_component_new): Likewise. - (impl_ShellComponent_getDndSelection): New, implementation for - `ShellComponent::getDndSelection'. - (class_init): Install it. - - * evolution-shell-component-client.c - (evolution_shell_component_client_get_dnd_selection): New, wrapper - for `ShellComponent::getDndSelection'. - - * evolution-shell-component.h: Renamed - `EvolutionShellComponentPopulateFolderContextMenu' into - `EvolutionShellComponentPopulateFolderContextMenuFn'. New - function pointer typedef `EvolutionShellComponentGetDndSelectionFn'. - - * Evolution-ShellComponent.idl: New method - `ShellComponent::getDndSelection'. - - * e-storage-set-view.c (create_target_entries_from_dnd_type_list): - Always add an `E_SHORTCUT_TYPE' type at least. - (create_target_list_for_row): Don't return NULL if the list of - exported DND types is NULL. Don't create an unused target list. - Actually return the created target list. - (table_drag_data_get): If the @info is zero, set the e-shortcut - selection. - (set_uri_list_selection): Temporarily disabled. - -2001-03-07 Ettore Perazzoli <ettore@ximian.com> - - * e-component-registry.c (register_type): New args - @num_exported_dnd_types, @exported_dnd_types, - @num_accepted_dnd_types, @accepted_dnd_types. Pass them to - `e_folder_type_registry_register_type()'. - (register_component): Updated accordingly, getting the values from - the CORBA `GNOME::Evolution::FolderType' struct. - - * e-folder-type-registry.c: New members `accepted_dnd_types' and - `exported_dnd_types' in `struct _FolderType'. - (e_folder_type_registry_register_type): New args - @num_accepted_dnd_types, @accepted_dnd_types, - @num_exported_dnd_types, @exported_dnd_types. - (register_folder_type): Likewise. - (folder_type_new): Likewise. Use them to initialize - `accepted_dnd_types' and `exported_dnd_types' in the newly created - `FolderType' struct. - (e_folder_type_registry_get_accepted_dnd_types_for_type): New. - (e_folder_type_registry_get_exported_dnd_types_for_type): New. - - * e-storage-set-view.c: New #defined constant `DRAG_RESISTANCE'. - New members `drag_x', `drag_y', `drag_column', `drag_row' in - `EStorageSetViewPrivate'. - (init): Initialize them. - (button_press_event): New function, overriding for the - `::button_press_event' method. - (motion_notify_event): New function, overriding for the - `::motion_notify_event' method. - (class_init): Install them. - - * evolution-shell-component.c - (duplicate_null_terminated_string_array): New helper function. - (evolution_shell_component_construct): Copy the values for - `accepted_dnd_types' and `exported_dnd_types' from the original - folder type list using it. - (destroy): Free the `exported_dnd_types' and `accepted_dnd_types' - members too. - (fill_corba_sequence_from_null_terminated_string_array): New - helper function. - (impl_ShellComponent__get_supported_types): Also set the - `exported_dnd_types' and `accepted_dnd_types' values in the folder - type elements we return. - - * evolution-shell-component.h: Added `accepted_dnd_types' and - `exported_dnd_types' members to `EvolutionShellComponentFolderType'. - - * Evolution-ShellComponent.idl: Renamed `accepted_dnd_mime_types' - to `accepted_dnd_types' and `exported_dnd_mime_types' to - `exported_dnd_types'. These are not necessarily MIME types. - -2001-03-05 Christopher James Lahey <clahey@ximian.com> - - * e-storage-set-view.c: Override cursor_activated signal instead - of cursor_changed signal. + * importer/Makefile.am (INCLUDES): Remove `-g -Wall + -Wmissing-prototypes -Wmissing-declarations'. Use + `$(EXTRA_GNOME_CFLAGS)' instead of `$(GNOME_INCLUDEDIR)'. 2001-02-27 Dan Winship <danw@ximian.com> * main.c (development_warning): Update this again. -2001-02-26 Ettore Perazzoli <ettore@ximian.com> - - * Evolution-Shell.idl: Rename `FolderTypeList' to - `FolderTypeNameList' as it was confusing. - - * Evolution-ShellComponent.idl: New members - `accepted_dnd_mime_types' and `exported_dnd_mime_types' in `struct - FolderType'. - -2001-02-24 Jeffrey Stedfast <fejj@ximian.com> - - * e-storage.c (folder_changed_cb): Don't free a const pointer. - -2001-02-23 Iain Holmes <iain@ximian.com> - - * e-local-storage.c (construct): Connect to the create-folder signal. - (impl_async_create_folder): Move this into the real_do_folder_create - function. - (real_do_folder_create): Function that creates the folder. - (create_folder_cb): Creates the folder form a callback. - -2001-02-21 Michael Meeks <michael@ximian.com> - - * importer/importer.c: add include. - (show_import_wizard): update signature to that of a verb. - - * evolution-shell-component.c (corba_class_init): move into - (class_init): here & upd. - (evolution_shell_component_construct): upd. - (create_servant): kill. - (E_MAKE_TYPE) -> E_MAKE_X_TYPE. - 2001-02-20 Dan Winship <danw@ximian.com> * e-folder.c (_EFolderPrivate): split "highlighted" into @@ -185,54 +21,6 @@ correctly on folders so that folders will be highlighted whenever their children are. -2001-02-17 Christopher James Lahey <clahey@ximian.com> - - * e-shell-view-menu.c (file_verbs): Cast this fucntion pointer. - - * e-storage-set-view.c (ETABLE_SPEC): Turn on horizontal scrolling - here. - - * evolution-shell-component.c - (impl_ShellComponent_async_copy_folder): Commented out this unused - function. - - * evolution-storage.c (storage_gtk_to_corba_result): Removed an - unused variable here. - - * importer/importer.c: Include gal/widets/e-gui-utils.h. - -2001-02-14 Dan Winship <danw@ximian.com> - - * Evolution-Storage.idl: add asyncCreateFolder and - asyncRemoveFolder interfaces. (Use Bonobo::Listener rather than - creating a new listener interface.) - - * Evolution-LocalStorage.idl: Remove the - Evolution::LocalStorageOpsListener interface, which wasn't being - used. - - * evolution-storage.c (impl_Storage_async_create_folder, - impl_Storage_async_remove_folder): implement by emitting signals - on the EvolutionStorage object. Convert from - EvolutionStorageResult to GNOME_Evolution_Storage_Result (blah!) - (class_init): Set up the new "create_folder" and "remove_folder" - signals. - - * e-corba-storage.c (async_create_folder, async_remove_folder): - Implement, using the new Evolution::Storage IDL. Convert from - GNOME_Evolution_Storage_Result to EStorageResult (blah!) - - * e-storage-set.c (e_storage_set_async_create_folder): Don't allow - a NULL description (since it doesn't allow a NULL anythign else). - - * e-shell-folder-creation-dialog.c (dialog_clicked_cb): Pass "" - rather than NULL for the description. - -2001-02-12 Kjartan Maraas <kmaraas@gnome.org> - - * Makefile.am: xml-i18n-tools setup. - * GNOME_Evolution_Shell.oaf.in: Mark strings for translation. - 2001-02-10 Ettore Perazzoli <ettore@ximian.com> * e-shell-view-menu.c: Moved the author list to the top of the diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c index b9da2cf8c8..9cdb8068fc 100644 --- a/shell/e-shell-folder-creation-dialog.c +++ b/shell/e-shell-folder-creation-dialog.c @@ -186,7 +186,7 @@ dialog_clicked_cb (GnomeDialog *dialog, e_storage_set_async_create_folder (storage_set, path, folder_type, - "", /* description */ + NULL, /* description */ async_create_cb, dialog_data); } diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c index 4238aa5b9e..dbfcb42217 100644 --- a/shell/e-shell-view-menu.c +++ b/shell/e-shell-view-menu.c @@ -448,7 +448,7 @@ BonoboUIVerb new_verbs [] = { }; BonoboUIVerb file_verbs [] = { - BONOBO_UI_VERB ("FileImporter", (BonoboUIVerbFn) show_import_wizard), + BONOBO_UI_VERB ("FileImporter", show_import_wizard), BONOBO_UI_VERB ("FileGoToFolder", command_goto_folder), BONOBO_UI_VERB ("FileCreateFolder", command_create_folder), BONOBO_UI_VERB ("FileClose", command_close), diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index ccab7502f2..da8669d075 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -45,11 +45,7 @@ static char *list [] = { }; #endif -#define DRAG_RESISTANCE 3 /* FIXME hardcoded in ETable to this value as - * well, and there is no way for us to use the - * same value as it's not exported. */ - -#define ETABLE_SPEC "<ETableSpecification no-headers=\"true\" selection-mode=\"single\" cursor-mode=\"line\" draw-grid=\"true\" horizontal-scrolling=\"true\"> \ +#define ETABLE_SPEC "<ETableSpecification no-headers=\"true\" selection-mode=\"single\" cursor-mode=\"line\" draw-grid=\"true\"> \ <ETableColumn model_col=\"0\" _title=\"Folder\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"render_tree\" compare=\"string\"/> \ <ETableState> \ <column source=\"0\"/> \ @@ -71,13 +67,10 @@ struct _EStorageSetViewPrivate { GHashTable *type_name_to_pixbuf; - /* Path of the row selected by the latest "cursor_activated" signal. */ + /* Path of the row selected by the latest "cursor_change" signal. */ const char *selected_row_path; gboolean show_folders; - - int drag_x, drag_y; - int drag_column, drag_row; }; @@ -233,30 +226,6 @@ get_pixbuf_for_folder (EStorageSetView *storage_set_view, return scaled_pixbuf; } -static EFolder * -get_folder_at_row (EStorageSetView *storage_set_view, - int row) -{ - EStorageSetViewPrivate *priv; - ETreePath *folder_node_path; - const char *folder_path; - EFolder *folder; - - priv = storage_set_view->priv; - - folder_node_path = e_tree_model_node_at_row (priv->etree_model, row); - if (folder_node_path == NULL) - return NULL; - - folder_path = e_tree_model_node_get_data (priv->etree_model, folder_node_path); - g_assert (folder_path != NULL); - - folder = e_storage_set_get_folder (priv->storage_set, folder_path); - g_assert (folder != NULL); - - return folder; -} - /* Custom marshalling function. */ @@ -285,97 +254,6 @@ marshal_NONE__GDKDRAGCONTEXT_STRING_STRING_STRING (GtkObject *object, /* DnD selection setup stuff. */ -/* This will create an array of GtkTargetEntries from the specified list of DND - types. The type name will *not* be allocated in the list, as this is - supposed to be used only temporarily to set up the cell as a drag source. */ -static GtkTargetEntry * -create_target_entries_from_dnd_type_list (GList *dnd_types, - int *num_entries_return) -{ - GtkTargetEntry *entries; - GList *p; - int num_entries; - int i; - - if (dnd_types == NULL) - num_entries = 0; - else - num_entries = g_list_length (dnd_types); - - /* We always add an entry for an Evolution URI type. This will let us - do drag & drop within Evolution at least. */ - num_entries ++; - - entries = g_new (GtkTargetEntry, num_entries); - - i = 0; - - /* The Evolution URI will always come first. */ - entries[i].target = E_SHORTCUT_TYPE; - entries[i].flags = 0; - entries[i].info = 0; - i ++; - - for (p = dnd_types; p != NULL; p = p->next, i++) { - const char *dnd_type; - - g_assert (i < num_entries); - - dnd_type = (const char *) p->data; - - entries[i].target = (char *) dnd_type; - entries[i].flags = 0; - entries[i].info = i; - } - - *num_entries_return = num_entries; - return entries; -} - -static void -free_target_entries (GtkTargetEntry *entries) -{ - g_assert (entries != NULL); - - /* The target names are not strdup()ed so a simple free will do. */ - g_free (entries); -} - -static GtkTargetList * -create_target_list_for_row (EStorageSetView *storage_set_view, - int row) -{ - EStorageSetViewPrivate *priv; - GtkTargetList *target_list; - EFolderTypeRegistry *folder_type_registry; - GList *exported_dnd_types; - GtkTargetEntry *target_entries; - EFolder *folder; - const char *folder_type; - int num_target_entries; - - priv = storage_set_view->priv; - - folder_type_registry = e_storage_set_get_folder_type_registry (priv->storage_set); - - folder = get_folder_at_row (storage_set_view, row); - folder_type = e_folder_get_type_string (folder); - - exported_dnd_types = e_folder_type_registry_get_exported_dnd_types_for_type (folder_type_registry, - folder_type); - - target_entries = create_target_entries_from_dnd_type_list (exported_dnd_types, - &num_target_entries); - g_assert (target_entries != NULL); - - target_list = gtk_target_list_new (target_entries, num_target_entries); - - free_target_entries (target_entries); - - return target_list; -} - -#if 0 static void set_uri_list_selection (EStorageSetView *storage_set_view, GtkSelectionData *selection_data) @@ -391,7 +269,6 @@ set_uri_list_selection (EStorageSetView *storage_set_view, 8, (guchar *) uri_list, strlen (uri_list)); g_free (uri_list); } -#endif static void set_e_shortcut_selection (EStorageSetView *storage_set_view, @@ -403,7 +280,7 @@ set_e_shortcut_selection (EStorageSetView *storage_set_view, const char *trailing_slash; const char *name; - g_assert (storage_set_view != NULL); + g_return_if_fail(storage_set_view != NULL); priv = storage_set_view->priv; @@ -562,87 +439,7 @@ destroy (GtkObject *object) } -/* GtkWidget methods. */ - -static int -button_press_event (GtkWidget *widget, - GdkEventButton *event) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - ETable *table; - int row, column; - - storage_set_view = E_STORAGE_SET_VIEW (widget); - priv = storage_set_view->priv; - - table = E_TABLE (widget); - - /* FIXME correct? */ - if (GTK_WIDGET_CLASS (parent_class)->button_press_event != NULL) - (* GTK_WIDGET_CLASS (parent_class)->button_press_event) (widget, event); - - if (event->button != 1) - return FALSE; - - e_table_get_cell_at (table, event->x, event->y, &row, &column); - - priv->drag_x = event->x; - priv->drag_y = event->y; - priv->drag_column = column; - priv->drag_row = row; - - /* FIXME correct? */ - return TRUE; -} - -static int -motion_notify_event (GtkWidget *widget, - GdkEventMotion *event) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - ETable *table; - GtkTargetList *target_list; - GdkDragAction actions; - GdkDragContext *context; - - puts (__FUNCTION__); - - storage_set_view = E_STORAGE_SET_VIEW (widget); - priv = storage_set_view->priv; - - table = E_TABLE (widget); - - /* FIXME correct? */ - if (GTK_WIDGET_CLASS (parent_class)->motion_notify_event != NULL) - (* GTK_WIDGET_CLASS (parent_class)->motion_notify_event) (widget, event); - - /* FIXME correct? */ - if (! (event->state & GDK_BUTTON1_MASK)) - return FALSE; - - if (ABS (priv->drag_x - event->x) < DRAG_RESISTANCE - && ABS (priv->drag_y - event->y) < DRAG_RESISTANCE) - return FALSE; - - target_list = create_target_list_for_row (storage_set_view, priv->drag_row); - if (target_list == NULL) - return FALSE; - - actions = GDK_ACTION_MOVE | GDK_ACTION_COPY; - - context = e_table_drag_begin (table, - priv->drag_row, priv->drag_column, - target_list, actions, - 1, (GdkEvent *) event); - gtk_drag_set_icon_default (context); - - return FALSE; -} - - -/* ETable methods. */ +/* ETable methods */ static void table_drag_begin (ETable *etable, @@ -671,45 +468,19 @@ table_drag_data_get (ETable *etable, guint32 time) { EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - EFolder *folder; - EFolderTypeRegistry *folder_type_registry; - EvolutionShellComponentClient *component_client; - char *selection; - int selection_length; - int format; storage_set_view = E_STORAGE_SET_VIEW (etable); - priv = storage_set_view->priv; - if (info == 0) { + switch (info) { + case DND_TARGET_TYPE_URI_LIST: + set_uri_list_selection (storage_set_view, selection_data); + break; + case DND_TARGET_TYPE_E_SHORTCUT: set_e_shortcut_selection (storage_set_view, selection_data); - return; + break; + default: + g_assert_not_reached (); } - - g_assert (info > 0); - - folder = get_folder_at_row (storage_set_view, drag_row); - g_assert (folder != NULL); - - folder_type_registry = e_storage_set_get_folder_type_registry (priv->storage_set); - g_assert (folder_type_registry != NULL); - - component_client = e_folder_type_registry_get_handler_for_type (folder_type_registry, - e_folder_get_type_string (folder)); - g_assert (component_client != NULL); - - evolution_shell_component_client_get_dnd_selection (component_client, - e_folder_get_physical_uri (folder), - info, - &format, &selection, &selection_length); - if (selection == NULL) - return; - - gtk_selection_data_set (selection_data, selection_data->target, - format, selection, selection_length); - - g_free (selection); } static gboolean @@ -786,8 +557,8 @@ right_click (ETable *etable, } static void -cursor_activated (ETable *table, - int row) +cursor_change (ETable *table, + int row) { EStorageSetView *storage_set_view; ETreePath *node; @@ -1036,8 +807,8 @@ new_folder_cb (EStorageSet *storage_set, parent_path = g_strndup (path, last_separator - path); parent_node = g_hash_table_lookup (priv->path_to_etree_node, parent_path); if (parent_node == NULL) { - g_warning ("EStorageSetView: EStorageSet reported new subfolder for non-existing folder -- %s\n", - parent_path); + g_print ("EStorageSetView: EStorageSet reported new subfolder for non-existing folder -- %s\n", + parent_path); g_free (parent_path); return; } @@ -1099,7 +870,6 @@ static void class_init (EStorageSetViewClass *klass) { GtkObjectClass *object_class; - GtkWidgetClass *widget_class; ETableClass *etable_class; parent_class = gtk_type_class (e_table_get_type ()); @@ -1107,13 +877,9 @@ class_init (EStorageSetViewClass *klass) object_class = GTK_OBJECT_CLASS (klass); object_class->destroy = destroy; - widget_class = GTK_WIDGET_CLASS (klass); - widget_class->button_press_event = button_press_event; - widget_class->motion_notify_event = motion_notify_event; - etable_class = E_TABLE_CLASS (klass); etable_class->right_click = right_click; - etable_class->cursor_activated = cursor_activated; + etable_class->cursor_change = cursor_change; etable_class->table_drag_begin = table_drag_begin; etable_class->table_drag_data_get = table_drag_data_get; etable_class->table_drag_motion = table_drag_motion; @@ -1170,10 +936,6 @@ init (EStorageSetView *storage_set_view) priv->type_name_to_pixbuf = g_hash_table_new (g_str_hash, g_str_equal); priv->selected_row_path = NULL; priv->show_folders = TRUE; - priv->drag_x = 0; - priv->drag_y = 0; - priv->drag_column = 0; - priv->drag_row = 0; storage_set_view->priv = priv; } @@ -1355,7 +1117,6 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view, ETABLE_SPEC, NULL); gtk_object_unref (GTK_OBJECT (extras)); -#if 0 e_table_drag_source_set (E_TABLE (storage_set_view), GDK_BUTTON1_MASK, source_drag_types, num_source_drag_types, GDK_ACTION_MOVE | GDK_ACTION_COPY); @@ -1363,7 +1124,6 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view, e_table_drag_dest_set (E_TABLE (storage_set_view), GTK_DEST_DEFAULT_ALL, source_drag_types, num_source_drag_types, GDK_ACTION_MOVE | GDK_ACTION_COPY); -#endif gtk_object_ref (GTK_OBJECT (storage_set)); priv->storage_set = storage_set; diff --git a/shell/e-storage.c b/shell/e-storage.c index e38c5e3fbf..7045ef47d5 100644 --- a/shell/e-storage.c +++ b/shell/e-storage.c @@ -112,13 +112,11 @@ folder_changed_cb (EFolder *folder, GINT_TO_POINTER (highlight)); p = strrchr (path, '/'); if (p && p != path) { - char *name; - - name = g_strndup (path, p - path); - folder = e_folder_tree_get_folder (priv->folder_tree, name); - g_free (name); + path = g_strndup (path, p - path); + folder = e_folder_tree_get_folder (priv->folder_tree, path); if (folder) e_folder_set_child_highlight (folder, highlight); + g_free (path); } } } diff --git a/shell/importer/Makefile.am b/shell/importer/Makefile.am index 975d5a372a..2034387a99 100644 --- a/shell/importer/Makefile.am +++ b/shell/importer/Makefile.am @@ -1,7 +1,6 @@ INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shell \ - -I$(includedir) $(GNOME_INCLUDEDIR) \ - -DG_LOG_DOMAIN=\"Evolution-Importer\" -g -Wall \ - -Wmissing-prototypes -Wmissing-declarations \ + -I$(includedir) $(EXTRA_GNOME_CFLAGS) \ + -DG_LOG_DOMAIN=\"Evolution-Importer\" \ -DEVOLUTION_GLADEDIR=\"$(datadir)/evolution/glade\" lib_LTLIBRARIES = libevolution-importer.la @@ -27,17 +26,14 @@ idl_DATA = $(IDLS) libevolution_importerincludedir = $(includedir)/evolution/importer libevolution_importer_la_SOURCES = \ $(IDL_GENERATED) \ - evolution-intelligent-importer.c \ evolution-importer-client.c \ evolution-importer-listener.c \ evolution-importer.c \ - intelligent.c \ importer.c \ importer.h libevolution_importerinclude_HEADERS = \ GNOME_Evolution_Importer.h \ - evolution-intelligent-importer.h \ evolution-importer-client.h \ evolution-importer-listener.h \ evolution-importer.h diff --git a/shell/main.c b/shell/main.c index 3f98fd85b1..6be5ad4e29 100644 --- a/shell/main.c +++ b/shell/main.c @@ -68,7 +68,7 @@ development_warning (void) "Evolution" VERSION, GNOME_STOCK_BUTTON_OK, NULL); -/* xgettext:no-c-format */ + label = gtk_label_new ( _( "Hi. Thanks for taking the time to download this PREVIEW RELEASE\n" diff --git a/ui/evolution-addressbook.h b/ui/evolution-addressbook.h deleted file mode 100644 index 3128ccfb83..0000000000 --- a/ui/evolution-addressbook.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This file is autogenerated from evolution-addressbook.xml, do not edit - * - * This file contains translatable strings generated by - * bonobo-ui-extract. Add this file to your project's - * POTFILES.in. DO NOT compile it as part of your application. - */ - -gchar *s = N_("_Print Contacts..."); -gchar *s = N_("As _Table"); -gchar *s = N_("_New Contact"); -gchar *s = N_("_Tools"); -gchar *s = N_("_Search for contacts"); -gchar *s = N_("New"); -gchar *s = N_("Create a new contact"); -gchar *s = N_("Find"); -gchar *s = N_("Find a contact"); -gchar *s = N_("Print"); -gchar *s = N_("Print contacts"); -gchar *s = N_("Delete"); -gchar *s = N_("Delete a contact"); -gchar *s = N_("View All"); -gchar *s = N_("View all contacts"); -gchar *s = N_("Stop"); -gchar *s = N_("Stop Loading"); diff --git a/ui/evolution-message-composer.h b/ui/evolution-message-composer.h deleted file mode 100644 index bcc259c4d5..0000000000 --- a/ui/evolution-message-composer.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is autogenerated from evolution-message-composer.xml, do not edit - * - * This file contains translatable strings generated by - * bonobo-ui-extract. Add this file to your project's - * POTFILES.in. DO NOT compile it as part of your application. - */ - -gchar *s = N_("Open"); -gchar *s = N_("Open a file"); -gchar *s = N_("Save"); -gchar *s = N_("Save the current file"); -gchar *s = N_("Save As"); -gchar *s = N_("Save the current file with a different name"); -gchar *s = N_("Close"); -gchar *s = N_("Close the current file"); -gchar *s = N_("Save in folder..."); -gchar *s = N_("Save the message in a specified folder"); -gchar *s = N_("Insert text file..."); -gchar *s = N_("Insert a file as text into the message"); -gchar *s = N_("Send"); -gchar *s = N_("Send the message now"); -gchar *s = N_("Send _later"); -gchar *s = N_("Send the message later"); -gchar *s = N_("Attach"); -gchar *s = N_("Attach a file"); -gchar *s = N_("HTML"); -gchar *s = N_("Send the mail in HTML format"); -gchar *s = N_("Show attachments"); -gchar *s = N_("Show / hide attachments"); -gchar *s = N_("_File"); -gchar *s = N_("_Open..."); -gchar *s = N_("_Save"); -gchar *s = N_("Save _As..."); -gchar *s = N_("Save in _folder... (FIXME)"); -gchar *s = N_("_Insert text file... (FIXME)"); -gchar *s = N_("Send"); -gchar *s = N_("Send _Later"); -gchar *s = N_("_Close"); -gchar *s = N_("_Edit"); -gchar *s = N_("F_ormat"); -gchar *s = N_("_View"); -gchar *s = N_("Show _attachments"); -gchar *s = N_("_Help"); -gchar *s = N_("_About..."); -gchar *s = N_("_Debug"); -gchar *s = N_("Send this message now"); -gchar *s = N_("Bold"); -gchar *s = N_("Sets something as bold"); - - - - diff --git a/widgets/meeting-time-sel/ChangeLog b/widgets/meeting-time-sel/ChangeLog index 3b917ecf07..0580ff4096 100644 --- a/widgets/meeting-time-sel/ChangeLog +++ b/widgets/meeting-time-sel/ChangeLog @@ -1,3 +1,9 @@ +2001-02-09 JP Rosevear <jpr@ximian.com> + + * e-meeting-time-sel-list-item.c + (e_meeting_time_selector_list_item_destroy): Unref + no_mail_icon_mask rather than mail_icon_mask twice + 2000-12-25 Miguel de Icaza <miguel@helixcode.com> * e-meeting-time-sel.c (e_meeting_time_selector_attendee_add): Set diff --git a/widgets/meeting-time-sel/e-meeting-time-sel-list-item.c b/widgets/meeting-time-sel/e-meeting-time-sel-list-item.c index da7e4176be..26a3e7fd47 100644 --- a/widgets/meeting-time-sel/e-meeting-time-sel-list-item.c +++ b/widgets/meeting-time-sel/e-meeting-time-sel-list-item.c @@ -156,7 +156,7 @@ e_meeting_time_selector_list_item_destroy (GtkObject *object) gdk_pixmap_unref (mtsl_item->mail_icon); gdk_pixmap_unref (mtsl_item->no_mail_icon); gdk_bitmap_unref (mtsl_item->mail_icon_mask); - gdk_bitmap_unref (mtsl_item->mail_icon_mask); + gdk_bitmap_unref (mtsl_item->no_mail_icon_mask); if (GTK_OBJECT_CLASS (e_meeting_time_selector_list_item_parent_class)->destroy) (*GTK_OBJECT_CLASS (e_meeting_time_selector_list_item_parent_class)->destroy)(object); diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c deleted file mode 100644 index 427eaa7d76..0000000000 --- a/widgets/menus/gal-define-views-dialog.c +++ /dev/null @@ -1,328 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* gal-define-views-dialog.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <gnome.h> -#include "gal-define-views-dialog.h" -#include "gal-define-views-model.h" -#include "gal-view-new-dialog.h" -#include <gal/e-table/e-table-scrolled.h> - -static void gal_define_views_dialog_init (GalDefineViewsDialog *card); -static void gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass); -static void gal_define_views_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void gal_define_views_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void gal_define_views_dialog_destroy (GtkObject *object); - -static GnomeDialogClass *parent_class = NULL; -#define PARENT_TYPE gnome_dialog_get_type() - -/* The arguments we take */ -enum { - ARG_0, - ARG_COLLECTION, -}; - -typedef struct { - char *title; - ETableModel *model; - GalDefineViewsDialog *names; -} GalDefineViewsDialogChild; - -GtkType -gal_define_views_dialog_get_type (void) -{ - static GtkType type = 0; - - if (!type) { - static const GtkTypeInfo info = - { - "GalDefineViewsDialog", - sizeof (GalDefineViewsDialog), - sizeof (GalDefineViewsDialogClass), - (GtkClassInitFunc) gal_define_views_dialog_class_init, - (GtkObjectInitFunc) gal_define_views_dialog_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -static void -gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->set_arg = gal_define_views_dialog_set_arg; - object_class->get_arg = gal_define_views_dialog_get_arg; - object_class->destroy = gal_define_views_dialog_destroy; - - gtk_object_add_arg_type("GalDefineViewsDialog::collection", GAL_VIEW_COLLECTION_TYPE, - GTK_ARG_READWRITE, ARG_COLLECTION); -} - -/* ETable creation */ -#define SPEC "<ETableSpecification cursor-mode=\"line\" draw-grid=\"true\" selection-mode=\"single\">" \ - "<ETableColumn model_col= \"0\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"18\" resizable=\"true\" cell=\"string\" compare=\"string\"/>" \ - "<ETableState> <column source=\"0\"/> <grouping> </grouping> </ETableState>" \ - "</ETableSpecification>" - -/* For use from libglade. */ -GtkWidget *gal_define_views_dialog_create_etable(char *name, char *string1, char *string2, int int1, int int2); - -GtkWidget * -gal_define_views_dialog_create_etable(char *name, char *string1, char *string2, int int1, int int2) -{ - GtkWidget *table; - ETableModel *model; - model = gal_define_views_model_new(); - table = e_table_scrolled_new(model, NULL, SPEC, NULL); - gtk_object_set_data(GTK_OBJECT(table), "GalDefineViewsDialog::model", model); - return table; -} - -/* Button callbacks */ - -static void -gdvd_button_new_dialog_callback(GtkWidget *widget, int button, GalDefineViewsDialog *dialog) -{ - gchar *name; - GalView *view; - GalViewFactory *factory; - switch (button) { - case 0: - gtk_object_get(GTK_OBJECT(widget), - "name", &name, - "factory", &factory, - NULL); - if (name && factory) { - view = gal_view_factory_new_view(factory, - name); - gal_define_views_model_append(GAL_DEFINE_VIEWS_MODEL(dialog->model), view); - gtk_object_unref(GTK_OBJECT(view)); - } - break; - } - gnome_dialog_close(GNOME_DIALOG(widget)); -} - -static void -gdvd_button_new_callback(GtkWidget *widget, GalDefineViewsDialog *dialog) -{ - GtkWidget *view_new_dialog = gal_view_new_dialog_new(dialog->collection); - gtk_signal_connect(GTK_OBJECT(view_new_dialog), "clicked", - GTK_SIGNAL_FUNC(gdvd_button_new_dialog_callback), dialog); - gtk_widget_show(GTK_WIDGET(view_new_dialog)); -} - -static void -gdvd_button_modify_callback(GtkWidget *widget, GalDefineViewsDialog *dialog) -{ - int row; - GtkWidget *scrolled; - ETable *etable; - - scrolled = glade_xml_get_widget(dialog->gui, "custom-table"); - etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(scrolled)); - row = e_table_get_cursor_row (E_TABLE(etable)); - - if (row != -1) { - GalView *view; - view = gal_define_views_model_get_view(GAL_DEFINE_VIEWS_MODEL(dialog->model), - row); - gal_view_edit(view); - } - -} - -static void -gdvd_button_delete_callback(GtkWidget *widget, GalDefineViewsDialog *dialog) -{ - int row; - GtkWidget *scrolled; - ETable *etable; - - scrolled = glade_xml_get_widget(dialog->gui, "custom-table"); - etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(scrolled)); - row = e_table_get_cursor_row (E_TABLE(etable)); - - if (row != -1) { - gal_define_views_model_delete_view(GAL_DEFINE_VIEWS_MODEL(dialog->model), - row); - } - -} - -static void -gdvd_button_copy_callback(GtkWidget *widget, GalDefineViewsDialog *dialog) -{ - int row; - GtkWidget *scrolled; - ETable *etable; - - scrolled = glade_xml_get_widget(dialog->gui, "custom-table"); - etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(scrolled)); - row = e_table_get_cursor_row (E_TABLE(etable)); - - if (row != -1) { - gal_define_views_model_copy_view(GAL_DEFINE_VIEWS_MODEL(dialog->model), - row); - } - -} - -static void -gdvd_connect_signal(GalDefineViewsDialog *dialog, char *widget_name, char *signal, GtkSignalFunc handler) -{ - GtkWidget *widget; - - widget = glade_xml_get_widget(dialog->gui, widget_name); - - if (widget) - gtk_signal_connect(GTK_OBJECT(widget), signal, handler, dialog); -} - -static void -gal_define_views_dialog_init (GalDefineViewsDialog *dialog) -{ - GladeXML *gui; - GtkWidget *widget; - GtkWidget *etable; - - dialog->collection = NULL; - - gui = glade_xml_new (GAL_GLADEDIR "/gal-define-views.glade", NULL); - dialog->gui = gui; - - widget = glade_xml_get_widget(gui, "table-top"); - if (!widget) { - return; - } - gtk_widget_ref(widget); - gtk_widget_unparent(widget); - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0); - gtk_widget_unref(widget); - - gnome_dialog_append_buttons(GNOME_DIALOG(dialog), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - - gdvd_connect_signal(dialog, "button-new", "clicked", GTK_SIGNAL_FUNC(gdvd_button_new_callback)); - gdvd_connect_signal(dialog, "button-modify", "clicked", GTK_SIGNAL_FUNC(gdvd_button_modify_callback)); - gdvd_connect_signal(dialog, "button-delete", "clicked", GTK_SIGNAL_FUNC(gdvd_button_delete_callback)); - gdvd_connect_signal(dialog, "button-copy", "clicked", GTK_SIGNAL_FUNC(gdvd_button_copy_callback)); - - dialog->model = NULL; - etable = glade_xml_get_widget(dialog->gui, "custom-table"); - if (etable) { - dialog->model = gtk_object_get_data(GTK_OBJECT(etable), "GalDefineViewsDialog::model"); - gtk_object_set(GTK_OBJECT(dialog->model), - "collection", dialog->collection, - NULL); - } - - gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE); -} - -static void -gal_define_views_dialog_destroy (GtkObject *object) { - GalDefineViewsDialog *gal_define_views_dialog = GAL_DEFINE_VIEWS_DIALOG(object); - - gtk_object_unref(GTK_OBJECT(gal_define_views_dialog->gui)); -} - -static void -gal_define_views_dialog_set_collection(GalDefineViewsDialog *dialog, - GalViewCollection *collection) -{ - dialog->collection = collection; - if (dialog->model) { - gtk_object_set(GTK_OBJECT(dialog->model), - "collection", collection, - NULL); - } -} - -/** - * gal_define_views_dialog_new - * - * Returns a new dialog for defining views. - * - * Returns: The GalDefineViewsDialog. - */ -GtkWidget* -gal_define_views_dialog_new (GalViewCollection *collection) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (gal_define_views_dialog_get_type ())); - gal_define_views_dialog_set_collection(GAL_DEFINE_VIEWS_DIALOG (widget), collection); - return widget; -} - -static void -gal_define_views_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GalDefineViewsDialog *dialog; - - dialog = GAL_DEFINE_VIEWS_DIALOG (o); - - switch (arg_id){ - case ARG_COLLECTION: - if (GTK_VALUE_OBJECT(*arg)) - gal_define_views_dialog_set_collection(dialog, GAL_VIEW_COLLECTION(GTK_VALUE_OBJECT(*arg))); - else - gal_define_views_dialog_set_collection(dialog, NULL); - break; - - default: - return; - } -} - -static void -gal_define_views_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - GalDefineViewsDialog *dialog; - - dialog = GAL_DEFINE_VIEWS_DIALOG (object); - - switch (arg_id) { - case ARG_COLLECTION: - if (dialog->collection) - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(dialog->collection); - else - GTK_VALUE_OBJECT(*arg) = NULL; - break; - - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} diff --git a/widgets/menus/gal-define-views-dialog.h b/widgets/menus/gal-define-views-dialog.h deleted file mode 100644 index e5ebd8feb3..0000000000 --- a/widgets/menus/gal-define-views-dialog.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* gal-define-views-dialog.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __GAL_DEFINE_VIEWS_DIALOG_H__ -#define __GAL_DEFINE_VIEWS_DIALOG_H__ - -#include <gnome.h> -#include <glade/glade.h> -#include <gal/e-table/e-table-model.h> -#include <gal/menus/gal-view-collection.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* GalDefineViewsDialog - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define GAL_DEFINE_VIEWS_DIALOG_TYPE (gal_define_views_dialog_get_type ()) -#define GAL_DEFINE_VIEWS_DIALOG(obj) (GTK_CHECK_CAST ((obj), GAL_DEFINE_VIEWS_DIALOG_TYPE, GalDefineViewsDialog)) -#define GAL_DEFINE_VIEWS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GAL_DEFINE_VIEWS_DIALOG_TYPE, GalDefineViewsDialogClass)) -#define GAL_IS_DEFINE_VIEWS_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GAL_DEFINE_VIEWS_DIALOG_TYPE)) -#define GAL_IS_DEFINE_VIEWS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GAL_DEFINE_VIEWS_DIALOG_TYPE)) - -typedef struct _GalDefineViewsDialog GalDefineViewsDialog; -typedef struct _GalDefineViewsDialogClass GalDefineViewsDialogClass; - -struct _GalDefineViewsDialog -{ - GnomeDialog parent; - - /* item specific fields */ - GladeXML *gui; - ETableModel *model; - - GalViewCollection *collection; -}; - -struct _GalDefineViewsDialogClass -{ - GnomeDialogClass parent_class; -}; - -GtkWidget *gal_define_views_dialog_new (GalViewCollection *collection); -GtkType gal_define_views_dialog_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __GAL_DEFINE_VIEWS_DIALOG_H__ */ diff --git a/widgets/menus/gal-define-views-model.c b/widgets/menus/gal-define-views-model.c deleted file mode 100644 index 70e0638d18..0000000000 --- a/widgets/menus/gal-define-views-model.c +++ /dev/null @@ -1,316 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * - * Author: - * Christopher James Lahey <clahey@helixcode.com> - * - * (C) 1999 Helix Code, Inc. - */ - -#include <config.h> -#include "gal-define-views-model.h" -#include <gnome-xml/tree.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> -#include <gnome.h> - -#define PARENT_TYPE e_table_model_get_type() -ETableModelClass *parent_class; - -/* - * GalDefineViewsModel callbacks - * These are the callbacks that define the behavior of our custom model. - */ -static void gal_define_views_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void gal_define_views_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - - -enum { - ARG_0, - ARG_EDITABLE, - ARG_COLLECTION -}; - -static void -gdvm_destroy(GtkObject *object) -{ - GalDefineViewsModel *model = GAL_DEFINE_VIEWS_MODEL(object); - - gtk_object_unref(GTK_OBJECT(model->collection)); -} - -/* This function returns the number of columns in our ETableModel. */ -static int -gdvm_col_count (ETableModel *etc) -{ - return 1; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -gdvm_row_count (ETableModel *etc) -{ - GalDefineViewsModel *views = GAL_DEFINE_VIEWS_MODEL(etc); - if (views->collection) - return gal_view_collection_get_count(views->collection); - else - return 0; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -gdvm_value_at (ETableModel *etc, int col, int row) -{ - GalDefineViewsModel *views = GAL_DEFINE_VIEWS_MODEL(etc); - const char *value; - - value = gal_view_get_title (gal_view_collection_get_view(views->collection, row)); - - return (void *)(value ? value : ""); -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -gdvm_set_value_at (ETableModel *etc, int col, int row, const void *val) -{ - GalDefineViewsModel *views = GAL_DEFINE_VIEWS_MODEL(etc); - if (views->editable) { - gal_view_set_title(gal_view_collection_get_view(views->collection, row), val); - e_table_model_cell_changed(etc, col, row); - } -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -gdvm_is_cell_editable (ETableModel *etc, int col, int row) -{ - return GAL_DEFINE_VIEWS_MODEL(etc)->editable; -} - -static void -gdvm_append_row (ETableModel *etm, ETableModel *source, gint row) -{ -} - -/* This function duplicates the value passed to it. */ -static void * -gdvm_duplicate_value (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -/* This function frees the value passed to it. */ -static void -gdvm_free_value (ETableModel *etc, int col, void *value) -{ - g_free(value); -} - -static void * -gdvm_initialize_value (ETableModel *etc, int col) -{ - return g_strdup(""); -} - -static gboolean -gdvm_value_is_empty (ETableModel *etc, int col, const void *value) -{ - return !(value && *(char *)value); -} - -static char * -gdvm_value_to_string (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -/** - * gal_define_views_model_append - * @model: The model to add to. - * @view: The view to add. - * - * Adds the given view to the gal define views model. - */ -void -gal_define_views_model_append (GalDefineViewsModel *model, - GalView *view) -{ - ETableModel *etm = E_TABLE_MODEL(model); - - e_table_model_pre_change(etm); - gal_view_collection_append(model->collection, view); - e_table_model_row_inserted(etm, gal_view_collection_get_count(model->collection) - 1); -} - -static void -gal_define_views_model_class_init (GtkObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = gdvm_destroy; - object_class->set_arg = gal_define_views_model_set_arg; - object_class->get_arg = gal_define_views_model_get_arg; - - gtk_object_add_arg_type ("GalDefineViewsModel::editable", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_EDITABLE); - gtk_object_add_arg_type ("GalDefineViewsModel::collection", GAL_VIEW_COLLECTION_TYPE, - GTK_ARG_READWRITE, ARG_COLLECTION); - - model_class->column_count = gdvm_col_count; - model_class->row_count = gdvm_row_count; - model_class->value_at = gdvm_value_at; - model_class->set_value_at = gdvm_set_value_at; - model_class->is_cell_editable = gdvm_is_cell_editable; - model_class->append_row = gdvm_append_row; - model_class->duplicate_value = gdvm_duplicate_value; - model_class->free_value = gdvm_free_value; - model_class->initialize_value = gdvm_initialize_value; - model_class->value_is_empty = gdvm_value_is_empty; - model_class->value_to_string = gdvm_value_to_string; -} - -static void -gal_define_views_model_init (GtkObject *object) -{ - GalDefineViewsModel *model = GAL_DEFINE_VIEWS_MODEL(object); - - model->collection = NULL; -} - -static void -gal_define_views_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GalDefineViewsModel *model; - - model = GAL_DEFINE_VIEWS_MODEL (o); - - switch (arg_id){ - case ARG_EDITABLE: - model->editable = GTK_VALUE_BOOL (*arg); - break; - - case ARG_COLLECTION: - if (GTK_VALUE_OBJECT (*arg)) - model->collection = GAL_VIEW_COLLECTION(GTK_VALUE_OBJECT (*arg)); - else - model->collection = NULL; - e_table_model_changed(E_TABLE_MODEL(o)); - break; - } -} - -static void -gal_define_views_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - GalDefineViewsModel *model; - - model = GAL_DEFINE_VIEWS_MODEL (object); - - switch (arg_id) { - case ARG_EDITABLE: - GTK_VALUE_BOOL (*arg) = model->editable; - break; - - case ARG_COLLECTION: - if (model->collection) - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(model->collection); - else - GTK_VALUE_OBJECT (*arg) = NULL; - break; - - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -GtkType -gal_define_views_model_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "GalDefineViewsModel", - sizeof (GalDefineViewsModel), - sizeof (GalDefineViewsModelClass), - (GtkClassInitFunc) gal_define_views_model_class_init, - (GtkObjectInitFunc) gal_define_views_model_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -/** - * gal_define_views_model_new - * - * Returns a new define views model. This is a list of views as an - * ETable for use in the GalDefineViewsDialog. - * - * Returns: The new GalDefineViewsModel. - */ -ETableModel * -gal_define_views_model_new (void) -{ - GalDefineViewsModel *et; - - et = gtk_type_new (gal_define_views_model_get_type ()); - - return E_TABLE_MODEL(et); -} - -/** - * gal_define_views_model_get_view: - * @model: The GalDefineViewsModel. - * @n: Which view to get. - * - * Gets the nth view. - * - * Returns: The view. - */ -GalView * -gal_define_views_model_get_view (GalDefineViewsModel *model, - int n) -{ - return gal_view_collection_get_view(model->collection, n); -} - -/** - * gal_define_views_model_delete_view: - * @model: The GalDefineViewsModel. - * @n: Which view to delete. - * - * Deletes the nth view. - */ -void -gal_define_views_model_delete_view (GalDefineViewsModel *model, - int n) -{ - e_table_model_pre_change(E_TABLE_MODEL(model)); - gal_view_collection_delete_view(model->collection, n); - e_table_model_row_deleted(E_TABLE_MODEL(model), n); -} - -/** - * gal_define_views_model_copy_view: - * @model: The GalDefineViewsModel. - * @n: Which view to copy. - * - * Copys the nth view. - */ -void -gal_define_views_model_copy_view (GalDefineViewsModel *model, - int n) -{ - ETableModel *etm = E_TABLE_MODEL(model); - gal_view_collection_copy_view(model->collection, n); - e_table_model_row_inserted(etm, gal_view_collection_get_count(model->collection) - 1); -} diff --git a/widgets/menus/gal-define-views-model.h b/widgets/menus/gal-define-views-model.h deleted file mode 100644 index 4aac712df6..0000000000 --- a/widgets/menus/gal-define-views-model.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _GAL_DEFINE_VIEWS_MODEL_H_ -#define _GAL_DEFINE_VIEWS_MODEL_H_ - -#include <gal/e-table/e-table-model.h> -#include <gal/menus/gal-view.h> -#include <gal/menus/gal-view-collection.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GAL_DEFINE_VIEWS_MODEL_TYPE (gal_define_views_model_get_type ()) -#define GAL_DEFINE_VIEWS_MODEL(o) (GTK_CHECK_CAST ((o), GAL_DEFINE_VIEWS_MODEL_TYPE, GalDefineViewsModel)) -#define GAL_DEFINE_VIEWS_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_DEFINE_VIEWS_MODEL_TYPE, GalDefineViewsModelClass)) -#define GAL_IS_DEFINE_VIEWS_MODEL(o) (GTK_CHECK_TYPE ((o), GAL_DEFINE_VIEWS_MODEL_TYPE)) -#define GAL_IS_DEFINE_VIEWS_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_DEFINE_VIEWS_MODEL_TYPE)) - -typedef struct { - ETableModel parent; - - /* item specific fields */ - GalViewCollection *collection; - - guint editable : 1; -} GalDefineViewsModel; - - -typedef struct { - ETableModelClass parent_class; -} GalDefineViewsModelClass; - - -GtkType gal_define_views_model_get_type (void); -ETableModel *gal_define_views_model_new (void); - -void gal_define_views_model_append (GalDefineViewsModel *model, - GalView *view); -GalView *gal_define_views_model_get_view (GalDefineViewsModel *model, - int i); -void gal_define_views_model_delete_view (GalDefineViewsModel *model, - int i); -void gal_define_views_model_copy_view (GalDefineViewsModel *model, - int i); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _GAL_DEFINE_VIEWS_MODEL_H_ */ diff --git a/widgets/menus/gal-define-views.glade b/widgets/menus/gal-define-views.glade deleted file mode 100644 index c9a8b4ffee..0000000000 --- a/widgets/menus/gal-define-views.glade +++ /dev/null @@ -1,313 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>gal-define-views</name> - <program_name>gal-define-views</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <use_widget_names>True</use_widget_names> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> - <gnome_help_support>True</gnome_help_support> - <output_translatable_strings>True</output_translatable_strings> - <translatable_strings_file>gal-define-views.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>dialog1</name> - <visible>False</visible> - <title>Define Views for "%s"</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox1</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button1</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button7</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - - <widget> - <class>GtkTable</class> - <name>table-top</name> - <rows>5</rows> - <columns>1</columns> - <homogeneous>False</homogeneous> - <row_spacing>6</row_spacing> - <column_spacing>6</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkFrame</class> - <name>frame1</name> - <label>Description</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkTable</class> - <name>table-description</name> - <border_width>6</border_width> - <rows>1</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>6</row_spacing> - <column_spacing>6</column_spacing> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox1</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>Custom</class> - <name>custom-table</name> - <creation_function>gal_define_views_dialog_create_etable</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Fri, 10 Nov 2000 16:37:39 GMT</last_modification_time> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox1</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-new</name> - <can_focus>True</can_focus> - <label>_New...</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-copy</name> - <can_focus>True</can_focus> - <label>_Copy...</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-modify</name> - <can_focus>True</can_focus> - <label>_Edit...</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-delete</name> - <can_focus>True</can_focus> - <label>_Delete...</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHButtonBox</class> - <name>hbuttonbox1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>6</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment3</name> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>1</yscale> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-reset</name> - <can_focus>True</can_focus> - <label>Re_set to Factory Defaults...</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label-views</name> - <label>Views for "%s"</label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/widgets/menus/gal-view-collection.c b/widgets/menus/gal-view-collection.c deleted file mode 100644 index 895b85c7c1..0000000000 --- a/widgets/menus/gal-view-collection.c +++ /dev/null @@ -1,568 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-collection.c: a View Collection - * - * Authors: - * Chris Lahey (clahey@helixcode.com) - * - * (C) 1999, 2000 Helix Code, Inc. - */ -#include <config.h> -#include <gtk/gtksignal.h> -#include <gal/util/e-util.h> -#include <gal/util/e-xml-utils.h> -#include <gnome-xml/parser.h> -#include "gal-view-collection.h" -#include <ctype.h> - -#define GVC_CLASS(e) ((GalViewCollectionClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type () - -static GtkObjectClass *gal_view_collection_parent_class; - -enum { - DISPLAY_VIEW, - CHANGED, - LAST_SIGNAL -}; - -static guint gal_view_collection_signals [LAST_SIGNAL] = { 0, }; - -/** - * gal_view_collection_display_view: - * @collection: The GalViewCollection to send the signal on. - * @view: The view to display. - * - */ -void -gal_view_collection_display_view (GalViewCollection *collection, - GalView *view) -{ - g_return_if_fail (collection != NULL); - g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection)); - - gtk_signal_emit (GTK_OBJECT (collection), - gal_view_collection_signals [DISPLAY_VIEW], - view); -} - -static void -gal_view_collection_changed (GalViewCollection *collection) -{ - g_return_if_fail (collection != NULL); - g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection)); - - gtk_signal_emit (GTK_OBJECT (collection), - gal_view_collection_signals [CHANGED]); -} - -static void -gal_view_collection_item_free (GalViewCollectionItem *item) -{ - g_free(item->id); - if (item->view) - gtk_object_unref(GTK_OBJECT(item->view)); - g_free(item); -} - -static void -gal_view_collection_destroy (GtkObject *object) -{ - GalViewCollection *collection = GAL_VIEW_COLLECTION(object); - int i; - - for (i = 0; i < collection->view_count; i++) { - gal_view_collection_item_free (collection->view_data[i]); - } - g_free(collection->view_data); - e_free_object_list(collection->factory_list); - - for (i = 0; i < collection->removed_view_count; i++) { - gal_view_collection_item_free (collection->removed_view_data[i]); - } - g_free(collection->removed_view_data); - - g_free(collection->system_dir); - g_free(collection->local_dir); - - if (gal_view_collection_parent_class->destroy) - (*gal_view_collection_parent_class->destroy)(object); -} - -static void -gal_view_collection_class_init (GtkObjectClass *object_class) -{ - GalViewCollectionClass *klass = GAL_VIEW_COLLECTION_CLASS(object_class); - gal_view_collection_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = gal_view_collection_destroy; - - gal_view_collection_signals [DISPLAY_VIEW] = - gtk_signal_new ("display_view", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (GalViewCollectionClass, display_view), - gtk_marshal_NONE__OBJECT, - GTK_TYPE_NONE, 1, GAL_VIEW_TYPE); - - gal_view_collection_signals [CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (GalViewCollectionClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, gal_view_collection_signals, LAST_SIGNAL); - - klass->display_view = NULL; - klass->changed = NULL; -} - -static void -gal_view_collection_init (GalViewCollection *collection) -{ - collection->view_data = NULL; - collection->view_count = 0; - collection->factory_list = NULL; - - collection->removed_view_data = NULL; - collection->removed_view_count = 0; - - collection->system_dir = NULL; - collection->local_dir = NULL; -} - -/** - * gal_view_collection_get_type: - * - */ -guint -gal_view_collection_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "GalViewCollection", - sizeof (GalViewCollection), - sizeof (GalViewCollectionClass), - (GtkClassInitFunc) gal_view_collection_class_init, - (GtkObjectInitFunc) gal_view_collection_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -/** - * gal_view_collection_new: - * - * A collection of views and view factories. - */ -GalViewCollection * -gal_view_collection_new (void) -{ - return gtk_type_new(gal_view_collection_get_type()); -} - -/** - * gal_view_collection_set_storage_directories - * @collection: The view collection to initialize - * @system_dir: The location of the system built in views - * @local_dir: The location to store the users set up views - * - * Sets up the GalViewCollection. - */ -void -gal_view_collection_set_storage_directories (GalViewCollection *collection, - const char *system_dir, - const char *local_dir) -{ - g_free(collection->system_dir); - g_free(collection->local_dir); - - collection->system_dir = g_strdup(system_dir); - collection->local_dir = g_strdup(local_dir); -} - -/** - * gal_view_collection_add_factory - * @collection: The view collection to add a factory to - * @factory: The factory to add - * - * Adds the given factory to this collection. This list is used both - * when loading views from their xml description as well as when the - * user tries to create a new view. - */ -void -gal_view_collection_add_factory (GalViewCollection *collection, - GalViewFactory *factory) -{ - gtk_object_ref(GTK_OBJECT(factory)); - collection->factory_list = g_list_prepend(collection->factory_list, factory); -} - -static void -view_changed (GalView *view, - GalViewCollectionItem *item) -{ - item->changed = TRUE; - item->ever_changed = TRUE; - - gal_view_collection_changed(item->collection); -} - -static GalViewCollectionItem * -load_single_file (GalViewCollection *collection, - gchar *dir, - gboolean local, - xmlNode *node) -{ - GalViewCollectionItem *item; - item = g_new(GalViewCollectionItem, 1); - item->ever_changed = local; - item->changed = FALSE; - item->built_in = !local; - item->id = e_xml_get_string_prop_by_name(node, "id"); - item->title = e_xml_get_string_prop_by_name(node, "title"); - item->filename = e_xml_get_string_prop_by_name(node, "filename"); - item->type = e_xml_get_string_prop_by_name(node, "type"); - item->collection = collection; - if (item->filename) { - GalViewFactory *factory; - GList *factories; - - factory = NULL; - for (factories = collection->factory_list; factories; factories = factories->next) { - if (!strcmp(gal_view_factory_get_type_code(factories->data), item->type)) { - factory = factories->data; - break; - } - } - if (factory) { - char *filename; - - filename = g_concat_dir_and_file(dir, item->filename); - item->view = gal_view_factory_new_view (factory, item->title); - gal_view_load(item->view, filename); - gal_view_set_title (item->view, item->title); - gtk_signal_connect(GTK_OBJECT(item->view), "changed", - GTK_SIGNAL_FUNC(view_changed), item); - g_free(filename); - } - - } - return item; -} - -static void -load_single_dir (GalViewCollection *collection, - char *dir, - gboolean local) -{ - xmlDoc *doc; - xmlNode *root; - xmlNode *child; - char *filename = g_concat_dir_and_file(dir, "galview.xml"); - - doc = xmlParseFile(filename); - if (!doc) - return; - root = xmlDocGetRootElement(doc); - for (child = root->xmlChildrenNode; child; child = child->next) { - gchar *id = e_xml_get_string_prop_by_name(child, "id"); - gboolean found = FALSE; - int i; - - for (i = 0; i < collection->view_count; i++) { - if (!strcmp(id, collection->view_data[i]->id)) { - if (!local) - collection->view_data[i]->built_in = TRUE; - found = TRUE; - break; - } - } - if (!found) { - for (i = 0; i < collection->removed_view_count; i++) { - if (!strcmp(id, collection->removed_view_data[i]->id)) { - if (!local) - collection->removed_view_data[i]->built_in = TRUE; - found = TRUE; - break; - } - } - } - - if (!found) { - GalViewCollectionItem *item = load_single_file (collection, dir, local, child); - if (item->filename && *item->filename) { - collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1); - collection->view_data[collection->view_count] = item; - collection->view_count ++; - } else { - collection->removed_view_data = g_renew(GalViewCollectionItem *, collection->removed_view_data, collection->removed_view_count + 1); - collection->removed_view_data[collection->removed_view_count] = item; - collection->removed_view_count ++; - } - } - g_free(id); - } - - g_free(filename); -} - -/** - * gal_view_collection_load - * @collection: The view collection to load information for - * - * Loads the data from the system and user directories specified in - * set storage directories. This is primarily for internal use by - * other parts of gal_view. - */ -void -gal_view_collection_load (GalViewCollection *collection) -{ - load_single_dir(collection, collection->local_dir, TRUE); - load_single_dir(collection, collection->system_dir, FALSE); -} - -/** - * gal_view_collection_save - * @collection: The view collection to save information for - * - * Saves the data to the user directory specified in set storage - * directories. This is primarily for internal use by other parts of - * gal_view. - */ -void -gal_view_collection_save (GalViewCollection *collection) -{ - int i; - xmlDoc *doc; - xmlNode *root; - char *filename; - - e_create_directory(collection->local_dir); - - doc = xmlNewDoc("1.0"); - root = xmlNewNode(NULL, "GalViewCollection"); - xmlDocSetRootElement(doc, root); - for (i = 0; i < collection->view_count; i++) { - xmlNode *child; - GalViewCollectionItem *item; - - item = collection->view_data[i]; - if (item->ever_changed) { - child = xmlNewChild(root, NULL, "GalView", NULL); - e_xml_set_string_prop_by_name(child, "id", item->id); - e_xml_set_string_prop_by_name(child, "title", item->title); - e_xml_set_string_prop_by_name(child, "filename", item->filename); - e_xml_set_string_prop_by_name(child, "type", item->type); - - if (item->changed) { - filename = g_concat_dir_and_file(collection->local_dir, item->filename); - gal_view_save(item->view, filename); - g_free(filename); - } - } - } - for (i = 0; i < collection->removed_view_count; i++) { - xmlNode *child; - GalViewCollectionItem *item; - - item = collection->removed_view_data[i]; - - child = xmlNewChild(root, NULL, "GalView", NULL); - e_xml_set_string_prop_by_name(child, "id", item->id); - e_xml_set_string_prop_by_name(child, "title", item->title); - e_xml_set_string_prop_by_name(child, "type", item->type); - } - filename = g_concat_dir_and_file(collection->local_dir, "galview.xml"); - xmlSaveFile(filename, doc); - xmlFreeDoc(doc); - g_free(filename); -} - -/** - * gal_view_collection_get_count - * @collection: The view collection to count - * - * Calculates the number of views in the given collection. - * - * Returns: The number of views in the collection. - */ -gint -gal_view_collection_get_count (GalViewCollection *collection) -{ - return collection->view_count; -} - -/** - * gal_view_collection_get_view - * @collection: The view collection to query - * @n: The view to get. - * - * Returns: The nth view in the collection - */ -GalView * -gal_view_collection_get_view (GalViewCollection *collection, - int n) -{ - g_return_val_if_fail(n < collection->view_count, NULL); - g_return_val_if_fail(n >= 0, NULL); - - return collection->view_data[n]->view; -} - -/** - * gal_view_collection_get_view_item - * @collection: The view collection to query - * @n: The view item to get. - * - * Returns: The nth view item in the collection - */ -GalViewCollectionItem * -gal_view_collection_get_view_item (GalViewCollection *collection, - int n) -{ - g_return_val_if_fail(n < collection->view_count, NULL); - g_return_val_if_fail(n >= 0, NULL); - - return collection->view_data[n]; -} - -static char * -gal_view_generate_string (GalViewCollection *collection, - GalView *view, - int which) -{ - char *ret_val; - char *pointer; - - if (which == 1) - ret_val = g_strdup(gal_view_get_title(view)); - else - ret_val = g_strdup_printf("%s_%d", gal_view_get_title(view), which); - for (pointer = ret_val; *pointer; pointer++) { - if (!isalnum((guint) *pointer)) { - *pointer = '_'; - } - } - return ret_val; -} - -static gint -gal_view_check_string (GalViewCollection *collection, - char *string) -{ - int i; - - for (i = 0; i < collection->view_count; i++) { - if (!strcmp(string, collection->view_data[i]->id)) - return FALSE; - } - for (i = 0; i < collection->removed_view_count; i++) { - if (!strcmp(string, collection->removed_view_data[i]->id)) - return FALSE; - } - return TRUE; -} - -static char * -gal_view_generate_id (GalViewCollection *collection, - GalView *view) -{ - int i; - for (i = 1; TRUE; i++) { - char *try; - - try = gal_view_generate_string(collection, view, i); - if (gal_view_check_string(collection, try)) - return try; - g_free(try); - } -} - -void -gal_view_collection_append (GalViewCollection *collection, - GalView *view) -{ - GalViewCollectionItem *item; - item = g_new(GalViewCollectionItem, 1); - item->ever_changed = TRUE; - item->changed = TRUE; - item->built_in = FALSE; - item->title = g_strdup(gal_view_get_title(view)); - item->type = g_strdup(gal_view_get_type_code(view)); - item->id = gal_view_generate_id(collection, view); - item->filename = g_strdup_printf("%s.galview", item->id); - item->view = view; - item->collection = collection; - gtk_object_ref(GTK_OBJECT(view)); - - gtk_signal_connect(GTK_OBJECT(item->view), "changed", - GTK_SIGNAL_FUNC(view_changed), item); - - collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1); - collection->view_data[collection->view_count] = item; - collection->view_count ++; - - gal_view_collection_changed(collection); -} - -void -gal_view_collection_delete_view (GalViewCollection *collection, - int i) -{ - GalViewCollectionItem *item = collection->view_data[i]; - memmove(collection->view_data + i, collection->view_data + i + 1, (collection->view_count - i - 1) * sizeof(GalViewCollectionItem *)); - if (item->built_in) { - g_free(item->filename); - item->filename = NULL; - - collection->removed_view_data = g_renew(GalViewCollectionItem *, collection->removed_view_data, collection->removed_view_count + 1); - collection->removed_view_data[collection->removed_view_count] = item; - collection->removed_view_count ++; - } else { - gal_view_collection_item_free (item); - } - - gal_view_collection_changed(collection); -} - -void -gal_view_collection_copy_view (GalViewCollection *collection, - int i) -{ - GalViewCollectionItem *item; - GalView *view = collection->view_data[i]->view; - - item = g_new(GalViewCollectionItem, 1); - item->ever_changed = TRUE; - item->changed = FALSE; - item->built_in = FALSE; - item->title = g_strdup(gal_view_get_title(view)); - item->type = g_strdup(gal_view_get_type_code(view)); - item->id = gal_view_generate_id(collection, view); - item->filename = g_strdup_printf("%s.galview", item->id); - item->view = gal_view_clone(view); - item->collection = collection; - - gtk_signal_connect(GTK_OBJECT(item->view), "changed", - GTK_SIGNAL_FUNC(view_changed), item); - - collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1); - collection->view_data[collection->view_count] = item; - collection->view_count ++; - - gal_view_collection_changed(collection); -} diff --git a/widgets/menus/gal-view-collection.h b/widgets/menus/gal-view-collection.h deleted file mode 100644 index 82da6a2de6..0000000000 --- a/widgets/menus/gal-view-collection.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _GAL_VIEW_SET_H_ -#define _GAL_VIEW_SET_H_ - -#include <gtk/gtkobject.h> -#include <gal/menus/gal-view-factory.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define GAL_VIEW_COLLECTION_TYPE (gal_view_collection_get_type ()) -#define GAL_VIEW_COLLECTION(o) (GTK_CHECK_CAST ((o), GAL_VIEW_COLLECTION_TYPE, GalViewCollection)) -#define GAL_VIEW_COLLECTION_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_COLLECTION_TYPE, GalViewCollectionClass)) -#define GAL_IS_VIEW_COLLECTION(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_COLLECTION_TYPE)) -#define GAL_IS_VIEW_COLLECTION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_COLLECTION_TYPE)) - -typedef struct GalViewCollectionItem GalViewCollectionItem; - -typedef struct { - GtkObject base; - - GalViewCollectionItem **view_data; - int view_count; - GList *factory_list; - - GalViewCollectionItem **removed_view_data; - int removed_view_count; - - char *system_dir; - char *local_dir; -} GalViewCollection; - -typedef struct { - GtkObjectClass parent_class; - - /* - * Signals - */ - void (*display_view) (GalViewCollection *collection, - GalView *view); - void (*changed) (GalViewCollection *collection); -} GalViewCollectionClass; - -struct GalViewCollectionItem { - GalView *view; - char *id; - gboolean changed; - gboolean ever_changed; - gboolean built_in; - char *filename; - char *title; - char *type; - GalViewCollection *collection; -}; - -/* Standard functions */ -GtkType gal_view_collection_get_type (void); -GalViewCollection *gal_view_collection_new (void); - -/* Set up the view collection */ -void gal_view_collection_set_storage_directories (GalViewCollection *collection, - const char *system_dir, - const char *local_dir); -void gal_view_collection_add_factory (GalViewCollection *collection, - GalViewFactory *factory); - -/* Send the display view signal. */ -void gal_view_collection_display_view (GalViewCollection *collection, - GalView *view); -gint gal_view_collection_get_count (GalViewCollection *collection); -GalView *gal_view_collection_get_view (GalViewCollection *collection, - int n); -GalViewCollectionItem *gal_view_collection_get_view_item (GalViewCollection *collection, - int n); - -void gal_view_collection_append (GalViewCollection *collection, - GalView *view); -void gal_view_collection_delete_view (GalViewCollection *collection, - int i); -void gal_view_collection_copy_view (GalViewCollection *collection, - int i); -/* Call set_storage_directories and add factories for anything that - * might be found there before doing either of these. */ -void gal_view_collection_load (GalViewCollection *collection); -void gal_view_collection_save (GalViewCollection *collection); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* _GAL_VIEW_COLLECTION_H_ */ diff --git a/widgets/menus/gal-view-etable.c b/widgets/menus/gal-view-etable.c deleted file mode 100644 index 1eb3166611..0000000000 --- a/widgets/menus/gal-view-etable.c +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-etable.c: An ETable View - * - * Authors: - * Chris Lahey (clahey@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include "gal-view-etable.h" -#include <gal/e-table/e-table-config.h> - -#define PARENT_TYPE gal_view_get_type () - -static GalViewClass *gal_view_etable_parent_class; - - -static void -config_changed (ETableConfig *config, ETableState *state, GalViewEtable *view) -{ - if (view->state) - gtk_object_unref(GTK_OBJECT(view->state)); - view->state = e_table_state_duplicate(state); - gal_view_changed(GAL_VIEW(view)); -} - -static void -gal_view_etable_edit (GalView *view) -{ - GalViewEtable *etable_view = GAL_VIEW_ETABLE(view); - ETableConfig *config; - - config = e_table_config_new(etable_view->title, - etable_view->spec, - etable_view->state); - - gtk_signal_connect(GTK_OBJECT(config), "changed", - GTK_SIGNAL_FUNC(config_changed), view); -} - -static void -gal_view_etable_load (GalView *view, - const char *filename) -{ - e_table_state_load_from_file(GAL_VIEW_ETABLE(view)->state, filename); -} - -static void -gal_view_etable_save (GalView *view, - const char *filename) -{ - e_table_state_save_to_file(GAL_VIEW_ETABLE(view)->state, filename); -} - -static const char * -gal_view_etable_get_title (GalView *view) -{ - return GAL_VIEW_ETABLE(view)->title; -} - -static void -gal_view_etable_set_title (GalView *view, - const char *title) -{ - g_free(GAL_VIEW_ETABLE(view)->title); - GAL_VIEW_ETABLE(view)->title = g_strdup(title); -} - -static const char * -gal_view_etable_get_type_code (GalView *view) -{ - return "etable"; -} - -static GalView * -gal_view_etable_clone (GalView *view) -{ - GalViewEtable *gve, *new; - - gve = GAL_VIEW_ETABLE(view); - - new = gtk_type_new (gal_view_etable_get_type ()); - new->spec = gve->spec; - new->title = g_strdup (gve->title); - new->state = e_table_state_duplicate(gve->state); - - gtk_object_ref(GTK_OBJECT(new->spec)); - - return GAL_VIEW(new); -} - -static void -gal_view_etable_destroy (GtkObject *object) -{ - GalViewEtable *view = GAL_VIEW_ETABLE(object); - g_free(view->title); - if (view->spec) - gtk_object_unref(GTK_OBJECT(view->spec)); - if (view->state) - gtk_object_unref(GTK_OBJECT(view->state)); -} - -static void -gal_view_etable_class_init (GtkObjectClass *object_class) -{ - GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class); - gal_view_etable_parent_class = gtk_type_class (PARENT_TYPE); - - gal_view_class->edit = gal_view_etable_edit ; - gal_view_class->load = gal_view_etable_load ; - gal_view_class->save = gal_view_etable_save ; - gal_view_class->get_title = gal_view_etable_get_title ; - gal_view_class->set_title = gal_view_etable_set_title ; - gal_view_class->get_type_code = gal_view_etable_get_type_code; - gal_view_class->clone = gal_view_etable_clone ; - - object_class->destroy = gal_view_etable_destroy ; -} - -static void -gal_view_etable_init (GalViewEtable *gve) -{ - gve->spec = NULL; - gve->state = e_table_state_new(); - gve->title = NULL; -} - -/** - * gal_view_etable_new - * @spec: The ETableSpecification that this view will be based upon. - * @title: The name of the new view. - * - * Returns a new GalViewEtable. This is primarily for use by - * GalViewFactoryEtable. - * - * Returns: The new GalViewEtable. - */ -GalView * -gal_view_etable_new (ETableSpecification *spec, - const gchar *title) -{ - return gal_view_etable_construct (gtk_type_new (gal_view_etable_get_type ()), spec, title); -} - -/** - * gal_view_etable_construct - * @view: The view to construct. - * @spec: The ETableSpecification that this view will be based upon. - * @title: The name of the new view. - * - * constructs the GalViewEtable. To be used by subclasses and - * language bindings. - * - * Returns: The GalViewEtable. - */ -GalView * -gal_view_etable_construct (GalViewEtable *view, - ETableSpecification *spec, - const gchar *title) -{ - if (spec) - gtk_object_ref(GTK_OBJECT(spec)); - view->spec = spec; - - if (view->state) - gtk_object_unref(GTK_OBJECT(view->state)); - view->state = e_table_state_duplicate(spec->state); - - view->title = g_strdup(title); - - return GAL_VIEW(view); -} - -GtkType -gal_view_etable_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "GalViewEtable", - sizeof (GalViewEtable), - sizeof (GalViewEtableClass), - (GtkClassInitFunc) gal_view_etable_class_init, - (GtkObjectInitFunc) gal_view_etable_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} diff --git a/widgets/menus/gal-view-etable.h b/widgets/menus/gal-view-etable.h deleted file mode 100644 index 9fde64a9cb..0000000000 --- a/widgets/menus/gal-view-etable.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _GAL_VIEW_ETABLE_H_ -#define _GAL_VIEW_ETABLE_H_ - -#include <gtk/gtkobject.h> -#include <gal/menus/gal-view.h> -#include <gal/e-table/e-table-state.h> -#include <gal/e-table/e-table-specification.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GAL_VIEW_ETABLE_TYPE (gal_view_etable_get_type ()) -#define GAL_VIEW_ETABLE(o) (GTK_CHECK_CAST ((o), GAL_VIEW_ETABLE_TYPE, GalViewEtable)) -#define GAL_VIEW_ETABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_ETABLE_TYPE, GalViewEtableClass)) -#define GAL_IS_VIEW_ETABLE(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_ETABLE_TYPE)) -#define GAL_IS_VIEW_ETABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_ETABLE_TYPE)) - -typedef struct { - GalView base; - - ETableSpecification *spec; - ETableState *state; - char *title; -} GalViewEtable; - -typedef struct { - GalViewClass parent_class; -} GalViewEtableClass; - -/* Standard functions */ -GtkType gal_view_etable_get_type (void); -GalView *gal_view_etable_new (ETableSpecification *spec, - const gchar *title); -GalView *gal_view_etable_construct (GalViewEtable *view, - ETableSpecification *spec, - const gchar *title); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _GAL_VIEW_ETABLE_H_ */ diff --git a/widgets/menus/gal-view-factory-etable.c b/widgets/menus/gal-view-factory-etable.c deleted file mode 100644 index 80f5d39f92..0000000000 --- a/widgets/menus/gal-view-factory-etable.c +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-factory.c: A View Factory - * - * Authors: - * Chris Lahey (clahey@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include "gal-view-factory-etable.h" -#include "gal-view-etable.h" -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> - -#define GVFE_CLASS(e) ((GalViewFactoryEtableClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gal_view_factory_get_type () - -static GalViewFactoryClass *gal_view_factory_etable_parent_class; - -static const char * -gal_view_factory_etable_get_title (GalViewFactory *factory) -{ - return _("Table"); -} - -static GalView * -gal_view_factory_etable_new_view (GalViewFactory *factory, - const char *name) -{ - return gal_view_etable_new(GAL_VIEW_FACTORY_ETABLE(factory)->spec, name); -} - -static const char * -gal_view_factory_etable_get_type_code (GalViewFactory *factory) -{ - return "etable"; -} - -static void -gal_view_factory_etable_destroy (GtkObject *object) -{ - GalViewFactoryEtable *factory = GAL_VIEW_FACTORY_ETABLE(object); - - if (factory->spec) - gtk_object_unref(GTK_OBJECT(factory->spec)); -} - -static void -gal_view_factory_etable_class_init (GtkObjectClass *object_class) -{ - GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(object_class); - gal_view_factory_etable_parent_class = gtk_type_class (PARENT_TYPE); - - view_factory_class->get_title = gal_view_factory_etable_get_title; - view_factory_class->new_view = gal_view_factory_etable_new_view; - view_factory_class->get_type_code = gal_view_factory_etable_get_type_code; - - object_class->destroy = gal_view_factory_etable_destroy; -} - -static void -gal_view_factory_etable_init (GalViewFactoryEtable *factory) -{ - factory->spec = NULL; -} - -/** - * gal_view_etable_new - * @spec: The spec to create GalViewEtables based upon. - * - * A new GalViewFactory for creating ETable views. Create one of - * these and pass it to GalViewCollection for use. - * - * Returns: The new GalViewFactoryEtable. - */ -GalViewFactory * -gal_view_factory_etable_new (ETableSpecification *spec) -{ - return gal_view_factory_etable_construct (gtk_type_new (gal_view_factory_etable_get_type ()), spec); -} - -/** - * gal_view_etable_construct - * @factory: The factory to construct - * @spec: The spec to create GalViewEtables based upon. - * - * constructs the GalViewFactoryEtable. To be used by subclasses and - * language bindings. - * - * Returns: The GalViewFactoryEtable. - */ -GalViewFactory * -gal_view_factory_etable_construct (GalViewFactoryEtable *factory, - ETableSpecification *spec) -{ - if (spec) - gtk_object_ref(GTK_OBJECT(spec)); - factory->spec = spec; - return GAL_VIEW_FACTORY(factory); -} - -GtkType -gal_view_factory_etable_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "GalViewFactoryEtable", - sizeof (GalViewFactoryEtable), - sizeof (GalViewFactoryEtableClass), - (GtkClassInitFunc) gal_view_factory_etable_class_init, - (GtkObjectInitFunc) gal_view_factory_etable_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} diff --git a/widgets/menus/gal-view-factory-etable.h b/widgets/menus/gal-view-factory-etable.h deleted file mode 100644 index f41697f9f5..0000000000 --- a/widgets/menus/gal-view-factory-etable.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _GAL_VIEW_FACTORY_ETABLE_H_ -#define _GAL_VIEW_FACTORY_ETABLE_H_ - -#include <gtk/gtkobject.h> -#include <gal/menus/gal-view-factory.h> -#include <gal/e-table/e-table-specification.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GAL_VIEW_FACTORY_ETABLE_TYPE (gal_view_factory_etable_get_type ()) -#define GAL_VIEW_FACTORY_ETABLE(o) (GTK_CHECK_CAST ((o), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtable)) -#define GAL_VIEW_FACTORY_ETABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtableClass)) -#define GAL_IS_VIEW_FACTORY_ETABLE(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_FACTORY_ETABLE_TYPE)) -#define GAL_IS_VIEW_FACTORY_ETABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_ETABLE_TYPE)) - -typedef struct { - GalViewFactory base; - - ETableSpecification *spec; -} GalViewFactoryEtable; - -typedef struct { - GalViewFactoryClass parent_class; -} GalViewFactoryEtableClass; - -/* Standard functions */ -GtkType gal_view_factory_etable_get_type (void); -GalViewFactory *gal_view_factory_etable_new (ETableSpecification *spec); -GalViewFactory *gal_view_factory_etable_construct (GalViewFactoryEtable *factory, - ETableSpecification *spec); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _GAL_VIEW_FACTORY_ETABLE_H_ */ diff --git a/widgets/menus/gal-view-factory.c b/widgets/menus/gal-view-factory.c deleted file mode 100644 index 569dc59b92..0000000000 --- a/widgets/menus/gal-view-factory.c +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-factory.c: A View Factory - * - * Authors: - * Chris Lahey (clahey@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include "gal-view-factory.h" - -#define GVF_CLASS(e) ((GalViewFactoryClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type () - -#define d(x) - -d(static gint depth = 0); - -static GtkObjectClass *gal_view_factory_parent_class; - -/** - * gal_view_factory_get_title: - * @factory: The factory to query. - * - * Returns: The title of the factory. - */ -const char * -gal_view_factory_get_title (GalViewFactory *factory) -{ - g_return_val_if_fail (factory != NULL, 0); - g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), 0); - - if (GVF_CLASS (factory)->get_title) - return GVF_CLASS (factory)->get_title (factory); - else - return NULL; -} - -/** - * gal_view_factory_new_view: - * @factory: The factory to use - * @name: the name for the view. - * - * Returns: The new view - */ -GalView * -gal_view_factory_new_view (GalViewFactory *factory, - const char *name) -{ - g_return_val_if_fail (factory != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), NULL); - - if (GVF_CLASS (factory)->new_view) - return GVF_CLASS (factory)->new_view (factory, name); - else - return NULL; -} - -/** - * gal_view_factory_get_type_code: - * @factory: The factory to use - * - * Returns: The type code - */ -const char * -gal_view_factory_get_type_code (GalViewFactory *factory) -{ - g_return_val_if_fail (factory != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), NULL); - - if (GVF_CLASS (factory)->get_type_code) - return GVF_CLASS (factory)->get_type_code (factory); - else - return NULL; -} - -static void -gal_view_factory_class_init (GtkObjectClass *object_class) -{ - GalViewFactoryClass *klass = GAL_VIEW_FACTORY_CLASS(object_class); - gal_view_factory_parent_class = gtk_type_class (PARENT_TYPE); - - klass->get_title = NULL; - klass->new_view = NULL; -} - -GtkType -gal_view_factory_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "GalViewFactory", - sizeof (GalViewFactory), - sizeof (GalViewFactoryClass), - (GtkClassInitFunc) gal_view_factory_class_init, - NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} diff --git a/widgets/menus/gal-view-factory.h b/widgets/menus/gal-view-factory.h deleted file mode 100644 index dd828145e5..0000000000 --- a/widgets/menus/gal-view-factory.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _GAL_VIEW_FACTORY_H_ -#define _GAL_VIEW_FACTORY_H_ - -#include <gtk/gtkobject.h> -#include <gal/menus/gal-view.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GAL_VIEW_FACTORY_TYPE (gal_view_factory_get_type ()) -#define GAL_VIEW_FACTORY(o) (GTK_CHECK_CAST ((o), GAL_VIEW_FACTORY_TYPE, GalViewFactory)) -#define GAL_VIEW_FACTORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_TYPE, GalViewFactoryClass)) -#define GAL_IS_VIEW_FACTORY(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_FACTORY_TYPE)) -#define GAL_IS_VIEW_FACTORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_TYPE)) - -typedef struct { - GtkObject base; -} GalViewFactory; - -typedef struct { - GtkObjectClass parent_class; - - /* - * Virtual methods - */ - const char *(*get_title) (GalViewFactory *factory); - const char *(*get_type_code) (GalViewFactory *factory); - GalView *(*new_view) (GalViewFactory *factory, - const char *name); -} GalViewFactoryClass; - -/* Standard functions */ -GtkType gal_view_factory_get_type (void); - -/* Query functions */ -/* Returns already translated title. */ -const char *gal_view_factory_get_title (GalViewFactory *factory); - -/* Returns the code for use in identifying this type of object in the - * view list. This identifier should identify this as being the - * unique factory for xml files which were written out with this - * identifier. Thus each factory should have a unique type code. */ -const char *gal_view_factory_get_type_code (GalViewFactory *factory); - -/* Create a new view */ -GalView *gal_view_factory_new_view (GalViewFactory *factory, - const char *name); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* _GAL_VIEW_FACTORY_H_ */ diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c deleted file mode 100644 index aee6e3f0d0..0000000000 --- a/widgets/menus/gal-view-new-dialog.c +++ /dev/null @@ -1,217 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* gal-view-new-dialog.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <gnome.h> -#include "gal-view-new-dialog.h" -#include "gal-define-views-model.h" -#include <gal/widgets/e-unicode.h> -#include <gal/e-table/e-table-scrolled.h> - -static void gal_view_new_dialog_init (GalViewNewDialog *card); -static void gal_view_new_dialog_class_init (GalViewNewDialogClass *klass); -static void gal_view_new_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void gal_view_new_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void gal_view_new_dialog_destroy (GtkObject *object); - -static GnomeDialogClass *parent_class = NULL; -#define PARENT_TYPE gnome_dialog_get_type() - -/* The arguments we take */ -enum { - ARG_0, - ARG_NAME, - ARG_FACTORY, -}; - -GtkType -gal_view_new_dialog_get_type (void) -{ - static GtkType type = 0; - - if (!type) { - static const GtkTypeInfo info = - { - "GalViewNewDialog", - sizeof (GalViewNewDialog), - sizeof (GalViewNewDialogClass), - (GtkClassInitFunc) gal_view_new_dialog_class_init, - (GtkObjectInitFunc) gal_view_new_dialog_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -static void -gal_view_new_dialog_class_init (GalViewNewDialogClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->set_arg = gal_view_new_dialog_set_arg; - object_class->get_arg = gal_view_new_dialog_get_arg; - object_class->destroy = gal_view_new_dialog_destroy; - - gtk_object_add_arg_type ("GalViewNewDialog::name", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_NAME); - gtk_object_add_arg_type ("GalViewNewDialog::factory", GTK_TYPE_OBJECT, - GTK_ARG_READABLE, ARG_FACTORY); -} - -static void -gal_view_new_dialog_init (GalViewNewDialog *dialog) -{ - GladeXML *gui; - GtkWidget *widget; - - gui = glade_xml_new (GAL_GLADEDIR "/gal-view-new-dialog.glade", NULL); - dialog->gui = gui; - - widget = glade_xml_get_widget(gui, "table-top"); - if (!widget) { - return; - } - gtk_widget_ref(widget); - gtk_widget_unparent(widget); - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0); - gtk_widget_unref(widget); - - gnome_dialog_append_buttons(GNOME_DIALOG(dialog), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - - gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE); - - dialog->collection = NULL; - dialog->selected_factory = NULL; -} - -static void -gal_view_new_dialog_destroy (GtkObject *object) { - GalViewNewDialog *gal_view_new_dialog = GAL_VIEW_NEW_DIALOG(object); - - gtk_object_unref(GTK_OBJECT(gal_view_new_dialog->gui)); -} - -GtkWidget* -gal_view_new_dialog_new (GalViewCollection *collection) -{ - GtkWidget *widget = - gal_view_new_dialog_construct(gtk_type_new (gal_view_new_dialog_get_type ()), - collection); - return widget; -} - - -static void -gal_view_new_dialog_select_row_callback(GtkCList *list, - gint row, - gint column, - GdkEventButton *event, - GalViewNewDialog *dialog) -{ - dialog->selected_factory = gtk_clist_get_row_data(list, - row); -} - -GtkWidget* -gal_view_new_dialog_construct (GalViewNewDialog *dialog, - GalViewCollection *collection) -{ - GtkWidget *list = glade_xml_get_widget(dialog->gui, - "clist-type-list"); - GList *iterator; - dialog->collection = collection; - - iterator = dialog->collection->factory_list; - - for ( ; iterator; iterator = g_list_next(iterator) ) { - GalViewFactory *factory = iterator->data; - char *text[1]; - int row; - - gtk_object_ref(GTK_OBJECT(factory)); - text[0] = (char *) gal_view_factory_get_title(factory); - row = gtk_clist_append(GTK_CLIST(list), text); - gtk_clist_set_row_data(GTK_CLIST(list), row, factory); - } - - gtk_signal_connect(GTK_OBJECT (list), - "select_row", - GTK_SIGNAL_FUNC(gal_view_new_dialog_select_row_callback), - dialog); - - return GTK_WIDGET(dialog); -} - -static void -gal_view_new_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GalViewNewDialog *dialog; - GtkWidget *entry; - - dialog = GAL_VIEW_NEW_DIALOG (o); - - switch (arg_id){ - case ARG_NAME: - entry = glade_xml_get_widget(dialog->gui, "entry-name"); - if (entry && GTK_IS_EDITABLE(entry)) { - e_utf8_gtk_editable_set_text(GTK_EDITABLE(entry), GTK_VALUE_STRING(*arg)); - } - break; - default: - return; - } -} - -static void -gal_view_new_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - GalViewNewDialog *dialog; - GtkWidget *entry; - - dialog = GAL_VIEW_NEW_DIALOG (object); - - switch (arg_id) { - case ARG_NAME: - entry = glade_xml_get_widget(dialog->gui, "entry-name"); - if (entry && GTK_IS_EDITABLE(entry)) { - GTK_VALUE_STRING(*arg) = e_utf8_gtk_editable_get_text(GTK_EDITABLE(entry)); - } - break; - case ARG_FACTORY: - GTK_VALUE_OBJECT(*arg) = dialog->selected_factory ? GTK_OBJECT(dialog->selected_factory) : NULL; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} diff --git a/widgets/menus/gal-view-new-dialog.glade b/widgets/menus/gal-view-new-dialog.glade deleted file mode 100644 index 02d9866d49..0000000000 --- a/widgets/menus/gal-view-new-dialog.glade +++ /dev/null @@ -1,222 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>gal-view-new-dialog</name> - <program_name>gal-view-new-dialog</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <use_widget_names>True</use_widget_names> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> - <gnome_help_support>True</gnome_help_support> - <output_translatable_strings>True</output_translatable_strings> - <translatable_strings_file>gal-view-new-dialog.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>dialog1</name> - <visible>False</visible> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox1</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button1</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button3</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - - <widget> - <class>GtkTable</class> - <name>table-top</name> - <rows>4</rows> - <columns>1</columns> - <homogeneous>False</homogeneous> - <row_spacing>6</row_spacing> - <column_spacing>6</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label1</name> - <label>Name of new view:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>entry-name</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-name</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label2</name> - <label>Type of view:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkCList</class> - <name>clist-type-list</name> - <can_focus>True</can_focus> - <columns>1</columns> - <column_widths>80</column_widths> - <selection_mode>GTK_SELECTION_SINGLE</selection_mode> - <show_titles>False</show_titles> - <shadow_type>GTK_SHADOW_IN</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label5</name> - <label>label5</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/widgets/menus/gal-view-new-dialog.h b/widgets/menus/gal-view-new-dialog.h deleted file mode 100644 index de4fcc9387..0000000000 --- a/widgets/menus/gal-view-new-dialog.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* gal-view-new-dialog.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __GAL_VIEW_NEW_DIALOG_H__ -#define __GAL_VIEW_NEW_DIALOG_H__ - -#include <gnome.h> -#include <glade/glade.h> -#include <gal-view-collection.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* GalViewNewDialog - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define GAL_VIEW_NEW_DIALOG_TYPE (gal_view_new_dialog_get_type ()) -#define GAL_VIEW_NEW_DIALOG(obj) (GTK_CHECK_CAST ((obj), GAL_VIEW_NEW_DIALOG_TYPE, GalViewNewDialog)) -#define GAL_VIEW_NEW_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GAL_VIEW_NEW_DIALOG_TYPE, GalViewNewDialogClass)) -#define GAL_IS_VIEW_NEW_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GAL_VIEW_NEW_DIALOG_TYPE)) -#define GAL_IS_VIEW_NEW_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GAL_VIEW_NEW_DIALOG_TYPE)) - -typedef struct _GalViewNewDialog GalViewNewDialog; -typedef struct _GalViewNewDialogClass GalViewNewDialogClass; - -struct _GalViewNewDialog -{ - GnomeDialog parent; - - /* item specific fields */ - GladeXML *gui; - - GalViewCollection *collection; - GalViewFactory *selected_factory; -}; - -struct _GalViewNewDialogClass -{ - GnomeDialogClass parent_class; -}; - -GtkWidget *gal_view_new_dialog_new (GalViewCollection *collection); -GtkType gal_view_new_dialog_get_type (void); - -GtkWidget *gal_view_new_dialog_construct (GalViewNewDialog *dialog, - GalViewCollection *collection); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __GAL_VIEW_NEW_DIALOG_H__ */ diff --git a/widgets/menus/gal-view.c b/widgets/menus/gal-view.c deleted file mode 100644 index f48a6f0026..0000000000 --- a/widgets/menus/gal-view.c +++ /dev/null @@ -1,210 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view.c: A View - * - * Authors: - * Chris Lahey (clahey@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include <gtk/gtksignal.h> -#include "gal-view.h" - -#define GV_CLASS(e) ((GalViewClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type () - -#define d(x) - -d(static gint depth = 0); - - -static GtkObjectClass *gal_view_parent_class; - -enum { - CHANGED, - LAST_SIGNAL -}; - -static guint gal_view_signals [LAST_SIGNAL] = { 0, }; - -/** - * gal_view_edit - * @view: The view to edit - */ -void -gal_view_edit (GalView *view) -{ - g_return_if_fail (view != NULL); - g_return_if_fail (GAL_IS_VIEW (view)); - - if (GV_CLASS (view)->edit) - GV_CLASS (view)->edit (view); -} - -/** - * gal_view_load - * @view: The view to load to - * @filename: The file to load from - */ -void -gal_view_load (GalView *view, - const char *filename) -{ - g_return_if_fail (view != NULL); - g_return_if_fail (GAL_IS_VIEW (view)); - - if (GV_CLASS (view)->load) - GV_CLASS (view)->load (view, filename); -} - -/** - * gal_view_save - * @view: The view to save - * @filename: The file to save to - */ -void -gal_view_save (GalView *view, - const char *filename) -{ - g_return_if_fail (view != NULL); - g_return_if_fail (GAL_IS_VIEW (view)); - - if (GV_CLASS (view)->save) - GV_CLASS (view)->save (view, filename); -} - -/** - * gal_view_get_title - * @view: The view to query. - * - * Returns: The title of the view. - */ -const char * -gal_view_get_title (GalView *view) -{ - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW (view), NULL); - - if (GV_CLASS (view)->get_title) - return GV_CLASS (view)->get_title (view); - else - return NULL; -} - -/** - * gal_view_set_title - * @view: The view to set. - * @title: The new title value. - */ -void -gal_view_set_title (GalView *view, - const char *title) -{ - g_return_if_fail (view != NULL); - g_return_if_fail (GAL_IS_VIEW (view)); - - if (GV_CLASS (view)->set_title) - GV_CLASS (view)->set_title (view, title); -} - -/** - * gal_view_get_type_code - * @view: The view to get. - * - * Returns: The type of the view. - */ -const char * -gal_view_get_type_code (GalView *view) -{ - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW (view), NULL); - - if (GV_CLASS (view)->get_type_code) - return GV_CLASS (view)->get_type_code (view); - else - return NULL; -} - -/** - * gal_view_clone - * @view: The view to clone. - * - * Returns: The clone. - */ -GalView * -gal_view_clone (GalView *view) -{ - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW (view), NULL); - - if (GV_CLASS (view)->clone) - return GV_CLASS (view)->clone (view); - else - return NULL; -} - -/** - * gal_view_changed - * @view: The view that changed. - */ -void -gal_view_changed (GalView *view) -{ - g_return_if_fail (view != NULL); - g_return_if_fail (GAL_IS_VIEW (view)); - - gtk_signal_emit(GTK_OBJECT(view), - gal_view_signals [CHANGED]); -} - -static void -gal_view_class_init (GtkObjectClass *object_class) -{ - GalViewClass *klass = GAL_VIEW_CLASS(object_class); - gal_view_parent_class = gtk_type_class (PARENT_TYPE); - - klass->edit = NULL; - klass->load = NULL; - klass->save = NULL; - klass->get_title = NULL; - klass->clone = NULL; - - klass->changed = NULL; - - gal_view_signals [CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (GalViewClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, gal_view_signals, LAST_SIGNAL); -} - -GtkType -gal_view_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "GalView", - sizeof (GalView), - sizeof (GalViewClass), - (GtkClassInitFunc) gal_view_class_init, - NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} diff --git a/widgets/menus/gal-view.h b/widgets/menus/gal-view.h deleted file mode 100644 index 5cc7cc679c..0000000000 --- a/widgets/menus/gal-view.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _GAL_VIEW_H_ -#define _GAL_VIEW_H_ - -#include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GAL_VIEW_TYPE (gal_view_get_type ()) -#define GAL_VIEW(o) (GTK_CHECK_CAST ((o), GAL_VIEW_TYPE, GalView)) -#define GAL_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_TYPE, GalViewClass)) -#define GAL_IS_VIEW(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_TYPE)) -#define GAL_IS_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_TYPE)) - -typedef struct { - GtkObject base; -} GalView; - -typedef struct { - GtkObjectClass parent_class; - - /* - * Virtual methods - */ - void (*edit) (GalView *view); - void (*load) (GalView *view, - const char *filename); - void (*save) (GalView *view, - const char *filename); - const char *(*get_title) (GalView *view); - void (*set_title) (GalView *view, - const char *title); - const char *(*get_type_code) (GalView *view); - GalView *(*clone) (GalView *view); - - /* Signals */ - void (*changed) (GalView *view); -} GalViewClass; - -/* Standard functions */ -GtkType gal_view_get_type (void); - -/* Open an editor dialog for this view. */ -void gal_view_edit (GalView *view); - -/* xml load and save functions */ -void gal_view_load (GalView *view, - const char *filename); -void gal_view_save (GalView *view, - const char *filename); - -/* Title functions */ -const char *gal_view_get_title (GalView *view); -void gal_view_set_title (GalView *view, - const char *title); - -/* View type. */ -const char *gal_view_get_type_code (GalView *view); - -/* Cloning the view */ -GalView *gal_view_clone (GalView *view); - -/* Changed signal */ -void gal_view_changed (GalView *view); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _GAL_VIEW_H_ */ diff --git a/widgets/misc/.cvsignore b/widgets/misc/.cvsignore index f7ea0db71c..b4f8ca5c48 100644 --- a/widgets/misc/.cvsignore +++ b/widgets/misc/.cvsignore @@ -8,4 +8,4 @@ Makefile.in test-title-bar test-calendar test-dateedit -test-dropdown-button
\ No newline at end of file +test-dropdown-button diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 6f104db461..7120869df4 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,61 +1,7 @@ -2001-03-04 Damon Chaplin <damon@ximian.com> - - * e-cell-date-edit.c: pretty much working now. - -2001-03-01 Not Zed <NotZed@Ximian.com> - - * e-filter-bar.c: New type of search bar that interacts with - filter contexts to save filters etc. Still probably needs a - little cleanpu. - -2001-02-28 Not Zed <NotZed@Ximian.com> - - * e-search-bar.c (add_dropdown): Save the dropdown menu in the - struct too. Sigh, this is only so we can scan its content later, - ick. - (e_search_bar_set_menu_sensitive): New function to se tthe - sentisitivty of menyu items based on id. - (find_id): New function to find the row and widget for a specific - id. - (add_option): Renamed to set_option. - (add_dropdown): Renamed to set_dropdown. - (add_dropdown): ?New function to add a single item. - (set_dropdown): Call add_dropdown to add each item. - (e_search_bar_add_menu): New public function to add a single item. - -2001-02-27 Not Zed <NotZed@Ximian.com> - - * Makefile.am (libemiscwidgets_a_SOURCES): Added filter-bar.[ch]. - - * e-search-bar.c (class_init): Init virtual functions. - (e_search_bar_set_option): - (e_search_bar_set_menu): virtualise calling. - (e_search_bar_construct): Call virtual functions to setup menus. - - * e-search-bar.h (struct _ESearchBarClass): Virtualise - add_dropdown/add_option, so certain base options can be created. - -2001-02-25 Damon Chaplin <damon@ximian.com> - - * e-cell-date-edit.[hc]: new files to implement an ECell for showing - and editing dates & times. (Unfinished) - - * Makefile.am (libemiscwidgets_a_SOURCES): added e-cell-date-edit.[hc] - -2001-02-24 Not Zed <NotZed@Ximian.com> - - * e-search-bar.c (add_dropdown): Move the event box into the - esb->dropdown_holder. Changed so it can be called again on the - same esb, to rebuild the menu. - (e_search_bar_set_menu): New function to (re)set the menu. - (add_option): Setup so it can be re-called to rebuild the option - list. - (e_search_bar_set_option): New function to build the menu's. - -2001-02-05 Jeffrey Stedfast <fejj@ximian.com> - - * .cvsignore: Ignore test-dropdown-button +2001-02-08 Kjartan Maraas <kmaraas@gnome.org> + * e-clipped-label.c: Added #include <config.h> + 2001-01-28 Ettore Perazzoli <ettore@ximian.com> * e-search-bar.c (add_spacer): Make the spacer 4 pixels wider. diff --git a/widgets/misc/e-canvas-utils.c b/widgets/misc/e-canvas-utils.c deleted file mode 100644 index 50fcf0d7e5..0000000000 --- a/widgets/misc/e-canvas-utils.c +++ /dev/null @@ -1,137 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas-utils.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "e-canvas-utils.h" - -void -e_canvas_item_move_absolute (GnomeCanvasItem *item, double dx, double dy) -{ - double translate[6]; - - g_return_if_fail (item != NULL); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - - art_affine_translate (translate, dx, dy); - - gnome_canvas_item_affine_absolute (item, translate); -} - -static double -compute_offset(int top, int bottom, int page_top, int page_bottom) -{ - int size = bottom - top; - int offset = 0; - - if (top <= page_top && bottom >= page_bottom) - return 0; - - if (bottom > page_bottom) - offset = (bottom - page_bottom); - if (top < page_top + offset) - offset = (top - page_top); - - if (top <= page_top + offset && bottom >= page_bottom + offset) - return offset; - - if (top < page_top + size * 3 / 2 + offset) - offset = top - (page_top + size * 3 / 2); - if (bottom > page_bottom - size * 3 / 2 + offset) - offset = bottom - (page_bottom - size * 3 / 2); - if (top < page_top + size * 3 / 2 + offset) - offset = top - ((page_top + page_bottom - (bottom - top)) / 2); - - return offset; -} - - -static void -e_canvas_show_area (GnomeCanvas *canvas, double x1, double y1, double x2, double y2) -{ - GtkAdjustment *h, *v; - int dx = 0, dy = 0; - - g_return_if_fail (canvas != NULL); - g_return_if_fail (GNOME_IS_CANVAS (canvas)); - - h = gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)); - dx = compute_offset(x1, x2, h->value, h->value + h->page_size); - if (dx) - gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size)); - - v = gtk_layout_get_vadjustment(GTK_LAYOUT(canvas)); - dy = compute_offset(y1, y2, v->value, v->value + v->page_size); - if (dy) - gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size)); -} - -void -e_canvas_item_show_area (GnomeCanvasItem *item, double x1, double y1, double x2, double y2) -{ - g_return_if_fail (item != NULL); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - - gnome_canvas_item_i2w(item, &x1, &y1); - gnome_canvas_item_i2w(item, &x2, &y2); - - e_canvas_show_area(item->canvas, x1, y1, x2, y2); -} - -typedef struct { - double x1; - double y1; - double x2; - double y2; - GnomeCanvas *canvas; -} DoubsAndCanvas; - -static gboolean -show_area_timeout (gpointer data) -{ - DoubsAndCanvas *dac = data; - - if (!GTK_OBJECT_DESTROYED(dac->canvas)) - e_canvas_show_area(dac->canvas, dac->x1, dac->y1, dac->x2, dac->y2); - gtk_object_unref(GTK_OBJECT(dac->canvas)); - g_free(dac); - return FALSE; -} - -void -e_canvas_item_show_area_delayed (GnomeCanvasItem *item, double x1, double y1, double x2, double y2, gint delay) -{ - DoubsAndCanvas *dac; - - g_return_if_fail (item != NULL); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - - gnome_canvas_item_i2w(item, &x1, &y1); - gnome_canvas_item_i2w(item, &x2, &y2); - - dac = g_new(DoubsAndCanvas, 1); - dac->x1 = x1; - dac->y1 = y1; - dac->x2 = x2; - dac->y2 = y2; - dac->canvas = item->canvas; - gtk_object_ref(GTK_OBJECT(item->canvas)); - g_timeout_add(delay, show_area_timeout, dac); -} diff --git a/widgets/misc/e-canvas-utils.h b/widgets/misc/e-canvas-utils.h deleted file mode 100644 index 402b0048c6..0000000000 --- a/widgets/misc/e-canvas-utils.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas-utils.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __E_CANVAS_UTILS__ -#define __E_CANVAS_UTILS__ - -#include <gnome.h> - -BEGIN_GNOME_DECLS - -void e_canvas_item_move_absolute (GnomeCanvasItem *item, double dx, double dy); -void e_canvas_item_show_area (GnomeCanvasItem *item, double x1, double y1, double x2, double y2); -void e_canvas_item_show_area_delayed (GnomeCanvasItem *item, double x1, double y1, double x2, double y2, gint delay); - -END_GNOME_DECLS - -#endif /* __E_CANVAS_UTILS__ */ diff --git a/widgets/misc/e-canvas-vbox.c b/widgets/misc/e-canvas-vbox.c deleted file mode 100644 index 0b609f3e1c..0000000000 --- a/widgets/misc/e-canvas-vbox.c +++ /dev/null @@ -1,339 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas-vbox.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <gnome.h> -#include <math.h> -#include "e-canvas-vbox.h" -#include "e-canvas-utils.h" -#include "e-canvas.h" -#include "gal/util/e-util.h" - -static void e_canvas_vbox_init (ECanvasVbox *CanvasVbox); -static void e_canvas_vbox_class_init (ECanvasVboxClass *klass); -static void e_canvas_vbox_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_canvas_vbox_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_canvas_vbox_destroy (GtkObject *object); - -static gint e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_canvas_vbox_realize (GnomeCanvasItem *item); - -static void e_canvas_vbox_reflow (GnomeCanvasItem *item, int flags); - -static void e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item); -static void e_canvas_vbox_resize_children (GnomeCanvasItem *item); - -static GnomeCanvasGroupClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_WIDTH, - ARG_MINIMUM_WIDTH, - ARG_HEIGHT, - ARG_SPACING, -}; - -GtkType -e_canvas_vbox_get_type (void) -{ - static GtkType type = 0; - - if (!type) - { - static const GtkTypeInfo info = - { - "ECanvasVbox", - sizeof (ECanvasVbox), - sizeof (ECanvasVboxClass), - (GtkClassInitFunc) e_canvas_vbox_class_init, - (GtkObjectInitFunc) e_canvas_vbox_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (gnome_canvas_group_get_type (), &info); - } - - return type; -} - -static void -e_canvas_vbox_class_init (ECanvasVboxClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - gtk_object_add_arg_type ("ECanvasVbox::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ECanvasVbox::minimum_width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH); - gtk_object_add_arg_type ("ECanvasVbox::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("ECanvasVbox::spacing", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_SPACING); - - klass->add_item = e_canvas_vbox_real_add_item; - - object_class->set_arg = e_canvas_vbox_set_arg; - object_class->get_arg = e_canvas_vbox_get_arg; - object_class->destroy = e_canvas_vbox_destroy; - - /* GnomeCanvasItem method overrides */ - item_class->event = e_canvas_vbox_event; - item_class->realize = e_canvas_vbox_realize; -} - -static void -e_canvas_vbox_init (ECanvasVbox *vbox) -{ - vbox->items = NULL; - - vbox->width = 10; - vbox->minimum_width = 10; - vbox->height = 10; - vbox->spacing = 0; - - e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(vbox), e_canvas_vbox_reflow); -} - -static void -e_canvas_vbox_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - ECanvasVbox *e_canvas_vbox; - - item = GNOME_CANVAS_ITEM (o); - e_canvas_vbox = E_CANVAS_VBOX (o); - - switch (arg_id){ - case ARG_WIDTH: - case ARG_MINIMUM_WIDTH: - e_canvas_vbox->minimum_width = GTK_VALUE_DOUBLE (*arg); - e_canvas_vbox_resize_children(item); - e_canvas_item_request_reflow(item); - break; - case ARG_SPACING: - e_canvas_vbox->spacing = GTK_VALUE_DOUBLE (*arg); - e_canvas_item_request_reflow(item); - break; - } -} - -static void -e_canvas_vbox_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ECanvasVbox *e_canvas_vbox; - - e_canvas_vbox = E_CANVAS_VBOX (object); - - switch (arg_id) { - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->width; - break; - case ARG_MINIMUM_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->minimum_width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->height; - break; - case ARG_SPACING: - GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->spacing; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_canvas_vbox_destroy (GtkObject *object) -{ - ECanvasVbox *vbox = E_CANVAS_VBOX(object); - - g_list_foreach(vbox->items, (GFunc) gtk_object_unref, NULL); - g_list_free(vbox->items); - vbox->items = NULL; - - GTK_OBJECT_CLASS(parent_class)->destroy (object); -} - -static gint -e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event) -{ - gint return_val = TRUE; - - switch (event->type) { - case GDK_KEY_PRESS: - switch (event->key.keyval) { - case GDK_Left: - case GDK_KP_Left: - case GDK_Right: - case GDK_KP_Right: - case GDK_Down: - case GDK_KP_Down: - case GDK_Up: - case GDK_KP_Up: - case GDK_Return: - case GDK_KP_Enter: - return_val = TRUE; - break; - default: - return_val = FALSE; - break; - } - break; - default: - return_val = FALSE; - break; - } - if (!return_val) { - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS (parent_class)->event (item, event); - } - return return_val; - -} - -static void -e_canvas_vbox_realize (GnomeCanvasItem *item) -{ - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_canvas_vbox_resize_children(item); - e_canvas_item_request_reflow(item); -} - -static void -e_canvas_vbox_remove_item (GnomeCanvasItem *item, ECanvasVbox *vbox) -{ - vbox->items = g_list_remove(vbox->items, item); - gtk_object_unref(GTK_OBJECT(vbox)); -} - -static void -e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item) -{ - e_canvas_vbox->items = g_list_append(e_canvas_vbox->items, item); - gtk_object_ref(GTK_OBJECT(item)); - gtk_object_ref(GTK_OBJECT(e_canvas_vbox)); - gtk_signal_connect(GTK_OBJECT(item), "destroy", - GTK_SIGNAL_FUNC(e_canvas_vbox_remove_item), e_canvas_vbox); - if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) { - gnome_canvas_item_set(item, - "width", (double) e_canvas_vbox->minimum_width, - NULL); - e_canvas_item_request_reflow(item); - } - -} - -static void -e_canvas_vbox_resize_children (GnomeCanvasItem *item) -{ - GList *list; - ECanvasVbox *e_canvas_vbox; - - e_canvas_vbox = E_CANVAS_VBOX (item); - for ( list = e_canvas_vbox->items; list; list = list->next ) { - GnomeCanvasItem *child = GNOME_CANVAS_ITEM(list->data); - gnome_canvas_item_set(child, - "width", (double) e_canvas_vbox->minimum_width, - NULL); - } -} - -static void -e_canvas_vbox_reflow( GnomeCanvasItem *item, int flags ) -{ - ECanvasVbox *e_canvas_vbox = E_CANVAS_VBOX(item); - if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) { - - gdouble old_height; - gdouble running_height; - gdouble old_width; - gdouble max_width; - - old_width = e_canvas_vbox->width; - max_width = e_canvas_vbox->minimum_width; - - old_height = e_canvas_vbox->height; - running_height = 0; - - if (e_canvas_vbox->items == NULL) { - } else { - GList *list; - gdouble item_height; - gdouble item_width; - - list = e_canvas_vbox->items; - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - "width", &item_width, - NULL); - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) 0, - (double) running_height); - running_height += item_height; - if (max_width < item_width) - max_width = item_width; - list = g_list_next(list); - - for( ; list; list = g_list_next(list)) { - running_height += e_canvas_vbox->spacing; - - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - "width", &item_width, - NULL); - - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) 0, - (double) running_height); - - running_height += item_height; - if (max_width < item_width) - max_width = item_width; - } - - } - e_canvas_vbox->height = running_height; - e_canvas_vbox->width = max_width; - if (old_height != e_canvas_vbox->height || - old_width != e_canvas_vbox->width) - e_canvas_item_request_parent_reflow(item); - } -} - -void -e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item) -{ - if (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item) - (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item) (e_canvas_vbox, item); -} diff --git a/widgets/misc/e-canvas-vbox.h b/widgets/misc/e-canvas-vbox.h deleted file mode 100644 index e7e9140c1e..0000000000 --- a/widgets/misc/e-canvas-vbox.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-canvas-vbox.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_CANVAS_VBOX_H__ -#define __E_CANVAS_VBOX_H__ - -#include <gnome.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ECanvasVbox - A canvas item container. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the CanvasVbox - * height double R height of the CanvasVbox - * spacing double RW Spacing between items. - */ - -#define E_CANVAS_VBOX_TYPE (e_canvas_vbox_get_type ()) -#define E_CANVAS_VBOX(obj) (GTK_CHECK_CAST ((obj), E_CANVAS_VBOX_TYPE, ECanvasVbox)) -#define E_CANVAS_VBOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CANVAS_VBOX_TYPE, ECanvasVboxClass)) -#define E_IS_CANVAS_VBOX(obj) (GTK_CHECK_TYPE ((obj), E_CANVAS_VBOX_TYPE)) -#define E_IS_CANVAS_VBOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CANVAS_VBOX_TYPE)) - - -typedef struct _ECanvasVbox ECanvasVbox; -typedef struct _ECanvasVboxClass ECanvasVboxClass; - -struct _ECanvasVbox -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - GList *items; /* Of type GnomeCanvasItem */ - - double width; - double minimum_width; - double height; - double spacing; -}; - -struct _ECanvasVboxClass -{ - GnomeCanvasGroupClass parent_class; - - /* Virtual methods. */ - void (* add_item) (ECanvasVbox *CanvasVbox, GnomeCanvasItem *item); -}; - -/* - * To be added to a CanvasVbox, an item must have the argument "width" as - * a Read/Write argument and "height" as a Read Only argument. It - * should also do an ECanvas parent CanvasVbox request if its size - * changes. - */ -void e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item); -GtkType e_canvas_vbox_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CANVAS_VBOX_H__ */ diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c deleted file mode 100644 index ffc3a333f8..0000000000 --- a/widgets/misc/e-canvas.c +++ /dev/null @@ -1,704 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gnome.h> -#include "e-canvas.h" - -static void e_canvas_init (ECanvas *card); -static void e_canvas_destroy (GtkObject *object); -static void e_canvas_class_init (ECanvasClass *klass); -static void e_canvas_realize (GtkWidget *widget); -static void e_canvas_unrealize (GtkWidget *widget); -static gint e_canvas_key (GtkWidget *widget, - GdkEventKey *event); - -static gint e_canvas_focus_in (GtkWidget *widget, - GdkEventFocus *event); -static gint e_canvas_focus_out (GtkWidget *widget, - GdkEventFocus *event); - -static int emit_event (GnomeCanvas *canvas, GdkEvent *event); - -static GnomeCanvasClass *parent_class = NULL; - -enum { - REFLOW, - LAST_SIGNAL -}; - -static guint e_canvas_signals [LAST_SIGNAL] = { 0, }; - -GtkType -e_canvas_get_type (void) -{ - static GtkType canvas_type = 0; - - if (!canvas_type) - { - static const GtkTypeInfo canvas_info = - { - "ECanvas", - sizeof (ECanvas), - sizeof (ECanvasClass), - (GtkClassInitFunc) e_canvas_class_init, - (GtkObjectInitFunc) e_canvas_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - canvas_type = gtk_type_unique (gnome_canvas_get_type (), &canvas_info); - } - - return canvas_type; -} - -static void -e_canvas_class_init (ECanvasClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasClass *canvas_class; - GtkWidgetClass *widget_class; - - object_class = (GtkObjectClass*) klass; - canvas_class = (GnomeCanvasClass *) klass; - widget_class = (GtkWidgetClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_get_type ()); - - object_class->destroy = e_canvas_destroy; - - widget_class->key_press_event = e_canvas_key; - widget_class->key_release_event = e_canvas_key; - widget_class->focus_in_event = e_canvas_focus_in; - widget_class->focus_out_event = e_canvas_focus_out; - widget_class->realize = e_canvas_realize; - widget_class->unrealize = e_canvas_unrealize; - - klass->reflow = NULL; - - e_canvas_signals [REFLOW] = - gtk_signal_new ("reflow", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECanvasClass, reflow), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_canvas_signals, LAST_SIGNAL); -} - -static void -e_canvas_init (ECanvas *canvas) -{ - canvas->selection = NULL; - canvas->cursor = NULL; - canvas->ic = NULL; - canvas->ic_attr = NULL; -} - -static void -e_canvas_destroy (GtkObject *object) -{ - ECanvas *canvas = E_CANVAS(object); - - if (canvas->idle_id) - g_source_remove(canvas->idle_id); - - if ((GTK_OBJECT_CLASS (parent_class))->destroy) - (*(GTK_OBJECT_CLASS (parent_class))->destroy) (object); -} - -GtkWidget * -e_canvas_new () -{ - return GTK_WIDGET (gtk_type_new (e_canvas_get_type ())); -} - - -/* Returns whether the item is an inferior of or is equal to the parent. */ -static int -is_descendant (GnomeCanvasItem *item, GnomeCanvasItem *parent) -{ - for (; item; item = item->parent) - if (item == parent) - return TRUE; - - return FALSE; -} - -/* Emits an event for an item in the canvas, be it the current item, grabbed - * item, or focused item, as appropriate. - */ -static int -emit_event (GnomeCanvas *canvas, GdkEvent *event) -{ - GdkEvent ev; - gint finished; - GnomeCanvasItem *item; - GnomeCanvasItem *parent; - guint mask; - - /* Perform checks for grabbed items */ - - if (canvas->grabbed_item && !is_descendant (canvas->current_item, canvas->grabbed_item)) - return FALSE; - - if (canvas->grabbed_item) { - switch (event->type) { - case GDK_ENTER_NOTIFY: - mask = GDK_ENTER_NOTIFY_MASK; - break; - - case GDK_LEAVE_NOTIFY: - mask = GDK_LEAVE_NOTIFY_MASK; - break; - - case GDK_MOTION_NOTIFY: - mask = GDK_POINTER_MOTION_MASK; - break; - - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - mask = GDK_BUTTON_PRESS_MASK; - break; - - case GDK_BUTTON_RELEASE: - mask = GDK_BUTTON_RELEASE_MASK; - break; - - case GDK_KEY_PRESS: - mask = GDK_KEY_PRESS_MASK; - break; - - case GDK_KEY_RELEASE: - mask = GDK_KEY_RELEASE_MASK; - break; - - default: - mask = 0; - break; - } - - if (!(mask & canvas->grabbed_event_mask)) - return FALSE; - } - - /* Convert to world coordinates -- we have two cases because of diferent - * offsets of the fields in the event structures. - */ - - ev = *event; - - switch (ev.type) { - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: - gnome_canvas_window_to_world (canvas, - ev.crossing.x, ev.crossing.y, - &ev.crossing.x, &ev.crossing.y); - break; - - case GDK_MOTION_NOTIFY: - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - gnome_canvas_window_to_world (canvas, - ev.motion.x, ev.motion.y, - &ev.motion.x, &ev.motion.y); - break; - - default: - break; - } - - /* Choose where we send the event */ - - item = canvas->current_item; - - if (canvas->focused_item - && ((event->type == GDK_KEY_PRESS) || (event->type == GDK_KEY_RELEASE) || (event->type == GDK_FOCUS_CHANGE))) - item = canvas->focused_item; - - /* The event is propagated up the hierarchy (for if someone connected to - * a group instead of a leaf event), and emission is stopped if a - * handler returns TRUE, just like for GtkWidget events. - */ - - finished = FALSE; - - while (item && !finished) { - gtk_object_ref (GTK_OBJECT (item)); - - gtk_signal_emit_by_name (GTK_OBJECT (item), "event", - &ev, - &finished); - - if (GTK_OBJECT_DESTROYED (item)) - finished = TRUE; - - parent = item->parent; - gtk_object_unref (GTK_OBJECT (item)); - - item = parent; - } - - return finished; -} - -/* Key event handler for the canvas */ -static gint -e_canvas_key (GtkWidget *widget, GdkEventKey *event) -{ - GnomeCanvas *canvas; - GdkEvent full_event; - - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - canvas = GNOME_CANVAS (widget); - - full_event.key = *event; - - return emit_event (canvas, &full_event); -} - - -/** - * e_canvas_item_grab_focus: - * @item: A canvas item. - * - * Makes the specified item take the keyboard focus, so all keyboard events will - * be sent to it. If the canvas widget itself did not have the focus, it grabs - * it as well. - **/ -void -e_canvas_item_grab_focus (GnomeCanvasItem *item) -{ - GnomeCanvasItem *focused_item; - GdkEvent ev; - - g_return_if_fail (item != NULL); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - g_return_if_fail (GTK_WIDGET_CAN_FOCUS (GTK_WIDGET (item->canvas))); - - focused_item = item->canvas->focused_item; - - if (focused_item) { - ev.focus_change.type = GDK_FOCUS_CHANGE; - ev.focus_change.window = GTK_LAYOUT (item->canvas)->bin_window; - ev.focus_change.send_event = FALSE; - ev.focus_change.in = FALSE; - - emit_event (item->canvas, &ev); - } - - item->canvas->focused_item = item; - - if (!GTK_WIDGET_HAS_FOCUS (GTK_WIDGET(item->canvas))) { - gtk_widget_grab_focus (GTK_WIDGET (item->canvas)); - } - - if (focused_item) { - ev.focus_change.type = GDK_FOCUS_CHANGE; - ev.focus_change.window = GTK_LAYOUT (item->canvas)->bin_window; - ev.focus_change.send_event = FALSE; - ev.focus_change.in = TRUE; - - emit_event (item->canvas, &ev); - } -} - -/* Focus in handler for the canvas */ -static gint -e_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event) -{ - GnomeCanvas *canvas; - ECanvas *ecanvas; - GdkEvent full_event; - - canvas = GNOME_CANVAS (widget); - ecanvas = E_CANVAS (widget); - - GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - - if (ecanvas->ic) - gdk_im_begin (ecanvas->ic, canvas->layout.bin_window); - - if (canvas->focused_item) { - full_event.focus_change = *event; - return emit_event (canvas, &full_event); - } else { - return FALSE; - } -} - -/* Focus out handler for the canvas */ -static gint -e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event) -{ - GnomeCanvas *canvas; - ECanvas *ecanvas; - GdkEvent full_event; - - canvas = GNOME_CANVAS (widget); - ecanvas = E_CANVAS (widget); - - GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - - if (ecanvas->ic) - gdk_im_end (); - - if (canvas->focused_item) { - full_event.focus_change = *event; - return emit_event (canvas, &full_event); - } else { - return FALSE; - } -} - -static void -e_canvas_realize (GtkWidget *widget) -{ - ECanvas *ecanvas = E_CANVAS (widget); - - if (GTK_WIDGET_CLASS (parent_class)->realize) - (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); - - gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window, NULL, FALSE); - - if (gdk_im_ready () && (ecanvas->ic_attr = gdk_ic_attr_new ()) != NULL) { - GdkEventMask mask; - GdkICAttr *attr = ecanvas->ic_attr; - GdkICAttributesType attrmask = GDK_IC_ALL_REQ; - GdkIMStyle style; - GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE | - GDK_IM_PREEDIT_NOTHING | - GDK_IM_STATUS_NONE | - GDK_IM_STATUS_NOTHING; - - attr->style = style = gdk_im_decide_style (supported_style); - attr->client_window = ecanvas->parent.layout.bin_window; - - ecanvas->ic = gdk_ic_new (attr, attrmask); - if (ecanvas->ic != NULL) { - mask = gdk_window_get_events (attr->client_window); - mask |= gdk_ic_get_events (ecanvas->ic); - gdk_window_set_events (attr->client_window, mask); - - if (GTK_WIDGET_HAS_FOCUS (widget)) - gdk_im_begin (ecanvas->ic, attr->client_window); - } else - g_warning ("Can't create input context."); - } - -} - -static void -e_canvas_unrealize (GtkWidget *widget) -{ - ECanvas * ecanvas = E_CANVAS (widget); - if (ecanvas->ic) { - gdk_ic_destroy (ecanvas->ic); - ecanvas->ic = NULL; - } - if (ecanvas->ic_attr) { - gdk_ic_attr_destroy (ecanvas->ic_attr); - ecanvas->ic_attr = NULL; - } - if (GTK_WIDGET_CLASS (parent_class)->unrealize) - (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); -} - -static void -e_canvas_item_invoke_reflow (GnomeCanvasItem *item, int flags) -{ - GnomeCanvasGroup *group; - GList *list; - GnomeCanvasItem *child; - - if (GNOME_IS_CANVAS_GROUP (item)) { - group = GNOME_CANVAS_GROUP (item); - for (list = group->item_list; list; list = list->next) { - child = GNOME_CANVAS_ITEM (list->data); - if (child->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW) - e_canvas_item_invoke_reflow (child, flags); - } - } - - if (item->object.flags & E_CANVAS_ITEM_NEEDS_REFLOW) { - ECanvasItemReflowFunc func; - func = gtk_object_get_data (GTK_OBJECT (item), - "ECanvasItem::reflow_callback"); - if (func) - func (item, flags); - } - - item->object.flags &= ~E_CANVAS_ITEM_NEEDS_REFLOW; - item->object.flags &= ~E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW; -} - -static void -do_reflow (ECanvas *canvas) -{ - if (GNOME_CANVAS(canvas)->root->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW) - e_canvas_item_invoke_reflow (GNOME_CANVAS(canvas)->root, 0); -} - -/* Idle handler for the e-canvas. It deals with pending reflows. */ -static gint -idle_handler (gpointer data) -{ - ECanvas *canvas; - - GDK_THREADS_ENTER(); - - canvas = E_CANVAS (data); - do_reflow (canvas); - - /* Reset idle id */ - canvas->idle_id = 0; - - gtk_signal_emit (GTK_OBJECT (canvas), - e_canvas_signals [REFLOW]); - - GDK_THREADS_LEAVE(); - - return FALSE; -} - -/* Convenience function to add an idle handler to a canvas */ -static void -add_idle (ECanvas *canvas) -{ - if (canvas->idle_id != 0) - return; - - canvas->idle_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE, idle_handler, (gpointer) canvas, NULL); -} - -static void -e_canvas_item_descendent_needs_reflow (GnomeCanvasItem *item) -{ - if (item->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW) - return; - - item->object.flags |= E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW; - if (item->parent) - e_canvas_item_descendent_needs_reflow(item->parent); -} - -void -e_canvas_item_request_reflow (GnomeCanvasItem *item) -{ - if (item->object.flags & GNOME_CANVAS_ITEM_REALIZED) { - item->object.flags |= E_CANVAS_ITEM_NEEDS_REFLOW; - e_canvas_item_descendent_needs_reflow(item); - add_idle(E_CANVAS(item->canvas)); - } -} - -void -e_canvas_item_request_parent_reflow (GnomeCanvasItem *item) -{ - g_return_if_fail(item != NULL); - g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); - e_canvas_item_request_reflow(item->parent); -} - -void -e_canvas_item_set_reflow_callback (GnomeCanvasItem *item, ECanvasItemReflowFunc func) -{ - gtk_object_set_data(GTK_OBJECT(item), "ECanvasItem::reflow_callback", (gpointer) func); -} - - -void -e_canvas_item_set_selection_callback (GnomeCanvasItem *item, ECanvasItemSelectionFunc func) -{ - gtk_object_set_data(GTK_OBJECT(item), "ECanvasItem::selection_callback", (gpointer) func); -} - -void -e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, ECanvasItemSelectionCompareFunc func) -{ - gtk_object_set_data(GTK_OBJECT(item), "ECanvasItem::selection_compare_callback", (gpointer) func); -} - -void -e_canvas_item_set_cursor (GnomeCanvasItem *item, gpointer id) -{ - GList *list; - int flags; - ECanvas *canvas; - ECanvasSelectionInfo *info; - ECanvasItemSelectionFunc func; - - g_return_if_fail(item != NULL); - g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); - g_return_if_fail(item->canvas != NULL); - g_return_if_fail(E_IS_CANVAS(item->canvas)); - - canvas = E_CANVAS(item->canvas); - flags = E_CANVAS_ITEM_SELECTION_DELETE_DATA; - - for (list = canvas->selection; list; list = g_list_next(list)) { - info = list->data; - - func = gtk_object_get_data(GTK_OBJECT(info->item), "ECanvasItem::selection_callback"); - if (func) - func(info->item, flags, info->id); - g_message ("ECANVAS: free info (2): item %p, id %p", - info->item, info->id); - gtk_object_unref (GTK_OBJECT (info->item)); - g_free(info); - } - g_list_free(canvas->selection); - - canvas->selection = NULL; - - gnome_canvas_item_grab_focus(item); - - info = g_new(ECanvasSelectionInfo, 1); - info->item = item; - gtk_object_ref (GTK_OBJECT (info->item)); - info->id = id; - g_message ("ECANVAS: new info item %p, id %p", item, id); - - flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR; - func = gtk_object_get_data(GTK_OBJECT(item), "ECanvasItem::selection_callback"); - if (func) - func(item, flags, id); - - canvas->selection = g_list_prepend(canvas->selection, info); - canvas->cursor = info; -} - -void -e_canvas_item_set_cursor_end (GnomeCanvasItem *item, gpointer id) -{ -} - -void -e_canvas_item_add_selection (GnomeCanvasItem *item, gpointer id) -{ - int flags; - ECanvas *canvas; - ECanvasSelectionInfo *info; - ECanvasItemSelectionFunc func; - GList *list; - - g_return_if_fail(item != NULL); - g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); - g_return_if_fail(item->canvas != NULL); - g_return_if_fail(E_IS_CANVAS(item->canvas)); - - flags = E_CANVAS_ITEM_SELECTION_SELECT; - canvas = E_CANVAS(item->canvas); - - if (canvas->cursor) { - func = gtk_object_get_data(GTK_OBJECT(canvas->cursor->item), "ECanvasItem::selection_callback"); - if (func) - func(canvas->cursor->item, flags, canvas->cursor->id); - } - - gnome_canvas_item_grab_focus(item); - - flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR; - - for (list = canvas->selection; list; list = g_list_next(list)) { - ECanvasSelectionInfo *search; - search = list->data; - - if (search->item == item) { - ECanvasItemSelectionCompareFunc compare_func; - compare_func = gtk_object_get_data(GTK_OBJECT(search->item), "ECanvasItem::selection_compare_callback"); - - if (compare_func(search->item, search->id, id, 0) == 0) { - canvas->cursor = search; - func = gtk_object_get_data(GTK_OBJECT(item), "ECanvasItem::selection_callback"); - if (func) - func(item, flags, search->id); - return; - } - } - } - - info = g_new(ECanvasSelectionInfo, 1); - info->item = item; - gtk_object_ref (GTK_OBJECT (info->item)); - info->id = id; - g_message ("ECANVAS: new info (2): item %p, id %p", item, id); - - func = gtk_object_get_data(GTK_OBJECT(item), "ECanvasItem::selection_callback"); - if (func) - func(item, flags, id); - - canvas->selection = g_list_prepend(canvas->selection, info); - canvas->cursor = info; -} - -void -e_canvas_item_remove_selection (GnomeCanvasItem *item, gpointer id) -{ - int flags; - ECanvas *canvas; - ECanvasSelectionInfo *info; - GList *list; - - g_return_if_fail(item != NULL); - g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); - g_return_if_fail(item->canvas != NULL); - g_return_if_fail(E_IS_CANVAS(item->canvas)); - - flags = E_CANVAS_ITEM_SELECTION_DELETE_DATA; - canvas = E_CANVAS(item->canvas); - - for (list = canvas->selection; list; list = g_list_next(list)) { - info = list->data; - - if (info->item == item) { - ECanvasItemSelectionCompareFunc compare_func; - compare_func = gtk_object_get_data(GTK_OBJECT(info->item), "ECanvasItem::selection_compare_callback"); - - if (compare_func(info->item, info->id, id, 0) == 0) { - ECanvasItemSelectionFunc func; - func = gtk_object_get_data(GTK_OBJECT(info->item), "ECanvasItem::selection_callback"); - if (func) - func(info->item, flags, info->id); - canvas->selection = g_list_remove_link(canvas->selection, list); - - if (canvas->cursor == info) - canvas->cursor = NULL; - - g_message ("ECANVAS: removing info: item %p, info %p", - info->item, info->id); - gtk_object_unref (GTK_OBJECT (info->item)); - g_free(info); - g_list_free_1(list); - break; - } - } - } -} diff --git a/widgets/misc/e-canvas.h b/widgets/misc/e-canvas.h deleted file mode 100644 index b13a9dd2ab..0000000000 --- a/widgets/misc/e-canvas.h +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-canvas.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_CANVAS_H__ -#define __E_CANVAS_H__ - -#include <gnome.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ECanvas - A class derived from canvas for the purpose of adding - * evolution specific canvas hacks. - */ - -#define E_CANVAS_TYPE (e_canvas_get_type ()) -#define E_CANVAS(obj) (GTK_CHECK_CAST ((obj), E_CANVAS_TYPE, ECanvas)) -#define E_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CANVAS_TYPE, ECanvasClass)) -#define E_IS_CANVAS(obj) (GTK_CHECK_TYPE ((obj), E_CANVAS_TYPE)) -#define E_IS_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CANVAS_TYPE)) - -typedef void (*ECanvasItemReflowFunc) (GnomeCanvasItem *item, - gint flags); - -typedef void (*ECanvasItemSelectionFunc) (GnomeCanvasItem *item, - gint flags, - gpointer user_data); -/* Returns the same as strcmp does. */ -typedef gint (*ECanvasItemSelectionCompareFunc) (GnomeCanvasItem *item, - gpointer data1, - gpointer data2, - gint flags); - - -typedef struct _ECanvas ECanvas; -typedef struct _ECanvasClass ECanvasClass; - -/* Object flags for items */ -enum { - E_CANVAS_ITEM_NEEDS_REFLOW = 1 << 13, - E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW = 1 << 14 -}; - -enum { - E_CANVAS_ITEM_SELECTION_SELECT = 1 << 0, /* TRUE = select. FALSE = unselect. */ - E_CANVAS_ITEM_SELECTION_CURSOR = 1 << 1, /* TRUE = has become cursor. FALSE = not cursor. */ - E_CANVAS_ITEM_SELECTION_DELETE_DATA = 1 << 2, -}; - -typedef struct { - GnomeCanvasItem *item; - gpointer id; -} ECanvasSelectionInfo; - -struct _ECanvas -{ - GnomeCanvas parent; - - int idle_id; - GList *selection; - ECanvasSelectionInfo *cursor; - - /* Input context for dead key support */ - GdkIC *ic; - GdkICAttr *ic_attr; -}; - -struct _ECanvasClass -{ - GnomeCanvasClass parent_class; - void (* reflow) (ECanvas *canvas); -}; - - -GtkType e_canvas_get_type (void); -GtkWidget *e_canvas_new (void); - -/* Used to send all of the keystroke events to a specific item as well as - * GDK_FOCUS_CHANGE events. - */ -void e_canvas_item_grab_focus (GnomeCanvasItem *item); - -void e_canvas_item_request_reflow (GnomeCanvasItem *item); -void e_canvas_item_request_parent_reflow (GnomeCanvasItem *item); -void e_canvas_item_set_reflow_callback (GnomeCanvasItem *item, ECanvasItemReflowFunc func); - -void e_canvas_item_set_selection_callback (GnomeCanvasItem *item, ECanvasItemSelectionFunc func); -void e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, ECanvasItemSelectionCompareFunc func); - -void e_canvas_item_set_cursor (GnomeCanvasItem *item, gpointer id); -void e_canvas_item_add_selection (GnomeCanvasItem *item, gpointer id); -void e_canvas_item_remove_selection (GnomeCanvasItem *item, gpointer id); - -/* Not implemented yet. */ -void e_canvas_item_set_cursor_end (GnomeCanvasItem *item, gpointer id); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CANVAS_H__ */ diff --git a/widgets/misc/e-clipped-label.c b/widgets/misc/e-clipped-label.c index aaabd52daf..fd475f118e 100644 --- a/widgets/misc/e-clipped-label.c +++ b/widgets/misc/e-clipped-label.c @@ -30,6 +30,10 @@ * of text (so no wrapping/justification), without underlined characters. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <math.h> #include <string.h> diff --git a/widgets/misc/e-colors.c b/widgets/misc/e-colors.c deleted file mode 100644 index c7a79003ae..0000000000 --- a/widgets/misc/e-colors.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * e_color.c: General color allocation utilities - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * We keep our own color context, as the color allocation might take place - * before things are realized. - */ -#include <config.h> -#include <gnome.h> -#include "e-colors.h" - -static gboolean e_color_inited; -static GdkColorContext *e_color_context; - -GdkColor e_white, e_dark_gray, e_black; - -int -e_color_alloc (gushort red, gushort green, gushort blue) -{ - int failed; - - if (!e_color_inited) - e_color_init (); - - return gdk_color_context_get_pixel (e_color_context, - red, green, blue, &failed); -} - -void -e_color_alloc_gdk (GdkColor *c) -{ - int failed; - - g_return_if_fail (c != NULL); - - if (!e_color_inited) - e_color_init (); - - c->pixel = gdk_color_context_get_pixel (e_color_context, c->red, c->green, c->blue, &failed); -} - -void -e_color_alloc_name (const char *name, GdkColor *c) -{ - int failed; - - g_return_if_fail (name != NULL); - g_return_if_fail (c != NULL); - - if (!e_color_inited) - e_color_init (); - - gdk_color_parse (name, c); - c->pixel = 0; - c->pixel = gdk_color_context_get_pixel (e_color_context, c->red, c->green, c->blue, &failed); -} - -void -e_color_init (void) -{ - GdkColormap *colormap; - - /* It's surprisingly easy to end up calling this twice. Survive. */ - if (e_color_inited) - return; - - colormap = gtk_widget_get_default_colormap (); - - /* Initialize the color context */ - e_color_context = gdk_color_context_new ( - gtk_widget_get_default_visual (), colormap); - - e_color_inited = TRUE; - - /* Allocate the default colors */ - gdk_color_white (colormap, &e_white); - gdk_color_black (colormap, &e_black); - e_color_alloc_name ("gray20", &e_dark_gray); -} diff --git a/widgets/misc/e-colors.h b/widgets/misc/e-colors.h deleted file mode 100644 index 590a89995c..0000000000 --- a/widgets/misc/e-colors.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GNOME_APP_LIBS_COLOR_H -#define GNOME_APP_LIBS_COLOR_H - -BEGIN_GNOME_DECLS - -void e_color_init (void); - -/* Return the pixel value for the given red, green and blue */ -int e_color_alloc (gushort red, gushort green, gushort blue); -void e_color_alloc_name (const char *name, GdkColor *color); -void e_color_alloc_gdk (GdkColor *color); - -extern GdkColor e_white, e_dark_gray, e_black; - -END_GNOME_DECLS - -#endif /* GNOME_APP_LIBS_COLOR_H */ diff --git a/widgets/misc/e-cursors.c b/widgets/misc/e-cursors.c deleted file mode 100644 index c10e0e6490..0000000000 --- a/widgets/misc/e-cursors.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * cursors.c: cursor handling for Gnumeric - * - * Authors: - * Miguel de Icaza (miguel@gnu.org) - */ -#include <config.h> -#include <gnome.h> -#include "e-colors.h" -#include "e-cursors.h" -#include "pixmaps/cursor_cross.xpm" -#include "pixmaps/cursor_zoom_in.xpm" -#include "pixmaps/cursor_zoom_out.xpm" -#include "pixmaps/cursor_hand_open.xpm" -#include "pixmaps/cursor_hand_closed.xpm" - -#define GDK_INTERNAL_CURSOR -1 - -typedef struct { - GdkCursor *cursor; - int hot_x, hot_y; - char **xpm; -} CursorDef; - -static CursorDef cursors [] = { - { NULL, 17, 17, cursor_cross_xpm }, - { NULL, GDK_INTERNAL_CURSOR, GDK_CROSSHAIR, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_ARROW, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_FLEUR, NULL }, - { NULL, 24, 24, cursor_zoom_in_xpm }, - { NULL, 24, 24, cursor_zoom_out_xpm }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SB_H_DOUBLE_ARROW, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SB_V_DOUBLE_ARROW, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SIZING, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SIZING, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_HAND2, NULL }, - { NULL, 10, 10, cursor_hand_open_xpm }, - { NULL, 10, 10, cursor_hand_closed_xpm }, - { NULL, 0, 0, NULL } -}; - - -static void -create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, gchar **xpm) -{ - int height, width, colors; - char pixmap_buffer [(32 * 32)/8]; - char mask_buffer [(32 * 32)/8]; - int x, y, pix, yofs; - int transparent_color, black_color; - - sscanf (xpm [0], "%d %d %d %d", &height, &width, &colors, &pix); - - g_assert (height == 32); - g_assert (width == 32); - g_assert (colors <= 3); - - transparent_color = ' '; - black_color = '.'; - - yofs = colors + 1; - for (y = 0; y < 32; y++){ - for (x = 0; x < 32;){ - char value = 0, maskv = 0; - - for (pix = 0; pix < 8; pix++, x++){ - if (xpm [y + yofs][x] != transparent_color){ - maskv |= 1 << pix; - - /* - * Invert the colours here because it seems - * to workaround a bug the Matrox G100 Xserver? - * We reverse the foreground & background in the next - * routine to compensate. - */ - if (xpm [y + yofs][x] == black_color){ - value |= 1 << pix; - } - } - } - pixmap_buffer [(y * 4 + x/8)-1] = value; - mask_buffer [(y * 4 + x/8)-1] = maskv; - } - } - *bitmap = gdk_bitmap_create_from_data (NULL, pixmap_buffer, 32, 32); - *mask = gdk_bitmap_create_from_data (NULL, mask_buffer, 32, 32); -} - -void -e_cursors_init (void) -{ - int i; - - for (i = 0; cursors [i].hot_x; i++){ - GdkBitmap *bitmap, *mask; - - if (cursors [i].hot_x < 0) - cursors [i].cursor = gdk_cursor_new (cursors [i].hot_y); - else { - create_bitmap_and_mask_from_xpm (&bitmap, &mask, cursors [i].xpm); - - /* The foreground and background colours are reversed. - * See comment above for explanation. - */ - cursors [i].cursor = - gdk_cursor_new_from_pixmap ( - bitmap, mask, - &e_black, &e_white, - cursors [i].hot_x, - cursors [i].hot_y); - } - } - - g_assert (i == E_CURSOR_NUM_CURSORS); -} - -void -e_cursors_shutdown (void) -{ - int i; - - for (i = 0; cursors [i].hot_x; i++) - gdk_cursor_destroy (cursors [i].cursor); -} - - -/* Returns a cursor given its type */ -GdkCursor * -e_cursor_get (ECursorType type) -{ - g_return_val_if_fail (type >= 0 && type < E_CURSOR_NUM_CURSORS, NULL); - - return cursors [type].cursor; -} diff --git a/widgets/misc/e-cursors.h b/widgets/misc/e-cursors.h deleted file mode 100644 index a8374d6506..0000000000 --- a/widgets/misc/e-cursors.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef GNOME_APP_LIB_CURSORS_H -#define GNOME_APP_LIB_CURSORS_H - -#include <gdk/gdk.h> - -BEGIN_GNOME_DECLS - -typedef enum { - E_CURSOR_FAT_CROSS, - E_CURSOR_THIN_CROSS, - E_CURSOR_ARROW, - E_CURSOR_MOVE, - E_CURSOR_ZOOM_IN, - E_CURSOR_ZOOM_OUT, - E_CURSOR_SIZE_X, - E_CURSOR_SIZE_Y, - E_CURSOR_SIZE_TL, - E_CURSOR_SIZE_TR, - E_CURSOR_PRESS, - E_CURSOR_HAND_OPEN, - E_CURSOR_HAND_CLOSED, - E_CURSOR_NUM_CURSORS -} ECursorType; - -void e_cursors_init (void); -void e_cursors_shutdown (void); - -#define e_cursor_set(win, c) \ -G_STMT_START { \ - if (win) \ - gdk_window_set_cursor (win, e_cursor_get (c)); \ -} G_STMT_END - -#define e_cursor_set_widget(w, c) \ -G_STMT_START { \ - if (GTK_WIDGET (w)->window) \ - gdk_window_set_cursor (GTK_WIDGET (w)->window, e_cursor_get (c)); \ -} G_STMT_END - -GdkCursor *e_cursor_get (ECursorType type); - -END_GNOME_DECLS - -#endif /* GNOME_APP_LIB_CURSORS_H */ diff --git a/widgets/misc/e-gui-utils.c b/widgets/misc/e-gui-utils.c deleted file mode 100644 index 9019ae18c5..0000000000 --- a/widgets/misc/e-gui-utils.c +++ /dev/null @@ -1,213 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * GUI utility functions - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 1999 Miguel de Icaza - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include <gtk/gtksignal.h> -#include <libgnomeui/gnome-messagebox.h> -#include <libgnomeui/gnome-stock.h> -#include <gnome.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <gdk-pixbuf/gnome-canvas-pixbuf.h> -#include "e-gui-utils.h" - -void -e_notice (GtkWindow *window, const char *type, const char *format, ...) -{ - GtkWidget *dialog; - va_list args; - char *str; - - va_start (args, format); - str = g_strdup_vprintf (format, args); - dialog = gnome_message_box_new (str, type, GNOME_STOCK_BUTTON_OK, NULL); - va_end (args); - g_free (str); - - if (window) - gnome_dialog_set_parent (GNOME_DIALOG (dialog), window); - - gnome_dialog_run (GNOME_DIALOG (dialog)); -} - -static void -kill_popup_menu (GtkWidget *widget, GtkMenu *menu) -{ - g_return_if_fail (menu != NULL); - g_return_if_fail (GTK_IS_MENU (menu)); - - gtk_object_unref (GTK_OBJECT (menu)); -} - -void -e_auto_kill_popup_menu_on_hide (GtkMenu *menu) -{ - g_return_if_fail (menu != NULL); - g_return_if_fail (GTK_IS_MENU (menu)); - - gtk_signal_connect (GTK_OBJECT (menu), "hide", - GTK_SIGNAL_FUNC (kill_popup_menu), menu); -} - -void -e_popup_menu (GtkMenu *menu, GdkEvent *event) -{ - g_return_if_fail (menu != NULL); - g_return_if_fail (GTK_IS_MENU (menu)); - - e_auto_kill_popup_menu_on_hide (menu); - - if (event->type == GDK_KEY_PRESS) - gtk_menu_popup (menu, NULL, NULL, 0, NULL, 0, event->key.time); - else if ((event->type == GDK_BUTTON_PRESS) || - (event->type == GDK_BUTTON_RELEASE) || - (event->type == GDK_2BUTTON_PRESS) || - (event->type == GDK_3BUTTON_PRESS)){ - gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button.button, event->button.time); - } else - gtk_menu_popup (menu, NULL, NULL, 0, NULL, 0, GDK_CURRENT_TIME); -} - -typedef struct { - GtkCallback callback; - gpointer closure; -} CallbackClosure; - -static void -e_container_foreach_leaf_callback(GtkWidget *widget, CallbackClosure *callback_closure) -{ - if (GTK_IS_CONTAINER(widget)) { - e_container_foreach_leaf(GTK_CONTAINER(widget), callback_closure->callback, callback_closure->closure); - } else { - (*callback_closure->callback) (widget, callback_closure->closure); - } -} - -void -e_container_foreach_leaf(GtkContainer *container, - GtkCallback callback, - gpointer closure) -{ - CallbackClosure callback_closure; - callback_closure.callback = callback; - callback_closure.closure = closure; - gtk_container_foreach(container, (GtkCallback) e_container_foreach_leaf_callback, &callback_closure); -} - -static void -e_container_change_tab_order_destroy_notify(gpointer data) -{ - GList *list = data; - g_list_foreach(list, (GFunc) gtk_object_unref, NULL); - g_list_free(list); -} - - -static gint -e_container_change_tab_order_callback(GtkContainer *container, - GtkDirectionType direction, - GList *children) -{ - GtkWidget *focus_child; - GtkWidget *child; - - if (direction != GTK_DIR_TAB_FORWARD && - direction != GTK_DIR_TAB_BACKWARD) - return FALSE; - - focus_child = container->focus_child; - - if (direction == GTK_DIR_TAB_BACKWARD) { - children = g_list_last(children); - } - - while (children) { - child = children->data; - if (direction == GTK_DIR_TAB_FORWARD) - children = children->next; - else - children = children->prev; - - if (!child) - continue; - - if (focus_child) { - if (focus_child == child) { - focus_child = NULL; - - if (GTK_WIDGET_DRAWABLE (child) && - GTK_IS_CONTAINER (child) && - !GTK_WIDGET_HAS_FOCUS (child)) - if (gtk_container_focus (GTK_CONTAINER (child), direction)) { - gtk_signal_emit_stop_by_name(GTK_OBJECT(container), "focus"); - return TRUE; - } - } - } - else if (GTK_WIDGET_DRAWABLE (child)) { - if (GTK_IS_CONTAINER (child)) { - if (gtk_container_focus (GTK_CONTAINER (child), direction)) { - gtk_signal_emit_stop_by_name(GTK_OBJECT(container), "focus"); - return TRUE; - } - } - else if (GTK_WIDGET_CAN_FOCUS (child)) { - gtk_widget_grab_focus (child); - gtk_signal_emit_stop_by_name(GTK_OBJECT(container), "focus"); - return TRUE; - } - } - } - - return FALSE; -} - -gint -e_container_change_tab_order(GtkContainer *container, GList *widgets) -{ - GList *list; - list = g_list_copy(widgets); - g_list_foreach(list, (GFunc) gtk_object_ref, NULL); - return gtk_signal_connect_full(GTK_OBJECT(container), "focus", - GTK_SIGNAL_FUNC(e_container_change_tab_order_callback), - NULL, list, - e_container_change_tab_order_destroy_notify, - FALSE, FALSE); -} - -struct widgetandint { - GtkWidget *widget; - int count; -}; - -static void -nth_entry_callback(GtkWidget *widget, struct widgetandint *data) -{ - if (GTK_IS_ENTRY(widget)) { - if (data->count > 1) { - data->count --; - data->widget = widget; - } else if (data->count == 1) { - data->count --; - data->widget = NULL; - gtk_widget_grab_focus(widget); - } - } -} - -void -e_container_focus_nth_entry(GtkContainer *container, int n) -{ - struct widgetandint data; - data.widget = NULL; - data.count = n; - e_container_foreach_leaf(container, (GtkCallback) nth_entry_callback, &data); - if (data.widget) - gtk_widget_grab_focus(data.widget); -} diff --git a/widgets/misc/e-gui-utils.h b/widgets/misc/e-gui-utils.h deleted file mode 100644 index d11d0a77fb..0000000000 --- a/widgets/misc/e-gui-utils.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef GAL_GUI_UTILS_H -#define GAL_GUI_UTILS_H - -#include <gtk/gtkmenu.h> -#include <gtk/gtkwindow.h> - -#include <libgnomeui/gnome-messagebox.h> - -BEGIN_GNOME_DECLS - -void e_popup_menu (GtkMenu *menu, GdkEvent *event); -void e_auto_kill_popup_menu_on_hide (GtkMenu *menu); -void e_notice (GtkWindow *window, const char *type, const char *format, ...); -void e_container_foreach_leaf (GtkContainer *container, - GtkCallback callback, - gpointer closure); -void e_container_focus_nth_entry (GtkContainer *container, - int n); -gint e_container_change_tab_order (GtkContainer *container, - GList *widgets); - -END_GNOME_DECLS - -#endif /* GAL_GUI_UTILS_H */ diff --git a/widgets/misc/e-popup-menu.c b/widgets/misc/e-popup-menu.c deleted file mode 100644 index 0eadba4225..0000000000 --- a/widgets/misc/e-popup-menu.c +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-popup-menu.c: popup menu display -nnn * - * Authors: - * Miguel de Icaza (miguel@kernel.org) - * Jody Goldberg (jgoldberg@home.com) - * Jeffrey Stedfast <fejj@helixcode.com> - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include <gnome.h> -#include "e-popup-menu.h" -#include "e-gui-utils.h" - -/* - * Creates an item with an optional icon - */ -static GtkWidget * -make_item (GtkMenu *menu, const char *name, const char *pixname) -{ - GtkWidget *label, *item; - guint label_accel; - - if (*name == '\0') - return gtk_menu_item_new (); - - /* - * Ugh. This needs to go into Gtk+ - */ - label = gtk_accel_label_new (""); - label_accel = gtk_label_parse_uline (GTK_LABEL (label), name); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_widget_show (label); - - item = pixname ? gtk_pixmap_menu_item_new () : gtk_menu_item_new (); - gtk_container_add (GTK_CONTAINER (item), label); - - if (label_accel != GDK_VoidSymbol){ - gtk_widget_add_accelerator ( - item, - "activate_item", - gtk_menu_ensure_uline_accel_group (GTK_MENU (menu)), - label_accel, 0, - GTK_ACCEL_LOCKED); - } - - if (pixname){ - GtkWidget *pixmap = gnome_stock_pixmap_widget (item, pixname); - - gtk_widget_show (pixmap); - gtk_pixmap_menu_item_set_pixmap ( - GTK_PIXMAP_MENU_ITEM (item), pixmap); - } - - return item; -} - -GtkMenu * -e_popup_menu_create (EPopupMenu *menu_list, guint32 disable_mask, guint32 hide_mask, void *closure) -{ - GtkMenu *menu = GTK_MENU (gtk_menu_new ()); - gboolean last_item_seperator = TRUE; - gint last_non_seperator = -1; - gint i; - - for (i = 0; menu_list[i].name; i++) { - if (strcmp ("", menu_list[i].name) && !(menu_list [i].disable_mask & hide_mask)) { - last_non_seperator = i; - } - } - - for (i = 0; i <= last_non_seperator; i++) { - gboolean seperator; - - seperator = !strcmp ("", menu_list[i].name); - - if ((!(seperator && last_item_seperator)) && !(menu_list [i].disable_mask & hide_mask)) { - GtkWidget *item; - - item = make_item (menu, menu_list[i].name, menu_list[i].pixname); - gtk_menu_append (menu, item); - - if (!menu_list[i].submenu) { - if (menu_list[i].fn) - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (menu_list[i].fn), - closure); - } else { - /* submenu */ - GtkMenu *submenu; - - submenu = e_popup_menu_create (menu_list[i].submenu, disable_mask, hide_mask, closure); - - gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), GTK_WIDGET (submenu)); - } - - if (menu_list[i].disable_mask & disable_mask) - gtk_widget_set_sensitive (item, FALSE); - - gtk_widget_show (item); - } - - last_item_seperator = seperator; - } - - return menu; -} - -void -e_popup_menu_run (EPopupMenu *menu_list, GdkEvent *event, guint32 disable_mask, guint32 hide_mask, void *closure) -{ - GtkMenu *menu; - - g_return_if_fail (menu_list != NULL); - g_return_if_fail (event != NULL); - - menu = e_popup_menu_create (menu_list, disable_mask, hide_mask, closure); - - e_popup_menu (menu, event); -} - diff --git a/widgets/misc/e-popup-menu.h b/widgets/misc/e-popup-menu.h deleted file mode 100644 index 61839902f6..0000000000 --- a/widgets/misc/e-popup-menu.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef E_POPUP_MENU_H -#define E_POPUP_MENU_H - -#include <gtk/gtkwidget.h> - -BEGIN_GNOME_DECLS - -typedef struct _EPopupMenu EPopupMenu; - -struct _EPopupMenu { - char *name; - char *pixname; - void (*fn) (GtkWidget *widget, void *closure); - EPopupMenu *submenu; - guint32 disable_mask; -}; - -GtkMenu *e_popup_menu_create (EPopupMenu *menu_list, - guint32 disable_mask, - guint32 hide_mask, - void *closure); - -void e_popup_menu_run (EPopupMenu *menu_list, - GdkEvent *event, - guint32 disable_mask, - guint32 hide_mask, - void *closure); - -END_GNOME_DECLS - -#endif /* E_POPUP_MENU_H */ diff --git a/widgets/misc/e-printable.c b/widgets/misc/e-printable.c deleted file mode 100644 index f029e88573..0000000000 --- a/widgets/misc/e-printable.c +++ /dev/null @@ -1,207 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-printable.c: an object printer. - * - * Author: - * Christopher James Lahey <clahey@helixcode.com> - * - * (C) 2000 Helix Code, Inc. - */ -#include <config.h> -#include <gtk/gtksignal.h> -#include "gal/util/e-util.h" -#include "e-printable.h" - -#define EP_CLASS(e) ((EPrintableClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type () - - -static GtkObjectClass *e_printable_parent_class; - -enum { - PRINT_PAGE, - DATA_LEFT, - RESET, - HEIGHT, - WILL_FIT, - LAST_SIGNAL -}; - -static guint e_printable_signals [LAST_SIGNAL] = { 0, }; - -static void -e_printable_class_init (GtkObjectClass *object_class) -{ - EPrintableClass *klass = E_PRINTABLE_CLASS(object_class); - e_printable_parent_class = gtk_type_class (PARENT_TYPE); - - e_printable_signals [PRINT_PAGE] = - gtk_signal_new ("print_page", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EPrintableClass, print_page), - e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL, - GTK_TYPE_NONE, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL); - - e_printable_signals [DATA_LEFT] = - gtk_signal_new ("data_left", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EPrintableClass, data_left), - gtk_marshal_BOOL__NONE, - GTK_TYPE_BOOL, 0, GTK_TYPE_NONE); - - e_printable_signals [RESET] = - gtk_signal_new ("reset", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EPrintableClass, reset), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0, GTK_TYPE_NONE); - - e_printable_signals [HEIGHT] = - gtk_signal_new ("height", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EPrintableClass, height), - e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL, - GTK_TYPE_DOUBLE, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL); - - e_printable_signals [WILL_FIT] = - gtk_signal_new ("will_fit", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EPrintableClass, will_fit), - e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL, - GTK_TYPE_BOOL, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL); - - gtk_object_class_add_signals (object_class, e_printable_signals, LAST_SIGNAL); - - klass->print_page = NULL; - klass->data_left = NULL; - klass->reset = NULL; - klass->height = NULL; - klass->will_fit = NULL; -} - - -guint -e_printable_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "EPrintable", - sizeof (EPrintable), - sizeof (EPrintableClass), - (GtkClassInitFunc) e_printable_class_init, - NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (gtk_object_get_type (), &info); - } - - return type; -} - -EPrintable * -e_printable_new(void) -{ - return E_PRINTABLE(gtk_type_new(e_printable_get_type())); -} - -void -e_printable_print_page (EPrintable *e_printable, - GnomePrintContext *context, - gdouble width, - gdouble height, - gboolean quantized) -{ - g_return_if_fail (e_printable != NULL); - g_return_if_fail (E_IS_PRINTABLE (e_printable)); - - gtk_signal_emit (GTK_OBJECT (e_printable), - e_printable_signals [PRINT_PAGE], - context, - width, - height, - quantized); -} - -gboolean -e_printable_data_left (EPrintable *e_printable) -{ - gboolean ret_val; - - g_return_val_if_fail (e_printable != NULL, FALSE); - g_return_val_if_fail (E_IS_PRINTABLE (e_printable), FALSE); - - gtk_signal_emit (GTK_OBJECT (e_printable), - e_printable_signals [DATA_LEFT], - &ret_val); - - return ret_val; -} - -void -e_printable_reset (EPrintable *e_printable) -{ - g_return_if_fail (e_printable != NULL); - g_return_if_fail (E_IS_PRINTABLE (e_printable)); - - gtk_signal_emit (GTK_OBJECT (e_printable), - e_printable_signals [RESET]); -} - -gdouble -e_printable_height (EPrintable *e_printable, - GnomePrintContext *context, - gdouble width, - gdouble max_height, - gboolean quantized) -{ - gdouble ret_val; - - g_return_val_if_fail (e_printable != NULL, -1); - g_return_val_if_fail (E_IS_PRINTABLE (e_printable), -1); - - gtk_signal_emit (GTK_OBJECT (e_printable), - e_printable_signals [HEIGHT], - context, - width, - max_height, - quantized, - &ret_val); - - return ret_val; -} - -gboolean -e_printable_will_fit (EPrintable *e_printable, - GnomePrintContext *context, - gdouble width, - gdouble max_height, - gboolean quantized) -{ - gboolean ret_val; - - g_return_val_if_fail (e_printable != NULL, -1); - g_return_val_if_fail (E_IS_PRINTABLE (e_printable), -1); - - gtk_signal_emit (GTK_OBJECT (e_printable), - e_printable_signals [WILL_FIT], - context, - width, - max_height, - quantized, - &ret_val); - - return ret_val; -} diff --git a/widgets/misc/e-printable.h b/widgets/misc/e-printable.h deleted file mode 100644 index 581b1e6f63..0000000000 --- a/widgets/misc/e-printable.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-printable.h: an object printer. - * - * Author: - * Christopher James Lahey <clahey@helixcode.com> - * - * (C) 2000 Helix Code, Inc. - */ -#ifndef _E_PRINTABLE_H_ -#define _E_PRINTABLE_H_ - -#include <gtk/gtkobject.h> -#include <libgnomeprint/gnome-print.h> - -BEGIN_GNOME_DECLS - -#define E_PRINTABLE_TYPE (e_printable_get_type ()) -#define E_PRINTABLE(o) (GTK_CHECK_CAST ((o), E_PRINTABLE_TYPE, EPrintable)) -#define E_PRINTABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_PRINTABLE_TYPE, EPrintableClass)) -#define E_IS_PRINTABLE(o) (GTK_CHECK_TYPE ((o), E_PRINTABLE_TYPE)) -#define E_IS_PRINTABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_PRINTABLE_TYPE)) - -typedef struct { - GtkObject base; -} EPrintable; - -typedef struct { - GtkObjectClass parent_class; - - /* - * Signals - */ - - void (*print_page) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble height, gboolean quantized); - gboolean (*data_left) (EPrintable *etm); - void (*reset) (EPrintable *etm); - gdouble (*height) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized); - - /* e_printable_will_fit (ep, ...) should be equal in value to - * (e_printable_print_page (ep, ...), - * !e_printable_data_left(ep)) except that the latter has the - * side effect of doing the printing and advancing the - * position of the printable. - */ - - gboolean (*will_fit) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized); -} EPrintableClass; - -GtkType e_printable_get_type (void); - -EPrintable *e_printable_new (void); - -/* - * Routines for emitting signals on the e_table */ -void e_printable_print_page (EPrintable *e_printable, - GnomePrintContext *context, - gdouble width, - gdouble height, - gboolean quantized); -gboolean e_printable_data_left (EPrintable *e_printable); -void e_printable_reset (EPrintable *e_printable); -gdouble e_printable_height (EPrintable *e_printable, - GnomePrintContext *context, - gdouble width, - gdouble max_height, - gboolean quantized); -gboolean e_printable_will_fit (EPrintable *e_printable, - GnomePrintContext *context, - gdouble width, - gdouble max_height, - gboolean quantized); - -END_GNOME_DECLS - -#endif /* _E_PRINTABLE_H_ */ diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c deleted file mode 100644 index 735d965120..0000000000 --- a/widgets/misc/e-reflow.c +++ /dev/null @@ -1,861 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-reflow.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <gnome.h> -#include <math.h> -#include "e-reflow.h" -#include "gal/e-text/e-text.h" -#include "e-canvas-utils.h" -#include "e-canvas.h" -#include "gal/util/e-util.h" - -static void e_reflow_init (EReflow *reflow); -static void e_reflow_class_init (EReflowClass *klass); -static void e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_reflow_destroy (GtkObject *object); -static gboolean e_reflow_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_reflow_realize (GnomeCanvasItem *item); -static void e_reflow_unrealize (GnomeCanvasItem *item); -static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static void e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags); -static double e_reflow_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item); -static void e_reflow_reflow (GnomeCanvasItem *item, int flags); -static void e_reflow_real_add_item(EReflow *e_reflow, GnomeCanvasItem *item, gint *position); -static void set_empty(EReflow *e_reflow); - -static void e_reflow_resize_children (GnomeCanvasItem *item); - -#define E_REFLOW_DIVIDER_WIDTH 2 -#define E_REFLOW_BORDER_WIDTH 7 -#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2) - -static GnomeCanvasGroupClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_MINIMUM_WIDTH, - ARG_WIDTH, - ARG_HEIGHT, - ARG_EMPTY_MESSAGE, -}; - -GtkType -e_reflow_get_type (void) -{ - static GtkType reflow_type = 0; - - if (!reflow_type) - { - static const GtkTypeInfo reflow_info = - { - "EReflow", - sizeof (EReflow), - sizeof (EReflowClass), - (GtkClassInitFunc) e_reflow_class_init, - (GtkObjectInitFunc) e_reflow_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - reflow_type = gtk_type_unique (gnome_canvas_group_get_type (), &reflow_info); - } - - return reflow_type; -} - -static void -e_reflow_class_init (EReflowClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - gtk_object_add_arg_type ("EReflow::minimum_width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH); - gtk_object_add_arg_type ("EReflow::width", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_WIDTH); - gtk_object_add_arg_type ("EReflow::height", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_HEIGHT); - gtk_object_add_arg_type ("EReflow::empty_message", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_EMPTY_MESSAGE); - - klass->add_item = e_reflow_real_add_item; - - object_class->set_arg = e_reflow_set_arg; - object_class->get_arg = e_reflow_get_arg; - object_class->destroy = e_reflow_destroy; - - /* GnomeCanvasItem method overrides */ - item_class->event = e_reflow_event; - item_class->realize = e_reflow_realize; - item_class->unrealize = e_reflow_unrealize; - item_class->draw = e_reflow_draw; - item_class->update = e_reflow_update; - item_class->point = e_reflow_point; -} - -static void -e_reflow_init (EReflow *reflow) -{ - reflow->items = NULL; - reflow->columns = NULL; - reflow->column_width = 150; - - reflow->minimum_width = 10; - reflow->width = 10; - reflow->height = 10; - reflow->idle = 0; - - reflow->empty_message = NULL; - reflow->empty_text = NULL; - - reflow->column_drag = FALSE; - - reflow->need_height_update = FALSE; - reflow->need_column_resize = FALSE; - - reflow->default_cursor_shown = TRUE; - reflow->arrow_cursor = NULL; - reflow->default_cursor = NULL; - - e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(reflow), e_reflow_reflow); -} - -static void -e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EReflow *e_reflow; - - item = GNOME_CANVAS_ITEM (o); - e_reflow = E_REFLOW (o); - - switch (arg_id){ - case ARG_HEIGHT: - e_reflow->height = GTK_VALUE_DOUBLE (*arg); - e_canvas_item_request_reflow(item); - break; - case ARG_MINIMUM_WIDTH: - e_reflow->minimum_width = GTK_VALUE_DOUBLE (*arg); - if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(o)) - set_empty(e_reflow); - e_canvas_item_request_reflow(item); - break; - case ARG_EMPTY_MESSAGE: - g_free(e_reflow->empty_message); - e_reflow->empty_message = g_strdup(GTK_VALUE_STRING (*arg)); - if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(o)) - set_empty(e_reflow); - } -} - -static void -e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (object); - - switch (arg_id) { - case ARG_MINIMUM_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_reflow->minimum_width; - break; - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_reflow->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_reflow->height; - break; - case ARG_EMPTY_MESSAGE: - GTK_VALUE_STRING (*arg) = g_strdup(e_reflow->empty_message); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_reflow_destroy (GtkObject *object) -{ - EReflow *reflow = E_REFLOW(object); - - g_list_foreach(reflow->items, (GFunc) gtk_object_unref, NULL); - g_list_free(reflow->items); - reflow->items = NULL; - - g_free(reflow->empty_message); - - GTK_OBJECT_CLASS(parent_class)->destroy (object); -} - -static void -e_reflow_realize (GnomeCanvasItem *item) -{ - EReflow *e_reflow; - GnomeCanvasGroup *group; - GList *list; - GtkAdjustment *adjustment; - - e_reflow = E_REFLOW (item); - group = GNOME_CANVAS_GROUP( item ); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_reflow->arrow_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW); - e_reflow->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); - - for(list = e_reflow->items; list; list = g_list_next(list)) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM(list->data); - gnome_canvas_item_set(item, - "width", (double) e_reflow->column_width, - NULL); - } - - set_empty(e_reflow); - - e_canvas_item_request_reflow(item); - - adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - - if (!item->canvas->aa) { - } -} - -static void -e_reflow_unrealize (GnomeCanvasItem *item) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (item); - - if (!item->canvas->aa) - { - } - - gdk_cursor_destroy (e_reflow->arrow_cursor); - gdk_cursor_destroy (e_reflow->default_cursor); - e_reflow->arrow_cursor = NULL; - e_reflow->default_cursor = NULL; - - g_list_free (e_reflow->columns); - e_reflow->columns = NULL; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); -} - -static gint -e_reflow_pick_line (EReflow *e_reflow, double x) -{ - x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - x /= e_reflow->column_width + E_REFLOW_FULL_GUTTER; - return x; -} - -static gboolean -e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (item); - - switch( event->type ) - { - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - GList *list; - for (list = e_reflow->items; list; list = list->next) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); - EFocus has_focus; - gtk_object_get(GTK_OBJECT(item), - "has_focus", &has_focus, - NULL); - if (has_focus) { - if (event->key.state & GDK_SHIFT_MASK) - list = list->prev; - else - list = list->next; - if (list) { - item = GNOME_CANVAS_ITEM(list->data); - gnome_canvas_item_set(item, - "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, - NULL); - return 1; - } else { - return 0; - } - } - } - } - break; - case GDK_BUTTON_PRESS: - switch(event->button.button) - { - case 1: - { - GdkEventButton *button = (GdkEventButton *) event; - double n_x, max_x; - n_x = button->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - - max_x = E_REFLOW_BORDER_WIDTH; - max_x += (e_reflow->column_width + E_REFLOW_FULL_GUTTER) * e_reflow->column_count; - if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > button->x ) { - e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x); - e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2; - e_reflow->temp_column_width = e_reflow->column_width; - e_reflow->column_drag = TRUE; - - gnome_canvas_item_grab (item, - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - e_reflow->arrow_cursor, - button->time); - - e_reflow->previous_temp_column_width = -1; - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - return TRUE; - } - } - break; - case 4: - { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - gdouble new_value = adjustment->value; - new_value -= adjustment->step_increment; - gtk_adjustment_set_value(adjustment, new_value); - } - break; - case 5: - { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - gdouble new_value = adjustment->value; - new_value += adjustment->step_increment; - if ( new_value > adjustment->upper - adjustment->page_size ) - new_value = adjustment->upper - adjustment->page_size; - gtk_adjustment_set_value(adjustment, new_value); - } - break; - } - break; - case GDK_BUTTON_RELEASE: - if (e_reflow->column_drag) { - gdouble old_width = e_reflow->column_width; - GdkEventButton *button = (GdkEventButton *) event; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - e_reflow->temp_column_width = e_reflow->column_width + - (button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value)); - if ( e_reflow->temp_column_width < 50 ) - e_reflow->temp_column_width = 50; - e_reflow->column_drag = FALSE; - if ( old_width != e_reflow->temp_column_width ) { - gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width)); - e_reflow->column_width = e_reflow->temp_column_width; - adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - e_reflow_resize_children(item); - e_canvas_item_request_reflow(item); - } - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - gnome_canvas_item_ungrab (item, button->time); - return TRUE; - } - break; - case GDK_MOTION_NOTIFY: - if (e_reflow->column_drag) { - double old_width = e_reflow->temp_column_width; - GdkEventMotion *motion = (GdkEventMotion *) event; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - e_reflow->temp_column_width = e_reflow->column_width + - (motion->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value)); - if (e_reflow->temp_column_width < 50) - e_reflow->temp_column_width = 50; - if (old_width != e_reflow->temp_column_width) { - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - } - return TRUE; - } else { - GdkEventMotion *motion = (GdkEventMotion *) event; - double n_x, max_x; - - n_x = motion->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - - max_x = E_REFLOW_BORDER_WIDTH; - max_x += (e_reflow->column_width + E_REFLOW_FULL_GUTTER) * e_reflow->column_count; - - if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > motion->x) { - if ( e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor); - e_reflow->default_cursor_shown = FALSE; - } - } else - if ( ! e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor); - e_reflow->default_cursor_shown = TRUE; - } - - } - break; - case GDK_ENTER_NOTIFY: - if (!e_reflow->column_drag) { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x, max_x; - n_x = crossing->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - - max_x = E_REFLOW_BORDER_WIDTH; - max_x += (e_reflow->column_width + E_REFLOW_FULL_GUTTER) * e_reflow->column_count; - if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > crossing->x) { - if ( e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor); - e_reflow->default_cursor_shown = FALSE; - } - } - } - break; - case GDK_LEAVE_NOTIFY: - if (!e_reflow->column_drag) { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x; - n_x = crossing->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) { - if ( ! e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor); - e_reflow->default_cursor_shown = TRUE; - } - } - } - break; - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -static void -e_reflow_real_add_item(EReflow *e_reflow, GnomeCanvasItem *item, gint *position) -{ - e_reflow->items = g_list_append(e_reflow->items, item); - gtk_object_ref(GTK_OBJECT(item)); - if (GTK_OBJECT_FLAGS (e_reflow) & GNOME_CANVAS_ITEM_REALIZED) { - gnome_canvas_item_set(item, - "width", (double) e_reflow->column_width, - NULL); - e_reflow_post_add_item(e_reflow, item); - e_canvas_item_request_reflow(item); - } - if (position) - *position = g_list_index(e_reflow->items, item); -} - -static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) -{ - int x_rect, y_rect, width_rect, height_rect; - gdouble running_width; - EReflow *e_reflow = E_REFLOW(item); - int i; - double column_width; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw) - GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height); - column_width = e_reflow->column_width; - running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - x_rect = running_width; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - /* Compute first column to draw. */ - i = x; - i /= column_width + E_REFLOW_FULL_GUTTER; - running_width += i * (column_width + E_REFLOW_FULL_GUTTER); - - for ( ; i < e_reflow->column_count; i++) { - if ( running_width > x + width ) - break; - x_rect = running_width; - gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style, - drawable, - GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - NULL, - GTK_WIDGET(item->canvas), - "reflow", - x_rect - x, - y_rect - y, - width_rect, - height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - if (e_reflow->column_drag) { - int start_line = e_reflow_pick_line(e_reflow, - gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value); - i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - i += start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - x_rect = running_width; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - /* Compute first column to draw. */ - i /= column_width + E_REFLOW_FULL_GUTTER; - running_width += i * (column_width + E_REFLOW_FULL_GUTTER); - - for ( ; i < e_reflow->column_count; i++) { - if ( running_width > x + width ) - break; - x_rect = running_width; - gdk_draw_rectangle(drawable, - GTK_WIDGET(item->canvas)->style->fg_gc[GTK_STATE_NORMAL], - TRUE, - x_rect - x, - y_rect - y, - width_rect - 1, - height_rect - 1); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } -} - -static void -e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags) -{ - EReflow *e_reflow; - double x0, x1, y0, y1; - - e_reflow = E_REFLOW (item); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->update) - GNOME_CANVAS_ITEM_CLASS(parent_class)->update (item, affine, clip_path, flags); - - x0 = item->x1; - y0 = item->y1; - x1 = item->x2; - y1 = item->y2; - if ( x1 < x0 + e_reflow->width ) - x1 = x0 + e_reflow->width; - if ( y1 < y0 + e_reflow->height ) - y1 = y0 + e_reflow->height; - item->x2 = x1; - item->y2 = y1; - - if (e_reflow->need_height_update) { - x0 = item->x1; - y0 = item->y1; - x1 = item->x2; - y1 = item->y2; - if ( x0 > 0 ) - x0 = 0; - if ( y0 > 0 ) - y0 = 0; - if ( x1 < E_REFLOW(item)->width ) - x1 = E_REFLOW(item)->width; - if ( x1 < E_REFLOW(item)->height ) - x1 = E_REFLOW(item)->height; - - gnome_canvas_request_redraw(item->canvas, x0, y0, x1, y1); - e_reflow->need_height_update = FALSE; - } else if (e_reflow->need_column_resize) { - int x_rect, y_rect, width_rect, height_rect; - int start_line = e_reflow_pick_line(e_reflow, - gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value); - gdouble running_width; - int i; - double column_width; - - if ( e_reflow->previous_temp_column_width != -1 ) { - running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->previous_temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - for ( i = 0; i < e_reflow->column_count; i++) { - x_rect = running_width; - gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } - - if ( e_reflow->temp_column_width != -1 ) { - running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - for ( i = 0; i < e_reflow->column_count; i++) { - x_rect = running_width; - gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } - - e_reflow->previous_temp_column_width = e_reflow->temp_column_width; - e_reflow->need_column_resize = FALSE; - } -} - -static void -e_reflow_resize_children (GnomeCanvasItem *item) -{ - GList *list; - EReflow *e_reflow; - - e_reflow = E_REFLOW (item); - for ( list = e_reflow->items; list; list = list->next ) { - GnomeCanvasItem *child = GNOME_CANVAS_ITEM(list->data); - gnome_canvas_item_set(child, - "width", (double) e_reflow->column_width, - NULL); - } -} - -static double -e_reflow_point (GnomeCanvasItem *item, - double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - double distance = 1; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->point) - distance = GNOME_CANVAS_ITEM_CLASS(parent_class)->point (item, x, y, cx, cy, actual_item); - if (*actual_item) - return 0; - - *actual_item = item; - return 0; -#if 0 - if (y >= E_REFLOW_BORDER_WIDTH && y <= e_reflow->height - E_REFLOW_BORDER_WIDTH) { - float n_x; - n_x = x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x, (e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if (n_x < E_REFLOW_FULL_GUTTER) { - *actual_item = item; - return 0; - } - } - return distance; -#endif -} - -static void -_reflow( EReflow *e_reflow ) -{ - gdouble running_height; - GList *list; - double item_height; - - if (e_reflow->columns) { - g_list_free (e_reflow->columns); - e_reflow->columns = NULL; - } - - e_reflow->column_count = 0; - - if (e_reflow->items == NULL) { - e_reflow->columns = NULL; - e_reflow->column_count = 0; - return; - } - - list = e_reflow->items; - - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH; - e_reflow->columns = g_list_append (e_reflow->columns, list); - e_reflow->column_count = 1; - - list = g_list_next(list); - - for ( ; list; list = g_list_next(list)) { - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - if (running_height + item_height + E_REFLOW_BORDER_WIDTH > e_reflow->height) { - running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH; - e_reflow->columns = g_list_append (e_reflow->columns, list); - e_reflow->column_count ++; - } else { - running_height += item_height + E_REFLOW_BORDER_WIDTH; - } - } -} - -static void -set_empty(EReflow *e_reflow) -{ - if (e_reflow->items == NULL) { - if (e_reflow->empty_text) { - if (e_reflow->empty_message) { - gnome_canvas_item_set(e_reflow->empty_text, - "width", e_reflow->minimum_width, - "text", e_reflow->empty_message, - NULL); - e_canvas_item_move_absolute(e_reflow->empty_text, - e_reflow->minimum_width / 2, - 0); - } else { - gtk_object_destroy(GTK_OBJECT(e_reflow->empty_text)); - e_reflow->empty_text = NULL; - } - } else { - if (e_reflow->empty_message) - e_reflow->empty_text = - gnome_canvas_item_new(GNOME_CANVAS_GROUP(e_reflow), - e_text_get_type(), - "anchor", GTK_ANCHOR_N, - "width", e_reflow->minimum_width, - "clip", TRUE, - "use_ellipsis", TRUE, - "font_gdk", GTK_WIDGET(GNOME_CANVAS_ITEM(e_reflow)->canvas)->style->font, - "fill_color", "black", - "justification", GTK_JUSTIFY_CENTER, - "text", e_reflow->empty_message, - "draw_background", FALSE, - NULL); - e_canvas_item_move_absolute(e_reflow->empty_text, - e_reflow->minimum_width / 2, - 0); - } - } else { - if (e_reflow->empty_text) { - gtk_object_destroy(GTK_OBJECT(e_reflow->empty_text)); - e_reflow->empty_text = NULL; - } - } -} - -static void -e_reflow_reflow( GnomeCanvasItem *item, int flags ) -{ - EReflow *e_reflow = E_REFLOW(item); - if ( GTK_OBJECT_FLAGS( e_reflow ) & GNOME_CANVAS_ITEM_REALIZED ) { - - gdouble old_width; - gdouble running_width; - - _reflow (e_reflow); - - old_width = e_reflow->width; - - running_width = E_REFLOW_BORDER_WIDTH; - - if (e_reflow->items == NULL) { - } else { - GList *list; - GList *next_column; - gdouble item_height; - gdouble running_height; - - running_height = E_REFLOW_BORDER_WIDTH; - - list = e_reflow->items; - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) running_width, - (double) running_height); - running_height += item_height + E_REFLOW_BORDER_WIDTH; - next_column = g_list_next(e_reflow->columns); - list = g_list_next(list); - - for( ; list; list = g_list_next(list)) { - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - - if (next_column && (next_column->data == list)) { - next_column = g_list_next (next_column); - running_height = E_REFLOW_BORDER_WIDTH; - running_width += e_reflow->column_width + E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH; - } - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) running_width, - (double) running_height); - - running_height += item_height + E_REFLOW_BORDER_WIDTH; - } - - } - e_reflow->width = running_width + e_reflow->column_width + E_REFLOW_BORDER_WIDTH; - if ( e_reflow->width < e_reflow->minimum_width ) - e_reflow->width = e_reflow->minimum_width; - if (old_width != e_reflow->width) - e_canvas_item_request_parent_reflow(item); - } -} - -void -e_reflow_add_item(EReflow *e_reflow, GnomeCanvasItem *item, gint *position) -{ - if (E_REFLOW_CLASS(GTK_OBJECT(e_reflow)->klass)->add_item) - (E_REFLOW_CLASS(GTK_OBJECT(e_reflow)->klass)->add_item) (e_reflow, item, position); -} - -void -e_reflow_post_add_item(EReflow *e_reflow, GnomeCanvasItem *item) -{ - set_empty(e_reflow); -} diff --git a/widgets/misc/e-reflow.h b/widgets/misc/e-reflow.h deleted file mode 100644 index b4c1dcb372..0000000000 --- a/widgets/misc/e-reflow.h +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-reflow.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_REFLOW_H__ -#define __E_REFLOW_H__ - -#include <gnome.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EReflow - A canvas item container. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * minimum_width double RW minimum width of the reflow. width >= minimum_width - * width double R width of the reflow - * height double RW height of the reflow - */ - -#define E_REFLOW_TYPE (e_reflow_get_type ()) -#define E_REFLOW(obj) (GTK_CHECK_CAST ((obj), E_REFLOW_TYPE, EReflow)) -#define E_REFLOW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_REFLOW_TYPE, EReflowClass)) -#define E_IS_REFLOW(obj) (GTK_CHECK_TYPE ((obj), E_REFLOW_TYPE)) -#define E_IS_REFLOW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_REFLOW_TYPE)) - - -typedef struct _EReflow EReflow; -typedef struct _EReflowClass EReflowClass; - -struct _EReflow -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - GList *items; /* Of type GnomeCanvasItem */ - GList *columns; /* Of type GList of type GnomeCanvasItem (points into items) */ - gint column_count; /* Number of columnns */ - - GnomeCanvasItem *empty_text; - gchar *empty_message; - - double minimum_width; - double width; - double height; - - double column_width; - - int idle; - - /* These are all for when the column is being dragged. */ - gboolean column_drag; - gdouble start_x; - gint which_column_dragged; - double temp_column_width; - double previous_temp_column_width; - - guint need_height_update : 1; - guint need_column_resize : 1; - - guint default_cursor_shown : 1; - GdkCursor *arrow_cursor; - GdkCursor *default_cursor; -}; - -struct _EReflowClass -{ - GnomeCanvasGroupClass parent_class; - - /* Virtual methods. */ - void (* add_item) (EReflow *reflow, GnomeCanvasItem *item, gint *position); -}; - -/* - * To be added to a reflow, an item must have the argument "width" as - * a Read/Write argument and "height" as a Read Only argument. It - * should also do an ECanvas parent reflow request if its size - * changes. - */ -void e_reflow_add_item (EReflow *e_reflow, - GnomeCanvasItem *item, - gint *position); -GtkType e_reflow_get_type (void); - -/* Internal usage only: */ -void e_reflow_post_add_item (EReflow *e_reflow, - GnomeCanvasItem *item); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_REFLOW_H__ */ diff --git a/widgets/misc/e-unicode.c b/widgets/misc/e-unicode.c deleted file mode 100644 index 37a56471c9..0000000000 --- a/widgets/misc/e-unicode.c +++ /dev/null @@ -1,2957 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2000 Helix Code, Inc. - * - * Authors: Lauris Kaplinski <lauris@helixcode.com> - * - * TODO: Break simple ligatures in e_utf8_strstrcasedecomp - * - */ - -#include <config.h> -#include <ctype.h> -#include <string.h> -#include <stdio.h> -#include <unicode.h> -#include <iconv.h> -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <gdk/gdkkeysyms.h> -#include "e-unicode.h" -#include "e-font.h" - -#define FONT_TESTING -#define MAX_DECOMP 8 - -static gint e_canonical_decomposition (unicode_char_t ch, unicode_char_t * buf); -static unicode_char_t e_stripped_char (unicode_char_t ch); - -/* - * This my favourite - * - * strstr doing case insensitive, decomposing search - * - * Lauris - */ - -const gchar * -e_utf8_strstrcasedecomp (const gchar *haystack, const gchar *needle) -{ - unicode_char_t *nuni; - unicode_char_t unival; - gint nlen; - const guchar *o, *p; - - if (haystack == NULL) return NULL; - if (needle == NULL) return NULL; - if (strlen (needle) == 0) return haystack; - if (strlen (haystack) == 0) return NULL; - - nuni = alloca (sizeof (unicode_char_t) * strlen (needle)); - - nlen = 0; - for (p = unicode_get_utf8 (needle, &unival); p && unival; p = unicode_get_utf8 (p, &unival)) { - gint sc; - sc = e_stripped_char (unival); - if (sc) { - nuni[nlen++] = sc; - } - } - /* NULL means there was illegal utf-8 sequence */ - if (!p) return NULL; - /* If everything is correct, we have decomposed, lowercase, stripped needle */ - if (nlen < 1) return haystack; - - o = haystack; - for (p = unicode_get_utf8 (o, &unival); p && unival; p = unicode_get_utf8 (p, &unival)) { - gint sc; - sc = e_stripped_char (unival); - if (sc) { - /* We have valid stripped char */ - if (sc == nuni[0]) { - const gchar *q = p; - gint npos = 1; - while (npos < nlen) { - q = unicode_get_utf8 (q, &unival); - if (!q || !unival) return NULL; - sc = e_stripped_char (unival); - if ((!sc) || (sc != nuni[npos])) break; - npos++; - } - if (npos == nlen) { - return p; - } - } - } - o = p; - } - - return NULL; -} - -const gchar * -e_utf8_strstrcase (const gchar *haystack, const gchar *needle) -{ - unicode_char_t *nuni; - unicode_char_t unival; - gint nlen; - const guchar *o, *p; - - if (haystack == NULL) return NULL; - if (needle == NULL) return NULL; - if (strlen (needle) == 0) return haystack; - if (strlen (haystack) == 0) return NULL; - - nuni = alloca (sizeof (unicode_char_t) * strlen (needle)); - - nlen = 0; - for (p = unicode_get_utf8 (needle, &unival); p && unival; p = unicode_get_utf8 (p, &unival)) { - nuni[nlen++] = unicode_tolower (unival); - } - /* NULL means there was illegal utf-8 sequence */ - if (!p) return NULL; - - o = haystack; - for (p = unicode_get_utf8 (o, &unival); p && unival; p = unicode_get_utf8 (p, &unival)) { - gint sc; - sc = unicode_tolower (unival); - /* We have valid stripped char */ - if (sc == nuni[0]) { - const gchar *q = p; - gint npos = 1; - while (npos < nlen) { - q = unicode_get_utf8 (q, &unival); - if (!q || !unival) return NULL; - sc = unicode_tolower (unival); - if (sc != nuni[npos]) break; - npos++; - } - if (npos == nlen) { - return p; - } - } - o = p; - } - - return NULL; -} - -#if 0 -const gchar * -e_utf8_strstrcase (const gchar *haystack, const gchar *needle) -{ - gchar *p; - unicode_char_t *huni, *nuni; - unicode_char_t unival; - gint hlen, nlen, hp, np; - - if (haystack == NULL) return NULL; - if (needle == NULL) return NULL; - if (strlen (needle) == 0) return haystack; - - huni = alloca (sizeof (unicode_char_t) * strlen (haystack)); - - for (hlen = 0, p = unicode_get_utf8 (haystack, &unival); p && unival; hlen++, p = unicode_get_utf8 (p, &unival)) { - huni[hlen] = unicode_tolower (unival); - } - - if (!p) return NULL; - if (hlen == 0) return NULL; - - nuni = alloca (sizeof (unicode_char_t) * strlen (needle)); - - for (nlen = 0, p = unicode_get_utf8 (needle, &unival); p && unival; nlen++, p = unicode_get_utf8 (p, &unival)) { - nuni[nlen] = unicode_tolower (unival); - } - - if (!p) return NULL; - if (nlen == 0) return NULL; - - if (hlen < nlen) return NULL; - - for (hp = 0; hp <= hlen - nlen; hp++) { - for (np = 0; np < nlen; np++) { - if (huni[hp + np] != nuni[np]) break; - } - if (np == nlen) return haystack + unicode_offset_to_index (haystack, hp); - } - - return NULL; -} -#endif - -gchar * -e_utf8_from_gtk_event_key (GtkWidget *widget, guint keyval, const gchar *string) -{ - gint unival; - gchar *utf; - gint unilen; - - if (keyval == GDK_VoidSymbol) { - utf = e_utf8_from_gtk_string (widget, string); - } else { - unival = gdk_keyval_to_unicode (keyval); - - if (unival < ' ') return NULL; - - utf = g_new (gchar, 7); - - unilen = e_unichar_to_utf8 (unival, utf); - - utf[unilen] = '\0'; - } - - return utf; -} - -gchar * -e_utf8_from_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes) -{ - iconv_t ic; - char *new, *ob; - gchar * ib; - size_t ibl, obl; - - g_return_val_if_fail (widget != NULL, NULL); - g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); - - if (!string) return NULL; - - g_return_val_if_fail (widget, NULL); - - ic = e_iconv_from_gdk_font (widget->style->font); - if (ic == (iconv_t) -1) { - XFontStruct *xfs; - /* If iconv is missing we assume either iso-10646 or iso-8859-1 */ - xfs = GDK_FONT_XFONT (widget->style->font); - if (widget->style->font->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0))) { - gint i; - const guchar *ib; - guchar * ob, * new; - /* iso-10646 */ - ib = string; - new = ob = g_new (unsigned char, bytes * 6 + 1); - for (i = 0; i < (bytes - 1); i += 2) { - ob += e_unichar_to_utf8 (ib[i] * 256 + ib[i + 1], ob); - } - *ob = '\0'; - return new; - } else { - gint i; - /* iso-8859-1 */ - ib = (char *) string; - new = ob = g_new (unsigned char, bytes * 2 + 1); - for (i = 0; i < (bytes); i ++) { - ob += e_unichar_to_utf8 (ib[i], ob); - } - *ob = '\0'; - return new; - } - } - - ib = (char *) string; - ibl = bytes; - new = ob = g_new (gchar, ibl * 6 + 1); - obl = ibl * 6 + 1; - - while (ibl > 0) { - iconv (ic, &ib, &ibl, &ob, &obl); - if (ibl > 0) { - gint len; - if ((*ib & 0x80) == 0x00) len = 1; - else if ((*ib &0xe0) == 0xc0) len = 2; - else if ((*ib &0xf0) == 0xe0) len = 3; - else if ((*ib &0xf8) == 0xf0) len = 4; - else { - g_warning ("Invalid UTF-8 sequence"); - break; - } - ib += len; - ibl = bytes - (ib - string); - if (ibl > bytes) ibl = 0; - *ob++ = '_'; - obl--; - } - } - - *ob = '\0'; - - return new; -} - -gchar * -e_utf8_from_gtk_string (GtkWidget *widget, const gchar *string) -{ - return e_utf8_from_gtk_string_sized (widget, string, strlen (string)); -} - -gchar * -e_utf8_to_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes) -{ - iconv_t ic; - char *new, *ob; - gchar * ib; - size_t ibl, obl; - - if (!string) return NULL; - - g_return_val_if_fail (widget, NULL); - - ic = e_iconv_to_gdk_font (widget->style->font); - if (ic == (iconv_t) -1) { - XFontStruct *xfs; - gboolean twobyte; - gint len; - const gchar *u; - unicode_char_t uc; - /* If iconv is missing we assume either iso-10646 or iso-8859-1 */ - xfs = GDK_FONT_XFONT (widget->style->font); - twobyte = (widget->style->font->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0))); - - new = g_new (unsigned char, bytes * 4 + 1); - u = string; - len = 0; - - while ((u) && (u - string < bytes)) { - u = unicode_get_utf8 (u, &uc); - if (twobyte) { - new[len++] = (uc & 0xff00) >> 8; - } - new[len++] = uc & 0xff; - } - new[len] = '\0'; - return new; - } - - ib = (char *) string; - ibl = bytes; - new = ob = g_new (gchar, ibl * 4 + 1); - obl = ibl * 4 + 1; - - while (ibl > 0) { - iconv (ic, &ib, &ibl, &ob, &obl); - if (ibl > 0) { - gint len; - if ((*ib & 0x80) == 0x00) len = 1; - else if ((*ib &0xe0) == 0xc0) len = 2; - else if ((*ib &0xf0) == 0xe0) len = 3; - else if ((*ib &0xf8) == 0xf0) len = 4; - else { - g_warning ("Invalid UTF-8 sequence"); - break; - } - ib += len; - ibl = bytes - (ib - string); - if (ibl > bytes) ibl = 0; - *ob++ = '_'; - obl--; - } - } - - *ob = '\0'; - - return new; -} - -gchar * -e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string) -{ - return e_utf8_to_gtk_string_sized (widget, string, strlen (string)); -} - -gchar * -e_utf8_from_locale_string_sized (const gchar *string, gint bytes) -{ - iconv_t ic; - char *new, *ob; - gchar * ib; - size_t ibl, obl; - - if (!string) return NULL; - - ic = e_iconv_from_locale (); - if (ic == (iconv_t) -1) { - gint i; - /* iso-8859-1 */ - ib = (char *) string; - new = ob = g_new (unsigned char, bytes * 2 + 1); - for (i = 0; i < (bytes); i ++) { - ob += e_unichar_to_utf8 (ib[i], ob); - } - *ob = '\0'; - return new; - } - - ib = (char *) string; - ibl = bytes; - new = ob = g_new (gchar, ibl * 6 + 1); - obl = ibl * 6 + 1; - - while (ibl > 0) { - iconv (ic, &ib, &ibl, &ob, &obl); - if (ibl > 0) { - gint len; - if ((*ib & 0x80) == 0x00) len = 1; - else if ((*ib &0xe0) == 0xc0) len = 2; - else if ((*ib &0xf0) == 0xe0) len = 3; - else if ((*ib &0xf8) == 0xf0) len = 4; - else { - g_warning ("Invalid UTF-8 sequence"); - break; - } - ib += len; - ibl = bytes - (ib - string); - if (ibl > bytes) ibl = 0; - *ob++ = '_'; - obl--; - } - } - - *ob = '\0'; - - return new; -} - -gchar * -e_utf8_from_locale_string (const gchar *string) -{ - return e_utf8_from_locale_string_sized (string, strlen (string)); -} - -gchar * -e_utf8_to_locale_string_sized (const gchar *string, gint bytes) -{ - iconv_t ic; - char *new, *ob; - gchar * ib; - size_t ibl, obl; - - if (!string) return NULL; - - ic = e_iconv_to_locale (); - if (ic == (iconv_t) -1) { - gint len; - const gchar *u; - unicode_char_t uc; - - new = g_new (unsigned char, bytes * 4 + 1); - u = string; - len = 0; - - while ((u) && (u - string < bytes)) { - u = unicode_get_utf8 (u, &uc); - new[len++] = uc & 0xff; - } - new[len] = '\0'; - return new; - } - - ib = (char *) string; - ibl = bytes; - new = ob = g_new (gchar, ibl * 4 + 1); - obl = ibl * 4 + 1; - - while (ibl > 0) { - iconv (ic, &ib, &ibl, &ob, &obl); - if (ibl > 0) { - gint len; - if ((*ib & 0x80) == 0x00) len = 1; - else if ((*ib &0xe0) == 0xc0) len = 2; - else if ((*ib &0xf0) == 0xe0) len = 3; - else if ((*ib &0xf8) == 0xf0) len = 4; - else { - g_warning ("Invalid UTF-8 sequence"); - break; - } - ib += len; - ibl = bytes - (ib - string); - if (ibl > bytes) ibl = 0; - *ob++ = '_'; - obl--; - } - } - - *ob = '\0'; - - return new; -} - -gchar * -e_utf8_to_locale_string (const gchar *string) -{ - return e_utf8_to_locale_string_sized (string, strlen (string)); -} - -gchar * -e_utf8_gtk_entry_get_text (GtkEntry *entry) -{ - gchar *s, *u; - - s = gtk_entry_get_text (entry); - if (!s) return NULL; - u = e_utf8_from_gtk_string ((GtkWidget *) entry, s); - return u; -} - -gchar * -e_utf8_gtk_editable_get_text (GtkEditable *editable) -{ - return e_utf8_gtk_editable_get_chars(editable, 0, -1); -} - -gchar * -e_utf8_gtk_editable_get_chars (GtkEditable *editable, gint start, gint end) -{ - gchar *s, *u; - - s = gtk_editable_get_chars (editable, start, end); - if (!s) return NULL; - u = e_utf8_from_gtk_string ((GtkWidget *) editable, s); - g_free (s); - return u; -} - -void -e_utf8_gtk_editable_insert_text (GtkEditable *editable, const gchar *text, gint length, gint *position) -{ - gchar *s; - - s = e_utf8_to_gtk_string_sized ((GtkWidget *) editable, text, length); - - gtk_editable_insert_text (editable, s, length, position); - - g_free (s); -} - -void -e_utf8_gtk_editable_set_text (GtkEditable *editable, const gchar *text) -{ - int position; - gtk_editable_delete_text(editable, 0, -1); - if (text) - e_utf8_gtk_editable_insert_text(editable, text, strlen(text), &position); -} - -void -e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text) -{ - if (!text) - gtk_entry_set_text(entry, ""); - else { - gchar *s; - - s = e_utf8_to_gtk_string ((GtkWidget *) entry, text); - gtk_entry_set_text (entry, s); - - if (s) g_free (s); - } -} - -GtkWidget * -e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu, const gchar *label) -{ - GtkWidget *w; - gchar *s; - - if (!label) return NULL; - - s = e_utf8_to_gtk_string ((GtkWidget *) menu, label); - w = gtk_menu_item_new_with_label (s); - - if (s) g_free (s); - - return w; -} - -void -e_utf8_gtk_clist_set_text (GtkCList *clist, gint row, gint col, const gchar *text) -{ - gchar *s; - - if (!text) return; - - s = e_utf8_to_gtk_string ((GtkWidget *) clist, text); - gtk_clist_set_text (clist, row, col, s); - - if (s) g_free (s); -} - -gint -e_utf8_gtk_clist_append (GtkCList *clist, gchar *text[]) -{ - gint row, i; - gchar **v; - - if (!text) return 0; - - v = g_new (gchar *, clist->columns); - for (i = 0; i < clist->columns; i++) - v[i] = e_utf8_to_gtk_string ((GtkWidget *) clist, text[i]); - - row = gtk_clist_append (clist, v); - - for (i = 0; i < clist->columns; i++) - if (v[i]) g_free (v[i]); - - return row; -} - -/* - * Translate \U+XXXX\ sequences to utf8 chars - */ - -gchar * -e_utf8_xml1_decode (const gchar *text) -{ - const guchar *c; - guchar *u, *d; - int len, s; - - g_return_val_if_fail (text != NULL, NULL); - - len = strlen (text)+1; - /* len * 2 is absolute maximum */ - u = d = g_malloc (len * 2); - - c = text; - s = 0; - while (s < len) { - if ((s <= (len - 8)) && - (c[s ] == '\\') && - (c[s + 1] == 'U' ) && - (c[s + 2] == '+' ) && - isxdigit (c[s + 3]) && - isxdigit (c[s + 4]) && - isxdigit (c[s + 5]) && - isxdigit (c[s + 6]) && - (c[s + 7] == '\\')) { - /* Valid \U+XXXX\ sequence */ - unsigned int unival; - unival = strtol (c + s + 3, NULL, 16); - d += e_unichar_to_utf8 (unival, d); - s += 8; - } else if (c[s] > 127) { - /* fixme: We assume iso-8859-1 currently */ - d += e_unichar_to_utf8 (c[s], d); - s += 1; - } else { - *d++ = c[s++]; - } - } - *d++ = '\0'; - u = g_realloc (u, (d - u)); - - return u; -} - -gchar * -e_utf8_xml1_encode (const gchar *text) -{ - guchar *u, *d, *c; - int unival; - int len; - - g_return_val_if_fail (text != NULL, NULL); - - len = 0; - for (u = unicode_get_utf8 (text, &unival); u && unival; u = unicode_get_utf8 (u, &unival)) { - if ((unival >= 0x80) || (unival == '\\')) { - len += 8; - } else { - len += 1; - } - } - d = c = g_new (guchar, len + 1); - - for (u = unicode_get_utf8 (text, &unival); u && unival; u = unicode_get_utf8 (u, &unival)) { - if ((unival >= 0x80) || (unival == '\\')) { - *c++ = '\\'; - *c++ = 'U'; - *c++ = '+'; - c += sprintf (c, "%04x", unival); - *c++ = '\\'; - } else { - *c++ = unival; - } - } - *c = '\0'; - - return d; -} - -/** - * e_unichar_to_utf8: - * @c: a ISO10646 character code - * @outbuf: output buffer, must have at least 6 bytes of space. - * If %NULL, the length will be computed and returned - * and nothing will be written to @out. - * - * Convert a single character to utf8 - * - * Return value: number of bytes written - **/ - -gint -e_unichar_to_utf8 (gint c, gchar *outbuf) -{ - size_t len = 0; - int first; - int i; - - if (c < 0x80) - { - first = 0; - len = 1; - } - else if (c < 0x800) - { - first = 0xc0; - len = 2; - } - else if (c < 0x10000) - { - first = 0xe0; - len = 3; - } - else if (c < 0x200000) - { - first = 0xf0; - len = 4; - } - else if (c < 0x4000000) - { - first = 0xf8; - len = 5; - } - else - { - first = 0xfc; - len = 6; - } - - if (outbuf) - { - for (i = len - 1; i > 0; --i) - { - outbuf[i] = (c & 0x3f) | 0x80; - c >>= 6; - } - outbuf[0] = c | first; - } - - return len; -} - -/* - * The following is borrowed from Gtk+ 1.3 - */ - -/* Thanks to Markus G. Kuhn <mkuhn@acm.org> for the ksysym<->Unicode - * mapping functions, from the xterm sources. - */ - -/* These tables could be compressed by contiguous ranges, but the benefit of doing so - * is smallish. It would save about ~1000 bytes total. - */ - -static struct { - unsigned short keysym; - unsigned short ucs; -} gdk_keysym_to_unicode_tab[] = { - { 0x01a1, 0x0104 }, /* Aogonek Ą LATIN CAPITAL LETTER A WITH OGONEK */ - { 0x01a2, 0x02d8 }, /* breve ˘ BREVE */ - { 0x01a3, 0x0141 }, /* Lstroke Ł LATIN CAPITAL LETTER L WITH STROKE */ - { 0x01a5, 0x013d }, /* Lcaron Ľ LATIN CAPITAL LETTER L WITH CARON */ - { 0x01a6, 0x015a }, /* Sacute Ś LATIN CAPITAL LETTER S WITH ACUTE */ - { 0x01a9, 0x0160 }, /* Scaron Š LATIN CAPITAL LETTER S WITH CARON */ - { 0x01aa, 0x015e }, /* Scedilla Ş LATIN CAPITAL LETTER S WITH CEDILLA */ - { 0x01ab, 0x0164 }, /* Tcaron Ť LATIN CAPITAL LETTER T WITH CARON */ - { 0x01ac, 0x0179 }, /* Zacute Ź LATIN CAPITAL LETTER Z WITH ACUTE */ - { 0x01ae, 0x017d }, /* Zcaron Ž LATIN CAPITAL LETTER Z WITH CARON */ - { 0x01af, 0x017b }, /* Zabovedot Ż LATIN CAPITAL LETTER Z WITH DOT ABOVE */ - { 0x01b1, 0x0105 }, /* aogonek ą LATIN SMALL LETTER A WITH OGONEK */ - { 0x01b2, 0x02db }, /* ogonek ˛ OGONEK */ - { 0x01b3, 0x0142 }, /* lstroke ł LATIN SMALL LETTER L WITH STROKE */ - { 0x01b5, 0x013e }, /* lcaron ľ LATIN SMALL LETTER L WITH CARON */ - { 0x01b6, 0x015b }, /* sacute ś LATIN SMALL LETTER S WITH ACUTE */ - { 0x01b7, 0x02c7 }, /* caron ˇ CARON */ - { 0x01b9, 0x0161 }, /* scaron š LATIN SMALL LETTER S WITH CARON */ - { 0x01ba, 0x015f }, /* scedilla ş LATIN SMALL LETTER S WITH CEDILLA */ - { 0x01bb, 0x0165 }, /* tcaron ť LATIN SMALL LETTER T WITH CARON */ - { 0x01bc, 0x017a }, /* zacute ź LATIN SMALL LETTER Z WITH ACUTE */ - { 0x01bd, 0x02dd }, /* doubleacute ˝ DOUBLE ACUTE ACCENT */ - { 0x01be, 0x017e }, /* zcaron ž LATIN SMALL LETTER Z WITH CARON */ - { 0x01bf, 0x017c }, /* zabovedot ż LATIN SMALL LETTER Z WITH DOT ABOVE */ - { 0x01c0, 0x0154 }, /* Racute Ŕ LATIN CAPITAL LETTER R WITH ACUTE */ - { 0x01c3, 0x0102 }, /* Abreve Ă LATIN CAPITAL LETTER A WITH BREVE */ - { 0x01c5, 0x0139 }, /* Lacute Ĺ LATIN CAPITAL LETTER L WITH ACUTE */ - { 0x01c6, 0x0106 }, /* Cacute Ć LATIN CAPITAL LETTER C WITH ACUTE */ - { 0x01c8, 0x010c }, /* Ccaron Č LATIN CAPITAL LETTER C WITH CARON */ - { 0x01ca, 0x0118 }, /* Eogonek Ę LATIN CAPITAL LETTER E WITH OGONEK */ - { 0x01cc, 0x011a }, /* Ecaron Ě LATIN CAPITAL LETTER E WITH CARON */ - { 0x01cf, 0x010e }, /* Dcaron Ď LATIN CAPITAL LETTER D WITH CARON */ - { 0x01d0, 0x0110 }, /* Dstroke Đ LATIN CAPITAL LETTER D WITH STROKE */ - { 0x01d1, 0x0143 }, /* Nacute Ń LATIN CAPITAL LETTER N WITH ACUTE */ - { 0x01d2, 0x0147 }, /* Ncaron Ň LATIN CAPITAL LETTER N WITH CARON */ - { 0x01d5, 0x0150 }, /* Odoubleacute Ő LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */ - { 0x01d8, 0x0158 }, /* Rcaron Ř LATIN CAPITAL LETTER R WITH CARON */ - { 0x01d9, 0x016e }, /* Uring Ů LATIN CAPITAL LETTER U WITH RING ABOVE */ - { 0x01db, 0x0170 }, /* Udoubleacute Ű LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */ - { 0x01de, 0x0162 }, /* Tcedilla Ţ LATIN CAPITAL LETTER T WITH CEDILLA */ - { 0x01e0, 0x0155 }, /* racute ŕ LATIN SMALL LETTER R WITH ACUTE */ - { 0x01e3, 0x0103 }, /* abreve ă LATIN SMALL LETTER A WITH BREVE */ - { 0x01e5, 0x013a }, /* lacute ĺ LATIN SMALL LETTER L WITH ACUTE */ - { 0x01e6, 0x0107 }, /* cacute ć LATIN SMALL LETTER C WITH ACUTE */ - { 0x01e8, 0x010d }, /* ccaron č LATIN SMALL LETTER C WITH CARON */ - { 0x01ea, 0x0119 }, /* eogonek ę LATIN SMALL LETTER E WITH OGONEK */ - { 0x01ec, 0x011b }, /* ecaron ě LATIN SMALL LETTER E WITH CARON */ - { 0x01ef, 0x010f }, /* dcaron ď LATIN SMALL LETTER D WITH CARON */ - { 0x01f0, 0x0111 }, /* dstroke đ LATIN SMALL LETTER D WITH STROKE */ - { 0x01f1, 0x0144 }, /* nacute ń LATIN SMALL LETTER N WITH ACUTE */ - { 0x01f2, 0x0148 }, /* ncaron ň LATIN SMALL LETTER N WITH CARON */ - { 0x01f5, 0x0151 }, /* odoubleacute ő LATIN SMALL LETTER O WITH DOUBLE ACUTE */ - { 0x01f8, 0x0159 }, /* rcaron ř LATIN SMALL LETTER R WITH CARON */ - { 0x01f9, 0x016f }, /* uring ů LATIN SMALL LETTER U WITH RING ABOVE */ - { 0x01fb, 0x0171 }, /* udoubleacute ű LATIN SMALL LETTER U WITH DOUBLE ACUTE */ - { 0x01fe, 0x0163 }, /* tcedilla ţ LATIN SMALL LETTER T WITH CEDILLA */ - { 0x01ff, 0x02d9 }, /* abovedot ˙ DOT ABOVE */ - { 0x02a1, 0x0126 }, /* Hstroke Ħ LATIN CAPITAL LETTER H WITH STROKE */ - { 0x02a6, 0x0124 }, /* Hcircumflex Ĥ LATIN CAPITAL LETTER H WITH CIRCUMFLEX */ - { 0x02a9, 0x0130 }, /* Iabovedot İ LATIN CAPITAL LETTER I WITH DOT ABOVE */ - { 0x02ab, 0x011e }, /* Gbreve Ğ LATIN CAPITAL LETTER G WITH BREVE */ - { 0x02ac, 0x0134 }, /* Jcircumflex Ĵ LATIN CAPITAL LETTER J WITH CIRCUMFLEX */ - { 0x02b1, 0x0127 }, /* hstroke ħ LATIN SMALL LETTER H WITH STROKE */ - { 0x02b6, 0x0125 }, /* hcircumflex ĥ LATIN SMALL LETTER H WITH CIRCUMFLEX */ - { 0x02b9, 0x0131 }, /* idotless ı LATIN SMALL LETTER DOTLESS I */ - { 0x02bb, 0x011f }, /* gbreve ğ LATIN SMALL LETTER G WITH BREVE */ - { 0x02bc, 0x0135 }, /* jcircumflex ĵ LATIN SMALL LETTER J WITH CIRCUMFLEX */ - { 0x02c5, 0x010a }, /* Cabovedot Ċ LATIN CAPITAL LETTER C WITH DOT ABOVE */ - { 0x02c6, 0x0108 }, /* Ccircumflex Ĉ LATIN CAPITAL LETTER C WITH CIRCUMFLEX */ - { 0x02d5, 0x0120 }, /* Gabovedot Ġ LATIN CAPITAL LETTER G WITH DOT ABOVE */ - { 0x02d8, 0x011c }, /* Gcircumflex Ĝ LATIN CAPITAL LETTER G WITH CIRCUMFLEX */ - { 0x02dd, 0x016c }, /* Ubreve Ŭ LATIN CAPITAL LETTER U WITH BREVE */ - { 0x02de, 0x015c }, /* Scircumflex Ŝ LATIN CAPITAL LETTER S WITH CIRCUMFLEX */ - { 0x02e5, 0x010b }, /* cabovedot ċ LATIN SMALL LETTER C WITH DOT ABOVE */ - { 0x02e6, 0x0109 }, /* ccircumflex ĉ LATIN SMALL LETTER C WITH CIRCUMFLEX */ - { 0x02f5, 0x0121 }, /* gabovedot ġ LATIN SMALL LETTER G WITH DOT ABOVE */ - { 0x02f8, 0x011d }, /* gcircumflex ĝ LATIN SMALL LETTER G WITH CIRCUMFLEX */ - { 0x02fd, 0x016d }, /* ubreve ŭ LATIN SMALL LETTER U WITH BREVE */ - { 0x02fe, 0x015d }, /* scircumflex ŝ LATIN SMALL LETTER S WITH CIRCUMFLEX */ - { 0x03a2, 0x0138 }, /* kra ĸ LATIN SMALL LETTER KRA */ - { 0x03a3, 0x0156 }, /* Rcedilla Ŗ LATIN CAPITAL LETTER R WITH CEDILLA */ - { 0x03a5, 0x0128 }, /* Itilde Ĩ LATIN CAPITAL LETTER I WITH TILDE */ - { 0x03a6, 0x013b }, /* Lcedilla Ļ LATIN CAPITAL LETTER L WITH CEDILLA */ - { 0x03aa, 0x0112 }, /* Emacron Ē LATIN CAPITAL LETTER E WITH MACRON */ - { 0x03ab, 0x0122 }, /* Gcedilla Ģ LATIN CAPITAL LETTER G WITH CEDILLA */ - { 0x03ac, 0x0166 }, /* Tslash Ŧ LATIN CAPITAL LETTER T WITH STROKE */ - { 0x03b3, 0x0157 }, /* rcedilla ŗ LATIN SMALL LETTER R WITH CEDILLA */ - { 0x03b5, 0x0129 }, /* itilde ĩ LATIN SMALL LETTER I WITH TILDE */ - { 0x03b6, 0x013c }, /* lcedilla ļ LATIN SMALL LETTER L WITH CEDILLA */ - { 0x03ba, 0x0113 }, /* emacron ē LATIN SMALL LETTER E WITH MACRON */ - { 0x03bb, 0x0123 }, /* gcedilla ģ LATIN SMALL LETTER G WITH CEDILLA */ - { 0x03bc, 0x0167 }, /* tslash ŧ LATIN SMALL LETTER T WITH STROKE */ - { 0x03bd, 0x014a }, /* ENG Ŋ LATIN CAPITAL LETTER ENG */ - { 0x03bf, 0x014b }, /* eng ŋ LATIN SMALL LETTER ENG */ - { 0x03c0, 0x0100 }, /* Amacron Ā LATIN CAPITAL LETTER A WITH MACRON */ - { 0x03c7, 0x012e }, /* Iogonek Į LATIN CAPITAL LETTER I WITH OGONEK */ - { 0x03cc, 0x0116 }, /* Eabovedot Ė LATIN CAPITAL LETTER E WITH DOT ABOVE */ - { 0x03cf, 0x012a }, /* Imacron Ī LATIN CAPITAL LETTER I WITH MACRON */ - { 0x03d1, 0x0145 }, /* Ncedilla Ņ LATIN CAPITAL LETTER N WITH CEDILLA */ - { 0x03d2, 0x014c }, /* Omacron Ō LATIN CAPITAL LETTER O WITH MACRON */ - { 0x03d3, 0x0136 }, /* Kcedilla Ķ LATIN CAPITAL LETTER K WITH CEDILLA */ - { 0x03d9, 0x0172 }, /* Uogonek Ų LATIN CAPITAL LETTER U WITH OGONEK */ - { 0x03dd, 0x0168 }, /* Utilde Ũ LATIN CAPITAL LETTER U WITH TILDE */ - { 0x03de, 0x016a }, /* Umacron Ū LATIN CAPITAL LETTER U WITH MACRON */ - { 0x03e0, 0x0101 }, /* amacron ā LATIN SMALL LETTER A WITH MACRON */ - { 0x03e7, 0x012f }, /* iogonek į LATIN SMALL LETTER I WITH OGONEK */ - { 0x03ec, 0x0117 }, /* eabovedot ė LATIN SMALL LETTER E WITH DOT ABOVE */ - { 0x03ef, 0x012b }, /* imacron ī LATIN SMALL LETTER I WITH MACRON */ - { 0x03f1, 0x0146 }, /* ncedilla ņ LATIN SMALL LETTER N WITH CEDILLA */ - { 0x03f2, 0x014d }, /* omacron ō LATIN SMALL LETTER O WITH MACRON */ - { 0x03f3, 0x0137 }, /* kcedilla ķ LATIN SMALL LETTER K WITH CEDILLA */ - { 0x03f9, 0x0173 }, /* uogonek ų LATIN SMALL LETTER U WITH OGONEK */ - { 0x03fd, 0x0169 }, /* utilde ũ LATIN SMALL LETTER U WITH TILDE */ - { 0x03fe, 0x016b }, /* umacron ū LATIN SMALL LETTER U WITH MACRON */ - { 0x047e, 0x203e }, /* overline ‾ OVERLINE */ - { 0x04a1, 0x3002 }, /* kana_fullstop 。 IDEOGRAPHIC FULL STOP */ - { 0x04a2, 0x300c }, /* kana_openingbracket 「 LEFT CORNER BRACKET */ - { 0x04a3, 0x300d }, /* kana_closingbracket 」 RIGHT CORNER BRACKET */ - { 0x04a4, 0x3001 }, /* kana_comma 、 IDEOGRAPHIC COMMA */ - { 0x04a5, 0x30fb }, /* kana_conjunctive ・ KATAKANA MIDDLE DOT */ - { 0x04a6, 0x30f2 }, /* kana_WO ヲ KATAKANA LETTER WO */ - { 0x04a7, 0x30a1 }, /* kana_a ァ KATAKANA LETTER SMALL A */ - { 0x04a8, 0x30a3 }, /* kana_i ィ KATAKANA LETTER SMALL I */ - { 0x04a9, 0x30a5 }, /* kana_u ゥ KATAKANA LETTER SMALL U */ - { 0x04aa, 0x30a7 }, /* kana_e ェ KATAKANA LETTER SMALL E */ - { 0x04ab, 0x30a9 }, /* kana_o ォ KATAKANA LETTER SMALL O */ - { 0x04ac, 0x30e3 }, /* kana_ya ャ KATAKANA LETTER SMALL YA */ - { 0x04ad, 0x30e5 }, /* kana_yu ュ KATAKANA LETTER SMALL YU */ - { 0x04ae, 0x30e7 }, /* kana_yo ョ KATAKANA LETTER SMALL YO */ - { 0x04af, 0x30c3 }, /* kana_tsu ッ KATAKANA LETTER SMALL TU */ - { 0x04b0, 0x30fc }, /* prolongedsound ー KATAKANA-HIRAGANA PROLONGED SOUND MARK */ - { 0x04b1, 0x30a2 }, /* kana_A ア KATAKANA LETTER A */ - { 0x04b2, 0x30a4 }, /* kana_I イ KATAKANA LETTER I */ - { 0x04b3, 0x30a6 }, /* kana_U ウ KATAKANA LETTER U */ - { 0x04b4, 0x30a8 }, /* kana_E エ KATAKANA LETTER E */ - { 0x04b5, 0x30aa }, /* kana_O オ KATAKANA LETTER O */ - { 0x04b6, 0x30ab }, /* kana_KA カ KATAKANA LETTER KA */ - { 0x04b7, 0x30ad }, /* kana_KI キ KATAKANA LETTER KI */ - { 0x04b8, 0x30af }, /* kana_KU ク KATAKANA LETTER KU */ - { 0x04b9, 0x30b1 }, /* kana_KE ケ KATAKANA LETTER KE */ - { 0x04ba, 0x30b3 }, /* kana_KO コ KATAKANA LETTER KO */ - { 0x04bb, 0x30b5 }, /* kana_SA サ KATAKANA LETTER SA */ - { 0x04bc, 0x30b7 }, /* kana_SHI シ KATAKANA LETTER SI */ - { 0x04bd, 0x30b9 }, /* kana_SU ス KATAKANA LETTER SU */ - { 0x04be, 0x30bb }, /* kana_SE セ KATAKANA LETTER SE */ - { 0x04bf, 0x30bd }, /* kana_SO ソ KATAKANA LETTER SO */ - { 0x04c0, 0x30bf }, /* kana_TA タ KATAKANA LETTER TA */ - { 0x04c1, 0x30c1 }, /* kana_CHI チ KATAKANA LETTER TI */ - { 0x04c2, 0x30c4 }, /* kana_TSU ツ KATAKANA LETTER TU */ - { 0x04c3, 0x30c6 }, /* kana_TE テ KATAKANA LETTER TE */ - { 0x04c4, 0x30c8 }, /* kana_TO ト KATAKANA LETTER TO */ - { 0x04c5, 0x30ca }, /* kana_NA ナ KATAKANA LETTER NA */ - { 0x04c6, 0x30cb }, /* kana_NI ニ KATAKANA LETTER NI */ - { 0x04c7, 0x30cc }, /* kana_NU ヌ KATAKANA LETTER NU */ - { 0x04c8, 0x30cd }, /* kana_NE ネ KATAKANA LETTER NE */ - { 0x04c9, 0x30ce }, /* kana_NO ノ KATAKANA LETTER NO */ - { 0x04ca, 0x30cf }, /* kana_HA ハ KATAKANA LETTER HA */ - { 0x04cb, 0x30d2 }, /* kana_HI ヒ KATAKANA LETTER HI */ - { 0x04cc, 0x30d5 }, /* kana_FU フ KATAKANA LETTER HU */ - { 0x04cd, 0x30d8 }, /* kana_HE ヘ KATAKANA LETTER HE */ - { 0x04ce, 0x30db }, /* kana_HO ホ KATAKANA LETTER HO */ - { 0x04cf, 0x30de }, /* kana_MA マ KATAKANA LETTER MA */ - { 0x04d0, 0x30df }, /* kana_MI ミ KATAKANA LETTER MI */ - { 0x04d1, 0x30e0 }, /* kana_MU ム KATAKANA LETTER MU */ - { 0x04d2, 0x30e1 }, /* kana_ME メ KATAKANA LETTER ME */ - { 0x04d3, 0x30e2 }, /* kana_MO モ KATAKANA LETTER MO */ - { 0x04d4, 0x30e4 }, /* kana_YA ヤ KATAKANA LETTER YA */ - { 0x04d5, 0x30e6 }, /* kana_YU ユ KATAKANA LETTER YU */ - { 0x04d6, 0x30e8 }, /* kana_YO ヨ KATAKANA LETTER YO */ - { 0x04d7, 0x30e9 }, /* kana_RA ラ KATAKANA LETTER RA */ - { 0x04d8, 0x30ea }, /* kana_RI リ KATAKANA LETTER RI */ - { 0x04d9, 0x30eb }, /* kana_RU ル KATAKANA LETTER RU */ - { 0x04da, 0x30ec }, /* kana_RE レ KATAKANA LETTER RE */ - { 0x04db, 0x30ed }, /* kana_RO ロ KATAKANA LETTER RO */ - { 0x04dc, 0x30ef }, /* kana_WA ワ KATAKANA LETTER WA */ - { 0x04dd, 0x30f3 }, /* kana_N ン KATAKANA LETTER N */ - { 0x04de, 0x309b }, /* voicedsound ゛ KATAKANA-HIRAGANA VOICED SOUND MARK */ - { 0x04df, 0x309c }, /* semivoicedsound ゜ KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */ - { 0x05ac, 0x060c }, /* Arabic_comma ، ARABIC COMMA */ - { 0x05bb, 0x061b }, /* Arabic_semicolon ؛ ARABIC SEMICOLON */ - { 0x05bf, 0x061f }, /* Arabic_question_mark ؟ ARABIC QUESTION MARK */ - { 0x05c1, 0x0621 }, /* Arabic_hamza ء ARABIC LETTER HAMZA */ - { 0x05c2, 0x0622 }, /* Arabic_maddaonalef آ ARABIC LETTER ALEF WITH MADDA ABOVE */ - { 0x05c3, 0x0623 }, /* Arabic_hamzaonalef أ ARABIC LETTER ALEF WITH HAMZA ABOVE */ - { 0x05c4, 0x0624 }, /* Arabic_hamzaonwaw ؤ ARABIC LETTER WAW WITH HAMZA ABOVE */ - { 0x05c5, 0x0625 }, /* Arabic_hamzaunderalef إ ARABIC LETTER ALEF WITH HAMZA BELOW */ - { 0x05c6, 0x0626 }, /* Arabic_hamzaonyeh ئ ARABIC LETTER YEH WITH HAMZA ABOVE */ - { 0x05c7, 0x0627 }, /* Arabic_alef ا ARABIC LETTER ALEF */ - { 0x05c8, 0x0628 }, /* Arabic_beh ب ARABIC LETTER BEH */ - { 0x05c9, 0x0629 }, /* Arabic_tehmarbuta ة ARABIC LETTER TEH MARBUTA */ - { 0x05ca, 0x062a }, /* Arabic_teh ت ARABIC LETTER TEH */ - { 0x05cb, 0x062b }, /* Arabic_theh ث ARABIC LETTER THEH */ - { 0x05cc, 0x062c }, /* Arabic_jeem ج ARABIC LETTER JEEM */ - { 0x05cd, 0x062d }, /* Arabic_hah ح ARABIC LETTER HAH */ - { 0x05ce, 0x062e }, /* Arabic_khah خ ARABIC LETTER KHAH */ - { 0x05cf, 0x062f }, /* Arabic_dal د ARABIC LETTER DAL */ - { 0x05d0, 0x0630 }, /* Arabic_thal ذ ARABIC LETTER THAL */ - { 0x05d1, 0x0631 }, /* Arabic_ra ر ARABIC LETTER REH */ - { 0x05d2, 0x0632 }, /* Arabic_zain ز ARABIC LETTER ZAIN */ - { 0x05d3, 0x0633 }, /* Arabic_seen س ARABIC LETTER SEEN */ - { 0x05d4, 0x0634 }, /* Arabic_sheen ش ARABIC LETTER SHEEN */ - { 0x05d5, 0x0635 }, /* Arabic_sad ص ARABIC LETTER SAD */ - { 0x05d6, 0x0636 }, /* Arabic_dad ض ARABIC LETTER DAD */ - { 0x05d7, 0x0637 }, /* Arabic_tah ط ARABIC LETTER TAH */ - { 0x05d8, 0x0638 }, /* Arabic_zah ظ ARABIC LETTER ZAH */ - { 0x05d9, 0x0639 }, /* Arabic_ain ع ARABIC LETTER AIN */ - { 0x05da, 0x063a }, /* Arabic_ghain غ ARABIC LETTER GHAIN */ - { 0x05e0, 0x0640 }, /* Arabic_tatweel ـ ARABIC TATWEEL */ - { 0x05e1, 0x0641 }, /* Arabic_feh ف ARABIC LETTER FEH */ - { 0x05e2, 0x0642 }, /* Arabic_qaf ق ARABIC LETTER QAF */ - { 0x05e3, 0x0643 }, /* Arabic_kaf ك ARABIC LETTER KAF */ - { 0x05e4, 0x0644 }, /* Arabic_lam ل ARABIC LETTER LAM */ - { 0x05e5, 0x0645 }, /* Arabic_meem م ARABIC LETTER MEEM */ - { 0x05e6, 0x0646 }, /* Arabic_noon ن ARABIC LETTER NOON */ - { 0x05e7, 0x0647 }, /* Arabic_ha ه ARABIC LETTER HEH */ - { 0x05e8, 0x0648 }, /* Arabic_waw و ARABIC LETTER WAW */ - { 0x05e9, 0x0649 }, /* Arabic_alefmaksura ى ARABIC LETTER ALEF MAKSURA */ - { 0x05ea, 0x064a }, /* Arabic_yeh ي ARABIC LETTER YEH */ - { 0x05eb, 0x064b }, /* Arabic_fathatan ً ARABIC FATHATAN */ - { 0x05ec, 0x064c }, /* Arabic_dammatan ٌ ARABIC DAMMATAN */ - { 0x05ed, 0x064d }, /* Arabic_kasratan ٍ ARABIC KASRATAN */ - { 0x05ee, 0x064e }, /* Arabic_fatha َ ARABIC FATHA */ - { 0x05ef, 0x064f }, /* Arabic_damma ُ ARABIC DAMMA */ - { 0x05f0, 0x0650 }, /* Arabic_kasra ِ ARABIC KASRA */ - { 0x05f1, 0x0651 }, /* Arabic_shadda ّ ARABIC SHADDA */ - { 0x05f2, 0x0652 }, /* Arabic_sukun ْ ARABIC SUKUN */ - { 0x06a1, 0x0452 }, /* Serbian_dje ђ CYRILLIC SMALL LETTER DJE */ - { 0x06a2, 0x0453 }, /* Macedonia_gje ѓ CYRILLIC SMALL LETTER GJE */ - { 0x06a3, 0x0451 }, /* Cyrillic_io ё CYRILLIC SMALL LETTER IO */ - { 0x06a4, 0x0454 }, /* Ukrainian_ie є CYRILLIC SMALL LETTER UKRAINIAN IE */ - { 0x06a5, 0x0455 }, /* Macedonia_dse ѕ CYRILLIC SMALL LETTER DZE */ - { 0x06a6, 0x0456 }, /* Ukrainian_i і CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ - { 0x06a7, 0x0457 }, /* Ukrainian_yi ї CYRILLIC SMALL LETTER YI */ - { 0x06a8, 0x0458 }, /* Cyrillic_je ј CYRILLIC SMALL LETTER JE */ - { 0x06a9, 0x0459 }, /* Cyrillic_lje љ CYRILLIC SMALL LETTER LJE */ - { 0x06aa, 0x045a }, /* Cyrillic_nje њ CYRILLIC SMALL LETTER NJE */ - { 0x06ab, 0x045b }, /* Serbian_tshe ћ CYRILLIC SMALL LETTER TSHE */ - { 0x06ac, 0x045c }, /* Macedonia_kje ќ CYRILLIC SMALL LETTER KJE */ - { 0x06ae, 0x045e }, /* Byelorussian_shortu ў CYRILLIC SMALL LETTER SHORT U */ - { 0x06af, 0x045f }, /* Cyrillic_dzhe џ CYRILLIC SMALL LETTER DZHE */ - { 0x06b0, 0x2116 }, /* numerosign № NUMERO SIGN */ - { 0x06b1, 0x0402 }, /* Serbian_DJE Ђ CYRILLIC CAPITAL LETTER DJE */ - { 0x06b2, 0x0403 }, /* Macedonia_GJE Ѓ CYRILLIC CAPITAL LETTER GJE */ - { 0x06b3, 0x0401 }, /* Cyrillic_IO Ё CYRILLIC CAPITAL LETTER IO */ - { 0x06b4, 0x0404 }, /* Ukrainian_IE Є CYRILLIC CAPITAL LETTER UKRAINIAN IE */ - { 0x06b5, 0x0405 }, /* Macedonia_DSE Ѕ CYRILLIC CAPITAL LETTER DZE */ - { 0x06b6, 0x0406 }, /* Ukrainian_I І CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */ - { 0x06b7, 0x0407 }, /* Ukrainian_YI Ї CYRILLIC CAPITAL LETTER YI */ - { 0x06b8, 0x0408 }, /* Cyrillic_JE Ј CYRILLIC CAPITAL LETTER JE */ - { 0x06b9, 0x0409 }, /* Cyrillic_LJE Љ CYRILLIC CAPITAL LETTER LJE */ - { 0x06ba, 0x040a }, /* Cyrillic_NJE Њ CYRILLIC CAPITAL LETTER NJE */ - { 0x06bb, 0x040b }, /* Serbian_TSHE Ћ CYRILLIC CAPITAL LETTER TSHE */ - { 0x06bc, 0x040c }, /* Macedonia_KJE Ќ CYRILLIC CAPITAL LETTER KJE */ - { 0x06be, 0x040e }, /* Byelorussian_SHORTU Ў CYRILLIC CAPITAL LETTER SHORT U */ - { 0x06bf, 0x040f }, /* Cyrillic_DZHE Џ CYRILLIC CAPITAL LETTER DZHE */ - { 0x06c0, 0x044e }, /* Cyrillic_yu ю CYRILLIC SMALL LETTER YU */ - { 0x06c1, 0x0430 }, /* Cyrillic_a а CYRILLIC SMALL LETTER A */ - { 0x06c2, 0x0431 }, /* Cyrillic_be б CYRILLIC SMALL LETTER BE */ - { 0x06c3, 0x0446 }, /* Cyrillic_tse ц CYRILLIC SMALL LETTER TSE */ - { 0x06c4, 0x0434 }, /* Cyrillic_de д CYRILLIC SMALL LETTER DE */ - { 0x06c5, 0x0435 }, /* Cyrillic_ie е CYRILLIC SMALL LETTER IE */ - { 0x06c6, 0x0444 }, /* Cyrillic_ef ф CYRILLIC SMALL LETTER EF */ - { 0x06c7, 0x0433 }, /* Cyrillic_ghe г CYRILLIC SMALL LETTER GHE */ - { 0x06c8, 0x0445 }, /* Cyrillic_ha х CYRILLIC SMALL LETTER HA */ - { 0x06c9, 0x0438 }, /* Cyrillic_i и CYRILLIC SMALL LETTER I */ - { 0x06ca, 0x0439 }, /* Cyrillic_shorti й CYRILLIC SMALL LETTER SHORT I */ - { 0x06cb, 0x043a }, /* Cyrillic_ka к CYRILLIC SMALL LETTER KA */ - { 0x06cc, 0x043b }, /* Cyrillic_el л CYRILLIC SMALL LETTER EL */ - { 0x06cd, 0x043c }, /* Cyrillic_em м CYRILLIC SMALL LETTER EM */ - { 0x06ce, 0x043d }, /* Cyrillic_en н CYRILLIC SMALL LETTER EN */ - { 0x06cf, 0x043e }, /* Cyrillic_o о CYRILLIC SMALL LETTER O */ - { 0x06d0, 0x043f }, /* Cyrillic_pe п CYRILLIC SMALL LETTER PE */ - { 0x06d1, 0x044f }, /* Cyrillic_ya я CYRILLIC SMALL LETTER YA */ - { 0x06d2, 0x0440 }, /* Cyrillic_er р CYRILLIC SMALL LETTER ER */ - { 0x06d3, 0x0441 }, /* Cyrillic_es с CYRILLIC SMALL LETTER ES */ - { 0x06d4, 0x0442 }, /* Cyrillic_te т CYRILLIC SMALL LETTER TE */ - { 0x06d5, 0x0443 }, /* Cyrillic_u у CYRILLIC SMALL LETTER U */ - { 0x06d6, 0x0436 }, /* Cyrillic_zhe ж CYRILLIC SMALL LETTER ZHE */ - { 0x06d7, 0x0432 }, /* Cyrillic_ve в CYRILLIC SMALL LETTER VE */ - { 0x06d8, 0x044c }, /* Cyrillic_softsign ь CYRILLIC SMALL LETTER SOFT SIGN */ - { 0x06d9, 0x044b }, /* Cyrillic_yeru ы CYRILLIC SMALL LETTER YERU */ - { 0x06da, 0x0437 }, /* Cyrillic_ze з CYRILLIC SMALL LETTER ZE */ - { 0x06db, 0x0448 }, /* Cyrillic_sha ш CYRILLIC SMALL LETTER SHA */ - { 0x06dc, 0x044d }, /* Cyrillic_e э CYRILLIC SMALL LETTER E */ - { 0x06dd, 0x0449 }, /* Cyrillic_shcha щ CYRILLIC SMALL LETTER SHCHA */ - { 0x06de, 0x0447 }, /* Cyrillic_che ч CYRILLIC SMALL LETTER CHE */ - { 0x06df, 0x044a }, /* Cyrillic_hardsign ъ CYRILLIC SMALL LETTER HARD SIGN */ - { 0x06e0, 0x042e }, /* Cyrillic_YU Ю CYRILLIC CAPITAL LETTER YU */ - { 0x06e1, 0x0410 }, /* Cyrillic_A А CYRILLIC CAPITAL LETTER A */ - { 0x06e2, 0x0411 }, /* Cyrillic_BE Б CYRILLIC CAPITAL LETTER BE */ - { 0x06e3, 0x0426 }, /* Cyrillic_TSE Ц CYRILLIC CAPITAL LETTER TSE */ - { 0x06e4, 0x0414 }, /* Cyrillic_DE Д CYRILLIC CAPITAL LETTER DE */ - { 0x06e5, 0x0415 }, /* Cyrillic_IE Е CYRILLIC CAPITAL LETTER IE */ - { 0x06e6, 0x0424 }, /* Cyrillic_EF Ф CYRILLIC CAPITAL LETTER EF */ - { 0x06e7, 0x0413 }, /* Cyrillic_GHE Г CYRILLIC CAPITAL LETTER GHE */ - { 0x06e8, 0x0425 }, /* Cyrillic_HA Х CYRILLIC CAPITAL LETTER HA */ - { 0x06e9, 0x0418 }, /* Cyrillic_I И CYRILLIC CAPITAL LETTER I */ - { 0x06ea, 0x0419 }, /* Cyrillic_SHORTI Й CYRILLIC CAPITAL LETTER SHORT I */ - { 0x06eb, 0x041a }, /* Cyrillic_KA К CYRILLIC CAPITAL LETTER KA */ - { 0x06ec, 0x041b }, /* Cyrillic_EL Л CYRILLIC CAPITAL LETTER EL */ - { 0x06ed, 0x041c }, /* Cyrillic_EM М CYRILLIC CAPITAL LETTER EM */ - { 0x06ee, 0x041d }, /* Cyrillic_EN Н CYRILLIC CAPITAL LETTER EN */ - { 0x06ef, 0x041e }, /* Cyrillic_O О CYRILLIC CAPITAL LETTER O */ - { 0x06f0, 0x041f }, /* Cyrillic_PE П CYRILLIC CAPITAL LETTER PE */ - { 0x06f1, 0x042f }, /* Cyrillic_YA Я CYRILLIC CAPITAL LETTER YA */ - { 0x06f2, 0x0420 }, /* Cyrillic_ER Р CYRILLIC CAPITAL LETTER ER */ - { 0x06f3, 0x0421 }, /* Cyrillic_ES С CYRILLIC CAPITAL LETTER ES */ - { 0x06f4, 0x0422 }, /* Cyrillic_TE Т CYRILLIC CAPITAL LETTER TE */ - { 0x06f5, 0x0423 }, /* Cyrillic_U У CYRILLIC CAPITAL LETTER U */ - { 0x06f6, 0x0416 }, /* Cyrillic_ZHE Ж CYRILLIC CAPITAL LETTER ZHE */ - { 0x06f7, 0x0412 }, /* Cyrillic_VE В CYRILLIC CAPITAL LETTER VE */ - { 0x06f8, 0x042c }, /* Cyrillic_SOFTSIGN Ь CYRILLIC CAPITAL LETTER SOFT SIGN */ - { 0x06f9, 0x042b }, /* Cyrillic_YERU Ы CYRILLIC CAPITAL LETTER YERU */ - { 0x06fa, 0x0417 }, /* Cyrillic_ZE З CYRILLIC CAPITAL LETTER ZE */ - { 0x06fb, 0x0428 }, /* Cyrillic_SHA Ш CYRILLIC CAPITAL LETTER SHA */ - { 0x06fc, 0x042d }, /* Cyrillic_E Э CYRILLIC CAPITAL LETTER E */ - { 0x06fd, 0x0429 }, /* Cyrillic_SHCHA Щ CYRILLIC CAPITAL LETTER SHCHA */ - { 0x06fe, 0x0427 }, /* Cyrillic_CHE Ч CYRILLIC CAPITAL LETTER CHE */ - { 0x06ff, 0x042a }, /* Cyrillic_HARDSIGN Ъ CYRILLIC CAPITAL LETTER HARD SIGN */ - { 0x07a1, 0x0386 }, /* Greek_ALPHAaccent Ά GREEK CAPITAL LETTER ALPHA WITH TONOS */ - { 0x07a2, 0x0388 }, /* Greek_EPSILONaccent Έ GREEK CAPITAL LETTER EPSILON WITH TONOS */ - { 0x07a3, 0x0389 }, /* Greek_ETAaccent Ή GREEK CAPITAL LETTER ETA WITH TONOS */ - { 0x07a4, 0x038a }, /* Greek_IOTAaccent Ί GREEK CAPITAL LETTER IOTA WITH TONOS */ - { 0x07a5, 0x03aa }, /* Greek_IOTAdiaeresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ - { 0x07a7, 0x038c }, /* Greek_OMICRONaccent Ό GREEK CAPITAL LETTER OMICRON WITH TONOS */ - { 0x07a8, 0x038e }, /* Greek_UPSILONaccent Ύ GREEK CAPITAL LETTER UPSILON WITH TONOS */ - { 0x07a9, 0x03ab }, /* Greek_UPSILONdieresis Ϋ GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */ - { 0x07ab, 0x038f }, /* Greek_OMEGAaccent Ώ GREEK CAPITAL LETTER OMEGA WITH TONOS */ - { 0x07ae, 0x0385 }, /* Greek_accentdieresis ΅ GREEK DIALYTIKA TONOS */ - { 0x07af, 0x2015 }, /* Greek_horizbar ― HORIZONTAL BAR */ - { 0x07b1, 0x03ac }, /* Greek_alphaaccent ά GREEK SMALL LETTER ALPHA WITH TONOS */ - { 0x07b2, 0x03ad }, /* Greek_epsilonaccent έ GREEK SMALL LETTER EPSILON WITH TONOS */ - { 0x07b3, 0x03ae }, /* Greek_etaaccent ή GREEK SMALL LETTER ETA WITH TONOS */ - { 0x07b4, 0x03af }, /* Greek_iotaaccent ί GREEK SMALL LETTER IOTA WITH TONOS */ - { 0x07b5, 0x03ca }, /* Greek_iotadieresis ϊ GREEK SMALL LETTER IOTA WITH DIALYTIKA */ - { 0x07b6, 0x0390 }, /* Greek_iotaaccentdieresis ΐ GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */ - { 0x07b7, 0x03cc }, /* Greek_omicronaccent ό GREEK SMALL LETTER OMICRON WITH TONOS */ - { 0x07b8, 0x03cd }, /* Greek_upsilonaccent ύ GREEK SMALL LETTER UPSILON WITH TONOS */ - { 0x07b9, 0x03cb }, /* Greek_upsilondieresis ϋ GREEK SMALL LETTER UPSILON WITH DIALYTIKA */ - { 0x07ba, 0x03b0 }, /* Greek_upsilonaccentdieresis ΰ GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */ - { 0x07bb, 0x03ce }, /* Greek_omegaaccent ώ GREEK SMALL LETTER OMEGA WITH TONOS */ - { 0x07c1, 0x0391 }, /* Greek_ALPHA Α GREEK CAPITAL LETTER ALPHA */ - { 0x07c2, 0x0392 }, /* Greek_BETA Β GREEK CAPITAL LETTER BETA */ - { 0x07c3, 0x0393 }, /* Greek_GAMMA Γ GREEK CAPITAL LETTER GAMMA */ - { 0x07c4, 0x0394 }, /* Greek_DELTA Δ GREEK CAPITAL LETTER DELTA */ - { 0x07c5, 0x0395 }, /* Greek_EPSILON Ε GREEK CAPITAL LETTER EPSILON */ - { 0x07c6, 0x0396 }, /* Greek_ZETA Ζ GREEK CAPITAL LETTER ZETA */ - { 0x07c7, 0x0397 }, /* Greek_ETA Η GREEK CAPITAL LETTER ETA */ - { 0x07c8, 0x0398 }, /* Greek_THETA Θ GREEK CAPITAL LETTER THETA */ - { 0x07c9, 0x0399 }, /* Greek_IOTA Ι GREEK CAPITAL LETTER IOTA */ - { 0x07ca, 0x039a }, /* Greek_KAPPA Κ GREEK CAPITAL LETTER KAPPA */ - { 0x07cb, 0x039b }, /* Greek_LAMBDA Λ GREEK CAPITAL LETTER LAMDA */ - { 0x07cc, 0x039c }, /* Greek_MU Μ GREEK CAPITAL LETTER MU */ - { 0x07cd, 0x039d }, /* Greek_NU Ν GREEK CAPITAL LETTER NU */ - { 0x07ce, 0x039e }, /* Greek_XI Ξ GREEK CAPITAL LETTER XI */ - { 0x07cf, 0x039f }, /* Greek_OMICRON Ο GREEK CAPITAL LETTER OMICRON */ - { 0x07d0, 0x03a0 }, /* Greek_PI Π GREEK CAPITAL LETTER PI */ - { 0x07d1, 0x03a1 }, /* Greek_RHO Ρ GREEK CAPITAL LETTER RHO */ - { 0x07d2, 0x03a3 }, /* Greek_SIGMA Σ GREEK CAPITAL LETTER SIGMA */ - { 0x07d4, 0x03a4 }, /* Greek_TAU Τ GREEK CAPITAL LETTER TAU */ - { 0x07d5, 0x03a5 }, /* Greek_UPSILON Υ GREEK CAPITAL LETTER UPSILON */ - { 0x07d6, 0x03a6 }, /* Greek_PHI Φ GREEK CAPITAL LETTER PHI */ - { 0x07d7, 0x03a7 }, /* Greek_CHI Χ GREEK CAPITAL LETTER CHI */ - { 0x07d8, 0x03a8 }, /* Greek_PSI Ψ GREEK CAPITAL LETTER PSI */ - { 0x07d9, 0x03a9 }, /* Greek_OMEGA Ω GREEK CAPITAL LETTER OMEGA */ - { 0x07e1, 0x03b1 }, /* Greek_alpha α GREEK SMALL LETTER ALPHA */ - { 0x07e2, 0x03b2 }, /* Greek_beta β GREEK SMALL LETTER BETA */ - { 0x07e3, 0x03b3 }, /* Greek_gamma γ GREEK SMALL LETTER GAMMA */ - { 0x07e4, 0x03b4 }, /* Greek_delta δ GREEK SMALL LETTER DELTA */ - { 0x07e5, 0x03b5 }, /* Greek_epsilon ε GREEK SMALL LETTER EPSILON */ - { 0x07e6, 0x03b6 }, /* Greek_zeta ζ GREEK SMALL LETTER ZETA */ - { 0x07e7, 0x03b7 }, /* Greek_eta η GREEK SMALL LETTER ETA */ - { 0x07e8, 0x03b8 }, /* Greek_theta θ GREEK SMALL LETTER THETA */ - { 0x07e9, 0x03b9 }, /* Greek_iota ι GREEK SMALL LETTER IOTA */ - { 0x07ea, 0x03ba }, /* Greek_kappa κ GREEK SMALL LETTER KAPPA */ - { 0x07eb, 0x03bb }, /* Greek_lambda λ GREEK SMALL LETTER LAMDA */ - { 0x07ec, 0x03bc }, /* Greek_mu μ GREEK SMALL LETTER MU */ - { 0x07ed, 0x03bd }, /* Greek_nu ν GREEK SMALL LETTER NU */ - { 0x07ee, 0x03be }, /* Greek_xi ξ GREEK SMALL LETTER XI */ - { 0x07ef, 0x03bf }, /* Greek_omicron ο GREEK SMALL LETTER OMICRON */ - { 0x07f0, 0x03c0 }, /* Greek_pi π GREEK SMALL LETTER PI */ - { 0x07f1, 0x03c1 }, /* Greek_rho ρ GREEK SMALL LETTER RHO */ - { 0x07f2, 0x03c3 }, /* Greek_sigma σ GREEK SMALL LETTER SIGMA */ - { 0x07f3, 0x03c2 }, /* Greek_finalsmallsigma ς GREEK SMALL LETTER FINAL SIGMA */ - { 0x07f4, 0x03c4 }, /* Greek_tau τ GREEK SMALL LETTER TAU */ - { 0x07f5, 0x03c5 }, /* Greek_upsilon υ GREEK SMALL LETTER UPSILON */ - { 0x07f6, 0x03c6 }, /* Greek_phi φ GREEK SMALL LETTER PHI */ - { 0x07f7, 0x03c7 }, /* Greek_chi χ GREEK SMALL LETTER CHI */ - { 0x07f8, 0x03c8 }, /* Greek_psi ψ GREEK SMALL LETTER PSI */ - { 0x07f9, 0x03c9 }, /* Greek_omega ω GREEK SMALL LETTER OMEGA */ -/* 0x08a1 leftradical ? ??? */ -/* 0x08a2 topleftradical ? ??? */ -/* 0x08a3 horizconnector ? ??? */ - { 0x08a4, 0x2320 }, /* topintegral ⌠ TOP HALF INTEGRAL */ - { 0x08a5, 0x2321 }, /* botintegral ⌡ BOTTOM HALF INTEGRAL */ - { 0x08a6, 0x2502 }, /* vertconnector │ BOX DRAWINGS LIGHT VERTICAL */ -/* 0x08a7 topleftsqbracket ? ??? */ -/* 0x08a8 botleftsqbracket ? ??? */ -/* 0x08a9 toprightsqbracket ? ??? */ -/* 0x08aa botrightsqbracket ? ??? */ -/* 0x08ab topleftparens ? ??? */ -/* 0x08ac botleftparens ? ??? */ -/* 0x08ad toprightparens ? ??? */ -/* 0x08ae botrightparens ? ??? */ -/* 0x08af leftmiddlecurlybrace ? ??? */ -/* 0x08b0 rightmiddlecurlybrace ? ??? */ -/* 0x08b1 topleftsummation ? ??? */ -/* 0x08b2 botleftsummation ? ??? */ -/* 0x08b3 topvertsummationconnector ? ??? */ -/* 0x08b4 botvertsummationconnector ? ??? */ -/* 0x08b5 toprightsummation ? ??? */ -/* 0x08b6 botrightsummation ? ??? */ -/* 0x08b7 rightmiddlesummation ? ??? */ - { 0x08bc, 0x2264 }, /* lessthanequal ≤ LESS-THAN OR EQUAL TO */ - { 0x08bd, 0x2260 }, /* notequal ≠ NOT EQUAL TO */ - { 0x08be, 0x2265 }, /* greaterthanequal ≥ GREATER-THAN OR EQUAL TO */ - { 0x08bf, 0x222b }, /* integral ∫ INTEGRAL */ - { 0x08c0, 0x2234 }, /* therefore ∴ THEREFORE */ - { 0x08c1, 0x221d }, /* variation ∝ PROPORTIONAL TO */ - { 0x08c2, 0x221e }, /* infinity ∞ INFINITY */ - { 0x08c5, 0x2207 }, /* nabla ∇ NABLA */ - { 0x08c8, 0x2245 }, /* approximate ≅ APPROXIMATELY EQUAL TO */ -/* 0x08c9 similarequal ? ??? */ - { 0x08cd, 0x21d4 }, /* ifonlyif ⇔ LEFT RIGHT DOUBLE ARROW */ - { 0x08ce, 0x21d2 }, /* implies ⇒ RIGHTWARDS DOUBLE ARROW */ - { 0x08cf, 0x2261 }, /* identical ≡ IDENTICAL TO */ - { 0x08d6, 0x221a }, /* radical √ SQUARE ROOT */ - { 0x08da, 0x2282 }, /* includedin ⊂ SUBSET OF */ - { 0x08db, 0x2283 }, /* includes ⊃ SUPERSET OF */ - { 0x08dc, 0x2229 }, /* intersection ∩ INTERSECTION */ - { 0x08dd, 0x222a }, /* union ∪ UNION */ - { 0x08de, 0x2227 }, /* logicaland ∧ LOGICAL AND */ - { 0x08df, 0x2228 }, /* logicalor ∨ LOGICAL OR */ - { 0x08ef, 0x2202 }, /* partialderivative ∂ PARTIAL DIFFERENTIAL */ - { 0x08f6, 0x0192 }, /* function ƒ LATIN SMALL LETTER F WITH HOOK */ - { 0x08fb, 0x2190 }, /* leftarrow ← LEFTWARDS ARROW */ - { 0x08fc, 0x2191 }, /* uparrow ↑ UPWARDS ARROW */ - { 0x08fd, 0x2192 }, /* rightarrow → RIGHTWARDS ARROW */ - { 0x08fe, 0x2193 }, /* downarrow ↓ DOWNWARDS ARROW */ - { 0x09df, 0x2422 }, /* blank ␢ BLANK SYMBOL */ - { 0x09e0, 0x25c6 }, /* soliddiamond ◆ BLACK DIAMOND */ - { 0x09e1, 0x2592 }, /* checkerboard ▒ MEDIUM SHADE */ - { 0x09e2, 0x2409 }, /* ht ␉ SYMBOL FOR HORIZONTAL TABULATION */ - { 0x09e3, 0x240c }, /* ff ␌ SYMBOL FOR FORM FEED */ - { 0x09e4, 0x240d }, /* cr ␍ SYMBOL FOR CARRIAGE RETURN */ - { 0x09e5, 0x240a }, /* lf ␊ SYMBOL FOR LINE FEED */ - { 0x09e8, 0x2424 }, /* nl  SYMBOL FOR NEWLINE */ - { 0x09e9, 0x240b }, /* vt ␋ SYMBOL FOR VERTICAL TABULATION */ - { 0x09ea, 0x2518 }, /* lowrightcorner ┘ BOX DRAWINGS LIGHT UP AND LEFT */ - { 0x09eb, 0x2510 }, /* uprightcorner ┐ BOX DRAWINGS LIGHT DOWN AND LEFT */ - { 0x09ec, 0x250c }, /* upleftcorner ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT */ - { 0x09ed, 0x2514 }, /* lowleftcorner └ BOX DRAWINGS LIGHT UP AND RIGHT */ - { 0x09ee, 0x253c }, /* crossinglines ┼ BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ -/* 0x09ef horizlinescan1 ? ??? */ -/* 0x09f0 horizlinescan3 ? ??? */ - { 0x09f1, 0x2500 }, /* horizlinescan5 ─ BOX DRAWINGS LIGHT HORIZONTAL */ -/* 0x09f2 horizlinescan7 ? ??? */ -/* 0x09f3 horizlinescan9 ? ??? */ - { 0x09f4, 0x251c }, /* leftt ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ - { 0x09f5, 0x2524 }, /* rightt ┤ BOX DRAWINGS LIGHT VERTICAL AND LEFT */ - { 0x09f6, 0x2534 }, /* bott ┴ BOX DRAWINGS LIGHT UP AND HORIZONTAL */ - { 0x09f7, 0x252c }, /* topt ┬ BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */ - { 0x09f8, 0x2502 }, /* vertbar │ BOX DRAWINGS LIGHT VERTICAL */ - { 0x0aa1, 0x2003 }, /* emspace EM SPACE */ - { 0x0aa2, 0x2002 }, /* enspace EN SPACE */ - { 0x0aa3, 0x2004 }, /* em3space THREE-PER-EM SPACE */ - { 0x0aa4, 0x2005 }, /* em4space FOUR-PER-EM SPACE */ - { 0x0aa5, 0x2007 }, /* digitspace FIGURE SPACE */ - { 0x0aa6, 0x2008 }, /* punctspace PUNCTUATION SPACE */ - { 0x0aa7, 0x2009 }, /* thinspace THIN SPACE */ - { 0x0aa8, 0x200a }, /* hairspace HAIR SPACE */ - { 0x0aa9, 0x2014 }, /* emdash — EM DASH */ - { 0x0aaa, 0x2013 }, /* endash – EN DASH */ -/* 0x0aac signifblank ? ??? */ - { 0x0aae, 0x2026 }, /* ellipsis … HORIZONTAL ELLIPSIS */ -/* 0x0aaf doubbaselinedot ? ??? */ - { 0x0ab0, 0x2153 }, /* onethird ⅓ VULGAR FRACTION ONE THIRD */ - { 0x0ab1, 0x2154 }, /* twothirds ⅔ VULGAR FRACTION TWO THIRDS */ - { 0x0ab2, 0x2155 }, /* onefifth ⅕ VULGAR FRACTION ONE FIFTH */ - { 0x0ab3, 0x2156 }, /* twofifths ⅖ VULGAR FRACTION TWO FIFTHS */ - { 0x0ab4, 0x2157 }, /* threefifths ⅗ VULGAR FRACTION THREE FIFTHS */ - { 0x0ab5, 0x2158 }, /* fourfifths ⅘ VULGAR FRACTION FOUR FIFTHS */ - { 0x0ab6, 0x2159 }, /* onesixth ⅙ VULGAR FRACTION ONE SIXTH */ - { 0x0ab7, 0x215a }, /* fivesixths ⅚ VULGAR FRACTION FIVE SIXTHS */ - { 0x0ab8, 0x2105 }, /* careof ℅ CARE OF */ - { 0x0abb, 0x2012 }, /* figdash ‒ FIGURE DASH */ - { 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET */ - { 0x0abd, 0x002e }, /* decimalpoint . FULL STOP */ - { 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET */ -/* 0x0abf marker ? ??? */ - { 0x0ac3, 0x215b }, /* oneeighth ⅛ VULGAR FRACTION ONE EIGHTH */ - { 0x0ac4, 0x215c }, /* threeeighths ⅜ VULGAR FRACTION THREE EIGHTHS */ - { 0x0ac5, 0x215d }, /* fiveeighths ⅝ VULGAR FRACTION FIVE EIGHTHS */ - { 0x0ac6, 0x215e }, /* seveneighths ⅞ VULGAR FRACTION SEVEN EIGHTHS */ - { 0x0ac9, 0x2122 }, /* trademark ™ TRADE MARK SIGN */ - { 0x0aca, 0x2613 }, /* signaturemark ☓ SALTIRE */ -/* 0x0acb trademarkincircle ? ??? */ - { 0x0acc, 0x25c1 }, /* leftopentriangle ◁ WHITE LEFT-POINTING TRIANGLE */ - { 0x0acd, 0x25b7 }, /* rightopentriangle ▷ WHITE RIGHT-POINTING TRIANGLE */ - { 0x0ace, 0x25cb }, /* emopencircle ○ WHITE CIRCLE */ - { 0x0acf, 0x25a1 }, /* emopenrectangle □ WHITE SQUARE */ - { 0x0ad0, 0x2018 }, /* leftsinglequotemark ‘ LEFT SINGLE QUOTATION MARK */ - { 0x0ad1, 0x2019 }, /* rightsinglequotemark ’ RIGHT SINGLE QUOTATION MARK */ - { 0x0ad2, 0x201c }, /* leftdoublequotemark “ LEFT DOUBLE QUOTATION MARK */ - { 0x0ad3, 0x201d }, /* rightdoublequotemark ” RIGHT DOUBLE QUOTATION MARK */ - { 0x0ad4, 0x211e }, /* prescription ℞ PRESCRIPTION TAKE */ - { 0x0ad6, 0x2032 }, /* minutes ′ PRIME */ - { 0x0ad7, 0x2033 }, /* seconds ″ DOUBLE PRIME */ - { 0x0ad9, 0x271d }, /* latincross ✝ LATIN CROSS */ -/* 0x0ada hexagram ? ??? */ - { 0x0adb, 0x25ac }, /* filledrectbullet ▬ BLACK RECTANGLE */ - { 0x0adc, 0x25c0 }, /* filledlefttribullet ◀ BLACK LEFT-POINTING TRIANGLE */ - { 0x0add, 0x25b6 }, /* filledrighttribullet ▶ BLACK RIGHT-POINTING TRIANGLE */ - { 0x0ade, 0x25cf }, /* emfilledcircle ● BLACK CIRCLE */ - { 0x0adf, 0x25a0 }, /* emfilledrect ■ BLACK SQUARE */ - { 0x0ae0, 0x25e6 }, /* enopencircbullet ◦ WHITE BULLET */ - { 0x0ae1, 0x25ab }, /* enopensquarebullet ▫ WHITE SMALL SQUARE */ - { 0x0ae2, 0x25ad }, /* openrectbullet ▭ WHITE RECTANGLE */ - { 0x0ae3, 0x25b3 }, /* opentribulletup △ WHITE UP-POINTING TRIANGLE */ - { 0x0ae4, 0x25bd }, /* opentribulletdown ▽ WHITE DOWN-POINTING TRIANGLE */ - { 0x0ae5, 0x2606 }, /* openstar ☆ WHITE STAR */ - { 0x0ae6, 0x2022 }, /* enfilledcircbullet • BULLET */ - { 0x0ae7, 0x25aa }, /* enfilledsqbullet ▪ BLACK SMALL SQUARE */ - { 0x0ae8, 0x25b2 }, /* filledtribulletup ▲ BLACK UP-POINTING TRIANGLE */ - { 0x0ae9, 0x25bc }, /* filledtribulletdown ▼ BLACK DOWN-POINTING TRIANGLE */ - { 0x0aea, 0x261c }, /* leftpointer ☜ WHITE LEFT POINTING INDEX */ - { 0x0aeb, 0x261e }, /* rightpointer ☞ WHITE RIGHT POINTING INDEX */ - { 0x0aec, 0x2663 }, /* club ♣ BLACK CLUB SUIT */ - { 0x0aed, 0x2666 }, /* diamond ♦ BLACK DIAMOND SUIT */ - { 0x0aee, 0x2665 }, /* heart ♥ BLACK HEART SUIT */ - { 0x0af0, 0x2720 }, /* maltesecross ✠ MALTESE CROSS */ - { 0x0af1, 0x2020 }, /* dagger † DAGGER */ - { 0x0af2, 0x2021 }, /* doubledagger ‡ DOUBLE DAGGER */ - { 0x0af3, 0x2713 }, /* checkmark ✓ CHECK MARK */ - { 0x0af4, 0x2717 }, /* ballotcross ✗ BALLOT X */ - { 0x0af5, 0x266f }, /* musicalsharp ♯ MUSIC SHARP SIGN */ - { 0x0af6, 0x266d }, /* musicalflat ♭ MUSIC FLAT SIGN */ - { 0x0af7, 0x2642 }, /* malesymbol ♂ MALE SIGN */ - { 0x0af8, 0x2640 }, /* femalesymbol ♀ FEMALE SIGN */ - { 0x0af9, 0x260e }, /* telephone ☎ BLACK TELEPHONE */ - { 0x0afa, 0x2315 }, /* telephonerecorder ⌕ TELEPHONE RECORDER */ - { 0x0afb, 0x2117 }, /* phonographcopyright ℗ SOUND RECORDING COPYRIGHT */ - { 0x0afc, 0x2038 }, /* caret ‸ CARET */ - { 0x0afd, 0x201a }, /* singlelowquotemark ‚ SINGLE LOW-9 QUOTATION MARK */ - { 0x0afe, 0x201e }, /* doublelowquotemark „ DOUBLE LOW-9 QUOTATION MARK */ -/* 0x0aff cursor ? ??? */ - { 0x0ba3, 0x003c }, /* leftcaret < LESS-THAN SIGN */ - { 0x0ba6, 0x003e }, /* rightcaret > GREATER-THAN SIGN */ - { 0x0ba8, 0x2228 }, /* downcaret ∨ LOGICAL OR */ - { 0x0ba9, 0x2227 }, /* upcaret ∧ LOGICAL AND */ - { 0x0bc0, 0x00af }, /* overbar ¯ MACRON */ - { 0x0bc2, 0x22a4 }, /* downtack ⊤ DOWN TACK */ - { 0x0bc3, 0x2229 }, /* upshoe ∩ INTERSECTION */ - { 0x0bc4, 0x230a }, /* downstile ⌊ LEFT FLOOR */ - { 0x0bc6, 0x005f }, /* underbar _ LOW LINE */ - { 0x0bca, 0x2218 }, /* jot ∘ RING OPERATOR */ - { 0x0bcc, 0x2395 }, /* quad ⎕ APL FUNCTIONAL SYMBOL QUAD (Unicode 3.0) */ - { 0x0bce, 0x22a5 }, /* uptack ⊥ UP TACK */ - { 0x0bcf, 0x25cb }, /* circle ○ WHITE CIRCLE */ - { 0x0bd3, 0x2308 }, /* upstile ⌈ LEFT CEILING */ - { 0x0bd6, 0x222a }, /* downshoe ∪ UNION */ - { 0x0bd8, 0x2283 }, /* rightshoe ⊃ SUPERSET OF */ - { 0x0bda, 0x2282 }, /* leftshoe ⊂ SUBSET OF */ - { 0x0bdc, 0x22a3 }, /* lefttack ⊣ LEFT TACK */ - { 0x0bfc, 0x22a2 }, /* righttack ⊢ RIGHT TACK */ - { 0x0cdf, 0x2017 }, /* hebrew_doublelowline ‗ DOUBLE LOW LINE */ - { 0x0ce0, 0x05d0 }, /* hebrew_aleph א HEBREW LETTER ALEF */ - { 0x0ce1, 0x05d1 }, /* hebrew_bet ב HEBREW LETTER BET */ - { 0x0ce2, 0x05d2 }, /* hebrew_gimel ג HEBREW LETTER GIMEL */ - { 0x0ce3, 0x05d3 }, /* hebrew_dalet ד HEBREW LETTER DALET */ - { 0x0ce4, 0x05d4 }, /* hebrew_he ה HEBREW LETTER HE */ - { 0x0ce5, 0x05d5 }, /* hebrew_waw ו HEBREW LETTER VAV */ - { 0x0ce6, 0x05d6 }, /* hebrew_zain ז HEBREW LETTER ZAYIN */ - { 0x0ce7, 0x05d7 }, /* hebrew_chet ח HEBREW LETTER HET */ - { 0x0ce8, 0x05d8 }, /* hebrew_tet ט HEBREW LETTER TET */ - { 0x0ce9, 0x05d9 }, /* hebrew_yod י HEBREW LETTER YOD */ - { 0x0cea, 0x05da }, /* hebrew_finalkaph ך HEBREW LETTER FINAL KAF */ - { 0x0ceb, 0x05db }, /* hebrew_kaph כ HEBREW LETTER KAF */ - { 0x0cec, 0x05dc }, /* hebrew_lamed ל HEBREW LETTER LAMED */ - { 0x0ced, 0x05dd }, /* hebrew_finalmem ם HEBREW LETTER FINAL MEM */ - { 0x0cee, 0x05de }, /* hebrew_mem מ HEBREW LETTER MEM */ - { 0x0cef, 0x05df }, /* hebrew_finalnun ן HEBREW LETTER FINAL NUN */ - { 0x0cf0, 0x05e0 }, /* hebrew_nun נ HEBREW LETTER NUN */ - { 0x0cf1, 0x05e1 }, /* hebrew_samech ס HEBREW LETTER SAMEKH */ - { 0x0cf2, 0x05e2 }, /* hebrew_ayin ע HEBREW LETTER AYIN */ - { 0x0cf3, 0x05e3 }, /* hebrew_finalpe ף HEBREW LETTER FINAL PE */ - { 0x0cf4, 0x05e4 }, /* hebrew_pe פ HEBREW LETTER PE */ - { 0x0cf5, 0x05e5 }, /* hebrew_finalzade ץ HEBREW LETTER FINAL TSADI */ - { 0x0cf6, 0x05e6 }, /* hebrew_zade צ HEBREW LETTER TSADI */ - { 0x0cf7, 0x05e7 }, /* hebrew_qoph ק HEBREW LETTER QOF */ - { 0x0cf8, 0x05e8 }, /* hebrew_resh ר HEBREW LETTER RESH */ - { 0x0cf9, 0x05e9 }, /* hebrew_shin ש HEBREW LETTER SHIN */ - { 0x0cfa, 0x05ea }, /* hebrew_taw ת HEBREW LETTER TAV */ - { 0x0da1, 0x0e01 }, /* Thai_kokai ก THAI CHARACTER KO KAI */ - { 0x0da2, 0x0e02 }, /* Thai_khokhai ข THAI CHARACTER KHO KHAI */ - { 0x0da3, 0x0e03 }, /* Thai_khokhuat ฃ THAI CHARACTER KHO KHUAT */ - { 0x0da4, 0x0e04 }, /* Thai_khokhwai ค THAI CHARACTER KHO KHWAI */ - { 0x0da5, 0x0e05 }, /* Thai_khokhon ฅ THAI CHARACTER KHO KHON */ - { 0x0da6, 0x0e06 }, /* Thai_khorakhang ฆ THAI CHARACTER KHO RAKHANG */ - { 0x0da7, 0x0e07 }, /* Thai_ngongu ง THAI CHARACTER NGO NGU */ - { 0x0da8, 0x0e08 }, /* Thai_chochan จ THAI CHARACTER CHO CHAN */ - { 0x0da9, 0x0e09 }, /* Thai_choching ฉ THAI CHARACTER CHO CHING */ - { 0x0daa, 0x0e0a }, /* Thai_chochang ช THAI CHARACTER CHO CHANG */ - { 0x0dab, 0x0e0b }, /* Thai_soso ซ THAI CHARACTER SO SO */ - { 0x0dac, 0x0e0c }, /* Thai_chochoe ฌ THAI CHARACTER CHO CHOE */ - { 0x0dad, 0x0e0d }, /* Thai_yoying ญ THAI CHARACTER YO YING */ - { 0x0dae, 0x0e0e }, /* Thai_dochada ฎ THAI CHARACTER DO CHADA */ - { 0x0daf, 0x0e0f }, /* Thai_topatak ฏ THAI CHARACTER TO PATAK */ - { 0x0db0, 0x0e10 }, /* Thai_thothan ฐ THAI CHARACTER THO THAN */ - { 0x0db1, 0x0e11 }, /* Thai_thonangmontho ฑ THAI CHARACTER THO NANGMONTHO */ - { 0x0db2, 0x0e12 }, /* Thai_thophuthao ฒ THAI CHARACTER THO PHUTHAO */ - { 0x0db3, 0x0e13 }, /* Thai_nonen ณ THAI CHARACTER NO NEN */ - { 0x0db4, 0x0e14 }, /* Thai_dodek ด THAI CHARACTER DO DEK */ - { 0x0db5, 0x0e15 }, /* Thai_totao ต THAI CHARACTER TO TAO */ - { 0x0db6, 0x0e16 }, /* Thai_thothung ถ THAI CHARACTER THO THUNG */ - { 0x0db7, 0x0e17 }, /* Thai_thothahan ท THAI CHARACTER THO THAHAN */ - { 0x0db8, 0x0e18 }, /* Thai_thothong ธ THAI CHARACTER THO THONG */ - { 0x0db9, 0x0e19 }, /* Thai_nonu น THAI CHARACTER NO NU */ - { 0x0dba, 0x0e1a }, /* Thai_bobaimai บ THAI CHARACTER BO BAIMAI */ - { 0x0dbb, 0x0e1b }, /* Thai_popla ป THAI CHARACTER PO PLA */ - { 0x0dbc, 0x0e1c }, /* Thai_phophung ผ THAI CHARACTER PHO PHUNG */ - { 0x0dbd, 0x0e1d }, /* Thai_fofa ฝ THAI CHARACTER FO FA */ - { 0x0dbe, 0x0e1e }, /* Thai_phophan พ THAI CHARACTER PHO PHAN */ - { 0x0dbf, 0x0e1f }, /* Thai_fofan ฟ THAI CHARACTER FO FAN */ - { 0x0dc0, 0x0e20 }, /* Thai_phosamphao ภ THAI CHARACTER PHO SAMPHAO */ - { 0x0dc1, 0x0e21 }, /* Thai_moma ม THAI CHARACTER MO MA */ - { 0x0dc2, 0x0e22 }, /* Thai_yoyak ย THAI CHARACTER YO YAK */ - { 0x0dc3, 0x0e23 }, /* Thai_rorua ร THAI CHARACTER RO RUA */ - { 0x0dc4, 0x0e24 }, /* Thai_ru ฤ THAI CHARACTER RU */ - { 0x0dc5, 0x0e25 }, /* Thai_loling ล THAI CHARACTER LO LING */ - { 0x0dc6, 0x0e26 }, /* Thai_lu ฦ THAI CHARACTER LU */ - { 0x0dc7, 0x0e27 }, /* Thai_wowaen ว THAI CHARACTER WO WAEN */ - { 0x0dc8, 0x0e28 }, /* Thai_sosala ศ THAI CHARACTER SO SALA */ - { 0x0dc9, 0x0e29 }, /* Thai_sorusi ษ THAI CHARACTER SO RUSI */ - { 0x0dca, 0x0e2a }, /* Thai_sosua ส THAI CHARACTER SO SUA */ - { 0x0dcb, 0x0e2b }, /* Thai_hohip ห THAI CHARACTER HO HIP */ - { 0x0dcc, 0x0e2c }, /* Thai_lochula ฬ THAI CHARACTER LO CHULA */ - { 0x0dcd, 0x0e2d }, /* Thai_oang อ THAI CHARACTER O ANG */ - { 0x0dce, 0x0e2e }, /* Thai_honokhuk ฮ THAI CHARACTER HO NOKHUK */ - { 0x0dcf, 0x0e2f }, /* Thai_paiyannoi ฯ THAI CHARACTER PAIYANNOI */ - { 0x0dd0, 0x0e30 }, /* Thai_saraa ะ THAI CHARACTER SARA A */ - { 0x0dd1, 0x0e31 }, /* Thai_maihanakat ั THAI CHARACTER MAI HAN-AKAT */ - { 0x0dd2, 0x0e32 }, /* Thai_saraaa า THAI CHARACTER SARA AA */ - { 0x0dd3, 0x0e33 }, /* Thai_saraam ำ THAI CHARACTER SARA AM */ - { 0x0dd4, 0x0e34 }, /* Thai_sarai ิ THAI CHARACTER SARA I */ - { 0x0dd5, 0x0e35 }, /* Thai_saraii ี THAI CHARACTER SARA II */ - { 0x0dd6, 0x0e36 }, /* Thai_saraue ึ THAI CHARACTER SARA UE */ - { 0x0dd7, 0x0e37 }, /* Thai_sarauee ื THAI CHARACTER SARA UEE */ - { 0x0dd8, 0x0e38 }, /* Thai_sarau ุ THAI CHARACTER SARA U */ - { 0x0dd9, 0x0e39 }, /* Thai_sarauu ู THAI CHARACTER SARA UU */ - { 0x0dda, 0x0e3a }, /* Thai_phinthu ฺ THAI CHARACTER PHINTHU */ - { 0x0dde, 0x0e3e }, /* Thai_maihanakat_maitho ??? */ - { 0x0ddf, 0x0e3f }, /* Thai_baht ฿ THAI CURRENCY SYMBOL BAHT */ - { 0x0de0, 0x0e40 }, /* Thai_sarae เ THAI CHARACTER SARA E */ - { 0x0de1, 0x0e41 }, /* Thai_saraae แ THAI CHARACTER SARA AE */ - { 0x0de2, 0x0e42 }, /* Thai_sarao โ THAI CHARACTER SARA O */ - { 0x0de3, 0x0e43 }, /* Thai_saraaimaimuan ใ THAI CHARACTER SARA AI MAIMUAN */ - { 0x0de4, 0x0e44 }, /* Thai_saraaimaimalai ไ THAI CHARACTER SARA AI MAIMALAI */ - { 0x0de5, 0x0e45 }, /* Thai_lakkhangyao ๅ THAI CHARACTER LAKKHANGYAO */ - { 0x0de6, 0x0e46 }, /* Thai_maiyamok ๆ THAI CHARACTER MAIYAMOK */ - { 0x0de7, 0x0e47 }, /* Thai_maitaikhu ็ THAI CHARACTER MAITAIKHU */ - { 0x0de8, 0x0e48 }, /* Thai_maiek ่ THAI CHARACTER MAI EK */ - { 0x0de9, 0x0e49 }, /* Thai_maitho ้ THAI CHARACTER MAI THO */ - { 0x0dea, 0x0e4a }, /* Thai_maitri ๊ THAI CHARACTER MAI TRI */ - { 0x0deb, 0x0e4b }, /* Thai_maichattawa ๋ THAI CHARACTER MAI CHATTAWA */ - { 0x0dec, 0x0e4c }, /* Thai_thanthakhat ์ THAI CHARACTER THANTHAKHAT */ - { 0x0ded, 0x0e4d }, /* Thai_nikhahit ํ THAI CHARACTER NIKHAHIT */ - { 0x0df0, 0x0e50 }, /* Thai_leksun ๐ THAI DIGIT ZERO */ - { 0x0df1, 0x0e51 }, /* Thai_leknung ๑ THAI DIGIT ONE */ - { 0x0df2, 0x0e52 }, /* Thai_leksong ๒ THAI DIGIT TWO */ - { 0x0df3, 0x0e53 }, /* Thai_leksam ๓ THAI DIGIT THREE */ - { 0x0df4, 0x0e54 }, /* Thai_leksi ๔ THAI DIGIT FOUR */ - { 0x0df5, 0x0e55 }, /* Thai_lekha ๕ THAI DIGIT FIVE */ - { 0x0df6, 0x0e56 }, /* Thai_lekhok ๖ THAI DIGIT SIX */ - { 0x0df7, 0x0e57 }, /* Thai_lekchet ๗ THAI DIGIT SEVEN */ - { 0x0df8, 0x0e58 }, /* Thai_lekpaet ๘ THAI DIGIT EIGHT */ - { 0x0df9, 0x0e59 }, /* Thai_lekkao ๙ THAI DIGIT NINE */ - { 0x0ea1, 0x3131 }, /* Hangul_Kiyeog ㄱ HANGUL LETTER KIYEOK */ - { 0x0ea2, 0x3132 }, /* Hangul_SsangKiyeog ㄲ HANGUL LETTER SSANGKIYEOK */ - { 0x0ea3, 0x3133 }, /* Hangul_KiyeogSios ㄳ HANGUL LETTER KIYEOK-SIOS */ - { 0x0ea4, 0x3134 }, /* Hangul_Nieun ㄴ HANGUL LETTER NIEUN */ - { 0x0ea5, 0x3135 }, /* Hangul_NieunJieuj ㄵ HANGUL LETTER NIEUN-CIEUC */ - { 0x0ea6, 0x3136 }, /* Hangul_NieunHieuh ㄶ HANGUL LETTER NIEUN-HIEUH */ - { 0x0ea7, 0x3137 }, /* Hangul_Dikeud ㄷ HANGUL LETTER TIKEUT */ - { 0x0ea8, 0x3138 }, /* Hangul_SsangDikeud ㄸ HANGUL LETTER SSANGTIKEUT */ - { 0x0ea9, 0x3139 }, /* Hangul_Rieul ㄹ HANGUL LETTER RIEUL */ - { 0x0eaa, 0x313a }, /* Hangul_RieulKiyeog ㄺ HANGUL LETTER RIEUL-KIYEOK */ - { 0x0eab, 0x313b }, /* Hangul_RieulMieum ㄻ HANGUL LETTER RIEUL-MIEUM */ - { 0x0eac, 0x313c }, /* Hangul_RieulPieub ㄼ HANGUL LETTER RIEUL-PIEUP */ - { 0x0ead, 0x313d }, /* Hangul_RieulSios ㄽ HANGUL LETTER RIEUL-SIOS */ - { 0x0eae, 0x313e }, /* Hangul_RieulTieut ㄾ HANGUL LETTER RIEUL-THIEUTH */ - { 0x0eaf, 0x313f }, /* Hangul_RieulPhieuf ㄿ HANGUL LETTER RIEUL-PHIEUPH */ - { 0x0eb0, 0x3140 }, /* Hangul_RieulHieuh ㅀ HANGUL LETTER RIEUL-HIEUH */ - { 0x0eb1, 0x3141 }, /* Hangul_Mieum ㅁ HANGUL LETTER MIEUM */ - { 0x0eb2, 0x3142 }, /* Hangul_Pieub ㅂ HANGUL LETTER PIEUP */ - { 0x0eb3, 0x3143 }, /* Hangul_SsangPieub ㅃ HANGUL LETTER SSANGPIEUP */ - { 0x0eb4, 0x3144 }, /* Hangul_PieubSios ㅄ HANGUL LETTER PIEUP-SIOS */ - { 0x0eb5, 0x3145 }, /* Hangul_Sios ㅅ HANGUL LETTER SIOS */ - { 0x0eb6, 0x3146 }, /* Hangul_SsangSios ㅆ HANGUL LETTER SSANGSIOS */ - { 0x0eb7, 0x3147 }, /* Hangul_Ieung ㅇ HANGUL LETTER IEUNG */ - { 0x0eb8, 0x3148 }, /* Hangul_Jieuj ㅈ HANGUL LETTER CIEUC */ - { 0x0eb9, 0x3149 }, /* Hangul_SsangJieuj ㅉ HANGUL LETTER SSANGCIEUC */ - { 0x0eba, 0x314a }, /* Hangul_Cieuc ㅊ HANGUL LETTER CHIEUCH */ - { 0x0ebb, 0x314b }, /* Hangul_Khieuq ㅋ HANGUL LETTER KHIEUKH */ - { 0x0ebc, 0x314c }, /* Hangul_Tieut ㅌ HANGUL LETTER THIEUTH */ - { 0x0ebd, 0x314d }, /* Hangul_Phieuf ㅍ HANGUL LETTER PHIEUPH */ - { 0x0ebe, 0x314e }, /* Hangul_Hieuh ㅎ HANGUL LETTER HIEUH */ - { 0x0ebf, 0x314f }, /* Hangul_A ㅏ HANGUL LETTER A */ - { 0x0ec0, 0x3150 }, /* Hangul_AE ㅐ HANGUL LETTER AE */ - { 0x0ec1, 0x3151 }, /* Hangul_YA ㅑ HANGUL LETTER YA */ - { 0x0ec2, 0x3152 }, /* Hangul_YAE ㅒ HANGUL LETTER YAE */ - { 0x0ec3, 0x3153 }, /* Hangul_EO ㅓ HANGUL LETTER EO */ - { 0x0ec4, 0x3154 }, /* Hangul_E ㅔ HANGUL LETTER E */ - { 0x0ec5, 0x3155 }, /* Hangul_YEO ㅕ HANGUL LETTER YEO */ - { 0x0ec6, 0x3156 }, /* Hangul_YE ㅖ HANGUL LETTER YE */ - { 0x0ec7, 0x3157 }, /* Hangul_O ㅗ HANGUL LETTER O */ - { 0x0ec8, 0x3158 }, /* Hangul_WA ㅘ HANGUL LETTER WA */ - { 0x0ec9, 0x3159 }, /* Hangul_WAE ㅙ HANGUL LETTER WAE */ - { 0x0eca, 0x315a }, /* Hangul_OE ㅚ HANGUL LETTER OE */ - { 0x0ecb, 0x315b }, /* Hangul_YO ㅛ HANGUL LETTER YO */ - { 0x0ecc, 0x315c }, /* Hangul_U ㅜ HANGUL LETTER U */ - { 0x0ecd, 0x315d }, /* Hangul_WEO ㅝ HANGUL LETTER WEO */ - { 0x0ece, 0x315e }, /* Hangul_WE ㅞ HANGUL LETTER WE */ - { 0x0ecf, 0x315f }, /* Hangul_WI ㅟ HANGUL LETTER WI */ - { 0x0ed0, 0x3160 }, /* Hangul_YU ㅠ HANGUL LETTER YU */ - { 0x0ed1, 0x3161 }, /* Hangul_EU ㅡ HANGUL LETTER EU */ - { 0x0ed2, 0x3162 }, /* Hangul_YI ㅢ HANGUL LETTER YI */ - { 0x0ed3, 0x3163 }, /* Hangul_I ㅣ HANGUL LETTER I */ - { 0x0ed4, 0x11a8 }, /* Hangul_J_Kiyeog ᆨ HANGUL JONGSEONG KIYEOK */ - { 0x0ed5, 0x11a9 }, /* Hangul_J_SsangKiyeog ᆩ HANGUL JONGSEONG SSANGKIYEOK */ - { 0x0ed6, 0x11aa }, /* Hangul_J_KiyeogSios ᆪ HANGUL JONGSEONG KIYEOK-SIOS */ - { 0x0ed7, 0x11ab }, /* Hangul_J_Nieun ᆫ HANGUL JONGSEONG NIEUN */ - { 0x0ed8, 0x11ac }, /* Hangul_J_NieunJieuj ᆬ HANGUL JONGSEONG NIEUN-CIEUC */ - { 0x0ed9, 0x11ad }, /* Hangul_J_NieunHieuh ᆭ HANGUL JONGSEONG NIEUN-HIEUH */ - { 0x0eda, 0x11ae }, /* Hangul_J_Dikeud ᆮ HANGUL JONGSEONG TIKEUT */ - { 0x0edb, 0x11af }, /* Hangul_J_Rieul ᆯ HANGUL JONGSEONG RIEUL */ - { 0x0edc, 0x11b0 }, /* Hangul_J_RieulKiyeog ᆰ HANGUL JONGSEONG RIEUL-KIYEOK */ - { 0x0edd, 0x11b1 }, /* Hangul_J_RieulMieum ᆱ HANGUL JONGSEONG RIEUL-MIEUM */ - { 0x0ede, 0x11b2 }, /* Hangul_J_RieulPieub ᆲ HANGUL JONGSEONG RIEUL-PIEUP */ - { 0x0edf, 0x11b3 }, /* Hangul_J_RieulSios ᆳ HANGUL JONGSEONG RIEUL-SIOS */ - { 0x0ee0, 0x11b4 }, /* Hangul_J_RieulTieut ᆴ HANGUL JONGSEONG RIEUL-THIEUTH */ - { 0x0ee1, 0x11b5 }, /* Hangul_J_RieulPhieuf ᆵ HANGUL JONGSEONG RIEUL-PHIEUPH */ - { 0x0ee2, 0x11b6 }, /* Hangul_J_RieulHieuh ᆶ HANGUL JONGSEONG RIEUL-HIEUH */ - { 0x0ee3, 0x11b7 }, /* Hangul_J_Mieum ᆷ HANGUL JONGSEONG MIEUM */ - { 0x0ee4, 0x11b8 }, /* Hangul_J_Pieub ᆸ HANGUL JONGSEONG PIEUP */ - { 0x0ee5, 0x11b9 }, /* Hangul_J_PieubSios ᆹ HANGUL JONGSEONG PIEUP-SIOS */ - { 0x0ee6, 0x11ba }, /* Hangul_J_Sios ᆺ HANGUL JONGSEONG SIOS */ - { 0x0ee7, 0x11bb }, /* Hangul_J_SsangSios ᆻ HANGUL JONGSEONG SSANGSIOS */ - { 0x0ee8, 0x11bc }, /* Hangul_J_Ieung ᆼ HANGUL JONGSEONG IEUNG */ - { 0x0ee9, 0x11bd }, /* Hangul_J_Jieuj ᆽ HANGUL JONGSEONG CIEUC */ - { 0x0eea, 0x11be }, /* Hangul_J_Cieuc ᆾ HANGUL JONGSEONG CHIEUCH */ - { 0x0eeb, 0x11bf }, /* Hangul_J_Khieuq ᆿ HANGUL JONGSEONG KHIEUKH */ - { 0x0eec, 0x11c0 }, /* Hangul_J_Tieut ᇀ HANGUL JONGSEONG THIEUTH */ - { 0x0eed, 0x11c1 }, /* Hangul_J_Phieuf ᇁ HANGUL JONGSEONG PHIEUPH */ - { 0x0eee, 0x11c2 }, /* Hangul_J_Hieuh ᇂ HANGUL JONGSEONG HIEUH */ - { 0x0eef, 0x316d }, /* Hangul_RieulYeorinHieuh ㅭ HANGUL LETTER RIEUL-YEORINHIEUH */ - { 0x0ef0, 0x3171 }, /* Hangul_SunkyeongeumMieum ㅱ HANGUL LETTER KAPYEOUNMIEUM */ - { 0x0ef1, 0x3178 }, /* Hangul_SunkyeongeumPieub ㅸ HANGUL LETTER KAPYEOUNPIEUP */ - { 0x0ef2, 0x317f }, /* Hangul_PanSios ㅿ HANGUL LETTER PANSIOS */ -/* 0x0ef3 Hangul_KkogjiDalrinIeung ? ??? */ - { 0x0ef4, 0x3184 }, /* Hangul_SunkyeongeumPhieuf ㆄ HANGUL LETTER KAPYEOUNPHIEUPH */ - { 0x0ef5, 0x3186 }, /* Hangul_YeorinHieuh ㆆ HANGUL LETTER YEORINHIEUH */ - { 0x0ef6, 0x318d }, /* Hangul_AraeA ㆍ HANGUL LETTER ARAEA */ - { 0x0ef7, 0x318e }, /* Hangul_AraeAE ㆎ HANGUL LETTER ARAEAE */ - { 0x0ef8, 0x11eb }, /* Hangul_J_PanSios ᇫ HANGUL JONGSEONG PANSIOS */ -/* 0x0ef9 Hangul_J_KkogjiDalrinIeung ? ??? */ - { 0x0efa, 0x11f9 }, /* Hangul_J_YeorinHieuh ᇹ HANGUL JONGSEONG YEORINHIEUH */ - { 0x0eff, 0x20a9 }, /* Korean_Won ₩ WON SIGN */ - { 0x13bc, 0x0152 }, /* OE Œ LATIN CAPITAL LIGATURE OE */ - { 0x13bd, 0x0153 }, /* oe œ LATIN SMALL LIGATURE OE */ - { 0x13be, 0x0178 }, /* Ydiaeresis Ÿ LATIN CAPITAL LETTER Y WITH DIAERESIS */ - { 0x20a0, 0x20a0 }, /* EcuSign ₠ EURO-CURRENCY SIGN */ - { 0x20a1, 0x20a1 }, /* ColonSign ₡ COLON SIGN */ - { 0x20a2, 0x20a2 }, /* CruzeiroSign ₢ CRUZEIRO SIGN */ - { 0x20a3, 0x20a3 }, /* FFrancSign ₣ FRENCH FRANC SIGN */ - { 0x20a4, 0x20a4 }, /* LiraSign ₤ LIRA SIGN */ - { 0x20a5, 0x20a5 }, /* MillSign ₥ MILL SIGN */ - { 0x20a6, 0x20a6 }, /* NairaSign ₦ NAIRA SIGN */ - { 0x20a7, 0x20a7 }, /* PesetaSign ₧ PESETA SIGN */ - { 0x20a8, 0x20a8 }, /* RupeeSign ₨ RUPEE SIGN */ - { 0x20a9, 0x20a9 }, /* WonSign ₩ WON SIGN */ - { 0x20aa, 0x20aa }, /* NewSheqelSign ₪ NEW SHEQEL SIGN */ - { 0x20ab, 0x20ab }, /* DongSign ₫ DONG SIGN */ - { 0x20ac, 0x20ac }, /* EuroSign € EURO SIGN */ -}; - -/** - * gdk_keyval_to_unicode: - * @keysym: a GDK key symbol - * - * Convert from a GDK key symbol to the corresponding ISO10646 (Unicode) - * character. - * - * Return value: the corresponding unicode character, or 0 if there - * is no corresponding character. - **/ - -guint32 -gdk_keyval_to_unicode (guint keysym) -{ - int min = 0; - int max = sizeof (gdk_keysym_to_unicode_tab) / sizeof (gdk_keysym_to_unicode_tab[0]) - 1; - int mid; - - /* First check for Latin-1 characters (1:1 mapping) */ - if ((keysym >= 0x0020 && keysym <= 0x007e) || - (keysym >= 0x00a0 && keysym <= 0x00ff)) - return keysym; - - /* Also check for directly encoded 24-bit UCS characters: - */ - if ((keysym & 0xff000000) == 0x01000000) - return keysym & 0x00ffffff; - - /* binary search in table */ - while (max >= min) { - mid = (min + max) / 2; - if (gdk_keysym_to_unicode_tab[mid].keysym < keysym) - min = mid + 1; - else if (gdk_keysym_to_unicode_tab[mid].keysym > keysym) - max = mid - 1; - else { - /* found it */ - return gdk_keysym_to_unicode_tab[mid].ucs; - } - } - - /* No matching Unicode value found */ - return 0; -} - -/* - * Canonical decomposition - * - * It is copied here from libunicode, because we do not want malloc - * - */ - -typedef struct -{ - unsigned short ch; - unsigned char *expansion; -} e_decomposition; - -static e_decomposition e_decomp_table[] = -{ - { 0x00c0, "\x00\x41\x03\x00\0" }, - { 0x00c1, "\x00\x41\x03\x01\0" }, - { 0x00c2, "\x00\x41\x03\x02\0" }, - { 0x00c3, "\x00\x41\x03\x03\0" }, - { 0x00c4, "\x00\x41\x03\x08\0" }, - { 0x00c5, "\x00\x41\x03\x0a\0" }, - { 0x00c7, "\x00\x43\x03\x27\0" }, - { 0x00c8, "\x00\x45\x03\x00\0" }, - { 0x00c9, "\x00\x45\x03\x01\0" }, - { 0x00ca, "\x00\x45\x03\x02\0" }, - { 0x00cb, "\x00\x45\x03\x08\0" }, - { 0x00cc, "\x00\x49\x03\x00\0" }, - { 0x00cd, "\x00\x49\x03\x01\0" }, - { 0x00ce, "\x00\x49\x03\x02\0" }, - { 0x00cf, "\x00\x49\x03\x08\0" }, - { 0x00d1, "\x00\x4e\x03\x03\0" }, - { 0x00d2, "\x00\x4f\x03\x00\0" }, - { 0x00d3, "\x00\x4f\x03\x01\0" }, - { 0x00d4, "\x00\x4f\x03\x02\0" }, - { 0x00d5, "\x00\x4f\x03\x03\0" }, - { 0x00d6, "\x00\x4f\x03\x08\0" }, - { 0x00d9, "\x00\x55\x03\x00\0" }, - { 0x00da, "\x00\x55\x03\x01\0" }, - { 0x00db, "\x00\x55\x03\x02\0" }, - { 0x00dc, "\x00\x55\x03\x08\0" }, - { 0x00dd, "\x00\x59\x03\x01\0" }, - { 0x00e0, "\x00\x61\x03\x00\0" }, - { 0x00e1, "\x00\x61\x03\x01\0" }, - { 0x00e2, "\x00\x61\x03\x02\0" }, - { 0x00e3, "\x00\x61\x03\x03\0" }, - { 0x00e4, "\x00\x61\x03\x08\0" }, - { 0x00e5, "\x00\x61\x03\x0a\0" }, - { 0x00e7, "\x00\x63\x03\x27\0" }, - { 0x00e8, "\x00\x65\x03\x00\0" }, - { 0x00e9, "\x00\x65\x03\x01\0" }, - { 0x00ea, "\x00\x65\x03\x02\0" }, - { 0x00eb, "\x00\x65\x03\x08\0" }, - { 0x00ec, "\x00\x69\x03\x00\0" }, - { 0x00ed, "\x00\x69\x03\x01\0" }, - { 0x00ee, "\x00\x69\x03\x02\0" }, - { 0x00ef, "\x00\x69\x03\x08\0" }, - { 0x00f1, "\x00\x6e\x03\x03\0" }, - { 0x00f2, "\x00\x6f\x03\x00\0" }, - { 0x00f3, "\x00\x6f\x03\x01\0" }, - { 0x00f4, "\x00\x6f\x03\x02\0" }, - { 0x00f5, "\x00\x6f\x03\x03\0" }, - { 0x00f6, "\x00\x6f\x03\x08\0" }, - { 0x00f9, "\x00\x75\x03\x00\0" }, - { 0x00fa, "\x00\x75\x03\x01\0" }, - { 0x00fb, "\x00\x75\x03\x02\0" }, - { 0x00fc, "\x00\x75\x03\x08\0" }, - { 0x00fd, "\x00\x79\x03\x01\0" }, - { 0x00ff, "\x00\x79\x03\x08\0" }, - { 0x0100, "\x00\x41\x03\x04\0" }, - { 0x0101, "\x00\x61\x03\x04\0" }, - { 0x0102, "\x00\x41\x03\x06\0" }, - { 0x0103, "\x00\x61\x03\x06\0" }, - { 0x0104, "\x00\x41\x03\x28\0" }, - { 0x0105, "\x00\x61\x03\x28\0" }, - { 0x0106, "\x00\x43\x03\x01\0" }, - { 0x0107, "\x00\x63\x03\x01\0" }, - { 0x0108, "\x00\x43\x03\x02\0" }, - { 0x0109, "\x00\x63\x03\x02\0" }, - { 0x010a, "\x00\x43\x03\x07\0" }, - { 0x010b, "\x00\x63\x03\x07\0" }, - { 0x010c, "\x00\x43\x03\x0c\0" }, - { 0x010d, "\x00\x63\x03\x0c\0" }, - { 0x010e, "\x00\x44\x03\x0c\0" }, - { 0x010f, "\x00\x64\x03\x0c\0" }, - { 0x0112, "\x00\x45\x03\x04\0" }, - { 0x0113, "\x00\x65\x03\x04\0" }, - { 0x0114, "\x00\x45\x03\x06\0" }, - { 0x0115, "\x00\x65\x03\x06\0" }, - { 0x0116, "\x00\x45\x03\x07\0" }, - { 0x0117, "\x00\x65\x03\x07\0" }, - { 0x0118, "\x00\x45\x03\x28\0" }, - { 0x0119, "\x00\x65\x03\x28\0" }, - { 0x011a, "\x00\x45\x03\x0c\0" }, - { 0x011b, "\x00\x65\x03\x0c\0" }, - { 0x011c, "\x00\x47\x03\x02\0" }, - { 0x011d, "\x00\x67\x03\x02\0" }, - { 0x011e, "\x00\x47\x03\x06\0" }, - { 0x011f, "\x00\x67\x03\x06\0" }, - { 0x0120, "\x00\x47\x03\x07\0" }, - { 0x0121, "\x00\x67\x03\x07\0" }, - { 0x0122, "\x00\x47\x03\x27\0" }, - { 0x0123, "\x00\x67\x03\x27\0" }, - { 0x0124, "\x00\x48\x03\x02\0" }, - { 0x0125, "\x00\x68\x03\x02\0" }, - { 0x0128, "\x00\x49\x03\x03\0" }, - { 0x0129, "\x00\x69\x03\x03\0" }, - { 0x012a, "\x00\x49\x03\x04\0" }, - { 0x012b, "\x00\x69\x03\x04\0" }, - { 0x012c, "\x00\x49\x03\x06\0" }, - { 0x012d, "\x00\x69\x03\x06\0" }, - { 0x012e, "\x00\x49\x03\x28\0" }, - { 0x012f, "\x00\x69\x03\x28\0" }, - { 0x0130, "\x00\x49\x03\x07\0" }, - { 0x0134, "\x00\x4a\x03\x02\0" }, - { 0x0135, "\x00\x6a\x03\x02\0" }, - { 0x0136, "\x00\x4b\x03\x27\0" }, - { 0x0137, "\x00\x6b\x03\x27\0" }, - { 0x0139, "\x00\x4c\x03\x01\0" }, - { 0x013a, "\x00\x6c\x03\x01\0" }, - { 0x013b, "\x00\x4c\x03\x27\0" }, - { 0x013c, "\x00\x6c\x03\x27\0" }, - { 0x013d, "\x00\x4c\x03\x0c\0" }, - { 0x013e, "\x00\x6c\x03\x0c\0" }, - { 0x0143, "\x00\x4e\x03\x01\0" }, - { 0x0144, "\x00\x6e\x03\x01\0" }, - { 0x0145, "\x00\x4e\x03\x27\0" }, - { 0x0146, "\x00\x6e\x03\x27\0" }, - { 0x0147, "\x00\x4e\x03\x0c\0" }, - { 0x0148, "\x00\x6e\x03\x0c\0" }, - { 0x014c, "\x00\x4f\x03\x04\0" }, - { 0x014d, "\x00\x6f\x03\x04\0" }, - { 0x014e, "\x00\x4f\x03\x06\0" }, - { 0x014f, "\x00\x6f\x03\x06\0" }, - { 0x0150, "\x00\x4f\x03\x0b\0" }, - { 0x0151, "\x00\x6f\x03\x0b\0" }, - { 0x0154, "\x00\x52\x03\x01\0" }, - { 0x0155, "\x00\x72\x03\x01\0" }, - { 0x0156, "\x00\x52\x03\x27\0" }, - { 0x0157, "\x00\x72\x03\x27\0" }, - { 0x0158, "\x00\x52\x03\x0c\0" }, - { 0x0159, "\x00\x72\x03\x0c\0" }, - { 0x015a, "\x00\x53\x03\x01\0" }, - { 0x015b, "\x00\x73\x03\x01\0" }, - { 0x015c, "\x00\x53\x03\x02\0" }, - { 0x015d, "\x00\x73\x03\x02\0" }, - { 0x015e, "\x00\x53\x03\x27\0" }, - { 0x015f, "\x00\x73\x03\x27\0" }, - { 0x0160, "\x00\x53\x03\x0c\0" }, - { 0x0161, "\x00\x73\x03\x0c\0" }, - { 0x0162, "\x00\x54\x03\x27\0" }, - { 0x0163, "\x00\x74\x03\x27\0" }, - { 0x0164, "\x00\x54\x03\x0c\0" }, - { 0x0165, "\x00\x74\x03\x0c\0" }, - { 0x0168, "\x00\x55\x03\x03\0" }, - { 0x0169, "\x00\x75\x03\x03\0" }, - { 0x016a, "\x00\x55\x03\x04\0" }, - { 0x016b, "\x00\x75\x03\x04\0" }, - { 0x016c, "\x00\x55\x03\x06\0" }, - { 0x016d, "\x00\x75\x03\x06\0" }, - { 0x016e, "\x00\x55\x03\x0a\0" }, - { 0x016f, "\x00\x75\x03\x0a\0" }, - { 0x0170, "\x00\x55\x03\x0b\0" }, - { 0x0171, "\x00\x75\x03\x0b\0" }, - { 0x0172, "\x00\x55\x03\x28\0" }, - { 0x0173, "\x00\x75\x03\x28\0" }, - { 0x0174, "\x00\x57\x03\x02\0" }, - { 0x0175, "\x00\x77\x03\x02\0" }, - { 0x0176, "\x00\x59\x03\x02\0" }, - { 0x0177, "\x00\x79\x03\x02\0" }, - { 0x0178, "\x00\x59\x03\x08\0" }, - { 0x0179, "\x00\x5a\x03\x01\0" }, - { 0x017a, "\x00\x7a\x03\x01\0" }, - { 0x017b, "\x00\x5a\x03\x07\0" }, - { 0x017c, "\x00\x7a\x03\x07\0" }, - { 0x017d, "\x00\x5a\x03\x0c\0" }, - { 0x017e, "\x00\x7a\x03\x0c\0" }, - { 0x01a0, "\x00\x4f\x03\x1b\0" }, - { 0x01a1, "\x00\x6f\x03\x1b\0" }, - { 0x01af, "\x00\x55\x03\x1b\0" }, - { 0x01b0, "\x00\x75\x03\x1b\0" }, - { 0x01cd, "\x00\x41\x03\x0c\0" }, - { 0x01ce, "\x00\x61\x03\x0c\0" }, - { 0x01cf, "\x00\x49\x03\x0c\0" }, - { 0x01d0, "\x00\x69\x03\x0c\0" }, - { 0x01d1, "\x00\x4f\x03\x0c\0" }, - { 0x01d2, "\x00\x6f\x03\x0c\0" }, - { 0x01d3, "\x00\x55\x03\x0c\0" }, - { 0x01d4, "\x00\x75\x03\x0c\0" }, - { 0x01d5, "\x00\x55\x03\x08\x03\x04\0" }, - { 0x01d6, "\x00\x75\x03\x08\x03\x04\0" }, - { 0x01d7, "\x00\x55\x03\x08\x03\x01\0" }, - { 0x01d8, "\x00\x75\x03\x08\x03\x01\0" }, - { 0x01d9, "\x00\x55\x03\x08\x03\x0c\0" }, - { 0x01da, "\x00\x75\x03\x08\x03\x0c\0" }, - { 0x01db, "\x00\x55\x03\x08\x03\x00\0" }, - { 0x01dc, "\x00\x75\x03\x08\x03\x00\0" }, - { 0x01de, "\x00\x41\x03\x08\x03\x04\0" }, - { 0x01df, "\x00\x61\x03\x08\x03\x04\0" }, - { 0x01e0, "\x00\x41\x03\x07\x03\x04\0" }, - { 0x01e1, "\x00\x61\x03\x07\x03\x04\0" }, - { 0x01e2, "\x00\xc6\x03\x04\0" }, - { 0x01e3, "\x00\xe6\x03\x04\0" }, - { 0x01e6, "\x00\x47\x03\x0c\0" }, - { 0x01e7, "\x00\x67\x03\x0c\0" }, - { 0x01e8, "\x00\x4b\x03\x0c\0" }, - { 0x01e9, "\x00\x6b\x03\x0c\0" }, - { 0x01ea, "\x00\x4f\x03\x28\0" }, - { 0x01eb, "\x00\x6f\x03\x28\0" }, - { 0x01ec, "\x00\x4f\x03\x28\x03\x04\0" }, - { 0x01ed, "\x00\x6f\x03\x28\x03\x04\0" }, - { 0x01ee, "\x01\xb7\x03\x0c\0" }, - { 0x01ef, "\x02\x92\x03\x0c\0" }, - { 0x01f0, "\x00\x6a\x03\x0c\0" }, - { 0x01f4, "\x00\x47\x03\x01\0" }, - { 0x01f5, "\x00\x67\x03\x01\0" }, - { 0x01fa, "\x00\x41\x03\x0a\x03\x01\0" }, - { 0x01fb, "\x00\x61\x03\x0a\x03\x01\0" }, - { 0x01fc, "\x00\xc6\x03\x01\0" }, - { 0x01fd, "\x00\xe6\x03\x01\0" }, - { 0x01fe, "\x00\xd8\x03\x01\0" }, - { 0x01ff, "\x00\xf8\x03\x01\0" }, - { 0x0200, "\x00\x41\x03\x0f\0" }, - { 0x0201, "\x00\x61\x03\x0f\0" }, - { 0x0202, "\x00\x41\x03\x11\0" }, - { 0x0203, "\x00\x61\x03\x11\0" }, - { 0x0204, "\x00\x45\x03\x0f\0" }, - { 0x0205, "\x00\x65\x03\x0f\0" }, - { 0x0206, "\x00\x45\x03\x11\0" }, - { 0x0207, "\x00\x65\x03\x11\0" }, - { 0x0208, "\x00\x49\x03\x0f\0" }, - { 0x0209, "\x00\x69\x03\x0f\0" }, - { 0x020a, "\x00\x49\x03\x11\0" }, - { 0x020b, "\x00\x69\x03\x11\0" }, - { 0x020c, "\x00\x4f\x03\x0f\0" }, - { 0x020d, "\x00\x6f\x03\x0f\0" }, - { 0x020e, "\x00\x4f\x03\x11\0" }, - { 0x020f, "\x00\x6f\x03\x11\0" }, - { 0x0210, "\x00\x52\x03\x0f\0" }, - { 0x0211, "\x00\x72\x03\x0f\0" }, - { 0x0212, "\x00\x52\x03\x11\0" }, - { 0x0213, "\x00\x72\x03\x11\0" }, - { 0x0214, "\x00\x55\x03\x0f\0" }, - { 0x0215, "\x00\x75\x03\x0f\0" }, - { 0x0216, "\x00\x55\x03\x11\0" }, - { 0x0217, "\x00\x75\x03\x11\0" }, - { 0x0340, "\x03\x00\0" }, - { 0x0341, "\x03\x01\0" }, - { 0x0343, "\x03\x13\0" }, - { 0x0344, "\x03\x08\x03\x01\0" }, - { 0x0374, "\x02\xb9\0" }, - { 0x037e, "\x00\x3b\0" }, - { 0x0385, "\x00\xa8\x03\x01\0" }, - { 0x0386, "\x03\x91\x03\x01\0" }, - { 0x0387, "\x00\xb7\0" }, - { 0x0388, "\x03\x95\x03\x01\0" }, - { 0x0389, "\x03\x97\x03\x01\0" }, - { 0x038a, "\x03\x99\x03\x01\0" }, - { 0x038c, "\x03\x9f\x03\x01\0" }, - { 0x038e, "\x03\xa5\x03\x01\0" }, - { 0x038f, "\x03\xa9\x03\x01\0" }, - { 0x0390, "\x03\xb9\x03\x08\x03\x01\0" }, - { 0x03aa, "\x03\x99\x03\x08\0" }, - { 0x03ab, "\x03\xa5\x03\x08\0" }, - { 0x03ac, "\x03\xb1\x03\x01\0" }, - { 0x03ad, "\x03\xb5\x03\x01\0" }, - { 0x03ae, "\x03\xb7\x03\x01\0" }, - { 0x03af, "\x03\xb9\x03\x01\0" }, - { 0x03b0, "\x03\xc5\x03\x08\x03\x01\0" }, - { 0x03ca, "\x03\xb9\x03\x08\0" }, - { 0x03cb, "\x03\xc5\x03\x08\0" }, - { 0x03cc, "\x03\xbf\x03\x01\0" }, - { 0x03cd, "\x03\xc5\x03\x01\0" }, - { 0x03ce, "\x03\xc9\x03\x01\0" }, - { 0x03d3, "\x03\xd2\x03\x01\0" }, - { 0x03d4, "\x03\xd2\x03\x08\0" }, - { 0x0401, "\x04\x15\x03\x08\0" }, - { 0x0403, "\x04\x13\x03\x01\0" }, - { 0x0407, "\x04\x06\x03\x08\0" }, - { 0x040c, "\x04\x1a\x03\x01\0" }, - { 0x040e, "\x04\x23\x03\x06\0" }, - { 0x0419, "\x04\x18\x03\x06\0" }, - { 0x0439, "\x04\x38\x03\x06\0" }, - { 0x0451, "\x04\x35\x03\x08\0" }, - { 0x0453, "\x04\x33\x03\x01\0" }, - { 0x0457, "\x04\x56\x03\x08\0" }, - { 0x045c, "\x04\x3a\x03\x01\0" }, - { 0x045e, "\x04\x43\x03\x06\0" }, - { 0x0476, "\x04\x74\x03\x0f\0" }, - { 0x0477, "\x04\x75\x03\x0f\0" }, - { 0x04c1, "\x04\x16\x03\x06\0" }, - { 0x04c2, "\x04\x36\x03\x06\0" }, - { 0x04d0, "\x04\x10\x03\x06\0" }, - { 0x04d1, "\x04\x30\x03\x06\0" }, - { 0x04d2, "\x04\x10\x03\x08\0" }, - { 0x04d3, "\x04\x30\x03\x08\0" }, - { 0x04d6, "\x04\x15\x03\x06\0" }, - { 0x04d7, "\x04\x35\x03\x06\0" }, - { 0x04da, "\x04\xd8\x03\x08\0" }, - { 0x04db, "\x04\xd9\x03\x08\0" }, - { 0x04dc, "\x04\x16\x03\x08\0" }, - { 0x04dd, "\x04\x36\x03\x08\0" }, - { 0x04de, "\x04\x17\x03\x08\0" }, - { 0x04df, "\x04\x37\x03\x08\0" }, - { 0x04e2, "\x04\x18\x03\x04\0" }, - { 0x04e3, "\x04\x38\x03\x04\0" }, - { 0x04e4, "\x04\x18\x03\x08\0" }, - { 0x04e5, "\x04\x38\x03\x08\0" }, - { 0x04e6, "\x04\x1e\x03\x08\0" }, - { 0x04e7, "\x04\x3e\x03\x08\0" }, - { 0x04ea, "\x04\xe8\x03\x08\0" }, - { 0x04eb, "\x04\xe9\x03\x08\0" }, - { 0x04ee, "\x04\x23\x03\x04\0" }, - { 0x04ef, "\x04\x43\x03\x04\0" }, - { 0x04f0, "\x04\x23\x03\x08\0" }, - { 0x04f1, "\x04\x43\x03\x08\0" }, - { 0x04f2, "\x04\x23\x03\x0b\0" }, - { 0x04f3, "\x04\x43\x03\x0b\0" }, - { 0x04f4, "\x04\x27\x03\x08\0" }, - { 0x04f5, "\x04\x47\x03\x08\0" }, - { 0x04f8, "\x04\x2b\x03\x08\0" }, - { 0x04f9, "\x04\x4b\x03\x08\0" }, - { 0x0929, "\x09\x28\x09\x3c\0" }, - { 0x0931, "\x09\x30\x09\x3c\0" }, - { 0x0934, "\x09\x33\x09\x3c\0" }, - { 0x0958, "\x09\x15\x09\x3c\0" }, - { 0x0959, "\x09\x16\x09\x3c\0" }, - { 0x095a, "\x09\x17\x09\x3c\0" }, - { 0x095b, "\x09\x1c\x09\x3c\0" }, - { 0x095c, "\x09\x21\x09\x3c\0" }, - { 0x095d, "\x09\x22\x09\x3c\0" }, - { 0x095e, "\x09\x2b\x09\x3c\0" }, - { 0x095f, "\x09\x2f\x09\x3c\0" }, - { 0x09b0, "\x09\xac\x09\xbc\0" }, - { 0x09cb, "\x09\xc7\x09\xbe\0" }, - { 0x09cc, "\x09\xc7\x09\xd7\0" }, - { 0x09dc, "\x09\xa1\x09\xbc\0" }, - { 0x09dd, "\x09\xa2\x09\xbc\0" }, - { 0x09df, "\x09\xaf\x09\xbc\0" }, - { 0x0a59, "\x0a\x16\x0a\x3c\0" }, - { 0x0a5a, "\x0a\x17\x0a\x3c\0" }, - { 0x0a5b, "\x0a\x1c\x0a\x3c\0" }, - { 0x0a5c, "\x0a\x21\x0a\x3c\0" }, - { 0x0a5e, "\x0a\x2b\x0a\x3c\0" }, - { 0x0b48, "\x0b\x47\x0b\x56\0" }, - { 0x0b4b, "\x0b\x47\x0b\x3e\0" }, - { 0x0b4c, "\x0b\x47\x0b\x57\0" }, - { 0x0b5c, "\x0b\x21\x0b\x3c\0" }, - { 0x0b5d, "\x0b\x22\x0b\x3c\0" }, - { 0x0b5f, "\x0b\x2f\x0b\x3c\0" }, - { 0x0b94, "\x0b\x92\x0b\xd7\0" }, - { 0x0bca, "\x0b\xc6\x0b\xbe\0" }, - { 0x0bcb, "\x0b\xc7\x0b\xbe\0" }, - { 0x0bcc, "\x0b\xc6\x0b\xd7\0" }, - { 0x0c48, "\x0c\x46\x0c\x56\0" }, - { 0x0cc0, "\x0c\xbf\x0c\xd5\0" }, - { 0x0cc7, "\x0c\xc6\x0c\xd5\0" }, - { 0x0cc8, "\x0c\xc6\x0c\xd6\0" }, - { 0x0cca, "\x0c\xc6\x0c\xc2\0" }, - { 0x0ccb, "\x0c\xc6\x0c\xc2\x0c\xd5\0" }, - { 0x0d4a, "\x0d\x46\x0d\x3e\0" }, - { 0x0d4b, "\x0d\x47\x0d\x3e\0" }, - { 0x0d4c, "\x0d\x46\x0d\x57\0" }, - { 0x0e33, "\x0e\x4d\x0e\x32\0" }, - { 0x0eb3, "\x0e\xcd\x0e\xb2\0" }, - { 0x0f43, "\x0f\x42\x0f\xb7\0" }, - { 0x0f4d, "\x0f\x4c\x0f\xb7\0" }, - { 0x0f52, "\x0f\x51\x0f\xb7\0" }, - { 0x0f57, "\x0f\x56\x0f\xb7\0" }, - { 0x0f5c, "\x0f\x5b\x0f\xb7\0" }, - { 0x0f69, "\x0f\x40\x0f\xb5\0" }, - { 0x0f73, "\x0f\x71\x0f\x72\0" }, - { 0x0f75, "\x0f\x71\x0f\x74\0" }, - { 0x0f76, "\x0f\xb2\x0f\x80\0" }, - { 0x0f78, "\x0f\xb3\x0f\x80\0" }, - { 0x0f81, "\x0f\x71\x0f\x80\0" }, - { 0x0f93, "\x0f\x92\x0f\xb7\0" }, - { 0x0f9d, "\x0f\x9c\x0f\xb7\0" }, - { 0x0fa2, "\x0f\xa1\x0f\xb7\0" }, - { 0x0fa7, "\x0f\xa6\x0f\xb7\0" }, - { 0x0fac, "\x0f\xab\x0f\xb7\0" }, - { 0x0fb9, "\x0f\x90\x0f\xb5\0" }, - { 0x1e00, "\x00\x41\x03\x25\0" }, - { 0x1e01, "\x00\x61\x03\x25\0" }, - { 0x1e02, "\x00\x42\x03\x07\0" }, - { 0x1e03, "\x00\x62\x03\x07\0" }, - { 0x1e04, "\x00\x42\x03\x23\0" }, - { 0x1e05, "\x00\x62\x03\x23\0" }, - { 0x1e06, "\x00\x42\x03\x31\0" }, - { 0x1e07, "\x00\x62\x03\x31\0" }, - { 0x1e08, "\x00\x43\x03\x27\x03\x01\0" }, - { 0x1e09, "\x00\x63\x03\x27\x03\x01\0" }, - { 0x1e0a, "\x00\x44\x03\x07\0" }, - { 0x1e0b, "\x00\x64\x03\x07\0" }, - { 0x1e0c, "\x00\x44\x03\x23\0" }, - { 0x1e0d, "\x00\x64\x03\x23\0" }, - { 0x1e0e, "\x00\x44\x03\x31\0" }, - { 0x1e0f, "\x00\x64\x03\x31\0" }, - { 0x1e10, "\x00\x44\x03\x27\0" }, - { 0x1e11, "\x00\x64\x03\x27\0" }, - { 0x1e12, "\x00\x44\x03\x2d\0" }, - { 0x1e13, "\x00\x64\x03\x2d\0" }, - { 0x1e14, "\x00\x45\x03\x04\x03\x00\0" }, - { 0x1e15, "\x00\x65\x03\x04\x03\x00\0" }, - { 0x1e16, "\x00\x45\x03\x04\x03\x01\0" }, - { 0x1e17, "\x00\x65\x03\x04\x03\x01\0" }, - { 0x1e18, "\x00\x45\x03\x2d\0" }, - { 0x1e19, "\x00\x65\x03\x2d\0" }, - { 0x1e1a, "\x00\x45\x03\x30\0" }, - { 0x1e1b, "\x00\x65\x03\x30\0" }, - { 0x1e1c, "\x00\x45\x03\x27\x03\x06\0" }, - { 0x1e1d, "\x00\x65\x03\x27\x03\x06\0" }, - { 0x1e1e, "\x00\x46\x03\x07\0" }, - { 0x1e1f, "\x00\x66\x03\x07\0" }, - { 0x1e20, "\x00\x47\x03\x04\0" }, - { 0x1e21, "\x00\x67\x03\x04\0" }, - { 0x1e22, "\x00\x48\x03\x07\0" }, - { 0x1e23, "\x00\x68\x03\x07\0" }, - { 0x1e24, "\x00\x48\x03\x23\0" }, - { 0x1e25, "\x00\x68\x03\x23\0" }, - { 0x1e26, "\x00\x48\x03\x08\0" }, - { 0x1e27, "\x00\x68\x03\x08\0" }, - { 0x1e28, "\x00\x48\x03\x27\0" }, - { 0x1e29, "\x00\x68\x03\x27\0" }, - { 0x1e2a, "\x00\x48\x03\x2e\0" }, - { 0x1e2b, "\x00\x68\x03\x2e\0" }, - { 0x1e2c, "\x00\x49\x03\x30\0" }, - { 0x1e2d, "\x00\x69\x03\x30\0" }, - { 0x1e2e, "\x00\x49\x03\x08\x03\x01\0" }, - { 0x1e2f, "\x00\x69\x03\x08\x03\x01\0" }, - { 0x1e30, "\x00\x4b\x03\x01\0" }, - { 0x1e31, "\x00\x6b\x03\x01\0" }, - { 0x1e32, "\x00\x4b\x03\x23\0" }, - { 0x1e33, "\x00\x6b\x03\x23\0" }, - { 0x1e34, "\x00\x4b\x03\x31\0" }, - { 0x1e35, "\x00\x6b\x03\x31\0" }, - { 0x1e36, "\x00\x4c\x03\x23\0" }, - { 0x1e37, "\x00\x6c\x03\x23\0" }, - { 0x1e38, "\x00\x4c\x03\x23\x03\x04\0" }, - { 0x1e39, "\x00\x6c\x03\x23\x03\x04\0" }, - { 0x1e3a, "\x00\x4c\x03\x31\0" }, - { 0x1e3b, "\x00\x6c\x03\x31\0" }, - { 0x1e3c, "\x00\x4c\x03\x2d\0" }, - { 0x1e3d, "\x00\x6c\x03\x2d\0" }, - { 0x1e3e, "\x00\x4d\x03\x01\0" }, - { 0x1e3f, "\x00\x6d\x03\x01\0" }, - { 0x1e40, "\x00\x4d\x03\x07\0" }, - { 0x1e41, "\x00\x6d\x03\x07\0" }, - { 0x1e42, "\x00\x4d\x03\x23\0" }, - { 0x1e43, "\x00\x6d\x03\x23\0" }, - { 0x1e44, "\x00\x4e\x03\x07\0" }, - { 0x1e45, "\x00\x6e\x03\x07\0" }, - { 0x1e46, "\x00\x4e\x03\x23\0" }, - { 0x1e47, "\x00\x6e\x03\x23\0" }, - { 0x1e48, "\x00\x4e\x03\x31\0" }, - { 0x1e49, "\x00\x6e\x03\x31\0" }, - { 0x1e4a, "\x00\x4e\x03\x2d\0" }, - { 0x1e4b, "\x00\x6e\x03\x2d\0" }, - { 0x1e4c, "\x00\x4f\x03\x03\x03\x01\0" }, - { 0x1e4d, "\x00\x6f\x03\x03\x03\x01\0" }, - { 0x1e4e, "\x00\x4f\x03\x03\x03\x08\0" }, - { 0x1e4f, "\x00\x6f\x03\x03\x03\x08\0" }, - { 0x1e50, "\x00\x4f\x03\x04\x03\x00\0" }, - { 0x1e51, "\x00\x6f\x03\x04\x03\x00\0" }, - { 0x1e52, "\x00\x4f\x03\x04\x03\x01\0" }, - { 0x1e53, "\x00\x6f\x03\x04\x03\x01\0" }, - { 0x1e54, "\x00\x50\x03\x01\0" }, - { 0x1e55, "\x00\x70\x03\x01\0" }, - { 0x1e56, "\x00\x50\x03\x07\0" }, - { 0x1e57, "\x00\x70\x03\x07\0" }, - { 0x1e58, "\x00\x52\x03\x07\0" }, - { 0x1e59, "\x00\x72\x03\x07\0" }, - { 0x1e5a, "\x00\x52\x03\x23\0" }, - { 0x1e5b, "\x00\x72\x03\x23\0" }, - { 0x1e5c, "\x00\x52\x03\x23\x03\x04\0" }, - { 0x1e5d, "\x00\x72\x03\x23\x03\x04\0" }, - { 0x1e5e, "\x00\x52\x03\x31\0" }, - { 0x1e5f, "\x00\x72\x03\x31\0" }, - { 0x1e60, "\x00\x53\x03\x07\0" }, - { 0x1e61, "\x00\x73\x03\x07\0" }, - { 0x1e62, "\x00\x53\x03\x23\0" }, - { 0x1e63, "\x00\x73\x03\x23\0" }, - { 0x1e64, "\x00\x53\x03\x01\x03\x07\0" }, - { 0x1e65, "\x00\x73\x03\x01\x03\x07\0" }, - { 0x1e66, "\x00\x53\x03\x0c\x03\x07\0" }, - { 0x1e67, "\x00\x73\x03\x0c\x03\x07\0" }, - { 0x1e68, "\x00\x53\x03\x23\x03\x07\0" }, - { 0x1e69, "\x00\x73\x03\x23\x03\x07\0" }, - { 0x1e6a, "\x00\x54\x03\x07\0" }, - { 0x1e6b, "\x00\x74\x03\x07\0" }, - { 0x1e6c, "\x00\x54\x03\x23\0" }, - { 0x1e6d, "\x00\x74\x03\x23\0" }, - { 0x1e6e, "\x00\x54\x03\x31\0" }, - { 0x1e6f, "\x00\x74\x03\x31\0" }, - { 0x1e70, "\x00\x54\x03\x2d\0" }, - { 0x1e71, "\x00\x74\x03\x2d\0" }, - { 0x1e72, "\x00\x55\x03\x24\0" }, - { 0x1e73, "\x00\x75\x03\x24\0" }, - { 0x1e74, "\x00\x55\x03\x30\0" }, - { 0x1e75, "\x00\x75\x03\x30\0" }, - { 0x1e76, "\x00\x55\x03\x2d\0" }, - { 0x1e77, "\x00\x75\x03\x2d\0" }, - { 0x1e78, "\x00\x55\x03\x03\x03\x01\0" }, - { 0x1e79, "\x00\x75\x03\x03\x03\x01\0" }, - { 0x1e7a, "\x00\x55\x03\x04\x03\x08\0" }, - { 0x1e7b, "\x00\x75\x03\x04\x03\x08\0" }, - { 0x1e7c, "\x00\x56\x03\x03\0" }, - { 0x1e7d, "\x00\x76\x03\x03\0" }, - { 0x1e7e, "\x00\x56\x03\x23\0" }, - { 0x1e7f, "\x00\x76\x03\x23\0" }, - { 0x1e80, "\x00\x57\x03\x00\0" }, - { 0x1e81, "\x00\x77\x03\x00\0" }, - { 0x1e82, "\x00\x57\x03\x01\0" }, - { 0x1e83, "\x00\x77\x03\x01\0" }, - { 0x1e84, "\x00\x57\x03\x08\0" }, - { 0x1e85, "\x00\x77\x03\x08\0" }, - { 0x1e86, "\x00\x57\x03\x07\0" }, - { 0x1e87, "\x00\x77\x03\x07\0" }, - { 0x1e88, "\x00\x57\x03\x23\0" }, - { 0x1e89, "\x00\x77\x03\x23\0" }, - { 0x1e8a, "\x00\x58\x03\x07\0" }, - { 0x1e8b, "\x00\x78\x03\x07\0" }, - { 0x1e8c, "\x00\x58\x03\x08\0" }, - { 0x1e8d, "\x00\x78\x03\x08\0" }, - { 0x1e8e, "\x00\x59\x03\x07\0" }, - { 0x1e8f, "\x00\x79\x03\x07\0" }, - { 0x1e90, "\x00\x5a\x03\x02\0" }, - { 0x1e91, "\x00\x7a\x03\x02\0" }, - { 0x1e92, "\x00\x5a\x03\x23\0" }, - { 0x1e93, "\x00\x7a\x03\x23\0" }, - { 0x1e94, "\x00\x5a\x03\x31\0" }, - { 0x1e95, "\x00\x7a\x03\x31\0" }, - { 0x1e96, "\x00\x68\x03\x31\0" }, - { 0x1e97, "\x00\x74\x03\x08\0" }, - { 0x1e98, "\x00\x77\x03\x0a\0" }, - { 0x1e99, "\x00\x79\x03\x0a\0" }, - { 0x1e9b, "\x01\x7f\x03\x07\0" }, - { 0x1ea0, "\x00\x41\x03\x23\0" }, - { 0x1ea1, "\x00\x61\x03\x23\0" }, - { 0x1ea2, "\x00\x41\x03\x09\0" }, - { 0x1ea3, "\x00\x61\x03\x09\0" }, - { 0x1ea4, "\x00\x41\x03\x02\x03\x01\0" }, - { 0x1ea5, "\x00\x61\x03\x02\x03\x01\0" }, - { 0x1ea6, "\x00\x41\x03\x02\x03\x00\0" }, - { 0x1ea7, "\x00\x61\x03\x02\x03\x00\0" }, - { 0x1ea8, "\x00\x41\x03\x02\x03\x09\0" }, - { 0x1ea9, "\x00\x61\x03\x02\x03\x09\0" }, - { 0x1eaa, "\x00\x41\x03\x02\x03\x03\0" }, - { 0x1eab, "\x00\x61\x03\x02\x03\x03\0" }, - { 0x1eac, "\x00\x41\x03\x23\x03\x02\0" }, - { 0x1ead, "\x00\x61\x03\x23\x03\x02\0" }, - { 0x1eae, "\x00\x41\x03\x06\x03\x01\0" }, - { 0x1eaf, "\x00\x61\x03\x06\x03\x01\0" }, - { 0x1eb0, "\x00\x41\x03\x06\x03\x00\0" }, - { 0x1eb1, "\x00\x61\x03\x06\x03\x00\0" }, - { 0x1eb2, "\x00\x41\x03\x06\x03\x09\0" }, - { 0x1eb3, "\x00\x61\x03\x06\x03\x09\0" }, - { 0x1eb4, "\x00\x41\x03\x06\x03\x03\0" }, - { 0x1eb5, "\x00\x61\x03\x06\x03\x03\0" }, - { 0x1eb6, "\x00\x41\x03\x23\x03\x06\0" }, - { 0x1eb7, "\x00\x61\x03\x23\x03\x06\0" }, - { 0x1eb8, "\x00\x45\x03\x23\0" }, - { 0x1eb9, "\x00\x65\x03\x23\0" }, - { 0x1eba, "\x00\x45\x03\x09\0" }, - { 0x1ebb, "\x00\x65\x03\x09\0" }, - { 0x1ebc, "\x00\x45\x03\x03\0" }, - { 0x1ebd, "\x00\x65\x03\x03\0" }, - { 0x1ebe, "\x00\x45\x03\x02\x03\x01\0" }, - { 0x1ebf, "\x00\x65\x03\x02\x03\x01\0" }, - { 0x1ec0, "\x00\x45\x03\x02\x03\x00\0" }, - { 0x1ec1, "\x00\x65\x03\x02\x03\x00\0" }, - { 0x1ec2, "\x00\x45\x03\x02\x03\x09\0" }, - { 0x1ec3, "\x00\x65\x03\x02\x03\x09\0" }, - { 0x1ec4, "\x00\x45\x03\x02\x03\x03\0" }, - { 0x1ec5, "\x00\x65\x03\x02\x03\x03\0" }, - { 0x1ec6, "\x00\x45\x03\x23\x03\x02\0" }, - { 0x1ec7, "\x00\x65\x03\x23\x03\x02\0" }, - { 0x1ec8, "\x00\x49\x03\x09\0" }, - { 0x1ec9, "\x00\x69\x03\x09\0" }, - { 0x1eca, "\x00\x49\x03\x23\0" }, - { 0x1ecb, "\x00\x69\x03\x23\0" }, - { 0x1ecc, "\x00\x4f\x03\x23\0" }, - { 0x1ecd, "\x00\x6f\x03\x23\0" }, - { 0x1ece, "\x00\x4f\x03\x09\0" }, - { 0x1ecf, "\x00\x6f\x03\x09\0" }, - { 0x1ed0, "\x00\x4f\x03\x02\x03\x01\0" }, - { 0x1ed1, "\x00\x6f\x03\x02\x03\x01\0" }, - { 0x1ed2, "\x00\x4f\x03\x02\x03\x00\0" }, - { 0x1ed3, "\x00\x6f\x03\x02\x03\x00\0" }, - { 0x1ed4, "\x00\x4f\x03\x02\x03\x09\0" }, - { 0x1ed5, "\x00\x6f\x03\x02\x03\x09\0" }, - { 0x1ed6, "\x00\x4f\x03\x02\x03\x03\0" }, - { 0x1ed7, "\x00\x6f\x03\x02\x03\x03\0" }, - { 0x1ed8, "\x00\x4f\x03\x23\x03\x02\0" }, - { 0x1ed9, "\x00\x6f\x03\x23\x03\x02\0" }, - { 0x1eda, "\x00\x4f\x03\x1b\x03\x01\0" }, - { 0x1edb, "\x00\x6f\x03\x1b\x03\x01\0" }, - { 0x1edc, "\x00\x4f\x03\x1b\x03\x00\0" }, - { 0x1edd, "\x00\x6f\x03\x1b\x03\x00\0" }, - { 0x1ede, "\x00\x4f\x03\x1b\x03\x09\0" }, - { 0x1edf, "\x00\x6f\x03\x1b\x03\x09\0" }, - { 0x1ee0, "\x00\x4f\x03\x1b\x03\x03\0" }, - { 0x1ee1, "\x00\x6f\x03\x1b\x03\x03\0" }, - { 0x1ee2, "\x00\x4f\x03\x1b\x03\x23\0" }, - { 0x1ee3, "\x00\x6f\x03\x1b\x03\x23\0" }, - { 0x1ee4, "\x00\x55\x03\x23\0" }, - { 0x1ee5, "\x00\x75\x03\x23\0" }, - { 0x1ee6, "\x00\x55\x03\x09\0" }, - { 0x1ee7, "\x00\x75\x03\x09\0" }, - { 0x1ee8, "\x00\x55\x03\x1b\x03\x01\0" }, - { 0x1ee9, "\x00\x75\x03\x1b\x03\x01\0" }, - { 0x1eea, "\x00\x55\x03\x1b\x03\x00\0" }, - { 0x1eeb, "\x00\x75\x03\x1b\x03\x00\0" }, - { 0x1eec, "\x00\x55\x03\x1b\x03\x09\0" }, - { 0x1eed, "\x00\x75\x03\x1b\x03\x09\0" }, - { 0x1eee, "\x00\x55\x03\x1b\x03\x03\0" }, - { 0x1eef, "\x00\x75\x03\x1b\x03\x03\0" }, - { 0x1ef0, "\x00\x55\x03\x1b\x03\x23\0" }, - { 0x1ef1, "\x00\x75\x03\x1b\x03\x23\0" }, - { 0x1ef2, "\x00\x59\x03\x00\0" }, - { 0x1ef3, "\x00\x79\x03\x00\0" }, - { 0x1ef4, "\x00\x59\x03\x23\0" }, - { 0x1ef5, "\x00\x79\x03\x23\0" }, - { 0x1ef6, "\x00\x59\x03\x09\0" }, - { 0x1ef7, "\x00\x79\x03\x09\0" }, - { 0x1ef8, "\x00\x59\x03\x03\0" }, - { 0x1ef9, "\x00\x79\x03\x03\0" }, - { 0x1f00, "\x03\xb1\x03\x13\0" }, - { 0x1f01, "\x03\xb1\x03\x14\0" }, - { 0x1f02, "\x03\xb1\x03\x13\x03\x00\0" }, - { 0x1f03, "\x03\xb1\x03\x14\x03\x00\0" }, - { 0x1f04, "\x03\xb1\x03\x13\x03\x01\0" }, - { 0x1f05, "\x03\xb1\x03\x14\x03\x01\0" }, - { 0x1f06, "\x03\xb1\x03\x13\x03\x42\0" }, - { 0x1f07, "\x03\xb1\x03\x14\x03\x42\0" }, - { 0x1f08, "\x03\x91\x03\x13\0" }, - { 0x1f09, "\x03\x91\x03\x14\0" }, - { 0x1f0a, "\x03\x91\x03\x13\x03\x00\0" }, - { 0x1f0b, "\x03\x91\x03\x14\x03\x00\0" }, - { 0x1f0c, "\x03\x91\x03\x13\x03\x01\0" }, - { 0x1f0d, "\x03\x91\x03\x14\x03\x01\0" }, - { 0x1f0e, "\x03\x91\x03\x13\x03\x42\0" }, - { 0x1f0f, "\x03\x91\x03\x14\x03\x42\0" }, - { 0x1f10, "\x03\xb5\x03\x13\0" }, - { 0x1f11, "\x03\xb5\x03\x14\0" }, - { 0x1f12, "\x03\xb5\x03\x13\x03\x00\0" }, - { 0x1f13, "\x03\xb5\x03\x14\x03\x00\0" }, - { 0x1f14, "\x03\xb5\x03\x13\x03\x01\0" }, - { 0x1f15, "\x03\xb5\x03\x14\x03\x01\0" }, - { 0x1f18, "\x03\x95\x03\x13\0" }, - { 0x1f19, "\x03\x95\x03\x14\0" }, - { 0x1f1a, "\x03\x95\x03\x13\x03\x00\0" }, - { 0x1f1b, "\x03\x95\x03\x14\x03\x00\0" }, - { 0x1f1c, "\x03\x95\x03\x13\x03\x01\0" }, - { 0x1f1d, "\x03\x95\x03\x14\x03\x01\0" }, - { 0x1f20, "\x03\xb7\x03\x13\0" }, - { 0x1f21, "\x03\xb7\x03\x14\0" }, - { 0x1f22, "\x03\xb7\x03\x13\x03\x00\0" }, - { 0x1f23, "\x03\xb7\x03\x14\x03\x00\0" }, - { 0x1f24, "\x03\xb7\x03\x13\x03\x01\0" }, - { 0x1f25, "\x03\xb7\x03\x14\x03\x01\0" }, - { 0x1f26, "\x03\xb7\x03\x13\x03\x42\0" }, - { 0x1f27, "\x03\xb7\x03\x14\x03\x42\0" }, - { 0x1f28, "\x03\x97\x03\x13\0" }, - { 0x1f29, "\x03\x97\x03\x14\0" }, - { 0x1f2a, "\x03\x97\x03\x13\x03\x00\0" }, - { 0x1f2b, "\x03\x97\x03\x14\x03\x00\0" }, - { 0x1f2c, "\x03\x97\x03\x13\x03\x01\0" }, - { 0x1f2d, "\x03\x97\x03\x14\x03\x01\0" }, - { 0x1f2e, "\x03\x97\x03\x13\x03\x42\0" }, - { 0x1f2f, "\x03\x97\x03\x14\x03\x42\0" }, - { 0x1f30, "\x03\xb9\x03\x13\0" }, - { 0x1f31, "\x03\xb9\x03\x14\0" }, - { 0x1f32, "\x03\xb9\x03\x13\x03\x00\0" }, - { 0x1f33, "\x03\xb9\x03\x14\x03\x00\0" }, - { 0x1f34, "\x03\xb9\x03\x13\x03\x01\0" }, - { 0x1f35, "\x03\xb9\x03\x14\x03\x01\0" }, - { 0x1f36, "\x03\xb9\x03\x13\x03\x42\0" }, - { 0x1f37, "\x03\xb9\x03\x14\x03\x42\0" }, - { 0x1f38, "\x03\x99\x03\x13\0" }, - { 0x1f39, "\x03\x99\x03\x14\0" }, - { 0x1f3a, "\x03\x99\x03\x13\x03\x00\0" }, - { 0x1f3b, "\x03\x99\x03\x14\x03\x00\0" }, - { 0x1f3c, "\x03\x99\x03\x13\x03\x01\0" }, - { 0x1f3d, "\x03\x99\x03\x14\x03\x01\0" }, - { 0x1f3e, "\x03\x99\x03\x13\x03\x42\0" }, - { 0x1f3f, "\x03\x99\x03\x14\x03\x42\0" }, - { 0x1f40, "\x03\xbf\x03\x13\0" }, - { 0x1f41, "\x03\xbf\x03\x14\0" }, - { 0x1f42, "\x03\xbf\x03\x13\x03\x00\0" }, - { 0x1f43, "\x03\xbf\x03\x14\x03\x00\0" }, - { 0x1f44, "\x03\xbf\x03\x13\x03\x01\0" }, - { 0x1f45, "\x03\xbf\x03\x14\x03\x01\0" }, - { 0x1f48, "\x03\x9f\x03\x13\0" }, - { 0x1f49, "\x03\x9f\x03\x14\0" }, - { 0x1f4a, "\x03\x9f\x03\x13\x03\x00\0" }, - { 0x1f4b, "\x03\x9f\x03\x14\x03\x00\0" }, - { 0x1f4c, "\x03\x9f\x03\x13\x03\x01\0" }, - { 0x1f4d, "\x03\x9f\x03\x14\x03\x01\0" }, - { 0x1f50, "\x03\xc5\x03\x13\0" }, - { 0x1f51, "\x03\xc5\x03\x14\0" }, - { 0x1f52, "\x03\xc5\x03\x13\x03\x00\0" }, - { 0x1f53, "\x03\xc5\x03\x14\x03\x00\0" }, - { 0x1f54, "\x03\xc5\x03\x13\x03\x01\0" }, - { 0x1f55, "\x03\xc5\x03\x14\x03\x01\0" }, - { 0x1f56, "\x03\xc5\x03\x13\x03\x42\0" }, - { 0x1f57, "\x03\xc5\x03\x14\x03\x42\0" }, - { 0x1f59, "\x03\xa5\x03\x14\0" }, - { 0x1f5b, "\x03\xa5\x03\x14\x03\x00\0" }, - { 0x1f5d, "\x03\xa5\x03\x14\x03\x01\0" }, - { 0x1f5f, "\x03\xa5\x03\x14\x03\x42\0" }, - { 0x1f60, "\x03\xc9\x03\x13\0" }, - { 0x1f61, "\x03\xc9\x03\x14\0" }, - { 0x1f62, "\x03\xc9\x03\x13\x03\x00\0" }, - { 0x1f63, "\x03\xc9\x03\x14\x03\x00\0" }, - { 0x1f64, "\x03\xc9\x03\x13\x03\x01\0" }, - { 0x1f65, "\x03\xc9\x03\x14\x03\x01\0" }, - { 0x1f66, "\x03\xc9\x03\x13\x03\x42\0" }, - { 0x1f67, "\x03\xc9\x03\x14\x03\x42\0" }, - { 0x1f68, "\x03\xa9\x03\x13\0" }, - { 0x1f69, "\x03\xa9\x03\x14\0" }, - { 0x1f6a, "\x03\xa9\x03\x13\x03\x00\0" }, - { 0x1f6b, "\x03\xa9\x03\x14\x03\x00\0" }, - { 0x1f6c, "\x03\xa9\x03\x13\x03\x01\0" }, - { 0x1f6d, "\x03\xa9\x03\x14\x03\x01\0" }, - { 0x1f6e, "\x03\xa9\x03\x13\x03\x42\0" }, - { 0x1f6f, "\x03\xa9\x03\x14\x03\x42\0" }, - { 0x1f70, "\x03\xb1\x03\x00\0" }, - { 0x1f71, "\x03\xb1\x03\x01\0" }, - { 0x1f72, "\x03\xb5\x03\x00\0" }, - { 0x1f73, "\x03\xb5\x03\x01\0" }, - { 0x1f74, "\x03\xb7\x03\x00\0" }, - { 0x1f75, "\x03\xb7\x03\x01\0" }, - { 0x1f76, "\x03\xb9\x03\x00\0" }, - { 0x1f77, "\x03\xb9\x03\x01\0" }, - { 0x1f78, "\x03\xbf\x03\x00\0" }, - { 0x1f79, "\x03\xbf\x03\x01\0" }, - { 0x1f7a, "\x03\xc5\x03\x00\0" }, - { 0x1f7b, "\x03\xc5\x03\x01\0" }, - { 0x1f7c, "\x03\xc9\x03\x00\0" }, - { 0x1f7d, "\x03\xc9\x03\x01\0" }, - { 0x1f80, "\x03\xb1\x03\x13\x03\x45\0" }, - { 0x1f81, "\x03\xb1\x03\x14\x03\x45\0" }, - { 0x1f82, "\x03\xb1\x03\x13\x03\x00\x03\x45\0" }, - { 0x1f83, "\x03\xb1\x03\x14\x03\x00\x03\x45\0" }, - { 0x1f84, "\x03\xb1\x03\x13\x03\x01\x03\x45\0" }, - { 0x1f85, "\x03\xb1\x03\x14\x03\x01\x03\x45\0" }, - { 0x1f86, "\x03\xb1\x03\x13\x03\x42\x03\x45\0" }, - { 0x1f87, "\x03\xb1\x03\x14\x03\x42\x03\x45\0" }, - { 0x1f88, "\x03\x91\x03\x13\x03\x45\0" }, - { 0x1f89, "\x03\x91\x03\x14\x03\x45\0" }, - { 0x1f8a, "\x03\x91\x03\x13\x03\x00\x03\x45\0" }, - { 0x1f8b, "\x03\x91\x03\x14\x03\x00\x03\x45\0" }, - { 0x1f8c, "\x03\x91\x03\x13\x03\x01\x03\x45\0" }, - { 0x1f8d, "\x03\x91\x03\x14\x03\x01\x03\x45\0" }, - { 0x1f8e, "\x03\x91\x03\x13\x03\x42\x03\x45\0" }, - { 0x1f8f, "\x03\x91\x03\x14\x03\x42\x03\x45\0" }, - { 0x1f90, "\x03\xb7\x03\x13\x03\x45\0" }, - { 0x1f91, "\x03\xb7\x03\x14\x03\x45\0" }, - { 0x1f92, "\x03\xb7\x03\x13\x03\x00\x03\x45\0" }, - { 0x1f93, "\x03\xb7\x03\x14\x03\x00\x03\x45\0" }, - { 0x1f94, "\x03\xb7\x03\x13\x03\x01\x03\x45\0" }, - { 0x1f95, "\x03\xb7\x03\x14\x03\x01\x03\x45\0" }, - { 0x1f96, "\x03\xb7\x03\x13\x03\x42\x03\x45\0" }, - { 0x1f97, "\x03\xb7\x03\x14\x03\x42\x03\x45\0" }, - { 0x1f98, "\x03\x97\x03\x13\x03\x45\0" }, - { 0x1f99, "\x03\x97\x03\x14\x03\x45\0" }, - { 0x1f9a, "\x03\x97\x03\x13\x03\x00\x03\x45\0" }, - { 0x1f9b, "\x03\x97\x03\x14\x03\x00\x03\x45\0" }, - { 0x1f9c, "\x03\x97\x03\x13\x03\x01\x03\x45\0" }, - { 0x1f9d, "\x03\x97\x03\x14\x03\x01\x03\x45\0" }, - { 0x1f9e, "\x03\x97\x03\x13\x03\x42\x03\x45\0" }, - { 0x1f9f, "\x03\x97\x03\x14\x03\x42\x03\x45\0" }, - { 0x1fa0, "\x03\xc9\x03\x13\x03\x45\0" }, - { 0x1fa1, "\x03\xc9\x03\x14\x03\x45\0" }, - { 0x1fa2, "\x03\xc9\x03\x13\x03\x00\x03\x45\0" }, - { 0x1fa3, "\x03\xc9\x03\x14\x03\x00\x03\x45\0" }, - { 0x1fa4, "\x03\xc9\x03\x13\x03\x01\x03\x45\0" }, - { 0x1fa5, "\x03\xc9\x03\x14\x03\x01\x03\x45\0" }, - { 0x1fa6, "\x03\xc9\x03\x13\x03\x42\x03\x45\0" }, - { 0x1fa7, "\x03\xc9\x03\x14\x03\x42\x03\x45\0" }, - { 0x1fa8, "\x03\xa9\x03\x13\x03\x45\0" }, - { 0x1fa9, "\x03\xa9\x03\x14\x03\x45\0" }, - { 0x1faa, "\x03\xa9\x03\x13\x03\x00\x03\x45\0" }, - { 0x1fab, "\x03\xa9\x03\x14\x03\x00\x03\x45\0" }, - { 0x1fac, "\x03\xa9\x03\x13\x03\x01\x03\x45\0" }, - { 0x1fad, "\x03\xa9\x03\x14\x03\x01\x03\x45\0" }, - { 0x1fae, "\x03\xa9\x03\x13\x03\x42\x03\x45\0" }, - { 0x1faf, "\x03\xa9\x03\x14\x03\x42\x03\x45\0" }, - { 0x1fb0, "\x03\xb1\x03\x06\0" }, - { 0x1fb1, "\x03\xb1\x03\x04\0" }, - { 0x1fb2, "\x03\xb1\x03\x00\x03\x45\0" }, - { 0x1fb3, "\x03\xb1\x03\x45\0" }, - { 0x1fb4, "\x03\xb1\x03\x01\x03\x45\0" }, - { 0x1fb6, "\x03\xb1\x03\x42\0" }, - { 0x1fb7, "\x03\xb1\x03\x42\x03\x45\0" }, - { 0x1fb8, "\x03\x91\x03\x06\0" }, - { 0x1fb9, "\x03\x91\x03\x04\0" }, - { 0x1fba, "\x03\x91\x03\x00\0" }, - { 0x1fbb, "\x03\x91\x03\x01\0" }, - { 0x1fbc, "\x03\x91\x03\x45\0" }, - { 0x1fbe, "\x03\xb9\0" }, - { 0x1fc1, "\x00\xa8\x03\x42\0" }, - { 0x1fc2, "\x03\xb7\x03\x00\x03\x45\0" }, - { 0x1fc3, "\x03\xb7\x03\x45\0" }, - { 0x1fc4, "\x03\xb7\x03\x01\x03\x45\0" }, - { 0x1fc6, "\x03\xb7\x03\x42\0" }, - { 0x1fc7, "\x03\xb7\x03\x42\x03\x45\0" }, - { 0x1fc8, "\x03\x95\x03\x00\0" }, - { 0x1fc9, "\x03\x95\x03\x01\0" }, - { 0x1fca, "\x03\x97\x03\x00\0" }, - { 0x1fcb, "\x03\x97\x03\x01\0" }, - { 0x1fcc, "\x03\x97\x03\x45\0" }, - { 0x1fcd, "\x1f\xbf\x03\x00\0" }, - { 0x1fce, "\x1f\xbf\x03\x01\0" }, - { 0x1fcf, "\x1f\xbf\x03\x42\0" }, - { 0x1fd0, "\x03\xb9\x03\x06\0" }, - { 0x1fd1, "\x03\xb9\x03\x04\0" }, - { 0x1fd2, "\x03\xb9\x03\x08\x03\x00\0" }, - { 0x1fd3, "\x03\xb9\x03\x08\x03\x01\0" }, - { 0x1fd6, "\x03\xb9\x03\x42\0" }, - { 0x1fd7, "\x03\xb9\x03\x08\x03\x42\0" }, - { 0x1fd8, "\x03\x99\x03\x06\0" }, - { 0x1fd9, "\x03\x99\x03\x04\0" }, - { 0x1fda, "\x03\x99\x03\x00\0" }, - { 0x1fdb, "\x03\x99\x03\x01\0" }, - { 0x1fdd, "\x1f\xfe\x03\x00\0" }, - { 0x1fde, "\x1f\xfe\x03\x01\0" }, - { 0x1fdf, "\x1f\xfe\x03\x42\0" }, - { 0x1fe0, "\x03\xc5\x03\x06\0" }, - { 0x1fe1, "\x03\xc5\x03\x04\0" }, - { 0x1fe2, "\x03\xc5\x03\x08\x03\x00\0" }, - { 0x1fe3, "\x03\xc5\x03\x08\x03\x01\0" }, - { 0x1fe4, "\x03\xc1\x03\x13\0" }, - { 0x1fe5, "\x03\xc1\x03\x14\0" }, - { 0x1fe6, "\x03\xc5\x03\x42\0" }, - { 0x1fe7, "\x03\xc5\x03\x08\x03\x42\0" }, - { 0x1fe8, "\x03\xa5\x03\x06\0" }, - { 0x1fe9, "\x03\xa5\x03\x04\0" }, - { 0x1fea, "\x03\xa5\x03\x00\0" }, - { 0x1feb, "\x03\xa5\x03\x01\0" }, - { 0x1fec, "\x03\xa1\x03\x14\0" }, - { 0x1fed, "\x00\xa8\x03\x00\0" }, - { 0x1fee, "\x00\xa8\x03\x01\0" }, - { 0x1fef, "\x00\x60\0" }, - { 0x1ff2, "\x03\xc9\x03\x00\x03\x45\0" }, - { 0x1ff3, "\x03\xc9\x03\x45\0" }, - { 0x1ff4, "\x03\xc9\x03\x01\x03\x45\0" }, - { 0x1ff6, "\x03\xc9\x03\x42\0" }, - { 0x1ff7, "\x03\xc9\x03\x42\x03\x45\0" }, - { 0x1ff8, "\x03\x9f\x03\x00\0" }, - { 0x1ff9, "\x03\x9f\x03\x01\0" }, - { 0x1ffa, "\x03\xa9\x03\x00\0" }, - { 0x1ffb, "\x03\xa9\x03\x01\0" }, - { 0x1ffc, "\x03\xa9\x03\x45\0" }, - { 0x1ffd, "\x00\xb4\0" }, - { 0x2000, "\x20\x02\0" }, - { 0x2001, "\x20\x03\0" }, - { 0x2126, "\x03\xa9\0" }, - { 0x212a, "\x00\x4b\0" }, - { 0x212b, "\x00\x41\x03\x0a\0" }, - { 0x2204, "\x22\x03\x03\x38\0" }, - { 0x2209, "\x22\x08\x03\x38\0" }, - { 0x220c, "\x22\x0b\x03\x38\0" }, - { 0x2224, "\x22\x23\x03\x38\0" }, - { 0x2226, "\x22\x25\x03\x38\0" }, - { 0x2241, "\x00\x7e\x03\x38\0" }, - { 0x2244, "\x22\x43\x03\x38\0" }, - { 0x2247, "\x22\x45\x03\x38\0" }, - { 0x2249, "\x22\x48\x03\x38\0" }, - { 0x2260, "\x00\x3d\x03\x38\0" }, - { 0x2262, "\x22\x61\x03\x38\0" }, - { 0x226d, "\x22\x4d\x03\x38\0" }, - { 0x226e, "\x00\x3c\x03\x38\0" }, - { 0x226f, "\x00\x3e\x03\x38\0" }, - { 0x2270, "\x22\x64\x03\x38\0" }, - { 0x2271, "\x22\x65\x03\x38\0" }, - { 0x2274, "\x22\x72\x03\x38\0" }, - { 0x2275, "\x22\x73\x03\x38\0" }, - { 0x2278, "\x22\x76\x03\x38\0" }, - { 0x2279, "\x22\x77\x03\x38\0" }, - { 0x2280, "\x22\x7a\x03\x38\0" }, - { 0x2281, "\x22\x7b\x03\x38\0" }, - { 0x2284, "\x22\x82\x03\x38\0" }, - { 0x2285, "\x22\x83\x03\x38\0" }, - { 0x2288, "\x22\x86\x03\x38\0" }, - { 0x2289, "\x22\x87\x03\x38\0" }, - { 0x22ac, "\x22\xa2\x03\x38\0" }, - { 0x22ad, "\x22\xa8\x03\x38\0" }, - { 0x22ae, "\x22\xa9\x03\x38\0" }, - { 0x22af, "\x22\xab\x03\x38\0" }, - { 0x22e0, "\x22\x7c\x03\x38\0" }, - { 0x22e1, "\x22\x7d\x03\x38\0" }, - { 0x22e2, "\x22\x91\x03\x38\0" }, - { 0x22e3, "\x22\x92\x03\x38\0" }, - { 0x22ea, "\x22\xb2\x03\x38\0" }, - { 0x22eb, "\x22\xb3\x03\x38\0" }, - { 0x22ec, "\x22\xb4\x03\x38\0" }, - { 0x22ed, "\x22\xb5\x03\x38\0" }, - { 0x2329, "\x30\x08\0" }, - { 0x232a, "\x30\x09\0" }, - { 0x304c, "\x30\x4b\x30\x99\0" }, - { 0x304e, "\x30\x4d\x30\x99\0" }, - { 0x3050, "\x30\x4f\x30\x99\0" }, - { 0x3052, "\x30\x51\x30\x99\0" }, - { 0x3054, "\x30\x53\x30\x99\0" }, - { 0x3056, "\x30\x55\x30\x99\0" }, - { 0x3058, "\x30\x57\x30\x99\0" }, - { 0x305a, "\x30\x59\x30\x99\0" }, - { 0x305c, "\x30\x5b\x30\x99\0" }, - { 0x305e, "\x30\x5d\x30\x99\0" }, - { 0x3060, "\x30\x5f\x30\x99\0" }, - { 0x3062, "\x30\x61\x30\x99\0" }, - { 0x3065, "\x30\x64\x30\x99\0" }, - { 0x3067, "\x30\x66\x30\x99\0" }, - { 0x3069, "\x30\x68\x30\x99\0" }, - { 0x3070, "\x30\x6f\x30\x99\0" }, - { 0x3071, "\x30\x6f\x30\x9a\0" }, - { 0x3073, "\x30\x72\x30\x99\0" }, - { 0x3074, "\x30\x72\x30\x9a\0" }, - { 0x3076, "\x30\x75\x30\x99\0" }, - { 0x3077, "\x30\x75\x30\x9a\0" }, - { 0x3079, "\x30\x78\x30\x99\0" }, - { 0x307a, "\x30\x78\x30\x9a\0" }, - { 0x307c, "\x30\x7b\x30\x99\0" }, - { 0x307d, "\x30\x7b\x30\x9a\0" }, - { 0x3094, "\x30\x46\x30\x99\0" }, - { 0x309e, "\x30\x9d\x30\x99\0" }, - { 0x30ac, "\x30\xab\x30\x99\0" }, - { 0x30ae, "\x30\xad\x30\x99\0" }, - { 0x30b0, "\x30\xaf\x30\x99\0" }, - { 0x30b2, "\x30\xb1\x30\x99\0" }, - { 0x30b4, "\x30\xb3\x30\x99\0" }, - { 0x30b6, "\x30\xb5\x30\x99\0" }, - { 0x30b8, "\x30\xb7\x30\x99\0" }, - { 0x30ba, "\x30\xb9\x30\x99\0" }, - { 0x30bc, "\x30\xbb\x30\x99\0" }, - { 0x30be, "\x30\xbd\x30\x99\0" }, - { 0x30c0, "\x30\xbf\x30\x99\0" }, - { 0x30c2, "\x30\xc1\x30\x99\0" }, - { 0x30c5, "\x30\xc4\x30\x99\0" }, - { 0x30c7, "\x30\xc6\x30\x99\0" }, - { 0x30c9, "\x30\xc8\x30\x99\0" }, - { 0x30d0, "\x30\xcf\x30\x99\0" }, - { 0x30d1, "\x30\xcf\x30\x9a\0" }, - { 0x30d3, "\x30\xd2\x30\x99\0" }, - { 0x30d4, "\x30\xd2\x30\x9a\0" }, - { 0x30d6, "\x30\xd5\x30\x99\0" }, - { 0x30d7, "\x30\xd5\x30\x9a\0" }, - { 0x30d9, "\x30\xd8\x30\x99\0" }, - { 0x30da, "\x30\xd8\x30\x9a\0" }, - { 0x30dc, "\x30\xdb\x30\x99\0" }, - { 0x30dd, "\x30\xdb\x30\x9a\0" }, - { 0x30f4, "\x30\xa6\x30\x99\0" }, - { 0x30f7, "\x30\xef\x30\x99\0" }, - { 0x30f8, "\x30\xf0\x30\x99\0" }, - { 0x30f9, "\x30\xf1\x30\x99\0" }, - { 0x30fa, "\x30\xf2\x30\x99\0" }, - { 0x30fe, "\x30\xfd\x30\x99\0" }, - { 0xf900, "\x8c\x48\0" }, - { 0xf901, "\x66\xf4\0" }, - { 0xf902, "\x8e\xca\0" }, - { 0xf903, "\x8c\xc8\0" }, - { 0xf904, "\x6e\xd1\0" }, - { 0xf905, "\x4e\x32\0" }, - { 0xf906, "\x53\xe5\0" }, - { 0xf907, "\x9f\x9c\0" }, - { 0xf908, "\x9f\x9c\0" }, - { 0xf909, "\x59\x51\0" }, - { 0xf90a, "\x91\xd1\0" }, - { 0xf90b, "\x55\x87\0" }, - { 0xf90c, "\x59\x48\0" }, - { 0xf90d, "\x61\xf6\0" }, - { 0xf90e, "\x76\x69\0" }, - { 0xf90f, "\x7f\x85\0" }, - { 0xf910, "\x86\x3f\0" }, - { 0xf911, "\x87\xba\0" }, - { 0xf912, "\x88\xf8\0" }, - { 0xf913, "\x90\x8f\0" }, - { 0xf914, "\x6a\x02\0" }, - { 0xf915, "\x6d\x1b\0" }, - { 0xf916, "\x70\xd9\0" }, - { 0xf917, "\x73\xde\0" }, - { 0xf918, "\x84\x3d\0" }, - { 0xf919, "\x91\x6a\0" }, - { 0xf91a, "\x99\xf1\0" }, - { 0xf91b, "\x4e\x82\0" }, - { 0xf91c, "\x53\x75\0" }, - { 0xf91d, "\x6b\x04\0" }, - { 0xf91e, "\x72\x1b\0" }, - { 0xf91f, "\x86\x2d\0" }, - { 0xf920, "\x9e\x1e\0" }, - { 0xf921, "\x5d\x50\0" }, - { 0xf922, "\x6f\xeb\0" }, - { 0xf923, "\x85\xcd\0" }, - { 0xf924, "\x89\x64\0" }, - { 0xf925, "\x62\xc9\0" }, - { 0xf926, "\x81\xd8\0" }, - { 0xf927, "\x88\x1f\0" }, - { 0xf928, "\x5e\xca\0" }, - { 0xf929, "\x67\x17\0" }, - { 0xf92a, "\x6d\x6a\0" }, - { 0xf92b, "\x72\xfc\0" }, - { 0xf92c, "\x90\xce\0" }, - { 0xf92d, "\x4f\x86\0" }, - { 0xf92e, "\x51\xb7\0" }, - { 0xf92f, "\x52\xde\0" }, - { 0xf930, "\x64\xc4\0" }, - { 0xf931, "\x6a\xd3\0" }, - { 0xf932, "\x72\x10\0" }, - { 0xf933, "\x76\xe7\0" }, - { 0xf934, "\x80\x01\0" }, - { 0xf935, "\x86\x06\0" }, - { 0xf936, "\x86\x5c\0" }, - { 0xf937, "\x8d\xef\0" }, - { 0xf938, "\x97\x32\0" }, - { 0xf939, "\x9b\x6f\0" }, - { 0xf93a, "\x9d\xfa\0" }, - { 0xf93b, "\x78\x8c\0" }, - { 0xf93c, "\x79\x7f\0" }, - { 0xf93d, "\x7d\xa0\0" }, - { 0xf93e, "\x83\xc9\0" }, - { 0xf93f, "\x93\x04\0" }, - { 0xf940, "\x9e\x7f\0" }, - { 0xf941, "\x8a\xd6\0" }, - { 0xf942, "\x58\xdf\0" }, - { 0xf943, "\x5f\x04\0" }, - { 0xf944, "\x7c\x60\0" }, - { 0xf945, "\x80\x7e\0" }, - { 0xf946, "\x72\x62\0" }, - { 0xf947, "\x78\xca\0" }, - { 0xf948, "\x8c\xc2\0" }, - { 0xf949, "\x96\xf7\0" }, - { 0xf94a, "\x58\xd8\0" }, - { 0xf94b, "\x5c\x62\0" }, - { 0xf94c, "\x6a\x13\0" }, - { 0xf94d, "\x6d\xda\0" }, - { 0xf94e, "\x6f\x0f\0" }, - { 0xf94f, "\x7d\x2f\0" }, - { 0xf950, "\x7e\x37\0" }, - { 0xf951, "\x96\xfb\0" }, - { 0xf952, "\x52\xd2\0" }, - { 0xf953, "\x80\x8b\0" }, - { 0xf954, "\x51\xdc\0" }, - { 0xf955, "\x51\xcc\0" }, - { 0xf956, "\x7a\x1c\0" }, - { 0xf957, "\x7d\xbe\0" }, - { 0xf958, "\x83\xf1\0" }, - { 0xf959, "\x96\x75\0" }, - { 0xf95a, "\x8b\x80\0" }, - { 0xf95b, "\x62\xcf\0" }, - { 0xf95c, "\x6a\x02\0" }, - { 0xf95d, "\x8a\xfe\0" }, - { 0xf95e, "\x4e\x39\0" }, - { 0xf95f, "\x5b\xe7\0" }, - { 0xf960, "\x60\x12\0" }, - { 0xf961, "\x73\x87\0" }, - { 0xf962, "\x75\x70\0" }, - { 0xf963, "\x53\x17\0" }, - { 0xf964, "\x78\xfb\0" }, - { 0xf965, "\x4f\xbf\0" }, - { 0xf966, "\x5f\xa9\0" }, - { 0xf967, "\x4e\x0d\0" }, - { 0xf968, "\x6c\xcc\0" }, - { 0xf969, "\x65\x78\0" }, - { 0xf96a, "\x7d\x22\0" }, - { 0xf96b, "\x53\xc3\0" }, - { 0xf96c, "\x58\x5e\0" }, - { 0xf96d, "\x77\x01\0" }, - { 0xf96e, "\x84\x49\0" }, - { 0xf96f, "\x8a\xaa\0" }, - { 0xf970, "\x6b\xba\0" }, - { 0xf971, "\x8f\xb0\0" }, - { 0xf972, "\x6c\x88\0" }, - { 0xf973, "\x62\xfe\0" }, - { 0xf974, "\x82\xe5\0" }, - { 0xf975, "\x63\xa0\0" }, - { 0xf976, "\x75\x65\0" }, - { 0xf977, "\x4e\xae\0" }, - { 0xf978, "\x51\x69\0" }, - { 0xf979, "\x51\xc9\0" }, - { 0xf97a, "\x68\x81\0" }, - { 0xf97b, "\x7c\xe7\0" }, - { 0xf97c, "\x82\x6f\0" }, - { 0xf97d, "\x8a\xd2\0" }, - { 0xf97e, "\x91\xcf\0" }, - { 0xf97f, "\x52\xf5\0" }, - { 0xf980, "\x54\x42\0" }, - { 0xf981, "\x59\x73\0" }, - { 0xf982, "\x5e\xec\0" }, - { 0xf983, "\x65\xc5\0" }, - { 0xf984, "\x6f\xfe\0" }, - { 0xf985, "\x79\x2a\0" }, - { 0xf986, "\x95\xad\0" }, - { 0xf987, "\x9a\x6a\0" }, - { 0xf988, "\x9e\x97\0" }, - { 0xf989, "\x9e\xce\0" }, - { 0xf98a, "\x52\x9b\0" }, - { 0xf98b, "\x66\xc6\0" }, - { 0xf98c, "\x6b\x77\0" }, - { 0xf98d, "\x8f\x62\0" }, - { 0xf98e, "\x5e\x74\0" }, - { 0xf98f, "\x61\x90\0" }, - { 0xf990, "\x62\x00\0" }, - { 0xf991, "\x64\x9a\0" }, - { 0xf992, "\x6f\x23\0" }, - { 0xf993, "\x71\x49\0" }, - { 0xf994, "\x74\x89\0" }, - { 0xf995, "\x79\xca\0" }, - { 0xf996, "\x7d\xf4\0" }, - { 0xf997, "\x80\x6f\0" }, - { 0xf998, "\x8f\x26\0" }, - { 0xf999, "\x84\xee\0" }, - { 0xf99a, "\x90\x23\0" }, - { 0xf99b, "\x93\x4a\0" }, - { 0xf99c, "\x52\x17\0" }, - { 0xf99d, "\x52\xa3\0" }, - { 0xf99e, "\x54\xbd\0" }, - { 0xf99f, "\x70\xc8\0" }, - { 0xf9a0, "\x88\xc2\0" }, - { 0xf9a1, "\x8a\xaa\0" }, - { 0xf9a2, "\x5e\xc9\0" }, - { 0xf9a3, "\x5f\xf5\0" }, - { 0xf9a4, "\x63\x7b\0" }, - { 0xf9a5, "\x6b\xae\0" }, - { 0xf9a6, "\x7c\x3e\0" }, - { 0xf9a7, "\x73\x75\0" }, - { 0xf9a8, "\x4e\xe4\0" }, - { 0xf9a9, "\x56\xf9\0" }, - { 0xf9aa, "\x5b\xe7\0" }, - { 0xf9ab, "\x5d\xba\0" }, - { 0xf9ac, "\x60\x1c\0" }, - { 0xf9ad, "\x73\xb2\0" }, - { 0xf9ae, "\x74\x69\0" }, - { 0xf9af, "\x7f\x9a\0" }, - { 0xf9b0, "\x80\x46\0" }, - { 0xf9b1, "\x92\x34\0" }, - { 0xf9b2, "\x96\xf6\0" }, - { 0xf9b3, "\x97\x48\0" }, - { 0xf9b4, "\x98\x18\0" }, - { 0xf9b5, "\x4f\x8b\0" }, - { 0xf9b6, "\x79\xae\0" }, - { 0xf9b7, "\x91\xb4\0" }, - { 0xf9b8, "\x96\xb8\0" }, - { 0xf9b9, "\x60\xe1\0" }, - { 0xf9ba, "\x4e\x86\0" }, - { 0xf9bb, "\x50\xda\0" }, - { 0xf9bc, "\x5b\xee\0" }, - { 0xf9bd, "\x5c\x3f\0" }, - { 0xf9be, "\x65\x99\0" }, - { 0xf9bf, "\x6a\x02\0" }, - { 0xf9c0, "\x71\xce\0" }, - { 0xf9c1, "\x76\x42\0" }, - { 0xf9c2, "\x84\xfc\0" }, - { 0xf9c3, "\x90\x7c\0" }, - { 0xf9c4, "\x9f\x8d\0" }, - { 0xf9c5, "\x66\x88\0" }, - { 0xf9c6, "\x96\x2e\0" }, - { 0xf9c7, "\x52\x89\0" }, - { 0xf9c8, "\x67\x7b\0" }, - { 0xf9c9, "\x67\xf3\0" }, - { 0xf9ca, "\x6d\x41\0" }, - { 0xf9cb, "\x6e\x9c\0" }, - { 0xf9cc, "\x74\x09\0" }, - { 0xf9cd, "\x75\x59\0" }, - { 0xf9ce, "\x78\x6b\0" }, - { 0xf9cf, "\x7d\x10\0" }, - { 0xf9d0, "\x98\x5e\0" }, - { 0xf9d1, "\x51\x6d\0" }, - { 0xf9d2, "\x62\x2e\0" }, - { 0xf9d3, "\x96\x78\0" }, - { 0xf9d4, "\x50\x2b\0" }, - { 0xf9d5, "\x5d\x19\0" }, - { 0xf9d6, "\x6d\xea\0" }, - { 0xf9d7, "\x8f\x2a\0" }, - { 0xf9d8, "\x5f\x8b\0" }, - { 0xf9d9, "\x61\x44\0" }, - { 0xf9da, "\x68\x17\0" }, - { 0xf9db, "\x73\x87\0" }, - { 0xf9dc, "\x96\x86\0" }, - { 0xf9dd, "\x52\x29\0" }, - { 0xf9de, "\x54\x0f\0" }, - { 0xf9df, "\x5c\x65\0" }, - { 0xf9e0, "\x66\x13\0" }, - { 0xf9e1, "\x67\x4e\0" }, - { 0xf9e2, "\x68\xa8\0" }, - { 0xf9e3, "\x6c\xe5\0" }, - { 0xf9e4, "\x74\x06\0" }, - { 0xf9e5, "\x75\xe2\0" }, - { 0xf9e6, "\x7f\x79\0" }, - { 0xf9e7, "\x88\xcf\0" }, - { 0xf9e8, "\x88\xe1\0" }, - { 0xf9e9, "\x91\xcc\0" }, - { 0xf9ea, "\x96\xe2\0" }, - { 0xf9eb, "\x53\x3f\0" }, - { 0xf9ec, "\x6e\xba\0" }, - { 0xf9ed, "\x54\x1d\0" }, - { 0xf9ee, "\x71\xd0\0" }, - { 0xf9ef, "\x74\x98\0" }, - { 0xf9f0, "\x85\xfa\0" }, - { 0xf9f1, "\x96\xa3\0" }, - { 0xf9f2, "\x9c\x57\0" }, - { 0xf9f3, "\x9e\x9f\0" }, - { 0xf9f4, "\x67\x97\0" }, - { 0xf9f5, "\x6d\xcb\0" }, - { 0xf9f6, "\x81\xe8\0" }, - { 0xf9f7, "\x7a\xcb\0" }, - { 0xf9f8, "\x7b\x20\0" }, - { 0xf9f9, "\x7c\x92\0" }, - { 0xf9fa, "\x72\xc0\0" }, - { 0xf9fb, "\x70\x99\0" }, - { 0xf9fc, "\x8b\x58\0" }, - { 0xf9fd, "\x4e\xc0\0" }, - { 0xf9fe, "\x83\x36\0" }, - { 0xf9ff, "\x52\x3a\0" }, - { 0xfa00, "\x52\x07\0" }, - { 0xfa01, "\x5e\xa6\0" }, - { 0xfa02, "\x62\xd3\0" }, - { 0xfa03, "\x7c\xd6\0" }, - { 0xfa04, "\x5b\x85\0" }, - { 0xfa05, "\x6d\x1e\0" }, - { 0xfa06, "\x66\xb4\0" }, - { 0xfa07, "\x8f\x3b\0" }, - { 0xfa08, "\x88\x4c\0" }, - { 0xfa09, "\x96\x4d\0" }, - { 0xfa0a, "\x89\x8b\0" }, - { 0xfa0b, "\x5e\xd3\0" }, - { 0xfa0c, "\x51\x40\0" }, - { 0xfa0d, "\x55\xc0\0" }, - { 0xfa10, "\x58\x5a\0" }, - { 0xfa12, "\x66\x74\0" }, - { 0xfa15, "\x51\xde\0" }, - { 0xfa16, "\x73\x2a\0" }, - { 0xfa17, "\x76\xca\0" }, - { 0xfa18, "\x79\x3c\0" }, - { 0xfa19, "\x79\x5e\0" }, - { 0xfa1a, "\x79\x65\0" }, - { 0xfa1b, "\x79\x8f\0" }, - { 0xfa1c, "\x97\x56\0" }, - { 0xfa1d, "\x7c\xbe\0" }, - { 0xfa1e, "\x7f\xbd\0" }, - { 0xfa20, "\x86\x12\0" }, - { 0xfa22, "\x8a\xf8\0" }, - { 0xfa25, "\x90\x38\0" }, - { 0xfa26, "\x90\xfd\0" }, - { 0xfa2a, "\x98\xef\0" }, - { 0xfa2b, "\x98\xfc\0" }, - { 0xfa2c, "\x99\x28\0" }, - { 0xfa2d, "\x9d\xb4\0" }, - { 0xfb1f, "\x05\xf2\x05\xb7\0" }, - { 0xfb2a, "\x05\xe9\x05\xc1\0" }, - { 0xfb2b, "\x05\xe9\x05\xc2\0" }, - { 0xfb2c, "\x05\xe9\x05\xbc\x05\xc1\0" }, - { 0xfb2d, "\x05\xe9\x05\xbc\x05\xc2\0" }, - { 0xfb2e, "\x05\xd0\x05\xb7\0" }, - { 0xfb2f, "\x05\xd0\x05\xb8\0" }, - { 0xfb30, "\x05\xd0\x05\xbc\0" }, - { 0xfb31, "\x05\xd1\x05\xbc\0" }, - { 0xfb32, "\x05\xd2\x05\xbc\0" }, - { 0xfb33, "\x05\xd3\x05\xbc\0" }, - { 0xfb34, "\x05\xd4\x05\xbc\0" }, - { 0xfb35, "\x05\xd5\x05\xbc\0" }, - { 0xfb36, "\x05\xd6\x05\xbc\0" }, - { 0xfb38, "\x05\xd8\x05\xbc\0" }, - { 0xfb39, "\x05\xd9\x05\xbc\0" }, - { 0xfb3a, "\x05\xda\x05\xbc\0" }, - { 0xfb3b, "\x05\xdb\x05\xbc\0" }, - { 0xfb3c, "\x05\xdc\x05\xbc\0" }, - { 0xfb3e, "\x05\xde\x05\xbc\0" }, - { 0xfb40, "\x05\xe0\x05\xbc\0" }, - { 0xfb41, "\x05\xe1\x05\xbc\0" }, - { 0xfb43, "\x05\xe3\x05\xbc\0" }, - { 0xfb44, "\x05\xe4\x05\xbc\0" }, - { 0xfb46, "\x05\xe6\x05\xbc\0" }, - { 0xfb47, "\x05\xe7\x05\xbc\0" }, - { 0xfb48, "\x05\xe8\x05\xbc\0" }, - { 0xfb49, "\x05\xe9\x05\xbc\0" }, - { 0xfb4a, "\x05\xea\x05\xbc\0" }, - { 0xfb4b, "\x05\xd5\x05\xb9\0" }, - { 0xfb4c, "\x05\xd1\x05\xbf\0" }, - { 0xfb4d, "\x05\xdb\x05\xbf\0" }, - { 0xfb4e, "\x05\xe4\x05\xbf\0" } -}; - -/* - * WARNING! - * - * NO BUFFER CHECKING AHEAD! - * - */ - -static gint -e_canonical_decomposition (unicode_char_t ch, unicode_char_t * buf) -{ - gint len = 0; - - if (ch <= 0xffff) - { - int start = 0; - int end = sizeof (e_decomp_table) / sizeof (e_decomp_table[0]); - while (start != end) - { - int half = (start + end) / 2; - if (ch == e_decomp_table[half].ch) { - /* Found it. */ - int i; - /* We store as a double-nul terminated string. */ - for (len = 0; (e_decomp_table[half].expansion[len] || e_decomp_table[half].expansion[len + 1]); len += 2) ; - - /* We've counted twice as many bytes as there are - characters. */ - len /= 2; - - for (i = 0; i < len; i ++) { - buf[i] = (e_decomp_table[half].expansion[2 * i] << 8) | e_decomp_table[half].expansion[2 * i + 1]; - } - break; - } else if (ch > e_decomp_table[half].ch) { - if (start == half) break; - start = half; - } else { - if (end == half) break; - end = half; - } - } - } - - if (len == 0) - { - /* Not in our table. */ - *buf = ch; - len = 1; - } - - /* Supposedly following the Unicode 2.1.9 table means that the - decompositions come out in canonical order. I haven't tested - this, but we rely on it here. */ - return len; -} - -static unicode_char_t -e_stripped_char (unicode_char_t ch) -{ - unicode_char_t decomp[MAX_DECOMP]; - gint utype, dlen; - - utype = unicode_type (ch); - - switch (utype) { - case UNICODE_CONTROL: - case UNICODE_FORMAT: - case UNICODE_UNASSIGNED: - case UNICODE_COMBINING_MARK: - /* Ignore those */ - return 0; - break; - default: - /* Convert to lowercase, fall through */ - ch = unicode_tolower (ch); - case UNICODE_LOWERCASE_LETTER: - dlen = e_canonical_decomposition (ch, decomp); - if (dlen > 0) return *decomp; - break; - } - - return 0; -} diff --git a/widgets/misc/e-unicode.h b/widgets/misc/e-unicode.h deleted file mode 100644 index 14569ced7f..0000000000 --- a/widgets/misc/e-unicode.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef _E_UNICODE_H_ -#define _E_UNICODE_H_ - -/* - * UTF-8 support functions for gal - * - * Authors: - * Lauris Kaplinski <lauris@helixcode.com> - * - * Copyright (C) 2000-2001 Helix Code, Inc. - * - */ - -#include <sys/types.h> -#include <glib.h> -#include <gtk/gtk.h> -#include <config.h> -#include <libgnome/gnome-defs.h> - -BEGIN_GNOME_DECLS - -#ifdef USING_GNOME_PRINT_0_20 -#define gnome_font_get_size(f) ((f)->size) -#define gnome_font_get_glyph_width gnome_font_get_width -#define gnome_font_lookup_default gnome_font_get_glyph -#endif - -#define G_UTF8_IN_GAL - -void e_unicode_init (void); - -/* - * UTF-8 searching implementations - * - * e_utf8_strstrcase - case insensitive search - * e_utf8_strstrcasedecomp - case insensitive and decompositing search (i.e. accented - * letters are treated equal to their base letters, explicit accent marks (unicode - * not ascii/iso ones) are ignored). - */ - -const gchar *e_utf8_strstrcase (const gchar *haystack, const gchar *needle); -const gchar *e_utf8_strstrcasedecomp (const gchar *haystack, const gchar *needle); - -gchar *e_utf8_from_gtk_event_key (GtkWidget *widget, guint keyval, const gchar *string); - -gchar *e_utf8_from_gtk_string (GtkWidget *widget, const gchar *string); -gchar *e_utf8_from_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes); - -gchar *e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string); -gchar *e_utf8_to_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes); - -gchar *e_utf8_from_locale_string (const gchar *string); -gchar *e_utf8_from_locale_string_sized (const gchar *string, gint bytes); - -gchar *e_utf8_to_locale_string (const gchar *string); -gchar *e_utf8_to_locale_string_sized (const gchar *string, gint bytes); -/* - * These are simple wrappers that save us some typing - */ - -/* NB! This return newly allocated string, not const as gtk+ one */ - -gchar *e_utf8_gtk_entry_get_text (GtkEntry *entry); -void e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text); - -gchar *e_utf8_gtk_editable_get_text (GtkEditable *editable); -void e_utf8_gtk_editable_set_text (GtkEditable *editable, const gchar *text); -gchar *e_utf8_gtk_editable_get_chars (GtkEditable *editable, gint start, gint end); -void e_utf8_gtk_editable_insert_text (GtkEditable *editable, const gchar *text, gint length, gint *position); - -GtkWidget *e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu, const gchar *label); - -void e_utf8_gtk_clist_set_text (GtkCList *clist, gint row, gint col, const gchar *text); -gint e_utf8_gtk_clist_append (GtkCList *clist, gchar *text[]); - -gchar * e_utf8_xml1_decode (const gchar *text); -gchar * e_utf8_xml1_encode (const gchar *text); - -gint e_unichar_to_utf8 (gint c, gchar *outbuf); -guint32 gdk_keyval_to_unicode (guint keysym); - -END_GNOME_DECLS - -#endif - - diff --git a/widgets/misc/gal-categories.glade b/widgets/misc/gal-categories.glade deleted file mode 100644 index 4501c44452..0000000000 --- a/widgets/misc/gal-categories.glade +++ /dev/null @@ -1,175 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>categories</name> - <program_name>categories</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>False</gettext_support> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> - <backup_source_files>False</backup_source_files> - <output_translatable_strings>True</output_translatable_strings> - <translatable_strings_file>gal-categories.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>categories</name> - <visible>False</visible> - <title>categories</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox1</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button1</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button3</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - - <widget> - <class>GtkTable</class> - <name>table-categories</name> - <rows>4</rows> - <columns>1</columns> - <homogeneous>False</homogeneous> - <row_spacing>0</row_spacing> - <column_spacing>0</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkEntry</class> - <name>entry-categories</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label-header</name> - <label>Item(s) belong to these _categories:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>entry-categories</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label2</name> - <label>_Available Categories:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/widgets/misc/pixmaps/.cvsignore b/widgets/misc/pixmaps/.cvsignore deleted file mode 100644 index 3dda72986f..0000000000 --- a/widgets/misc/pixmaps/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile.in -Makefile diff --git a/widgets/misc/pixmaps/cursor_cross.xpm b/widgets/misc/pixmaps/cursor_cross.xpm deleted file mode 100644 index cf9d0aca33..0000000000 --- a/widgets/misc/pixmaps/cursor_cross.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static char * cursor_cross_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ....... ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" ......+++++...... ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" ......+++++....... ", -" .....+++++....... ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" ........ ", -" ....... ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_hand_closed.xpm b/widgets/misc/pixmaps/cursor_hand_closed.xpm deleted file mode 100644 index 61a6de4b88..0000000000 --- a/widgets/misc/pixmaps/cursor_hand_closed.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static char * cursor_hand_closed_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ", -" ", -" .. ", -" ..++... ", -" .+++++++.. ", -" .+++++++++. ", -" ...+++++++++. ", -" .++.+++++++++. ", -" .++++++++++++. ", -" .+++++++++++. ", -" .++++++++++. ", -" .+++++++++. ", -" .+++++++. ", -" .++++++. ", -" .++++++. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_hand_open.xpm b/widgets/misc/pixmaps/cursor_hand_open.xpm deleted file mode 100644 index 048acc8054..0000000000 --- a/widgets/misc/pixmaps/cursor_hand_open.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static char * cursor_hand_open_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" .. ", -" .. .++... ", -" .++..++.++. ", -" .++..++.++. . ", -" .++.++.++..+. ", -" .++.++.++.++. ", -" .. .+++++++.++. ", -" .++..++++++++++. ", -" .+++.+++++++++. ", -" .++++++++++++. ", -" .+++++++++++. ", -" .++++++++++. ", -" .+++++++++. ", -" .+++++++. ", -" .++++++. ", -" .++++++. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_zoom_in.xpm b/widgets/misc/pixmaps/cursor_zoom_in.xpm deleted file mode 100644 index 1caf9e3e2a..0000000000 --- a/widgets/misc/pixmaps/cursor_zoom_in.xpm +++ /dev/null @@ -1,37 +0,0 @@ -/* XPM */ -static char * cursor_zoom_in_xpm[] = { -"32 32 2 1", -" c None", -". c #000000", -" ", -" ", -" ", -" ", -" ", -" ", -" ...... ", -" .. .. ", -" .. .. ", -" . . ", -" . ... . ", -" . ... . ", -" . ....... . ", -" . ....... . ", -" . ... . ", -" . ... .. ", -" .. . . ", -" .. . . . ", -" ........ . . ", -" ..... . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . ", -" . . ", -" .. ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_zoom_out.xpm b/widgets/misc/pixmaps/cursor_zoom_out.xpm deleted file mode 100644 index af1b698521..0000000000 --- a/widgets/misc/pixmaps/cursor_zoom_out.xpm +++ /dev/null @@ -1,37 +0,0 @@ -/* XPM */ -static char * cursor_zoom_out_xpm[] = { -"32 32 2 1", -" c None", -". c #000000", -" ", -" ", -" ", -" ", -" ", -" ", -" ...... ", -" .. .. ", -" .. .. ", -" . . ", -" . . ", -" . . ", -" . ....... . ", -" . ....... . ", -" . . ", -" . .. ", -" .. . . ", -" .. . . . ", -" ........ . . ", -" ..... . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . ", -" . . ", -" .. ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/test-color.c b/widgets/misc/test-color.c deleted file mode 100644 index ed622201c8..0000000000 --- a/widgets/misc/test-color.c +++ /dev/null @@ -1,47 +0,0 @@ -#include <gnome.h> -#include "color.h" -#include "pixmaps/font.xpm" -#include "widget-color-combo.h" -#include "color-palette.h" - -/* To compile (from src/widgets): - -gcc -I.. -I../.. -L. -Wall -o tester tester.c ../color.c `gnome-config --cflags --libs gnome gnomeui` -lwidgets - -*/ - - -gint -main ( gint argc, gchar* argv[] ) -{ - GtkWidget * dialog; - GtkWidget * T; - - gnome_init ("tester", "1.0", argc, argv); - - dialog = gnome_dialog_new ("TESTER", GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, NULL); - T = color_palette_new("Color Palette", NULL, "for_colorgroup"); - - gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ), - T, TRUE, TRUE, 5); - gtk_widget_show_all (T); - - T = color_combo_new (font_xpm, _("Automatic"), - &gs_black, - "for_colorgroup"); - gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ), - T, TRUE, TRUE, 5); - gtk_widget_show_all (T); - - T = color_combo_new (font_xpm, _("Automatic"), - &gs_black, - "back_colorgroup"); - gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ), - T, TRUE, TRUE, 5); - gtk_widget_show_all (T); - - gnome_dialog_run_and_close ( GNOME_DIALOG (dialog) ); - return 0; -} - diff --git a/widgets/table/.cvsignore b/widgets/table/.cvsignore deleted file mode 100644 index b1004fee2c..0000000000 --- a/widgets/table/.cvsignore +++ /dev/null @@ -1,13 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -table-test -table-example-1 -table-example-2 -table-size-test -tree-example-1 -tree-example-2 diff --git a/widgets/table/add-col.xpm b/widgets/table/add-col.xpm deleted file mode 100644 index 9c5f314c8e..0000000000 --- a/widgets/table/add-col.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static char * add_col_xpm[] = { -"16 16 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ", -" .............. ", -" .++++++++++++. ", -" .++++++++++++. ", -" ....+++....... ", -" .+. ", -" . ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/table/arrow-down.xpm b/widgets/table/arrow-down.xpm deleted file mode 100644 index f1e6cb4b3c..0000000000 --- a/widgets/table/arrow-down.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const char * arrow_down_xpm[] = { -"13 16 2 1", -" c None", -". c #FF0000", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -".............", -" ........... ", -" ......... ", -" ....... ", -" ..... ", -" ... ", -" . "}; diff --git a/widgets/table/arrow-up.xpm b/widgets/table/arrow-up.xpm deleted file mode 100644 index 0cc5b9a00c..0000000000 --- a/widgets/table/arrow-up.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const char * arrow_up_xpm[] = { -"13 16 2 1", -" c None", -". c #FF0000", -" . ", -" ... ", -" ..... ", -" ....... ", -" ......... ", -" ........... ", -".............", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... "}; diff --git a/widgets/table/check-empty.xpm b/widgets/table/check-empty.xpm deleted file mode 100644 index 746b20234e..0000000000 --- a/widgets/table/check-empty.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const char * check_empty_xpm[] = { -"16 16 2 1", -" c None", -". c #000000", -" ", -" ", -" ............ ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" ............ ", -" ", -" "}; diff --git a/widgets/table/check-filled.xpm b/widgets/table/check-filled.xpm deleted file mode 100644 index c0468fc25b..0000000000 --- a/widgets/table/check-filled.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const char * check_filled_xpm[] = { -"16 16 2 1", -" c None", -". c #000000", -" ", -" ", -" ............ ", -" . . ", -" . . . ", -" . .. . ", -" . ... . ", -" . . ... . ", -" . .. ... . ", -" . ..... . ", -" . ... . ", -" . . . ", -" . . ", -" ............ ", -" ", -" "}; diff --git a/widgets/table/clip.png b/widgets/table/clip.png Binary files differdeleted file mode 100644 index 27aa5f072f..0000000000 --- a/widgets/table/clip.png +++ /dev/null diff --git a/widgets/table/e-cell-checkbox.c b/widgets/table/e-cell-checkbox.c deleted file mode 100644 index 2857388cb6..0000000000 --- a/widgets/table/e-cell-checkbox.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * e-cell-checkbox.c: Checkbox cell renderer - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 1999, 2000 Ximian, Inc - */ -#include <config.h> -#include <gtk/gtkenums.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkwindow.h> -#include <gtk/gtksignal.h> -#include <gdk/gdkkeysyms.h> -#include <libgnomeui/gnome-canvas.h> -#include "e-cell-checkbox.h" -#include "gal/util/e-util.h" -#include "e-table-item.h" - -#include "check-empty.xpm" -#include "check-filled.xpm" - -#define PARENT_TYPE e_cell_toggle_get_type () - -static GdkPixbuf *checks [2]; - -static void -e_cell_checkbox_class_init (GtkObjectClass *object_class) -{ - checks [0] = gdk_pixbuf_new_from_xpm_data (check_empty_xpm); - checks [1] = gdk_pixbuf_new_from_xpm_data (check_filled_xpm); -} - -E_MAKE_TYPE(e_cell_checkbox, "ECellCheckbox", ECellCheckbox, e_cell_checkbox_class_init, NULL, PARENT_TYPE); - -/** - * e_cell_checkbox_new: - * - * Creates a new ECell renderer that can be used to render check - * boxes. the data provided from the model is cast to an integer. - * zero is used for the off display, and non-zero for checked status. - * - * Returns: an ECell object that can be used to render checkboxes. - */ -ECell * -e_cell_checkbox_new (void) -{ - ECellCheckbox *eccb = gtk_type_new (e_cell_checkbox_get_type ()); - - e_cell_toggle_construct (E_CELL_TOGGLE (eccb), 2, 2, checks); - - return (ECell *) eccb; -} diff --git a/widgets/table/e-cell-checkbox.h b/widgets/table/e-cell-checkbox.h deleted file mode 100644 index 60c0341fe7..0000000000 --- a/widgets/table/e-cell-checkbox.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _E_CELL_CHECKBOX_H_ -#define _E_CELL_CHECKBOX_H_ - -#include <gal/e-table/e-cell-toggle.h> - -BEGIN_GNOME_DECLS - -#define E_CELL_CHECKBOX_TYPE (e_cell_checkbox_get_type ()) -#define E_CELL_CHECKBOX(o) (GTK_CHECK_CAST ((o), E_CELL_CHECKBOX_TYPE, ECellCheckbox)) -#define E_CELL_CHECKBOX_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_CHECKBOX_TYPE, ECellCheckboxClass)) -#define E_IS_CELL_CHECKBOX(o) (GTK_CHECK_TYPE ((o), E_CELL_CHECKBOX_TYPE)) -#define E_IS_CELL_CHECKBOX_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_CHECKBOX_TYPE)) - -typedef struct { - ECellToggle parent; -} ECellCheckbox; - -typedef struct { - ECellToggleClass parent_class; -} ECellCheckboxClass; - -GtkType e_cell_checkbox_get_type (void); -ECell *e_cell_checkbox_new (void); - -END_GNOME_DECLS - -#endif /* _E_CELL_CHECKBOX_H_ */ - diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c deleted file mode 100644 index 87f9ce6c9e..0000000000 --- a/widgets/table/e-cell-combo.c +++ /dev/null @@ -1,618 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin <damon@ximian.com> - * - * Copyright 2001, Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * ECellCombo - a subclass of ECellPopup used to support popup lists like a - * GtkCombo widget. It only supports a basic popup list of strings at present, - * with no auto-completion. - */ - -/* - * Notes: (handling pointer grabs and GTK+ grabs is a nightmare!) - * - * o We must grab the pointer when we show the popup, so that if any buttons - * are pressed outside the application we hide the popup. - * - * o We have to be careful when popping up any widgets which also grab the - * pointer at some point, since we will lose our own pointer grab. - * When we pop up a list it will grab the pointer itself when an item is - * selected, and release the grab when the button is released. - * Fortunately we hide the popup at this point, so it isn't a problem. - * But for other types of widgets in the popup it could cause trouble. - * - I think GTK+ should provide help for this (nested pointer grabs?). - * - * o We must set the 'owner_events' flag of the pointer grab to TRUE so that - * pointer events get reported to all the application windows as normal. - * If we don't do this then the widgets in the popup may not work properly. - * - * o We must do a gtk_grab_add() so that we only allow events to go to the - * widgets within the popup (though some special events still get reported - * to the widget owning the window). Doing th gtk_grab_add() on the toplevel - * popup window should be fine. We can then check for any events that should - * close the popup, like the Escape key, or a button press outside the popup. - */ - -#include <config.h> -#include <gdk/gdkkeysyms.h> -#include "gal/util/e-util.h" -#include "e-table-item.h" -#include "e-cell-combo.h" - - -/* The height to make the popup list if there aren't any items in it. */ -#define E_CELL_COMBO_LIST_EMPTY_HEIGHT 15 - - -static void e_cell_combo_class_init (GtkObjectClass *object_class); -static void e_cell_combo_init (ECellCombo *ecc); -static void e_cell_combo_destroy (GtkObject *object); - -static gint e_cell_combo_do_popup (ECellPopup *ecp, - GdkEvent *event); -static void e_cell_combo_select_matching_item (ECellCombo *ecc); -static void e_cell_combo_show_popup (ECellCombo *ecc); -static void e_cell_combo_get_popup_pos (ECellCombo *ecc, - gint *x, - gint *y, - gint *height, - gint *width); - -static gint e_cell_combo_button_press (GtkWidget *popup_window, - GdkEvent *event, - ECellCombo *ecc); -static gint e_cell_combo_button_release (GtkWidget *popup_window, - GdkEventButton *event, - ECellCombo *ecc); -static int e_cell_combo_key_press (GtkWidget *popup_window, - GdkEventKey *event, - ECellCombo *ecc); - -static void e_cell_combo_update_cell (ECellCombo *ecc); -static void e_cell_combo_restart_edit (ECellCombo *ecc); - - -static ECellPopupClass *parent_class; - - -E_MAKE_TYPE (e_cell_combo, "ECellCombo", ECellCombo, - e_cell_combo_class_init, e_cell_combo_init, - e_cell_popup_get_type()); - - -static void -e_cell_combo_class_init (GtkObjectClass *object_class) -{ - ECellPopupClass *ecpc = (ECellPopupClass *) object_class; - - object_class->destroy = e_cell_combo_destroy; - - ecpc->popup = e_cell_combo_do_popup; - - parent_class = gtk_type_class (e_cell_popup_get_type ()); -} - - -static void -e_cell_combo_init (ECellCombo *ecc) -{ - GtkWidget *frame; - - /* We create one popup window for the ECell, since there will only - ever be one popup in use at a time. */ - ecc->popup_window = gtk_window_new (GTK_WINDOW_POPUP); - - gtk_window_set_policy (GTK_WINDOW (ecc->popup_window), - TRUE, TRUE, FALSE); - - frame = gtk_frame_new (NULL); - gtk_container_add (GTK_CONTAINER (ecc->popup_window), frame); - gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); - gtk_widget_show (frame); - - ecc->popup_scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->hscrollbar, GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->vscrollbar, GTK_CAN_FOCUS); - gtk_container_add (GTK_CONTAINER (frame), ecc->popup_scrolled_window); - gtk_widget_show (ecc->popup_scrolled_window); - - ecc->popup_list = gtk_list_new (); - gtk_list_set_selection_mode (GTK_LIST (ecc->popup_list), - GTK_SELECTION_BROWSE); - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window), ecc->popup_list); - gtk_container_set_focus_vadjustment (GTK_CONTAINER (ecc->popup_list), - gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window))); - gtk_container_set_focus_hadjustment (GTK_CONTAINER (ecc->popup_list), - gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window))); - gtk_widget_show (ecc->popup_list); - - gtk_signal_connect (GTK_OBJECT (ecc->popup_window), - "button_press_event", - GTK_SIGNAL_FUNC (e_cell_combo_button_press), - ecc); - /* We use connect_after here so the list updates the selection before - we hide the popup and update the cell. */ - gtk_signal_connect_after (GTK_OBJECT (ecc->popup_window), - "button_release_event", - GTK_SIGNAL_FUNC (e_cell_combo_button_release), - ecc); - gtk_signal_connect (GTK_OBJECT (ecc->popup_window), - "key_press_event", - GTK_SIGNAL_FUNC (e_cell_combo_key_press), ecc); -} - - -/** - * e_cell_combo_new: - * - * Creates a new ECellCombo renderer. - * - * Returns: an ECellCombo object. - */ -ECell * -e_cell_combo_new (void) -{ - ECellCombo *ecc = gtk_type_new (e_cell_combo_get_type ()); - - return (ECell*) ecc; -} - - -/* - * GtkObject::destroy method - */ -static void -e_cell_combo_destroy (GtkObject *object) -{ - ECellCombo *ecc = E_CELL_COMBO (object); - - gtk_widget_unref (ecc->popup_window); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - - - -void -e_cell_combo_set_popdown_strings (ECellCombo *ecc, - GList *strings) -{ - GList *elem; - GtkWidget *listitem; - - g_return_if_fail (E_IS_CELL_COMBO (ecc)); - g_return_if_fail (strings != NULL); - - gtk_list_clear_items (GTK_LIST (ecc->popup_list), 0, -1); - elem = strings; - while (elem) { - listitem = gtk_list_item_new_with_label ((gchar *) elem->data); - gtk_widget_show (listitem); - gtk_container_add (GTK_CONTAINER (ecc->popup_list), listitem); - elem = elem->next; - } -} - - -static gint -e_cell_combo_do_popup (ECellPopup *ecp, - GdkEvent *event) -{ - ECellCombo *ecc = E_CELL_COMBO (ecp); - guint32 time; - gint error_code; - - e_cell_combo_show_popup (ecc); - e_cell_combo_select_matching_item (ecc); - - if (event->type == GDK_BUTTON_PRESS) { - GTK_LIST (ecc->popup_list)->drag_selection = TRUE; - time = event->button.time; - } else { - time = event->key.time; - } - - error_code = gdk_pointer_grab (ecc->popup_list->window, TRUE, - GDK_ENTER_NOTIFY_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_BUTTON1_MOTION_MASK, - NULL, NULL, time); - if (error_code != 0) - g_warning ("Failed to get pointer grab (%i)", error_code); - gtk_grab_add (ecc->popup_window); - - return TRUE; -} - - -static void -e_cell_combo_select_matching_item (ECellCombo *ecc) -{ - ECellPopup *ecp = E_CELL_POPUP (ecc); - ECellView *ecv = (ECellView*) ecp->popup_cell_view; - ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view); - ETableCol *ecol; - GtkList *list; - GtkWidget *listitem, *label; - GList *elem; - gboolean found = FALSE; - char *cell_text, *list_item_text; - - ecol = e_table_header_get_column (eti->header, ecp->popup_view_col); - cell_text = e_table_model_value_at (ecv->e_table_model, - ecol->col_idx, ecp->popup_row); - - list = GTK_LIST (ecc->popup_list); - elem = list->children; - while (elem) { - listitem = GTK_WIDGET (elem->data); - label = GTK_BIN (listitem)->child; - gtk_label_get (GTK_LABEL (label), &list_item_text); - - if (!strcmp (list_item_text, cell_text)) { - found = TRUE; - gtk_list_select_child (list, listitem); - gtk_widget_grab_focus (listitem); - break; - } - - elem = elem->next; - } - - if (!found) { - gtk_list_unselect_all (list); - if (list->children) - gtk_widget_grab_focus (GTK_WIDGET (list->children->data)); - } -} - - -static void -e_cell_combo_show_popup (ECellCombo *ecc) -{ - gint x, y, width, height, old_width, old_height; - - g_print ("In e_cell_popup_popup_list\n"); - - /* This code is practically copied from GtkCombo. */ - old_width = ecc->popup_window->allocation.width; - old_height = ecc->popup_window->allocation.height; - - e_cell_combo_get_popup_pos (ecc, &x, &y, &height, &width); - - /* workaround for gtk_scrolled_window_size_allocate bug */ - if (old_width != width || old_height != height) { - gtk_widget_hide (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->hscrollbar); - gtk_widget_hide (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->vscrollbar); - } - - gtk_widget_set_uposition (ecc->popup_window, x, y); - gtk_widget_set_usize (ecc->popup_window, width, height); - gtk_widget_realize (ecc->popup_window); - gdk_window_resize (ecc->popup_window->window, width, height); - gtk_widget_show (ecc->popup_window); - - E_CELL_POPUP (ecc)->popup_shown = TRUE; -} - - -/* Calculates the size and position of the popup window (like GtkCombo). */ -static void -e_cell_combo_get_popup_pos (ECellCombo *ecc, - gint *x, - gint *y, - gint *height, - gint *width) -{ - ECellPopup *ecp = E_CELL_POPUP (ecc); - ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view); - GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas); - GtkBin *popwin; - GtkScrolledWindow *popup; - GtkRequisition list_requisition; - gboolean show_vscroll = FALSE, show_hscroll = FALSE; - gint avail_height, avail_width, min_height, work_height, screen_width; - gint column_width, row_height, scrollbar_width; - double x1, y1; - - /* This code is practically copied from GtkCombo. */ - popup = GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window); - popwin = GTK_BIN (ecc->popup_window); - - gdk_window_get_origin (canvas->window, x, y); - - x1 = e_table_header_col_diff (eti->header, 0, eti->editing_col + 1); - y1 = e_table_item_row_diff (eti, 0, eti->editing_row + 1); - column_width = e_table_header_col_diff (eti->header, eti->editing_col, - eti->editing_col + 1); - row_height = e_table_item_row_diff (eti, eti->editing_row, - eti->editing_row + 1); - gnome_canvas_item_i2w (GNOME_CANVAS_ITEM (eti), &x1, &y1); - - *x += x1; - /* The ETable positions don't include the grid lines, I think, so we - add 1. */ - *y += y1 + 1; - - scrollbar_width = popup->vscrollbar->requisition.width - + GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT (popup)->klass)->scrollbar_spacing; - - avail_height = gdk_screen_height () - *y; - - /* We'll use the entire screen width if needed, but we save space for - the vertical scrollbar in case we need to show that. */ - screen_width = gdk_screen_width (); - avail_width = screen_width - scrollbar_width; - - gtk_widget_size_request (ecc->popup_list, &list_requisition); - min_height = MIN (list_requisition.height, - popup->vscrollbar->requisition.height); - if (!GTK_LIST (ecc->popup_list)->children) - list_requisition.height += E_CELL_COMBO_LIST_EMPTY_HEIGHT; - - /* Calculate the desired width. */ - *width = list_requisition.width - + 2 * popwin->child->style->klass->xthickness - + 2 * GTK_CONTAINER (popwin->child)->border_width - + 2 * GTK_CONTAINER (popup)->border_width - + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width - + 2 * GTK_BIN (popup)->child->style->klass->xthickness; - - /* Use at least the same width as the column. */ - if (*width < column_width) - *width = column_width; - - /* If it is larger than the available width, use that instead and show - the horizontal scrollbar. */ - if (*width > avail_width) { - *width = avail_width; - show_hscroll = TRUE; - } - - /* Calculate all the borders etc. that we need to add to the height. */ - work_height = (2 * popwin->child->style->klass->ythickness - + 2 * GTK_CONTAINER (popwin->child)->border_width - + 2 * GTK_CONTAINER (popup)->border_width - + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width - + 2 * GTK_BIN (popup)->child->style->klass->xthickness); - - /* Add on the height of the horizontal scrollbar if we need it. */ - if (show_hscroll) - work_height += popup->hscrollbar->requisition.height + - GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT (popup)->klass)->scrollbar_spacing; - - /* Check if it fits in the available height. */ - if (work_height + list_requisition.height > avail_height) { - /* It doesn't fit, so we see if we have the minimum space - needed. */ - if (work_height + min_height > avail_height - && *y - row_height > avail_height) { - /* We don't, so we show the popup above the cell - instead of below it. */ - avail_height = *y - row_height; - *y -= (work_height + list_requisition.height - + row_height); - if (*y < 0) - *y = 0; - } - } - - /* Check if we still need the vertical scrollbar. */ - if (work_height + list_requisition.height > avail_height) { - *width += scrollbar_width; - show_vscroll = TRUE; - } - - /* We try to line it up with the right edge of the column, but we don't - want it to go off the edges of the screen. */ - if (*x > screen_width) - *x = screen_width; - *x -= *width; - if (*x < 0) - *x = 0; - - if (show_vscroll) - *height = avail_height; - else - *height = work_height + list_requisition.height; -} - - - - - - -/* This handles button press events in the popup window. - Note that since we have a pointer grab on this window, we also get button - press events for windows outside the application here, so we hide the popup - window if that happens. We also get propagated events from child widgets - which we ignore. */ -static gint -e_cell_combo_button_press (GtkWidget *popup_window, - GdkEvent *event, - ECellCombo *ecc) -{ - GtkWidget *event_widget; - - g_print ("In e_cell_combo_button_press\n"); - - event_widget = gtk_get_event_widget (event); - - /* If the button press was for a widget inside the popup list, but - not the popup window itself, then we ignore the event and return - FALSE. Otherwise we will hide the popup. - Note that since we have a pointer grab on the popup list, button - presses outside the application will be reported to this window, - which is why we hide the popup in this case. */ - while (event_widget) { - event_widget = event_widget->parent; - if (event_widget == ecc->popup_list) - return FALSE; - } - - gtk_grab_remove (ecc->popup_window); - gdk_pointer_ungrab (event->button.time); - gtk_widget_hide (ecc->popup_window); - - E_CELL_POPUP (ecc)->popup_shown = FALSE; - - /* We don't want to update the cell here. Since the list is in browse - mode there will always be one item selected, so when we popup the - list one item is selected even if it doesn't match the current text - in the cell. So if you click outside the popup (which is what has - happened here) it is better to not update the cell. */ - /*e_cell_combo_update_cell (ecc);*/ - e_cell_combo_restart_edit (ecc); - - return TRUE; -} - - -/* This handles button release events in the popup window. If the button is - released inside the list, we want to hide the popup window and update the - cell with the new selection. */ -static gint -e_cell_combo_button_release (GtkWidget *popup_window, - GdkEventButton *event, - ECellCombo *ecc) -{ - GtkWidget *event_widget; - - event_widget = gtk_get_event_widget ((GdkEvent*) event); - - g_print ("In e_cell_popup_button_release event_widget:%s\n", - gtk_widget_get_name (event_widget)); - - /* See if the button was released in the list (or its children). */ - while (event_widget && event_widget != ecc->popup_list) - event_widget = event_widget->parent; - - /* If it wasn't, then we just ignore the event. */ - if (event_widget != ecc->popup_list) - return FALSE; - - /* The button was released inside the list, so we hide the popup and - update the cell to reflect the new selection. */ - gtk_grab_remove (ecc->popup_window); - gdk_pointer_ungrab (event->time); - gtk_widget_hide (ecc->popup_window); - - E_CELL_POPUP (ecc)->popup_shown = FALSE; - - e_cell_combo_update_cell (ecc); - e_cell_combo_restart_edit (ecc); - - return TRUE; -} - - -/* This handles key press events in the popup window. If the Escape key is - pressed we hide the popup, and do not change the cell contents. */ -static int -e_cell_combo_key_press (GtkWidget *popup_window, - GdkEventKey *event, - ECellCombo *ecc) -{ - g_print ("In e_cell_popup_key_press\n"); - - /* If the Escape key is pressed we hide the popup. */ - if (event->keyval != GDK_Escape - && event->keyval != GDK_Return - && event->keyval != GDK_KP_Enter - && event->keyval != GDK_ISO_Enter - && event->keyval != GDK_3270_Enter) - return FALSE; - - gtk_grab_remove (ecc->popup_window); - gdk_pointer_ungrab (event->time); - gtk_widget_hide (ecc->popup_window); - - E_CELL_POPUP (ecc)->popup_shown = FALSE; - - if (event->keyval != GDK_Escape) - e_cell_combo_update_cell (ecc); - - e_cell_combo_restart_edit (ecc); - - return TRUE; -} - - -static void -e_cell_combo_update_cell (ECellCombo *ecc) -{ - ECellPopup *ecp = E_CELL_POPUP (ecc); - ECellView *ecv = (ECellView*) ecp->popup_cell_view; - ETableItem *eti = E_TABLE_ITEM (ecv->e_table_item_view); - ETableCol *ecol; - GtkList *list = GTK_LIST (ecc->popup_list); - GtkListItem *listitem; - gchar *text, *old_text; - - g_print ("In e_cell_popup_update_cell\n"); - - /* Return if no item is selected. */ - if (list->selection == NULL) - return; - - /* Get the text of the selected item. */ - listitem = list->selection->data; - gtk_label_get (GTK_LABEL (GTK_BIN (listitem)->child), &text); - - /* Compare it with the existing cell contents. */ - ecol = e_table_header_get_column (eti->header, ecp->popup_view_col); - old_text = e_table_model_value_at (ecv->e_table_model, - ecol->col_idx, ecp->popup_row); - - g_print (" Old text: %s New text: %s\n", old_text, text); - - /* If they are different, update the cell contents. */ - if (strcmp (old_text, text)) { - g_print (" Setting cell text...\n"); - e_table_model_set_value_at (ecv->e_table_model, - ecol->col_idx, ecp->popup_row, - text); - g_print (" Set cell text.\n"); - } -} - - -static void -e_cell_combo_restart_edit (ECellCombo *ecc) -{ - /* This doesn't work. ETable stops the edit straight-away again. */ -#if 0 - ECellView *ecv = (ECellView*) ecc->popup_cell_view; - ETableItem *eti = E_TABLE_ITEM (ecv->e_table_item_view); - - e_table_item_enter_edit (eti, ecc->popup_view_col, ecc->popup_row); -#endif -} - - - diff --git a/widgets/table/e-cell-combo.h b/widgets/table/e-cell-combo.h deleted file mode 100644 index 9f8833d029..0000000000 --- a/widgets/table/e-cell-combo.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin <damon@ximian.com> - * - * Copyright 2001, Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * ECellCombo - a subclass of ECellPopup used to support popup lists like a - * GtkCombo widget. It only supports a basic popup list of strings at present, - * with no auto-completion. - */ - -#ifndef _E_CELL_COMBO_H_ -#define _E_CELL_COMBO_H_ - -#include <gal/e-table/e-cell-popup.h> - -#define E_CELL_COMBO_TYPE (e_cell_combo_get_type ()) -#define E_CELL_COMBO(o) (GTK_CHECK_CAST ((o), E_CELL_COMBO_TYPE, ECellCombo)) -#define E_CELL_COMBO_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_COMBO_TYPE, ECellComboClass)) -#define E_IS_CELL_COMBO(o) (GTK_CHECK_TYPE ((o), E_CELL_COMBO_TYPE)) -#define E_IS_CELL_COMBO_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_COMBO_TYPE)) - - -typedef struct { - ECellPopup parent; - - GtkWidget *popup_window; - GtkWidget *popup_scrolled_window; - GtkWidget *popup_list; -} ECellCombo; - -typedef struct { - ECellPopupClass parent_class; -} ECellComboClass; - - -GtkType e_cell_combo_get_type (void); -ECell *e_cell_combo_new (void); - -void e_cell_combo_set_popdown_strings (ECellCombo *ecc, - GList *strings); - -#endif /* _E_CELL_COMBO_H_ */ diff --git a/widgets/table/e-cell-date.c b/widgets/table/e-cell-date.c deleted file mode 100644 index a70147f0ce..0000000000 --- a/widgets/table/e-cell-date.c +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ECellDate - Date item for e-table. - * Copyright (C) 2001 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - */ - -#include <config.h> -#include "gal/util/e-i18n.h" -#include "e-cell-date.h" -#include <gnome.h> -#include <sys/time.h> -#include <unistd.h> -#include <gal/util/e-util.h> -#include <gal/widgets/e-unicode.h> - -#define PARENT_TYPE e_cell_text_get_type () - -static ECellTextClass *parent_class; - -static char * -ecd_get_text(ECellText *cell, ETableModel *model, int col, int row) -{ - time_t date = GPOINTER_TO_INT (e_table_model_value_at(model, col, row)); - time_t nowdate = time(NULL); - time_t yesdate; - struct tm then, now, yesterday; - char buf[26]; - gboolean done = FALSE; - - if (date == 0) { - return e_utf8_from_locale_string (_("?")); - } - - localtime_r (&date, &then); - localtime_r (&nowdate, &now); - if (then.tm_mday == now.tm_mday && - then.tm_mon == now.tm_mon && - then.tm_year == now.tm_year) { - strftime (buf, 26, _("Today %l:%M %p"), &then); - done = TRUE; - } - if (!done) { - yesdate = nowdate - 60 * 60 * 24; - localtime_r (&yesdate, &yesterday); - if (then.tm_mday == yesterday.tm_mday && - then.tm_mon == yesterday.tm_mon && - then.tm_year == yesterday.tm_year) { - strftime (buf, 26, _("Yesterday %l:%M %p"), &then); - done = TRUE; - } - } - if (!done) { - int i; - for (i = 2; i < 7; i++) { - yesdate = nowdate - 60 * 60 * 24 * i; - localtime_r (&yesdate, &yesterday); - if (then.tm_mday == yesterday.tm_mday && - then.tm_mon == yesterday.tm_mon && - then.tm_year == yesterday.tm_year) { - strftime (buf, 26, _("%a %l:%M %p"), &then); - done = TRUE; - break; - } - } - } - if (!done) { - if (then.tm_year == now.tm_year) { - strftime (buf, 26, _("%b %d %l:%M %p"), &then); - } else { - strftime (buf, 26, _("%b %d %Y"), &then); - } - } -#if 0 -#ifdef CTIME_R_THREE_ARGS - ctime_r (&date, buf, 26); -#else - ctime_r (&date, buf); -#endif -#endif - - return e_utf8_from_locale_string (buf); -} - -static void -ecd_free_text(ECellText *cell, char *text) -{ - g_free(text); -} - -static void -e_cell_date_class_init (GtkObjectClass *object_class) -{ - ECellTextClass *ectc = (ECellTextClass *) object_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - ectc->get_text = ecd_get_text; - ectc->free_text = ecd_free_text; -} - -static void -e_cell_date_init (GtkObject *object) -{ -} - -/** - * e_cell_date_new: - * @fontname: font to be used to render on the screen - * @justify: Justification of the string in the cell. - * - * Creates a new ECell renderer that can be used to render dates that - * that come from the model. The value returned from the model is - * interpreted as being a time_t. - * - * The ECellDate object support a large set of properties that can be - * configured through the Gtk argument system and allows the user to have - * a finer control of the way the string is displayed. The arguments supported - * allow the control of strikeout, bold, color and a date filter. - * - * The arguments "strikeout_column", "bold_column" and "color_column" set - * and return an integer that points to a column in the model that controls - * these settings. So controlling the way things are rendered is achieved - * by having special columns in the model that will be used to flag whether - * the date should be rendered with strikeout, or bolded. In the case of - * the "color_column" argument, the column in the model is expected to have - * a string that can be parsed by gdk_color_parse(). - * - * Returns: an ECell object that can be used to render dates. - */ -ECell * -e_cell_date_new (const char *fontname, GtkJustification justify) -{ - ECellDate *ecd = gtk_type_new (e_cell_date_get_type ()); - - e_cell_text_construct(E_CELL_TEXT(ecd), fontname, justify); - - return (ECell *) ecd; -} - -E_MAKE_TYPE(e_cell_date, "ECellDate", ECellDate, e_cell_date_class_init, e_cell_date_init, PARENT_TYPE); diff --git a/widgets/table/e-cell-date.h b/widgets/table/e-cell-date.h deleted file mode 100644 index 25bde7a85a..0000000000 --- a/widgets/table/e-cell-date.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ECellDate - Date item for e-table. - * Copyright (C) 2001 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - */ -#ifndef _E_CELL_DATE_H_ -#define _E_CELL_DATE_H_ - -#include <gal/e-table/e-cell-text.h> - -BEGIN_GNOME_DECLS - -#define E_CELL_DATE_TYPE (e_cell_date_get_type ()) -#define E_CELL_DATE(o) (GTK_CHECK_CAST ((o), E_CELL_DATE_TYPE, ECellDate)) -#define E_CELL_DATE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_DATE_TYPE, ECellDateClass)) -#define E_IS_CELL_DATE(o) (GTK_CHECK_TYPE ((o), E_CELL_DATE_TYPE)) -#define E_IS_CELL_DATE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_DATE_TYPE)) - -typedef struct { - ECellText base; -} ECellDate; - -typedef struct { - ECellTextClass parent_class; -} ECellDateClass; - -GtkType e_cell_date_get_type (void); -ECell *e_cell_date_new (const char *fontname, GtkJustification justify); - -END_GNOME_DECLS - -#endif /* _E_CELL_DATE_H_ */ diff --git a/widgets/table/e-cell-number.c b/widgets/table/e-cell-number.c deleted file mode 100644 index ebac2c78ed..0000000000 --- a/widgets/table/e-cell-number.c +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ECellNumber - Number item for e-table. - * Copyright (C) 2001 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - */ - -#include <config.h> -#include "gal/util/e-i18n.h" -#include "e-cell-number.h" -#include <gnome.h> -#include <sys/time.h> -#include <unistd.h> -#include <gal/util/e-util.h> - -#define PARENT_TYPE e_cell_text_get_type () - -static ECellTextClass *parent_class; - -static char * -ecn_get_text(ECellText *cell, ETableModel *model, int col, int row) -{ - return e_format_number(GPOINTER_TO_INT (e_table_model_value_at(model, col, row))); -} - -static void -ecn_free_text(ECellText *cell, char *text) -{ - g_free(text); -} - -static void -e_cell_number_class_init (GtkObjectClass *object_class) -{ - ECellTextClass *ectc = (ECellTextClass *) object_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - ectc->get_text = ecn_get_text; - ectc->free_text = ecn_free_text; -} - -static void -e_cell_number_init (GtkObject *object) -{ -} - -/** - * e_cell_number_new: - * @fontname: font to be used to render on the screen - * @justify: Justification of the string in the cell. - * - * Creates a new ECell renderer that can be used to render numbers that - * that come from the model. The value returned from the model is - * interpreted as being an int. - * - * See ECellText for other features. - * - * Returns: an ECell object that can be used to render numbers. - */ -ECell * -e_cell_number_new (const char *fontname, GtkJustification justify) -{ - ECellNumber *ecn = gtk_type_new (e_cell_number_get_type ()); - - e_cell_text_construct(E_CELL_TEXT(ecn), fontname, justify); - - return (ECell *) ecn; -} - -E_MAKE_TYPE(e_cell_number, "ECellNumber", ECellNumber, e_cell_number_class_init, e_cell_number_init, PARENT_TYPE); diff --git a/widgets/table/e-cell-number.h b/widgets/table/e-cell-number.h deleted file mode 100644 index b9124bb2b0..0000000000 --- a/widgets/table/e-cell-number.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ECellNumber - Number item for e-table. - * Copyright (C) 2001 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - */ -#ifndef _E_CELL_NUMBER_H_ -#define _E_CELL_NUMBER_H_ - -#include <gal/e-table/e-cell-text.h> - -BEGIN_GNOME_DECLS - -#define E_CELL_NUMBER_TYPE (e_cell_number_get_type ()) -#define E_CELL_NUMBER(o) (GTK_CHECK_CAST ((o), E_CELL_NUMBER_TYPE, ECellNumber)) -#define E_CELL_NUMBER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_NUMBER_TYPE, ECellNumberClass)) -#define E_IS_CELL_NUMBER(o) (GTK_CHECK_TYPE ((o), E_CELL_NUMBER_TYPE)) -#define E_IS_CELL_NUMBER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_NUMBER_TYPE)) - -typedef struct { - ECellText base; -} ECellNumber; - -typedef struct { - ECellTextClass parent_class; -} ECellNumberClass; - -GtkType e_cell_number_get_type (void); -ECell *e_cell_number_new (const char *fontname, GtkJustification justify); - -END_GNOME_DECLS - -#endif /* _E_CELL_NUMBER_H_ */ diff --git a/widgets/table/e-cell-pixbuf.c b/widgets/table/e-cell-pixbuf.c deleted file mode 100644 index 0321474677..0000000000 --- a/widgets/table/e-cell-pixbuf.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * e-cell-pixbuf.c: An ECell that displays a GdkPixbuf - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Vladimir Vukicevic <vladimir@ximian.com> - * - */ - -#include <glib.h> -#include <gtk/gtk.h> - -#include <stdio.h> - -#include <libgnomeui/libgnomeui.h> - -#include "e-cell-pixbuf.h" - -static ECellClass *parent_class; - -typedef struct _ECellPixbufView ECellPixbufView; - -struct _ECellPixbufView { - ECellView cell_view; - GdkGC *gc; - GnomeCanvas *canvas; -}; - -/* - * ECellPixbuf functions - */ - -ECell * -e_cell_pixbuf_new (void) -{ - ECellPixbuf *ecp; - - ecp = gtk_type_new (E_CELL_PIXBUF_TYPE); - e_cell_pixbuf_construct (ecp); - - return (ECell *) ecp; -} - -void -e_cell_pixbuf_construct (ECellPixbuf *ecp) -{ - /* noop */ - return; -} - -/* - * ECell methods - */ - -static ECellView * -pixbuf_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - ECellPixbufView *pixbuf_view = g_new0 (ECellPixbufView, 1); - ETableItem *eti = E_TABLE_ITEM (e_table_item_view); - GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas; - - pixbuf_view->cell_view.ecell = ecell; - pixbuf_view->cell_view.e_table_model = table_model; - pixbuf_view->cell_view.e_table_item_view = e_table_item_view; - pixbuf_view->canvas = canvas; - - return (ECellView *) pixbuf_view; -} - -static void -pixbuf_kill_view (ECellView *ecell_view) -{ - ECellPixbufView *pixbuf_view = (ECellPixbufView *) ecell_view; - - g_free (pixbuf_view); -} - -static void -pixbuf_realize (ECellView *ecell_view) -{ - ECellPixbufView *pixbuf_view = (ECellPixbufView *) ecell_view; - - pixbuf_view->gc = gdk_gc_new (GTK_WIDGET (pixbuf_view->canvas)->window); -} - -static void -pixbuf_unrealize (ECellView *ecell_view) -{ - ECellPixbufView *pixbuf_view = (ECellPixbufView *) ecell_view; - - gdk_gc_unref (pixbuf_view->gc); -} - -static void -pixbuf_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, ECellFlags flags, - int x1, int y1, int x2, int y2) -{ - ECellPixbufView *pixbuf_view = (ECellPixbufView *) ecell_view; - GdkPixbuf *cell_pixbuf; - int real_x, real_y, real_w, real_h; - int pix_w, pix_h; - - cell_pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, - model_col, row); - /* we can't make sure we really got a pixbuf since, well, it's a Gdk thing */ - - if (x2 - x1 == 0) - return; - - pix_w = gdk_pixbuf_get_width (cell_pixbuf); - pix_h = gdk_pixbuf_get_height (cell_pixbuf); - - /* We center the pixbuf within our allocated space */ - if (x2 - x1 > pix_w) { - int diff = (x2 - x1) - pix_w; - real_x = x1 + diff/2; - real_w = pix_w; - } else { - real_x = x1; - real_w = x2 - x1; - } - - if (y2 - y1 > pix_h) { - int diff = (y2 - y1) - pix_h; - real_y = y1 + diff/2; - real_h = pix_h; - } else { - real_y = y1; - real_h = y2 - y1; - } - - - gdk_pixbuf_render_to_drawable (cell_pixbuf, - drawable, - pixbuf_view->gc, - 0, 0, - real_x, real_y, - real_w, real_h, - GDK_RGB_DITHER_NORMAL, - 0, 0); -} - -static gint -pixbuf_event (ECellView *ecell_view, GdkEvent *event, - int model_col, int view_col, int row, - ECellFlags flags, ECellActions *actions) -{ - /* noop */ - - return FALSE; -} - -static gint -pixbuf_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - GdkPixbuf *pixbuf; - - pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, model_col, row); - if (!pixbuf) { - /* ??? */ - g_warning ("e-cell-pixbuf: height with NULL pixbuf at %d %d %d\n", model_col, view_col, row); - return 0; - } - - /* We give ourselves 3 pixels of padding on either side */ - return gdk_pixbuf_get_height (pixbuf) + 6; -} - -static gint -pixbuf_max_width (ECellView *ecell_view, int model_col, int view_col) -{ - gint num_rows, i; - gint max_width = -1; - - if (model_col == 0) { - num_rows = e_table_model_row_count (ecell_view->e_table_model); - - for (i = 0; i <= num_rows; i++) { - GdkPixbuf *pixbuf = (GdkPixbuf *) e_table_model_value_at - (ecell_view->e_table_model, - model_col, - i); - int pw = gdk_pixbuf_get_width (pixbuf); - if (max_width < pw) - max_width = pw; - } - } else { - return -1; - } - - return max_width; -} - -static void -pixbuf_destroy (GtkObject *object) -{ - /* ... */ -} - -static void -e_cell_pixbuf_init (GtkObject *object) -{ - /* ... */ -} - -static void -e_cell_pixbuf_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - - object_class->destroy = pixbuf_destroy; - - ecc->new_view = pixbuf_new_view; - ecc->kill_view = pixbuf_kill_view; - ecc->realize = pixbuf_realize; - ecc->unrealize = pixbuf_unrealize; - ecc->draw = pixbuf_draw; - ecc->event = pixbuf_event; - ecc->height = pixbuf_height; - ecc->max_width = pixbuf_max_width; - - parent_class = gtk_type_class (E_CELL_TYPE); -} - -guint -e_cell_pixbuf_get_type (void) -{ - static guint type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "ECellPixbuf", - sizeof (ECellPixbuf), - sizeof (ECellPixbufClass), - (GtkClassInitFunc) e_cell_pixbuf_class_init, - (GtkObjectInitFunc) e_cell_pixbuf_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL, - }; - - type = gtk_type_unique (e_cell_get_type (), &type_info); - } - - return type; -} - diff --git a/widgets/table/e-cell-pixbuf.h b/widgets/table/e-cell-pixbuf.h deleted file mode 100644 index b300f410ba..0000000000 --- a/widgets/table/e-cell-pixbuf.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * e-cell-pixbuf.h: An ECell that displays a GdkPixbuf - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Vladimir Vukicevic <vladimir@ximian.com> - * - */ - -#ifndef _E_CELL_PIXBUF_H_ -#define _E_CELL_PIXBUF_H_ - -#include <glib.h> - -#include <gal/e-table/e-table.h> - -#define E_CELL_PIXBUF_TYPE (e_cell_pixbuf_get_type ()) -#define E_CELL_PIXBUF(o) (GTK_CHECK_CAST ((o), E_CELL_PIXBUF_TYPE, ECellPixbuf)) -#define E_CELL_PIXBUF_CLASS(k) (GTK_CHECK_CAST_CLASS ((k), E_CELL_PIXBUF_TYPE, ECellPixbufClass)) -#define E_IS_CELL_PIXBUF(o) (GTK_CHECK_TYPE ((o), E_CELL_PIXBUF_TYPE)) -#define E_IS_CELL_PIXBUF_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_PIXBUF_TYPE)) - -typedef struct _ECellPixbuf ECellPixbuf; -typedef struct _ECellPixbufClass ECellPixbufClass; - -struct _ECellPixbuf { - ECell parent; -}; - -struct _ECellPixbufClass { - ECellClass parent_class; -}; - -GtkType e_cell_pixbuf_get_type (void); -ECell *e_cell_pixbuf_new (void); -void e_cell_pixbuf_construct (ECellPixbuf *ecp); - -#endif diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c deleted file mode 100644 index a4bba62555..0000000000 --- a/widgets/table/e-cell-popup.c +++ /dev/null @@ -1,504 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin <damon@ximian.com> - * - * Copyright 2001, Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * ECellPopup - an abstract ECell class used to support popup selections like - * a GtkCombo widget. It contains a child ECell, e.g. an ECellText, but when - * selected it displays an arrow on the right edge which the user can click to - * show a popup. Subclasses implement the popup class function to show the - * popup. - */ - -#include <config.h> -#include <gdk/gdkkeysyms.h> -#include "gal/util/e-util.h" -#include "e-table-item.h" -#include "e-cell-popup.h" - - -#define E_CELL_POPUP_ARROW_WIDTH 16 -#define E_CELL_POPUP_ARROW_XPAD 3 -#define E_CELL_POPUP_ARROW_YPAD 3 - - -static void e_cell_popup_class_init (GtkObjectClass *object_class); -static void e_cell_popup_init (ECellPopup *ecp); -static void e_cell_popup_destroy (GtkObject *object); - - -static ECellView* ecp_new_view (ECell *ecell, - ETableModel *table_model, - void *e_table_item_view); -static void ecp_kill_view (ECellView *ecv); -static void ecp_realize (ECellView *ecv); -static void ecp_unrealize (ECellView *ecv); -static void ecp_draw (ECellView *ecv, - GdkDrawable *drawable, - int model_col, - int view_col, - int row, - ECellFlags flags, - int x1, - int y1, - int x2, - int y2); -static gint ecp_event (ECellView *ecv, - GdkEvent *event, - int model_col, - int view_col, - int row, - ECellFlags flags, - ECellActions *actions); -static int ecp_height (ECellView *ecv, - int model_col, - int view_col, - int row); -static void* ecp_enter_edit (ECellView *ecv, - int model_col, - int view_col, - int row); -static void ecp_leave_edit (ECellView *ecv, - int model_col, - int view_col, - int row, - void *edit_context); -static void ecp_print (ECellView *ecv, - GnomePrintContext *context, - int model_col, - int view_col, - int row, - double width, - double height); -static gdouble ecp_print_height (ECellView *ecv, - GnomePrintContext *context, - int model_col, - int view_col, - int row, - double width); -static int ecp_max_width (ECellView *ecv, - int model_col, - int view_col); -static void ecp_show_tooltip (ECellView *ecv, - int model_col, - int view_col, - int row, - int col_width, - ETableTooltip *tooltip); - -static gint e_cell_popup_do_popup (ECellPopupView *ecp_view, - GdkEvent *event); - -static ECellClass *parent_class; - - -E_MAKE_TYPE (e_cell_popup, "ECellPopup", ECellPopup, e_cell_popup_class_init, - e_cell_popup_init, e_cell_get_type()); - - -static void -e_cell_popup_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - - object_class->destroy = e_cell_popup_destroy; - - ecc->new_view = ecp_new_view; - ecc->kill_view = ecp_kill_view; - ecc->realize = ecp_realize; - ecc->unrealize = ecp_unrealize; - ecc->draw = ecp_draw; - ecc->event = ecp_event; - ecc->height = ecp_height; - ecc->enter_edit = ecp_enter_edit; - ecc->leave_edit = ecp_leave_edit; - ecc->print = ecp_print; - ecc->print_height = ecp_print_height; - ecc->max_width = ecp_max_width; - ecc->show_tooltip = ecp_show_tooltip; - - parent_class = gtk_type_class (e_cell_get_type ()); -} - - -static void -e_cell_popup_init (ECellPopup *ecp) -{ - ecp->popup_shown = FALSE; -} - - -/** - * e_cell_popup_new: - * - * Creates a new ECellPopup renderer. - * - * Returns: an ECellPopup object. - */ -ECell * -e_cell_popup_new (void) -{ - ECellPopup *ecp = gtk_type_new (e_cell_popup_get_type ()); - - return (ECell*) ecp; -} - - -/* - * GtkObject::destroy method - */ -static void -e_cell_popup_destroy (GtkObject *object) -{ - ECellPopup *ecp = E_CELL_POPUP (object); - - gtk_object_unref (GTK_OBJECT (ecp->child)); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - - - -/* - * ECell::new_view method - */ -static ECellView * -ecp_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - ECellPopup *ecp = E_CELL_POPUP (ecell); - ECellPopupView *ecp_view; - - /* We must have a child ECell before we create any views. */ - g_return_val_if_fail (ecp->child != NULL, NULL); - - ecp_view = g_new0 (ECellPopupView, 1); - - ecp_view->cell_view.ecell = ecell; - ecp_view->cell_view.e_table_model = table_model; - ecp_view->cell_view.e_table_item_view = e_table_item_view; - - ecp_view->child_view = e_cell_new_view (ecp->child, table_model, - e_table_item_view); - - return (ECellView*) ecp_view; -} - - -/* - * ECell::kill_view method - */ -static void -ecp_kill_view (ECellView *ecv) -{ - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - - if (ecp_view->child_view) - e_cell_kill_view (ecp_view->child_view); - g_free (ecp_view); -} - - -/* - * ECell::realize method - */ -static void -ecp_realize (ECellView *ecv) -{ - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - - e_cell_realize (ecp_view->child_view); - - if (parent_class->realize) - (* parent_class->realize) (ecv); -} - - -/* - * ECell::unrealize method - */ -static void -ecp_unrealize (ECellView *ecv) -{ - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - - e_cell_realize (ecp_view->child_view); - - if (parent_class->unrealize) - (* parent_class->unrealize) (ecv); -} - - -/* - * ECell::draw method - */ -static void -ecp_draw (ECellView *ecv, GdkDrawable *drawable, - int model_col, int view_col, int row, ECellFlags flags, - int x1, int y1, int x2, int y2) -{ - ECellPopup *ecp = E_CELL_POPUP (ecv->ecell); - ETableItem *eti = E_TABLE_ITEM (ecv->e_table_item_view); - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ecv->e_table_item_view)->canvas); - GtkShadowType shadow; - GdkRectangle rect; - gboolean show_popup_arrow = FALSE; - - /* Display the popup arrow if we are editing this cell, or the popup - is shown for this cell. */ - if (eti->editing_col == view_col && eti->editing_row == row) { - show_popup_arrow = TRUE; - ecp->popup_arrow_shown = TRUE; - - } else if (ecp->popup_shown && ecp->popup_view_col == view_col - && ecp->popup_row == row) { - show_popup_arrow = TRUE; - } - - if (eti->editing_col == -1) - ecp->popup_arrow_shown = FALSE; - -#if 0 - g_print ("In ecp_draw row:%i col: %i %i,%i %i,%i Show Arrow:%i\n", - row, view_col, x1, y1, x2, y2, show_popup_arrow); -#endif - - if (show_popup_arrow) { - e_cell_draw (ecp_view->child_view, drawable, model_col, - view_col, row, flags, - x1, y1, x2 - E_CELL_POPUP_ARROW_WIDTH, y2); - - rect.x = x2 - E_CELL_POPUP_ARROW_WIDTH; - rect.y = y1 + 1; - rect.width = E_CELL_POPUP_ARROW_WIDTH; - rect.height = y2 - y1 - 2; - - if (ecp->popup_shown) - shadow = GTK_SHADOW_IN; - else - shadow = GTK_SHADOW_OUT; - - gtk_paint_box (canvas->style, drawable, - GTK_STATE_NORMAL, shadow, - &rect, canvas, "ecellpopup", - rect.x, rect.y, rect.width, rect.height); - gtk_paint_arrow (canvas->style, drawable, - GTK_STATE_NORMAL, shadow, - &rect, canvas, NULL, - GTK_ARROW_DOWN, TRUE, - rect.x + E_CELL_POPUP_ARROW_XPAD, - rect.y + E_CELL_POPUP_ARROW_YPAD, - rect.width - E_CELL_POPUP_ARROW_XPAD * 2, - rect.height - E_CELL_POPUP_ARROW_YPAD * 2); - } else { - e_cell_draw (ecp_view->child_view, drawable, model_col, - view_col, row, flags, x1, y1, x2, y2); - } -} - - -/* - * ECell::event method - */ -static gint -ecp_event (ECellView *ecv, GdkEvent *event, int model_col, int view_col, - int row, ECellFlags flags, ECellActions *actions) -{ - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - ECellPopup *ecp = E_CELL_POPUP (ecp_view->cell_view.ecell); - ETableItem *eti = E_TABLE_ITEM (ecv->e_table_item_view); - int width; - - switch (event->type) { - case GDK_BUTTON_PRESS: - if (eti->editing_col == view_col && eti->editing_row == row - && ecp->popup_arrow_shown) { - width = e_table_header_col_diff (eti->header, view_col, - view_col + 1); - - g_print ("Event in item popup width: %i button: %g,%g\n", - width, event->button.x, event->button.y); - - /* FIXME: The event coords seem to be relative to the - text within the cell, so we have to add 4. */ - if (event->button.x + 4 >= width - E_CELL_POPUP_ARROW_WIDTH) { - return e_cell_popup_do_popup (ecp_view, event); - } - } - break; - case GDK_BUTTON_RELEASE: - break; - case GDK_KEY_PRESS: - if (event->key.state & GDK_MOD1_MASK - && event->key.keyval == GDK_Down) { - g_print ("## Alt-Down pressed\n"); - return e_cell_popup_do_popup (ecp_view, event); - } - g_print ("Key Press Event ECellPopup\n"); - break; - default: - break; - } - - return e_cell_event (ecp_view->child_view, event, model_col, view_col, - row, flags, actions); -} - - -/* - * ECell::height method - */ -static int -ecp_height (ECellView *ecv, int model_col, int view_col, int row) -{ - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - - return e_cell_height (ecp_view->child_view, model_col, view_col, row); -} - - -/* - * ECellView::enter_edit method - */ -static void * -ecp_enter_edit (ECellView *ecv, int model_col, int view_col, int row) -{ - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - ECellPopup *ecp = E_CELL_POPUP (ecp_view->cell_view.ecell); - - g_print ("In ecp_enter_edit model_col: %i view_col: %i row: %i\n", - model_col, view_col, row); - - if (ecp->popup_view_col != view_col || ecp->popup_row != row) - ecp->popup_arrow_shown = FALSE; - - ecp->popup_view_col = view_col; - ecp->popup_row = row; - - return e_cell_enter_edit (ecp_view->child_view, model_col, view_col, row); -} - - -/* - * ECellView::leave_edit method - */ -static void -ecp_leave_edit (ECellView *ecv, int model_col, int view_col, int row, - void *edit_context) -{ - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - - g_print ("In ecp_leave_edit model_col: %i view_col: %i row: %i\n", - model_col, view_col, row); - - e_cell_leave_edit (ecp_view->child_view, model_col, view_col, row, - edit_context); -} - - -static void -ecp_print (ECellView *ecv, GnomePrintContext *context, - int model_col, int view_col, int row, double width, double height) -{ - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - - e_cell_print (ecp_view->child_view, context, model_col, view_col, row, - width, height); -} - - -static gdouble -ecp_print_height (ECellView *ecv, GnomePrintContext *context, - int model_col, int view_col, int row, - double width) -{ - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - - return e_cell_print_height (ecp_view->child_view, context, model_col, - view_col, row, width); -} - - -static int -ecp_max_width (ECellView *ecv, - int model_col, - int view_col) -{ - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - - return e_cell_max_width (ecp_view->child_view, model_col, view_col); -} - - -static void -ecp_show_tooltip (ECellView *ecv, - int model_col, - int view_col, - int row, - int col_width, - ETableTooltip *tooltip) -{ - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - - e_cell_show_tooltip (ecp_view->child_view, model_col, view_col, row, - col_width, tooltip); -} - - - -ECell* -e_cell_popup_get_child (ECellPopup *ecp) -{ - g_return_val_if_fail (E_IS_CELL_POPUP (ecp), NULL); - - return ecp->child; -} - - -void -e_cell_popup_set_child (ECellPopup *ecp, - ECell *child) -{ - g_return_if_fail (E_IS_CELL_POPUP (ecp)); - - if (ecp->child) - gtk_object_unref (GTK_OBJECT (ecp->child)); - - ecp->child = child; - gtk_object_ref (GTK_OBJECT (child)); -} - - -static gint -e_cell_popup_do_popup (ECellPopupView *ecp_view, - GdkEvent *event) -{ - ECellPopup *ecp = E_CELL_POPUP (ecp_view->cell_view.ecell); - gint (*popup_func) (ECellPopup *ecp, GdkEvent *event); - - ecp->popup_cell_view = ecp_view; - - popup_func = E_CELL_POPUP_CLASS (GTK_OBJECT (ecp)->klass)->popup; - - return popup_func ? popup_func (ecp, event) : FALSE; -} diff --git a/widgets/table/e-cell-popup.h b/widgets/table/e-cell-popup.h deleted file mode 100644 index 2ccfd730ae..0000000000 --- a/widgets/table/e-cell-popup.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin <damon@ximian.com> - * - * Copyright 2001, Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * ECellPopup - an ECell used to support popup selections like a GtkCombo - * widget. It contains a child ECell, e.g. an ECellText, but when selected it - * displays an arrow on the right edge which the user can click to show a - * popup. It will support subclassing or signals so that different types of - * popup can be provided. - */ - -#ifndef _E_CELL_POPUP_H_ -#define _E_CELL_POPUP_H_ - -#include <libgnomeui/gnome-canvas.h> -#include <gal/e-table/e-cell.h> - -#define E_CELL_POPUP_TYPE (e_cell_popup_get_type ()) -#define E_CELL_POPUP(o) (GTK_CHECK_CAST ((o), E_CELL_POPUP_TYPE, ECellPopup)) -#define E_CELL_POPUP_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_POPUP_TYPE, ECellPopupClass)) -#define E_IS_CELL_POPUP(o) (GTK_CHECK_TYPE ((o), E_CELL_POPUP_TYPE)) -#define E_IS_CELL_POPUP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_POPUP_TYPE)) - -typedef struct _ECellPopupView ECellPopupView; - -typedef struct { - ECell parent; - - ECell *child; - - /* This is TRUE if the popup window is shown for the cell being - edited. While shown we display the arrow indented. */ - gboolean popup_shown; - - /* This is TRUE if the popup arrow is shown for the cell being edited. - This is needed to stop the first click on the cell from popping up - the popup window. We only popup the window after we have drawn the - arrow. */ - gboolean popup_arrow_shown; - - /* The view in which the popup is shown. */ - ECellPopupView *popup_cell_view; - - gint popup_view_col; - gint popup_row; -} ECellPopup; - - -typedef struct { - ECellClass parent_class; - - /* Virtual function for subclasses to override. */ - gint (*popup) (ECellPopup *ecp, GdkEvent *event); -} ECellPopupClass; - - -struct _ECellPopupView { - ECellView cell_view; - - ECellView *child_view; -}; - - -GtkType e_cell_popup_get_type (void); -ECell *e_cell_popup_new (void); - -/* Get and set the child ECell. */ -ECell *e_cell_popup_get_child (ECellPopup *ecp); -void e_cell_popup_set_child (ECellPopup *ecp, - ECell *child); - -#endif /* _E_CELL_POPUP_H_ */ diff --git a/widgets/table/e-cell-size.c b/widgets/table/e-cell-size.c deleted file mode 100644 index 7943ad8d8a..0000000000 --- a/widgets/table/e-cell-size.c +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ECellSize - Size item for e-table. - * Copyright (C) 2001 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - */ - -#include <config.h> -#include "e-cell-size.h" -#include <gnome.h> -#include <sys/time.h> -#include <unistd.h> -#include <gal/util/e-util.h> - -#define PARENT_TYPE e_cell_text_get_type () - -static ECellTextClass *parent_class; - -static char * -ecd_get_text(ECellText *cell, ETableModel *model, int col, int row) -{ - gint size = GPOINTER_TO_INT(e_table_model_value_at(model, col, row)); - gfloat fsize; - - if (size < 1024) { - return g_strdup_printf ("%d", size); - } else { - fsize = ((gfloat) size) / 1024.0; - if (fsize < 1024.0) { - return g_strdup_printf ("%.2f K", fsize); - } else { - fsize /= 1024.0; - return g_strdup_printf ("%.2f M", fsize); - } - } -} - -static void -ecd_free_text(ECellText *cell, char *text) -{ - g_free(text); -} - -static void -e_cell_size_class_init (GtkObjectClass *object_class) -{ - ECellTextClass *ectc = (ECellTextClass *) object_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - ectc->get_text = ecd_get_text; - ectc->free_text = ecd_free_text; -} - -static void -e_cell_size_init (GtkObject *object) -{ -} - -/** - * e_cell_size_new: - * @fontname: font to be used to render on the screen - * @justify: Justification of the string in the cell. - * - * Creates a new ECell renderer that can be used to render file sizes - * that that come from the model. The value returned from the model - * is interpreted as being a time_t. - * - * The ECellSize object support a large set of properties that can be - * configured through the Gtk argument system and allows the user to have - * a finer control of the way the string is displayed. The arguments supported - * allow the control of strikeout, bold, color and a size filter. - * - * The arguments "strikeout_column", "bold_column" and "color_column" set - * and return an integer that points to a column in the model that controls - * these settings. So controlling the way things are rendered is achieved - * by having special columns in the model that will be used to flag whether - * the size should be rendered with strikeout, or bolded. In the case of - * the "color_column" argument, the column in the model is expected to have - * a string that can be parsed by gdk_color_parse(). - * - * Returns: an ECell object that can be used to render file sizes. */ -ECell * -e_cell_size_new (const char *fontname, GtkJustification justify) -{ - ECellSize *ecd = gtk_type_new (e_cell_size_get_type ()); - - e_cell_text_construct(E_CELL_TEXT(ecd), fontname, justify); - - return (ECell *) ecd; -} - -E_MAKE_TYPE(e_cell_size, "ECellSize", ECellSize, e_cell_size_class_init, e_cell_size_init, PARENT_TYPE); diff --git a/widgets/table/e-cell-size.h b/widgets/table/e-cell-size.h deleted file mode 100644 index db976a4eb6..0000000000 --- a/widgets/table/e-cell-size.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ECellSize - Size item for e-table. - * Copyright (C) 2001 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - */ -#ifndef _E_CELL_SIZE_H_ -#define _E_CELL_SIZE_H_ - -#include <gal/e-table/e-cell-text.h> - -BEGIN_GNOME_DECLS - -#define E_CELL_SIZE_TYPE (e_cell_size_get_type ()) -#define E_CELL_SIZE(o) (GTK_CHECK_CAST ((o), E_CELL_SIZE_TYPE, ECellSize)) -#define E_CELL_SIZE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_SIZE_TYPE, ECellSizeClass)) -#define E_IS_CELL_SIZE(o) (GTK_CHECK_TYPE ((o), E_CELL_SIZE_TYPE)) -#define E_IS_CELL_SIZE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_SIZE_TYPE)) - -typedef struct { - ECellText base; -} ECellSize; - -typedef struct { - ECellTextClass parent_class; -} ECellSizeClass; - -GtkType e_cell_size_get_type (void); -ECell *e_cell_size_new (const char *fontname, GtkJustification justify); - -END_GNOME_DECLS - -#endif /* _E_CELL_SIZE_H_ */ diff --git a/widgets/table/e-cell-string.c b/widgets/table/e-cell-string.c deleted file mode 100644 index 992b1bd10e..0000000000 --- a/widgets/table/e-cell-string.c +++ /dev/null @@ -1,9 +0,0 @@ -ECell * -e_cell_string_new (void) -{ - ECell *ecell; - - ecell = gtk_type_new (ecell); - - return ecell; -} diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c deleted file mode 100644 index 969e17f84f..0000000000 --- a/widgets/table/e-cell-text.c +++ /dev/null @@ -1,2439 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-cell-text.c - Text cell renderer - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Miguel de Icaza <miguel@ximian.com> - * Chris Lahey <clahey@ximian.com> - * - * (C) 1999, 2000 Ximian, Inc. - * - * A lot of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena <federico@nuclecu.unam.mx> - * - * TODO: - * Clean up UTF-8 handling - * UTF-8 selection - */ - -#include <config.h> -#include <gtk/gtkenums.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkwindow.h> -#include <gtk/gtkinvisible.h> -#include <gtk/gtksignal.h> -#include <gdk/gdkkeysyms.h> -#include <libgnomeui/gnome-canvas.h> -#include <stdio.h> -#include <unicode.h> -#include "e-cell-text.h" -#include "gal/util/e-util.h" -#include "gal/widgets/e-canvas.h" -#include "gal/widgets/e-font.h" -#include "gal/widgets/e-unicode.h" -#include "e-table-item.h" -#include "gal/util/e-text-event-processor.h" -#include "gal/e-text/e-text.h" -#include "gal/util/e-text-event-processor-emacs-like.h" -#include "e-table-tooltip.h" - -#include <gdk/gdkx.h> /* for BlackPixel */ -#include <ctype.h> -#include <math.h> - -#define ECT_CLASS(c) (E_CELL_TEXT_CLASS(GTK_OBJECT((c))->klass)) - -/* This defines a line of text */ -struct line { - char *text; /* Line's text UTF-8, it is a pointer into the text->text string */ - int length; /* Line's length in BYTES */ - int width; /* Line's width in pixels */ - int ellipsis_length; /* Length before adding ellipsis in BYTES */ -}; - -/* Object argument IDs */ -enum { - ARG_0, - - ARG_STRIKEOUT_COLUMN, - ARG_BOLD_COLUMN, - ARG_COLOR_COLUMN, - ARG_EDITABLE, -}; - - -enum { - E_SELECTION_PRIMARY, - E_SELECTION_CLIPBOARD -}; - -static GdkAtom clipboard_atom = GDK_NONE; - -#define PARENT_TYPE e_cell_get_type () - -#define TEXT_PAD 4 - -typedef struct { - gpointer lines; /* Text split into lines (private field) */ - int num_lines; /* Number of lines of text */ - int max_width; - int ref_count; -} ECellTextLineBreaks; - - -typedef struct _CellEdit CellEdit; - -typedef struct { - ECellView cell_view; - GdkGC *gc; -#if 0 - GdkFont *font; -#else - EFont *font; -#endif - GdkCursor *i_cursor; - GdkBitmap *stipple; /* Stipple for text */ - - GnomeCanvas *canvas; - - /* - * During editing. - */ - CellEdit *edit; - - - int xofs, yofs; /* This gets added to the x - and y for the cell text. */ - double ellipsis_width[2]; /* The width of the ellipsis. */ - -} ECellTextView; - -typedef struct _CurrentCell{ - ECellTextView *text_view; - int width; - char *text; - int model_col, view_col, row; - ECellTextLineBreaks *breaks; - EFontStyle style; -} CurrentCell; - -#define CURRENT_CELL(x) ((CurrentCell *)(x)) - -struct _CellEdit { - CurrentCell cell; - - char *old_text; - - /* - * Where the editing is taking place - */ - - int xofs_edit, yofs_edit; /* Offset because of editing. - This is negative compared - to the other offsets. */ - - /* This needs to be reworked a bit once we get line wrapping. */ - int selection_start; /* Start of selection - IN BYTES */ - int selection_end; /* End of selection - IN BYTES */ - gboolean select_by_word; /* Current selection is by word */ - - /* This section is for drag scrolling and blinking cursor. */ - /* Cursor handling. */ - gint timeout_id; /* Current timeout id for scrolling */ - GTimer *timer; /* Timer for blinking cursor and scrolling */ - - gint lastx, lasty; /* Last x and y motion events */ - gint last_state; /* Last state */ - gulong scroll_start; /* Starting time for scroll (microseconds) */ - - gint show_cursor; /* Is cursor currently shown */ - gboolean button_down; /* Is mouse button 1 down */ - - ETextEventProcessor *tep; /* Text Event Processor */ - - /* Hmmm... this should probably be in native encoding? */ - - GtkWidget *invisible; /* For selection handling */ - gboolean has_selection; /* TRUE if we have the selection */ - gchar *primary_selection; /* Primary selection text */ - gint primary_length; /* Primary selection text length in BYTES */ - gchar *clipboard_selection; /* Clipboard selection text */ - gint clipboard_length; /* Clipboard selection text length in BYTES */ - - guint pointer_in : 1; - guint default_cursor_shown : 1; - - ECellActions actions; -}; - -static void e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data); - -static void e_cell_text_view_get_selection (CellEdit *edit, GdkAtom selection, guint32 time); -static void e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection, char *data, gint length); - -static GtkWidget *e_cell_text_view_get_invisible (CellEdit *edit); -static void _selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - CellEdit *edit); -static void _selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - CellEdit *edit); -static void _selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - CellEdit *edit); -static int number_of_lines (char *text); -static void split_into_lines (CurrentCell *cell); -static void unref_lines (CurrentCell *cell); -static void calc_line_widths (CurrentCell *cell); -static int get_line_ypos (CurrentCell *cell, struct line *line); -static int get_line_xpos (CurrentCell *cell, struct line *line); -static void _get_tep (CellEdit *edit); - -static gint _get_position_from_xy (CurrentCell *cell, gint x, gint y); -static void _get_xy_from_position (CurrentCell *cell, gint position, gint *xp, gint *yp); -static gboolean _blink_scroll_timeout (gpointer data); - -static void build_current_cell (CurrentCell *cell, ECellTextView *text_view, int model_col, int view_col, int row); -static void unbuild_current_cell (CurrentCell *cell); -static void calc_ellipsis (ECellTextView *text_view); -static void ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap); -static GdkColor* e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec); - -static ECellClass *parent_class; - -static char * -ect_get_text (ECellText *cell, ETableModel *model, int col, int row) -{ - if (ECT_CLASS(cell)->get_text) - return ECT_CLASS(cell)->get_text (cell, model, col, row); - else - return NULL; -} - -static void -ect_free_text (ECellText *cell, char *text) -{ - if (ECT_CLASS(cell)->free_text) - ECT_CLASS(cell)->free_text (cell, text); -} - -static char * -ect_real_get_text (ECellText *cell, ETableModel *model, int col, int row) -{ - return e_table_model_value_at(model, col, row); -} - -static void -ect_real_free_text (ECellText *cell, char *text) -{ -} - -static void -ect_queue_redraw (ECellTextView *text_view, int view_col, int view_row) -{ - e_table_item_redraw_range ( - text_view->cell_view.e_table_item_view, - view_col, view_row, view_col, view_row); -} - -/* - * Accept the currently edited text. if it's the same as what's in the cell, do nothing. - */ -static void -ect_accept_edits (ECellTextView *text_view) -{ - CurrentCell *cell = (CurrentCell *) text_view->edit; - - if (strcmp (text_view->edit->old_text, cell->text)) { - e_table_model_set_value_at (text_view->cell_view.e_table_model, - cell->model_col, cell->row, cell->text); - } -} - -/* - * Shuts down the editing process - */ -static void -ect_stop_editing (ECellTextView *text_view) -{ - CellEdit *edit = text_view->edit; - int row, view_col; - - if (!edit) - return; - - row = edit->cell.row; - view_col = edit->cell.view_col; - - g_free (edit->old_text); - edit->old_text = NULL; - g_free (edit->cell.text); - edit->cell.text = NULL; - if (edit->invisible) - gtk_widget_unref (edit->invisible); - if (edit->tep) - gtk_object_unref (GTK_OBJECT(edit->tep)); - if (edit->primary_selection) - g_free (edit->primary_selection); - if (edit->clipboard_selection) - g_free (edit->clipboard_selection); - if (! edit->default_cursor_shown){ - gdk_window_set_cursor (GTK_WIDGET(text_view->canvas)->window, NULL); - edit->default_cursor_shown = TRUE; - } - if (edit->timeout_id) { - g_source_remove (edit->timeout_id); - edit->timeout_id = 0; - } - if (edit->timer) { - g_timer_stop (edit->timer); - g_timer_destroy (edit->timer); - edit->timer = NULL; - } - - g_free (edit); - - text_view->edit = NULL; - ect_queue_redraw (text_view, view_col, row); -} - -/* - * Cancels the edits - */ -static void -ect_cancel_edit (ECellTextView *text_view) -{ - ect_stop_editing (text_view); -} - -/* - * ECell::new_view method - */ -static ECellView * -ect_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - ECellText *ect = E_CELL_TEXT (ecell); - ECellTextView *text_view = g_new0 (ECellTextView, 1); - GnomeCanvas *canvas = GNOME_CANVAS_ITEM (e_table_item_view)->canvas; - - text_view->cell_view.ecell = ecell; - text_view->cell_view.e_table_model = table_model; - text_view->cell_view.e_table_item_view = e_table_item_view; - - if (ect->font_name){ -#if 0 - GdkFont *f; - - f = gdk_fontset_load (ect->font_name); - text_view->font = f; -#endif - text_view->font = e_font_from_gdk_name (ect->font_name); - } - if (!text_view->font){ - gdk_font_ref (GTK_WIDGET (canvas)->style->font); - text_view->font = e_font_from_gdk_font (GTK_WIDGET (canvas)->style->font); - } - - text_view->canvas = canvas; - - text_view->xofs = 0.0; - text_view->yofs = 0.0; - - return (ECellView *)text_view; -} - -/* - * ECell::kill_view method - */ -static void -ect_kill_view (ECellView *ecv) -{ - ECellTextView *text_view = (ECellTextView *) ecv; - - g_free (text_view); -} - -/* - * ECell::realize method - */ -static void -ect_realize (ECellView *ecell_view) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - - text_view->gc = gdk_gc_new (GTK_WIDGET (text_view->canvas)->window); - - text_view->i_cursor = gdk_cursor_new (GDK_XTERM); - - calc_ellipsis (text_view); - - if (parent_class->realize) - (* parent_class->realize) (ecell_view); -} - -/* - * ECell::unrealize method - */ -static void -ect_unrealize (ECellView *ecv) -{ - ECellTextView *text_view = (ECellTextView *) ecv; - ECellText *ect = (ECellText*) ecv->ecell; - GdkColormap *colormap; - - gdk_gc_unref (text_view->gc); - text_view->gc = NULL; - - if (text_view->edit){ - ect_cancel_edit (text_view); - } - - if (text_view->font) - e_font_unref (text_view->font); - - if (text_view->stipple) - gdk_bitmap_unref (text_view->stipple); - - gdk_cursor_destroy (text_view->i_cursor); - - if (ect->colors) { - colormap = gtk_widget_get_colormap (GTK_WIDGET (text_view->canvas)); - g_hash_table_foreach (ect->colors, (GHFunc) ect_free_color, - colormap); - g_hash_table_destroy (ect->colors); - ect->colors = NULL; - } - - if (parent_class->unrealize) - (* parent_class->unrealize) (ecv); -} - -static void -ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap) -{ - - g_free (color_spec); - - /* This frees the color. Note we don't free it if it is the special - value. */ - if (color != (GdkColor*) 1) { - gdk_colors_free (colormap, &color->pixel, 1, 0); - - /* This frees the memory for the GdkColor. */ - gdk_color_free (color); - } -} - -static void -set_style(ECellView *ecell_view, CurrentCell *cell, int row) -{ - EFontStyle style = E_FONT_PLAIN; - ECellText *ect = E_CELL_TEXT (ecell_view->ecell); - - if (ect->bold_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row)) - style = E_FONT_BOLD; - - cell->style = style; -} - -/* - * ECell::draw method - */ -static void -ect_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, ECellFlags flags, - int x1, int y1, int x2, int y2) -{ - /* New ECellText */ - ECellText *ect = E_CELL_TEXT (ecell_view->ecell); - ECellTextView *text_view = (ECellTextView *) ecell_view; - GtkWidget *canvas = GTK_WIDGET (text_view->canvas); - GdkRectangle rect, *clip_rect; - struct line *lines; - int i; - int xpos, ypos; - int start_char, end_char; - int sel_start, sel_end; - GdkRectangle sel_rect; - GdkGC *fg_gc; - EFont *font = text_view->font; - const int height = e_font_height (text_view->font); - CellEdit *edit = text_view->edit; - gboolean edit_display = FALSE; - ECellTextLineBreaks *linebreaks; - GdkColor *foreground, *cell_foreground, *cursor_color; - gchar *color_spec; - gboolean selected; - EFontStyle style = E_FONT_PLAIN; - - selected = flags & E_CELL_SELECTED; - - if (edit){ - if ((edit->cell.view_col == view_col) && (edit->cell.row == row)) { - edit_display = TRUE; - fg_gc = canvas->style->fg_gc[edit->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE]; - } else - fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE]; - } else { - fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE]; - } - - /* - * Be a nice citizen: clip to the region we are supposed to draw on - */ - rect.x = x1; - rect.y = y1; - rect.width = x2 - x1; - rect.height = y2 - y1; - - gdk_gc_set_clip_rectangle (text_view->gc, &rect); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ - - if (selected){ - if (flags & E_CELL_FOCUSED) - foreground = &canvas->style->text [GTK_STATE_SELECTED]; - else - foreground = &canvas->style->text [GTK_STATE_ACTIVE]; - } else { - foreground = &canvas->style->text [GTK_STATE_NORMAL]; - } - - cursor_color = foreground; - - if (ect->color_column != -1 && ! selected) { - color_spec = e_table_model_value_at (ecell_view->e_table_model, - ect->color_column, row); - cell_foreground = e_cell_text_get_color (text_view, - color_spec); - if (cell_foreground) - foreground = cell_foreground; - } - - gdk_gc_set_foreground (text_view->gc, foreground); - - x1 += 4; - y1 += 1; - x2 -= 4; - y2 -= 1; - - rect.x = x1; - rect.y = y1; - rect.width = x2 - x1; - rect.height = y2 - y1; - - gdk_gc_set_clip_rectangle (text_view->gc, &rect); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ - - if (edit_display){ - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - - set_style(ecell_view, cell, row); - - style = cell->style; - - cell->width = x2 - x1; - - split_into_lines (cell); - - linebreaks = cell->breaks; - - lines = linebreaks->lines; - ypos = get_line_ypos (cell, lines); - ypos += e_font_ascent (text_view->font); - ypos -= edit->yofs_edit; - - for (i = 0; i < linebreaks->num_lines; i++) { - xpos = get_line_xpos (cell, lines); - xpos -= edit->xofs_edit; - - /* start_char, end_char, sel_start and sel_end are IN BYTES */ - - start_char = lines->text - cell->text; - end_char = start_char + lines->length; - - sel_start = edit->selection_start; - sel_end = edit->selection_end; - - if (sel_start > sel_end){ - sel_start ^= sel_end; - sel_end ^= sel_start; - sel_start ^= sel_end; - } - if (sel_start < start_char) - sel_start = start_char; - if (sel_end > end_char) - sel_end = end_char; - - if (sel_start < sel_end){ - sel_rect.x = xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_start - start_char); - sel_rect.y = ypos + y1 - e_font_ascent (font); - sel_rect.width = e_font_utf8_text_width (font, style, - lines->text + sel_start - start_char, - sel_end - sel_start); - sel_rect.height = height; - gtk_paint_flat_box (canvas->style, - drawable, - edit->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - clip_rect, - canvas, - "text", - sel_rect.x, - sel_rect.y, - sel_rect.width, - sel_rect.height); - - e_font_draw_utf8_text (drawable, font, style, text_view->gc, xpos + x1, ypos + y1, - lines->text, - sel_start - start_char); - e_font_draw_utf8_text (drawable, font, style, fg_gc, - xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_start - start_char), - ypos + y1, - lines->text + sel_start - start_char, - sel_end - sel_start); - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_end - start_char), - ypos + y1, - lines->text + sel_end - start_char, - end_char - sel_end); - } else { - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1, ypos + y1, - lines->text, - lines->length); - } - if (edit->selection_start == edit->selection_end && - edit->selection_start >= start_char && - edit->selection_start <= end_char && - edit->show_cursor) { - gdk_gc_set_foreground (text_view->gc, cursor_color); - gdk_draw_rectangle (drawable, - text_view->gc, - TRUE, - xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_start - start_char), - ypos + y1 - e_font_ascent (font), - 1, - height); - } - if (ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row)) { - gdk_draw_rectangle (drawable, - text_view->gc, - TRUE, - x1, ypos + y1 - (e_font_ascent (font) / 2), - x2 - x1, - 1); - } - ypos += height; - lines ++; - } - unref_lines (cell); - } else { - - ECellTextLineBreaks *linebreaks; - CurrentCell cell; - build_current_cell (&cell, text_view, model_col, view_col, row); - - set_style(ecell_view, &cell, row); - - style = cell.style; - - cell.width = x2 - x1; - - split_into_lines (&cell); - - linebreaks = cell.breaks; - lines = linebreaks->lines; - ypos = get_line_ypos (&cell, lines); - ypos += e_font_ascent (text_view->font); - - - for (i = 0; i < linebreaks->num_lines; i++) { - xpos = get_line_xpos (&cell, lines); - if (ect->use_ellipsis && lines->ellipsis_length < lines->length) { - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1, ypos + y1, - lines->text, - lines->ellipsis_length); - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1 + lines->width - text_view->ellipsis_width[style], - ypos + y1, - ect->ellipsis ? ect->ellipsis : "...", - ect->ellipsis ? strlen (ect->ellipsis) : 3); - } else { - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1, - ypos + y1, - lines->text, - lines->length); - } - if (ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row)) { - gdk_draw_rectangle (drawable, - text_view->gc, - TRUE, - x1, ypos + y1 - (e_font_ascent (font) / 2), - x2 - x1, - 1); - } - ypos += height; - lines++; - } - unref_lines (&cell); - unbuild_current_cell (&cell); - } - - gdk_gc_set_clip_rectangle (text_view->gc, NULL); - gdk_gc_set_clip_rectangle (fg_gc, NULL); -} - -/* - * Selects the entire string - */ -static void -ect_edit_select_all (ECellTextView *text_view) -{ - g_assert (text_view->edit); - - text_view->edit->selection_start = 0; - text_view->edit->selection_end = strlen (text_view->edit->cell.text); -} - -static gboolean -key_begins_editing (GdkEventKey *event) -{ - if (event->length == 0) - return FALSE; - - return TRUE; -} - -/* - * ECell::event method - */ -static gint -ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - ETextEventProcessorEvent e_tep_event; - gboolean edit_display = FALSE; - CellEdit *edit = text_view->edit; - GtkWidget *canvas = GTK_WIDGET (text_view->canvas); - gint return_val = 0; - CurrentCell cell, *cellptr; - - if (flags & !E_CELL_EDITING) - return 0; - - build_current_cell (&cell, text_view, model_col, view_col, row); - - - if (edit){ - if ((edit->cell.view_col == view_col) && (edit->cell.row == row)) { - edit_display = TRUE; - cellptr = CURRENT_CELL(edit); - } else { - cellptr = &cell; - } - } else { - cellptr = &cell; - } - - set_style(ecell_view, cellptr, row); - - e_tep_event.type = event->type; - switch (event->type) { - case GDK_FOCUS_CHANGE: - break; - case GDK_KEY_PRESS: /* Fall Through */ - case GDK_KEY_RELEASE: - if (event->key.keyval == GDK_Escape){ - ect_cancel_edit (text_view); - return_val = TRUE; - break; - } - - if ((!edit_display) && - e_table_model_is_cell_editable (ecell_view->e_table_model, model_col, row) && - key_begins_editing (&event->key)) { - e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); - ect_edit_select_all (text_view); - edit = text_view->edit; - cellptr = CURRENT_CELL(edit); - edit_display = TRUE; - } - if (edit_display) { - GdkEventKey key = event->key; - if (key.keyval == GDK_KP_Enter || key.keyval == GDK_Return){ - e_table_item_leave_edit (text_view->cell_view.e_table_item_view); - } else { - e_tep_event.key.time = key.time; - e_tep_event.key.state = key.state; - e_tep_event.key.keyval = key.keyval; - - /* This is probably ugly hack, but we have to handle UTF-8 input somehow */ -#if 0 - e_tep_event.key.length = key.length; - e_tep_event.key.string = key.string; -#else - e_tep_event.key.string = e_utf8_from_gtk_event_key (canvas, key.keyval, key.string); - if (e_tep_event.key.string != NULL) { - e_tep_event.key.length = strlen (e_tep_event.key.string); - } else { - e_tep_event.key.length = 0; - } -#endif - - _get_tep (edit); - return_val = e_text_event_processor_handle_event (edit->tep, &e_tep_event); - *actions = edit->actions; - if (e_tep_event.key.string) g_free (e_tep_event.key.string); - break; - } - } - - else - return 0; - break; - case GDK_BUTTON_PRESS: /* Fall Through */ - case GDK_BUTTON_RELEASE: - event->button.x -= 4; - event->button.y -= 1; - if ((!edit_display) - && e_table_model_is_cell_editable (ecell_view->e_table_model, model_col, row) - && event->type == GDK_BUTTON_RELEASE - && event->button.button == 1) { - GdkEventButton button = event->button; - - e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); - edit = text_view->edit; - cellptr = CURRENT_CELL(edit); - edit_display = TRUE; - - e_tep_event.button.type = GDK_BUTTON_PRESS; - e_tep_event.button.time = button.time; - e_tep_event.button.state = button.state; - e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy (cellptr, button.x, button.y); - _get_tep (edit); - return_val = e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - *actions = edit->actions; - if (event->button.button == 1) { - if (event->type == GDK_BUTTON_PRESS) - edit->button_down = TRUE; - else - edit->button_down = FALSE; - } - edit->lastx = button.x; - edit->lasty = button.y; - edit->last_state = button.state; - - e_tep_event.button.type = GDK_BUTTON_RELEASE; - } - if (edit_display) { - GdkEventButton button = event->button; - e_tep_event.button.time = button.time; - e_tep_event.button.state = button.state; - e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy (cellptr, button.x, button.y); - _get_tep (edit); - return_val = e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - *actions = edit->actions; - if (event->button.button == 1) { - if (event->type == GDK_BUTTON_PRESS) - edit->button_down = TRUE; - else - edit->button_down = FALSE; - } - edit->lastx = button.x; - edit->lasty = button.y; - edit->last_state = button.state; - } - break; - case GDK_MOTION_NOTIFY: - event->motion.x -= 4; - event->motion.y -= 1; - if (edit_display) { - GdkEventMotion motion = event->motion; - e_tep_event.motion.time = motion.time; - e_tep_event.motion.state = motion.state; - e_tep_event.motion.position = _get_position_from_xy (cellptr, motion.x, motion.y); - _get_tep (edit); - return_val = e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - *actions = edit->actions; - edit->lastx = motion.x; - edit->lasty = motion.y; - edit->last_state = motion.state; - } - break; - case GDK_ENTER_NOTIFY: -#if 0 - edit->pointer_in = TRUE; -#endif - if (edit_display) { - if (edit->default_cursor_shown){ - gdk_window_set_cursor (canvas->window, text_view->i_cursor); - edit->default_cursor_shown = FALSE; - } - } - break; - case GDK_LEAVE_NOTIFY: -#if 0 - text_view->pointer_in = FALSE; -#endif - if (edit_display) { - if (! edit->default_cursor_shown){ - gdk_window_set_cursor (canvas->window, NULL); - edit->default_cursor_shown = TRUE; - } - } - break; - default: - break; - } - - unbuild_current_cell (&cell); - if (return_val) - return return_val; -#if 0 - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS(parent_class)->event (item, event); -#endif - else - return 0; - -} - -/* - * ECell::height method - */ -static int -ect_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - EFont *font; - ECellText *ect = E_CELL_TEXT(ecell_view->ecell); - gchar *string; - gint value; - - font = text_view->font; - - string = ect_get_text(ect, ecell_view->e_table_model, model_col, row); - value = e_font_height (font) * number_of_lines(string) + TEXT_PAD; - ect_free_text(ect, string); - - return value; -} - -/* - * ECellView::enter_edit method - */ -static void * -ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - CellEdit *edit; - ECellText *ect = E_CELL_TEXT(ecell_view->ecell); - char *temp; - - edit = g_new (CellEdit, 1); - text_view->edit = edit; - - build_current_cell (CURRENT_CELL(edit), text_view, model_col, view_col, row); - - set_style(ecell_view, CURRENT_CELL(edit), row); - - edit->xofs_edit = 0.0; - edit->yofs_edit = 0.0; - - edit->selection_start = 0; - edit->selection_end = 0; - edit->select_by_word = FALSE; - - edit->timeout_id = g_timeout_add (10, _blink_scroll_timeout, text_view); - edit->timer = g_timer_new (); - g_timer_elapsed (edit->timer, &(edit->scroll_start)); - g_timer_start (edit->timer); - - edit->lastx = 0; - edit->lasty = 0; - edit->last_state = 0; - - edit->scroll_start = 0; - edit->show_cursor = TRUE; - edit->button_down = FALSE; - - edit->tep = NULL; - - edit->has_selection = FALSE; - - edit->invisible = NULL; - edit->primary_selection = NULL; - edit->primary_length = 0; - edit->clipboard_selection = NULL; - edit->clipboard_length = 0; - - edit->pointer_in = FALSE; - edit->default_cursor_shown = TRUE; - - temp = ect_get_text(ect, ecell_view->e_table_model, model_col, row); - edit->old_text = g_strdup (temp); - ect_free_text(ect, temp); - edit->cell.text = g_strdup (edit->old_text); - -#if 0 - if (edit->pointer_in){ - if (edit->default_cursor_shown){ - gdk_window_set_cursor (GTK_WIDGET(item->canvas)->window, text_view->i_cursor); - edit->default_cursor_shown = FALSE; - } - } -#endif - - ect_queue_redraw (text_view, view_col, row); - - return NULL; -} - -/* - * ECellView::leave_edit method - */ -static void -ect_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - CellEdit *edit = text_view->edit; - - if (edit){ - ect_accept_edits (text_view); - ect_stop_editing (text_view); - /* FIXME: edit is freed in ect_stop_editing() so I've - commented this out - Damon. */ - /*unbuild_current_cell (CURRENT_CELL(edit));*/ - } else { - /* - * We did invoke this leave edit internally - */ - } -} - -static void -ect_print (ECellView *ecell_view, GnomePrintContext *context, - int model_col, int view_col, int row, - double width, double height) -{ - GnomeFont *font = gnome_font_new ("Helvetica", 12); - char *string; - ECellText *ect = E_CELL_TEXT(ecell_view->ecell); - string = ect_get_text(ect, ecell_view->e_table_model, model_col, row); - gnome_print_gsave(context); - if (gnome_print_moveto(context, 2, 2) == -1) - /* FIXME */; - if (gnome_print_lineto(context, width - 2, 2) == -1) - /* FIXME */; - if (gnome_print_lineto(context, width - 2, height - 2) == -1) - /* FIXME */; - if (gnome_print_lineto(context, 2, height - 2) == -1) - /* FIXME */; - if (gnome_print_lineto(context, 2, 2) == -1) - /* FIXME */; - if (gnome_print_clip(context) == -1) - /* FIXME */; - gnome_print_moveto(context, 2, (height - gnome_font_get_ascender(font) + gnome_font_get_descender(font)) / 2); - gnome_print_setfont(context, font); - gnome_print_show(context, string); - gnome_print_grestore(context); - ect_free_text(ect, string); -} - -static gdouble -ect_print_height (ECellView *ecell_view, GnomePrintContext *context, - int model_col, int view_col, int row, - double width) -{ - return 16; -} - -static int -ect_max_width (ECellView *ecell_view, - int model_col, - int view_col) -{ - /* New ECellText */ - ECellTextView *text_view = (ECellTextView *) ecell_view; - EFont *font; - int row; - int number_of_rows; - int max_width = 0; - - font = text_view->font; - number_of_rows = e_table_model_row_count (ecell_view->e_table_model); - - for (row = 0; row < number_of_rows; row++) { - CurrentCell cell; - struct line *line; - int width; - - build_current_cell (&cell, text_view, model_col, view_col, row); - split_into_lines (&cell); - calc_line_widths (&cell); - - line = (struct line *)cell.breaks->lines; - width = e_font_utf8_text_width (font, cell.style, - line->text, line->length); - max_width = MAX (max_width, width); - unref_lines (&cell); - unbuild_current_cell (&cell); - } - - return max_width; -} - -static gint -tooltip_event (GtkWidget *window, - GdkEvent *event, - ETableTooltip *tooltip) -{ - gint ret_val = FALSE; - - switch (event->type) { - case GDK_LEAVE_NOTIFY: - if (tooltip->window) { - gtk_widget_destroy (tooltip->window); - tooltip->window = NULL; - } - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - if (event->type == GDK_BUTTON_RELEASE) { - if (tooltip->window) { - gtk_widget_destroy (tooltip->window); - tooltip->window = NULL; - } - } - - event->button.x = tooltip->cx; - event->button.y = tooltip->cy; - gtk_signal_emit_by_name (GTK_OBJECT (tooltip->eti), "event", - event, &ret_val); - break; - case GDK_KEY_PRESS: - if (tooltip->window){ - gtk_widget_destroy (tooltip->window); - tooltip->window = NULL; - } - gtk_signal_emit_by_name (GTK_OBJECT (tooltip->eti), "event", - event, &ret_val); - break; - default: - break; - } - - return ret_val; -} - -static void -ect_show_tooltip (ECellView *ecell_view, - int model_col, - int view_col, - int row, - int col_width, - ETableTooltip *tooltip) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - CurrentCell cell; - struct line *lines; - GtkWidget *canvas; - int i; - gdouble max_width; - gboolean cut_off; - double i2c[6]; - ArtPoint origin = {0, 0}; - ArtPoint pixel_origin; - int canvas_x, canvas_y; - GnomeCanvasItem *tooltip_text; - double tooltip_width; - double tooltip_height; - double tooltip_x; - double tooltip_y; - GnomeCanvasItem *rect; - double text_height; - - tooltip->timer = 0; - - build_current_cell (&cell, text_view, model_col, view_col, row); - - set_style(ecell_view, &cell, row); - - cell.width = col_width - 8; - split_into_lines (&cell); - calc_line_widths (&cell); - - cut_off = FALSE; - for (lines = cell.breaks->lines, i = 0; i < cell.breaks->num_lines; - lines++, i++) { - if (lines->length > lines->ellipsis_length) { - cut_off = TRUE; - break; - } - } - - if (!cut_off) { - tooltip->timer = 0; - unref_lines (&cell); - unbuild_current_cell (&cell); - return; - } - - gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (tooltip->eti), i2c); - art_affine_point (&pixel_origin, &origin, i2c); - - gdk_window_get_origin (GTK_WIDGET (text_view->canvas)->window, - &canvas_x, &canvas_y); - pixel_origin.x += canvas_x; - pixel_origin.y += canvas_y; - pixel_origin.x -= (int) gtk_layout_get_hadjustment (GTK_LAYOUT (text_view->canvas))->value; - pixel_origin.y -= (int) gtk_layout_get_vadjustment (GTK_LAYOUT (text_view->canvas))->value; - - tooltip->window = gtk_window_new (GTK_WINDOW_POPUP); - gtk_container_set_border_width (GTK_CONTAINER (tooltip->window), 1); - - canvas = e_canvas_new (); - gtk_container_add (GTK_CONTAINER (tooltip->window), canvas); - - max_width = 0.0; - for (lines = cell.breaks->lines, i = 0; i < cell.breaks->num_lines; - lines++, i++) { - gdouble line_width; - - line_width = e_font_utf8_text_width (text_view->font, - cell.style, lines->text, - lines->length); - max_width = MAX (max_width, line_width); - } - - text_height = e_font_height (text_view->font) * cell.breaks->num_lines + 4; - rect = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), - gnome_canvas_rect_get_type (), - "x1", (double) 0.0, - "y1", (double) 0.0, - "x2", (double) max_width + 4, - "y2", (double) text_height, - "fill_color", "light gray", - NULL); - - tooltip_text = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), - e_text_get_type (), - "anchor", GTK_ANCHOR_NW, -/* "font_gdk", text_view->font, */ - "text", cell.text, - "editable", FALSE, - "clip_width", max_width, - "clip_height", (double) text_height, - "clip", TRUE, - "line_wrap", FALSE, - "justification", E_CELL_TEXT (text_view->cell_view.ecell)->justify, - "draw_background", FALSE, - NULL); - - tooltip_width = max_width; - tooltip_height = text_height; - tooltip_y = tooltip->y; - - switch (E_CELL_TEXT (text_view->cell_view.ecell)->justify) { - case GTK_JUSTIFY_CENTER: - tooltip_x = - tooltip_width / 2; - break; - case GTK_JUSTIFY_RIGHT: - tooltip_x = tooltip_width / 2; - break; - case GTK_JUSTIFY_FILL: - case GTK_JUSTIFY_LEFT: - tooltip_x = tooltip->x; - break; - } - - gnome_canvas_item_move (tooltip_text, 3.0, 1.0); - gnome_canvas_item_set (rect, - "x2", (double) tooltip_width + 6, - "y2", (double) tooltip->row_height + 1, - NULL); - gtk_widget_set_usize (tooltip->window, tooltip_width + 6, - tooltip->row_height + 1); - gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, - (double) tooltip_width + 6, - (double) tooltip_height); - gtk_widget_show (canvas); - gtk_widget_realize (tooltip->window); - gtk_signal_connect (GTK_OBJECT (tooltip->window), "event", - GTK_SIGNAL_FUNC (tooltip_event), tooltip); - - gtk_widget_popup (tooltip->window, pixel_origin.x + tooltip->x, - pixel_origin.y + tooltip->y + 1); - - unref_lines (&cell); - unbuild_current_cell (&cell); - - return; -} - -/* - * GtkObject::destroy method - */ -static void -ect_destroy (GtkObject *object) -{ - ECellText *ect = E_CELL_TEXT (object); - - g_free (ect->font_name); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} -/* Set_arg handler for the text item */ -static void -ect_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ECellText *text; - - text = E_CELL_TEXT (object); - - switch (arg_id) { - case ARG_STRIKEOUT_COLUMN: - text->strikeout_column = GTK_VALUE_INT (*arg); - break; - - case ARG_BOLD_COLUMN: - text->bold_column = GTK_VALUE_INT (*arg); - break; - - case ARG_COLOR_COLUMN: - text->color_column = GTK_VALUE_INT (*arg); - break; - - case ARG_EDITABLE: - text->editable = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE; - break; - - default: - return; - } -} - -/* Get_arg handler for the text item */ -static void -ect_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ECellText *text; - - text = E_CELL_TEXT (object); - - switch (arg_id) { - case ARG_STRIKEOUT_COLUMN: - GTK_VALUE_INT (*arg) = text->strikeout_column; - break; - - case ARG_BOLD_COLUMN: - GTK_VALUE_INT (*arg) = text->bold_column; - break; - - case ARG_COLOR_COLUMN: - GTK_VALUE_INT (*arg) = text->color_column; - break; - - case ARG_EDITABLE: - GTK_VALUE_BOOL (*arg) = text->editable ? TRUE : FALSE; - break; - - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_cell_text_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - ECellTextClass *ectc = (ECellTextClass *) object_class; - - object_class->destroy = ect_destroy; - - ecc->new_view = ect_new_view; - ecc->kill_view = ect_kill_view; - ecc->realize = ect_realize; - ecc->unrealize = ect_unrealize; - ecc->draw = ect_draw; - ecc->event = ect_event; - ecc->height = ect_height; - ecc->enter_edit = ect_enter_edit; - ecc->leave_edit = ect_leave_edit; - ecc->print = ect_print; - ecc->print_height = ect_print_height; - ecc->max_width = ect_max_width; - ecc->show_tooltip = ect_show_tooltip; - - ectc->get_text = ect_real_get_text; - ectc->free_text = ect_real_free_text; - - object_class->get_arg = ect_get_arg; - object_class->set_arg = ect_set_arg; - - parent_class = gtk_type_class (PARENT_TYPE); - - gtk_object_add_arg_type ("ECellText::strikeout_column", - GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_STRIKEOUT_COLUMN); - gtk_object_add_arg_type ("ECellText::bold_column", - GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_BOLD_COLUMN); - gtk_object_add_arg_type ("ECellText::color_column", - GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_COLOR_COLUMN); - gtk_object_add_arg_type ("ECellText::editable", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE); - - if (!clipboard_atom) - clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); -} - -static void -e_cell_text_init (ECellText *ect) -{ - ect->ellipsis = NULL; - ect->use_ellipsis = TRUE; - ect->strikeout_column = -1; - ect->bold_column = -1; - ect->color_column = -1; - ect->editable = TRUE; -} - -E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, e_cell_text_init, PARENT_TYPE); - -/** - * e_cell_text_construct: - * @cell: The cell to construct - * @fontname: font to be used to render on the screen - * @justify: Justification of the string in the cell - * - * constructs the ECellText. To be used by subclasses and language - * bindings. - * - * Returns: The ECellText. - */ -ECell * -e_cell_text_construct (ECellText *cell, const char *fontname, GtkJustification justify) -{ - cell->font_name = g_strdup (fontname); - cell->justify = justify; - return E_CELL(cell); -} - -/** - * e_cell_text_new: - * @fontname: font to be used to render on the screen - * @justify: Justification of the string in the cell. - * - * Creates a new ECell renderer that can be used to render strings that - * that come from the model. The value returned from the model is - * interpreted as being a char *. - * - * The ECellText object support a large set of properties that can be - * configured through the Gtk argument system and allows the user to have - * a finer control of the way the string is displayed. The arguments supported - * allow the control of strikeout, bold, and color. - * - * The arguments "strikeout_column", "bold_column" and "color_column" set - * and return an integer that points to a column in the model that controls - * these settings. So controlling the way things are rendered is achieved - * by having special columns in the model that will be used to flag whether - * the text should be rendered with strikeout, or bolded. In the case of - * the "color_column" argument, the column in the model is expected to have - * a string that can be parsed by gdk_color_parse(). - * - * Returns: an ECell object that can be used to render strings. - */ -ECell * -e_cell_text_new (const char *fontname, GtkJustification justify) -{ - ECellText *ect = gtk_type_new (e_cell_text_get_type ()); - - e_cell_text_construct(ect, fontname, justify); - - return (ECell *) ect; -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_xpos (CurrentCell *cell, struct line *line) -{ - int x; - - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)cell->text_view)->ecell); - - x = text_view->xofs + ect->x; - - switch (ect->justify) { - case GTK_JUSTIFY_RIGHT: - x += cell->width - line->width; - break; - - case GTK_JUSTIFY_CENTER: - x += (cell->width - line->width) / 2; - break; - - default: - /* For GTK_JUSTIFY_LEFT, we don't have to do anything. We do not support - * GTK_JUSTIFY_FILL, yet. - */ - break; - } - - return x; -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_ypos (CurrentCell *cell, struct line *line) -{ - int y; - - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)cell->text_view)->ecell); - ECellTextLineBreaks *linebreaks = cell->breaks; - - struct line *lines = linebreaks->lines; - - EFont *font; - - font = text_view->font; - - y = text_view->yofs + ect->y; - y += (line - lines) * e_font_height (font); - - return y; -} - -/* fixme: Handle Font attributes */ -/* position is in BYTES */ - -static void -_get_xy_from_position (CurrentCell *cell, gint position, gint *xp, gint *yp) -{ - if (xp || yp) { - struct line *lines; - int x, y; - int j; - ECellTextView *text_view = cell->text_view; - ECellTextLineBreaks *linebreaks; - EFont *font; - - font = text_view->font; - - split_into_lines (cell); - - linebreaks = cell->breaks; - lines = linebreaks->lines; - - x = get_line_xpos (cell, lines); - y = get_line_ypos (cell, lines); - for (j = 0, lines = linebreaks->lines; j < linebreaks->num_lines; lines++, j++) { - if (lines->text > cell->text + position) - break; - y += e_font_height (font); - } - lines --; - y -= e_font_descent (font); - - x += e_font_utf8_text_width (font, cell->style, - lines->text, - position - (lines->text - cell->text)); - if ((CellEdit *) cell == cell->text_view->edit){ - x -= ((CellEdit *)cell)->xofs_edit; - y -= ((CellEdit *)cell)->yofs_edit; - } - if (xp) - *xp = x; - if (yp) - *yp = y; - unref_lines (cell); - } -} - -static gint -_get_position_from_xy (CurrentCell *cell, gint x, gint y) -{ - int i, j; - int xpos, ypos; - struct line *lines; - int return_val; - gchar *p; - - ECellTextView *text_view = cell->text_view; - ECellTextLineBreaks *linebreaks; - EFont *font; - - font = text_view->font; - - split_into_lines (cell); - - linebreaks = cell->breaks; - - lines = linebreaks->lines; - - if ((CellEdit *) cell == cell->text_view->edit){ - x += ((CellEdit *)cell)->xofs_edit; - y += ((CellEdit *)cell)->yofs_edit; - } - - ypos = get_line_ypos (cell, linebreaks->lines); - j = 0; - while (y > ypos) { - ypos += e_font_height (font); - j ++; - } - j--; - if (j >= linebreaks->num_lines) - j = linebreaks->num_lines - 1; - if (j < 0) - j = 0; - i = 0; - - lines += j; - xpos = get_line_xpos (cell, lines); - - for (p = lines->text; p < lines->text + lines->length; p = unicode_next_utf8 (p)) { - gint charwidth; - - charwidth = e_font_utf8_char_width (font, cell->style, p); - - xpos += charwidth / 2; - if (xpos > x) { - break; - } - xpos += (charwidth + 1) / 2; - } - - return_val = p - cell->text; - - unref_lines (cell); - - return return_val; -} - -#define SCROLL_WAIT_TIME 30000 - -static gboolean -_blink_scroll_timeout (gpointer data) -{ - ECellTextView *text_view = (ECellTextView *) data; - ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - - gulong current_time; - gboolean scroll = FALSE; - gboolean redraw = FALSE; - - g_timer_elapsed (edit->timer, ¤t_time); - - if (edit->scroll_start + SCROLL_WAIT_TIME > 1000000) { - if (current_time > edit->scroll_start - (1000000 - SCROLL_WAIT_TIME) && - current_time < edit->scroll_start) - scroll = TRUE; - } else { - if (current_time > edit->scroll_start + SCROLL_WAIT_TIME || - current_time < edit->scroll_start) - scroll = TRUE; - } - if (scroll && edit->button_down) { - /* FIXME: Copy this for y. */ - if (edit->lastx - ect->x > cell->width) { - ECellTextLineBreaks *linebreaks; - split_into_lines (cell); - linebreaks = cell->breaks; - if (edit->xofs_edit < linebreaks->max_width - cell->width) { - edit->xofs_edit += 4; - if (edit->xofs_edit > linebreaks->max_width - cell->width + 1) - edit->xofs_edit = linebreaks->max_width - cell->width + 1; - redraw = TRUE; - } - unref_lines (cell); - } - if (edit->lastx - ect->x < 0 && - edit->xofs_edit > 0) { - edit->xofs_edit -= 4; - if (edit->xofs_edit < 0) - edit->xofs_edit = 0; - redraw = TRUE; - } - if (redraw) { - ETextEventProcessorEvent e_tep_event; - e_tep_event.type = GDK_MOTION_NOTIFY; - e_tep_event.motion.state = edit->last_state; - e_tep_event.motion.time = 0; - e_tep_event.motion.position = _get_position_from_xy (cell, edit->lastx, edit->lasty); - _get_tep (edit); - e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - edit->scroll_start = current_time; - } - } - - if (!((current_time / 500000) % 2)) { - if (!edit->show_cursor) - redraw = TRUE; - edit->show_cursor = TRUE; - } else { - if (edit->show_cursor) - redraw = TRUE; - edit->show_cursor = FALSE; - } - if (redraw){ - ect_queue_redraw (text_view, edit->cell.view_col, edit->cell.row); - } - return TRUE; -} - -static int -_get_position (ECellTextView *text_view, ETextEventProcessorCommand *command) -{ - int length; - int x, y; - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - EFont *font; - gchar *p; - int unival; - - font = text_view->font; - - switch (command->position) { - - case E_TEP_VALUE: - return command->value; - - case E_TEP_SELECTION: - return edit->selection_end; - - case E_TEP_START_OF_BUFFER: - return 0; - - /* fixme: this probably confuses TEP */ - - case E_TEP_END_OF_BUFFER: - return strlen (cell->text); - - case E_TEP_START_OF_LINE: - - if (edit->selection_end < 1) return 0; - - p = unicode_previous_utf8 (cell->text, cell->text + edit->selection_end); - - if (p == cell->text) return 0; - - p = unicode_previous_utf8 (cell->text, p); - - while (p && p > cell->text) { - if (*p == '\n') return p - cell->text + 1; - p = unicode_previous_utf8 (cell->text, p); - } - - return 0; - - case E_TEP_END_OF_LINE: - - length = strlen (cell->text); - if (edit->selection_end >= length) return length; - - p = unicode_next_utf8 (cell->text + edit->selection_end); - - while (*p) { - if (*p == '\n') return p - cell->text; - p = unicode_next_utf8 (p); - } - - return p - cell->text; - - case E_TEP_FORWARD_CHARACTER: - - length = strlen (cell->text); - if (edit->selection_end >= length) return length; - - p = unicode_next_utf8 (cell->text + edit->selection_end); - - return p - cell->text; - - case E_TEP_BACKWARD_CHARACTER: - - if (edit->selection_end < 1) return 0; - - p = unicode_previous_utf8 (cell->text, cell->text + edit->selection_end); - - if (p == NULL) return 0; - - return p - cell->text; - - case E_TEP_FORWARD_WORD: - - length = strlen (cell->text); - if (edit->selection_end >= length) return length; - - p = unicode_next_utf8 (cell->text + edit->selection_end); - - while (*p) { - unicode_get_utf8 (p, &unival); - if (unicode_isspace (unival)) return p - cell->text; - p = unicode_next_utf8 (p); - } - - return p - cell->text; - - case E_TEP_BACKWARD_WORD: - - if (edit->selection_end < 1) return 0; - - p = unicode_previous_utf8 (cell->text, cell->text + edit->selection_end); - - if (p == cell->text) return 0; - - p = unicode_previous_utf8 (cell->text, p); - - while (p && p > cell->text) { - unicode_get_utf8 (p, &unival); - if (unicode_isspace (unival)) { - return (unicode_next_utf8 (p) - cell->text); - } - p = unicode_previous_utf8 (cell->text, p); - } - - return 0; - - case E_TEP_FORWARD_LINE: - _get_xy_from_position (cell, edit->selection_end, &x, &y); - y += e_font_height (font); - return _get_position_from_xy (cell, x, y); - case E_TEP_BACKWARD_LINE: - _get_xy_from_position (cell, edit->selection_end, &x, &y); - y -= e_font_height (font); - return _get_position_from_xy (cell, x, y); - - case E_TEP_FORWARD_PARAGRAPH: - case E_TEP_BACKWARD_PARAGRAPH: - - case E_TEP_FORWARD_PAGE: - case E_TEP_BACKWARD_PAGE: - return edit->selection_end; - default: - return edit->selection_end; - } - g_assert_not_reached (); - return 0; /* Kill warning */ -} - -static void -_delete_selection (ECellTextView *text_view) -{ - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - gint length; - gchar *sp, *ep; - - if (edit->selection_end == edit->selection_start) return; - - if (edit->selection_end < edit->selection_start) { - edit->selection_end ^= edit->selection_start; - edit->selection_start ^= edit->selection_end; - edit->selection_end ^= edit->selection_start; - } - - sp = cell->text + edit->selection_start; - ep = cell->text + edit->selection_end; - length = strlen (ep) + 1; - - memmove (sp, ep, length); - - edit->selection_end = edit->selection_start; -} - -/* fixme: */ -/* NB! We expect value to be length IN BYTES */ - -static void -_insert (ECellTextView *text_view, char *string, int value) -{ - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - char *temp; - - if (value <= 0) return; - - temp = g_new (gchar, strlen (cell->text) + value + 1); - - strncpy (temp, cell->text, edit->selection_start); - strncpy (temp + edit->selection_start, string, value); - strcpy (temp + edit->selection_start + value, cell->text + edit->selection_end); - - g_free (cell->text); - - cell->text = temp; - - edit->selection_start += value; - edit->selection_end = edit->selection_start; -} - -static void -e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data) -{ - CellEdit *edit = (CellEdit *) data; - CurrentCell *cell = CURRENT_CELL(edit); - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (text_view->cell_view.ecell); - - gboolean change = FALSE; - gboolean redraw = FALSE; - - int sel_start, sel_end; - EFont *font; - - font = text_view->font; - - /* If the EText isn't editable, then ignore any commands that would - modify the text. */ - if (!ect->editable && (command->action == E_TEP_DELETE - || command->action == E_TEP_INSERT - || command->action == E_TEP_PASTE - || command->action == E_TEP_GET_SELECTION)) - return; - - switch (command->action) { - case E_TEP_MOVE: - edit->selection_start = _get_position (text_view, command); - edit->selection_end = edit->selection_start; - if (edit->timer) { - g_timer_reset (edit->timer); - } - redraw = TRUE; - break; - case E_TEP_SELECT: - edit->selection_end = _get_position (text_view, command); - sel_start = MIN(edit->selection_start, edit->selection_end); - sel_end = MAX(edit->selection_start, edit->selection_end); - if (sel_start != sel_end) { - e_cell_text_view_supply_selection (edit, command->time, GDK_SELECTION_PRIMARY, - cell->text + sel_start, - sel_end - sel_start); - } else if (edit->timer) { - g_timer_reset (edit->timer); - } - redraw = TRUE; - break; - case E_TEP_DELETE: - if (edit->selection_end == edit->selection_start) { - edit->selection_end = _get_position (text_view, command); - } - _delete_selection (text_view); - if (edit->timer) { - g_timer_reset (edit->timer); - } - redraw = TRUE; - change = TRUE; - break; - - case E_TEP_INSERT: - if (edit->selection_end != edit->selection_start) { - _delete_selection (text_view); - } - _insert (text_view, command->string, command->value); - if (edit->timer) { - g_timer_reset (edit->timer); - } - redraw = TRUE; - change = TRUE; - break; - case E_TEP_COPY: - sel_start = MIN(edit->selection_start, edit->selection_end); - sel_end = MAX(edit->selection_start, edit->selection_end); - if (sel_start != sel_end) { - e_cell_text_view_supply_selection (edit, command->time, clipboard_atom, - cell->text + sel_start, - sel_end - sel_start); - } - if (edit->timer) { - g_timer_reset (edit->timer); - } - break; - case E_TEP_PASTE: - e_cell_text_view_get_selection (edit, clipboard_atom, command->time); - if (edit->timer) { - g_timer_reset (edit->timer); - } - redraw = TRUE; - change = TRUE; - break; - case E_TEP_GET_SELECTION: - e_cell_text_view_get_selection (edit, GDK_SELECTION_PRIMARY, command->time); - break; - case E_TEP_ACTIVATE: - e_table_item_leave_edit (text_view->cell_view.e_table_item_view); - break; - case E_TEP_SET_SELECT_BY_WORD: - edit->select_by_word = command->value; - break; - case E_TEP_GRAB: - edit->actions = E_CELL_GRAB; - break; - case E_TEP_UNGRAB: - edit->actions = E_CELL_UNGRAB; - break; - case E_TEP_NOP: - break; - } - - if (!edit->button_down) { - int x; - int i; - struct line *lines; - ECellTextLineBreaks *linebreaks; - - split_into_lines (cell); - - linebreaks = cell->breaks; - - for (lines = linebreaks->lines, i = 0; i < linebreaks->num_lines ; i++, lines ++) { - if ((lines->text - cell->text) > edit->selection_end) { - break; - } - } - lines --; - x = e_font_utf8_text_width (font, cell->style, - lines->text, - edit->selection_end - (lines->text - cell->text)); - - - if (x < edit->xofs_edit) { - edit->xofs_edit = x; - redraw = TRUE; - } - - if (2 + x - cell->width > edit->xofs_edit) { - edit->xofs_edit = 2 + x - cell->width; - redraw = TRUE; - } - unref_lines (cell); - } - - if (redraw){ - ect_queue_redraw (text_view, edit->cell.view_col, edit->cell.row); - } -#if 0 - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); -#endif -} - -static void _invisible_destroy (GtkInvisible *invisible, - CellEdit *edit) -{ - edit->invisible = NULL; -} - -static GtkWidget *e_cell_text_view_get_invisible (CellEdit *edit) -{ - GtkWidget *invisible; - if (edit->invisible) { - invisible = edit->invisible; - } else { - invisible = gtk_invisible_new (); - edit->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - gtk_signal_connect (GTK_OBJECT(invisible), "selection_get", - GTK_SIGNAL_FUNC (_selection_get), - edit); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_clear_event", - GTK_SIGNAL_FUNC (_selection_clear_event), - edit); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_received", - GTK_SIGNAL_FUNC (_selection_received), - edit); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - edit); - } - return invisible; -} - -static void -_selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - CellEdit *edit) -{ - if (event->selection == GDK_SELECTION_PRIMARY) { - g_free (edit->primary_selection); - edit->primary_selection = NULL; - edit->primary_length = 0; - - edit->has_selection = FALSE; -#if 0 - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); -#endif - - } else if (event->selection == clipboard_atom) { - g_free (edit->clipboard_selection); - edit->clipboard_selection = NULL; - edit->clipboard_length = 0; - } -} - -static void -_selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - CellEdit *edit) -{ - switch (info) { - case E_SELECTION_PRIMARY: - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, edit->primary_selection, edit->primary_length); - break; - case E_SELECTION_CLIPBOARD: - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, edit->clipboard_selection, edit->clipboard_length); - break; - } -} - -/* fixme: What happens, if delivered string is not UTF-8? */ - -static void -_selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - CellEdit *edit) -{ - if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { - return; - } else { - ETextEventProcessorCommand command; - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.string = selection_data->data; - command.value = selection_data->length; - command.time = time; - e_cell_text_view_command (edit->tep, &command, edit); - } -} - -static void -e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection, char *data, gint length) -{ - gboolean successful; - GtkWidget *invisible; - - invisible = e_cell_text_view_get_invisible (edit); - - if (selection == GDK_SELECTION_PRIMARY){ - if (edit->primary_selection) { - g_free (edit->primary_selection); - } - edit->primary_selection = g_strndup (data, length); - edit->primary_length = length; - } else if (selection == clipboard_atom) { - if (edit->clipboard_selection) { - g_free (edit->clipboard_selection); - } - edit->clipboard_selection = g_strndup (data, length); - edit->clipboard_length = length; - } - - successful = gtk_selection_owner_set (invisible, - selection, - time); - - if (selection == GDK_SELECTION_PRIMARY) - edit->has_selection = successful; -} - -static void -e_cell_text_view_get_selection (CellEdit *edit, GdkAtom selection, guint32 time) -{ - GtkWidget *invisible; - invisible = e_cell_text_view_get_invisible (edit); - gtk_selection_convert (invisible, - selection, - GDK_SELECTION_TYPE_STRING, - time); -} - -static void -_get_tep (CellEdit *edit) -{ - if (!edit->tep) { - edit->tep = e_text_event_processor_emacs_like_new (); - gtk_object_ref (GTK_OBJECT (edit->tep)); - gtk_object_sink (GTK_OBJECT (edit->tep)); - gtk_signal_connect (GTK_OBJECT(edit->tep), - "command", - GTK_SIGNAL_FUNC(e_cell_text_view_command), - (gpointer) edit); - } -} - -static int -number_of_lines (char *text) -{ - int num_lines = 0; - gchar *p; - - if (!text) return 0; - - for (p = text; *p; p = unicode_next_utf8 (p)) { - if (*p == '\n') num_lines++; - } - - num_lines++; - return num_lines; -} - -/* Splits the text of the text item into lines */ -static void -split_into_lines (CurrentCell *cell) -{ - char *p; - struct line *lines; - gint len; - - char *text = cell->text; - ECellTextLineBreaks *linebreaks; - - if (! cell->breaks) { - cell->breaks = g_new (ECellTextLineBreaks, 1); - cell->breaks->ref_count = 1; - } else { - cell->breaks->ref_count ++; - return; - } - linebreaks = cell->breaks; - - /* Check if already split. */ - linebreaks->lines = NULL; - linebreaks->num_lines = 0; - - if (!text) - return; - - /* First, count the number of lines */ - - linebreaks->num_lines = number_of_lines(cell->text); - - /* Allocate array of lines and calculate split positions */ - - linebreaks->lines = lines = g_new0 (struct line, linebreaks->num_lines); - - len = 0; - for (p = text; *p; p = unicode_next_utf8 (p)) { - if (len == 0) lines->text = p; - if (*p == '\n') { - lines->length = p - lines->text; - lines++; - len = 0; - } else - len++; - } - - if (len == 0) - lines->text = p; - lines->length = p - lines->text; - - calc_line_widths (cell); -} - -/* Free lines structure. */ -static void -unref_lines (CurrentCell *cell) -{ - if (cell->breaks){ - cell->breaks->ref_count --; - if (cell->breaks->ref_count <= 0){ - g_free (cell->breaks->lines); - g_free (cell->breaks); - cell->breaks = NULL; - } - } -} - -static void -calc_ellipsis (ECellTextView *text_view) -{ - ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); - EFont *font; - - font = text_view->font; - if (font) { - text_view->ellipsis_width[E_FONT_PLAIN] = - e_font_utf8_text_width (font, E_FONT_PLAIN, - ect->ellipsis ? ect->ellipsis : "...", - ect->ellipsis ? strlen (ect->ellipsis) : 3); - text_view->ellipsis_width[E_FONT_BOLD] = - e_font_utf8_text_width (font, E_FONT_BOLD, - ect->ellipsis ? ect->ellipsis : "...", - ect->ellipsis ? strlen (ect->ellipsis) : 3); - } -} - -/* Calculates the line widths (in pixels) of the text's splitted lines */ -static void -calc_line_widths (CurrentCell *cell) -{ - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); - ECellTextLineBreaks *linebreaks = cell->breaks; - struct line *lines; - int i; - int j; - EFont *font; - - font = text_view->font; - - lines = linebreaks->lines; - linebreaks->max_width = 0; - - if (!lines) return; - - for (i = 0; i < linebreaks->num_lines; i++) { - if (lines->length != 0) { - if (font) { - lines->width = e_font_utf8_text_width (font, cell->style, - lines->text, lines->length); - lines->ellipsis_length = 0; - } else { - lines->width = 0; - } - - if (ect->use_ellipsis && - (!(text_view->edit && - cell->row == text_view->edit->cell.row && - cell->view_col == text_view->edit->cell.view_col)) && - lines->width > cell->width) { - if (font) { - lines->ellipsis_length = 0; - for (j = 0; j < lines->length; j++){ - if (e_font_utf8_text_width (font, cell->style, lines->text, j) + - text_view->ellipsis_width[cell->style] < cell->width) { - lines->ellipsis_length = j; - } - else - break; - } - } - else - lines->ellipsis_length = 0; - lines->width = e_font_utf8_text_width (font, cell->style, lines->text, lines->ellipsis_length) + - text_view->ellipsis_width[cell->style]; - } - else - lines->ellipsis_length = lines->length; - - if (lines->width > linebreaks->max_width) - linebreaks->max_width = lines->width; - } else { - lines->width = 0; - lines->ellipsis_length = 0; - } - - lines++; - } -} - -static void -build_current_cell (CurrentCell *cell, ECellTextView *text_view, int model_col, int view_col, int row) -{ - ECellView *ecell_view = (ECellView *) text_view; - ECellText *ect = E_CELL_TEXT (ecell_view->ecell); - char *temp; - - cell->text_view = text_view; - cell->model_col = model_col; - cell->view_col = view_col; - cell->row = row; - cell->breaks = NULL; - - temp = ect_get_text(ect, ecell_view->e_table_model, model_col, row); - cell->text = g_strdup(temp); - ect_free_text(ect, temp); - - cell->width = e_table_header_get_column ( - ((ETableItem *)ecell_view->e_table_item_view)->header, - view_col)->width - 8; - cell->style = 0; -} - -static void -unbuild_current_cell (CurrentCell *cell) -{ - g_free(cell->text); - cell->text = NULL; -} - - -static GdkColor* -e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec) -{ - ECellText *ect = E_CELL_TEXT (((ECellView*) cell_view)->ecell); - GdkColormap *colormap; - GdkColor *color, tmp_color; - - /* If the color spec is NULL we use the default color. */ - if (color_spec == NULL) - return NULL; - - /* Create the hash table if we haven't already. */ - if (!ect->colors) - ect->colors = g_hash_table_new (g_str_hash, g_str_equal); - - /* See if we've already allocated the color. Note that we use a - special value of (GdkColor*) 1 in the hash to indicate that we've - already tried and failed to allocate the color, so we don't keep - trying to allocate it. */ - color = g_hash_table_lookup (ect->colors, color_spec); - if (color == (GdkColor*) 1) - return NULL; - if (color) - return color; - - /* Try to parse the color. */ - if (gdk_color_parse (color_spec, &tmp_color)) { - colormap = gtk_widget_get_colormap (GTK_WIDGET (cell_view->canvas)); - - /* Try to allocate the color. */ - if (gdk_color_alloc (colormap, &tmp_color)) - color = gdk_color_copy (&tmp_color); - } - - g_hash_table_insert (ect->colors, g_strdup (color_spec), - color ? color : (GdkColor*) 1); - return color; -} - diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h deleted file mode 100644 index 8ea9c509bd..0000000000 --- a/widgets/table/e-cell-text.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ECellText - Text item for e-table. - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - * - * Drawing and event handling from: - * - * EText - Text item for evolution. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Chris Lahey <clahey@ximian.com> - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena <federico@nuclecu.unam.mx> */ -#ifndef _E_CELL_TEXT_H_ -#define _E_CELL_TEXT_H_ - -#include <libgnomeui/gnome-canvas.h> -#include <gal/e-table/e-cell.h> - -BEGIN_GNOME_DECLS - -#define E_CELL_TEXT_TYPE (e_cell_text_get_type ()) -#define E_CELL_TEXT(o) (GTK_CHECK_CAST ((o), E_CELL_TEXT_TYPE, ECellText)) -#define E_CELL_TEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TEXT_TYPE, ECellTextClass)) -#define E_IS_CELL_TEXT(o) (GTK_CHECK_TYPE ((o), E_CELL_TEXT_TYPE)) -#define E_IS_CELL_TEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TEXT_TYPE)) - -typedef struct { - ECell parent; - - GtkJustification justify; - char *font_name; - - double x, y; /* Position at anchor */ - - gulong pixel; /* Fill color */ - - /* Clip handling */ - char *ellipsis; /* The ellipsis characters. NULL = "...". */ - - guint use_ellipsis : 1; /* Whether to use the ellipsis. */ - guint editable : 1; /* Whether the text can be edited. */ - - int strikeout_column; - int bold_column; - - /* This column in the ETable should return a string specifying a color, - either a color name like "red" or a color spec like "rgb:F/0/0". - See the XParseColor man page for the formats available. */ - int color_column; - - /* This stores the colors we have allocated. */ - GHashTable *colors; -} ECellText; - -typedef struct { - ECellClass parent_class; - - char *(*get_text) (ECellText *cell, ETableModel *model, int col, int row); - void (*free_text) (ECellText *cell, char *text); -} ECellTextClass; - -GtkType e_cell_text_get_type (void); -ECell *e_cell_text_new (const char *fontname, GtkJustification justify); -ECell *e_cell_text_construct(ECellText *cell, const char *fontname, GtkJustification justify); - -END_GNOME_DECLS - -#endif /* _E_CELL_TEXT_H_ */ - - diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c deleted file mode 100644 index 45971f6f18..0000000000 --- a/widgets/table/e-cell-toggle.c +++ /dev/null @@ -1,342 +0,0 @@ -/* - * e-cell-toggle.c: Multi-state image toggle cell object. - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 1999, 2000 Ximian, Inc - */ -#include <config.h> -#include <gtk/gtkenums.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkwindow.h> -#include <gtk/gtksignal.h> -#include <gdk/gdkkeysyms.h> -#include <libgnomeui/gnome-canvas.h> -#include "e-cell-toggle.h" -#include "gal/util/e-util.h" -#include "e-table-item.h" - -#define PARENT_TYPE e_cell_get_type () - -typedef struct { - ECellView cell_view; - GdkGC *gc; - GnomeCanvas *canvas; -} ECellToggleView; - -static ECellClass *parent_class; - -static void -etog_queue_redraw (ECellToggleView *text_view, int view_col, int view_row) -{ - e_table_item_redraw_range ( - text_view->cell_view.e_table_item_view, - view_col, view_row, view_col, view_row); -} - -/* - * ECell::realize method - */ -static ECellView * -etog_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - ECellToggleView *toggle_view = g_new0 (ECellToggleView, 1); - ETableItem *eti = E_TABLE_ITEM (e_table_item_view); - GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas; - - toggle_view->cell_view.ecell = ecell; - toggle_view->cell_view.e_table_model = table_model; - toggle_view->cell_view.e_table_item_view = e_table_item_view; - toggle_view->canvas = canvas; - - return (ECellView *) toggle_view; -} - -static void -etog_kill_view (ECellView *ecell_view) -{ - g_free (ecell_view); -} - -static void -etog_realize (ECellView *ecell_view) -{ - ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; - - toggle_view->gc = gdk_gc_new (GTK_WIDGET (toggle_view->canvas)->window); -} - -/* - * ECell::unrealize method - */ -static void -etog_unrealize (ECellView *ecv) -{ - ECellToggleView *toggle_view = (ECellToggleView *) ecv; - - gdk_gc_unref (toggle_view->gc); - toggle_view->gc = NULL; -} - -/* - * ECell::draw method - */ -static void -etog_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, ECellFlags flags, - int x1, int y1, int x2, int y2) -{ - ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell); - gboolean selected; -#if 0 - ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; -#endif - GdkPixbuf *image; - int x, y, width, height; - - const int value = GPOINTER_TO_INT ( - e_table_model_value_at (ecell_view->e_table_model, model_col, row)); - - selected = flags & E_CELL_SELECTED; - - if (value >= toggle->n_states){ - g_warning ("Value from the table model is %d, the states we support are [0..%d)\n", - value, toggle->n_states); - return; - } - - image = toggle->images [value]; - - if ((x2 - x1) < gdk_pixbuf_get_width (image)){ - x = x1; - width = x2 - x1; - } else { - x = x1 + ((x2 - x1) - gdk_pixbuf_get_width (image)) / 2; - width = gdk_pixbuf_get_width (image); - } - - if ((y2 - y1) < gdk_pixbuf_get_height (image)){ - y = y1; - height = y2 - y1; - } else { - y = y1 + ((y2 - y1) - gdk_pixbuf_get_height (image)) / 2; - height = gdk_pixbuf_get_height (image); - } - -#if 0 /* do alpha */ - if (gdk_pixbuf_get_has_alpha (image)) { - flat = gdk_pixbuf_composite_color_simple ( - image, - gdk_pixbuf_get_width (image), - gdk_pixbuf_get_height (image), - GDK_INTERP_NEAREST, - 255, - 32, - 0xffffff, 0xffffff); - - gdk_pixbuf_render_to_drawable (flat, drawable, - toggle_view->gc, - 0, 0, - x, y, - width, height, - GDK_RGB_DITHER_NORMAL, - 0, 0); - gdk_pixbuf_unref (flat); - } else { - gdk_pixbuf_render_to_drawable (image, drawable, - toggle_view->gc, - 0, 0, - x, y, - width, height, - GDK_RGB_DITHER_NORMAL, - 0, 0); - } -#else - gdk_pixbuf_render_to_drawable_alpha (image, drawable, - 0, 0, - x, y, - width, height, - GDK_PIXBUF_ALPHA_BILEVEL, - 128, - GDK_RGB_DITHER_NORMAL, - x, y); -#endif -} - -static void -etog_set_value (ECellToggleView *toggle_view, int model_col, int view_col, int row, int value) -{ - ECell *ecell = toggle_view->cell_view.ecell; - ECellToggle *toggle = E_CELL_TOGGLE (ecell); - - if (value >= toggle->n_states) - value = 0; - - e_table_model_set_value_at (toggle_view->cell_view.e_table_model, - model_col, row, GINT_TO_POINTER (value)); - etog_queue_redraw (toggle_view, view_col, row); -} - -/* - * ECell::event method - */ -static gint -etog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions) -{ - ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; - void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, row); - const int value = GPOINTER_TO_INT (_value); - - if (flags & !E_CELL_EDITING) - return 0; - - switch (event->type){ - case GDK_BUTTON_RELEASE: - if (!e_table_model_is_cell_editable(ecell_view->e_table_model, model_col, row)) - return FALSE; - - etog_set_value (toggle_view, model_col, view_col, row, value + 1); - return TRUE; - - case GDK_KEY_PRESS: - if (!e_table_model_is_cell_editable(ecell_view->e_table_model, model_col, row)) - return FALSE; - - if (event->key.keyval == GDK_space){ - etog_set_value (toggle_view, model_col, view_col, row, value + 1); - return TRUE; - } - return FALSE; - - default: - return FALSE; - } - return TRUE; -} - -/* - * ECell::height method - */ -static int -etog_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell); - - return toggle->height; -} - -/* - * ECell::max_width method - */ -static int -etog_max_width (ECellView *ecell_view, int model_col, int view_col) -{ - ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell); - void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, 0); - int max_width = gdk_pixbuf_get_width (toggle->images[GPOINTER_TO_INT (_value)]); - int number_of_rows; - int row; - - number_of_rows = e_table_model_row_count (ecell_view->e_table_model); - for (row = 1; row < number_of_rows; row++) { - void *_value = e_table_model_value_at (ecell_view->e_table_model, - model_col, row); - max_width = MAX (max_width, gdk_pixbuf_get_width (toggle->images[GPOINTER_TO_INT (_value)])); - } - - return max_width; -} - -static void -etog_destroy (GtkObject *object) -{ - ECellToggle *etog = E_CELL_TOGGLE (object); - int i; - - for (i = 0; i < etog->n_states; i++) - gdk_pixbuf_unref (etog->images [i]); - - g_free (etog->images); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -e_cell_toggle_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - - object_class->destroy = etog_destroy; - - ecc->new_view = etog_new_view; - ecc->kill_view = etog_kill_view; - ecc->realize = etog_realize; - ecc->unrealize = etog_unrealize; - ecc->draw = etog_draw; - ecc->event = etog_event; - ecc->height = etog_height; - ecc->max_width = etog_max_width; - - parent_class = gtk_type_class (PARENT_TYPE); -} - -E_MAKE_TYPE(e_cell_toggle, "ECellToggle", ECellToggle, e_cell_toggle_class_init, NULL, PARENT_TYPE); - -/** - * e_cell_toggle_construct: - * @etog: a fresh ECellToggle object - * @border: number of pixels used as a border - * @n_states: number of states the toggle will have - * @images: a collection of @n_states images, one for each state. - * - * Constructs the @etog object with the @border, @n_staes, and @images - * arguments. - */ -void -e_cell_toggle_construct (ECellToggle *etog, int border, int n_states, GdkPixbuf **images) -{ - int max_height = 0; - int i; - - etog->border = border; - etog->n_states = n_states; - - etog->images = g_new (GdkPixbuf *, n_states); - - for (i = 0; i < n_states; i++){ - etog->images [i] = images [i]; - gdk_pixbuf_ref (images [i]); - - if (gdk_pixbuf_get_height (images [i]) > max_height) - max_height = gdk_pixbuf_get_height (images [i]); - } - - etog->height = max_height; -} - -/** - * e_cell_checkbox_new: - * @border: number of pixels used as a border - * @n_states: number of states the toggle will have - * @images: a collection of @n_states images, one for each state. - * - * Creates a new ECell renderer that can be used to render toggle - * buttons with the images specified in @images. The value returned - * by ETableModel::get_value is typecase into an integer and clamped - * to the [0..n_states) range. That will select the image rendered. - * - * Returns: an ECell object that can be used to render multi-state - * toggle cells. - */ -ECell * -e_cell_toggle_new (int border, int n_states, GdkPixbuf **images) -{ - ECellToggle *etog = gtk_type_new (e_cell_toggle_get_type ()); - - e_cell_toggle_construct (etog, border, n_states, images); - - return (ECell *) etog; -} - - diff --git a/widgets/table/e-cell-toggle.h b/widgets/table/e-cell-toggle.h deleted file mode 100644 index 0916970b00..0000000000 --- a/widgets/table/e-cell-toggle.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _E_CELL_TOGGLE_H_ -#define _E_CELL_TOGGLE_H_ - -#include <libgnomeui/gnome-canvas.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <gal/e-table/e-cell.h> - -BEGIN_GNOME_DECLS - -#define E_CELL_TOGGLE_TYPE (e_cell_toggle_get_type ()) -#define E_CELL_TOGGLE(o) (GTK_CHECK_CAST ((o), E_CELL_TOGGLE_TYPE, ECellToggle)) -#define E_CELL_TOGGLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TOGGLE_TYPE, ECellToggleClass)) -#define E_IS_CELL_TOGGLE(o) (GTK_CHECK_TYPE ((o), E_CELL_TOGGLE_TYPE)) -#define E_IS_CELL_TOGGLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TOGGLE_TYPE)) - -typedef struct { - ECell parent; - - int border; - int n_states; - GdkPixbuf **images; - - int height; -} ECellToggle; - -typedef struct { - ECellClass parent_class; -} ECellToggleClass; - -GtkType e_cell_toggle_get_type (void); -ECell *e_cell_toggle_new (int border, int n_states, GdkPixbuf **images); -void e_cell_toggle_construct (ECellToggle *etog, int border, - int n_states, GdkPixbuf **images); - -END_GNOME_DECLS - -#endif /* _E_CELL_TOGGLE_H_ */ - - diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c deleted file mode 100644 index 62c78da748..0000000000 --- a/widgets/table/e-cell-tree.c +++ /dev/null @@ -1,697 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-cell-tree.c - Tree cell renderer - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Chris Toshok <toshok@ximian.com> - * - * A majority of code taken from: - * - * the ECellText renderer. - * - * Copyright (C) 1998 The Free Software Foundation - * Copyright (C) 1999, 2000 Ximian, Inc. - */ - -#include <config.h> -#include <gtk/gtkenums.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkwindow.h> -#include <gtk/gtkinvisible.h> -#include <gtk/gtksignal.h> -#include <gdk/gdkkeysyms.h> -#include <libgnomeui/gnome-canvas.h> -#include <stdio.h> -#include "e-table-sorted-variable.h" -#include "e-tree-model.h" -#include "e-cell-tree.h" -#include "gal/util/e-util.h" -#include "e-table-item.h" - -#include <gdk/gdkx.h> /* for BlackPixel */ -#include <ctype.h> -#include <math.h> - -#include "tree-expanded.xpm" -#include "tree-unexpanded.xpm" - -#define PARENT_TYPE e_cell_get_type () - -typedef struct { - ECellView cell_view; - ECellView *subcell_view; - GdkGC *gc; - - GnomeCanvas *canvas; - -} ECellTreeView; - -static ECellClass *parent_class; - -#define INDENT_AMOUNT 16 - -static int -visible_depth_of_node (ETreeModel *tree_model, ETreePath *path) -{ - return (e_tree_model_node_depth (tree_model, path) - - (e_tree_model_root_node_is_visible (tree_model) ? 0 : 1)); -} - -static gint -offset_of_node (ETreeModel *tree_model, ETreePath *path) -{ - return (visible_depth_of_node(tree_model, path) + 1) * INDENT_AMOUNT; -} - -static ETreePath* -e_cell_tree_get_node (ETableModel *table_model, int row) -{ - return (ETreePath*)e_table_model_value_at (table_model, -1, row); -} - -static ETreeModel* -e_cell_tree_get_tree_model (ETableModel *table_model, int row) -{ - return (ETreeModel*)e_table_model_value_at (table_model, -2, row); -} - -/* - * ECell::new_view method - */ -static ECellView * -ect_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - ECellTree *ect = E_CELL_TREE (ecell); - ECellTreeView *tree_view = g_new0 (ECellTreeView, 1); - GnomeCanvas *canvas = GNOME_CANVAS_ITEM (e_table_item_view)->canvas; - - tree_view->cell_view.ecell = ecell; - tree_view->cell_view.e_table_model = table_model; - tree_view->cell_view.e_table_item_view = e_table_item_view; - - /* create our subcell view */ - tree_view->subcell_view = e_cell_new_view (ect->subcell, table_model, e_table_item_view /* XXX */); - - tree_view->canvas = canvas; - - return (ECellView *)tree_view; -} - -/* - * ECell::kill_view method - */ -static void -ect_kill_view (ECellView *ecv) -{ - ECellTreeView *tree_view = (ECellTreeView *) ecv; - - /* kill our subcell view */ - e_cell_kill_view (tree_view->subcell_view); - - g_free (tree_view); -} - -/* - * ECell::realize method - */ -static void -ect_realize (ECellView *ecell_view) -{ - ECellTreeView *tree_view = (ECellTreeView *) ecell_view; - - /* realize our subcell view */ - e_cell_realize (tree_view->subcell_view); - - tree_view->gc = gdk_gc_new (GTK_WIDGET (tree_view->canvas)->window); - - gdk_gc_set_line_attributes (tree_view->gc, 1, - GDK_LINE_ON_OFF_DASH, None, None); - gdk_gc_set_dashes (tree_view->gc, 0, "\1\1", 2); - - if (parent_class->realize) - (* parent_class->realize) (ecell_view); -} - -/* - * ECell::unrealize method - */ -static void -ect_unrealize (ECellView *ecv) -{ - ECellTreeView *tree_view = (ECellTreeView *) ecv; - - /* unrealize our subcell view. */ - e_cell_unrealize (tree_view->subcell_view); - - gdk_gc_unref (tree_view->gc); - tree_view->gc = NULL; - - if (parent_class->unrealize) - (* parent_class->unrealize) (ecv); -} - -/* - * ECell::draw method - */ -static void -ect_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, ECellFlags flags, - int x1, int y1, int x2, int y2) -{ - ECellTreeView *tree_view = (ECellTreeView *)ecell_view; - ETreeModel *tree_model = e_cell_tree_get_tree_model(ecell_view->e_table_model, row); - ETreePath *node; - GdkRectangle rect, *clip_rect; - GtkWidget *canvas = GTK_WIDGET (tree_view->canvas); - GdkGC *fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE]; - GdkColor *foreground; - gboolean selected; - - int offset, subcell_offset; - gboolean expanded, expandable; - - selected = flags & E_CELL_SELECTED; - - /* only draw the tree effects if we're the active sort */ - if (/* XXX */ TRUE) { - GdkPixbuf *node_image; - int node_image_width = 0, node_image_height = 0; - ETreePath *parent_node; - - node = e_cell_tree_get_node (ecell_view->e_table_model, row); - - expandable = e_tree_model_node_is_expandable (tree_model, node); - expanded = e_tree_model_node_is_expanded (tree_model, node); - - if (visible_depth_of_node (tree_model, node) > 0 || expandable) { - offset = offset_of_node (tree_model, node); - } else { - offset = 0; - } - subcell_offset = offset; - - node_image = e_tree_model_icon_of_node (tree_model, node); - - if (node_image) { - node_image_width = gdk_pixbuf_get_width (node_image); - node_image_height = gdk_pixbuf_get_height (node_image); - } - - /* - * Be a nice citizen: clip to the region we are supposed to draw on - */ - rect.x = x1; - rect.y = y1; - rect.width = subcell_offset + node_image_width; - rect.height = y2 - y1; - - gdk_gc_set_clip_rectangle (tree_view->gc, &rect); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ - - if (selected) { - foreground = &canvas->style->text [GTK_STATE_SELECTED]; - } else { - foreground = &canvas->style->text [GTK_STATE_NORMAL]; - } - - gdk_gc_set_foreground (tree_view->gc, foreground); - - /* draw our lines */ - if (E_CELL_TREE(tree_view->cell_view.ecell)->draw_lines) { - - if (visible_depth_of_node (tree_model, node) > 0 - || e_tree_model_node_get_children (tree_model, node, NULL) > 0) - gdk_draw_line (drawable, tree_view->gc, - rect.x + offset - INDENT_AMOUNT / 2 + 1, - rect.y + rect.height / 2, - rect.x + offset, - rect.y + rect.height / 2); - - if (visible_depth_of_node (tree_model, node) != 0) { - gdk_draw_line (drawable, tree_view->gc, - rect.x + offset - INDENT_AMOUNT / 2, - rect.y, - rect.x + offset - INDENT_AMOUNT / 2, - (e_tree_model_node_get_next (tree_model, node) - ? rect.y + rect.height - : rect.y + rect.height / 2)); - } - - /* now traverse back up to the root of the tree, checking at - each level if the node has siblings, and drawing the - correct vertical pipe for it's configuration. */ - parent_node = e_tree_model_node_get_parent (tree_model, node); - offset -= INDENT_AMOUNT; - while (parent_node && visible_depth_of_node (tree_model, parent_node) != 0) { - if (e_tree_model_node_get_next(tree_model, parent_node)) { - gdk_draw_line (drawable, tree_view->gc, - rect.x + offset - INDENT_AMOUNT / 2, - rect.y, - rect.x + offset - INDENT_AMOUNT / 2, - rect.y + rect.height); - } - parent_node = e_tree_model_node_get_parent (tree_model, parent_node); - offset -= INDENT_AMOUNT; - } - } - - /* now draw our icon if we're expandable */ - if (expandable) { - GdkPixbuf *image; - int image_width, image_height; - - image = (expanded - ? E_CELL_TREE(tree_view->cell_view.ecell)->open_pixbuf - : E_CELL_TREE(tree_view->cell_view.ecell)->closed_pixbuf); - - image_width = gdk_pixbuf_get_width(image); - image_height = gdk_pixbuf_get_height(image); - - gdk_pixbuf_render_to_drawable_alpha (image, - drawable, - 0, 0, - x1 + subcell_offset - INDENT_AMOUNT / 2 - image_width / 2, - y1 + (y2 - y1) / 2 - image_height / 2, - image_width, image_height, - GDK_PIXBUF_ALPHA_BILEVEL, - 128, - GDK_RGB_DITHER_NORMAL, - image_width, 0); - } - - if (node_image) { - gdk_pixbuf_render_to_drawable_alpha (node_image, - drawable, - 0, 0, - x1 + subcell_offset, - y1 + (y2 - y1) / 2 - node_image_height / 2, - node_image_width, node_image_height, - GDK_PIXBUF_ALPHA_BILEVEL, - 128, - GDK_RGB_DITHER_NORMAL, - node_image_width, 0); - subcell_offset += node_image_width; - } - } - - /* Now cause our subcell to draw its contents, shifted by - subcell_offset pixels */ - e_cell_draw (tree_view->subcell_view, drawable, - model_col, view_col, row, flags, - x1 + subcell_offset, y1, x2, y2); -} - -/* - * ECell::event method - */ -static gint -ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions) -{ - ECellTreeView *tree_view = (ECellTreeView *) ecell_view; - ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row); - ETreePath *node = e_cell_tree_get_node (ecell_view->e_table_model, row); - int offset = offset_of_node (tree_model, node); - - switch (event->type) { - case GDK_BUTTON_PRESS: { - /* if the event happened in our area of control (and - we care about it), handle it. */ - - /* only activate the tree control if the click/release happens in the icon's area. */ - if (event->button.x > (offset - INDENT_AMOUNT) && event->button.x < offset) { - if (e_tree_model_node_is_expandable (tree_model, node)) { - e_tree_model_node_set_expanded (tree_model, - node, - !e_tree_model_node_is_expanded(tree_model, node)); - return TRUE; - } - } - else if (event->button.x < (offset - INDENT_AMOUNT)) - return FALSE; - } - default: { - gint return_value; - - /* modify the event and pass it off to our subcell_view */ - switch (event->type) { - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - event->button.x -= offset; - break; - case GDK_MOTION_NOTIFY: - event->motion.x -= offset; - break; - default: - /* nada */ - } - - return_value = e_cell_event(tree_view->subcell_view, event, model_col, view_col, row, flags, actions); - - /* modify the event and pass it off to our subcell_view */ - switch (event->type) { - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - event->button.x += offset; - break; - case GDK_MOTION_NOTIFY: - event->motion.x += offset; - break; - default: - /* nada */ - } - - return return_value; - } - } -} - -/* - * ECell::height method - */ -static int -ect_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - ECellTreeView *tree_view = (ECellTreeView *) ecell_view; - - return e_cell_height (tree_view->subcell_view, model_col, view_col, row); -} - -/* - * ECell::max_width method - */ -static int -ect_max_width (ECellView *ecell_view, int model_col, int view_col) -{ - ECellTreeView *tree_view = (ECellTreeView *) ecell_view; - int row; - int number_of_rows; - int max_width = 0; - int width = 0; - int subcell_max_width; - - number_of_rows = e_table_model_row_count (ecell_view->e_table_model); - - subcell_max_width = e_cell_max_width (tree_view->subcell_view, model_col, view_col); - - for (row = 0; row < number_of_rows; row++) { - ETreeModel *tree_model = e_cell_tree_get_tree_model(ecell_view->e_table_model, row); - ETreePath *node; - GdkPixbuf *node_image; - int node_image_width = 0, node_image_height = 0; - - int offset, subcell_offset; - gboolean expanded, expandable; - - node = e_cell_tree_get_node (ecell_view->e_table_model, row); - - offset = offset_of_node (tree_model, node); - expandable = e_tree_model_node_is_expandable (tree_model, node); - expanded = e_tree_model_node_is_expanded (tree_model, node); - subcell_offset = offset; - - node_image = e_tree_model_icon_of_node (tree_model, node); - - if (node_image) { - node_image_width = gdk_pixbuf_get_width (node_image); - node_image_height = gdk_pixbuf_get_height (node_image); - } - - width = subcell_max_width + subcell_offset + node_image_width; - - if (expandable) { - GdkPixbuf *image; - - image = (expanded - ? E_CELL_TREE(tree_view->cell_view.ecell)->open_pixbuf - : E_CELL_TREE(tree_view->cell_view.ecell)->closed_pixbuf); - - width += gdk_pixbuf_get_width(image); - } - - max_width = MAX (max_width, width); - } - - return max_width; -} - -/* - * ECellView::show_tooltip method - */ -static void -ect_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, - int col_width, ETableTooltip *tooltip) -{ - ECellTreeView *tree_view = (ECellTreeView *) ecell_view; - ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row); - ETreePath *node = e_cell_tree_get_node (ecell_view->e_table_model, row); - int offset = offset_of_node (tree_model, node); - GdkPixbuf *node_image; - - node_image = e_tree_model_icon_of_node (tree_model, node); - if (node_image) - offset += gdk_pixbuf_get_width (node_image); - - tooltip->x += offset; - e_cell_show_tooltip (tree_view->subcell_view, model_col, view_col, row, col_width - offset, tooltip); -} - -/* - * ECellView::enter_edit method - */ -static void * -ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) -{ - /* just defer to our subcell's view */ - ECellTreeView *tree_view = (ECellTreeView *) ecell_view; - - return e_cell_enter_edit (tree_view->subcell_view, model_col, view_col, row); -} - -/* - * ECellView::leave_edit method - */ -static void -ect_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context) -{ - /* just defer to our subcell's view */ - ECellTreeView *tree_view = (ECellTreeView *) ecell_view; - - e_cell_leave_edit (tree_view->subcell_view, model_col, view_col, row, edit_context); -} - -static void -ect_print (ECellView *ecell_view, GnomePrintContext *context, - int model_col, int view_col, int row, - double width, double height) -{ - ECellTreeView *tree_view = (ECellTreeView *) ecell_view; - - if (/* XXX only if we're the active sort */ TRUE) { - ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row); - ETreePath *node = e_cell_tree_get_node (ecell_view->e_table_model, row); - int offset = offset_of_node (tree_model, node); - int subcell_offset = offset; - gboolean expandable = e_tree_model_node_is_expandable (tree_model, node); - gboolean expanded = e_tree_model_node_is_expanded (tree_model, node); - - /* draw our lines */ - if (E_CELL_TREE(tree_view->cell_view.ecell)->draw_lines) { - - if (!e_tree_model_node_is_root (tree_model, node) - || e_tree_model_node_get_children (tree_model, node, NULL) > 0) { - gnome_print_moveto (context, - offset - INDENT_AMOUNT / 2, - height / 2); - - gnome_print_lineto (context, - offset, - height / 2); - } - - if (visible_depth_of_node (tree_model, node) != 0) { - gnome_print_moveto (context, - offset - INDENT_AMOUNT / 2, - height); - gnome_print_lineto (context, - offset - INDENT_AMOUNT / 2, - (e_tree_model_node_get_next (tree_model, node) - ? 0 - : height / 2)); - } - - /* now traverse back up to the root of the tree, checking at - each level if the node has siblings, and drawing the - correct vertical pipe for it's configuration. */ - node = e_tree_model_node_get_parent (tree_model, node); - offset -= INDENT_AMOUNT; - while (node && visible_depth_of_node (tree_model, node) != 0) { - if (e_tree_model_node_get_next(tree_model, node)) { - gnome_print_moveto (context, - offset - INDENT_AMOUNT / 2, - height); - gnome_print_lineto (context, - offset - INDENT_AMOUNT / 2, - 0); - } - node = e_tree_model_node_get_parent (tree_model, node); - offset -= INDENT_AMOUNT; - } - } - - /* now draw our icon if we're expandable */ - if (expandable) { - double image_matrix [6] = {16, 0, 0, 16, 0, 0}; - GdkPixbuf *image = (expanded - ? E_CELL_TREE(tree_view->cell_view.ecell)->open_pixbuf - : E_CELL_TREE(tree_view->cell_view.ecell)->closed_pixbuf); - int image_width, image_height, image_rowstride; - guchar *image_pixels; - - image_width = gdk_pixbuf_get_width(image); - image_height = gdk_pixbuf_get_height(image); - image_pixels = gdk_pixbuf_get_pixels(image); - image_rowstride = gdk_pixbuf_get_rowstride(image); - - image_matrix [4] = subcell_offset - INDENT_AMOUNT / 2 - image_width / 2; - image_matrix [5] = height / 2 - image_height / 2; - - gnome_print_gsave (context); - gnome_print_concat (context, image_matrix); - - gnome_print_rgbaimage (context, image_pixels, image_width, image_height, image_rowstride); - gnome_print_grestore (context); - } - - gnome_print_stroke (context); - - if (gnome_print_translate(context, subcell_offset, 0) == -1) - /* FIXME */; - width -= subcell_offset; - } - - - e_cell_print (tree_view->subcell_view, context, model_col, view_col, row, width, height); -} - -static gdouble -ect_print_height (ECellView *ecell_view, GnomePrintContext *context, - int model_col, int view_col, int row, - double width) -{ - return 12; /* XXX */ -} - -/* - * GtkObject::destroy method - */ -static void -ect_destroy (GtkObject *object) -{ - ECellTree *ect = E_CELL_TREE (object); - - /* destroy our subcell */ - if (ect->subcell) - gtk_object_unref (GTK_OBJECT (ect->subcell)); - ect->subcell = NULL; - - gdk_pixbuf_unref (ect->open_pixbuf); - gdk_pixbuf_unref (ect->closed_pixbuf); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -e_cell_tree_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - - object_class->destroy = ect_destroy; - - ecc->new_view = ect_new_view; - ecc->kill_view = ect_kill_view; - ecc->realize = ect_realize; - ecc->unrealize = ect_unrealize; - ecc->draw = ect_draw; - ecc->event = ect_event; - ecc->height = ect_height; - ecc->enter_edit = ect_enter_edit; - ecc->leave_edit = ect_leave_edit; - ecc->print = ect_print; - ecc->print_height = ect_print_height; - ecc->max_width = ect_max_width; - ecc->show_tooltip = ect_show_tooltip; - - parent_class = gtk_type_class (PARENT_TYPE); -} - -E_MAKE_TYPE(e_cell_tree, "ECellTree", ECellTree, e_cell_tree_class_init, NULL, PARENT_TYPE); - -/** - * e_cell_tree_construct: - * @ect: the ECellTree we're constructing. - * @open_pixbuf: pixbuf to be used instead of the '-' icon. - * @closed_pixbuf: pixbuf to be used instead of the '+' icon. - * @draw_lines: whether or not to draw the lines between parents/children/siblings. - * @subcell: the ECell to render to the right of the tree effects. - * - * Constructs an ECellTree. used by subclasses that need to - * initialize a nested ECellTree. See e_cell_tree_new() for more info. - * - **/ -void -e_cell_tree_construct (ECellTree *ect, - GdkPixbuf *open_pixbuf, - GdkPixbuf *closed_pixbuf, - gboolean draw_lines, - ECell *subcell) -{ - ect->subcell = subcell; - if (subcell) { - gtk_object_ref (GTK_OBJECT (subcell)); - gtk_object_sink (GTK_OBJECT (subcell)); - } - if (open_pixbuf) - ect->open_pixbuf = open_pixbuf; - else - ect->open_pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **)tree_expanded_xpm); - if (closed_pixbuf) - ect->closed_pixbuf = closed_pixbuf; - else - ect->closed_pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **)tree_unexpanded_xpm); - - ect->draw_lines = draw_lines; -} - - -/** - * e_cell_tree_new: - * @open_pixbuf: pixbuf to be used instead of the '-' icon. - * @closed_pixbuf: pixbuf to be used instead of the '+' icon. - * @draw_lines: whether or not to draw the lines between parents/children/siblings. - * @subcell: the ECell to render to the right of the tree effects. - * - * Creates a new ECell renderer that can be used to render tree - * effects that come from an ETreeModel. Various assumptions are made - * as to the fact that the ETableModel the ETable this cell is - * associated with is in fact an ETreeModel. The cell uses special - * columns to get at structural information (needed to draw the - * lines/icons. - * - * Return value: an ECell object that can be used to render trees. - **/ -ECell * -e_cell_tree_new (GdkPixbuf *open_pixbuf, - GdkPixbuf *closed_pixbuf, - gboolean draw_lines, - ECell *subcell) -{ - ECellTree *ect = gtk_type_new (e_cell_tree_get_type ()); - - e_cell_tree_construct (ect, open_pixbuf, closed_pixbuf, draw_lines, subcell); - - return (ECell *) ect; -} diff --git a/widgets/table/e-cell-tree.h b/widgets/table/e-cell-tree.h deleted file mode 100644 index 7b2d007159..0000000000 --- a/widgets/table/e-cell-tree.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ECellTree - Tree item for e-table. - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Toshok <toshok@ximian.com> - * - */ -#ifndef _E_CELL_TREE_H_ -#define _E_CELL_TREE_H_ - -#include <libgnomeui/gnome-canvas.h> -#include <gal/e-table/e-cell.h> - -BEGIN_GNOME_DECLS - -#define E_CELL_TREE_TYPE (e_cell_tree_get_type ()) -#define E_CELL_TREE(o) (GTK_CHECK_CAST ((o), E_CELL_TREE_TYPE, ECellTree)) -#define E_CELL_TREE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TREE_TYPE, ECellTreeClass)) -#define E_IS_CELL_TREE(o) (GTK_CHECK_TYPE ((o), E_CELL_TREE_TYPE)) -#define E_IS_CELL_TREE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TREE_TYPE)) - -typedef struct { - ECell parent; - - gboolean draw_lines; - - GdkPixbuf *open_pixbuf; - GdkPixbuf *closed_pixbuf; - - ECell *subcell; -} ECellTree; - -typedef struct { - ECellClass parent_class; -} ECellTreeClass; - -GtkType e_cell_tree_get_type (void); -ECell *e_cell_tree_new (GdkPixbuf *open_pixbuf, - GdkPixbuf *closed_pixbuf, - gboolean draw_lines, - ECell *subcell); -void e_cell_tree_construct (ECellTree *ect, - GdkPixbuf *open_pixbuf, - GdkPixbuf *closed_pixbuf, - gboolean draw_lines, - ECell *subcell); - - -END_GNOME_DECLS - -#endif /* _E_CELL_TREE_H_ */ - - diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c deleted file mode 100644 index 2d59df19da..0000000000 --- a/widgets/table/e-cell.c +++ /dev/null @@ -1,354 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-cell.c: base class for cell renderers in e-table - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 1999 Ximian, Inc - */ -#include <config.h> -#include "e-cell.h" -#include "gal/util/e-util.h" - -#define PARENT_TYPE gtk_object_get_type () - -static ECellView * -ec_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - return NULL; -} - -static void -ec_realize (ECellView *e_cell) -{ -} - -static void -ec_kill_view (ECellView *ecell_view) -{ -} - -static void -ec_unrealize (ECellView *e_cell) -{ -} - -static void -ec_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, ECellFlags flags, - int x1, int y1, int x2, int y2) -{ - g_error ("e-cell-draw invoked\n"); -} - -static gint -ec_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions) -{ - g_error ("e-cell-event invoked\n"); - return 0; -} - -static gint -ec_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - g_error ("e-cell-height invoked\n"); - return 0; -} - -static void -ec_focus (ECellView *ecell_view, int model_col, int view_col, int row, int x1, int y1, int x2, int y2) -{ - ecell_view->focus_col = view_col; - ecell_view->focus_row = row; - ecell_view->focus_x1 = x1; - ecell_view->focus_y1 = y1; - ecell_view->focus_x2 = x2; - ecell_view->focus_y2 = y2; -} - -static void -ec_unfocus (ECellView *ecell_view) -{ - ecell_view->focus_col = -1; - ecell_view->focus_row = -1; - ecell_view->focus_x1 = -1; - ecell_view->focus_y1 = -1; - ecell_view->focus_x2 = -1; - ecell_view->focus_y2 = -1; -} - -static void * -ec_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) -{ - return NULL; -} - -static void -ec_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *context) -{ -} - -static void -ec_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip) -{ - /* Do nothing */ -} - -static void -e_cell_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - - ecc->realize = ec_realize; - ecc->unrealize = ec_unrealize; - ecc->new_view = ec_new_view; - ecc->kill_view = ec_kill_view; - ecc->draw = ec_draw; - ecc->event = ec_event; - ecc->focus = ec_focus; - ecc->unfocus = ec_unfocus; - ecc->height = ec_height; - ecc->enter_edit = ec_enter_edit; - ecc->leave_edit = ec_leave_edit; - ecc->print = NULL; - ecc->print_height = NULL; - ecc->max_width = NULL; - ecc->show_tooltip = ec_show_tooltip; -} - -static void -e_cell_init (GtkObject *object) -{ -} - -E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE); - -/** - * e_cell_event: - * @ecell_view: The ECellView where the event will be dispatched - * @event: The GdkEvent. - * @model_col: the column in the model - * @view_col: the column in the view - * @row: the row - * @flags: flags about the current state - * @actions: A second return value in case the cell wants to take some action (specifically grabbing & ungrabbing) - * - * Dispatches the event @event to the @ecell_view for. - * - * Returns: processing state from the GdkEvent handling. - */ -gint -e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->event ( - ecell_view, event, model_col, view_col, row, flags, actions); -} - -/** - * e_cell_new_view: - * @ecell: the Ecell that will create the new view - * @table_model: the table model the ecell is bound to - * @e_table_item_view: An ETableItem object (the CanvasItem that reprensents the view of the table) - * - * ECell renderers new to be bound to a table_model and to the actual view - * during their life time to actually render the data. This method is invoked - * by the ETableItem canvas item to instatiate a new view of the ECell. - * - * This is invoked when the ETableModel is attached to the ETableItem (a CanvasItem - * that can render ETableModels in the screen). - * - * Returns: a new ECellView for this @ecell on the @table_model displayed on the @e_table_item_view. - */ -ECellView * -e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell)->klass)->new_view ( - ecell, table_model, e_table_item_view); -} - -/** - * e_cell_realize: - * @ecell_view: The ECellView to be realized. - * - * This function is invoked to give a chance to the ECellView to allocate - * any resources it needs from Gdk, equivalent to the GtkWidget::realize - * signal. - */ -void -e_cell_realize (ECellView *ecell_view) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->realize (ecell_view); -} - -/** - * e_cell_kill_view: - * @ecell_view: view to be destroyed. - * - * This method it used to destroy a view of an ECell renderer - */ -void -e_cell_kill_view (ECellView *ecell_view) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->kill_view (ecell_view); -} - -/** - * e_cell_unrealize: - * @ecell_view: The ECellView to be unrealized. - * - * This function is invoked to give a chance to the ECellView to - * release any resources it allocated during the realize method, - * equivalent to the GtkWidget::unrealize signal. - */ -void -e_cell_unrealize (ECellView *ecell_view) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->unrealize (ecell_view); -} - -/** - * e_cell_draw: - * @ecell_view: the ECellView to redraw - * @drawable: draw desination - * @model_col: the column in the model being drawn. - * @view_col: the column in the view being drawn (what the model maps to). - * @row: the row being drawn - * @flags: rendering flags. - * @x1: boudary for the rendering - * @y1: boudary for the rendering - * @x2: boudary for the rendering - * @y2: boudary for the rendering - * - * This instructs the ECellView to render itself into the drawable. The - * region to be drawn in given by (x1,y1)-(x2,y2). - * - * The most important flags are %E_CELL_SELECTED and %E_CELL_FOCUSED, other - * flags include alignments and justifications. - */ -void -e_cell_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, ECellFlags flags, - int x1, int y1, int x2, int y2) -{ - g_return_if_fail (ecell_view != NULL); - g_return_if_fail (row >= 0); - g_return_if_fail (row < e_table_model_row_count(ecell_view->e_table_model)); - - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->draw ( - ecell_view, drawable, model_col, view_col, row, flags, x1, y1, x2, y2); -} - -/** - * e_cell_print: - * @ecell_view: the ECellView to redraw - * @context: The GnomePrintContext where we output our printed data. - * @model_col: the column in the model being drawn. - * @view_col: the column in the view being drawn (what the model maps to). - * @row: the row being drawn - * @width: width - * @height: height - * - * FIXME: - */ -void -e_cell_print (ECellView *ecell_view, GnomePrintContext *context, - int model_col, int view_col, int row, - double width, double height) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->print - (ecell_view, context, model_col, view_col, row, width, height); -} - -/** - * e_cell_print: - * - * FIXME: - */ -gdouble -e_cell_print_height (ECellView *ecell_view, GnomePrintContext *context, - int model_col, int view_col, int row, - double width) -{ - if (E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->print_height) - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->print_height - (ecell_view, context, model_col, view_col, row, width); - else - return 0.0; -} - -/** - * e_cell_height: - * @ecell_view: the ECellView. - * @model_col: the column in the model - * @view_col: the column in the view. - * @row: the row to me measured - * - * Returns: the height of the cell at @model_col, @row rendered at - * @view_col, @row. - */ -int -e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->height ( - ecell_view, model_col, view_col, row); -} - -/** - * e_cell_enter_edit: - * @ecell_view: the ECellView that will enter editing - * @model_col: the column in the model - * @view_col: the column in the view - * @row: the row - * - * Notifies the ECellView that it is about to enter editing mode for - * @model_col, @row rendered at @view_col, @row. - */ -void * -e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->enter_edit ( - ecell_view, model_col, view_col, row); -} - -/** - * e_cell_leave_edit: - * @ecell_view: the ECellView that will leave editing - * @model_col: the column in the model - * @view_col: the column in the view - * @row: the row - * @edit_context: the editing context - * - * Notifies the ECellView that editing is finished at @model_col, @row - * rendered at @view_col, @row. - */ -void -e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->leave_edit ( - ecell_view, model_col, view_col, row, edit_context); -} - -/** - * e_cell_max_width: - * @ecell_view: the ECellView that will leave editing - * @model_col: the column in the model - * @view_col: the column in the view. - * - * Returns: the maximum width for the ECellview at @model_col which - * is being rendered as @view_col - */ -int -e_cell_max_width (ECellView *ecell_view, int model_col, int view_col) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->max_width - (ecell_view, model_col, view_col); -} - -void -e_cell_show_tooltip (ECellView *ecell_view, int model_col, int view_col, - int row, int col_width, ETableTooltip *tooltip) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->show_tooltip - (ecell_view, model_col, view_col, row, col_width, tooltip); -} diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h deleted file mode 100644 index b9927114bb..0000000000 --- a/widgets/table/e-cell.h +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_CELL_H_ -#define _E_CELL_H_ - -#include <gdk/gdktypes.h> -#include <libgnomeprint/gnome-print.h> -#include <gal/e-table/e-table-model.h> -#include <gal/e-table/e-table-tooltip.h> - -BEGIN_GNOME_DECLS - -#define E_CELL_TYPE (e_cell_get_type ()) -#define E_CELL(o) (GTK_CHECK_CAST ((o), E_CELL_TYPE, ECell)) -#define E_CELL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass)) -#define E_IS_CELL(o) (GTK_CHECK_TYPE ((o), E_CELL_TYPE)) -#define E_IS_CELL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TYPE)) - -typedef enum { - E_CELL_SELECTED = 1 << 0, - - E_CELL_JUSTIFICATION = 3 << 1, - E_CELL_JUSTIFY_CENTER = 0 << 1, - E_CELL_JUSTIFY_LEFT = 1 << 1, - E_CELL_JUSTIFY_RIGHT = 2 << 1, - E_CELL_JUSTIFY_FILL = 3 << 1, - - E_CELL_ALIGN_LEFT = 1 << 1, - E_CELL_ALIGN_RIGHT = 1 << 2, - - E_CELL_FOCUSED = 1 << 3, - - E_CELL_EDITING = 1 << 4, -} ECellFlags; - -typedef enum { - E_CELL_GRAB = 1 << 0, - E_CELL_UNGRAB = 1 << 1, -} ECellActions; - -typedef struct { - GtkObject object; -} ECell; - -typedef struct { - ECell *ecell; - ETableModel *e_table_model; - void *e_table_item_view; - - gint focus_x1, focus_y1, focus_x2, focus_y2; - gint focus_col, focus_row; -} ECellView; - -#define E_CELL_IS_FOCUSED(ecell_view) (ecell_view->focus_x1 != -1) - -typedef struct { - GtkObjectClass parent_class; - - ECellView *(*new_view) (ECell *ecell, ETableModel *table_model, void *e_table_item_view); - void (*kill_view) (ECellView *ecell_view); - - void (*realize) (ECellView *ecell_view); - void (*unrealize) (ECellView *ecell_view); - - void (*draw) (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, - ECellFlags flags, int x1, int y1, int x2, int y2); - gint (*event) (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions); - void (*focus) (ECellView *ecell_view, int model_col, int view_col, - int row, int x1, int y1, int x2, int y2); - void (*unfocus) (ECellView *ecell_view); - int (*height) (ECellView *ecell_view, int model_col, int view_col, int row); - - void *(*enter_edit) (ECellView *ecell_view, int model_col, int view_col, int row); - void (*leave_edit) (ECellView *ecell_view, int model_col, int view_col, int row, void *context); - void (*print) (ECellView *ecell_view, GnomePrintContext *context, - int model_col, int view_col, int row, - gdouble width, gdouble height); - gdouble (*print_height) (ECellView *ecell_view, GnomePrintContext *context, - int model_col, int view_col, int row, gdouble width); - int (*max_width) (ECellView *ecell_view, int model_col, int view_col); - void (*show_tooltip) (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip); -} ECellClass; - -GtkType e_cell_get_type (void); -ECellView *e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view); -void e_cell_kill_view (ECellView *ecell_view); - -gint e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions); - -void e_cell_realize (ECellView *ecell_view); -void e_cell_unrealize (ECellView *ecell_view); - -void e_cell_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, ECellFlags flags, - int x1, int y1, int x2, int y2); -void e_cell_print (ECellView *ecell_view, GnomePrintContext *context, - int model_col, int view_col, int row, - double width, double height); -gdouble e_cell_print_height (ECellView *ecell_view, GnomePrintContext *context, - int model_col, int view_col, int row, gdouble width); -int e_cell_max_width (ECellView *ecell_view, int model_col, int view_col); -void e_cell_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip); -void e_cell_focus (ECellView *ecell_view, int model_col, int view_col, int row, - int x1, int y1, int x2, int y2); -void e_cell_unfocus (ECellView *ecell_view); -int e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row); - -void *e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row); -void e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context); - -END_GNOME_DECLS - -#endif /* _E_CELL_H_ */ diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c deleted file mode 100644 index cdaa446f90..0000000000 --- a/widgets/table/e-table-click-to-add.c +++ /dev/null @@ -1,541 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-click-to-add.c: A canvas item based view of the ETableColumn. - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * Copyright 1999, 2000 Ximian, Inc. - */ -#include <config.h> -#include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-util.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#include "e-table-header.h" -#include "e-table-click-to-add.h" -#include "e-table-defines.h" -#include "e-table-one.h" -#include "gal/e-text/e-text.h" -#include "gal/widgets/e-canvas.h" -#include "gal/widgets/e-canvas-utils.h" - -enum { - CURSOR_CHANGE, - LAST_SIGNAL -}; - -static gint etcta_signals [LAST_SIGNAL] = { 0, }; - -#define PARENT_OBJECT_TYPE gnome_canvas_group_get_type () - -#define ELEMENTS(x) (sizeof (x) / sizeof (x[0])) - -static GnomeCanvasGroupClass *etcta_parent_class; - -enum { - ARG_0, - ARG_HEADER, - ARG_MODEL, - ARG_MESSAGE, - ARG_WIDTH, - ARG_HEIGHT, -}; - -static void -etcta_cursor_change (GtkObject *object, gint row, gint col, ETableClickToAdd *etcta) -{ - gtk_signal_emit (GTK_OBJECT (etcta), - etcta_signals [CURSOR_CHANGE], - row, col); -} - -static void -etcta_add_table_header (ETableClickToAdd *etcta, ETableHeader *header) -{ - etcta->eth = header; - if (etcta->eth) - gtk_object_ref (GTK_OBJECT (etcta->eth)); - if (etcta->row) - gnome_canvas_item_set(GNOME_CANVAS_ITEM(etcta->row), - "ETableHeader", header, - NULL); -} - -static void -etcta_drop_table_header (ETableClickToAdd *etcta) -{ - GtkObject *header; - - if (!etcta->eth) - return; - - header = GTK_OBJECT (etcta->eth); - - gtk_object_unref (header); - etcta->eth = NULL; -} - -static void -etcta_add_one (ETableClickToAdd *etcta, ETableModel *one) -{ - etcta->one = one; - if (etcta->one) - gtk_object_ref (GTK_OBJECT(etcta->one)); - if (etcta->row) - gnome_canvas_item_set(GNOME_CANVAS_ITEM(etcta->row), - "ETableModel", one, - NULL); - gtk_object_set(GTK_OBJECT(etcta->selection), - "model", one, - NULL); -} - -static void -etcta_drop_one (ETableClickToAdd *etcta) -{ - if (!etcta->one) - return; - gtk_object_unref (GTK_OBJECT(etcta->one)); - etcta->one = NULL; - gtk_object_set(GTK_OBJECT(etcta->selection), - "model", NULL, - NULL); -} - -static void -etcta_add_model (ETableClickToAdd *etcta, ETableModel *model) -{ - etcta->model = model; - if (etcta->model) - gtk_object_ref (GTK_OBJECT(etcta->model)); -} - -static void -etcta_drop_model (ETableClickToAdd *etcta) -{ - etcta_drop_one (etcta); - if (!etcta->model) - return; - gtk_object_unref (GTK_OBJECT(etcta->model)); - etcta->model = NULL; -} - -static void -etcta_add_message (ETableClickToAdd *etcta, char *message) -{ - etcta->message = g_strdup(message); -} - -static void -etcta_drop_message (ETableClickToAdd *etcta) -{ - g_free(etcta->message); - etcta->message = NULL; -} - - -static void -etcta_destroy (GtkObject *object){ - ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (object); - - etcta_drop_table_header (etcta); - etcta_drop_model (etcta); - etcta_drop_message (etcta); - gtk_object_unref(GTK_OBJECT(etcta->selection)); - - if (GTK_OBJECT_CLASS (etcta_parent_class)->destroy) - (*GTK_OBJECT_CLASS (etcta_parent_class)->destroy) (object); -} - -static void -etcta_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - ETableClickToAdd *etcta; - - item = GNOME_CANVAS_ITEM (o); - etcta = E_TABLE_CLICK_TO_ADD (o); - - switch (arg_id){ - case ARG_HEADER: - etcta_drop_table_header (etcta); - etcta_add_table_header (etcta, E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg))); - break; - case ARG_MODEL: - etcta_drop_model (etcta); - etcta_add_model (etcta, E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg))); - break; - case ARG_MESSAGE: - etcta_drop_message (etcta); - etcta_add_message (etcta, GTK_VALUE_STRING (*arg)); - break; - case ARG_WIDTH: - etcta->width = GTK_VALUE_DOUBLE (*arg); - if (etcta->row) - gnome_canvas_item_set(etcta->row, - "minimum_width", etcta->width, - NULL); - if (etcta->text) - gnome_canvas_item_set(etcta->text, - "width", etcta->width - 4, - NULL); - if (etcta->rect) - gnome_canvas_item_set(etcta->rect, - "x2", etcta->width - 1, - NULL); - break; - } - gnome_canvas_item_request_update(item); -} - -static void -etcta_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ETableClickToAdd *etcta; - - etcta = E_TABLE_CLICK_TO_ADD (o); - - switch (arg_id){ - case ARG_HEADER: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etcta->eth); - break; - case ARG_MODEL: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etcta->model); - break; - case ARG_MESSAGE: - GTK_VALUE_STRING (*arg) = g_strdup(etcta->message); - break; - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = etcta->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = etcta->height; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -etcta_realize (GnomeCanvasItem *item) -{ - ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item); - - etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) etcta->width - 1, - "y2", (double) etcta->height - 1, - "outline_color", "black", - "fill_color", "white", - NULL); - - etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item), - e_text_get_type(), - "text", etcta->message ? etcta->message : "", - "anchor", GTK_ANCHOR_NW, - "width", etcta->width - 4, - "draw_background", FALSE, - NULL); - e_canvas_item_move_absolute (etcta->text, 2, 2); - - if (GNOME_CANVAS_ITEM_CLASS (etcta_parent_class)->realize) - (*GNOME_CANVAS_ITEM_CLASS (etcta_parent_class)->realize)(item); -} - -static void -etcta_unrealize (GnomeCanvasItem *item) -{ - if (GNOME_CANVAS_ITEM_CLASS (etcta_parent_class)->unrealize) - (*GNOME_CANVAS_ITEM_CLASS (etcta_parent_class)->unrealize)(item); -} - -static double -etcta_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - *actual_item = item; - return 0.0; -} - -static void finish_editing (ETableClickToAdd *etcta); - -static int -item_key_press (ETableItem *item, int row, int col, GdkEvent *event, ETableClickToAdd *etcta) -{ - switch (event->key.keyval) { - case GDK_Return: - case GDK_KP_Enter: - case GDK_ISO_Enter: - case GDK_3270_Enter: - finish_editing(etcta); - return TRUE; - } - return FALSE; -} - -static void -finish_editing (ETableClickToAdd *etcta) -{ - if (etcta->row) { - ETableModel *one; - - e_table_one_commit(E_TABLE_ONE(etcta->one)); - etcta_drop_one (etcta); - gtk_object_destroy(GTK_OBJECT(etcta->row)); - etcta->row = NULL; - - one = e_table_one_new(etcta->model); - etcta_add_one (etcta, one); - gtk_object_unref(GTK_OBJECT(one)); - - e_selection_model_clear(E_SELECTION_MODEL(etcta->selection)); - - etcta->row = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta), - e_table_item_get_type(), - "ETableHeader", etcta->eth, - "ETableModel", etcta->one, - "minimum_width", etcta->width, - "drawgrid", TRUE, - "table_selection_model", etcta->selection, - "cursor_mode", E_CURSOR_SPREADSHEET, - NULL); - - gtk_signal_connect(GTK_OBJECT(etcta->row), "key_press", - GTK_SIGNAL_FUNC(item_key_press), etcta); - - e_table_item_set_cursor(E_TABLE_ITEM(etcta->row), 0, 0); - } -} - -/* - * Handles the events on the ETableClickToAdd, particularly it creates the ETableItem and passes in some events. - */ -static int -etcta_event (GnomeCanvasItem *item, GdkEvent *e) -{ - ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item); - int ret_val = TRUE; - - switch (e->type){ - case GDK_BUTTON_PRESS: - if (etcta->text) { - gtk_object_destroy(GTK_OBJECT(etcta->text)); - etcta->text = NULL; - } - if (etcta->rect) { - gtk_object_destroy(GTK_OBJECT(etcta->rect)); - etcta->rect = NULL; - } - if (!etcta->row) { - ETableModel *one; - - one = e_table_one_new(etcta->model); - etcta_add_one (etcta, one); - gtk_object_unref(GTK_OBJECT(one)); - - e_selection_model_clear(E_SELECTION_MODEL(etcta->selection)); - - etcta->row = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item), - e_table_item_get_type(), - "ETableHeader", etcta->eth, - "ETableModel", etcta->one, - "minimum_width", etcta->width, - "drawgrid", TRUE, - "table_selection_model", etcta->selection, - "cursor_mode", E_CURSOR_SPREADSHEET, - NULL); - - gtk_signal_connect(GTK_OBJECT(etcta->row), "key_press", - GTK_SIGNAL_FUNC(item_key_press), etcta); - } - /* Fall through. No break; */ - case GDK_BUTTON_RELEASE: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - if (etcta->row) { - gnome_canvas_item_i2w (item, &e->button.x, &e->button.y); - gnome_canvas_item_w2i (etcta->row, &e->button.x, &e->button.y); - gtk_signal_emit_by_name(GTK_OBJECT(etcta->row), "event", e, &ret_val); - gnome_canvas_item_i2w (etcta->row, &e->button.x, &e->button.y); - gnome_canvas_item_w2i (item, &e->button.x, &e->button.y); - } - break; - - case GDK_KEY_PRESS: - switch (e->key.keyval) { - case GDK_Tab: - case GDK_KP_Tab: - case GDK_ISO_Left_Tab: - finish_editing (etcta); - break; - default: - return FALSE; - break; - } - - default: - return FALSE; - } - return TRUE; -} - -static void -etcta_reflow (GnomeCanvasItem *item, int flags) -{ - ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item); - - double old_height = etcta->height; - - if (etcta->text) { - gtk_object_get(GTK_OBJECT(etcta->text), - "height", &etcta->height, - NULL); - etcta->height += 6; - } - if (etcta->row) { - gtk_object_get(GTK_OBJECT(etcta->row), - "height", &etcta->height, - NULL); - } - - if (etcta->rect) { - gtk_object_set(GTK_OBJECT(etcta->rect), - "y2", etcta->height - 1, - NULL); - } - if (old_height != etcta->height) - e_canvas_item_request_parent_reflow(item); -} - -static void -etcta_class_init (ETableClickToAddClass *klass) -{ - GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS(klass); - GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass); - - etcta_parent_class = gtk_type_class (PARENT_OBJECT_TYPE); - - klass->cursor_change = NULL; - - object_class->destroy = etcta_destroy; - object_class->set_arg = etcta_set_arg; - object_class->get_arg = etcta_get_arg; - - item_class->realize = etcta_realize; - item_class->unrealize = etcta_unrealize; - item_class->point = etcta_point; - item_class->event = etcta_event; - - gtk_object_add_arg_type ("ETableClickToAdd::header", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_HEADER); - gtk_object_add_arg_type ("ETableClickToAdd::model", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_MODEL); - gtk_object_add_arg_type ("ETableClickToAdd::message", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_MESSAGE); - gtk_object_add_arg_type ("ETableClickToAdd::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableClickToAdd::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - - etcta_signals [CURSOR_CHANGE] = - gtk_signal_new ("cursor_change", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClickToAddClass, cursor_change), - gtk_marshal_NONE__INT_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, etcta_signals, LAST_SIGNAL); -} - -static void -etcta_init (GnomeCanvasItem *item) -{ - ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item); - - etcta->one = NULL; - etcta->model = NULL; - etcta->eth = NULL; - - etcta->message = NULL; - - etcta->row = NULL; - etcta->text = NULL; - etcta->rect = NULL; - - etcta->selection = e_table_selection_model_new(); - gtk_signal_connect(GTK_OBJECT(etcta->selection), "cursor_changed", - GTK_SIGNAL_FUNC(etcta_cursor_change), etcta); - - e_canvas_item_set_reflow_callback(item, etcta_reflow); -} - -GtkType -e_table_click_to_add_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETableClickToAdd", - sizeof (ETableClickToAdd), - sizeof (ETableClickToAddClass), - (GtkClassInitFunc) etcta_class_init, - (GtkObjectInitFunc) etcta_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_OBJECT_TYPE, &info); - } - - return type; -} - - -/* The colors in this need to be themefied. */ -/** - * e_table_click_to_add_commit: - * @etcta: The %ETableClickToAdd to commit. - * - * This routine commits the current thing being edited and returns to - * just displaying the click to add message. - **/ -void -e_table_click_to_add_commit (ETableClickToAdd *etcta) -{ - if (etcta->row) { - e_table_one_commit(E_TABLE_ONE(etcta->one)); - etcta_drop_one (etcta); - gtk_object_destroy(GTK_OBJECT(etcta->row)); - etcta->row = NULL; - } - if (!etcta->rect) { - etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) etcta->width - 1, - "y2", (double) etcta->height - 1, - "outline_color", "black", - "fill_color", "white", - NULL); - } - if (!etcta->text) { - etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta), - e_text_get_type(), - "text", etcta->message ? etcta->message : "", - "anchor", GTK_ANCHOR_NW, - "width", etcta->width - 4, - "draw_background", FALSE, - NULL); - e_canvas_item_move_absolute (etcta->text, 3, 3); - } -} diff --git a/widgets/table/e-table-click-to-add.h b/widgets/table/e-table-click-to-add.h deleted file mode 100644 index f4412cb0ea..0000000000 --- a/widgets/table/e-table-click-to-add.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_CLICK_TO_ADD_H_ -#define _E_TABLE_CLICK_TO_ADD_H_ - -#include <libgnomeui/gnome-canvas.h> -#include <gnome-xml/tree.h> -#include <gal/e-table/e-table-header.h> -#include <gal/e-table/e-table-sort-info.h> -#include <gal/e-table/e-table-item.h> -#include <gal/e-table/e-table-selection-model.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_CLICK_TO_ADD_TYPE (e_table_click_to_add_get_type ()) -#define E_TABLE_CLICK_TO_ADD(o) (GTK_CHECK_CAST ((o), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAdd)) -#define E_TABLE_CLICK_TO_ADD_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAddClass)) -#define E_IS_TABLE_CLICK_TO_ADD(o) (GTK_CHECK_TYPE ((o), E_TABLE_CLICK_TO_ADD_TYPE)) -#define E_IS_TABLE_CLICK_TO_ADD_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_CLICK_TO_ADD_TYPE)) - -typedef struct { - GnomeCanvasGroup parent; - - ETableModel *one; /* The ETableOne. */ - - ETableModel *model; /* The backend model. */ - ETableHeader *eth; /* This is just to give to the ETableItem. */ - - char *message; - - GnomeCanvasItem *row; /* If row is NULL, we're sitting with no data and a "Click here" message. */ - GnomeCanvasItem *text; /* If text is NULL, row shouldn't be. */ - GnomeCanvasItem *rect; /* What the heck. Why not. */ - - gdouble width; - gdouble height; - - ETableSelectionModel *selection; -} ETableClickToAdd; - -typedef struct { - GnomeCanvasGroupClass parent_class; - - /* - * signals - */ - void (*cursor_change) (ETableClickToAdd *etcta, gint row, gint col); -} ETableClickToAddClass; - -GtkType e_table_click_to_add_get_type (void); - -void e_table_click_to_add_commit (ETableClickToAdd *etcta); - -END_GNOME_DECLS - -#endif /* _E_TABLE_CLICK_TO_ADD_H_ */ diff --git a/widgets/table/e-table-col-dnd.h b/widgets/table/e-table-col-dnd.h deleted file mode 100644 index 98b489b7c0..0000000000 --- a/widgets/table/e-table-col-dnd.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _E_TABLE_COL_DND_H_ -#define _E_TABLE_COL_DND_H_ - -BEGIN_GNOME_DECLS - -#define TARGET_ETABLE_COL_TYPE "application/x-etable-column-header" - -enum { - TARGET_ETABLE_COL_HEADER -}; - -END_GNOME_DECLS - -#endif /* _E_TABLE_COL_DND_H_ */ diff --git a/widgets/table/e-table-col.c b/widgets/table/e-table-col.c deleted file mode 100644 index 38ae4a9b51..0000000000 --- a/widgets/table/e-table-col.c +++ /dev/null @@ -1,207 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-col.c: ETableCol implementation - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Ximian, Inc - */ -#include <config.h> -#include <gtk/gtkobject.h> -#include <gtk/gtksignal.h> -#include "e-table-col.h" -#include "gal/util/e-util.h" - -#define PARENT_TYPE (gtk_object_get_type ()) - -static GtkObjectClass *parent_class; - - -enum { - ARG_0, - ARG_SORTABLE, -}; - -static void -etc_destroy (GtkObject *object) -{ - ETableCol *etc = E_TABLE_COL (object); - - gtk_object_unref (GTK_OBJECT(etc->ecell)); - - if (etc->pixbuf) - gdk_pixbuf_unref (etc->pixbuf); - if (etc->text) - g_free (etc->text); - - (*parent_class->destroy)(object); -} - - -static void -etc_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ETableCol *etc = E_TABLE_COL (o); - - switch (arg_id){ - case ARG_SORTABLE: - etc->sortable = GTK_VALUE_BOOL(*arg); - break; - } -} - -static void -etc_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ETableCol *etc = E_TABLE_COL (o); - - switch (arg_id){ - case ARG_SORTABLE: - GTK_VALUE_BOOL(*arg) = etc->sortable; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_table_col_class_init (GtkObjectClass *object_class) -{ - parent_class = gtk_type_class (PARENT_TYPE); - object_class->destroy = etc_destroy; - object_class->get_arg = etc_get_arg; - object_class->set_arg = etc_set_arg; - - gtk_object_add_arg_type ("ETableCol::sortable", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SORTABLE); -} - -static void -e_table_col_init (ETableCol *etc) -{ - etc->width = 0; - etc->sortable = 1; - etc->groupable = 1; - etc->justification = GTK_JUSTIFY_LEFT; -} - -E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, e_table_col_init, PARENT_TYPE); - -/** - * e_table_col_new: - * @col_idx: the column we represent in the model - * @text: a title for this column - * @expansion: FIXME - * @min_width: minimum width in pixels for this column - * @ecell: the renderer to be used for this column - * @compare: comparision function for the elements stored in this column - * @resizable: whether the column can be resized interactively by the user - * - * The ETableCol represents a column to be used inside an ETable. The - * ETableCol objects are inserted inside an ETableHeader (which is just a collection - * of ETableCols). The ETableHeader is the definition of the order in which - * columns are shown to the user. - * - * The @text argument is the the text that will be shown as a header to the - * user. @col_idx reflects where the data for this ETableCol object will - * be fetch from an ETableModel. So even if the user changes the order - * of the columns being viewed (the ETableCols in the ETableHeader), the - * column will always point to the same column inside the ETableModel. - * - * The @ecell argument is an ECell object that needs to know how to render the - * data in the ETableModel for this specific row. - * - * Returns: the newly created ETableCol object. - */ -ETableCol * -e_table_col_new (int col_idx, const char *text, double expansion, int min_width, - ECell *ecell, GCompareFunc compare, gboolean resizable) -{ - ETableCol *etc; - - g_return_val_if_fail (expansion >= 0, NULL); - g_return_val_if_fail (min_width >= 0, NULL); - g_return_val_if_fail (ecell != NULL, NULL); - g_return_val_if_fail (compare != NULL, NULL); - g_return_val_if_fail (text != NULL, NULL); - - etc = gtk_type_new (E_TABLE_COL_TYPE); - - etc->is_pixbuf = FALSE; - - etc->col_idx = col_idx; - etc->text = g_strdup (text); - etc->pixbuf = NULL; - etc->expansion = expansion; - etc->min_width = min_width; - etc->ecell = ecell; - etc->compare = compare; - - etc->selected = 0; - etc->resizeable = resizable; - - gtk_object_ref (GTK_OBJECT(etc->ecell)); - - return etc; -} - -/** - * e_table_col_new_with_pixbuf: - * @col_idx: the column we represent in the model - * @pixbuf: the image to be used for the header - * @expansion: FIXME - * @min_width: minimum width in pixels for this column - * @ecell: the renderer to be used for this column - * @compare: comparision function for the elements stored in this column - * @resizable: whether the column can be resized interactively by the user - * - * The ETableCol represents a column to be used inside an ETable. The - * ETableCol objects are inserted inside an ETableHeader (which is just a collection - * of ETableCols). The ETableHeader is the definition of the order in which - * columns are shown to the user. - * - * The @text argument is the the text that will be shown as a header to the - * user. @col_idx reflects where the data for this ETableCol object will - * be fetch from an ETableModel. So even if the user changes the order - * of the columns being viewed (the ETableCols in the ETableHeader), the - * column will always point to the same column inside the ETableModel. - * - * The @ecell argument is an ECell object that needs to know how to render the - * data in the ETableModel for this specific row. - * - * Returns: the newly created ETableCol object. - */ -ETableCol * -e_table_col_new_with_pixbuf (int col_idx, const char *text, GdkPixbuf *pixbuf, double expansion, int min_width, - ECell *ecell, GCompareFunc compare, gboolean resizable) -{ - ETableCol *etc; - - g_return_val_if_fail (expansion >= 0, NULL); - g_return_val_if_fail (min_width >= 0, NULL); - g_return_val_if_fail (ecell != NULL, NULL); - g_return_val_if_fail (compare != NULL, NULL); - g_return_val_if_fail (pixbuf != NULL, NULL); - - etc = gtk_type_new (E_TABLE_COL_TYPE); - - etc->is_pixbuf = TRUE; - - etc->col_idx = col_idx; - etc->text = g_strdup(text); - etc->pixbuf = pixbuf; - etc->expansion = expansion; - etc->min_width = min_width; - etc->ecell = ecell; - etc->compare = compare; - - etc->selected = 0; - etc->resizeable = resizable; - - gtk_object_ref (GTK_OBJECT(etc->ecell)); - gdk_pixbuf_ref (etc->pixbuf); - - return etc; -} diff --git a/widgets/table/e-table-col.h b/widgets/table/e-table-col.h deleted file mode 100644 index 036b317d69..0000000000 --- a/widgets/table/e-table-col.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_COL_H_ -#define _E_TABLE_COL_H_ - -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <gal/e-table/e-cell.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_TABLE_COL_TYPE (e_table_col_get_type ()) -#define E_TABLE_COL(o) (GTK_CHECK_CAST ((o), E_TABLE_COL_TYPE, ETableCol)) -#define E_TABLE_COL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_COL_TYPE, ETableColClass)) -#define E_IS_TABLE_COL(o) (GTK_CHECK_TYPE ((o), E_TABLE_COL_TYPE)) -#define E_IS_TABLE_COL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_COL_TYPE)) - -typedef enum { - E_TABLE_COL_ARROW_NONE = 0, - E_TABLE_COL_ARROW_UP, - E_TABLE_COL_ARROW_DOWN -} ETableColArrow; - -/* - * Information about a single column - */ -typedef struct { - GtkObject base; - char *text; - GdkPixbuf *pixbuf; - int min_width; - int width; - double expansion; - short x; - GCompareFunc compare; - unsigned int is_pixbuf:1; - unsigned int selected:1; - unsigned int resizeable:1; - unsigned int sortable:1; - unsigned int groupable:1; - int col_idx; - - GtkJustification justification; - - ECell *ecell; -} ETableCol; - -typedef struct { - GtkObjectClass parent_class; -} ETableColClass; - -GtkType e_table_col_get_type (void); -ETableCol *e_table_col_new (int col_idx, const char *text, - double expansion, int min_width, - ECell *ecell, GCompareFunc compare, - gboolean resizable); -ETableCol *e_table_col_new_with_pixbuf (int col_idx, const char *text, - GdkPixbuf *pixbuf, - double expansion, int min_width, - ECell *ecell, GCompareFunc compare, - gboolean resizable); -void e_table_col_destroy (ETableCol *etc); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* _E_TABLE_COL_H_ */ - diff --git a/widgets/table/e-table-column-specification.c b/widgets/table/e-table-column-specification.c deleted file mode 100644 index 68c19188b1..0000000000 --- a/widgets/table/e-table-column-specification.c +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-column-specification.c: Savable specification of a column. - * - * Author: - * Chris Lahey <clahey@ximian.com> - * - * (C) 2000 Ximian, Inc. - */ -#include <config.h> -#include <stdlib.h> -#include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> -#include "gal/util/e-xml-utils.h" -#include "gal/util/e-util.h" -#include "e-table-column-specification.h" - -#define PARENT_TYPE (gtk_object_get_type()) - -static GtkObjectClass *etcs_parent_class; - -static void -free_strings (ETableColumnSpecification *etcs) -{ - g_free(etcs->title); - g_free(etcs->pixbuf); - g_free(etcs->cell); - g_free(etcs->compare); -} - -static void -etcs_destroy (GtkObject *object) -{ - ETableColumnSpecification *etcs = E_TABLE_COLUMN_SPECIFICATION (object); - - free_strings(etcs); - - GTK_OBJECT_CLASS (etcs_parent_class)->destroy (object); -} - -static void -etcs_class_init (GtkObjectClass *klass) -{ - etcs_parent_class = gtk_type_class (PARENT_TYPE); - - klass->destroy = etcs_destroy; -} - -static void -etcs_init (ETableColumnSpecification *specification) -{ - specification->model_col = 0; - specification->title = g_strdup(""); - specification->pixbuf = NULL; - - specification->expansion = 0; - specification->minimum_width = 0; - specification->resizable = FALSE; - - specification->cell = NULL; - specification->compare = NULL; -} - -E_MAKE_TYPE(e_table_column_specification, "ETableColumnSpecification", ETableColumnSpecification, etcs_class_init, etcs_init, PARENT_TYPE); - -ETableColumnSpecification * -e_table_column_specification_new (void) -{ - ETableColumnSpecification *etcs = gtk_type_new (E_TABLE_COLUMN_SPECIFICATION_TYPE); - - return (ETableColumnSpecification *) etcs; -} - -void -e_table_column_specification_load_from_node (ETableColumnSpecification *etcs, - const xmlNode *node) -{ - free_strings(etcs); - - etcs->model_col = e_xml_get_integer_prop_by_name(node, "model_col"); - etcs->title = e_xml_get_string_prop_by_name(node, "_title"); - etcs->pixbuf = e_xml_get_string_prop_by_name(node, "pixbuf"); - - etcs->expansion = e_xml_get_double_prop_by_name(node, "expansion"); - etcs->minimum_width = e_xml_get_integer_prop_by_name(node, "minimum_width"); - etcs->resizable = e_xml_get_bool_prop_by_name(node, "resizable"); - - etcs->cell = e_xml_get_string_prop_by_name(node, "cell"); - etcs->compare = e_xml_get_string_prop_by_name(node, "compare"); - - if (etcs->title == NULL) - etcs->title = g_strdup(""); -} - -xmlNode * -e_table_column_specification_save_to_node (ETableColumnSpecification *specification, - xmlNode *parent) -{ - xmlNode *node; - if (parent) - node = xmlNewChild(parent, NULL, "ETableColumn", NULL); - else - node = xmlNewNode(NULL, "ETableColumn"); - - e_xml_set_integer_prop_by_name(node, "model_col", specification->model_col); - e_xml_set_string_prop_by_name(node, "_title", specification->title); - e_xml_set_string_prop_by_name(node, "pixbuf", specification->pixbuf); - - e_xml_set_double_prop_by_name(node, "expansion", specification->expansion); - e_xml_set_integer_prop_by_name(node, "minimum_width", specification->minimum_width); - e_xml_set_bool_prop_by_name(node, "resizable", specification->resizable); - - e_xml_set_string_prop_by_name(node, "cell", specification->cell); - e_xml_set_string_prop_by_name(node, "compare", specification->compare); - - return node; -} - diff --git a/widgets/table/e-table-column-specification.h b/widgets/table/e-table-column-specification.h deleted file mode 100644 index ff334ec1b1..0000000000 --- a/widgets/table/e-table-column-specification.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_COLUMN_SPECIFICATION_H_ -#define _E_TABLE_COLUMN_SPECIFICATION_H_ - -#include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define E_TABLE_COLUMN_SPECIFICATION_TYPE (e_table_column_specification_get_type ()) -#define E_TABLE_COLUMN_SPECIFICATION(o) (GTK_CHECK_CAST ((o), E_TABLE_COLUMN_SPECIFICATION_TYPE, ETableColumnSpecification)) -#define E_TABLE_COLUMN_SPECIFICATION_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_COLUMN_SPECIFICATION_TYPE, ETableColumnSpecificationClass)) -#define E_IS_TABLE_COLUMN_SPECIFICATION(o) (GTK_CHECK_TYPE ((o), E_TABLE_COLUMN_SPECIFICATION_TYPE)) -#define E_IS_TABLE_COLUMN_SPECIFICATION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_COLUMN_SPECIFICATION_TYPE)) - -typedef struct { - GtkObject base; - int model_col; - char *title; - char *pixbuf; - - double expansion; - int minimum_width; - guint resizable : 1; - - char *cell; - char *compare; -} ETableColumnSpecification; - -typedef struct { - GtkObjectClass parent_class; -} ETableColumnSpecificationClass; - -GtkType e_table_column_specification_get_type (void); - -ETableColumnSpecification *e_table_column_specification_new (void); - -void e_table_column_specification_load_from_node (ETableColumnSpecification *state, - const xmlNode *node); -xmlNode *e_table_column_specification_save_to_node (ETableColumnSpecification *state, - xmlNode *parent); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TABLE_COLUMN_SPECIFICATION_H_ */ diff --git a/widgets/table/e-table-column.c b/widgets/table/e-table-column.c deleted file mode 100644 index a3d6201ffd..0000000000 --- a/widgets/table/e-table-column.c +++ /dev/null @@ -1,293 +0,0 @@ -/* - * e-table-column.c: TableColumn implementation - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Ximian, Inc - */ -#include <config.h> -#include "e-table-column.h" - -enum { - STRUCTURE_CHANGE, - DIMENSION_CHANGE, - LAST_SIGNAL -}; - -static guint etc_signals [LAST_SIGNAL] = { 0, }; - -static GtkObjectClass *e_table_column_parent_class; - -static void -e_table_column_destroy (GtkObject *object) -{ - ETableColumn *etc = E_TABLE_COLUMN (object); - const int cols = etc->col_count; - - /* - * Destroy listeners - */ - for (l = etc->listeners; l; l = l->next) - g_free (l->data); - g_slist_free (etc->listeners); - etc->listeners = NULL; - - /* - * Destroy columns - */ - for (i = 0; i < cols; i++) - e_table_column_remove (etc, i); - - if (e_table_column_parent_class->destroy) - e_table_column_parent_class->destroy (object); -} - -static void -e_table_column_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = e_table_column_destroy; - - e_table_column_parent_class = (gtk_type_class (gtk_object_get_type ())); - - etc_signals [STRUCTURE_CHANGE] = - gtk_signal_new ("structure_change", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableColumn, structure_change), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - etc_signals [DIMENSION_CHANGE] = - gtk_signal_new ("dimension_change", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableColumn, dimension_change), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, etc_signals, LAST_SIGNAL); -} - -GtkType -e_table_column_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETableColumn", - sizeof (ETableColumn), - sizeof (ETableColumnClass), - (GtkClassInitFunc) e_table_column_class_init, - (GtkObjectInitFunc) NULL, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (gtk_object_get_type (), &info); - } - - return type; -} - -static void -etc_do_insert (ETableColumn *etc, int pos, ETableCol *val) -{ - memcpy (&etc->columns [pos+1], &etc->columns [pos], - sizeof (ETableCol *) * (etc->col_count - pos)); - etc->columns [pos] = val; -} - -void -e_table_column_add_column (ETableColumn *etc, ETableCol *tc, int pos) -{ - ETableCol **new_ptr; - - g_return_if_fail (etc != NULL); - g_return_if_fail (E_IS_TABLE_COLUMN (etc)); - g_return_if_fail (tc != NULL); - g_return_if_fail (pos >= 0 && pos < etc->col_count); - - if (pos == -1) - pos = etc->col_count; - etc->columns = g_realloc (etc->columns, sizeof (ETableCol *) * (etc->col_count + 1)); - etc_do_insert (etc, pos, tc); - etc->col_count++; - - gtk_signal_emit (GTK_OBJECT (etc), etc_signals [STRUCTURE_CHANGE]); -} - -ETableCol * -e_table_column_get_column (ETableColumn *etc, int column) -{ - g_return_val_if_fail (etc != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), NULL); - - if (column < 0) - return NULL; - - if (column >= etc->col_count) - return NULL; - - return etc->columns [column]; -} - -int -e_table_column_count (ETableColumn *etc) -{ - g_return_val_if_fail (etc != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0); - - return etc->col_count; -} - -int -e_table_column_index (ETableColumn *etc, const char *identifier) -{ - int i; - - g_return_val_if_fail (etc != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0); - g_return_val_if_fail (identifier != NULL, 0); - - for (i = 0; i < etc->col_count; i++){ - ETableCol *tc = etc->columns [i]; - - if (strcmp (i->id, identifier) == 0) - return i; - } - - return -1; -} - -int -e_table_column_get_index_at (ETableColumn *etc, int x_offset) -{ - int i, total; - - g_return_val_if_fail (etc != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0); - g_return_val_if_fail (identifier != NULL, 0); - - total = 0; - for (i = 0; i < etc->col_count; i++){ - total += etc->columns [i]->width; - - if (x_offset < total) - return i; - } - - return -1; -} - -ETableCol ** -e_table_column_get_columns (ETableColumn *etc) -{ - ETableCol **ret; - int i; - - g_return_val_if_fail (etc != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0); - - ret = g_new (ETableCol *, etc->col_count + 1); - memcpy (ret, etc->columns, sizeof (ETableCol *) * etc->col_count); - ret [etc->col_count] = NULL; - - return ret; -} - -gboolean -e_table_column_selection_ok (ETableColumn *etc) -{ - g_return_val_if_fail (etc != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), FALSE); - - return etc->selectable; -} - -int -ve_table_column_get_selected (ETableColumn *etc) -{ - int i; - int selected = 0; - - g_return_val_if_fail (etc != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0); - - for (i = 0; i < etc->col_count; i++){ - if (etc->columns [i]->selected) - selected++; - } - - return selected; -} - -int -e_table_column_total_width (ETableColumn *etc) -{ - int total; - - g_return_val_if_fail (etc != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0); - - total = 0; - for (i = 0; i < etc->col_count; i++) - total += etc->columns [i].width; - - return total; -} - -static void -etc_do_remove (ETableColumn *etc, int idx) -{ - memcpy (&etc->columns [idx], &etc->columns [idx+1], - sizeof (ETableCol *) * etc->col_count - idx); - etc->col_count--; -} - -void -e_table_column_move (ETableColumn *etc, int source_index, int target_index) -{ - g_return_if_fail (etc != NULL); - g_return_if_fail (E_IS_TABLE_COLUMN (etc)); - g_return_if_fail (source_index >= 0); - g_return_if_fail (target_index >= 0); - g_return_if_fail (source_index < etc->col_count); - g_return_if_fail (target_index < etc->col_count); - - old = etc->columns [source_index]; - etc_do_remove (etc, source_index); - etc_do_insert (etc, target_index, old); - gtk_signal_emit (GTK_OBJECT (etc), etc_signals [STRUCTURE_CHANGE]); -} - -void -e_table_column_remove (ETableColumn *etc, int idx) -{ - g_return_if_fail (etc != NULL); - g_return_if_fail (E_IS_TABLE_COLUMN (etc)); - g_return_if_fail (idx >= 0); - g_return_if_fail (idx < etc->col_count); - - etc_do_remove (etc, idx); - gtk_signal_emit (GTK_OBJECT (etc), etc_signals [STRUCTURE_CHANGE]); -} - -void -e_table_column_set_selection (ETableColumn *etc, gboolean allow_selection); -{ -} - -void -e_table_column_set_size (ETableColumn *etc, int idx, int size) -{ - g_return_if_fail (etc != NULL); - g_return_if_fail (E_IS_TABLE_COLUMN (etc)); - g_return_if_fail (idx >= 0); - g_return_if_fail (idx < etc->col_count); - g_return_if_fail (size > 0); - - etc->columns [idx]->width = size; - gtk_signal_emit (GTK_OBJECT (etc), etc_signals [SIZE_CHANGE], idx); -} diff --git a/widgets/table/e-table-config-field.c b/widgets/table/e-table-config-field.c deleted file mode 100644 index d7f016f9c2..0000000000 --- a/widgets/table/e-table-config-field.c +++ /dev/null @@ -1,279 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-config-field.c: One field of either the sort or group dialog. - * - * Author: - * Chris Lahey <clahey@ximian.com> - * - * (C) 2000 Ximian, Inc. - */ -#include <config.h> -#include <stdlib.h> -#include <gnome.h> -#include "gal/util/e-util.h" -#include "e-table-config-field.h" - -#define PARENT_TYPE (gtk_vbox_get_type()) - -static GtkVBoxClass *etcf_parent_class; - -static void -etcf_destroy (GtkObject *object) -{ - ETableConfigField *etcf = E_TABLE_CONFIG_FIELD (object); - - gtk_object_unref(GTK_OBJECT(etcf->spec)); - gtk_object_unref(GTK_OBJECT(etcf->sort_info)); - - GTK_OBJECT_CLASS (etcf_parent_class)->destroy (object); -} - -static void -etcf_class_init (GtkObjectClass *klass) -{ - etcf_parent_class = gtk_type_class (PARENT_TYPE); - - klass->destroy = etcf_destroy; -} - -static void -etcf_init (ETableConfigField *etcf) -{ - etcf->spec = NULL; - etcf->sort_info = NULL; - - etcf->combo = NULL; - etcf->radio_ascending = NULL; - etcf->radio_descending = NULL; - etcf->child_fields = NULL; -} - -E_MAKE_TYPE(e_table_config_field, "ETableConfigField", ETableConfigField, etcf_class_init, etcf_init, PARENT_TYPE); - -ETableConfigField * -e_table_config_field_new (ETableSpecification *spec, - ETableSortInfo *sort_info, - gboolean grouping) -{ - ETableConfigField *etcf = gtk_type_new (E_TABLE_CONFIG_FIELD_TYPE); - - e_table_config_field_construct (etcf, spec, sort_info, grouping); - - return (ETableConfigField *) etcf; -} - -inline static int -etcf_get_count (ETableConfigField *etcf) -{ - if (etcf->grouping) - return e_table_sort_info_grouping_get_count(etcf->sort_info); - else - return e_table_sort_info_sorting_get_count(etcf->sort_info); -} - -inline static ETableSortColumn -etcf_get_nth (ETableConfigField *etcf) -{ - if (etcf->grouping) - return e_table_sort_info_grouping_get_nth(etcf->sort_info, etcf->n); - else - return e_table_sort_info_sorting_get_nth(etcf->sort_info, etcf->n); -} - -inline static void -etcf_set_nth (ETableConfigField *etcf, ETableSortColumn column) -{ - if (etcf->grouping) - e_table_sort_info_grouping_set_nth(etcf->sort_info, etcf->n, column); - else - e_table_sort_info_sorting_set_nth(etcf->sort_info, etcf->n, column); -} - -inline static void -etcf_truncate (ETableConfigField *etcf) -{ - if (etcf->grouping) - e_table_sort_info_grouping_truncate(etcf->sort_info, etcf->n); - else - e_table_sort_info_sorting_truncate(etcf->sort_info, etcf->n); -} - -static void -etcf_set_sensitivity(ETableConfigField *etcf) -{ - int count = etcf_get_count(etcf); - - if (etcf->n >= count) { - gtk_widget_set_sensitive(etcf->radio_ascending, FALSE); - gtk_widget_set_sensitive(etcf->radio_descending, FALSE); - if (etcf->child_fields) - gtk_widget_set_sensitive(etcf->child_fields, FALSE); - } else { - gtk_widget_set_sensitive(etcf->radio_ascending, TRUE); - gtk_widget_set_sensitive(etcf->radio_descending, TRUE); - if (etcf->child_fields) - gtk_widget_set_sensitive(etcf->child_fields, TRUE); - } -} - -static void -toggled(GtkWidget *widget, ETableConfigField *etcf) -{ - int count; - - count = etcf_get_count(etcf); - if (count > etcf->n) { - ETableSortColumn sort_column; - - sort_column = etcf_get_nth(etcf); - sort_column.ascending = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(etcf->radio_ascending)); - etcf_set_nth(etcf, sort_column); - } -} - -static void -changed(GtkWidget *widget, ETableConfigField *etcf) -{ - ETableColumnSpecification **column; - gchar *text; - - text = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(etcf->combo)->entry)); - for (column = etcf->spec->columns; *column; column++) { - if (!strcmp((*column)->title_, text)) { - ETableSortColumn sort_column; - - sort_column.ascending = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(etcf->radio_ascending)); - sort_column.column = (*column)->model_col; - - etcf_set_nth(etcf, sort_column); - etcf_set_sensitivity(etcf); - return; - } - } - etcf_truncate(etcf); - etcf_set_sensitivity(etcf); -} - -static void -etcf_setup(ETableConfigField *etcf) -{ - int count; - GList *list = NULL; - ETableColumnSpecification **column; - ETableColumnSpecification *chosen_column = NULL; - int model_col = -1; - - etcf_set_sensitivity(etcf); - - count = etcf_get_count(etcf); - - if (count > etcf->n) { - ETableSortColumn sort_column; - - sort_column = etcf_get_nth(etcf); - model_col = sort_column.column; - if (sort_column.ascending) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(etcf->radio_ascending), TRUE); - else - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(etcf->radio_descending), TRUE); - } - - for (column = etcf->spec->columns; *column; column++) { - list = g_list_prepend(list, (*column)->title_); - if (count > etcf->n && chosen_column == NULL && (*column)->model_col == model_col) { - chosen_column = *column; - } - } - list = g_list_reverse(list); - list = g_list_prepend(list, "None"); - - gtk_combo_set_popdown_strings(GTK_COMBO(etcf->combo), list); - g_list_free(list); - - if (chosen_column) { - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(etcf->combo)->entry), chosen_column->title_); - } else { - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(etcf->combo)->entry), "None"); - } - - gtk_signal_connect(GTK_OBJECT(GTK_COMBO(etcf->combo)->entry), "changed", - GTK_SIGNAL_FUNC(changed), etcf); - gtk_signal_connect(GTK_OBJECT(etcf->radio_ascending), "toggled", - GTK_SIGNAL_FUNC(toggled), etcf); - gtk_signal_connect(GTK_OBJECT(etcf->radio_descending), "toggled", - GTK_SIGNAL_FUNC(toggled), etcf); -} - -static ETableConfigField * -e_table_config_field_construct_nth (ETableConfigField *etcf, - ETableSpecification *spec, - ETableSortInfo *sort_info, - gboolean grouping, - int n) -{ - GtkWidget *frame; - GtkWidget *internal_hbox; - GtkWidget *internal_vbox1; - GtkWidget *internal_vbox2; - - etcf->spec = spec; - gtk_object_ref(GTK_OBJECT(spec)); - - etcf->sort_info = sort_info; - gtk_object_ref(GTK_OBJECT(sort_info)); - - etcf->grouping = grouping; - etcf->n = n; - - gtk_box_set_spacing(GTK_BOX(etcf), 6); - - frame = gtk_frame_new(n > 0 ? _("Then By") : (grouping ? _("Group By") : _("Sort By"))); - gtk_box_pack_start(GTK_BOX(etcf), frame, FALSE, FALSE, 0); - - internal_hbox = gtk_hbox_new(FALSE, 6); - gtk_container_add(GTK_CONTAINER(frame), internal_hbox); - gtk_container_set_border_width(GTK_CONTAINER(internal_hbox), 6); - - internal_vbox1 = gtk_vbox_new(FALSE, 6); - gtk_box_pack_start(GTK_BOX(internal_hbox), internal_vbox1, FALSE, FALSE, 0); - - etcf->combo = gtk_combo_new(); - gtk_box_pack_start(GTK_BOX(internal_vbox1), etcf->combo, FALSE, FALSE, 0); - - internal_vbox2 = gtk_vbox_new(FALSE, 6); - gtk_box_pack_start(GTK_BOX(internal_hbox), internal_vbox2, FALSE, FALSE, 0); - - etcf->radio_ascending = gtk_radio_button_new_with_label (NULL, _("Ascending")); - gtk_box_pack_start(GTK_BOX(internal_vbox2), etcf->radio_ascending, FALSE, FALSE, 0); - - etcf->radio_descending = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON(etcf->radio_ascending), _("Descending")); - gtk_box_pack_start(GTK_BOX(internal_vbox2), etcf->radio_descending, FALSE, FALSE, 0); - - if (n < 3) { - etcf->child_fields = GTK_WIDGET(gtk_type_new (E_TABLE_CONFIG_FIELD_TYPE)); - e_table_config_field_construct_nth(E_TABLE_CONFIG_FIELD(etcf->child_fields), spec, sort_info, grouping, n + 1); - gtk_box_pack_start(GTK_BOX(etcf), etcf->child_fields, FALSE, FALSE, 0); - gtk_widget_show(etcf->child_fields); - } else - etcf->child_fields = NULL; - - etcf_setup(etcf); - - gtk_widget_show(etcf->radio_descending); - gtk_widget_show(etcf->radio_ascending); - gtk_widget_show(internal_vbox2); - gtk_widget_show(etcf->combo); - gtk_widget_show(internal_vbox1); - gtk_widget_show(internal_hbox); - gtk_widget_show(frame); - return etcf; -} - -ETableConfigField * -e_table_config_field_construct (ETableConfigField *etcf, - ETableSpecification *spec, - ETableSortInfo *sort_info, - gboolean grouping) -{ - return e_table_config_field_construct_nth(etcf, spec, sort_info, grouping, 0); -} diff --git a/widgets/table/e-table-config-field.h b/widgets/table/e-table-config-field.h deleted file mode 100644 index 9df83238ee..0000000000 --- a/widgets/table/e-table-config-field.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_CONFIG_FIELD_H_ -#define _E_TABLE_CONFIG_FIELD_H_ - -#include <gtk/gtkvbox.h> -#include <gal/e-table/e-table-sort-info.h> -#include <gal/e-table/e-table-specification.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_CONFIG_FIELD_TYPE (e_table_config_field_get_type ()) -#define E_TABLE_CONFIG_FIELD(o) (GTK_CHECK_CAST ((o), E_TABLE_CONFIG_FIELD_TYPE, ETableConfigField)) -#define E_TABLE_CONFIG_FIELD_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_CONFIG_FIELD_TYPE, ETableConfigFieldClass)) -#define E_IS_TABLE_CONFIG_FIELD(o) (GTK_CHECK_TYPE ((o), E_TABLE_CONFIG_FIELD_TYPE)) -#define E_IS_TABLE_CONFIG_FIELD_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_CONFIG_FIELD_TYPE)) - -typedef struct { - GtkVBox base; - - ETableSpecification *spec; - ETableSortInfo *sort_info; - guint grouping : 1; - int n; - - GtkWidget *combo; - GtkWidget *radio_ascending; - GtkWidget *radio_descending; - - GtkWidget *child_fields; -} ETableConfigField; - -typedef struct { - GtkVBoxClass parent_class; -} ETableConfigFieldClass; - -GtkType e_table_config_field_get_type (void); -ETableConfigField *e_table_config_field_new (ETableSpecification *spec, - ETableSortInfo *sort_info, - gboolean grouping); -ETableConfigField *e_table_config_field_construct (ETableConfigField *field, - ETableSpecification *spec, - ETableSortInfo *sort_info, - gboolean grouping); - -END_GNOME_DECLS - -#endif /* _E_TABLE_CONFIG_FIELD_H_ */ diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c deleted file mode 100644 index f25e77245d..0000000000 --- a/widgets/table/e-table-config.c +++ /dev/null @@ -1,768 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-config.c: The ETable config dialog. - * - * Authors: - * Chris Lahey (clahey@ximian.com) - * Miguel de Icaza (miguel@ximian.com) - * - * FIXME: - * Sort Dialog: when text is selected, the toggle button switches state. - * Make Clear all work. - * - * (C) 2000, 2001 Ximian, Inc. - */ - -#include <config.h> -#include <stdlib.h> -#include "gal/util/e-i18n.h" -#include <libgnomeui/gnome-dialog.h> -#include <glade/glade.h> -#include "e-table-config.h" -#include "gal/util/e-util.h" - - -#define PARENT_TYPE (gtk_object_get_type()) - -static GtkObjectClass *config_parent_class; - -enum { - CHANGED, - LAST_SIGNAL -}; - -static guint e_table_config_signals [LAST_SIGNAL] = { 0, }; - -static void -config_destroy (GtkObject *object) -{ - ETableConfig *config = E_TABLE_CONFIG (object); - - gtk_object_destroy (GTK_OBJECT (config->state)); - gtk_object_unref (GTK_OBJECT (config->source_state)); - gtk_object_unref (GTK_OBJECT (config->source_spec)); - - g_slist_free (config->column_names); - config->column_names = NULL; - - GTK_OBJECT_CLASS (config_parent_class)->destroy (object); -} - -static void -e_table_config_changed (ETableConfig *config, ETableState *state) -{ - g_return_if_fail (config != NULL); - g_return_if_fail (E_IS_TABLE_CONFIG (config)); - - gtk_signal_emit(GTK_OBJECT(config), - e_table_config_signals [CHANGED], - state); -} - -static void -config_class_init (GtkObjectClass *object_class) -{ - ETableConfigClass *klass = E_TABLE_CONFIG_CLASS(object_class); - - config_parent_class = gtk_type_class (PARENT_TYPE); - - klass->changed = NULL; - - object_class->destroy = config_destroy; - - e_table_config_signals [CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableConfigClass, changed), - gtk_marshal_NONE__OBJECT, - GTK_TYPE_NONE, 1, E_TABLE_STATE_TYPE); - - gtk_object_class_add_signals (object_class, e_table_config_signals, LAST_SIGNAL); -} - -static ETableColumnSpecification * -find_column_in_spec (ETableSpecification *spec, int model_col) -{ - ETableColumnSpecification **column; - - for (column = spec->columns; *column; column++){ - if ((*column)->model_col != model_col) - continue; - - return *column; - } - - return NULL; -} - -static int -find_model_column_by_name (ETableSpecification *spec, const char *s) -{ - ETableColumnSpecification **column; - - for (column = spec->columns; *column; column++){ - - if (strcasecmp ((*column)->title, s) == 0) - return (*column)->model_col; - } - return -1; -} - -static void -update_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort) -{ - ETableConfigSortWidgets *widgets; - int count, i; - - if (is_sort){ - count = e_table_sort_info_sorting_get_count ( - config->temp_state->sort_info); - widgets = &config->sort [0]; - } else { - count = e_table_sort_info_grouping_get_count ( - config->temp_state->sort_info); - widgets = &config->group [0]; - } - - for (i = 0; i < 4; i++){ - gboolean sensitive = (i <= count); - - gtk_widget_set_sensitive (widgets [i].frames, sensitive); - - /* - * Sorting is set, auto select the text - */ - gtk_signal_handler_block ( - GTK_OBJECT (widgets [i].radio_ascending), - widgets [i].toggled_id); - - if (i < count){ - GtkToggleButton *a, *d; - ETableSortColumn col = - is_sort - ? e_table_sort_info_sorting_get_nth ( - config->temp_state->sort_info, - i) - : e_table_sort_info_grouping_get_nth ( - config->temp_state->sort_info, - i); - - ETableColumnSpecification *column = - find_column_in_spec (config->source_spec, col.column); - - if (!column){ - /* - * This is a bug in the programmer - * stuff, but by the time we arrive - * here, the user has been given a - * warning - */ - continue; - } - - /* - * Change the text - */ - gtk_signal_handler_block ( - GTK_OBJECT (widgets [i].combo->entry), - widgets [i].changed_id); - gtk_combo_text_set_text ( - widgets [i].combo, gettext ( - column->title)); - gtk_signal_handler_unblock ( - GTK_OBJECT (widgets [i].combo->entry), - widgets [i].changed_id); - - /* - * Update radio buttons - */ - a = GTK_TOGGLE_BUTTON ( - widgets [i].radio_ascending); - d = GTK_TOGGLE_BUTTON ( - widgets [i].radio_descending); - - gtk_toggle_button_set_active (col.ascending ? a:d, 1); - } else { - GtkToggleButton *t; - - t = GTK_TOGGLE_BUTTON ( - widgets [i].radio_ascending); - - gtk_toggle_button_set_active (t, 1); - } - gtk_signal_handler_unblock ( - GTK_OBJECT (widgets [i].radio_ascending), - widgets [i].toggled_id); - } -} - -static void -update_group_config_dialog (ETableConfig *config) -{ - g_warning ("IMPLEMENT ME\n"); -} - -static void -config_sort_info_update (ETableConfig *config) -{ - ETableSortInfo *info = config->state->sort_info; - GString *res; - int count, i; - - count = e_table_sort_info_sorting_get_count (info); - res = g_string_new (""); - - for (i = 0; i < count; i++) { - ETableSortColumn col = e_table_sort_info_sorting_get_nth (info, i); - ETableColumnSpecification *column; - - column = find_column_in_spec (config->source_spec, col.column); - if (!column){ - g_warning ("Could not find column model in specification"); - continue; - } - - g_string_append (res, gettext ((column)->title)); - g_string_append_c (res, ' '); - g_string_append ( - res, - col.ascending ? - _("(Ascending)") : _("(Descending)")); - - if ((i + 1) != count) - g_string_append (res, ", "); - } - - if (res->str [0] == 0) - g_string_append (res, _("Not sorted")); - - gtk_label_set_text (GTK_LABEL(config->sort_label), res->str); - - g_string_free (res, TRUE); -} - -static void -config_group_info_update (ETableConfig *config) -{ - ETableSortInfo *info = config->state->sort_info; - GString *res; - int count, i; - - count = e_table_sort_info_grouping_get_count (info); - printf ("Count of the grouping action: %d\n", count); - res = g_string_new (""); - - for (i = 0; i < count; i++) { - ETableSortColumn col = e_table_sort_info_grouping_get_nth (info, i); - ETableColumnSpecification *column; - - column = find_column_in_spec (config->source_spec, col.column); - if (!column){ - g_warning ("Could not find model column in specification"); - continue; - } - - g_string_append (res, gettext ((column)->title)); - g_string_append_c (res, ' '); - g_string_append ( - res, - col.ascending ? - _("(Ascending)") : _("(Descending)")); - - if ((i+1) != count) - g_string_append (res, ", "); - } - if (res->str [0] == 0) - g_string_append (res, _("No grouping")); - - gtk_label_set_text (GTK_LABEL (config->group_label), res->str); - g_string_free (res, TRUE); -} - -static void -config_fields_info_update (ETableConfig *config) -{ - ETableColumnSpecification **column; - GString *res = g_string_new (""); - int i; - - for (i = 0; i < config->state->col_count; i++){ - for (column = config->source_spec->columns; *column; column++){ - - if (config->state->columns [i] != (*column)->model_col) - continue; - - g_string_append (res, gettext ((*column)->title)); - if (column [1]) - g_string_append (res, ", "); - } - } - - gtk_label_set_text (GTK_LABEL (config->fields_label), res->str); - g_string_free (res, TRUE); -} - -static void -do_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort) -{ - GnomeDialog *dialog; - int button, running = 1; - - config->temp_state = e_table_state_duplicate (config->state); - - update_sort_and_group_config_dialog (config, is_sort); - - gtk_widget_grab_focus (GTK_WIDGET ( - is_sort - ? config->sort [0].combo - : config->group [0].combo)); - - - if (is_sort) - dialog = GNOME_DIALOG (config->dialog_sort); - else - dialog = GNOME_DIALOG (config->dialog_group_by); - - do { - button = gnome_dialog_run (dialog); - switch (button){ - case 0: - if (is_sort){ - e_table_sort_info_sorting_truncate ( - config->state->sort_info, 0); - } else { - e_table_sort_info_grouping_truncate ( - config->state->sort_info, 0); - } - update_sort_and_group_config_dialog (config, is_sort); - continue; - - /* OK */ - case 1: - gtk_object_unref (GTK_OBJECT (config->state)); - config->state = config->temp_state; - running = 0; - gnome_property_box_changed ( - GNOME_PROPERTY_BOX (config->dialog_toplevel)); - break; - - /* CANCEL */ - case 2: - gtk_object_unref (GTK_OBJECT (config->temp_state)); - config->temp_state = 0; - running = 0; - break; - } - - } while (running); - gnome_dialog_close (GNOME_DIALOG (dialog)); - - if (is_sort) - config_sort_info_update (config); - else - config_group_info_update (config); -} - -static void -config_button_sort (GtkWidget *widget, ETableConfig *config) -{ - do_sort_and_group_config_dialog (config, TRUE); -} - -static void -config_button_group (GtkWidget *widget, ETableConfig *config) -{ - do_sort_and_group_config_dialog (config, FALSE); -} - - -static void -dialog_destroyed (GtkObject *dialog, ETableConfig *config) -{ - gtk_object_destroy (GTK_OBJECT (config)); -} - -static void -dialog_apply (GnomePropertyBox *pbox, gint page_num, ETableConfig *config) -{ - if (page_num != -1) - return; - - e_table_config_changed (config, config->state); -} - -/* - * Invoked by the Glade auto-connect code - */ -GtkWidget *e_table_proxy_gtk_combo_text_new (void); -GtkWidget * -e_table_proxy_gtk_combo_text_new (void) -{ - return gtk_combo_text_new (TRUE); -} - -#if 0 -static GtkWidget * -configure_dialog (GladeXML *gui, const char *widget_name, ETableConfig *config) -{ - GtkWidget *w; - - w = glade_xml_get_widget (gui, widget_name); - - return w; -} -#endif - -static void -connect_button (ETableConfig *config, GladeXML *gui, const char *widget_name, void *cback) -{ - GtkWidget *button = glade_xml_get_widget (gui, widget_name); - - gtk_signal_connect( - GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (cback), config); -} - -static void -sort_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *sort) -{ - ETableConfig *config = sort->e_table_config; - ETableSortInfo *sort_info = config->temp_state->sort_info; - ETableConfigSortWidgets *base = &config->sort[0]; - int idx = sort - base; - - char *s = gtk_entry_get_text (entry); - - if (g_hash_table_lookup (sort->combo->elements, s)){ - ETableSortColumn c; - int col; - - col = find_model_column_by_name (config->source_spec, s); - if (col == -1){ - g_warning ("This should not happen"); - return; - } - - c.ascending = GTK_TOGGLE_BUTTON ( - config->sort [idx].radio_ascending)->active; - c.column = col; - e_table_sort_info_sorting_set_nth (sort_info, idx, c); - - update_sort_and_group_config_dialog (config, TRUE); - } else { - e_table_sort_info_sorting_truncate (sort_info, idx); - update_sort_and_group_config_dialog (config, TRUE); - } -} - -static void -sort_ascending_toggled (GtkToggleButton *t, ETableConfigSortWidgets *sort) -{ - ETableConfig *config = sort->e_table_config; - ETableSortInfo *si = config->temp_state->sort_info; - ETableConfigSortWidgets *base = &config->sort[0]; - int idx = sort - base; - ETableSortColumn c; - - c = e_table_sort_info_sorting_get_nth (si, idx); - c.ascending = t->active; - e_table_sort_info_sorting_set_nth (si, idx, c); -} - -static void -configure_sort_dialog (ETableConfig *config, GladeXML *gui) -{ - GSList *l; - int i; - - for (i = 0; i < 4; i++){ - char buffer [80]; - - snprintf (buffer, sizeof (buffer), "sort-combo-%d", i + 1); - config->sort [i].combo = GTK_COMBO_TEXT ( - glade_xml_get_widget (gui, buffer)); - - gtk_combo_text_add_item (config->sort [i].combo, "", ""); - - snprintf (buffer, sizeof (buffer), "frame-sort-%d", i + 1); - config->sort [i].frames = - glade_xml_get_widget (gui, buffer); - - snprintf ( - buffer, sizeof (buffer), - "radiobutton-ascending-sort-%d", i+1); - config->sort [i].radio_ascending = glade_xml_get_widget ( - gui, buffer); - - snprintf ( - buffer, sizeof (buffer), - "radiobutton-descending-sort-%d", i+1); - config->sort [i].radio_descending = glade_xml_get_widget ( - gui, buffer); - - config->sort [i].e_table_config = config; - } - - for (l = config->column_names; l; l = l->next){ - char *label = l->data; - - for (i = 0; i < 4; i++){ - gtk_combo_text_add_item ( - config->sort [i].combo, - gettext (label), label); - } - } - - /* - * After we have runtime modified things, signal connect - */ - for (i = 0; i < 4; i++){ - config->sort [i].changed_id = gtk_signal_connect ( - GTK_OBJECT (config->sort [i].combo->entry), - "changed", sort_entry_changed, &config->sort [i]); - - config->sort [i].toggled_id = gtk_signal_connect ( - GTK_OBJECT (config->sort [i].radio_ascending), - "toggled", sort_ascending_toggled, &config->sort [i]); - } -} - -static void -group_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *group) -{ - ETableConfig *config = group->e_table_config; - ETableSortInfo *sort_info = config->temp_state->sort_info; - ETableConfigSortWidgets *base = &config->group[0]; - int idx = group - base; - - char *s = gtk_entry_get_text (entry); - - if (g_hash_table_lookup (group->combo->elements, s)){ - ETableSortColumn c; - int col; - - col = find_model_column_by_name (config->source_spec, s); - if (col == -1){ - g_warning ("This should not happen"); - return; - } - - c.ascending = GTK_TOGGLE_BUTTON ( - config->group [idx].radio_ascending)->active; - c.column = col; - e_table_sort_info_grouping_set_nth (sort_info, idx, c); - - update_group_config_dialog (config); - } else { - e_table_sort_info_grouping_truncate (sort_info, idx); - update_group_config_dialog (config); - } -} - -static void -group_ascending_toggled (GtkToggleButton *t, ETableConfigSortWidgets *group) -{ - ETableConfig *config = group->e_table_config; - ETableSortInfo *si = config->temp_state->sort_info; - ETableConfigSortWidgets *base = &config->group[0]; - int idx = group - base; - ETableSortColumn c; - - c = e_table_sort_info_grouping_get_nth (si, idx); - c.ascending = t->active; - e_table_sort_info_grouping_set_nth (si, idx, c); -} - -static void -configure_group_dialog (ETableConfig *config, GladeXML *gui) -{ - GSList *l; - int i; - - for (i = 0; i < 4; i++){ - char buffer [80]; - - snprintf (buffer, sizeof (buffer), "group-combo-%d", i + 1); - config->group [i].combo = GTK_COMBO_TEXT ( - glade_xml_get_widget (gui, buffer)); - - gtk_combo_text_add_item (config->group [i].combo, "", ""); - - snprintf (buffer, sizeof (buffer), "frame-group-%d", i + 1); - config->group [i].frames = - glade_xml_get_widget (gui, buffer); - - snprintf ( - buffer, sizeof (buffer), - "radiobutton-ascending-group-%d", i+1); - config->group [i].radio_ascending = glade_xml_get_widget ( - gui, buffer); - - snprintf ( - buffer, sizeof (buffer), - "radiobutton-descending-group-%d", i+1); - config->group [i].radio_descending = glade_xml_get_widget ( - gui, buffer); - - snprintf ( - buffer, sizeof (buffer), - "checkbutton-group-%d", i+1); - config->group [i].view_check = glade_xml_get_widget ( - gui, buffer); - - config->group [i].e_table_config = config; - } - - - for (l = config->column_names; l; l = l->next){ - char *label = l->data; - - for (i = 0; i < 4; i++){ - gtk_combo_text_add_item ( - config->group [i].combo, - gettext (label), label); - } - } - - /* - * After we have runtime modified things, signal connect - */ - for (i = 0; i < 4; i++){ - config->group [i].changed_id = gtk_signal_connect ( - GTK_OBJECT (config->group [i].combo->entry), - "changed", group_entry_changed, &config->group [i]); - - config->group [i].toggled_id = gtk_signal_connect ( - GTK_OBJECT (config->group [i].radio_ascending), - "toggled", group_ascending_toggled, &config->group [i]); - } -} - -static void -setup_gui (ETableConfig *config) -{ - GladeXML *gui = glade_xml_new ( - ETABLE_GLADEDIR "/e-table-config.glade", NULL); - - config->dialog_toplevel = glade_xml_get_widget ( - gui, "e-table-config"); - - gtk_notebook_set_show_tabs ( - GTK_NOTEBOOK (GNOME_PROPERTY_BOX ( - config->dialog_toplevel)->notebook), - FALSE); - - config->dialog_show_fields = glade_xml_get_widget ( - gui, "dialog-show-fields"); - config->dialog_group_by = glade_xml_get_widget ( - gui, "dialog-group-by"); - config->dialog_sort = glade_xml_get_widget ( - gui, "dialog-sort"); - - config->sort_label = glade_xml_get_widget ( - gui, "label-sort"); - config->group_label = glade_xml_get_widget ( - gui, "label-group"); - config->fields_label = glade_xml_get_widget ( - gui, "label-fields"); - - connect_button (config, gui, "button-sort", config_button_sort); - connect_button (config, gui, "button-group", config_button_group); - - configure_sort_dialog (config, gui); - configure_group_dialog (config, gui); - - gtk_signal_connect ( - GTK_OBJECT (config->dialog_toplevel), "destroy", - GTK_SIGNAL_FUNC (dialog_destroyed), config); - - gtk_signal_connect ( - GTK_OBJECT (config->dialog_toplevel), "apply", - GTK_SIGNAL_FUNC (dialog_apply), config); - - gtk_object_unref (GTK_OBJECT (gui)); -} - -static void -config_init (ETableConfig *config) -{ - glade_gnome_init (); -} - -ETableConfig * -e_table_config_construct (ETableConfig *config, - const char *header, - ETableSpecification *spec, - ETableState *state) -{ - ETableColumnSpecification **column; - - g_return_val_if_fail (config != NULL, NULL); - g_return_val_if_fail (header != NULL, NULL); - g_return_val_if_fail (spec != NULL, NULL); - g_return_val_if_fail (state != NULL, NULL); - - config->source_spec = spec; - config->source_state = state; - - gtk_object_ref (GTK_OBJECT (config->source_spec)); - gtk_object_ref (GTK_OBJECT (config->source_state)); - - config->state = e_table_state_duplicate (state); - - for (column = config->source_spec->columns; *column; column++){ - char *label = (*column)->title; - - config->column_names = g_slist_append ( - config->column_names, label); - } - - setup_gui (config); - - config_sort_info_update (config); - config_group_info_update (config); - config_fields_info_update (config); - - return E_TABLE_CONFIG (config); -} - -/** - * e_table_config_new: - * @header: The title of the dialog for the ETableConfig. - * @spec: The specification for the columns to allow. - * @state: The current state of the configuration. - * - * Creates a new ETable config object. - * - * Returns: The config object. - */ -ETableConfig * -e_table_config_new (const char *header, - ETableSpecification *spec, - ETableState *state) -{ - ETableConfig *config = gtk_type_new (E_TABLE_CONFIG_TYPE); - - if (e_table_config_construct (config, header, spec, state) == NULL){ - gtk_object_destroy (GTK_OBJECT (config)); - return NULL; - } - - gtk_widget_show (config->dialog_toplevel); - return E_TABLE_CONFIG (config); -} - -/** - * e_table_config_raise: - * @config: The ETableConfig object. - * - * Raises the dialog associated with this ETableConfig object. - */ -void -e_table_config_raise (ETableConfig *config) -{ - gdk_window_raise (GTK_WIDGET (config->dialog_toplevel)->window); -} - -E_MAKE_TYPE(e_table_config, "ETableConfig", ETableConfig, config_class_init, config_init, PARENT_TYPE); diff --git a/widgets/table/e-table-config.glade b/widgets/table/e-table-config.glade deleted file mode 100644 index e0035daf67..0000000000 --- a/widgets/table/e-table-config.glade +++ /dev/null @@ -1,1866 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>E-table</name> - <program_name>e-table</program_name> - <directory></directory> - <source_directory></source_directory> - <pixmaps_directory></pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <use_widget_names>False</use_widget_names> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> - <backup_source_files>True</backup_source_files> - <main_source_file>interface.c</main_source_file> - <main_header_file>interface.h</main_header_file> - <handler_source_file>callbacks.c</handler_source_file> - <handler_header_file>callbacks.h</handler_header_file> - <support_source_file>support.c</support_source_file> - <support_header_file>support.h</support_header_file> - <output_translatable_strings>True</output_translatable_strings> - <translatable_strings_file>e-table-config.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>dialog-show-fields</name> - <visible>False</visible> - <title>Show Fields</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox3</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox2</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table2</name> - <rows>1</rows> - <columns>5</columns> - <homogeneous>True</homogeneous> - <row_spacing>6</row_spacing> - <column_spacing>6</column_spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label-available</name> - <label>A_vailable Fields:</label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>table-1</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label-displayed</name> - <label>Sh_ow these fields in order:</label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>table-2</focus_target> - <child> - <left_attach>3</left_attach> - <right_attach>5</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkTable</class> - <name>table3</name> - <rows>1</rows> - <columns>5</columns> - <homogeneous>True</homogeneous> - <row_spacing>6</row_spacing> - <column_spacing>6</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox4</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <left_attach>0</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkViewport</class> - <name>viewport1</name> - <shadow_type>GTK_SHADOW_IN</shadow_type> - - <widget> - <class>GtkButton</class> - <name>table-1</name> - <can_focus>True</can_focus> - <label>Table HERE</label> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox5</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <left_attach>3</left_attach> - <right_attach>5</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow2</name> - <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkViewport</class> - <name>viewport2</name> - <shadow_type>GTK_SHADOW_IN</shadow_type> - - <widget> - <class>GtkButton</class> - <name>table-2</name> - <can_focus>True</can_focus> - <label>Table HERE</label> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox4</name> - <homogeneous>True</homogeneous> - <spacing>6</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-up</name> - <can_focus>True</can_focus> - <label>Move _Up</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-down</name> - <can_focus>True</can_focus> - <label>Move _Down</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox6</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-add</name> - <can_focus>True</can_focus> - <label>_Add -></label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-remove</name> - <can_focus>True</can_focus> - <label><- _Remove</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area3</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button20</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button22</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - </widget> -</widget> - -<widget> - <class>GnomeDialog</class> - <name>dialog-group-by</name> - <visible>False</visible> - <title>Group</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox4</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox24</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox13</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkFrame</class> - <name>frame-group-1</name> - <label>Group Items By</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox5</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - - <widget> - <class>GtkVBox</class> - <name>vbox7</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Custom</class> - <name>group-combo-1</name> - <creation_function>e_table_proxy_gtk_combo_text_new</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Fri, 19 Jan 2001 04:52:09 GMT</last_modification_time> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>checkbutton-group-1</name> - <can_focus>True</can_focus> - <label>Show field in View</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox8</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-ascending-group-1</name> - <can_focus>True</can_focus> - <label>Ascending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-1</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-descending-group-1</name> - <can_focus>True</can_focus> - <label>Descending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-1</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label8</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label9</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label10</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox14</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label11</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame-group-2</name> - <label>Then By</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox6</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - - <widget> - <class>GtkVBox</class> - <name>vbox9</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Custom</class> - <name>group-combo-2</name> - <creation_function>e_table_proxy_gtk_combo_text_new</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Fri, 19 Jan 2001 04:52:14 GMT</last_modification_time> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>checkbutton-group-2</name> - <can_focus>True</can_focus> - <label>Show field in View</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox10</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-ascending-group-2</name> - <can_focus>True</can_focus> - <label>Ascending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-2</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-descending-group-2</name> - <can_focus>True</can_focus> - <label>Descending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-2</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label19</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label18</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox15</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label13</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label12</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame-group-3</name> - <label>Then By</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox7</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - - <widget> - <class>GtkVBox</class> - <name>vbox11</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Custom</class> - <name>group-combo-3</name> - <creation_function>e_table_proxy_gtk_combo_text_new</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Fri, 19 Jan 2001 04:52:18 GMT</last_modification_time> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>checkbutton-group-3</name> - <can_focus>True</can_focus> - <label>Show field in View</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox12</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-ascending-group-3</name> - <can_focus>True</can_focus> - <label>Ascending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-3</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-descending-group-3</name> - <can_focus>True</can_focus> - <label>Descending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-3</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label17</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox16</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label14</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label16</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label15</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame-group-4</name> - <label>Then By</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox8</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - - <widget> - <class>GtkVBox</class> - <name>vbox13</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Custom</class> - <name>group-combo-4</name> - <creation_function>e_table_proxy_gtk_combo_text_new</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Fri, 19 Jan 2001 04:52:21 GMT</last_modification_time> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>checkbutton-group-4</name> - <can_focus>True</can_focus> - <label>Show field in View</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox14</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-ascending-group-4</name> - <can_focus>True</can_focus> - <label>Ascending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-4</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-descending-group-4</name> - <can_focus>True</can_focus> - <label>Descending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-4</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area4</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button39</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>Clear All</label> - </widget> - - <widget> - <class>GtkButton</class> - <name>button41</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button42</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - </widget> -</widget> - -<widget> - <class>GnomeDialog</class> - <name>dialog-sort</name> - <visible>False</visible> - <title>Sort</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>True</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>vbox15</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table5</name> - <rows>4</rows> - <columns>1</columns> - <homogeneous>False</homogeneous> - <row_spacing>6</row_spacing> - <column_spacing>6</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkFrame</class> - <name>frame-sort-4</name> - <label>Then By</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox9</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - - <widget> - <class>GtkAlignment</class> - <name>alignment1</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Custom</class> - <name>sort-combo-4</name> - <creation_function>e_table_proxy_gtk_combo_text_new</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Tue, 16 Jan 2001 08:33:52 GMT</last_modification_time> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox17</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-ascending-sort-4</name> - <can_focus>True</can_focus> - <label>Ascending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-4</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-descending-sort-4</name> - <can_focus>True</can_focus> - <label>Descending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-4</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame-sort-3</name> - <label>Then By</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox10</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - - <widget> - <class>GtkAlignment</class> - <name>alignment2</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Custom</class> - <name>sort-combo-3</name> - <creation_function>e_table_proxy_gtk_combo_text_new</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Tue, 16 Jan 2001 05:22:22 GMT</last_modification_time> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox19</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-ascending-sort-3</name> - <can_focus>True</can_focus> - <label>Ascending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-3</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-descending-sort-3</name> - <can_focus>True</can_focus> - <label>Descending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-3</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame-sort-2</name> - <label>Then By</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox11</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - - <widget> - <class>GtkAlignment</class> - <name>alignment3</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Custom</class> - <name>sort-combo-2</name> - <creation_function>e_table_proxy_gtk_combo_text_new</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Tue, 16 Jan 2001 05:22:15 GMT</last_modification_time> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox21</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-ascending-sort-2</name> - <can_focus>True</can_focus> - <label>Ascending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-2</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-descending-sort-2</name> - <can_focus>True</can_focus> - <label>Descending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-2</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame-sort-1</name> - <label>Sort Items By</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox12</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - - <widget> - <class>GtkAlignment</class> - <name>alignment4</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Custom</class> - <name>sort-combo-1</name> - <can_focus>True</can_focus> - <has_focus>True</has_focus> - <creation_function>e_table_proxy_gtk_combo_text_new</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Tue, 16 Jan 2001 05:22:00 GMT</last_modification_time> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox23</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-ascending-sort-1</name> - <can_focus>True</can_focus> - <label>Ascending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-1</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton-descending-sort-1</name> - <can_focus>True</can_focus> - <label>Descending</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>group-1</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>hbuttonbox1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button43</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>Clear All</label> - </widget> - - <widget> - <class>GtkButton</class> - <name>button44</name> - <can_default>True</can_default> - <has_default>True</has_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button45</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - </widget> -</widget> - -<widget> - <class>GnomePropertyBox</class> - <name>e-table-config</name> - - <widget> - <class>GtkNotebook</class> - <child_name>GnomePropertyBox:notebook</child_name> - <name>notebook1</name> - <show_tabs>False</show_tabs> - <show_border>True</show_border> - <tab_pos>GTK_POS_TOP</tab_pos> - <scrollable>False</scrollable> - <tab_hborder>2</tab_hborder> - <tab_vborder>2</tab_vborder> - <popup_enable>False</popup_enable> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkFrame</class> - <name>top-frame</name> - <border_width>2</border_width> - <label>Description</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - - <widget> - <class>GtkTable</class> - <name>table1</name> - <border_width>2</border_width> - <rows>3</rows> - <columns>3</columns> - <homogeneous>False</homogeneous> - <row_spacing>2</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>label2</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label3</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label4</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button15</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <signal> - <name>clicked</name> - <handler>on_fields_clicked</handler> - <last_modification_time>Tue, 03 Oct 2000 22:11:12 GMT</last_modification_time> - </signal> - <label>_Fields...</label> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-sort</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <signal> - <name>clicked</name> - <handler>on_sort_clicked</handler> - <last_modification_time>Tue, 03 Oct 2000 22:10:58 GMT</last_modification_time> - </signal> - <label>_Sort...</label> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-group</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <signal> - <name>clicked</name> - <handler>on_group_by_clicked</handler> - <last_modification_time>Tue, 03 Oct 2000 22:10:50 GMT</last_modification_time> - </signal> - <label>_Group By...</label> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label-group</name> - <label></label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>True</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label-sort</name> - <label></label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>True</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label-fields</name> - <label></label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>True</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label20</name> - <label>label20</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/widgets/table/e-table-config.glade.h b/widgets/table/e-table-config.glade.h deleted file mode 100644 index 4218ce256a..0000000000 --- a/widgets/table/e-table-config.glade.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Translatable strings file generated by Glade. - * Add this file to your project's POTFILES.in. - * DO NOT compile it as part of your application. - */ - -gchar *s = N_("Show Fields"); -gchar *s = N_("A_vailable Fields:"); -gchar *s = N_("Sh_ow these fields in order:"); -gchar *s = N_("Table HERE"); -gchar *s = N_("Table HERE"); -gchar *s = N_("Move _Up"); -gchar *s = N_("Move _Down"); -gchar *s = N_("_Add ->"); -gchar *s = N_("<- _Remove"); -gchar *s = N_("Group"); -gchar *s = N_("Group Items By"); -gchar *s = N_("Show field in View"); -gchar *s = N_("Ascending"); -gchar *s = N_("Descending"); -gchar *s = N_("Then By"); -gchar *s = N_("Show field in View"); -gchar *s = N_("Ascending"); -gchar *s = N_("Descending"); -gchar *s = N_("Then By"); -gchar *s = N_("Show field in View"); -gchar *s = N_("Ascending"); -gchar *s = N_("Descending"); -gchar *s = N_("Then By"); -gchar *s = N_("Show field in View"); -gchar *s = N_("Ascending"); -gchar *s = N_("Descending"); -gchar *s = N_("Clear All"); -gchar *s = N_("Sort"); -gchar *s = N_("Then By"); -gchar *s = N_("Ascending"); -gchar *s = N_("Descending"); -gchar *s = N_("Then By"); -gchar *s = N_("Ascending"); -gchar *s = N_("Descending"); -gchar *s = N_("Then By"); -gchar *s = N_("Ascending"); -gchar *s = N_("Descending"); -gchar *s = N_("Sort Items By"); -gchar *s = N_("Ascending"); -gchar *s = N_("Descending"); -gchar *s = N_("Clear All"); -gchar *s = N_("Description"); -gchar *s = N_("_Fields..."); -gchar *s = N_("_Sort..."); -gchar *s = N_("_Group By..."); -gchar *s = N_("label20"); diff --git a/widgets/table/e-table-config.h b/widgets/table/e-table-config.h deleted file mode 100644 index 28eb8600e2..0000000000 --- a/widgets/table/e-table-config.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_CONFIG_H_ -#define _E_TABLE_CONFIG_H_ - -#include <gnome.h> -#include <gal/e-table/e-table-sort-info.h> -#include <gal/e-table/e-table-specification.h> -#include <gal/widgets/gtk-combo-text.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_CONFIG_TYPE (e_table_config_get_type ()) -#define E_TABLE_CONFIG(o) (GTK_CHECK_CAST ((o), E_TABLE_CONFIG_TYPE, ETableConfig)) -#define E_TABLE_CONFIG_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_CONFIG_TYPE, ETableConfigClass)) -#define E_IS_TABLE_CONFIG(o) (GTK_CHECK_TYPE ((o), E_TABLE_CONFIG_TYPE)) -#define E_IS_TABLE_CONFIG_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_CONFIG_TYPE)) - -typedef struct { - GtkComboText *combo; - GtkWidget *frames; - GtkWidget *radio_ascending; - GtkWidget *radio_descending; - GtkWidget *view_check; /* Only for group dialog */ - guint changed_id, toggled_id; - void *e_table_config; -} ETableConfigSortWidgets; - - -typedef struct { - GtkObject parent; - - /* - * Our various dialog boxes - */ - GtkWidget *dialog_toplevel; - GtkWidget *dialog_show_fields; - GtkWidget *dialog_group_by; - GtkWidget *dialog_sort; - - /* - * The state we manipulate - */ - ETableSpecification *source_spec; - ETableState *source_state, *state, *temp_state; - - GtkWidget *sort_label; - GtkWidget *group_label; - GtkWidget *fields_label; - - ETableConfigSortWidgets sort [4]; - ETableConfigSortWidgets group [4]; - - /* - * List of valid column names - */ - GSList *column_names; -} ETableConfig; - -typedef struct { - GtkObjectClass parent_class; - - /* Signals */ - void (*changed) (ETableConfig *config); -} ETableConfigClass; - -GtkType e_table_config_get_type (void); -ETableConfig *e_table_config_new (const char *header, - ETableSpecification *spec, - ETableState *state); -ETableConfig *e_table_config_construct (ETableConfig *etco, - const char *header, - ETableSpecification *spec, - ETableState *state); -void e_table_config_raise (ETableConfig *config); - -END_GNOME_DECLS - -#endif /* _E_TABLE_CONFIG_H */ diff --git a/widgets/table/e-table-defines.h b/widgets/table/e-table-defines.h deleted file mode 100644 index 23bca8bc64..0000000000 --- a/widgets/table/e-table-defines.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __E_TABLE_DEFINES__ -#define __E_TABLE_DEFINES__ 1 - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define BUTTON_HEIGHT 10 -#define BUTTON_PADDING 2 -#define GROUP_INDENT (BUTTON_HEIGHT + (BUTTON_PADDING * 2)) - -/* Padding around the contents of a header button */ -#define HEADER_PADDING 1 - -#define MIN_ARROW_SIZE 10 - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif diff --git a/widgets/table/e-table-example-1.c b/widgets/table/e-table-example-1.c deleted file mode 100644 index a3be8dedd0..0000000000 --- a/widgets/table/e-table-example-1.c +++ /dev/null @@ -1,287 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* This code is GPL. */ -#include <stdio.h> -#include <string.h> -#include <gnome.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 <gdk-pixbuf/gdk-pixbuf.h> - -#include "table-test.h" - -/* - * One way in which we make it simpler to build an ETableModel is through - * the ETableSimple class. Instead of creating your own ETableModel - * class, you simply create a new object of the ETableSimple class. You - * give it a bunch of functions that act as callbacks. - * - * You also get to pass a void * to ETableSimple and it gets passed to - * your callbacks. This would be for having multiple models of the same - * type. This is just an example though, so we statically define all the - * data and ignore the void *data parameter. - * - * In our example we will be creating a table model with 6 columns and 10 - * rows. This corresponds to having 6 different types of information and - * 10 different sets of data in our database. - * - * The headers will be hard coded, as will be the example data. - * - */ - -/* - * There are two different meanings to the word "column". The first is - * the model column. A model column corresponds to a specific type of - * data. This is very much like the usage in a database table where a - * column is a field in the database. - * - * The second type of column is a view column. A view column - * corresponds to a visually displayed column. Each view column - * corresponds to a specific model column, though a model column may - * have any number of view columns associated with it, from zero to - * greater than one. - * - * Also, a view column doesn't necessarily depend on only one model - * column. In some cases, the view column renderer can be given a - * reference to another column to get extra information about its - * display. -*/ - -#define ROWS 10 -#define COLS 4 - -#define IMPORTANCE_COLUMN 4 -#define COLOR_COLUMN 5 - -/* - * Here we define the initial layout of the table. This is an xml - * format that allows you to change the initial ordering of the - * columns or to do sorting or grouping initially. This specification - * shows all 5 columns, but moves the importance column nearer to the - * front. It also sorts by the "Full Name" column (ascending.) - * Sorting and grouping take the model column as their arguments - * (sorting is specified by the "column" argument to the leaf elemnt. - */ - -#define INITIAL_SPEC "<ETableSpecification> \ - <columns-shown> \ - <column> 0 </column> \ - <column> 4 </column> \ - <column> 1 </column> \ - <column> 2 </column> \ - <column> 3 </column> \ - </columns-shown> \ - <grouping> <leaf column=\"1\" ascending=\"true\"/> </grouping> \ -</ETableSpecification>" - -char *headers [COLS] = { - "Email", - "Full Name", - "Address", - "Phone" -}; - -/* - * Virtual Column list: - * 0 Email - * 1 Full Name - * 2 Address - * 3 Phone - */ - -char *table_data [ROWS] [COLS]; - -/* - * ETableSimple callbacks - * These are the callbacks that define the behavior of our custom model. - */ - -/* - * Since our model is a constant size, we can just return its size in - * the column and row count fields. - */ - -/* This function returns the number of columns in our ETableModel. */ -static int -my_col_count (ETableModel *etc, void *data) -{ - return COLS; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -my_row_count (ETableModel *etc, void *data) -{ - return ROWS; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -my_value_at (ETableModel *etc, int col, int row, void *data) -{ - return (void *) table_data [row] [col]; -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -my_set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) -{ - g_free (table_data [row] [col]); - table_data [row] [col] = g_strdup (val); -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -my_is_cell_editable (ETableModel *etc, int col, int row, void *data) -{ - return TRUE; -} - -/* This function duplicates the value passed to it. */ -static void * -my_duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - return g_strdup (value); -} - -/* This function frees the value passed to it. */ -static void -my_free_value (ETableModel *etc, int col, void *value, void *data) -{ - g_free (value); -} - -/* This function creates an empty value. */ -static void * -my_initialize_value (ETableModel *etc, int col, void *data) -{ - return g_strdup (""); -} - -/* This function reports if a value is empty. */ -static gboolean -my_value_is_empty (ETableModel *etc, int col, const void *value, void *data) -{ - return !(value && *(char *)value); -} - -/* This function reports if a value is empty. */ -static char * -my_value_to_string (ETableModel *etc, int col, const void *value, void *data) -{ - return g_strdup(value); -} - -/* We create a window containing our new table. */ -static void -create_table (void) -{ - GtkWidget *e_table, *window, *frame; - ECell *cell_left_just; - ETableHeader *e_table_header; - int i, j; - ETableModel *e_table_model = NULL; - - /* First we fill in the simple data. */ - for (i = 0; i < ROWS; i++){ - for (j = 0; j < COLS; j++) - table_data [i] [j] = g_strdup (""); - } - /* Next we create our model. This uses the functions we defined - earlier. */ - e_table_model = e_table_simple_new ( - my_col_count, my_row_count, my_value_at, - my_set_value_at, my_is_cell_editable, - my_duplicate_value, my_free_value, - my_initialize_value, my_value_is_empty, - my_value_to_string, - NULL); - /* - * Next we create a header. The ETableHeader is used in two - * different way. The first is the full_header. This is the - * list of possible columns in the view. The second use is - * completely internal. Many of the ETableHeader functions are - * for that purpose. The only functions we really need are - * e_table_header_new and e_table_header_add_col. - * - * First we create the header. - */ - e_table_header = e_table_header_new (); - - /* - * Next we have to build renderers for all of the columns. - * Since all our columns are text columns, we can simply use - * the same renderer over and over again. If we had different - * types of columns, we could use a different renderer for - * each column. - */ - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT); - - /* - * Next we create a column object for each view column and add - * them to the header. We don't create a column object for - * the importance column since it will not be shown. - */ - for (i = 0; i < COLS; i++) { - /* Create the column. */ - ETableCol *ecol = e_table_col_new ( - i, headers [i], - 1.0, 20, cell_left_just, - g_str_compare, TRUE); - /* Add it to the header. */ - e_table_header_add_column (e_table_header, ecol, i); - } - - /* - * Here we create a window for our new table. This window - * will get shown and the person will be able to test their - * item. - */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - /* This frame is simply to get a bevel around our table. */ - frame = gtk_frame_new (NULL); - - /* - * Here we create the table. We give it the three pieces of - * the table we've created, the header, the model, and the - * initial layout. It does the rest. - */ - e_table = e_table_new (e_table_header, e_table_model, INITIAL_SPEC); - - /* Build the gtk widget hierarchy. */ - gtk_container_add (GTK_CONTAINER (frame), e_table); - gtk_container_add (GTK_CONTAINER (window), frame); - - /* Size the initial window. */ - gtk_widget_set_usize (window, 200, 200); - - /* Show it all. */ - gtk_widget_show_all (window); -} - -/* This is the main function which just initializes gnome and call our create_table function */ - -int -main (int argc, char *argv []) -{ - gnome_init ("TableExample", "TableExample", argc, argv); - e_cursors_init (); - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - create_table (); - - gtk_main (); - - e_cursors_shutdown (); - return 0; -} - diff --git a/widgets/table/e-table-example-2.c b/widgets/table/e-table-example-2.c deleted file mode 100644 index dcc7e244a1..0000000000 --- a/widgets/table/e-table-example-2.c +++ /dev/null @@ -1,330 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* This code is GPL. */ -#include <stdio.h> -#include <string.h> -#include <gnome.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 <gdk-pixbuf/gdk-pixbuf.h> - -#include "table-test.h" - -/* -One way in which we make it simpler to build an ETableModel is through -the ETableSimple class. Instead of creating your own ETableModel -class, you simply create a new object of the ETableSimple class. You -give it a bunch of functions that act as callbacks. - -You also get to pass a void * to ETableSimple and it gets passed to -your callbacks. This would be for having multiple models of the same -type. This is just an example though, so we statically define all the -data and ignore the void *data parameter. - -In our example we will be creating a table model with 6 columns and 10 -rows. This corresponds to having 6 different types of information and -10 different sets of data in our database. - -The headers will be hard coded, as will be the example data. - -*/ - -/* - There are two different meanings to the word "column". The first is - the model column. A model column corresponds to a specific type of - data. This is very much like the usage in a database table where a - column is a field in the database. - - The second type of column is a view column. A view column - corresponds to a visually displayed column. Each view column - corresponds to a specific model column, though a model column may - have any number of view columns associated with it, from zero to - greater than one. - - Also, a view column doesn't necessarily depend on only one model - column. In some cases, the view column renderer can be given a - reference to another column to get extra information about its - display. -*/ - -#define ROWS 10 -#define VIEW_COLS 4 -#define PHYSICAL_COLS 5 -#define VIRTUAL_COLS 6 - -#define IMPORTANCE_COLUMN 4 -#define COLOR_COLUMN 5 - -/* Here we define the initial layout of the table. This is an xml - format that allows you to change the initial ordering of the - columns or to do sorting or grouping initially. This specification - shows all 5 columns, but moves the importance column nearer to the - front. It also sorts by the "Full Name" column (ascending.) - Sorting and grouping take the model column as their arguments - (sorting is specified by the "column" argument to the leaf elemnt. */ -#define INITIAL_SPEC "<ETableSpecification> \ - <columns-shown> \ - <column> 0 </column> \ - <column> 4 </column> \ - <column> 1 </column> \ - <column> 2 </column> \ - <column> 3 </column> \ - </columns-shown> \ - <grouping> <leaf column=\"1\" ascending=\"true\"/> </grouping> \ -</ETableSpecification>" - -char *headers[VIEW_COLS] = { - "Email", - "Full Name", - "Address", - "Phone" -}; - -/* Virtual Column list: - 0 Full Name - 1 Email - 2 Address - 3 Phone - 4 Importance field. This field will be a boolean. It also has a - special header, so doesn't appear in the headers list. - 5 Color field. This column is also not displayed. It is also - not stored in the database. It's calculated based on the - Importance field. -*/ - -char *table_data[ROWS][VIEW_COLS]; -gboolean importance_data[ROWS]; - -/* - * ETableSimple callbacks - * These are the callbacks that define the behavior of our custom model. - */ - -/* Since our model is a constant size, we can just return its size in - the column and row count fields. */ - -static GdkColor *color1; -static GdkColor *color2; - -static int -my_col_count (ETableModel *etc, void *data) -{ - return VIRTUAL_COLS; -} - -static int -my_row_count (ETableModel *etc, void *data) -{ - return ROWS; -} - -static void * -my_value_at (ETableModel *etc, int col, int row, void *data) -{ - if (col == COLOR_COLUMN){ - if (importance_data[row]){ - return color1; - } else { - return color2; - } - } else if (col == IMPORTANCE_COLUMN){ - return (gpointer) importance_data[row]; - } else { - return (void *) table_data [row][col]; - } -} - -static void -my_set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) -{ - if (col == COLOR_COLUMN){ - } else if (col == IMPORTANCE_COLUMN){ - importance_data[row] = (gboolean) val; - } else { - g_free (table_data [row][col]); - table_data [row][col] = g_strdup (val); - } -} - -static gboolean -my_is_cell_editable (ETableModel *etc, int col, int row, void *data) -{ - if (col == IMPORTANCE_COLUMN) - return FALSE; - else - return TRUE; -} - -static void * -my_duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == COLOR_COLUMN){ - return (void *) value; - } else if (col == IMPORTANCE_COLUMN){ - return (void *) value; - } else { - return g_strdup (value); - } -} - -static void -my_free_value (ETableModel *etc, int col, void *value, void *data) -{ - if (col == COLOR_COLUMN){ - } else if (col == IMPORTANCE_COLUMN){ - } else { - g_free (value); - } -} - -static void * -my_initialize_value (ETableModel *etc, int col, void *data) -{ - if (col == COLOR_COLUMN){ - return NULL; - } else if (col == IMPORTANCE_COLUMN){ - return NULL; - } else { - return g_strdup (""); - } -} - -static gboolean -my_value_is_empty (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == COLOR_COLUMN){ - return value == NULL; - } else if (col == IMPORTANCE_COLUMN){ - return value == NULL; - } else { - return !(value && *(char *)value); - } -} - -static char * -my_value_to_string (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == COLOR_COLUMN){ - return g_strdup_printf("%d", (int) value); - } else if (col == IMPORTANCE_COLUMN){ - return g_strdup_printf("%d", (int) value); - } else { - return g_strdup(value); - } -} - -/* We create a window containing our new table. */ -static void -create_table () -{ - GtkWidget *e_table, *window, *frame; - ECell *cell_left_just; - ECell *cell_checkbox; - ETableHeader *e_table_header; - int i, j; - ETableModel *e_table_model = NULL; - ETableCol *ecol; - GdkPixbuf *pixbuf; - - /* First we fill in the simple data. */ - for (i = 0; i < ROWS; i++){ - for (j = 0; j < VIEW_COLS; j++){ - table_data[i][j] = g_strdup (""); - } - importance_data[i] = FALSE; - } - /* Next we create our model. This uses the functions we defined - earlier. */ - e_table_model = e_table_simple_new ( - my_col_count, my_row_count, my_value_at, - my_set_value_at, my_is_cell_editable, - my_duplicate_value, my_free_value, - my_initialize_value, my_value_is_empty, - my_value_to_string, - NULL); - /* - Next we create a header. The ETableHeader is used in two - different way. The first is the full_header. This is the - list of possible columns in the view. The second use is - completely internal. Many of the ETableHeader functions are - for that purpose. The only functions we really need are - e_table_header_new and e_table_header_add_col. - - First we create the header. */ - e_table_header = e_table_header_new (); - - /* Next we have to build renderers for all of the columns. - Since all our columns are text columns, we can simply use - the same renderer over and over again. If we had different - types of columns, we could use a different renderer for - each column. */ - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT); - - /* Next we create a column object for each view column and add - them to the header. We don't create a column object for - the importance column since it will not be shown. */ - for (i = 0; i < VIEW_COLS; i++){ - /* Create the column. */ - ETableCol *ecol = e_table_col_new ( - i, headers [i], - 1.0, 20, cell_left_just, - g_str_compare, TRUE); - /* Add it to the header. */ - e_table_header_add_column (e_table_header, ecol, i); - } - - /* Next we add a special column for the check box. */ - - cell_checkbox = e_cell_checkbox_new (); - pixbuf = gdk_pixbuf_new_from_file ("clip.png"); - ecol = e_table_col_new_with_pixbuf (i, pixbuf, 0.0, 18, cell_checkbox, g_int_compare, TRUE); - e_table_header_add_column (e_table_header, ecol, i); - - /* - * Setup GUI - */ - /* Here we create a window for our new table. This window - will get shown and the person will be able to test their - item. */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - /* This frame is simply to get a bevel around our table. */ - frame = gtk_frame_new (NULL); - /* Here we create the table. We give it the three pieces of - the table we've created, the header, the model, and the - initial layout. It does the rest. */ - e_table = e_table_new (e_table_header, e_table_model, INITIAL_SPEC); - - /* Build the gtk widget hierarchy. */ - gtk_container_add (GTK_CONTAINER (frame), e_table); - gtk_container_add (GTK_CONTAINER (window), frame); - - /* Size the initial window. */ - gtk_widget_set_usize (window, 200, 200); - /* Show it all. */ - gtk_widget_show_all (window); -} - - - -int -main (int argc, char *argv []) -{ - gnome_init ("TableExample", "TableExample", argc, argv); - e_cursors_init (); - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - create_table (); - - gtk_main (); - - e_cursors_shutdown (); - return 0; -} diff --git a/widgets/table/e-table-extras.c b/widgets/table/e-table-extras.c deleted file mode 100644 index 05642f1022..0000000000 --- a/widgets/table/e-table-extras.c +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-extras.c: Pair of hash table sort of thingies. - * - * Author: - * Chris Lahey <clahey@ximian.com> - * - * (C) 2000 Ximian, Inc. - */ -#include <config.h> -#include <stdlib.h> -#include <gtk/gtksignal.h> -#include "gal/util/e-util.h" -#include "gal/e-table/e-cell-text.h" -#include "gal/e-table/e-cell-checkbox.h" -#include "gal/e-table/e-cell-date.h" -#include "gal/e-table/e-cell-number.h" -#include "gal/e-table/e-cell-pixbuf.h" -#include "gal/e-table/e-cell-size.h" -#include "gal/e-table/e-cell-tree.h" -#include "e-table-extras.h" - -#define PARENT_TYPE (gtk_object_get_type()) - -static GtkObjectClass *ete_parent_class; - -static void -cell_hash_free(gchar *key, - ECell *cell, - gpointer user_data) -{ - g_free(key); - if (cell) - gtk_object_unref( GTK_OBJECT (cell)); -} - -static void -pixbuf_hash_free(gchar *key, - GdkPixbuf *pixbuf, - gpointer user_data) -{ - g_free(key); - if (pixbuf) - gdk_pixbuf_unref(pixbuf); -} - -static void -ete_destroy (GtkObject *object) -{ - ETableExtras *ete = E_TABLE_EXTRAS (object); - - g_hash_table_foreach (ete->cells, (GHFunc) cell_hash_free, NULL); - g_hash_table_foreach (ete->compares, (GHFunc) g_free, NULL); - g_hash_table_foreach (ete->pixbufs, (GHFunc) pixbuf_hash_free, NULL); - - g_hash_table_destroy (ete->cells); - g_hash_table_destroy (ete->compares); - g_hash_table_destroy (ete->pixbufs); - - ete->cells = NULL; - ete->compares = NULL; - ete->pixbufs = NULL; - - GTK_OBJECT_CLASS (ete_parent_class)->destroy (object); -} - -static void -ete_class_init (GtkObjectClass *klass) -{ - ete_parent_class = gtk_type_class (PARENT_TYPE); - - klass->destroy = ete_destroy; -} - -static void -ete_init (ETableExtras *extras) -{ - extras->cells = g_hash_table_new(g_str_hash, g_str_equal); - extras->compares = g_hash_table_new(g_str_hash, g_str_equal); - extras->pixbufs = g_hash_table_new(g_str_hash, g_str_equal); - - e_table_extras_add_compare(extras, "string", g_str_compare); - e_table_extras_add_compare(extras, "integer", g_int_compare); - - e_table_extras_add_cell(extras, "checkbox", e_cell_checkbox_new()); - e_table_extras_add_cell(extras, "date", e_cell_date_new (NULL, GTK_JUSTIFY_LEFT)); - e_table_extras_add_cell(extras, "number", e_cell_number_new (NULL, GTK_JUSTIFY_RIGHT)); - e_table_extras_add_cell(extras, "pixbuf", e_cell_pixbuf_new ()); - e_table_extras_add_cell(extras, "size", e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT)); - e_table_extras_add_cell(extras, "string", e_cell_text_new (NULL, GTK_JUSTIFY_LEFT)); - e_table_extras_add_cell(extras, "tree-string", e_cell_tree_new (NULL, NULL, TRUE, e_cell_text_new (NULL, GTK_JUSTIFY_LEFT))); -} - -E_MAKE_TYPE(e_table_extras, "ETableExtras", ETableExtras, ete_class_init, ete_init, PARENT_TYPE); - -ETableExtras * -e_table_extras_new (void) -{ - ETableExtras *ete = gtk_type_new (E_TABLE_EXTRAS_TYPE); - - return (ETableExtras *) ete; -} - -void -e_table_extras_add_cell (ETableExtras *extras, - char *id, - ECell *cell) -{ - gchar *old_key; - ECell *old_cell; - - if (g_hash_table_lookup_extended (extras->cells, id, (gpointer *)&old_key, (gpointer *)&old_cell)) { - g_free (old_key); - if (old_cell) - gtk_object_unref (GTK_OBJECT(old_cell)); - } - - if (cell) { - gtk_object_ref (GTK_OBJECT (cell)); - gtk_object_sink (GTK_OBJECT (cell)); - } - g_hash_table_insert (extras->cells, g_strdup(id), cell); -} - -ECell * -e_table_extras_get_cell (ETableExtras *extras, - char *id) -{ - return g_hash_table_lookup(extras->cells, id); -} - -void -e_table_extras_add_compare (ETableExtras *extras, - char *id, - GCompareFunc compare) -{ - gchar *old_key; - GCompareFunc old_compare; - - if (g_hash_table_lookup_extended (extras->cells, id, (gpointer *)&old_key, (gpointer *)&old_compare)) { - g_free (old_key); - } - - g_hash_table_insert(extras->compares, g_strdup(id), compare); -} - -GCompareFunc -e_table_extras_get_compare (ETableExtras *extras, - char *id) -{ - return g_hash_table_lookup(extras->compares, id); -} - -void -e_table_extras_add_pixbuf (ETableExtras *extras, - char *id, - GdkPixbuf *pixbuf) -{ - gchar *old_key; - GdkPixbuf *old_pixbuf; - - if (g_hash_table_lookup_extended (extras->pixbufs, id, (gpointer *)&old_key, (gpointer *)&old_pixbuf)) { - g_free (old_key); - if (old_pixbuf) - gdk_pixbuf_unref (old_pixbuf); - } - - if (pixbuf) - gdk_pixbuf_ref(pixbuf); - g_hash_table_insert (extras->pixbufs, g_strdup(id), pixbuf); -} - -GdkPixbuf * -e_table_extras_get_pixbuf (ETableExtras *extras, - char *id) -{ - return g_hash_table_lookup(extras->pixbufs, id); -} diff --git a/widgets/table/e-table-extras.h b/widgets/table/e-table-extras.h deleted file mode 100644 index d39fe9066f..0000000000 --- a/widgets/table/e-table-extras.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_EXTRAS_H_ -#define _E_TABLE_EXTRAS_H_ - -#include <gtk/gtkobject.h> -#include <gal/e-table/e-cell.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_EXTRAS_TYPE (e_table_extras_get_type ()) -#define E_TABLE_EXTRAS(o) (GTK_CHECK_CAST ((o), E_TABLE_EXTRAS_TYPE, ETableExtras)) -#define E_TABLE_EXTRAS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_EXTRAS_TYPE, ETableExtrasClass)) -#define E_IS_TABLE_EXTRAS(o) (GTK_CHECK_TYPE ((o), E_TABLE_EXTRAS_TYPE)) -#define E_IS_TABLE_EXTRAS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_EXTRAS_TYPE)) - -typedef struct { - GtkObject base; - - GHashTable *cells; - GHashTable *compares; - GHashTable *pixbufs; -} ETableExtras; - -typedef struct { - GtkObjectClass parent_class; -} ETableExtrasClass; - -GtkType e_table_extras_get_type (void); -ETableExtras *e_table_extras_new (void); - -void e_table_extras_add_cell (ETableExtras *extras, - char *id, - ECell *cell); -ECell *e_table_extras_get_cell (ETableExtras *extras, - char *id); - -void e_table_extras_add_compare (ETableExtras *extras, - char *id, - GCompareFunc compare); -GCompareFunc e_table_extras_get_compare (ETableExtras *extras, - char *id); - -void e_table_extras_add_pixbuf (ETableExtras *extras, - char *id, - GdkPixbuf *pixbuf); -GdkPixbuf *e_table_extras_get_pixbuf (ETableExtras *extras, - char *id); - -END_GNOME_DECLS - -#endif /* _E_TABLE_EXTRAS_H_ */ diff --git a/widgets/table/e-table-field-chooser-dialog.c b/widgets/table/e-table-field-chooser-dialog.c deleted file mode 100644 index 216c582753..0000000000 --- a/widgets/table/e-table-field-chooser-dialog.c +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-field-chooser-dialog.c - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <gnome.h> -#include "e-table-field-chooser-dialog.h" - -static void e_table_field_chooser_dialog_init (ETableFieldChooserDialog *card); -static void e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass); -static void e_table_field_chooser_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_table_field_chooser_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_table_field_chooser_dialog_destroy (GtkObject *object); -static void e_table_field_chooser_dialog_clicked (GnomeDialog *dialog, gint button); - -static GnomeDialogClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_DND_CODE, - ARG_FULL_HEADER, -}; - -GtkType -e_table_field_chooser_dialog_get_type (void) -{ - static GtkType table_field_chooser_dialog_type = 0; - - if (!table_field_chooser_dialog_type) - { - static const GtkTypeInfo table_field_chooser_dialog_info = - { - "ETableFieldChooserDialog", - sizeof (ETableFieldChooserDialog), - sizeof (ETableFieldChooserDialogClass), - (GtkClassInitFunc) e_table_field_chooser_dialog_class_init, - (GtkObjectInitFunc) e_table_field_chooser_dialog_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - table_field_chooser_dialog_type = gtk_type_unique (gnome_dialog_get_type (), &table_field_chooser_dialog_info); - } - - return table_field_chooser_dialog_type; -} - -static void -e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass) -{ - GtkObjectClass *object_class; - GnomeDialogClass *dialog_class; - - object_class = (GtkObjectClass*) klass; - dialog_class = GNOME_DIALOG_CLASS (klass); - - parent_class = gtk_type_class (gnome_dialog_get_type ()); - - object_class->destroy = e_table_field_chooser_dialog_destroy; - object_class->set_arg = e_table_field_chooser_dialog_set_arg; - object_class->get_arg = e_table_field_chooser_dialog_get_arg; - - dialog_class->clicked = e_table_field_chooser_dialog_clicked; - - gtk_object_add_arg_type ("ETableFieldChooserDialog::dnd_code", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_DND_CODE); - gtk_object_add_arg_type ("ETableFieldChooserDialog::full_header", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_FULL_HEADER); -} - -static void -e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_chooser_dialog) -{ - GtkWidget *widget; - - e_table_field_chooser_dialog->etfc = NULL; - e_table_field_chooser_dialog->dnd_code = g_strdup(""); - e_table_field_chooser_dialog->full_header = NULL; - - gnome_dialog_append_buttons(GNOME_DIALOG(e_table_field_chooser_dialog), - GNOME_STOCK_BUTTON_CLOSE, - NULL); - - gtk_window_set_policy(GTK_WINDOW(e_table_field_chooser_dialog), FALSE, TRUE, FALSE); - - widget = e_table_field_chooser_new(); - e_table_field_chooser_dialog->etfc = E_TABLE_FIELD_CHOOSER(widget); - - gtk_object_set(GTK_OBJECT(widget), - "dnd_code", e_table_field_chooser_dialog->dnd_code, - "full_header", e_table_field_chooser_dialog->full_header, - NULL); - - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(e_table_field_chooser_dialog)->vbox), - widget, TRUE, TRUE, 0); - - gtk_widget_show(GTK_WIDGET(widget)); -} - -GtkWidget* -e_table_field_chooser_dialog_new (void) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_table_field_chooser_dialog_get_type ())); - return widget; -} - -static void -e_table_field_chooser_dialog_destroy (GtkObject *object) -{ - ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG (object); - g_free(etfcd->dnd_code); - if (etfcd->full_header) - gtk_object_unref(GTK_OBJECT(etfcd->full_header)); -} - -static void -e_table_field_chooser_dialog_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG(object); - switch (arg_id){ - case ARG_DND_CODE: - g_free(etfcd->dnd_code); - etfcd->dnd_code = g_strdup(GTK_VALUE_STRING (*arg)); - if (etfcd->etfc) - gtk_object_set(GTK_OBJECT(etfcd->etfc), - "dnd_code", etfcd->dnd_code, - NULL); - break; - case ARG_FULL_HEADER: - if (etfcd->full_header) - gtk_object_unref(GTK_OBJECT(etfcd->full_header)); - if (GTK_VALUE_OBJECT(*arg)) - etfcd->full_header = E_TABLE_HEADER(GTK_VALUE_OBJECT(*arg)); - else - etfcd->full_header = NULL; - if (etfcd->full_header) - gtk_object_ref(GTK_OBJECT(etfcd->full_header)); - if (etfcd->etfc) - gtk_object_set(GTK_OBJECT(etfcd->etfc), - "full_header", etfcd->full_header, - NULL); - break; - default: - break; - } -} - -static void -e_table_field_chooser_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG(object); - switch (arg_id) { - case ARG_DND_CODE: - GTK_VALUE_STRING (*arg) = g_strdup (etfcd->dnd_code); - break; - case ARG_FULL_HEADER: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etfcd->full_header); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_table_field_chooser_dialog_clicked (GnomeDialog *dialog, int button) -{ - if (button == 0) - gnome_dialog_close(dialog); -} diff --git a/widgets/table/e-table-field-chooser-dialog.h b/widgets/table/e-table-field-chooser-dialog.h deleted file mode 100644 index 502db6f473..0000000000 --- a/widgets/table/e-table-field-chooser-dialog.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-table-field-chooser-dialog.h - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_TABLE_FIELD_CHOOSER_DIALOG_H__ -#define __E_TABLE_FIELD_CHOOSER_DIALOG_H__ - -#include <gnome.h> -#include <gal/e-table/e-table-field-chooser.h> -#include <gal/e-table/e-table-header.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ETableFieldChooserDialog - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define E_TABLE_FIELD_CHOOSER_DIALOG_TYPE (e_table_field_chooser_dialog_get_type ()) -#define E_TABLE_FIELD_CHOOSER_DIALOG(obj) (GTK_CHECK_CAST ((obj), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE, ETableFieldChooserDialog)) -#define E_TABLE_FIELD_CHOOSER_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE, ETableFieldChooserDialogClass)) -#define E_IS_TABLE_FIELD_CHOOSER_DIALOG(obj) (GTK_CHECK_TYPE ((obj), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE)) -#define E_IS_TABLE_FIELD_CHOOSER_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE)) - - -typedef struct _ETableFieldChooserDialog ETableFieldChooserDialog; -typedef struct _ETableFieldChooserDialogClass ETableFieldChooserDialogClass; - -struct _ETableFieldChooserDialog -{ - GnomeDialog parent; - - /* item specific fields */ - ETableFieldChooser *etfc; - gchar *dnd_code; - ETableHeader *full_header; -}; - -struct _ETableFieldChooserDialogClass -{ - GnomeDialogClass parent_class; -}; - - -GtkWidget *e_table_field_chooser_dialog_new(void); -GtkType e_table_field_chooser_dialog_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TABLE_FIELD_CHOOSER_DIALOG_H__ */ diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c deleted file mode 100644 index 2241f5e29f..0000000000 --- a/widgets/table/e-table-field-chooser-item.c +++ /dev/null @@ -1,560 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-column-view.c: A canvas item based view of the ETableColumn. - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * Copyright 1999, 2000 Ximian, Inc. - */ -#include <config.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkdnd.h> -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-util.h> -#include <libgnomeui/gnome-canvas-polygon.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - -#include "gal/util/e-xml-utils.h" -#include "gal/widgets/e-canvas.h" - -#include "e-table-header.h" -#include "e-table-col-dnd.h" -#include "e-table-defines.h" -#include "e-table-header-utils.h" - -#include "e-table-field-chooser-item.h" - -#if 0 -enum { - BUTTON_PRESSED, - LAST_SIGNAL -}; - -static guint etfci_signals [LAST_SIGNAL] = { 0, }; -#endif - -#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () - -#define ELEMENTS(x) (sizeof (x) / sizeof (x[0])) - -static GnomeCanvasItemClass *etfci_parent_class; - -static void etfci_drop_table_header (ETableFieldChooserItem *etfci); - -enum { - ARG_0, - ARG_FULL_HEADER, - ARG_DND_CODE, - ARG_WIDTH, - ARG_HEIGHT, -}; - -static void -etfci_destroy (GtkObject *object){ - ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (object); - - etfci_drop_table_header (etfci); - - gdk_font_unref(etfci->font); - - if (GTK_OBJECT_CLASS (etfci_parent_class)->destroy) - (*GTK_OBJECT_CLASS (etfci_parent_class)->destroy) (object); -} - -static gint -etfci_find_button (ETableFieldChooserItem *etfci, double loc) -{ - int i; - int count; - double height = 0; - GtkStyle *style; - - style = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas)->style; - - count = e_table_header_count(etfci->full_header); - for (i = 0; i < count; i++) { - ETableCol *ecol; - - ecol = e_table_header_get_column (etfci->full_header, i); - height += e_table_header_compute_height (ecol, style, etfci->font); - if (height > loc) - return i; - } - return MAX(0, count - 1); -} - -static void -etfci_reflow (GnomeCanvasItem *item, gint flags) -{ - ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item); - double old_height; - int i; - int count; - double height = 0; - GtkStyle *style; - - style = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas)->style; - - old_height = etfci->height; - - count = e_table_header_count(etfci->full_header); - for (i = 0; i < count; i++) { - ETableCol *ecol; - - ecol = e_table_header_get_column (etfci->full_header, i); - height += e_table_header_compute_height (ecol, style, etfci->font); - } - - etfci->height = height; - - if (old_height != etfci->height) - e_canvas_item_request_parent_reflow(item); - - gnome_canvas_item_request_update(item); -} - -static void -etfci_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item); - double i2c [6]; - ArtPoint c1, c2, i1, i2; - - if (GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->update) - (*GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->update)(item, affine, clip_path, flags); - - i1.x = i1.y = 0; - i2.x = etfci->width; - i2.y = etfci->height; - - gnome_canvas_item_i2c_affine (item, i2c); - art_affine_point (&c1, &i1, i2c); - art_affine_point (&c2, &i2, i2c); - - if (item->x1 != c1.x || - item->y1 != c1.y || - item->x2 != c2.x || - item->y2 != c2.y) - { - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); - item->x1 = c1.x; - item->y1 = c1.y; - item->x2 = c2.x; - item->y2 = c2.y; - - gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); - } - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); -} - -static void -etfci_font_load (ETableFieldChooserItem *etfci, char *font) -{ - if (etfci->font) - gdk_font_unref (etfci->font); - etfci->font = NULL; - - if (font) - etfci->font = gdk_fontset_load (font); - - if (etfci->font == NULL) { - etfci->font = GTK_WIDGET(GNOME_CANVAS_ITEM(etfci)->canvas)->style->font; - gdk_font_ref(etfci->font); - } -} - -static void -etfci_drop_table_header (ETableFieldChooserItem *etfci) -{ - GtkObject *header; - - if (!etfci->full_header) - return; - - header = GTK_OBJECT (etfci->full_header); - if (etfci->structure_change_id) - gtk_signal_disconnect (header, etfci->structure_change_id); - if (etfci->dimension_change_id) - gtk_signal_disconnect (header, etfci->dimension_change_id); - etfci->structure_change_id = 0; - etfci->dimension_change_id = 0; - - if (header) - gtk_object_unref (header); - etfci->full_header = NULL; - etfci->height = 0; - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci)); -} - -static void -structure_changed (ETableHeader *header, ETableFieldChooserItem *etfci) -{ - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci)); -} - -static void -dimension_changed (ETableHeader *header, int col, ETableFieldChooserItem *etfci) -{ - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci)); -} - -static void -etfci_add_table_header (ETableFieldChooserItem *etfci, ETableHeader *header) -{ - etfci->full_header = header; - gtk_object_ref (GTK_OBJECT (etfci->full_header)); - - etfci->structure_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "structure_change", - GTK_SIGNAL_FUNC(structure_changed), etfci); - etfci->dimension_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "dimension_change", - GTK_SIGNAL_FUNC(dimension_changed), etfci); - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci)); -} - -static void -etfci_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - ETableFieldChooserItem *etfci; - - item = GNOME_CANVAS_ITEM (o); - etfci = E_TABLE_FIELD_CHOOSER_ITEM (o); - - switch (arg_id){ - case ARG_FULL_HEADER: - etfci_drop_table_header (etfci); - if (GTK_VALUE_OBJECT (*arg)) - etfci_add_table_header (etfci, E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg))); - break; - - case ARG_DND_CODE: - g_free(etfci->dnd_code); - etfci->dnd_code = g_strdup(GTK_VALUE_STRING (*arg)); - break; - - case ARG_WIDTH: - etfci->width = GTK_VALUE_DOUBLE (*arg); - gnome_canvas_item_request_update(item); - break; - } -} - -static void -etfci_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - ETableFieldChooserItem *etfci; - - item = GNOME_CANVAS_ITEM (o); - etfci = E_TABLE_FIELD_CHOOSER_ITEM (o); - - switch (arg_id){ - - case ARG_DND_CODE: - GTK_VALUE_STRING (*arg) = g_strdup (etfci->dnd_code); - break; - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = etfci->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = etfci->height; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -etfci_drag_data_get (GtkWidget *widget, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time, - ETableFieldChooserItem *etfci) -{ - if (etfci->drag_col != -1) { - gchar *string = g_strdup_printf("%d", etfci->drag_col); - gtk_selection_data_set(selection_data, - GDK_SELECTION_TYPE_STRING, - sizeof(string[0]), - string, - strlen(string)); - g_free(string); - } -} - -static void -etfci_drag_end (GtkWidget *canvas, - GdkDragContext *context, - ETableFieldChooserItem *etfci) -{ - etfci->drag_col = -1; -} - -static void -etfci_realize (GnomeCanvasItem *item) -{ - ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item); - GdkWindow *window; - - if (GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)-> realize) - (*GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->realize)(item); - - window = GTK_WIDGET (item->canvas)->window; - - if (!etfci->font) - etfci_font_load (etfci, NULL); - - etfci->drag_end_id = gtk_signal_connect ( - GTK_OBJECT (item->canvas), "drag_end", - GTK_SIGNAL_FUNC (etfci_drag_end), etfci); - etfci->drag_data_get_id = gtk_signal_connect ( - GTK_OBJECT (item->canvas), "drag_data_get", - GTK_SIGNAL_FUNC (etfci_drag_data_get), etfci); - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci)); -} - -static void -etfci_unrealize (GnomeCanvasItem *item) -{ - ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item); - - if (etfci->font) - gdk_font_unref (etfci->font); - etfci->font = NULL; - - gtk_signal_disconnect (GTK_OBJECT (item->canvas), etfci->drag_end_id); - etfci->drag_end_id = 0; - gtk_signal_disconnect (GTK_OBJECT (item->canvas), etfci->drag_data_get_id); - etfci->drag_data_get_id = 0; - - if (GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->unrealize) - (*GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->unrealize)(item); -} - -static void -etfci_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height) -{ - ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item); - GnomeCanvas *canvas = item->canvas; - const int rows = e_table_header_count (etfci->full_header); - int y1, y2; - int row; - GtkStyle *style; - GtkStateType state; - - style = GTK_WIDGET (canvas)->style; - state = GTK_WIDGET_STATE (canvas); - - y1 = y2 = 0; - for (row = 0; row < rows; row++, y1 = y2){ - ETableCol *ecol; - - ecol = e_table_header_get_column (etfci->full_header, row); - - y2 += e_table_header_compute_height (ecol, style, etfci->font); - - if (y1 > (y + height)) - break; - - if (y2 < y) - continue; - - e_table_header_draw_button (drawable, ecol, - style, etfci->font, state, - GTK_WIDGET (canvas), style->fg_gc[GTK_STATE_NORMAL], - -x, y1 - y, - width, height, - etfci->width, y2 - y1, - E_TABLE_COL_ARROW_NONE); - } -} - -static double -etfci_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - *actual_item = item; - return 0.0; -} - -static gboolean -etfci_maybe_start_drag (ETableFieldChooserItem *etfci, double x, double y) -{ - if (!etfci->maybe_drag) - return FALSE; - - if (MAX (abs (etfci->click_x - x), - abs (etfci->click_y - y)) <= 3) - return FALSE; - - return TRUE; -} - -static void -etfci_start_drag (ETableFieldChooserItem *etfci, GdkEvent *event, double x, double y) -{ - GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas); - GtkTargetList *list; - GdkDragContext *context; - ETableCol *ecol; - GdkPixmap *pixmap; - int drag_col; - int button_height; - - GtkTargetEntry etfci_drag_types [] = { - { TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER }, - }; - - drag_col = etfci_find_button(etfci, y); - - if (drag_col < 0 || drag_col > e_table_header_count(etfci->full_header)) - return; - - ecol = e_table_header_get_column (etfci->full_header, drag_col); - - etfci->drag_col = ecol->col_idx; - - etfci_drag_types[0].target = g_strdup_printf("%s-%s", etfci_drag_types[0].target, etfci->dnd_code); - list = gtk_target_list_new (etfci_drag_types, ELEMENTS (etfci_drag_types)); - context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event); - g_free(etfci_drag_types[0].target); - - button_height = e_table_header_compute_height (ecol, widget->style, etfci->font); - pixmap = gdk_pixmap_new (widget->window, etfci->width, button_height, -1); - - e_table_header_draw_button (pixmap, e_table_header_get_column (etfci->full_header, drag_col), - widget->style, etfci->font, GTK_WIDGET_STATE (widget), - widget, widget->style->fg_gc[GTK_STATE_NORMAL], - 0, 0, - etfci->width, button_height, - etfci->width, button_height, - E_TABLE_COL_ARROW_NONE); - - gtk_drag_set_icon_pixmap (context, - gdk_window_get_colormap (widget->window), - pixmap, - NULL, - etfci->width / 2, - button_height / 2); - gdk_pixmap_unref (pixmap); - etfci->maybe_drag = FALSE; -} - -/* - * Handles the events on the ETableFieldChooserItem - */ -static int -etfci_event (GnomeCanvasItem *item, GdkEvent *e) -{ - ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item); - GnomeCanvas *canvas = item->canvas; - int x, y; - - switch (e->type){ - case GDK_MOTION_NOTIFY: - gnome_canvas_w2c (canvas, e->motion.x, e->motion.y, &x, &y); - - if (etfci_maybe_start_drag (etfci, x, y)) - etfci_start_drag (etfci, e, x, y); - break; - - case GDK_BUTTON_PRESS: - gnome_canvas_w2c (canvas, e->button.x, e->button.y, &x, &y); - - if (e->button.button == 1){ - etfci->click_x = x; - etfci->click_y = y; - etfci->maybe_drag = TRUE; - } - break; - - case GDK_BUTTON_RELEASE: { - etfci->maybe_drag = FALSE; - break; - } - - default: - return FALSE; - } - return TRUE; -} - -static void -etfci_class_init (GtkObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - - etfci_parent_class = gtk_type_class (PARENT_OBJECT_TYPE); - - object_class->destroy = etfci_destroy; - object_class->set_arg = etfci_set_arg; - object_class->get_arg = etfci_get_arg; - - item_class->update = etfci_update; - item_class->realize = etfci_realize; - item_class->unrealize = etfci_unrealize; - item_class->draw = etfci_draw; - item_class->point = etfci_point; - item_class->event = etfci_event; - - gtk_object_add_arg_type ("ETableFieldChooserItem::dnd_code", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_DND_CODE); - gtk_object_add_arg_type ("ETableFieldChooserItem::full_header", GTK_TYPE_OBJECT, - GTK_ARG_WRITABLE, ARG_FULL_HEADER); - gtk_object_add_arg_type ("ETableFieldChooserItem::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableFieldChooserItem::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); -} - -static void -etfci_init (GnomeCanvasItem *item) -{ - ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item); - - etfci->full_header = NULL; - - etfci->height = etfci->width = 0; - - etfci->font = NULL; - - etfci->structure_change_id = 0; - etfci->dimension_change_id = 0; - - etfci->dnd_code = NULL; - - etfci->maybe_drag = 0; - etfci->drag_end_id = 0; - - e_canvas_item_set_reflow_callback(item, etfci_reflow); -} - -GtkType -e_table_field_chooser_item_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETableFieldChooserItem", - sizeof (ETableFieldChooserItem), - sizeof (ETableFieldChooserItemClass), - (GtkClassInitFunc) etfci_class_init, - (GtkObjectInitFunc) etfci_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_OBJECT_TYPE, &info); - } - - return type; -} - diff --git a/widgets/table/e-table-field-chooser-item.h b/widgets/table/e-table-field-chooser-item.h deleted file mode 100644 index d91c36d52b..0000000000 --- a/widgets/table/e-table-field-chooser-item.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_FIELD_CHOOSER_ITEM_H_ -#define _E_TABLE_FIELD_CHOOSER_ITEM_H_ - -#include <libgnomeui/gnome-canvas.h> -#include <gnome-xml/tree.h> -#include <gal/e-table/e-table-header.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_FIELD_CHOOSER_ITEM_TYPE (e_table_field_chooser_item_get_type ()) -#define E_TABLE_FIELD_CHOOSER_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_FIELD_CHOOSER_ITEM_TYPE, ETableFieldChooserItem)) -#define E_TABLE_FIELD_CHOOSER_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_FIELD_CHOOSER_ITEM_TYPE, ETableFieldChooserItemClass)) -#define E_IS_TABLE_FIELD_CHOOSER_ITEM(o) (GTK_CHECK_TYPE ((o), E_TABLE_FIELD_CHOOSER_ITEM_TYPE)) -#define E_IS_TABLE_FIELD_CHOOSER_ITEM_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_FIELD_CHOOSER_ITEM_TYPE)) - -typedef struct { - GnomeCanvasItem parent; - ETableHeader *full_header; - - double height, width; - - GdkFont *font; - - /* - * Ids - */ - int structure_change_id, dimension_change_id; - - gchar *dnd_code; - - /* - * For dragging columns - */ - guint maybe_drag:1; - int click_x, click_y; - int drag_col; - guint drag_data_get_id; - guint drag_end_id; -} ETableFieldChooserItem; - -typedef struct { - GnomeCanvasItemClass parent_class; -} ETableFieldChooserItemClass; - -GtkType e_table_field_chooser_item_get_type (void); - -END_GNOME_DECLS - -#endif /* _E_TABLE_FIELD_CHOOSER_ITEM_H_ */ diff --git a/widgets/table/e-table-field-chooser.c b/widgets/table/e-table-field-chooser.c deleted file mode 100644 index a27416a6ba..0000000000 --- a/widgets/table/e-table-field-chooser.c +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-field-chooser.c - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <gnome.h> -#include "e-table-field-chooser.h" -#include "e-table-field-chooser-item.h" - -static void e_table_field_chooser_init (ETableFieldChooser *card); -static void e_table_field_chooser_class_init (ETableFieldChooserClass *klass); -static void e_table_field_chooser_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_table_field_chooser_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_table_field_chooser_destroy (GtkObject *object); - -static GtkVBoxClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_FULL_HEADER, - ARG_DND_CODE, -}; - -GtkType -e_table_field_chooser_get_type (void) -{ - static GtkType table_field_chooser_type = 0; - - if (!table_field_chooser_type) - { - static const GtkTypeInfo table_field_chooser_info = - { - "ETableFieldChooser", - sizeof (ETableFieldChooser), - sizeof (ETableFieldChooserClass), - (GtkClassInitFunc) e_table_field_chooser_class_init, - (GtkObjectInitFunc) e_table_field_chooser_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - table_field_chooser_type = gtk_type_unique (gtk_vbox_get_type (), &table_field_chooser_info); - } - - return table_field_chooser_type; -} - -static void -e_table_field_chooser_class_init (ETableFieldChooserClass *klass) -{ - GtkObjectClass *object_class; - GtkVBoxClass *vbox_class; - - object_class = (GtkObjectClass*) klass; - vbox_class = (GtkVBoxClass *) klass; - - glade_gnome_init(); - - parent_class = gtk_type_class (gtk_vbox_get_type ()); - - object_class->set_arg = e_table_field_chooser_set_arg; - object_class->get_arg = e_table_field_chooser_get_arg; - object_class->destroy = e_table_field_chooser_destroy; - gtk_object_add_arg_type ("ETableFieldChooser::dnd_code", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_DND_CODE); - gtk_object_add_arg_type ("ETableFieldChooser::full_header", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_FULL_HEADER); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, ETableFieldChooser *etfc) -{ - double height; - etfc->last_alloc = *allocation; - gnome_canvas_item_set( etfc->item, - "width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(etfc->item), - "height", &height, - NULL); - height = MAX(height, allocation->height); - gnome_canvas_set_scroll_region(GNOME_CANVAS( etfc->canvas ), 0, 0, allocation->width - 1, height - 1); - gnome_canvas_item_set( etfc->rect, - "x2", (double) allocation->width, - "y2", (double) height, - NULL ); -} - -static void resize(GnomeCanvas *canvas, ETableFieldChooser *etfc) -{ - double height; - gtk_object_get(GTK_OBJECT(etfc->item), - "height", &height, - NULL); - - height = MAX(height, etfc->last_alloc.height); - - gnome_canvas_set_scroll_region (GNOME_CANVAS(etfc->canvas), 0, 0, etfc->last_alloc.width - 1, height - 1); - gnome_canvas_item_set( etfc->rect, - "x2", (double) etfc->last_alloc.width, - "y2", (double) height, - NULL ); -} - -static void -e_table_field_chooser_init (ETableFieldChooser *etfc) -{ - GladeXML *gui; - GtkWidget *widget; - - gui = glade_xml_new (ETABLE_GLADEDIR "/e-table-field-chooser.glade", NULL); - etfc->gui = gui; - - widget = glade_xml_get_widget(gui, "vbox-top"); - if (!widget) { - return; - } - gtk_widget_reparent(widget, - GTK_WIDGET(etfc)); - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - etfc->canvas = GNOME_CANVAS(glade_xml_get_widget(gui, "canvas-buttons")); - - etfc->rect = gnome_canvas_item_new(gnome_canvas_root( GNOME_CANVAS( etfc->canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - - etfc->item = gnome_canvas_item_new(gnome_canvas_root(etfc->canvas), - e_table_field_chooser_item_get_type(), - "width", (double) 100, - "full_header", etfc->full_header, - "dnd_code", etfc->dnd_code, - NULL ); - - gtk_signal_connect( GTK_OBJECT( etfc->canvas ), "reflow", - GTK_SIGNAL_FUNC( resize ), - etfc); - - gnome_canvas_set_scroll_region ( GNOME_CANVAS( etfc->canvas ), - 0, 0, - 100, 100 ); - - /* Connect the signals */ - gtk_signal_connect (GTK_OBJECT (etfc->canvas), "size_allocate", - GTK_SIGNAL_FUNC (allocate_callback), - etfc); - - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); - gtk_widget_show(widget); -} - -static void -e_table_field_chooser_destroy (GtkObject *object) -{ - ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object); - - g_free(etfc->dnd_code); - if (etfc->full_header) - gtk_object_unref(GTK_OBJECT(etfc->full_header)); - - if (etfc->gui) - gtk_object_unref(GTK_OBJECT(etfc->gui)); -} - -GtkWidget* -e_table_field_chooser_new (void) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_table_field_chooser_get_type ())); - return widget; -} - -static void -e_table_field_chooser_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object); - - switch (arg_id){ - case ARG_DND_CODE: - g_free(etfc->dnd_code); - etfc->dnd_code = g_strdup(GTK_VALUE_STRING (*arg)); - if (etfc->item) - gtk_object_set(GTK_OBJECT(etfc->item), - "dnd_code", etfc->dnd_code, - NULL); - break; - case ARG_FULL_HEADER: - if (etfc->full_header) - gtk_object_unref(GTK_OBJECT(etfc->full_header)); - if (GTK_VALUE_OBJECT(*arg)) - etfc->full_header = E_TABLE_HEADER(GTK_VALUE_OBJECT(*arg)); - else - etfc->full_header = NULL; - if (etfc->full_header) - gtk_object_ref(GTK_OBJECT(etfc->full_header)); - if (etfc->item) - gtk_object_set(GTK_OBJECT(etfc->item), - "full_header", etfc->full_header, - NULL); - break; - default: - break; - } -} - -static void -e_table_field_chooser_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object); - - switch (arg_id) { - case ARG_DND_CODE: - GTK_VALUE_STRING (*arg) = g_strdup (etfc->dnd_code); - break; - case ARG_FULL_HEADER: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etfc->full_header); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} diff --git a/widgets/table/e-table-field-chooser.glade b/widgets/table/e-table-field-chooser.glade deleted file mode 100644 index a5cd37c2df..0000000000 --- a/widgets/table/e-table-field-chooser.glade +++ /dev/null @@ -1,131 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>e-table-field-chooser</name> - <program_name>e-table-field-chooser</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <use_widget_names>True</use_widget_names> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> - <gnome_help_support>True</gnome_help_support> - <output_translatable_strings>True</output_translatable_strings> - <translatable_strings_file>e-table-field-chooser.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>dialog-field-chooser</name> - <visible>False</visible> - <title>Field Chooser</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox1</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button3</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox-top</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label1</name> - <label>To add a column to your table, drag it into -the location in which you want it to appear.</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <width>200</width> - <height>200</height> - <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Custom</class> - <name>canvas-buttons</name> - <creation_function>e_canvas_new</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 08 Jun 2000 07:27:33 GMT</last_modification_time> - </widget> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/widgets/table/e-table-field-chooser.glade.h b/widgets/table/e-table-field-chooser.glade.h deleted file mode 100644 index a36bd6052c..0000000000 --- a/widgets/table/e-table-field-chooser.glade.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Translatable strings file generated by Glade. - * Add this file to your project's POTFILES.in. - * DO NOT compile it as part of your application. - */ - -gchar *s = N_("Field Chooser"); -gchar *s = N_("To add a column to your table, drag it into\n" - "the location in which you want it to appear."); diff --git a/widgets/table/e-table-field-chooser.h b/widgets/table/e-table-field-chooser.h deleted file mode 100644 index ca9917549a..0000000000 --- a/widgets/table/e-table-field-chooser.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor-fullname.h - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_TABLE_FIELD_CHOOSER_H__ -#define __E_TABLE_FIELD_CHOOSER_H__ - -#include <gnome.h> -#include <glade/glade.h> -#include <gal/e-table/e-table-header.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ETableFieldChooser - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define E_TABLE_FIELD_CHOOSER_TYPE (e_table_field_chooser_get_type ()) -#define E_TABLE_FIELD_CHOOSER(obj) (GTK_CHECK_CAST ((obj), E_TABLE_FIELD_CHOOSER_TYPE, ETableFieldChooser)) -#define E_TABLE_FIELD_CHOOSER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TABLE_FIELD_CHOOSER_TYPE, ETableFieldChooserClass)) -#define E_IS_TABLE_FIELD_CHOOSER(obj) (GTK_CHECK_TYPE ((obj), E_TABLE_FIELD_CHOOSER_TYPE)) -#define E_IS_TABLE_FIELD_CHOOSER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TABLE_FIELD_CHOOSER_TYPE)) - - -typedef struct _ETableFieldChooser ETableFieldChooser; -typedef struct _ETableFieldChooserClass ETableFieldChooserClass; - -struct _ETableFieldChooser -{ - GtkVBox parent; - - /* item specific fields */ - GladeXML *gui; - GnomeCanvas *canvas; - GnomeCanvasItem *item; - - GnomeCanvasItem *rect; - GtkAllocation last_alloc; - - gchar *dnd_code; - ETableHeader *full_header; -}; - -struct _ETableFieldChooserClass -{ - GtkVBoxClass parent_class; -}; - - -GtkWidget *e_table_field_chooser_new(void); -GtkType e_table_field_chooser_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TABLE_FIELD_CHOOSER_H__ */ diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c deleted file mode 100644 index 42d8fa0f49..0000000000 --- a/widgets/table/e-table-group-container.c +++ /dev/null @@ -1,1348 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-Table-Group.c: Implements the grouping objects for elements on a table - * - * Author: - * Chris Lahey <clahey@ximian.com> - * Miguel de Icaza (miguel@gnu.org) - * - * Copyright 1999, 2000 Ximian, Inc. - */ - -#include <config.h> -#include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> -#include "e-table-group-container.h" -#include "e-table-group-leaf.h" -#include "e-table-item.h" -#include "gal/util/e-util.h" -#include "gal/widgets/e-canvas.h" -#include "gal/widgets/e-canvas-utils.h" -#include "gal/e-text/e-text.h" -#include "e-table-defines.h" - -#define TITLE_HEIGHT 16 - -#define PARENT_TYPE e_table_group_get_type () - -static GnomeCanvasGroupClass *etgc_parent_class; - -/* The arguments we take */ -enum { - ARG_0, - ARG_HEIGHT, - ARG_WIDTH, - ARG_MINIMUM_WIDTH, - ARG_FROZEN, - ARG_TABLE_DRAW_GRID, - ARG_TABLE_DRAW_FOCUS, - ARG_CURSOR_MODE, - ARG_TABLE_SELECTION_MODEL, - ARG_LENGTH_THRESHOLD, -}; - -typedef struct { - ETableGroup *child; - void *key; - char *string; - GnomeCanvasItem *text; - GnomeCanvasItem *rect; - gint count; -} ETableGroupContainerChildNode; - -static EPrintable * -etgc_get_printable (ETableGroup *etg); - - -static void -e_table_group_container_child_node_free (ETableGroupContainer *etgc, - ETableGroupContainerChildNode *child_node) -{ - ETableGroup *etg = E_TABLE_GROUP (etgc); - ETableGroup *child = child_node->child; - - gtk_object_destroy (GTK_OBJECT (child)); - e_table_model_free_value (etg->model, etgc->ecol->col_idx, - child_node->key); - g_free(child_node->string); - gtk_object_destroy (GTK_OBJECT (child_node->text)); - gtk_object_destroy (GTK_OBJECT (child_node->rect)); -} - -static void -e_table_group_container_list_free (ETableGroupContainer *etgc) -{ - ETableGroupContainerChildNode *child_node; - GList *list; - - for (list = etgc->children; list; list = g_list_next (list)) { - child_node = (ETableGroupContainerChildNode *) list->data; - e_table_group_container_child_node_free (etgc, child_node); - } - - g_list_free (etgc->children); -} - -static void -etgc_destroy (GtkObject *object) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object); - - if (etgc->font) - gdk_font_unref (etgc->font); - etgc->font = NULL; - - if (etgc->ecol) - gtk_object_unref (GTK_OBJECT(etgc->ecol)); - - if (etgc->sort_info) - gtk_object_unref (GTK_OBJECT(etgc->sort_info)); - - if (etgc->table_selection_model) - gtk_object_unref (GTK_OBJECT(etgc->table_selection_model)); - - if (etgc->rect) - gtk_object_destroy (GTK_OBJECT(etgc->rect)); - - e_table_group_container_list_free (etgc); - - GTK_OBJECT_CLASS (etgc_parent_class)->destroy (object); -} - -/** - * e_table_group_container_construct - * @parent: The %GnomeCanvasGroup to create a child of. - * @etgc: The %ETableGroupContainer. - * @full_header: The full header of the %ETable. - * @header: The current header of the %ETable. - * @model: The %ETableModel of the %ETable. - * @sort_info: The %ETableSortInfo of the %ETable. - * @n: Which grouping level this is (Starts at 0 and sends n + 1 to any child %ETableGroups. - * - * This routine constructs the new %ETableGroupContainer. - */ -void -e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContainer *etgc, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, ETableSortInfo *sort_info, int n) -{ - ETableCol *col; - ETableSortColumn column = e_table_sort_info_grouping_get_nth(sort_info, n); - - col = e_table_header_get_column_by_col_idx(full_header, column.column); - if (col == NULL) - col = e_table_header_get_column (full_header, e_table_header_count (full_header) - 1); - - e_table_group_construct (parent, E_TABLE_GROUP (etgc), full_header, header, model); - etgc->ecol = col; - gtk_object_ref (GTK_OBJECT(etgc->ecol)); - etgc->sort_info = sort_info; - gtk_object_ref (GTK_OBJECT(etgc->sort_info)); - etgc->n = n; - etgc->ascending = column.ascending; - - - etgc->font = gdk_font_load ("lucidasans-10"); - if (!etgc->font){ - etgc->font = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style->font; - - gdk_font_ref (etgc->font); - } - etgc->open = TRUE; -} - -/** - * e_table_group_container_new - * @parent: The %GnomeCanvasGroup to create a child of. - * @full_header: The full header of the %ETable. - * @header: The current header of the %ETable. - * @model: The %ETableModel of the %ETable. - * @sort_info: The %ETableSortInfo of the %ETable. - * @n: Which grouping level this is (Starts at 0 and sends n + 1 to any child %ETableGroups. - * - * %ETableGroupContainer is an %ETableGroup which groups by the nth - * grouping of the %ETableSortInfo. It creates %ETableGroups as - * children. - * - * Returns: The new %ETableGroupContainer. - */ -ETableGroup * -e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, ETableSortInfo *sort_info, int n) -{ - ETableGroupContainer *etgc; - - g_return_val_if_fail (parent != NULL, NULL); - - etgc = gtk_type_new (e_table_group_container_get_type ()); - - e_table_group_container_construct (parent, etgc, full_header, header, - model, sort_info, n); - return E_TABLE_GROUP (etgc); -} - - -static int -etgc_event (GnomeCanvasItem *item, GdkEvent *event) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(item); - gboolean return_val = TRUE; - gboolean change_focus = FALSE; - gboolean use_col = FALSE; - gint start_col = 0; - gint old_col; - EFocus direction = E_FOCUS_START; - - switch (event->type) { - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - change_focus = TRUE; - use_col = TRUE; - start_col = (event->key.state & GDK_SHIFT_MASK) ? -1 : 0; - direction = (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START; - } else if (event->key.keyval == GDK_Left || - event->key.keyval == GDK_KP_Left) { - change_focus = TRUE; - use_col = TRUE; - start_col = -1; - direction = E_FOCUS_END; - } else if (event->key.keyval == GDK_Right || - event->key.keyval == GDK_KP_Right) { - change_focus = TRUE; - use_col = TRUE; - start_col = 0; - direction = E_FOCUS_START; - } else if (event->key.keyval == GDK_Down || - event->key.keyval == GDK_KP_Down) { - change_focus = TRUE; - use_col = FALSE; - direction = E_FOCUS_START; - } else if (event->key.keyval == GDK_Up || - event->key.keyval == GDK_KP_Up) { - change_focus = TRUE; - use_col = FALSE; - direction = E_FOCUS_END; - } else if (event->key.keyval == GDK_Return || - event->key.keyval == GDK_KP_Enter) { - change_focus = TRUE; - use_col = FALSE; - direction = E_FOCUS_START; - } - if (change_focus){ - GList *list; - for (list = etgc->children; list; list = list->next) { - ETableGroupContainerChildNode *child_node; - ETableGroup *child; - - child_node = (ETableGroupContainerChildNode *)list->data; - child = child_node->child; - - if (e_table_group_get_focus (child)) { - old_col = e_table_group_get_focus_column (child); - if (old_col == -1) - old_col = 0; - if (start_col == -1) - start_col = e_table_header_count (e_table_group_get_header (child)) - 1; - - if (direction == E_FOCUS_END) - list = list->prev; - else - list = list->next; - - if (list) { - child_node = (ETableGroupContainerChildNode *)list->data; - child = child_node->child; - if (use_col) - e_table_group_set_focus (child, direction, start_col); - else - e_table_group_set_focus (child, direction, old_col); - return 1; - } else { - return 0; - } - } - } - if (direction == E_FOCUS_END) - list = g_list_last(etgc->children); - else - list = etgc->children; - if (list) { - ETableGroupContainerChildNode *child_node; - ETableGroup *child; - - child_node = (ETableGroupContainerChildNode *)list->data; - child = child_node->child; - - if (start_col == -1) - start_col = e_table_header_count (e_table_group_get_header (child)) - 1; - - e_table_group_set_focus (child, direction, start_col); - return 1; - } - } - return_val = FALSE; - break; - default: - return_val = FALSE; - break; - } - if (return_val == FALSE) { - if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->event (item, event); - } - return return_val; - -} - -/* Realize handler for the text item */ -static void -etgc_realize (GnomeCanvasItem *item) -{ - ETableGroupContainer *etgc; - - if (GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->realize) (item); - - etgc = E_TABLE_GROUP_CONTAINER (item); - - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc)); -} - -/* Unrealize handler for the etgc item */ -static void -etgc_unrealize (GnomeCanvasItem *item) -{ - ETableGroupContainer *etgc; - - etgc = E_TABLE_GROUP_CONTAINER (item); - - if (GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->unrealize) (item); -} - -static void -compute_text (ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_node) -{ - gchar *text; - if (etgc->ecol->text) - text = g_strdup_printf ("%s : %s (%d item%s)", - etgc->ecol->text, - child_node->string, - (gint) child_node->count, - child_node->count == 1 ? "" : "s"); - else - text = g_strdup_printf ("%s (%d item%s)", - child_node->string, - (gint) child_node->count, - child_node->count == 1 ? "" : "s"); - gnome_canvas_item_set (child_node->text, - "text", text, - NULL); - g_free (text); -} - -static void -child_cursor_change (ETableGroup *etg, int row, - ETableGroupContainer *etgc) -{ - e_table_group_cursor_change (E_TABLE_GROUP (etgc), row); -} - -static void -child_cursor_activated (ETableGroup *etg, int row, - ETableGroupContainer *etgc) -{ - e_table_group_cursor_activated (E_TABLE_GROUP (etgc), row); -} - -static void -child_double_click (ETableGroup *etg, int row, int col, GdkEvent *event, - ETableGroupContainer *etgc) -{ - e_table_group_double_click (E_TABLE_GROUP (etgc), row, col, event); -} - -static gint -child_right_click (ETableGroup *etg, int row, int col, GdkEvent *event, - ETableGroupContainer *etgc) -{ - return e_table_group_right_click (E_TABLE_GROUP (etgc), row, col, event); -} - -static gint -child_click (ETableGroup *etg, int row, int col, GdkEvent *event, - ETableGroupContainer *etgc) -{ - return e_table_group_click (E_TABLE_GROUP (etgc), row, col, event); -} - -static gint -child_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, - ETableGroupContainer *etgc) -{ - return e_table_group_key_press (E_TABLE_GROUP (etgc), row, col, event); -} - -static ETableGroupContainerChildNode * -create_child_node (ETableGroupContainer *etgc, void *val) -{ - ETableGroup *child; - ETableGroupContainerChildNode *child_node; - ETableGroup *etg = E_TABLE_GROUP(etgc); - - child_node = g_new (ETableGroupContainerChildNode, 1); - child_node->rect = gnome_canvas_item_new (GNOME_CANVAS_GROUP (etgc), - gnome_canvas_rect_get_type (), - "fill_color", "grey70", - "outline_color", "grey50", - NULL); - child_node->text = gnome_canvas_item_new (GNOME_CANVAS_GROUP (etgc), - e_text_get_type (), - "font_gdk", etgc->font, - "anchor", GTK_ANCHOR_SW, - "fill_color", "black", - "draw_background", FALSE, - NULL); - child = e_table_group_new (GNOME_CANVAS_GROUP (etgc), etg->full_header, - etg->header, etg->model, etgc->sort_info, etgc->n + 1); - gnome_canvas_item_set(GNOME_CANVAS_ITEM(child), - "drawgrid", etgc->draw_grid, - "drawfocus", etgc->draw_focus, - "cursor_mode", etgc->cursor_mode, - "table_selection_model", etgc->table_selection_model, - "length_threshold", etgc->length_threshold, - "minimum_width", etgc->minimum_width - GROUP_INDENT, - NULL); - - gtk_signal_connect (GTK_OBJECT (child), "cursor_change", - GTK_SIGNAL_FUNC (child_cursor_change), etgc); - gtk_signal_connect (GTK_OBJECT (child), "cursor_activated", - GTK_SIGNAL_FUNC (child_cursor_activated), etgc); - gtk_signal_connect (GTK_OBJECT (child), "double_click", - GTK_SIGNAL_FUNC (child_double_click), etgc); - gtk_signal_connect (GTK_OBJECT (child), "right_click", - GTK_SIGNAL_FUNC (child_right_click), etgc); - gtk_signal_connect (GTK_OBJECT (child), "click", - GTK_SIGNAL_FUNC (child_click), etgc); - gtk_signal_connect (GTK_OBJECT (child), "key_press", - GTK_SIGNAL_FUNC (child_key_press), etgc); - child_node->child = child; - child_node->key = e_table_model_duplicate_value (etg->model, etgc->ecol->col_idx, val); - child_node->string = e_table_model_value_to_string (etg->model, etgc->ecol->col_idx, val); - child_node->count = 0; - - return child_node; -} - -static void -etgc_add (ETableGroup *etg, gint row) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); - void *val = e_table_model_value_at (etg->model, etgc->ecol->col_idx, row); - GCompareFunc comp = etgc->ecol->compare; - GList *list = etgc->children; - ETableGroup *child; - ETableGroupContainerChildNode *child_node; - int i = 0; - - for (; list; list = g_list_next (list), i++){ - int comp_val; - - child_node = list->data; - comp_val = (*comp)(child_node->key, val); - if (comp_val == 0) { - child = child_node->child; - child_node->count ++; - e_table_group_add (child, row); - compute_text (etgc, child_node); - return; - } - if ((comp_val > 0 && etgc->ascending) || - (comp_val < 0 && (!etgc->ascending))) - break; - } - child_node = create_child_node (etgc, val); - child = child_node->child; - child_node->count = 1; - e_table_group_add (child, row); - - if (list) - etgc->children = g_list_insert (etgc->children, child_node, i); - else - etgc->children = g_list_append (etgc->children, child_node); - - compute_text (etgc, child_node); - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc)); -} - -static void -etgc_add_array (ETableGroup *etg, const int *array, int count) -{ - int i; - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); - void *lastval = 0; - int laststart = 0; - GCompareFunc comp = etgc->ecol->compare; - ETableGroupContainerChildNode *child_node; - ETableGroup *child; - - if (count <= 0) - return; - - e_table_group_container_list_free (etgc); - etgc->children = NULL; - - lastval = e_table_model_value_at (etg->model, etgc->ecol->col_idx, array[0]); - - for (i = 1; i < count; i++) { - void *val = e_table_model_value_at (etg->model, etgc->ecol->col_idx, array[i]); - int comp_val; - - comp_val = (*comp)(lastval, val); - if (comp_val != 0) { - child_node = create_child_node(etgc, lastval); - child = child_node->child; - - e_table_group_add_array(child, array + laststart, i - laststart); - child_node->count = i - laststart; - - etgc->children = g_list_append (etgc->children, child_node); - compute_text (etgc, child_node); - laststart = i; - lastval = val; - } - } - - child_node = create_child_node(etgc, lastval); - child = child_node->child; - - e_table_group_add_array(child, array + laststart, i - laststart); - child_node->count = i - laststart; - - etgc->children = g_list_append (etgc->children, child_node); - compute_text (etgc, child_node); - - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc)); -} - -static void -etgc_add_all (ETableGroup *etg) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); - ESorter *sorter = E_SELECTION_MODEL(etgc->table_selection_model)->sorter; - int *array; - int count; - - e_sorter_get_sorted_to_model_array(sorter, &array, &count); - - etgc_add_array(etg, array, count); -} - -static gboolean -etgc_remove (ETableGroup *etg, gint row) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - GList *list; - - for (list = etgc->children ; list; list = g_list_next (list)) { - ETableGroupContainerChildNode *child_node = list->data; - ETableGroup *child = child_node->child; - - if (e_table_group_remove (child, row)) { - child_node->count --; - if (child_node->count == 0) { - e_table_group_container_child_node_free (etgc, child_node); - etgc->children = g_list_remove (etgc->children, child_node); - g_free (child_node); - } else - compute_text (etgc, child_node); - - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc)); - - return TRUE; - } - } - return FALSE; -} - -static int -etgc_row_count (ETableGroup *etg) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - GList *list; - gint count = 0; - for (list = etgc->children; list; list = g_list_next(list)) { - ETableGroup *group = ((ETableGroupContainerChildNode *)list->data)->child; - gint this_count = e_table_group_row_count(group); - count += this_count; - } - return count; -} - -static void -etgc_increment (ETableGroup *etg, gint position, gint amount) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - GList *list = etgc->children; - - for (list = etgc->children ; list; list = g_list_next (list)) - e_table_group_increment (((ETableGroupContainerChildNode *)list->data)->child, - position, amount); -} - -static void -etgc_decrement (ETableGroup *etg, gint position, gint amount) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - GList *list = etgc->children; - - for (list = etgc->children ; list; list = g_list_next (list)) - e_table_group_decrement (((ETableGroupContainerChildNode *)list->data)->child, - position, amount); -} - -static void -etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - if (etgc->children) { - if (direction == E_FOCUS_END) - e_table_group_set_focus (((ETableGroupContainerChildNode *)g_list_last (etgc->children)->data)->child, - direction, view_col); - else - e_table_group_set_focus (((ETableGroupContainerChildNode *)etgc->children->data)->child, - direction, view_col); - } -} - -static gint -etgc_get_focus_column (ETableGroup *etg) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - if (etgc->children) { - GList *list; - for (list = etgc->children; list; list = list->next) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - ETableGroup *child = child_node->child; - if (e_table_group_get_focus (child)) { - return e_table_group_get_focus_column (child); - } - } - } - return 0; -} - -static void -etgc_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - - if (row) - *row = -1; - if (col) - *col = -1; - - *x -= GROUP_INDENT; - *y -= TITLE_HEIGHT; - - if (*x >= 0 && *y >= 0 && etgc->children) { - GList *list; - for (list = etgc->children; list; list = list->next) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - ETableGroup *child = child_node->child; - - e_table_group_compute_location (child, x, y, row, col); - if ((*row != -1) && (*col != -1)) - return; - } - } -} - -static void etgc_thaw (ETableGroup *etg) -{ - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(etg)); -} - -static void -etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object); - GList *list; - - switch (arg_id) { - case ARG_FROZEN: - if (GTK_VALUE_BOOL (*arg)) - etg->frozen = TRUE; - else { - etg->frozen = FALSE; - etgc_thaw (etg); - } - break; - case ARG_MINIMUM_WIDTH: - case ARG_WIDTH: - etgc->minimum_width = GTK_VALUE_DOUBLE(*arg); - - for (list = etgc->children; list; list = g_list_next (list)) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - gtk_object_set (GTK_OBJECT(child_node->child), - "minimum_width", etgc->minimum_width - GROUP_INDENT, - NULL); - } - break; - case ARG_LENGTH_THRESHOLD: - etgc->length_threshold = GTK_VALUE_INT (*arg); - for (list = etgc->children; list; list = g_list_next (list)) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - gtk_object_set (GTK_OBJECT(child_node->child), - "length_threshold", GTK_VALUE_INT (*arg), - NULL); - } - break; - - case ARG_TABLE_SELECTION_MODEL: - if (etgc->table_selection_model) - gtk_object_unref(GTK_OBJECT(etgc->table_selection_model)); - etgc->table_selection_model = E_TABLE_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg)); - if (etgc->table_selection_model) - gtk_object_ref(GTK_OBJECT(etgc->table_selection_model)); - for (list = etgc->children; list; list = g_list_next (list)) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - gtk_object_set (GTK_OBJECT(child_node->child), - "table_selection_model", etgc->table_selection_model, - NULL); - } - break; - - case ARG_TABLE_DRAW_GRID: - etgc->draw_grid = GTK_VALUE_BOOL (*arg); - for (list = etgc->children; list; list = g_list_next (list)) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - gtk_object_set (GTK_OBJECT(child_node->child), - "drawgrid", GTK_VALUE_BOOL (*arg), - NULL); - } - break; - - case ARG_TABLE_DRAW_FOCUS: - etgc->draw_focus = GTK_VALUE_BOOL (*arg); - for (list = etgc->children; list; list = g_list_next (list)) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - gtk_object_set (GTK_OBJECT(child_node->child), - "drawfocus", GTK_VALUE_BOOL (*arg), - NULL); - } - break; - - case ARG_CURSOR_MODE: - etgc->cursor_mode = GTK_VALUE_INT (*arg); - for (list = etgc->children; list; list = g_list_next (list)) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - gtk_object_set (GTK_OBJECT(child_node->child), - "cursor_mode", GTK_VALUE_INT (*arg), - NULL); - } - break; - default: - break; - } -} - -static void -etgc_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object); - - switch (arg_id) { - case ARG_FROZEN: - GTK_VALUE_BOOL (*arg) = etg->frozen; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = etgc->height; - break; - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = etgc->width; - break; - case ARG_MINIMUM_WIDTH: - etgc->minimum_width = GTK_VALUE_DOUBLE(*arg); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -etgc_class_init (GtkObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS(object_class); - - object_class->destroy = etgc_destroy; - object_class->set_arg = etgc_set_arg; - object_class->get_arg = etgc_get_arg; - - item_class->event = etgc_event; - item_class->realize = etgc_realize; - item_class->unrealize = etgc_unrealize; - - etgc_parent_class = gtk_type_class (PARENT_TYPE); - - e_group_class->add = etgc_add; - e_group_class->add_array = etgc_add_array; - e_group_class->add_all = etgc_add_all; - e_group_class->remove = etgc_remove; - e_group_class->increment = etgc_increment; - e_group_class->decrement = etgc_decrement; - e_group_class->row_count = etgc_row_count; - e_group_class->set_focus = etgc_set_focus; - e_group_class->get_focus_column = etgc_get_focus_column; - e_group_class->get_printable = etgc_get_printable; - e_group_class->compute_location = etgc_compute_location; - - gtk_object_add_arg_type ("ETableGroupContainer::drawgrid", GTK_TYPE_BOOL, - GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID); - gtk_object_add_arg_type ("ETableGroupContainer::drawfocus", GTK_TYPE_BOOL, - GTK_ARG_WRITABLE, ARG_TABLE_DRAW_FOCUS); - gtk_object_add_arg_type ("ETableGroupContainer::cursor_mode", GTK_TYPE_INT, - GTK_ARG_WRITABLE, ARG_CURSOR_MODE); - gtk_object_add_arg_type ("ETableGroupContainer::table_selection_model", GTK_TYPE_OBJECT, - GTK_ARG_WRITABLE, ARG_TABLE_SELECTION_MODEL); - gtk_object_add_arg_type ("ETableGroupContainer::length_threshold", GTK_TYPE_INT, - GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD); - - gtk_object_add_arg_type ("ETableGroupContainer::frozen", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_FROZEN); - gtk_object_add_arg_type ("ETableGroupContainer::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("ETableGroupContainer::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableGroupContainer::minimum_width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH); -} - -static void -etgc_reflow (GnomeCanvasItem *item, gint flags) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(item); - gboolean frozen; - - gtk_object_get (GTK_OBJECT(etgc), - "frozen", &frozen, - NULL); - - if (frozen) - return; - - - if (GTK_OBJECT_FLAGS(etgc)& GNOME_CANVAS_ITEM_REALIZED){ - gdouble running_height = 0; - gdouble running_width = 0; - gdouble old_height; - gdouble old_width; - - old_height = etgc->height; - old_width = etgc->width; - if (etgc->children == NULL){ - } else { - GList *list; - gdouble extra_height = 0; - gdouble item_height = 0; - gdouble item_width = 0; - - if (etgc->font) - extra_height += etgc->font->ascent + etgc->font->descent + BUTTON_PADDING * 2; - - extra_height = MAX(extra_height, BUTTON_HEIGHT + BUTTON_PADDING * 2); - - running_height = extra_height; - - for ( list = etgc->children; list; list = g_list_next (list)){ - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data; - ETableGroup *child = child_node->child; - - gtk_object_get (GTK_OBJECT(child), - "width", &item_width, - NULL); - - if (item_width > running_width) - running_width = item_width; - } - for ( list = etgc->children; list; list = g_list_next (list)){ - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data; - ETableGroup *child = child_node->child; - gtk_object_get (GTK_OBJECT(child), - "height", &item_height, - NULL); - - e_canvas_item_move_absolute (GNOME_CANVAS_ITEM(child_node->text), - GROUP_INDENT, - running_height - BUTTON_PADDING); - - e_canvas_item_move_absolute (GNOME_CANVAS_ITEM(child), - GROUP_INDENT, - running_height); - - gnome_canvas_item_set (GNOME_CANVAS_ITEM(child_node->rect), - "x1", (double) 0, - "x2", (double) running_width + GROUP_INDENT, - "y1", (double) running_height - extra_height, - "y2", (double) running_height + item_height, - NULL); - - running_height += item_height + extra_height; - } - running_height -= extra_height; - } - if (running_height != old_height || running_width != old_width) { - etgc->height = running_height; - etgc->width = running_width; - e_canvas_item_request_parent_reflow (item); - } - } -} - -static void -etgc_init (GtkObject *object) -{ - ETableGroupContainer *container = E_TABLE_GROUP_CONTAINER(object); - container->children = FALSE; - - e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM(object), etgc_reflow); - - container->draw_grid = 1; - container->draw_focus = 1; - container->cursor_mode = E_CURSOR_SIMPLE; - container->length_threshold = -1; - container->table_selection_model = NULL; -} - -E_MAKE_TYPE (e_table_group_container, "ETableGroupContainer", ETableGroupContainer, etgc_class_init, etgc_init, PARENT_TYPE); - -void -e_table_group_apply_to_leafs (ETableGroup *etg, ETableGroupLeafFn fn, void *closure) -{ - if (E_IS_TABLE_GROUP_CONTAINER (etg)){ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); - GList *list = etgc->children; - - /* Protect from unrefs in the callback functions */ - gtk_object_ref (GTK_OBJECT (etg)); - - for (list = etgc->children; list; list = list->next){ - ETableGroupContainerChildNode *child_node = list->data; - - e_table_group_apply_to_leafs (child_node->child, fn, closure); - } - - gtk_object_unref (GTK_OBJECT (etg)); - } else if (E_IS_TABLE_GROUP_LEAF (etg)){ - (*fn) (E_TABLE_GROUP_LEAF (etg)->item, closure); - } else { - g_error ("Unknown ETableGroup found: %s", - gtk_type_name (GTK_OBJECT (etg)->klass->type)); - } -} - - -typedef struct { - ETableGroupContainer *etgc; - GList *child; - EPrintable *child_printable; -} ETGCPrintContext; - -#if 0 -#define CHECK(x) if((x) == -1) return -1; - -static gint -gp_draw_rect (GnomePrintContext *context, gdouble x, gdouble y, gdouble width, gdouble height, gdouble r, gdouble g, gdouble b) -{ - CHECK(gnome_print_moveto(context, x, y)); - CHECK(gnome_print_lineto(context, x + width, y)); - CHECK(gnome_print_lineto(context, x + width, y - height)); - CHECK(gnome_print_lineto(context, x, y - height)); - CHECK(gnome_print_lineto(context, x, y)); - return gnome_print_fill(context); -} -#endif - -#define CHECK(x) if((x) == -1) return -1; - -static gint -gp_draw_rect (GnomePrintContext *context, gdouble x, gdouble y, gdouble width, gdouble height) -{ - CHECK(gnome_print_moveto(context, x, y)); - CHECK(gnome_print_lineto(context, x + width, y)); - CHECK(gnome_print_lineto(context, x + width, y - height)); - CHECK(gnome_print_lineto(context, x, y - height)); - CHECK(gnome_print_lineto(context, x, y)); - return gnome_print_fill(context); -} - -#define TEXT_HEIGHT (12) -#define TEXT_AREA_HEIGHT (TEXT_HEIGHT + 4) - -static void -e_table_group_container_print_page (EPrintable *ep, - GnomePrintContext *context, - gdouble width, - gdouble height, - gboolean quantize, - ETGCPrintContext *groupcontext) -{ - gdouble yd = height; - gdouble child_height; - ETableGroupContainerChildNode *child_node; - GList *child; - EPrintable *child_printable; - gchar *string; - - GnomeFont *font = gnome_font_new ("Helvetica", TEXT_HEIGHT); - - child_printable = groupcontext->child_printable; - child = groupcontext->child; - - if (child_printable) { - if (child) - child_node = child->data; - else - child_node = NULL; - gtk_object_ref(GTK_OBJECT(child_printable)); - } else { - if (!child) { - return; - } else { - child_node = child->data; - child_printable = e_table_group_get_printable(child_node->child); - if (child_printable) - gtk_object_ref(GTK_OBJECT(child_printable)); - e_printable_reset(child_printable); - } - } - - while (1) { - child_height = e_printable_height(child_printable, context, width - 36, yd - TEXT_AREA_HEIGHT, quantize); - - if (gnome_print_gsave(context) == -1) - /* FIXME */; - if (gnome_print_moveto(context, 0, yd - child_height - TEXT_AREA_HEIGHT) == -1) - /* FIXME */; - if (gnome_print_lineto(context, 36, yd - child_height - TEXT_AREA_HEIGHT) == -1) - /* FIXME */; - if (gnome_print_lineto(context, 36, yd - TEXT_AREA_HEIGHT) == -1) - /* FIXME */; - if (gnome_print_lineto(context, width, yd - TEXT_AREA_HEIGHT) == -1) - /* FIXME */; - if (gnome_print_lineto(context, width, yd) == -1) - /* FIXME */; - if (gnome_print_lineto(context, 0, yd) == -1) - /* FIXME */; - if (gnome_print_lineto(context, 0, yd - child_height - TEXT_AREA_HEIGHT) == -1) - /* FIXME */; - if (gnome_print_setrgbcolor(context, .7, .7, .7) == -1) - /* FIXME */; - if (gnome_print_fill(context) == -1) - /* FIXME */; - if (gnome_print_grestore(context) == -1) - /* FIXME */; - - if (gnome_print_gsave(context) == -1) - /* FIXME */; - if (gnome_print_moveto(context, 0, yd - TEXT_AREA_HEIGHT) == -1) - /* FIXME */; - if (gnome_print_lineto(context, width, yd - TEXT_AREA_HEIGHT) == -1) - /* FIXME */; - if (gnome_print_lineto(context, width, yd) == -1) - /* FIXME */; - if (gnome_print_lineto(context, 0, yd) == -1) - /* FIXME */; - if (gnome_print_lineto(context, 0, yd - TEXT_AREA_HEIGHT) == -1) - /* FIXME */; - if (gnome_print_clip(context) == -1) - /* FIXME */; - - if (gnome_print_moveto(context, 2, yd - (TEXT_AREA_HEIGHT + gnome_font_get_ascender(font) - gnome_font_get_descender(font)) / 2) == -1) - /* FIXME */; - if (gnome_print_setfont(context, font)) - /* FIXME */; - if (groupcontext->etgc->ecol->text) - string = g_strdup_printf ("%s : %s (%d item%s)", - groupcontext->etgc->ecol->text, - child_node->string, - (gint) child_node->count, - child_node->count == 1 ? "" : "s"); - else - string = g_strdup_printf ("%s (%d item%s)", - child_node->string, - (gint) child_node->count, - child_node->count == 1 ? "" : "s"); - if (gnome_print_show(context, string)) - /* FIXME */; - g_free(string); - if (gnome_print_grestore(context) == -1) - /* FIXME */; - - if (gnome_print_gsave(context) == -1) - /* FIXME */; - if (gnome_print_translate(context, 36, yd - TEXT_AREA_HEIGHT - child_height) == -1) - /* FIXME */; - if (gnome_print_moveto(context, 0, 0) == -1) - /* FIXME */; - if (gnome_print_lineto(context, width - 36, 0) == -1) - /* FIXME */; - if (gnome_print_lineto(context, width - 36, child_height) == -1) - /* FIXME */; - if (gnome_print_lineto(context, 0, child_height) == -1) - /* FIXME */; - if (gnome_print_lineto(context, 0, 0) == -1) - /* FIXME */; - if (gnome_print_clip(context) == -1) - /* FIXME */; - e_printable_print_page(child_printable, context, width - 36, child_height, quantize); - if (gnome_print_grestore(context) == -1) - /* FIXME */; - - gp_draw_rect(context, 0, yd - child_height - TEXT_AREA_HEIGHT + 1, width, 1); - gp_draw_rect(context, width - 1, yd, 1, yd - child_height - TEXT_AREA_HEIGHT); - gp_draw_rect(context, 0, yd, 1, yd - child_height - TEXT_AREA_HEIGHT); - - yd -= child_height + TEXT_AREA_HEIGHT; - - if (e_printable_data_left(child_printable)) - break; - - child = child->next; - if (!child) { - child_printable = NULL; - break; - } - - child_node = child->data; - if (child_printable) - gtk_object_unref(GTK_OBJECT(child_printable)); - child_printable = e_table_group_get_printable(child_node->child); - if (child_printable) - gtk_object_ref(GTK_OBJECT(child_printable)); - e_printable_reset(child_printable); - } - - gp_draw_rect(context, 0, height, width, 1); - - if (groupcontext->child_printable) - gtk_object_unref(GTK_OBJECT(groupcontext->child_printable)); - groupcontext->child_printable = child_printable; - groupcontext->child = child; - -} - -static gboolean -e_table_group_container_data_left (EPrintable *ep, - ETGCPrintContext *groupcontext) -{ - gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "data_left"); - return groupcontext->child != NULL; -} - -static void -e_table_group_container_reset (EPrintable *ep, - ETGCPrintContext *groupcontext) -{ - groupcontext->child = groupcontext->etgc->children; - if (groupcontext->child_printable) - gtk_object_unref(GTK_OBJECT(groupcontext->child_printable)); - groupcontext->child_printable = NULL; -} - -static gdouble -e_table_group_container_height (EPrintable *ep, - GnomePrintContext *context, - gdouble width, - gdouble max_height, - gboolean quantize, - ETGCPrintContext *groupcontext) -{ - gdouble height = 0; - gdouble child_height; - gdouble yd = max_height; - ETableGroupContainerChildNode *child_node; - GList *child; - EPrintable *child_printable; - - child_printable = groupcontext->child_printable; - child = groupcontext->child; - - if (child_printable) - gtk_object_ref(GTK_OBJECT(child_printable)); - else { - if (!child) { - gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "height"); - return 0; - } else { - child_node = child->data; - child_printable = e_table_group_get_printable(child_node->child); - if (child_printable) - gtk_object_ref(GTK_OBJECT(child_printable)); - e_printable_reset(child_printable); - } - } - - if (yd != -1 && yd < TEXT_AREA_HEIGHT) - return 0; - - while (1) { - child_height = e_printable_height(child_printable, context, width - 36, yd - (yd == -1 ? 0 : TEXT_AREA_HEIGHT), quantize); - - height += child_height + TEXT_AREA_HEIGHT; - - if (yd != -1) { - if (!e_printable_will_fit(child_printable, context, width - 36, yd - (yd == -1 ? 0 : TEXT_AREA_HEIGHT), quantize)) { - break; - } - - yd -= child_height + TEXT_AREA_HEIGHT; - } - - child = child->next; - if (!child) { - break; - } - - child_node = child->data; - if (child_printable) - gtk_object_unref(GTK_OBJECT(child_printable)); - child_printable = e_table_group_get_printable(child_node->child); - if (child_printable) - gtk_object_ref(GTK_OBJECT(child_printable)); - e_printable_reset(child_printable); - } - if (child_printable) - gtk_object_unref(GTK_OBJECT(child_printable)); - gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "height"); - return height; -} - -static gboolean -e_table_group_container_will_fit (EPrintable *ep, - GnomePrintContext *context, - gdouble width, - gdouble max_height, - gboolean quantize, - ETGCPrintContext *groupcontext) -{ - gboolean will_fit = TRUE; - gdouble child_height; - gdouble yd = max_height; - ETableGroupContainerChildNode *child_node; - GList *child; - EPrintable *child_printable; - - child_printable = groupcontext->child_printable; - child = groupcontext->child; - - if (child_printable) - gtk_object_ref(GTK_OBJECT(child_printable)); - else { - if (!child) { - gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "will_fit"); - return will_fit; - } else { - child_node = child->data; - child_printable = e_table_group_get_printable(child_node->child); - if (child_printable) - gtk_object_ref(GTK_OBJECT(child_printable)); - e_printable_reset(child_printable); - } - } - - if (yd != -1 && yd < TEXT_AREA_HEIGHT) - will_fit = FALSE; - else { - while (1) { - child_height = e_printable_height(child_printable, context, width - 36, yd - (yd == -1 ? 0 : TEXT_AREA_HEIGHT), quantize); - - if (yd != -1) { - if (!e_printable_will_fit(child_printable, context, width - 36, yd - (yd == -1 ? 0 : TEXT_AREA_HEIGHT), quantize)) { - will_fit = FALSE; - break; - } - - yd -= child_height + TEXT_AREA_HEIGHT; - } - - child = child->next; - if (!child) { - break; - } - - child_node = child->data; - if (child_printable) - gtk_object_unref(GTK_OBJECT(child_printable)); - child_printable = e_table_group_get_printable(child_node->child); - if (child_printable) - gtk_object_ref(GTK_OBJECT(child_printable)); - e_printable_reset(child_printable); - } - } - - if (child_printable) - gtk_object_unref(GTK_OBJECT(child_printable)); - - gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "will_fit"); - return will_fit; -} - -static void -e_table_group_container_printable_destroy (GtkObject *object, - ETGCPrintContext *groupcontext) -{ - gtk_object_unref(GTK_OBJECT(groupcontext->etgc)); - if (groupcontext->child_printable) - gtk_object_ref(GTK_OBJECT(groupcontext->child_printable)); - g_free(groupcontext); -} - -static EPrintable * -etgc_get_printable (ETableGroup *etg) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - EPrintable *printable = e_printable_new(); - ETGCPrintContext *groupcontext; - - groupcontext = g_new(ETGCPrintContext, 1); - groupcontext->etgc = etgc; - gtk_object_ref(GTK_OBJECT(etgc)); - groupcontext->child = etgc->children; - groupcontext->child_printable = NULL; - - gtk_signal_connect (GTK_OBJECT(printable), - "print_page", - GTK_SIGNAL_FUNC(e_table_group_container_print_page), - groupcontext); - gtk_signal_connect (GTK_OBJECT(printable), - "data_left", - GTK_SIGNAL_FUNC(e_table_group_container_data_left), - groupcontext); - gtk_signal_connect (GTK_OBJECT(printable), - "reset", - GTK_SIGNAL_FUNC(e_table_group_container_reset), - groupcontext); - gtk_signal_connect (GTK_OBJECT(printable), - "height", - GTK_SIGNAL_FUNC(e_table_group_container_height), - groupcontext); - gtk_signal_connect (GTK_OBJECT(printable), - "will_fit", - GTK_SIGNAL_FUNC(e_table_group_container_will_fit), - groupcontext); - gtk_signal_connect (GTK_OBJECT(printable), - "destroy", - GTK_SIGNAL_FUNC(e_table_group_container_printable_destroy), - groupcontext); - - return printable; -} diff --git a/widgets/table/e-table-group-container.h b/widgets/table/e-table-group-container.h deleted file mode 100644 index 27ed807ffc..0000000000 --- a/widgets/table/e-table-group-container.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_GROUP_CONTAINER_H_ -#define _E_TABLE_GROUP_CONTAINER_H_ - -#include <libgnomeui/gnome-canvas.h> -#include <gal/e-table/e-table-model.h> -#include <gal/e-table/e-table-header.h> -#include <gal/e-table/e-table-group.h> -#include <gal/e-table/e-table-item.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_GROUP_CONTAINER_TYPE (e_table_group_container_get_type ()) -#define E_TABLE_GROUP_CONTAINER(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_CONTAINER_TYPE, ETableGroupContainer)) -#define E_TABLE_GROUP_CONTAINER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_GROUP_CONTAINER_TYPE, ETableGroupContainerClass)) -#define E_IS_TABLE_GROUP_CONTAINER(o) (GTK_CHECK_TYPE ((o), E_TABLE_GROUP_CONTAINER_TYPE)) -#define E_IS_TABLE_GROUP_CONTAINER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_CONTAINER_TYPE)) - -typedef struct { - ETableGroup group; - - /* - * The ETableCol used to group this set - */ - ETableCol *ecol; - gint ascending; - - /* - * List of ETableGroups we stack - */ - GList *children; - - /* - * The canvas rectangle that contains the children - */ - GnomeCanvasItem *rect; - - GdkFont *font; - - gdouble width, height, minimum_width; - - ETableSortInfo *sort_info; - int n; - int length_threshold; - - ETableSelectionModel *table_selection_model; - - guint draw_grid : 1; - guint draw_focus : 1; - ECursorMode cursor_mode; - - /* - * State: the ETableGroup is open or closed - */ - guint open:1; -} ETableGroupContainer; - -typedef struct { - ETableGroupClass parent_class; -} ETableGroupContainerClass; - -ETableGroup *e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header, ETableHeader *header, - ETableModel *model, ETableSortInfo *sort_info, int n); -void e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContainer *etgc, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, ETableSortInfo *sort_info, int n); - -GtkType e_table_group_container_get_type (void); - -END_GNOME_DECLS - -#endif /* _E_TABLE_GROUP_CONTAINER_H_ */ diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c deleted file mode 100644 index 35e7ef4f45..0000000000 --- a/widgets/table/e-table-group-leaf.c +++ /dev/null @@ -1,463 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-Table-Group.c: Implements the grouping objects for elements on a table - * - * Author: - * Miguel de Icaza (miguel@gnu.org () - * - * Copyright 1999, Ximian, Inc. - */ - -#include <config.h> -#include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> -#include "e-table-group-leaf.h" -#include "e-table-item.h" -#include "e-table-sorted-variable.h" -#include "e-table-sorted.h" -#include "gal/util/e-util.h" -#include "gal/widgets/e-canvas.h" - -#define PARENT_TYPE e_table_group_get_type () - -static GnomeCanvasGroupClass *etgl_parent_class; - -/* The arguments we take */ -enum { - ARG_0, - ARG_HEIGHT, - ARG_WIDTH, - ARG_MINIMUM_WIDTH, - ARG_FROZEN, - ARG_TABLE_DRAW_GRID, - ARG_TABLE_DRAW_FOCUS, - ARG_CURSOR_MODE, - ARG_LENGTH_THRESHOLD, - ARG_TABLE_SELECTION_MODEL, -}; - -static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void etgl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static void -etgl_destroy (GtkObject *object) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF(object); - if (etgl->ets) - gtk_object_unref (GTK_OBJECT(etgl->ets)); - if (etgl->item) - gtk_object_destroy (GTK_OBJECT(etgl->item)); - if (etgl->table_selection_model) - gtk_object_unref (GTK_OBJECT(etgl->table_selection_model)); - if (GTK_OBJECT_CLASS (etgl_parent_class)->destroy) - GTK_OBJECT_CLASS (etgl_parent_class)->destroy (object); -} - -static void -e_table_group_leaf_construct (GnomeCanvasGroup *parent, - ETableGroupLeaf *etgl, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - ETableSortInfo *sort_info) -{ - etgl->is_grouped = e_table_sort_info_grouping_get_count(sort_info); - if (etgl->is_grouped) - etgl->ets = E_TABLE_SUBSET(e_table_sorted_variable_new (model, full_header, sort_info)); - else - etgl->ets = E_TABLE_SUBSET(e_table_sorted_new (model, full_header, sort_info)); - gtk_object_ref(GTK_OBJECT(etgl->ets)); - gtk_object_sink(GTK_OBJECT(etgl->ets)); - e_table_group_construct (parent, E_TABLE_GROUP (etgl), full_header, header, model); -} - -/** - * e_table_group_leaf_new - * @parent: The %GnomeCanvasGroup to create a child of. - * @full_header: The full header of the %ETable. - * @header: The current header of the %ETable. - * @model: The %ETableModel of the %ETable. - * @sort_info: The %ETableSortInfo of the %ETable. - * - * %ETableGroupLeaf is an %ETableGroup which simply contains an - * %ETableItem. - * - * Returns: The new %ETableGroupLeaf. - */ -ETableGroup * -e_table_group_leaf_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - ETableSortInfo *sort_info) -{ - ETableGroupLeaf *etgl; - - g_return_val_if_fail (parent != NULL, NULL); - - etgl = gtk_type_new (e_table_group_leaf_get_type ()); - - e_table_group_leaf_construct (parent, etgl, full_header, - header, model, sort_info); - return E_TABLE_GROUP (etgl); -} - -static void -etgl_cursor_change (GtkObject *object, gint row, ETableGroupLeaf *etgl) -{ - if (row < E_TABLE_SUBSET(etgl->ets)->n_map) - e_table_group_cursor_change (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->ets)->map_table[row]); -} - -static void -etgl_cursor_activated (GtkObject *object, gint row, ETableGroupLeaf *etgl) -{ - if (row < E_TABLE_SUBSET(etgl->ets)->n_map) - e_table_group_cursor_activated (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->ets)->map_table[row]); -} - -static void -etgl_double_click (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl) -{ - if (row < E_TABLE_SUBSET(etgl->ets)->n_map) - e_table_group_double_click (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->ets)->map_table[row], col, event); -} - -static gint -etgl_key_press (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl) -{ - if (row < E_TABLE_SUBSET(etgl->ets)->n_map) - return e_table_group_key_press (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->ets)->map_table[row], col, event); - else - return 0; -} - -static gint -etgl_right_click (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl) -{ - if (row < E_TABLE_SUBSET(etgl->ets)->n_map) - return e_table_group_right_click (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->ets)->map_table[row], col, event); - else - return 0; -} - -static gint -etgl_click (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl) -{ - if (row < E_TABLE_SUBSET(etgl->ets)->n_map) - return e_table_group_click (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->ets)->map_table[row], col, event); - else - return 0; -} - -static void -etgl_reflow (GnomeCanvasItem *item, gint flags) -{ - ETableGroupLeaf *leaf = E_TABLE_GROUP_LEAF(item); - gtk_object_get(GTK_OBJECT(leaf->item), - "height", &leaf->height, - NULL); - gtk_object_get(GTK_OBJECT(leaf->item), - "width", &leaf->width, - NULL); - e_canvas_item_request_parent_reflow (item); -} - -static void -etgl_realize (GnomeCanvasItem *item) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF(item); - - if (GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize) - GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize (item); - - etgl->item = E_TABLE_ITEM(gnome_canvas_item_new (GNOME_CANVAS_GROUP(etgl), - e_table_item_get_type (), - "ETableHeader", E_TABLE_GROUP(etgl)->header, - "ETableModel", etgl->ets, - "drawgrid", etgl->draw_grid, - "drawfocus", etgl->draw_focus, - "cursor_mode", etgl->cursor_mode, - "minimum_width", etgl->minimum_width, - "length_threshold", etgl->length_threshold, - "table_selection_model", etgl->table_selection_model, - NULL)); - - gtk_signal_connect (GTK_OBJECT(etgl->item), "cursor_change", - GTK_SIGNAL_FUNC(etgl_cursor_change), etgl); - gtk_signal_connect (GTK_OBJECT(etgl->item), "cursor_activated", - GTK_SIGNAL_FUNC(etgl_cursor_activated), etgl); - gtk_signal_connect (GTK_OBJECT(etgl->item), "double_click", - GTK_SIGNAL_FUNC(etgl_double_click), etgl); - gtk_signal_connect (GTK_OBJECT(etgl->item), "right_click", - GTK_SIGNAL_FUNC(etgl_right_click), etgl); - gtk_signal_connect (GTK_OBJECT(etgl->item), "click", - GTK_SIGNAL_FUNC(etgl_click), etgl); - gtk_signal_connect (GTK_OBJECT(etgl->item), "key_press", - GTK_SIGNAL_FUNC(etgl_key_press), etgl); - e_canvas_item_request_reflow(item); -} - -static void -etgl_add (ETableGroup *etg, gint row) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) { - e_table_subset_variable_add (E_TABLE_SUBSET_VARIABLE(etgl->ets), row); - } -} - -static void -etgl_add_array (ETableGroup *etg, const gint *array, gint count) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) { - e_table_subset_variable_add_array (E_TABLE_SUBSET_VARIABLE(etgl->ets), array, count); - } -} - -static void -etgl_add_all (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) { - e_table_subset_variable_add_all (E_TABLE_SUBSET_VARIABLE(etgl->ets)); - } -} - -static gboolean -etgl_remove (ETableGroup *etg, gint row) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) { - return e_table_subset_variable_remove (E_TABLE_SUBSET_VARIABLE(etgl->ets), row); - } - return FALSE; -} - -static void -etgl_increment (ETableGroup *etg, gint position, gint amount) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) { - e_table_subset_variable_increment (E_TABLE_SUBSET_VARIABLE(etgl->ets), position, amount); - } -} - -static void -etgl_decrement (ETableGroup *etg, gint position, gint amount) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) { - e_table_subset_variable_decrement (E_TABLE_SUBSET_VARIABLE(etgl->ets), position, amount); - } -} - -static int -etgl_row_count (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - return e_table_model_row_count(E_TABLE_MODEL(etgl->ets)); -} - -static void -etgl_set_focus (ETableGroup *etg, EFocus direction, gint view_col) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - if (direction == E_FOCUS_END) { - e_table_item_set_cursor (etgl->item, view_col, e_table_model_row_count(E_TABLE_MODEL(etgl->ets)) - 1); - } else { - e_table_item_set_cursor (etgl->item, view_col, 0); - } -} - -static gint -etgl_get_focus_column (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - return e_table_item_get_focused_column (etgl->item); -} - -static EPrintable * -etgl_get_printable (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - return e_table_item_get_printable (etgl->item); -} - -static void -etgl_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - e_table_item_compute_location (etgl->item, x, y, row, col); -} - -static void -etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object); - - switch (arg_id) { - case ARG_FROZEN: - if (GTK_VALUE_BOOL (*arg)) - etg->frozen = TRUE; - else { - etg->frozen = FALSE; - } - break; - case ARG_MINIMUM_WIDTH: - case ARG_WIDTH: - etgl->minimum_width = GTK_VALUE_DOUBLE(*arg); - if (etgl->item) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), - "minimum_width", etgl->minimum_width, - NULL); - } - break; - case ARG_LENGTH_THRESHOLD: - etgl->length_threshold = GTK_VALUE_INT (*arg); - if (etgl->item) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), - "length_threshold", GTK_VALUE_INT (*arg), - NULL); - } - break; - case ARG_TABLE_SELECTION_MODEL: - if (etgl->table_selection_model) - gtk_object_unref(GTK_OBJECT(etgl->table_selection_model)); - etgl->table_selection_model = E_TABLE_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg)); - if (etgl->table_selection_model) - gtk_object_ref(GTK_OBJECT(etgl->table_selection_model)); - if (etgl->item) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), - "table_selection_model", etgl->table_selection_model, - NULL); - } - - case ARG_TABLE_DRAW_GRID: - etgl->draw_grid = GTK_VALUE_BOOL (*arg); - if (etgl->item) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), - "drawgrid", GTK_VALUE_BOOL (*arg), - NULL); - } - break; - - case ARG_TABLE_DRAW_FOCUS: - etgl->draw_focus = GTK_VALUE_BOOL (*arg); - if (etgl->item) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), - "drawfocus", GTK_VALUE_BOOL (*arg), - NULL); - } - break; - - case ARG_CURSOR_MODE: - etgl->cursor_mode = GTK_VALUE_INT (*arg); - if (etgl->item) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), - "cursor_mode", GTK_VALUE_INT (*arg), - NULL); - } - break; - default: - break; - } -} - -static void -etgl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object); - - switch (arg_id) { - case ARG_FROZEN: - GTK_VALUE_BOOL (*arg) = etg->frozen; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = etgl->height; - break; - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = etgl->width; - break; - case ARG_MINIMUM_WIDTH: - GTK_VALUE_DOUBLE (*arg) = etgl->minimum_width; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -etgl_class_init (GtkObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS(object_class); - - object_class->destroy = etgl_destroy; - object_class->set_arg = etgl_set_arg; - object_class->get_arg = etgl_get_arg; - - item_class->realize = etgl_realize; - - etgl_parent_class = gtk_type_class (PARENT_TYPE); - - e_group_class->add = etgl_add; - e_group_class->add_array = etgl_add_array; - e_group_class->add_all = etgl_add_all; - e_group_class->remove = etgl_remove; - e_group_class->increment = etgl_increment; - e_group_class->decrement = etgl_decrement; - e_group_class->row_count = etgl_row_count; - e_group_class->set_focus = etgl_set_focus; - e_group_class->get_focus_column = etgl_get_focus_column; - e_group_class->get_printable = etgl_get_printable; - e_group_class->compute_location = etgl_compute_location; - - gtk_object_add_arg_type ("ETableGroupLeaf::drawgrid", GTK_TYPE_BOOL, - GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID); - gtk_object_add_arg_type ("ETableGroupLeaf::drawfocus", GTK_TYPE_BOOL, - GTK_ARG_WRITABLE, ARG_TABLE_DRAW_FOCUS); - gtk_object_add_arg_type ("ETableGroupLeaf::cursor_mode", GTK_TYPE_INT, - GTK_ARG_WRITABLE, ARG_CURSOR_MODE); - gtk_object_add_arg_type ("ETableGroupLeaf::length_threshold", GTK_TYPE_INT, - GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD); - gtk_object_add_arg_type ("ETableGroupLeaf::table_selection_model", GTK_TYPE_OBJECT, - GTK_ARG_WRITABLE, ARG_TABLE_SELECTION_MODEL); - - gtk_object_add_arg_type ("ETableGroupLeaf::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("ETableGroupLeaf::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableGroupLeaf::minimum_width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH); - gtk_object_add_arg_type ("ETableGroupLeaf::frozen", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_FROZEN); -} - -static void -etgl_init (GtkObject *object) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object); - - etgl->width = 1; - etgl->height = 1; - etgl->minimum_width = 0; - - etgl->ets = NULL; - etgl->item = NULL; - - etgl->draw_grid = 1; - etgl->draw_focus = 1; - etgl->cursor_mode = E_CURSOR_SIMPLE; - etgl->length_threshold = -1; - - etgl->table_selection_model = NULL; - - e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM(object), etgl_reflow); -} - -E_MAKE_TYPE (e_table_group_leaf, "ETableGroupLeaf", ETableGroupLeaf, etgl_class_init, etgl_init, PARENT_TYPE); diff --git a/widgets/table/e-table-group-leaf.h b/widgets/table/e-table-group-leaf.h deleted file mode 100644 index 680ee37347..0000000000 --- a/widgets/table/e-table-group-leaf.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_GROUP_LEAF_H_ -#define _E_TABLE_GROUP_LEAF_H_ - -#include <libgnomeui/gnome-canvas.h> -#include <gal/e-table/e-table-group.h> -#include <gal/e-table/e-table-subset.h> -#include <gal/e-table/e-table-item.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_GROUP_LEAF_TYPE (e_table_group_leaf_get_type ()) -#define E_TABLE_GROUP_LEAF(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_LEAF_TYPE, ETableGroupLeaf)) -#define E_TABLE_GROUP_LEAF_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_GROUP_LEAF_TYPE, ETableGroupLeafClass)) -#define E_IS_TABLE_GROUP_LEAF(o) (GTK_CHECK_TYPE ((o), E_TABLE_GROUP_LEAF_TYPE)) -#define E_IS_TABLE_GROUP_LEAF_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_LEAF_TYPE)) - -typedef struct { - ETableGroup group; - - /* - * Item. - */ - ETableItem *item; - - gdouble height; - gdouble width; - gdouble minimum_width; - - int length_threshold; - - ETableSubset *ets; - guint is_grouped : 1; - - guint draw_grid : 1; - guint draw_focus : 1; - ECursorMode cursor_mode; - - ETableSelectionModel *table_selection_model; -} ETableGroupLeaf; - -typedef struct { - ETableGroupClass parent_class; -} ETableGroupLeafClass; - -ETableGroup *e_table_group_leaf_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - ETableSortInfo *sort_info); -GtkType e_table_group_leaf_get_type (void); - - -END_GNOME_DECLS - -#endif /* _E_TABLE_GROUP_LEAF_H_ */ - diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c deleted file mode 100644 index 0b09b38351..0000000000 --- a/widgets/table/e-table-group.c +++ /dev/null @@ -1,650 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-Table-Group.c: Implements the grouping objects for elements on a table - * - * Author: - * Miguel de Icaza (miguel@ximian.com) - * Chris Lahey (clahey@ximian.com) - * - * Copyright 1999, 2000 Ximian, Inc. - */ - -#include <config.h> -#include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> -#include "e-table-group.h" -#include "e-table-group-container.h" -#include "e-table-group-leaf.h" -#include "e-table-item.h" -#include "gal/util/e-util.h" - -#define PARENT_TYPE gnome_canvas_group_get_type () - -#define ETG_CLASS(e) (E_TABLE_GROUP_CLASS(GTK_OBJECT(e)->klass)) - -static GnomeCanvasGroupClass *etg_parent_class; - -enum { - CURSOR_CHANGE, - CURSOR_ACTIVATED, - DOUBLE_CLICK, - RIGHT_CLICK, - CLICK, - KEY_PRESS, - LAST_SIGNAL -}; - -static gint etg_signals [LAST_SIGNAL] = { 0, }; - -static gboolean etg_get_focus (ETableGroup *etg); -static void etg_destroy (GtkObject *object); - -static void -etg_destroy (GtkObject *object) -{ - ETableGroup *etg = E_TABLE_GROUP(object); - if (etg->header) - gtk_object_unref (GTK_OBJECT(etg->header)); - if (etg->full_header) - gtk_object_unref (GTK_OBJECT(etg->full_header)); - if (etg->model) - gtk_object_unref (GTK_OBJECT(etg->model)); - if (GTK_OBJECT_CLASS (etg_parent_class)->destroy) - GTK_OBJECT_CLASS (etg_parent_class)->destroy (object); -} - -/** - * e_table_group_new - * @parent: The %GnomeCanvasGroup to create a child of. - * @full_header: The full header of the %ETable. - * @header: The current header of the %ETable. - * @model: The %ETableModel of the %ETable. - * @sort_info: The %ETableSortInfo of the %ETable. - * @n: The grouping information object to group by. - * - * %ETableGroup is a collection of rows of an %ETable. It's a - * %GnomeCanvasItem. There are two different forms. If n < the - * number of groupings in the given %ETableSortInfo, then the - * %ETableGroup will need to contain other %ETableGroups, thus it - * creates an %ETableGroupContainer. Otherwise, it will just contain - * an %ETableItem, and thus it creates an %ETableGroupLeaf. - * - * Returns: The new %ETableGroup. - */ -ETableGroup * -e_table_group_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - ETableSortInfo *sort_info, - int n) -{ - g_return_val_if_fail (model != NULL, NULL); - - if (n < e_table_sort_info_grouping_get_count(sort_info)) { - return e_table_group_container_new (parent, full_header, header, model, sort_info, n); - } else { - return e_table_group_leaf_new (parent, full_header, header, model, sort_info); - } - return NULL; -} - -/** - * e_table_group_construct - * @parent: The %GnomeCanvasGroup to create a child of. - * @etg: The %ETableGroup to construct. - * @full_header: The full header of the %ETable. - * @header: The current header of the %ETable. - * @model: The %ETableModel of the %ETable. - * - * This routine does the base construction of the %ETableGroup. - */ -void -e_table_group_construct (GnomeCanvasGroup *parent, - ETableGroup *etg, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model) -{ - etg->full_header = full_header; - gtk_object_ref (GTK_OBJECT(etg->full_header)); - etg->header = header; - gtk_object_ref (GTK_OBJECT(etg->header)); - etg->model = model; - gtk_object_ref (GTK_OBJECT(etg->model)); - gnome_canvas_item_constructv (GNOME_CANVAS_ITEM (etg), parent, 0, NULL); -} - -/** - * e_table_group_add - * @etg: The %ETableGroup to add a row to - * @row: The row to add. - * - * This routine adds the given row from the %ETableModel to this set - * of rows. - */ -void -e_table_group_add (ETableGroup *etg, - gint row) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if (ETG_CLASS (etg)->add) - ETG_CLASS (etg)->add (etg, row); -} - -/** - * e_table_group_add_array - * @etg: The %ETableGroup to add to - * @array: The array to add. - * @count: The number of times to add - * - * This routine adds all the rows in the array to this set of rows. - * It assumes that the array is already sorted properly. - */ -void -e_table_group_add_array (ETableGroup *etg, - const int *array, - int count) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if (ETG_CLASS (etg)->add_array) - ETG_CLASS (etg)->add_array (etg, array, count); -} - -/** - * e_table_group_add_all - * @etg: The %ETableGroup to add to - * - * This routine adds all the rows from the %ETableModel to this set - * of rows. - */ -void -e_table_group_add_all (ETableGroup *etg) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if (ETG_CLASS (etg)->add_all) - ETG_CLASS (etg)->add_all (etg); -} - -/** - * e_table_group_remove - * @etg: The %ETableGroup to remove a row from - * @row: The row to remove. - * - * This routine removes the given row from the %ETableModel from this - * set of rows. - * - * Returns: TRUE if the row was deleted and FALSE if the row was not - * found. - */ -gboolean -e_table_group_remove (ETableGroup *etg, - gint row) -{ - g_return_val_if_fail (etg != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE); - - if (ETG_CLASS (etg)->remove) - return ETG_CLASS (etg)->remove (etg, row); - else - return FALSE; -} - -/** - * e_table_group_increment - * @etg: The %ETableGroup to increment - * @position: The position to increment from - * @amount: The amount to increment. - * - * This routine adds amount to all rows greater than or equal to - * position. This is to handle when a row gets inserted into the - * model. - */ -void -e_table_group_increment (ETableGroup *etg, - gint position, - gint amount) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if (ETG_CLASS (etg)->increment) - ETG_CLASS (etg)->increment (etg, position, amount); -} - -/** - * e_table_group_increment - * @etg: The %ETableGroup to decrement - * @position: The position to decrement from - * @amount: The amount to decrement - * - * This routine removes amount from all rows greater than or equal to - * position. This is to handle when a row gets deleted from the - * model. - */ -void -e_table_group_decrement (ETableGroup *etg, - gint position, - gint amount) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if (ETG_CLASS (etg)->decrement) - ETG_CLASS (etg)->decrement (etg, position, amount); -} - -/** - * e_table_group_increment - * @etg: The %ETableGroup to count - * - * This routine calculates the number of rows shown in this group. - * - * Returns: The number of rows. - */ -gint -e_table_group_row_count (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), 0); - - if (ETG_CLASS (etg)->row_count) - return ETG_CLASS (etg)->row_count (etg); - else - return 0; -} - -/** - * e_table_group_set_focus - * @etg: The %ETableGroup to set - * @direction: The direction the focus is coming from. - * @view_col: The column to set the focus in. - * - * Sets the focus to this widget. Places the focus in the view column - * coming from direction direction. - */ -void -e_table_group_set_focus (ETableGroup *etg, - EFocus direction, - gint view_col) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if (ETG_CLASS (etg)->set_focus) - ETG_CLASS (etg)->set_focus (etg, direction, view_col); -} - -/** - * e_table_group_get_focus - * @etg: The %ETableGroup to check - * - * Calculates if this group has the focus. - * - * Returns: TRUE if this group has the focus. - */ -gboolean -e_table_group_get_focus (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE); - - if (ETG_CLASS (etg)->get_focus) - return ETG_CLASS (etg)->get_focus (etg); - else - return FALSE; -} - -/** - * e_table_group_get_focus_column - * @etg: The %ETableGroup to check - * - * Calculates which column in this group has the focus. - * - * Returns: The column index (view column). - */ -gint -e_table_group_get_focus_column (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE); - - if (ETG_CLASS (etg)->get_focus_column) - return ETG_CLASS (etg)->get_focus_column (etg); - else - return -1; -} - -/** - * e_table_group_get_printable - * @etg: %ETableGroup which will be printed - * - * This routine creates and returns an %EPrintable that can be used to - * print the given %ETableGroup. - * - * Returns: The %EPrintable. - */ -EPrintable * -e_table_group_get_printable (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), NULL); - - if (ETG_CLASS (etg)->get_printable) - return ETG_CLASS (etg)->get_printable (etg); - else - return NULL; -} - -/** - * e_table_group_compute_location - * @eti: %ETableGroup to look in. - * @x: A pointer to the x location to find in the %ETableGroup. - * @y: A pointer to the y location to find in the %ETableGroup. - * @row: A pointer to the location to store the found row in. - * @col: A pointer to the location to store the found col in. - * - * This routine locates the pixel location (*x, *y) in the - * %ETableGroup. If that location is in the %ETableGroup, *row and - * *col are set to the view row and column where it was found. If - * that location is not in the %ETableGroup, the height of the - * %ETableGroup is removed from the value y points to. - */ -void -e_table_group_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if (ETG_CLASS (etg)->compute_location) - ETG_CLASS (etg)->compute_location (etg, x, y, row, col); -} - -/** - * e_table_group_get_position - * @eti: %ETableGroup to look in. - * @x: A pointer to the location to store the found x location in. - * @y: A pointer to the location to store the found y location in. - * @row: A pointer to the row number to find. - * @col: A pointer to the col number to find. - * - * This routine finds the view cell (row, col) in the %ETableGroup. - * If that location is in the %ETableGroup *x and *y are set to the - * upper left hand corner of the cell found. If that location is not - * in the %ETableGroup, the number of rows in the %ETableGroup is - * removed from the value row points to. - */ -void -e_table_group_get_position (ETableGroup *etg, int *x, int *y, int *row, int *col) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if (ETG_CLASS (etg)->get_position) - ETG_CLASS (etg)->get_position (etg, x, y, row, col); -} - -/** - * e_table_group_cursor_change - * @eti: %ETableGroup to emit the signal on - * @row: The new cursor row (model row) - * - * This routine emits the "cursor_change" signal. - */ -void -e_table_group_cursor_change (ETableGroup *e_table_group, gint row) -{ - g_return_if_fail (e_table_group != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (e_table_group)); - - gtk_signal_emit (GTK_OBJECT (e_table_group), - etg_signals [CURSOR_CHANGE], - row); -} - -/** - * e_table_group_cursor_activated - * @eti: %ETableGroup to emit the signal on - * @row: The cursor row (model row) - * - * This routine emits the "cursor_activated" signal. - */ -void -e_table_group_cursor_activated (ETableGroup *e_table_group, gint row) -{ - g_return_if_fail (e_table_group != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (e_table_group)); - - gtk_signal_emit (GTK_OBJECT (e_table_group), - etg_signals [CURSOR_ACTIVATED], - row); -} - -/** - * e_table_group_double_click - * @eti: %ETableGroup to emit the signal on - * @row: The row clicked on (model row) - * @col: The col clicked on (model col) - * @event: The event that caused this signal - * - * This routine emits the "double_click" signal. - */ -void -e_table_group_double_click (ETableGroup *e_table_group, gint row, gint col, GdkEvent *event) -{ - g_return_if_fail (e_table_group != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (e_table_group)); - - gtk_signal_emit (GTK_OBJECT (e_table_group), - etg_signals [DOUBLE_CLICK], - row, col, event); -} - -/** - * e_table_group_right_click - * @eti: %ETableGroup to emit the signal on - * @row: The row clicked on (model row) - * @col: The col clicked on (model col) - * @event: The event that caused this signal - * - * This routine emits the "right_click" signal. - */ -gint -e_table_group_right_click (ETableGroup *e_table_group, gint row, gint col, GdkEvent *event) -{ - gint return_val = 0; - - g_return_val_if_fail (e_table_group != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_GROUP (e_table_group), 0); - - gtk_signal_emit (GTK_OBJECT (e_table_group), - etg_signals [RIGHT_CLICK], - row, col, event, &return_val); - - return return_val; -} - -/** - * e_table_group_click - * @eti: %ETableGroup to emit the signal on - * @row: The row clicked on (model row) - * @col: The col clicked on (model col) - * @event: The event that caused this signal - * - * This routine emits the "click" signal. - */ -gint -e_table_group_click (ETableGroup *e_table_group, gint row, gint col, GdkEvent *event) -{ - gint return_val = 0; - - g_return_val_if_fail (e_table_group != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_GROUP (e_table_group), 0); - - gtk_signal_emit (GTK_OBJECT (e_table_group), - etg_signals [CLICK], - row, col, event, &return_val); - - return return_val; -} - -/** - * e_table_group_key_press - * @eti: %ETableGroup to emit the signal on - * @row: The cursor row (model row) - * @col: The cursor col (model col) - * @event: The event that caused this signal - * - * This routine emits the "key_press" signal. - */ -gint -e_table_group_key_press (ETableGroup *e_table_group, gint row, gint col, GdkEvent *event) -{ - gint return_val = 0; - - g_return_val_if_fail (e_table_group != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_GROUP (e_table_group), 0); - - gtk_signal_emit (GTK_OBJECT (e_table_group), - etg_signals [KEY_PRESS], - row, col, event, &return_val); - - return return_val; -} - -/** - * e_table_group_get_header - * @eti: %ETableGroup to check - * - * This routine returns the %ETableGroup's header. - * - * Returns: The %ETableHeader. - */ -ETableHeader * -e_table_group_get_header (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), NULL); - - return etg->header; -} - -static int -etg_event (GnomeCanvasItem *item, GdkEvent *event) -{ - ETableGroup *etg = E_TABLE_GROUP (item); - gboolean return_val = TRUE; - - switch (event->type) { - - case GDK_FOCUS_CHANGE: - etg->has_focus = event->focus_change.in; - return_val = FALSE; - - default: - return_val = FALSE; - } - if (return_val == FALSE){ - if (GNOME_CANVAS_ITEM_CLASS(etg_parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS(etg_parent_class)->event (item, event); - } - return return_val; - -} - -static gboolean -etg_get_focus (ETableGroup *etg) -{ - return etg->has_focus; -} - -static void -etg_class_init (GtkObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableGroupClass *klass = (ETableGroupClass *) object_class; - - object_class->destroy = etg_destroy; - - item_class->event = etg_event; - - klass->cursor_change = NULL; - klass->cursor_activated = NULL; - klass->double_click = NULL; - klass->right_click = NULL; - klass->click = NULL; - klass->key_press = NULL; - - klass->add = NULL; - klass->add_array = NULL; - klass->add_all = NULL; - klass->remove = NULL; - klass->row_count = NULL; - klass->increment = NULL; - klass->decrement = NULL; - klass->set_focus = NULL; - klass->get_focus = etg_get_focus; - klass->get_printable = NULL; - klass->compute_location = NULL; - klass->get_position = NULL; - - etg_parent_class = gtk_type_class (PARENT_TYPE); - - etg_signals [CURSOR_CHANGE] = - gtk_signal_new ("cursor_change", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableGroupClass, cursor_change), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - etg_signals [CURSOR_ACTIVATED] = - gtk_signal_new ("cursor_activated", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableGroupClass, cursor_activated), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - etg_signals [DOUBLE_CLICK] = - gtk_signal_new ("double_click", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableGroupClass, double_click), - gtk_marshal_NONE__INT_INT_POINTER, - GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); - - etg_signals [RIGHT_CLICK] = - gtk_signal_new ("right_click", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableGroupClass, right_click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); - - etg_signals [CLICK] = - gtk_signal_new ("click", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableGroupClass, click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); - - etg_signals [KEY_PRESS] = - gtk_signal_new ("key_press", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableGroupClass, key_press), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, etg_signals, LAST_SIGNAL); -} - -E_MAKE_TYPE (e_table_group, "ETableGroup", ETableGroup, etg_class_init, NULL, PARENT_TYPE); diff --git a/widgets/table/e-table-group.glade b/widgets/table/e-table-group.glade deleted file mode 100644 index 39274d3c61..0000000000 --- a/widgets/table/e-table-group.glade +++ /dev/null @@ -1,208 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <use_widget_names>False</use_widget_names> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> - <backup_source_files>False</backup_source_files> - <main_source_file>interface.c</main_source_file> - <main_header_file>interface.h</main_header_file> - <handler_source_file>callbacks.c</handler_source_file> - <handler_header_file>callbacks.h</handler_header_file> - <support_source_file>support.c</support_source_file> - <support_header_file>support.h</support_header_file> - <output_translatable_strings>True</output_translatable_strings> - <translatable_strings_file>e-table-group.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GtkWindow</class> - <name>window1</name> - <title>window1</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkTable</class> - <name>table1</name> - <rows>3</rows> - <columns>3</columns> - <homogeneous>False</homogeneous> - <row_spacing>0</row_spacing> - <column_spacing>0</column_spacing> - - <widget> - <class>GtkFrame</class> - <name>frame1</name> - <border_width>4</border_width> - <label>Available fields</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - - <widget> - <class>GtkCList</class> - <name>clist1</name> - <can_focus>True</can_focus> - <columns>1</columns> - <column_widths>80</column_widths> - <selection_mode>GTK_SELECTION_SINGLE</selection_mode> - <show_titles>False</show_titles> - <shadow_type>GTK_SHADOW_NONE</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label1</name> - <label>label1</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame2</name> - <border_width>4</border_width> - <label>Show in this order</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow2</name> - <hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - - <widget> - <class>GtkCList</class> - <name>clist2</name> - <can_focus>True</can_focus> - <columns>1</columns> - <column_widths>80</column_widths> - <selection_mode>GTK_SELECTION_SINGLE</selection_mode> - <show_titles>False</show_titles> - <shadow_type>GTK_SHADOW_NONE</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label2</name> - <label>label2</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox1</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>4</xpad> - <ypad>4</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button1</name> - <border_width>4</border_width> - <can_focus>True</can_focus> - <label>Add >></label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button2</name> - <border_width>4</border_width> - <can_focus>True</can_focus> - <label><< Remove</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/widgets/table/e-table-group.glade.h b/widgets/table/e-table-group.glade.h deleted file mode 100644 index 3ab6304734..0000000000 --- a/widgets/table/e-table-group.glade.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Translatable strings file generated by Glade. - * Add this file to your project's POTFILES.in. - * DO NOT compile it as part of your application. - */ - -gchar *s = N_("window1"); -gchar *s = N_("Available fields"); -gchar *s = N_("label1"); -gchar *s = N_("Show in this order"); -gchar *s = N_("label2"); -gchar *s = N_("Add >>"); -gchar *s = N_("<< Remove"); diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h deleted file mode 100644 index f8d23168fe..0000000000 --- a/widgets/table/e-table-group.h +++ /dev/null @@ -1,149 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_GROUP_H_ -#define _E_TABLE_GROUP_H_ - -#include <libgnomeui/gnome-canvas.h> -#include <gal/e-table/e-table-model.h> -#include <gal/e-table/e-table-header.h> -#include <gal/e-table/e-table-sort-info.h> -#include <gal/e-table/e-table-defines.h> -#include <gal/util/e-util.h> -#include <gal/widgets/e-printable.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_GROUP_TYPE (e_table_group_get_type ()) -#define E_TABLE_GROUP(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_TYPE, ETableGroup)) -#define E_TABLE_GROUP_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_GROUP_TYPE, ETableGroupClass)) -#define E_IS_TABLE_GROUP(o) (GTK_CHECK_TYPE ((o), E_TABLE_GROUP_TYPE)) -#define E_IS_TABLE_GROUP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_TYPE)) - -typedef struct { - GnomeCanvasGroup group; - - /* - * The full header. - */ - ETableHeader *full_header; - ETableHeader *header; - - /* - * The model we pull data from. - */ - ETableModel *model; - - /* - * Whether we should add indentation and open/close markers, - * or if we just act as containers of subtables. - */ - guint transparent : 1; - - guint has_focus : 1; - - guint frozen : 1; -} ETableGroup; - -typedef struct { - GnomeCanvasGroupClass parent_class; - - /* Signals */ - void (*cursor_change) (ETableGroup *etg, int row); - void (*cursor_activated) (ETableGroup *etg, int row); - void (*double_click) (ETableGroup *etg, int row, int col, GdkEvent *event); - gint (*right_click) (ETableGroup *etg, int row, int col, GdkEvent *event); - gint (*click) (ETableGroup *etg, int row, int col, GdkEvent *event); - gint (*key_press) (ETableGroup *etg, int row, int col, GdkEvent *event); - - /* Virtual functions. */ - void (*add) (ETableGroup *etg, gint row); - void (*add_array) (ETableGroup *etg, const int *array, int count); - void (*add_all) (ETableGroup *etg); - gboolean (*remove) (ETableGroup *etg, gint row); - gint (*row_count) (ETableGroup *etg); - void (*increment) (ETableGroup *etg, gint position, gint amount); - void (*decrement) (ETableGroup *etg, gint position, gint amount); - void (*set_focus) (ETableGroup *etg, EFocus direction, gint view_col); - gboolean (*get_focus) (ETableGroup *etg); - gint (*get_focus_column) (ETableGroup *etg); - EPrintable *(*get_printable) (ETableGroup *etg); - void (*compute_location) (ETableGroup *etg, int *x, int *y, int *row, int *col); - void (*get_position) (ETableGroup *etg, int *x, int *y, int *row, int *col); - -} ETableGroupClass; - -/* Virtual functions */ -void e_table_group_add (ETableGroup *etg, - gint row); -void e_table_group_add_array (ETableGroup *etg, - const int *array, - int count); -void e_table_group_add_all (ETableGroup *etg); -gboolean e_table_group_remove (ETableGroup *etg, - gint row); -void e_table_group_increment (ETableGroup *etg, - gint position, - gint amount); -void e_table_group_decrement (ETableGroup *etg, - gint position, - gint amount); -gint e_table_group_row_count (ETableGroup *etg); -void e_table_group_set_focus (ETableGroup *etg, - EFocus direction, - gint view_col); -gboolean e_table_group_get_focus (ETableGroup *etg); -gint e_table_group_get_focus_column (ETableGroup *etg); -ETableHeader *e_table_group_get_header (ETableGroup *etg); -EPrintable *e_table_group_get_printable (ETableGroup *etg); -void e_table_group_compute_location (ETableGroup *etg, - int *x, - int *y, - int *row, - int *col); -void e_table_group_get_position (ETableGroup *etg, - int *x, - int *y, - int *row, - int *col); -ETableGroup *e_table_group_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - ETableSortInfo *sort_info, - int n); -void e_table_group_construct (GnomeCanvasGroup *parent, - ETableGroup *etg, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model); - -/* For emitting the signals */ -void e_table_group_cursor_change (ETableGroup *etg, - gint row); -void e_table_group_cursor_activated (ETableGroup *etg, - gint row); -void e_table_group_double_click (ETableGroup *etg, - gint row, - gint col, - GdkEvent *event); -gint e_table_group_right_click (ETableGroup *etg, - gint row, - gint col, - GdkEvent *event); -gint e_table_group_click (ETableGroup *etg, - gint row, - gint col, - GdkEvent *event); -gint e_table_group_key_press (ETableGroup *etg, - gint row, - gint col, - GdkEvent *event); -GtkType e_table_group_get_type (void); - -typedef void (*ETableGroupLeafFn) (void *e_table_item, void *closure); -void e_table_group_apply_to_leafs (ETableGroup *etg, - ETableGroupLeafFn fn, - void *closure); - -END_GNOME_DECLS - -#endif /* _E_TABLE_GROUP_H_ */ diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c deleted file mode 100644 index 70bdb3d698..0000000000 --- a/widgets/table/e-table-header-item.c +++ /dev/null @@ -1,1596 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-column-view.c: A canvas item based view of the ETableColumn. - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * Copyright 1999, 2000, 2001 Ximian, Inc. - */ -#include <config.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkdnd.h> -#include "gal/util/e-i18n.h" -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-util.h> -#include <libgnomeui/gnome-canvas-polygon.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include "gal/widgets/e-cursors.h" -#include "gal/util/e-xml-utils.h" -#include "gal/widgets/e-canvas.h" -#include "gal/widgets/e-popup-menu.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-header-utils.h" -#include "e-table-col-dnd.h" -#include "e-table-defines.h" -#include "e-table-field-chooser-dialog.h" -#include "e-table-config.h" -#include "e-table.h" - -#include "add-col.xpm" -#include "remove-col.xpm" -#include "arrow-up.xpm" -#include "arrow-down.xpm" - -enum { - BUTTON_PRESSED, - LAST_SIGNAL -}; - -static guint ethi_signals [LAST_SIGNAL] = { 0, }; - -#define ARROW_DOWN_HEIGHT 16 -#define ARROW_PTR 7 - -/* Defines the tolerance for proximity of the column division to the cursor position */ -#define TOLERANCE 4 - -#define ETHI_RESIZING(x) ((x)->resize_col != -1) - -#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () - -#define ELEMENTS(x) (sizeof (x) / sizeof (x[0])) - -static GnomeCanvasItemClass *ethi_parent_class; - -static void ethi_drop_table_header (ETableHeaderItem *ethi); - -/* - * They display the arrows for the drop location. - */ - -static GtkWidget *arrow_up, *arrow_down; - -/* - * DnD icons - */ -static GdkColormap *dnd_colormap; -static GdkPixmap *remove_col_pixmap, *remove_col_mask; -static GdkPixmap *add_col_pixmap, *add_col_mask; - -enum { - ARG_0, - ARG_TABLE_HEADER, - ARG_FULL_HEADER, - ARG_DND_CODE, - ARG_TABLE_FONTSET, - ARG_SORT_INFO, - ARG_TABLE, -}; - -static void -ethi_destroy (GtkObject *object){ - ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (object); - - ethi_drop_table_header (ethi); - - if (ethi->dnd_code) { - g_free (ethi->dnd_code); - ethi->dnd_code = NULL; - } - - if (ethi->sort_info) { - if (ethi->sort_info_changed_id) - gtk_signal_disconnect (GTK_OBJECT(ethi->sort_info), ethi->sort_info_changed_id); - if (ethi->group_info_changed_id) - gtk_signal_disconnect (GTK_OBJECT(ethi->sort_info), ethi->group_info_changed_id); - gtk_object_unref (GTK_OBJECT(ethi->sort_info)); - ethi->sort_info = NULL; - } - - if (ethi->full_header) - gtk_object_unref (GTK_OBJECT(ethi->full_header)); - - if (ethi->config) - gtk_object_destroy (GTK_OBJECT (ethi->config)); - - if (GTK_OBJECT_CLASS (ethi_parent_class)->destroy) - (*GTK_OBJECT_CLASS (ethi_parent_class)->destroy) (object); -} - -static int -e_table_header_item_get_height (ETableHeaderItem *ethi) -{ - ETableHeader *eth; - int numcols, col; - int maxheight; - GtkStyle *style; - - g_return_val_if_fail (ethi != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_HEADER_ITEM (ethi), 0); - - eth = ethi->eth; - numcols = e_table_header_count (eth); - - maxheight = 0; - - style = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->style; - - for (col = 0; col < numcols; col++) { - ETableCol *ecol = e_table_header_get_column (eth, col); - int height; - - height = e_table_header_compute_height (ecol, style, ethi->font); - - if (height > maxheight) - maxheight = height; - } - - return maxheight; -} - -static void -ethi_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item); - - double i2c [6]; - ArtPoint c1, c2, i1, i2; - - if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update) - (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)(item, affine, clip_path, flags); - - - if (ethi->sort_info) - ethi->group_indent_width = e_table_sort_info_grouping_get_count(ethi->sort_info) * GROUP_INDENT; - else - ethi->group_indent_width = 0; - - ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width; - - i1.x = i1.y = 0; - i2.x = ethi->width; - i2.y = ethi->height; - - gnome_canvas_item_i2c_affine (item, i2c); - art_affine_point (&c1, &i1, i2c); - art_affine_point (&c2, &i2, i2c); - - if (item->x1 != c1.x || - item->y1 != c1.y || - item->x2 != c2.x || - item->y2 != c2.y) - { - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); - item->x1 = c1.x; - item->y1 = c1.y; - item->x2 = c2.x; - item->y2 = c2.y; - - gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); - } - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); -} - -static void -ethi_font_set (ETableHeaderItem *ethi, GdkFont *font) -{ - if (ethi->font) - gdk_font_unref (ethi->font); - - ethi->font = font; - - ethi->height = e_table_header_item_get_height (ethi); - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(ethi)); -} - -static void -ethi_font_load (ETableHeaderItem *ethi, char *fontname) -{ - GdkFont *font; - - font = gdk_fontset_load (fontname); - if (font == NULL) - font = gdk_font_load ("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-iso8859-1"); - - ethi_font_set (ethi, font); -} - -static void -ethi_drop_table_header (ETableHeaderItem *ethi) -{ - GtkObject *header; - - if (!ethi->eth) - return; - - header = GTK_OBJECT (ethi->eth); - gtk_signal_disconnect (header, ethi->structure_change_id); - gtk_signal_disconnect (header, ethi->dimension_change_id); - - gtk_object_unref (header); - ethi->eth = NULL; - ethi->width = 0; -} - -static void -structure_changed (ETableHeader *header, ETableHeaderItem *ethi) -{ - gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi)); -} - -static void -dimension_changed (ETableHeader *header, int col, ETableHeaderItem *ethi) -{ - gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi)); -} - -static void -ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header) -{ - ethi->eth = header; - gtk_object_ref (GTK_OBJECT (ethi->eth)); - - ethi->height = e_table_header_item_get_height (ethi); - - ethi->structure_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "structure_change", - GTK_SIGNAL_FUNC(structure_changed), ethi); - ethi->dimension_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "dimension_change", - GTK_SIGNAL_FUNC(dimension_changed), ethi); - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(ethi)); - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi)); -} - -static void -ethi_sort_info_changed (ETableSortInfo *sort_info, ETableHeaderItem *ethi) -{ - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi)); -} - -static void -ethi_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - ETableHeaderItem *ethi; - - item = GNOME_CANVAS_ITEM (o); - ethi = E_TABLE_HEADER_ITEM (o); - - switch (arg_id){ - case ARG_TABLE_HEADER: - ethi_drop_table_header (ethi); - ethi_add_table_header (ethi, E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg))); - break; - - case ARG_FULL_HEADER: - if (ethi->full_header) - gtk_object_unref(GTK_OBJECT(ethi->full_header)); - ethi->full_header = E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg)); - if (ethi->full_header) - gtk_object_ref(GTK_OBJECT(ethi->full_header)); - break; - - case ARG_DND_CODE: - g_free(ethi->dnd_code); - ethi->dnd_code = g_strdup (GTK_VALUE_STRING (*arg)); - break; - - case ARG_TABLE_FONTSET: - ethi_font_load (ethi, GTK_VALUE_STRING (*arg)); - break; - - case ARG_SORT_INFO: - if (ethi->sort_info){ - if (ethi->sort_info_changed_id) - gtk_signal_disconnect ( - GTK_OBJECT(ethi->sort_info), - ethi->sort_info_changed_id); - - if (ethi->group_info_changed_id) - gtk_signal_disconnect ( - GTK_OBJECT(ethi->sort_info), - ethi->group_info_changed_id); - gtk_object_unref (GTK_OBJECT(ethi->sort_info)); - } - ethi->sort_info = GTK_VALUE_POINTER (*arg); - gtk_object_ref (GTK_OBJECT(ethi->sort_info)); - ethi->sort_info_changed_id = - gtk_signal_connect ( - GTK_OBJECT(ethi->sort_info), "sort_info_changed", - GTK_SIGNAL_FUNC(ethi_sort_info_changed), ethi); - ethi->group_info_changed_id = - gtk_signal_connect ( - GTK_OBJECT(ethi->sort_info), "group_info_changed", - GTK_SIGNAL_FUNC(ethi_sort_info_changed), ethi); - break; - case ARG_TABLE: - if (GTK_VALUE_OBJECT(*arg)) - ethi->table = E_TABLE(GTK_VALUE_OBJECT(*arg)); - else - ethi->table = NULL; - break; - } - gnome_canvas_item_request_update(item); -} - -static void -ethi_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ETableHeaderItem *ethi; - - ethi = E_TABLE_HEADER_ITEM (o); - - switch (arg_id){ - case ARG_FULL_HEADER: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT (ethi->full_header); - break; - case ARG_DND_CODE: - GTK_VALUE_STRING (*arg) = g_strdup (ethi->dnd_code); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static int -ethi_find_col_by_x (ETableHeaderItem *ethi, int x) -{ - const int cols = e_table_header_count (ethi->eth); - int x1 = 0; - int col; - - if (x < x1) - return -1; - - x1 += ethi->group_indent_width; - - for (col = 0; col < cols; col++){ - ETableCol *ecol = e_table_header_get_column (ethi->eth, col); - - if ((x >= x1) && (x <= x1 + ecol->width)) - return col; - - x1 += ecol->width; - } - return -1; -} - -static int -ethi_find_col_by_x_nearest (ETableHeaderItem *ethi, int x) -{ - const int cols = e_table_header_count (ethi->eth); - int x1 = 0; - int col; - - if (x < x1) - return -1; - - x1 += ethi->group_indent_width; - - for (col = 0; col < cols; col++){ - ETableCol *ecol = e_table_header_get_column (ethi->eth, col); - - x1 += (ecol->width / 2); - - if (x <= x1) - return col; - - x1 += (ecol->width + 1) / 2; - } - return col; -} - -static void -ethi_remove_drop_marker (ETableHeaderItem *ethi) -{ - if (ethi->drag_mark == -1) - return; - - gtk_widget_hide (arrow_up); - gtk_widget_hide (arrow_down); - - ethi->drag_mark = -1; -} - -static GtkWidget * -make_shaped_window_from_xpm (const char **xpm) -{ - GdkPixbuf *pixbuf; - GdkPixmap *pixmap; - GdkBitmap *bitmap; - GtkWidget *win, *pix; - - pixbuf = gdk_pixbuf_new_from_xpm_data (xpm); - gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &bitmap, 128); - gdk_pixbuf_unref (pixbuf); - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - win = gtk_window_new (GTK_WINDOW_POPUP); - pix = gtk_pixmap_new (pixmap, bitmap); - gtk_widget_realize (win); - gtk_container_add (GTK_CONTAINER (win), pix); - gtk_widget_shape_combine_mask (win, bitmap, 0, 0); - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); - - gdk_pixmap_unref (pixmap); - gdk_bitmap_unref (bitmap); - - return win; -} - -static void -ethi_add_drop_marker (ETableHeaderItem *ethi, int col) -{ - int rx, ry; - int x; - - if (ethi->drag_mark == col) - return; - - ethi->drag_mark = col; - - x = e_table_header_col_diff (ethi->eth, 0, col); - if (col > 0) - x += ethi->group_indent_width; - - if (!arrow_up){ - arrow_up = make_shaped_window_from_xpm (arrow_up_xpm); - arrow_down = make_shaped_window_from_xpm (arrow_down_xpm); - } - - gdk_window_get_origin ( - GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->window, - &rx, &ry); - - gtk_widget_set_uposition (arrow_down, rx + x - ARROW_PTR, ry - ARROW_DOWN_HEIGHT); - gtk_widget_show_all (arrow_down); - - gtk_widget_set_uposition (arrow_up, rx + x - ARROW_PTR, ry + ethi->height); - gtk_widget_show_all (arrow_up); -} - -#define gray50_width 2 -#define gray50_height 2 -static char gray50_bits [] = { - 0x02, 0x01, }; - -static void -ethi_add_destroy_marker (ETableHeaderItem *ethi) -{ - double x1; - - if (ethi->remove_item) - gtk_object_destroy (GTK_OBJECT (ethi->remove_item)); - - if (!ethi->stipple) - ethi->stipple = gdk_bitmap_create_from_data ( - NULL, gray50_bits, gray50_width, gray50_height); - - x1 = (double) e_table_header_col_diff (ethi->eth, 0, ethi->drag_col); - if (ethi->drag_col > 0) - x1 += ethi->group_indent_width; - - ethi->remove_item = gnome_canvas_item_new ( - GNOME_CANVAS_GROUP (GNOME_CANVAS_ITEM (ethi)->canvas->root), - gnome_canvas_rect_get_type (), - "x1", x1 + 1, - "y1", (double) 1, - "x2", (double) x1 + e_table_header_col_diff ( - ethi->eth, ethi->drag_col, ethi->drag_col+1) - 2, - - "y2", (double) ethi->height - 2, - "fill_color", "red", - "fill_stipple", ethi->stipple, - NULL); -} - -static void -ethi_remove_destroy_marker (ETableHeaderItem *ethi) -{ - if (!ethi->remove_item) - return; - - gtk_object_destroy (GTK_OBJECT (ethi->remove_item)); - ethi->remove_item = NULL; -} - -#if 0 -static gboolean -moved (ETableHeaderItem *ethi, guint col, guint model_col) -{ - if (col == -1) - return TRUE; - ecol = e_table_header_get_column (ethi->eth, col); - if (ecol->col_idx == model_col) - return FALSE; - if (col > 0) { - ecol = e_table_header_get_column (ethi->eth, col - 1); - if (ecol->col_idx == model_col) - return FALSE; - } - return TRUE; -} -#endif - -static gboolean -ethi_drag_motion (GtkObject *canvas, GdkDragContext *context, - gint x, gint y, guint time, - ETableHeaderItem *ethi) -{ - char *droptype, *headertype; - - gdk_drag_status (context, 0, time); - - droptype = gdk_atom_name (GPOINTER_TO_INT (context->targets->data)); - headertype = g_strdup_printf ("%s-%s", TARGET_ETABLE_COL_TYPE, - ethi->dnd_code); - - if (strcmp (droptype, headertype) != 0) { - g_free (headertype); - return FALSE; - } - - g_free (headertype); - - if ((x >= 0) && (x <= (ethi->width)) && - (y >= 0) && (y <= (ethi->height))){ - int col; - - col = ethi_find_col_by_x_nearest (ethi, x); - - if (col == ethi->drag_col || col == ethi->drag_col + 1) { - if (ethi->drag_col != -1) - ethi_remove_destroy_marker (ethi); - - ethi_remove_drop_marker (ethi); - gdk_drag_status (context, context->suggested_action, time); - } - else if (col != -1){ - if (ethi->drag_col != -1) - ethi_remove_destroy_marker (ethi); - - ethi_add_drop_marker (ethi, col); - gdk_drag_status (context, context->suggested_action, time); - } else { - ethi_remove_drop_marker (ethi); - if (ethi->drag_col != -1) - ethi_add_destroy_marker (ethi); - } - } else { - ethi_remove_drop_marker (ethi); - if (ethi->drag_col != -1) - ethi_add_destroy_marker (ethi); - } - - return TRUE; -} - -static void -ethi_drag_end (GtkWidget *canvas, GdkDragContext *context, ETableHeaderItem *ethi) -{ - if (context->action == 0) { - e_table_header_remove (ethi->eth, ethi->drag_col); - gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi)); - } - ethi_remove_drop_marker (ethi); - ethi_remove_destroy_marker (ethi); - ethi->drag_col = -1; -} - -static void -ethi_drag_data_received (GtkWidget *canvas, - GdkDragContext *drag_context, - gint x, - gint y, - GtkSelectionData *data, - guint info, - guint time, - ETableHeaderItem *ethi) -{ - int found = FALSE; - int count = e_table_header_count(ethi->eth); - int column = atoi(data->data); - int drop_col = ethi->drop_col; - int i; - ethi->drop_col = -1; - - if (column < 0) - return; - for (i = 0; i < count; i++) { - ETableCol *ecol = e_table_header_get_column (ethi->eth, i); - if (ecol->col_idx == column) { - e_table_header_move(ethi->eth, i, drop_col); - found = TRUE; - break; - } - } - if (!found) { - count = e_table_header_count(ethi->full_header); - for (i = 0; i < count; i++) { - ETableCol *ecol = e_table_header_get_column (ethi->full_header, i); - if (ecol->col_idx == column) { - e_table_header_add_column (ethi->eth, ecol, drop_col); - break; - } - } - } - ethi_remove_drop_marker (ethi); - gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi)); -} - -static void -ethi_drag_data_get (GtkWidget *canvas, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time, - ETableHeaderItem *ethi) -{ - if (ethi->drag_col != -1) { - ETableCol *ecol = e_table_header_get_column (ethi->eth, ethi->drag_col); - - gchar *string = g_strdup_printf("%d", ecol->col_idx); - gtk_selection_data_set(selection_data, - GDK_SELECTION_TYPE_STRING, - sizeof(string[0]), - string, - strlen(string)); - g_free(string); - } -} - -static gboolean -ethi_drag_drop (GtkWidget *canvas, - GdkDragContext *context, - gint x, - gint y, - guint time, - ETableHeaderItem *ethi) -{ - gboolean successful = FALSE; - - if ((x >= 0) && (x <= (ethi->width)) && - (y >= 0) && (y <= (ethi->height))){ - int col; - - col = ethi_find_col_by_x_nearest (ethi, x); - - ethi_add_drop_marker (ethi, col); - - ethi->drop_col = col; - - if (col != -1) { - char *target = g_strdup_printf ("%s-%s", TARGET_ETABLE_COL_TYPE, ethi->dnd_code); - gtk_drag_get_data (canvas, context, gdk_atom_intern(target, FALSE), time); - g_free (target); - } - } - gtk_drag_finish (context, successful, successful, time); - return successful; -} - -static void -ethi_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, ETableHeaderItem *ethi) -{ - ethi_remove_drop_marker (ethi); - if (ethi->drag_col != -1) - ethi_add_destroy_marker (ethi); -} - -static void -ethi_realize (GnomeCanvasItem *item) -{ - ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item); - GdkWindow *window; - GdkColor c; - GtkTargetEntry ethi_drop_types [] = { - { TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER }, - }; - - - if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)-> realize) - (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->realize)(item); - - window = GTK_WIDGET (item->canvas)->window; - - ethi->gc = gdk_gc_new (window); - gnome_canvas_get_color (item->canvas, "black", &c); - gdk_gc_set_foreground (ethi->gc, &c); - - if (!ethi->font) - ethi_font_set (ethi, GTK_WIDGET (item->canvas)->style->font); - - /* - * Now, configure DnD - */ - ethi_drop_types[0].target = g_strdup_printf("%s-%s", ethi_drop_types[0].target, ethi->dnd_code); - gtk_drag_dest_set (GTK_WIDGET (item->canvas), 0, - ethi_drop_types, ELEMENTS (ethi_drop_types), - GDK_ACTION_MOVE); - g_free(ethi_drop_types[0].target); - - /* Drop signals */ - ethi->drag_motion_id = gtk_signal_connect (GTK_OBJECT (item->canvas), "drag_motion", - GTK_SIGNAL_FUNC (ethi_drag_motion), ethi); - ethi->drag_leave_id = gtk_signal_connect (GTK_OBJECT (item->canvas), "drag_leave", - GTK_SIGNAL_FUNC (ethi_drag_leave), ethi); - ethi->drag_drop_id = gtk_signal_connect (GTK_OBJECT (item->canvas), "drag_drop", - GTK_SIGNAL_FUNC (ethi_drag_drop), ethi); - ethi->drag_data_received_id = gtk_signal_connect (GTK_OBJECT (item->canvas), "drag_data_received", - GTK_SIGNAL_FUNC (ethi_drag_data_received), ethi); - - /* Drag signals */ - ethi->drag_end_id = gtk_signal_connect (GTK_OBJECT (item->canvas), "drag_end", - GTK_SIGNAL_FUNC (ethi_drag_end), ethi); - ethi->drag_data_get_id = gtk_signal_connect (GTK_OBJECT (item->canvas), "drag_data_get", - GTK_SIGNAL_FUNC (ethi_drag_data_get), ethi); - -} - -static void -ethi_unrealize (GnomeCanvasItem *item) -{ - ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item); - - gdk_gc_unref (ethi->gc); - ethi->gc = NULL; - - gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_motion_id); - gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_leave_id); - gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_drop_id); - gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_data_received_id); - - gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_end_id); - gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_data_get_id); - - if (ethi->stipple){ - gdk_bitmap_unref (ethi->stipple); - ethi->stipple = NULL; - } - - if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->unrealize) - (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->unrealize)(item); -} - -static void -ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height) -{ - ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item); - GnomeCanvas *canvas = item->canvas; - const int cols = e_table_header_count (ethi->eth); - int x1, x2; - int col; - GHashTable *arrows = g_hash_table_new (NULL, NULL); - - - if (ethi->sort_info) { - int length = e_table_sort_info_grouping_get_count(ethi->sort_info); - int i; - for (i = 0; i < length; i++) { - ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i); - g_hash_table_insert (arrows, - (gpointer) column.column, - (gpointer) (column.ascending ? - E_TABLE_COL_ARROW_UP : - E_TABLE_COL_ARROW_DOWN)); - } - length = e_table_sort_info_sorting_get_count(ethi->sort_info); - for (i = 0; i < length; i++) { - ETableSortColumn column = e_table_sort_info_sorting_get_nth(ethi->sort_info, i); - g_hash_table_insert (arrows, - (gpointer) column.column, - (gpointer) (column.ascending ? - E_TABLE_COL_ARROW_UP : - E_TABLE_COL_ARROW_DOWN)); - } - } - - ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width; - x1 = x2 = 0; - x2 += ethi->group_indent_width; - for (col = 0; col < cols; col++, x1 = x2){ - ETableCol *ecol = e_table_header_get_column (ethi->eth, col); - int col_width; - - col_width = ecol->width; - - x2 += col_width; - - if (x1 > (x + width)) - break; - - if (x2 < x) - continue; - - e_table_header_draw_button (drawable, ecol, - GTK_WIDGET (canvas)->style, ethi->font, - GTK_WIDGET_STATE (canvas), - GTK_WIDGET (canvas), ethi->gc, - x1 - x, -y, - width, height, - x2 - x1, ethi->height, - (ETableColArrow) g_hash_table_lookup ( - arrows, (gpointer) ecol->col_idx)); - } - - g_hash_table_destroy (arrows); -} - -static double -ethi_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - *actual_item = item; - return 0.0; -} - -/* - * is_pointer_on_division: - * - * Returns whether @pos is a column header division; If @the_total is not NULL, - * then the actual position is returned here. If @return_ecol is not NULL, - * then the ETableCol that actually contains this point is returned here - */ -static gboolean -is_pointer_on_division (ETableHeaderItem *ethi, int pos, int *the_total, int *return_col) -{ - const int cols = e_table_header_count (ethi->eth); - int col, total; - - total = 0; - for (col = 0; col < cols; col++){ - ETableCol *ecol = e_table_header_get_column (ethi->eth, col); - - if (col == 0) - total += ethi->group_indent_width; - - total += ecol->width; - - if ((total - TOLERANCE < pos)&& (pos < total + TOLERANCE)){ - if (return_col) - *return_col = col; - if (the_total) - *the_total = total; - - return TRUE; - } - - if (total > pos + TOLERANCE) - return FALSE; - } - - return FALSE; -} - -#define convert(c,sx,sy,x,y) gnome_canvas_w2c (c,sx,sy,x,y) - -static void -set_cursor (ETableHeaderItem *ethi, int pos) -{ - int col; - GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas); - gboolean resizeable = FALSE; - - /* We might be invoked before we are realized */ - if (!canvas->window) - return; - - if (is_pointer_on_division (ethi, pos, NULL, &col)) { - int last_col = ethi->eth->col_count - 1; - ETableCol *ecol = e_table_header_get_column (ethi->eth, col); - - /* Last column is not resizable */ - if (ecol->resizeable && col != last_col) { - int c = col + 1; - - /* Column is not resizable if all columns after it - are also not resizable */ - for (; c <= last_col; c++){ - ETableCol *ecol2; - - ecol2 = e_table_header_get_column (ethi->eth, c); - if (ecol2->resizeable) { - resizeable = TRUE; - break; - } - } - } - } - - if (resizeable) - e_cursor_set (canvas->window, E_CURSOR_SIZE_X); - else - gdk_window_set_cursor (canvas->window, NULL); - /* e_cursor_set (canvas->window, E_CURSOR_ARROW);*/ -} - -static void -ethi_end_resize (ETableHeaderItem *ethi) -{ - ethi->resize_col = -1; - ethi->resize_guide = GINT_TO_POINTER (0); - - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi)); -} - -static gboolean -ethi_maybe_start_drag (ETableHeaderItem *ethi, GdkEventMotion *event) -{ - if (!ethi->maybe_drag) - return FALSE; - - if (ethi->eth->col_count < 2) { - ethi->maybe_drag = FALSE; - return FALSE; - } - - if (MAX (abs (ethi->click_x - event->x), - abs (ethi->click_y - event->y)) <= 3) - return FALSE; - - return TRUE; -} - -static void -ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event) -{ - GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas); - GtkTargetList *list; - GdkDragContext *context; - ETableCol *ecol; - int col_width; - GdkPixmap *pixmap; - int group_indent = 0; - GHashTable *arrows = g_hash_table_new (NULL, NULL); - - GtkTargetEntry ethi_drag_types [] = { - { TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER }, - }; - - ethi->drag_col = ethi_find_col_by_x (ethi, event->motion.x); - - if (ethi->drag_col == -1) - return; - - if (ethi->sort_info) { - int length = e_table_sort_info_grouping_get_count(ethi->sort_info); - int i; - for (i = 0; i < length; i++) { - ETableSortColumn column = - e_table_sort_info_grouping_get_nth( - ethi->sort_info, i); - group_indent ++; - g_hash_table_insert ( - arrows, - (gpointer) column.column, - (gpointer) (column.ascending ? - E_TABLE_COL_ARROW_UP : - E_TABLE_COL_ARROW_DOWN)); - } - length = e_table_sort_info_sorting_get_count(ethi->sort_info); - for (i = 0; i < length; i++) { - ETableSortColumn column = - e_table_sort_info_sorting_get_nth ( - ethi->sort_info, i); - - g_hash_table_insert ( - arrows, - (gpointer) column.column, - (gpointer) (column.ascending ? - E_TABLE_COL_ARROW_UP : - E_TABLE_COL_ARROW_DOWN)); - } - } - - ethi_drag_types[0].target = g_strdup_printf( - "%s-%s", ethi_drag_types[0].target, ethi->dnd_code); - list = gtk_target_list_new ( - ethi_drag_types, ELEMENTS (ethi_drag_types)); - context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event); - g_free(ethi_drag_types[0].target); - - ecol = e_table_header_get_column (ethi->eth, ethi->drag_col); - col_width = ecol->width; - pixmap = gdk_pixmap_new (widget->window, col_width, ethi->height, -1); - - e_table_header_draw_button ( - pixmap, ecol, - widget->style, ethi->font, - GTK_WIDGET_STATE (widget), - widget, ethi->gc, - 0, 0, - col_width, ethi->height, - col_width, ethi->height, - (ETableColArrow) g_hash_table_lookup ( - arrows, (gpointer) ecol->col_idx)); - gtk_drag_set_icon_pixmap ( - context, - gdk_window_get_colormap (widget->window), - pixmap, - NULL, - col_width / 2, - ethi->height / 2); - gdk_pixmap_unref (pixmap); - - ethi->maybe_drag = FALSE; - g_hash_table_destroy (arrows); -} - -typedef struct { - ETableHeaderItem *ethi; - int col; -} EthiHeaderInfo; - -static void -ethi_popup_sort_ascending(GtkWidget *widget, EthiHeaderInfo *info) -{ - ETableCol *col; - int model_col; - int length; - int i; - int found = FALSE; - ETableHeaderItem *ethi = info->ethi; - - col = e_table_header_get_column (ethi->eth, info->col); - model_col = col->col_idx; - - length = e_table_sort_info_grouping_get_count(ethi->sort_info); - for (i = 0; i < length; i++) { - ETableSortColumn column = e_table_sort_info_grouping_get_nth ( - ethi->sort_info, i); - - if (model_col == column.column){ - column.ascending = 1; - e_table_sort_info_grouping_set_nth ( - ethi->sort_info, i, column); - found = 1; - break; - } - } - if (!found) { - length = e_table_sort_info_sorting_get_count ( - ethi->sort_info); - for (i = 0; i < length; i++) { - ETableSortColumn column = - e_table_sort_info_sorting_get_nth( - ethi->sort_info, i); - if (model_col == column.column){ - column.ascending = 1; - e_table_sort_info_sorting_set_nth ( - ethi->sort_info, i, column); - found = 1; - break; - } - } - } - if (!found) { - ETableSortColumn column = { model_col, 1 }; - length = e_table_sort_info_sorting_get_count(ethi->sort_info); - if (length == 0) - length++; - e_table_sort_info_sorting_set_nth(ethi->sort_info, length - 1, column); - } -} - -static void -ethi_popup_sort_descending(GtkWidget *widget, EthiHeaderInfo *info) -{ - ETableCol *col; - int model_col; - int length; - int i; - int found = FALSE; - ETableHeaderItem *ethi = info->ethi; - - col = e_table_header_get_column (ethi->eth, info->col); - model_col = col->col_idx; - - length = e_table_sort_info_grouping_get_count(ethi->sort_info); - for (i = 0; i < length; i++) { - ETableSortColumn column = e_table_sort_info_grouping_get_nth( - ethi->sort_info, i); - if (model_col == column.column){ - column.ascending = 0; - e_table_sort_info_grouping_set_nth( - ethi->sort_info, i, column); - found = 1; - break; - } - } - if (!found) { - length = e_table_sort_info_sorting_get_count (ethi->sort_info); - for (i = 0; i < length; i++) { - ETableSortColumn column = - e_table_sort_info_sorting_get_nth( - ethi->sort_info, i); - - if (model_col == column.column){ - column.ascending = 0; - e_table_sort_info_sorting_set_nth ( - ethi->sort_info, i, column); - found = 1; - break; - } - } - } - if (!found) { - ETableSortColumn column = { model_col, 0 }; - length = e_table_sort_info_sorting_get_count (ethi->sort_info); - if (length == 0) - length++; - e_table_sort_info_sorting_set_nth ( - ethi->sort_info, length - 1, column); - } -} - -static void -ethi_popup_unsort(GtkWidget *widget, EthiHeaderInfo *info) -{ - ETableHeaderItem *ethi = info->ethi; - - e_table_sort_info_grouping_truncate(ethi->sort_info, 0); - e_table_sort_info_sorting_truncate(ethi->sort_info, 0); -} - -static void -ethi_popup_group_field(GtkWidget *widget, EthiHeaderInfo *info) -{ - ETableCol *col; - int model_col; - ETableHeaderItem *ethi = info->ethi; - ETableSortColumn column; - - col = e_table_header_get_column (ethi->eth, info->col); - model_col = col->col_idx; - - column.column = model_col; - column.ascending = 1; - e_table_sort_info_grouping_set_nth(ethi->sort_info, 0, column); - e_table_sort_info_grouping_truncate(ethi->sort_info, 1); -} - -static void -ethi_popup_group_box(GtkWidget *widget, EthiHeaderInfo *info) -{ -} - -static void -ethi_popup_remove_column(GtkWidget *widget, EthiHeaderInfo *info) -{ - e_table_header_remove(info->ethi->eth, info->col); -} - -static void -ethi_popup_field_chooser(GtkWidget *widget, EthiHeaderInfo *info) -{ - GtkWidget *etfcd = e_table_field_chooser_dialog_new(); - gtk_object_set(GTK_OBJECT(etfcd), - "full_header", info->ethi->full_header, - "dnd_code", info->ethi->dnd_code, - NULL); - gtk_widget_show(etfcd); -} - -static void -ethi_popup_alignment(GtkWidget *widget, EthiHeaderInfo *info) -{ -} - -static void -ethi_popup_best_fit(GtkWidget *widget, EthiHeaderInfo *info) -{ - ETableHeaderItem *ethi = info->ethi; - int width; - - gtk_signal_emit_by_name (GTK_OBJECT (ethi->eth), - "request_width", - info->col, &width); - /* Add 10 to stop it from "..."ing */ - e_table_header_set_size (ethi->eth, info->col, width + 10); - - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi)); - -} - -static void -ethi_popup_format_columns(GtkWidget *widget, EthiHeaderInfo *info) -{ -} - -static void -config_destroyed (GtkObject *object, ETableHeaderItem *ethi) -{ - ethi->config = NULL; -} - -static void -apply_changes (GnomePropertyBox *pbox, gint page_num, ETableHeaderItem *ethi) -{ - ETableConfig *config = E_TABLE_CONFIG (ethi->config); - char *state = e_table_state_save_to_string (config->state); - - if (page_num != -1) - return; - - e_table_set_state (ethi->table, state); - g_free (state); -} - -static void -ethi_popup_customize_view(GtkWidget *widget, EthiHeaderInfo *info) -{ - ETableHeaderItem *ethi = info->ethi; - ETableState *state; - - if (ethi->config) - e_table_config_raise (E_TABLE_CONFIG (ethi->config)); - else { - state = e_table_get_state_object(ethi->table); - - ethi->config = e_table_config_new ( - _("Configuring view: FIXME"), - ethi->table->spec, state); - gtk_signal_connect ( - GTK_OBJECT (ethi->config), "destroy", - GTK_SIGNAL_FUNC (config_destroyed), ethi); - gtk_signal_connect ( - GTK_OBJECT ( - E_TABLE_CONFIG (ethi->config)->dialog_toplevel), - "apply", - GTK_SIGNAL_FUNC (apply_changes), ethi); - } -} - -/* Bit 1 is always disabled. */ -/* Bit 2 is disabled if not "sortable". */ -/* Bit 4 is disabled if we don't have a pointer to our table object. */ -static EPopupMenu ethi_context_menu [] = { - { N_("Sort Ascending"), NULL, GTK_SIGNAL_FUNC(ethi_popup_sort_ascending), NULL, 2}, - { N_("Sort Descending"), NULL, GTK_SIGNAL_FUNC(ethi_popup_sort_descending), NULL, 2}, - { N_("Unsort"), NULL, GTK_SIGNAL_FUNC(ethi_popup_unsort), NULL, 0}, - { "", NULL, GTK_SIGNAL_FUNC(NULL), NULL, 0}, - { N_("Group By This Field"), NULL, GTK_SIGNAL_FUNC(ethi_popup_group_field), NULL, 0}, - { N_("Group By Box"), NULL, GTK_SIGNAL_FUNC(ethi_popup_group_box), NULL, 1}, - { "", NULL, GTK_SIGNAL_FUNC(NULL), NULL, 1}, - { N_("Remove This Column"), NULL, GTK_SIGNAL_FUNC(ethi_popup_remove_column), NULL, 0}, - { N_("Add a Column..."), NULL, GTK_SIGNAL_FUNC(ethi_popup_field_chooser), NULL, 0}, - { "", NULL, GTK_SIGNAL_FUNC(NULL), NULL, 1}, - { N_("Alignment"), NULL, GTK_SIGNAL_FUNC(ethi_popup_alignment), NULL, 1}, - { N_("Best Fit"), NULL, GTK_SIGNAL_FUNC(ethi_popup_best_fit), NULL, 2}, - { N_("Format Columns..."), NULL, GTK_SIGNAL_FUNC(ethi_popup_format_columns), NULL, 1}, - { "", NULL, GTK_SIGNAL_FUNC(NULL), NULL, 1}, - { N_("Customize Current View..."), NULL, GTK_SIGNAL_FUNC(ethi_popup_customize_view), NULL, 4}, - { NULL, NULL, NULL, NULL, 0 } -}; - -static void -ethi_header_context_menu (ETableHeaderItem *ethi, GdkEventButton *event) -{ - EthiHeaderInfo *info = g_new(EthiHeaderInfo, 1); - ETableCol *col; - info->ethi = ethi; - info->col = ethi_find_col_by_x (ethi, event->x); - col = e_table_header_get_column (ethi->eth, info->col); - e_popup_menu_run (ethi_context_menu, (GdkEvent *) event, - 1 + - (col->sortable ? 0 : 2) + - (ethi->table ? 0 : 4), 0, info); -} - -static void -ethi_button_pressed (ETableHeaderItem *ethi, GdkEventButton *event) -{ - gtk_signal_emit (GTK_OBJECT (ethi), - ethi_signals [BUTTON_PRESSED], event); -} - -static void -ethi_change_sort_state (ETableHeaderItem *ethi, gdouble x) -{ - ETableCol *col; - int model_col; - int length; - int i; - int found = FALSE; - - col = e_table_header_get_column (ethi->eth, ethi_find_col_by_x (ethi, x)); - model_col = col->col_idx; - - length = e_table_sort_info_grouping_get_count(ethi->sort_info); - for (i = 0; i < length; i++) { - ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i); - if (model_col == column.column){ - int ascending = column.ascending; - ascending = ! ascending; - column.ascending = ascending; - e_table_sort_info_grouping_set_nth(ethi->sort_info, i, column); - found = 1; - break; - } - } - - if (!col->sortable) - return; - - if (!found) { - length = e_table_sort_info_sorting_get_count(ethi->sort_info); - for (i = 0; i < length; i++) { - ETableSortColumn column = e_table_sort_info_sorting_get_nth(ethi->sort_info, i); - - if (model_col == column.column){ - int ascending = column.ascending; - - if (ascending == 0){ - /* - * This means the user has clicked twice - * already, lets kill sorting now. - */ - e_table_sort_info_sorting_truncate (ethi->sort_info, i); - } else { - ascending = !ascending; - column.ascending = ascending; - e_table_sort_info_sorting_set_nth(ethi->sort_info, i, column); - } - found = 1; - break; - } - } - } - - if (!found) { - ETableSortColumn column = { model_col, 1 }; - length = e_table_sort_info_sorting_get_count(ethi->sort_info); - if (length == 0) - length++; - e_table_sort_info_sorting_set_nth(ethi->sort_info, length - 1, column); - } -} - -/* - * Handles the events on the ETableHeaderItem, particularly it handles resizing - */ -static int -ethi_event (GnomeCanvasItem *item, GdkEvent *e) -{ - ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item); - GnomeCanvas *canvas = item->canvas; - const gboolean resizing = ETHI_RESIZING (ethi); - int x, y, start, col; - int was_maybe_drag = 0; - - switch (e->type){ - case GDK_ENTER_NOTIFY: - convert (canvas, e->crossing.x, e->crossing.y, &x, &y); - set_cursor (ethi, x); - break; - - case GDK_LEAVE_NOTIFY: - gdk_window_set_cursor (GTK_WIDGET (canvas)->window, NULL); - /* e_cursor_set (GTK_WIDGET (canvas)->window, E_CURSOR_ARROW);*/ - break; - - case GDK_MOTION_NOTIFY: - - convert (canvas, e->motion.x, e->motion.y, &x, &y); - if (resizing){ - int new_width; - - if (ethi->resize_guide == NULL){ - /* Quick hack until I actually bind the views */ - ethi->resize_guide = GINT_TO_POINTER (1); - - gnome_canvas_item_grab (item, - GDK_POINTER_MOTION_MASK | - GDK_BUTTON_RELEASE_MASK, - e_cursor_get (E_CURSOR_SIZE_X), - e->button.time); - } - - new_width = x - ethi->resize_start_pos; - - e_table_header_set_size (ethi->eth, ethi->resize_col, new_width); - - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi)); - } else if (ethi_maybe_start_drag (ethi, &e->motion)){ - ethi_start_drag (ethi, e); - } else - set_cursor (ethi, x); - break; - - case GDK_BUTTON_PRESS: - if (e->button.button > 3) - return FALSE; - - convert (canvas, e->button.x, e->button.y, &x, &y); - - if (is_pointer_on_division (ethi, x, &start, &col) && e->button.button == 1){ - ETableCol *ecol; - - /* - * Record the important bits. - * - * By setting resize_pos to a non -1 value, - * we know that we are being resized (used in the - * other event handlers). - */ - ecol = e_table_header_get_column (ethi->eth, col); - - if (!ecol->resizeable) - break; - ethi->resize_col = col; - ethi->resize_start_pos = start - ecol->width; - ethi->resize_min_width = ecol->min_width; - } else { - if (e->button.button == 1){ - ethi->click_x = e->button.x; - ethi->click_y = e->button.y; - ethi->maybe_drag = TRUE; - } else if (e->button.button == 3){ - ethi_header_context_menu (ethi, &e->button); - } else - ethi_button_pressed (ethi, &e->button); - } - break; - - case GDK_2BUTTON_PRESS: - if (!resizing) - break; - - if (e->button.button != 1) - break; - else { - int width = 0; - gtk_signal_emit_by_name (GTK_OBJECT (ethi->eth), - "request_width", - (int)ethi->resize_col, &width); - /* Add 10 to stop it from "..."ing */ - e_table_header_set_size (ethi->eth, ethi->resize_col, width + 10); - - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi)); - ethi->maybe_drag = FALSE; - } - break; - - case GDK_BUTTON_RELEASE: { - gboolean needs_ungrab = FALSE; - - was_maybe_drag = ethi->maybe_drag; - - ethi->maybe_drag = FALSE; - - if (ethi->resize_col != -1){ - needs_ungrab = (ethi->resize_guide != NULL); - ethi_end_resize (ethi); - } else if (was_maybe_drag && ethi->sort_info) - ethi_change_sort_state (ethi, e->button.x); - - if (needs_ungrab) - gnome_canvas_item_ungrab (item, e->button.time); - - break; - } - - default: - return FALSE; - } - return TRUE; -} - -static void -ethi_class_init (GtkObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - - ethi_parent_class = gtk_type_class (PARENT_OBJECT_TYPE); - - object_class->destroy = ethi_destroy; - object_class->set_arg = ethi_set_arg; - object_class->get_arg = ethi_get_arg; - - item_class->update = ethi_update; - item_class->realize = ethi_realize; - item_class->unrealize = ethi_unrealize; - item_class->draw = ethi_draw; - item_class->point = ethi_point; - item_class->event = ethi_event; - - gtk_object_add_arg_type ("ETableHeaderItem::ETableHeader", GTK_TYPE_OBJECT, - GTK_ARG_WRITABLE, ARG_TABLE_HEADER); - gtk_object_add_arg_type ("ETableHeaderItem::full_header", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_FULL_HEADER); - gtk_object_add_arg_type ("ETableHeaderItem::dnd_code", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_DND_CODE); - gtk_object_add_arg_type ("ETableHeaderItem::fontset", GTK_TYPE_STRING, - GTK_ARG_WRITABLE, ARG_TABLE_FONTSET); - gtk_object_add_arg_type ("ETableHeaderItem::sort_info", GTK_TYPE_OBJECT, - GTK_ARG_WRITABLE, ARG_SORT_INFO); - gtk_object_add_arg_type ("ETableHeaderItem::table", GTK_TYPE_OBJECT, - GTK_ARG_WRITABLE, ARG_TABLE); - - /* - * Create our pixmaps for DnD - */ - dnd_colormap = gtk_widget_get_default_colormap (); - remove_col_pixmap = gdk_pixmap_colormap_create_from_xpm_d ( - NULL, dnd_colormap, - &remove_col_mask, NULL, remove_col_xpm); - - add_col_pixmap = gdk_pixmap_colormap_create_from_xpm_d ( - NULL, dnd_colormap, - &add_col_mask, NULL, add_col_xpm); - - ethi_signals [BUTTON_PRESSED] = - gtk_signal_new ("button_pressed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableHeaderItemClass, button_pressed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, ethi_signals, LAST_SIGNAL); -} - -static void -ethi_init (GnomeCanvasItem *item) -{ - ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item); - - ethi->resize_col = -1; - - item->x1 = 0; - item->y1 = 0; - item->x2 = 0; - item->y2 = 0; - - ethi->drag_col = -1; - ethi->drag_mark = -1; - - ethi->sort_info = NULL; - - ethi->sort_info_changed_id = 0; - ethi->group_info_changed_id = 0; - - ethi->group_indent_width = 0; - ethi->table = NULL; -} - -GtkType -e_table_header_item_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETableHeaderItem", - sizeof (ETableHeaderItem), - sizeof (ETableHeaderItemClass), - (GtkClassInitFunc) ethi_class_init, - (GtkObjectInitFunc) ethi_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_OBJECT_TYPE, &info); - } - - return type; -} - diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h deleted file mode 100644 index 6186037d5d..0000000000 --- a/widgets/table/e-table-header-item.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_HEADER_ITEM_H_ -#define _E_TABLE_HEADER_ITEM_H_ - -#include <gal/e-table/e-table.h> -#include <libgnomeui/gnome-canvas.h> -#include <gnome-xml/tree.h> -#include <gal/e-table/e-table-header.h> -#include <gal/e-table/e-table-sort-info.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_HEADER_ITEM_TYPE (e_table_header_item_get_type ()) -#define E_TABLE_HEADER_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_HEADER_ITEM_TYPE, ETableHeaderItem)) -#define E_TABLE_HEADER_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_HEADER_ITEM_TYPE, ETableHeaderItemClass)) -#define E_IS_TABLE_HEADER_ITEM(o) (GTK_CHECK_TYPE ((o), E_TABLE_HEADER_ITEM_TYPE)) -#define E_IS_TABLE_HEADER_ITEM_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_ITEM_TYPE)) - -typedef struct { - GnomeCanvasItem parent; - ETableHeader *eth; - - GdkGC *gc; - GdkCursor *change_cursor; - - short height, width; - GdkFont *font; - - /* - * Used during resizing; Could be shorts - */ - int resize_col; - int resize_start_pos; - int resize_min_width; - - GtkObject *resize_guide; - - int group_indent_width; - - /* - * Ids - */ - int structure_change_id, dimension_change_id; - - /* - * For dragging columns - */ - guint maybe_drag:1; - guint dnd_ready:1; - int click_x, click_y; - int drag_col, drop_col, drag_mark; - guint drag_motion_id, drag_end_id, drag_leave_id, drag_drop_id, drag_data_received_id, drag_data_get_id; - guint sort_info_changed_id, group_info_changed_id; - GnomeCanvasItem *remove_item; - GdkBitmap *stipple; - - gchar *dnd_code; - - /* - * For column sorting info - */ - ETableSortInfo *sort_info; - - /* For adding fields. */ - ETableHeader *full_header; - ETable *table; - void *config; -} ETableHeaderItem; - -typedef struct { - GnomeCanvasItemClass parent_class; - - /* - * signals - */ - void (*button_pressed) (ETableHeaderItem *ethi, GdkEventButton *button); -} ETableHeaderItemClass; - -GtkType e_table_header_item_get_type (void); - -END_GNOME_DECLS - -#endif /* _E_TABLE_HEADER_ITEM_H_ */ diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c deleted file mode 100644 index 987207f588..0000000000 --- a/widgets/table/e-table-header-utils.c +++ /dev/null @@ -1,429 +0,0 @@ -/* ETable widget - utilities for drawing table header buttons - * - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Chris Lahey <clahey@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include "e-table-defines.h" -#include "e-table-header-utils.h" - - - -/** - * e_table_header_compute_height: - * @ecol: Table column description. - * @style: Style for the button's bevel. - * @font: Font for the button's text, or NULL if no font is available. - * - * Computes the minimum height required for a table header button. - * - * Return value: The height of the button, in pixels. - **/ -double -e_table_header_compute_height (ETableCol *ecol, GtkStyle *style, GdkFont *font) -{ - int ythick; - int height; - - g_return_val_if_fail (ecol != NULL, -1); - g_return_val_if_fail (E_IS_TABLE_COL (ecol), -1); - g_return_val_if_fail (style != NULL, -1); - - ythick = style->klass->ythickness; - - if (font) - height = font->ascent + font->descent; - else - height = 16; /* FIXME: default? */ - - if (ecol->is_pixbuf) { - g_assert (ecol->pixbuf != NULL); - height = MAX (height, gdk_pixbuf_get_height (ecol->pixbuf)); - } - - height = MAX (height, MIN_ARROW_SIZE); - - height += 2 * (ythick + HEADER_PADDING); - - return height; -} - -double -e_table_header_width_extras (GtkStyle *style) -{ - g_return_val_if_fail (style != NULL, -1); - - return 2 * (style->klass->xthickness + HEADER_PADDING); -} - -/* Creates a pixmap that is a composite of a background color and the upper-left - * corner rectangle of a pixbuf. - */ -static GdkPixmap * -make_composite_pixmap (GdkDrawable *drawable, GdkGC *gc, - GdkPixbuf *pixbuf, GdkColor *bg, int width, int height, - int dither_xofs, int dither_yofs) -{ - int pwidth, pheight; - GdkPixmap *pixmap; - GdkPixbuf *tmp; - int color; - - pwidth = gdk_pixbuf_get_width (pixbuf); - pheight = gdk_pixbuf_get_height (pixbuf); - g_assert (width <= pwidth && height <= pheight); - - color = ((bg->red & 0xff00) << 8) | (bg->green & 0xff00) | ((bg->blue & 0xff00) >> 8); - - if (width >= pwidth && height >= pheight) { - tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height); - if (!tmp) - return NULL; - - gdk_pixbuf_composite_color (pixbuf, tmp, - 0, 0, - width, height, - 0, 0, - 1.0, 1.0, - GDK_INTERP_NEAREST, - 255, - 0, 0, - 16, - color, color); - } else { - int x, y, rowstride; - GdkPixbuf *fade; - guchar *pixels; - - /* Do a nice fade of the pixbuf down and to the right */ - - fade = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height); - if (!fade) - return NULL; - - gdk_pixbuf_copy_area (pixbuf, - 0, 0, - width, height, - fade, - 0, 0); - - rowstride = gdk_pixbuf_get_rowstride (fade); - pixels = gdk_pixbuf_get_pixels (fade); - - for (y = 0; y < height; y++) { - guchar *p; - int yfactor; - - p = pixels + y * rowstride; - - if (height < pheight) - yfactor = height - y; - else - yfactor = height; - - for (x = 0; x < width; x++) { - int xfactor; - - if (width < pwidth) - xfactor = width - x; - else - xfactor = width; - - p[3] = ((int) p[3] * xfactor * yfactor / (width * height)); - p += 4; - } - } - - tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height); - if (!tmp) { - gdk_pixbuf_unref (fade); - return NULL; - } - - gdk_pixbuf_composite_color (fade, tmp, - 0, 0, - width, height, - 0, 0, - 1.0, 1.0, - GDK_INTERP_NEAREST, - 255, - 0, 0, - 16, - color, color); - - gdk_pixbuf_unref (fade); - } - - pixmap = gdk_pixmap_new (drawable, width, height, gdk_rgb_get_visual ()->depth); - gdk_draw_rgb_image_dithalign (pixmap, gc, - 0, 0, - width, height, - GDK_RGB_DITHER_NORMAL, - gdk_pixbuf_get_pixels (tmp), - gdk_pixbuf_get_rowstride (tmp), - dither_xofs, dither_yofs); - gdk_pixbuf_unref (tmp); - - return pixmap; -} - -/** - * e_table_header_draw_button: - * @drawable: Destination drawable. - * @ecol: Table column for the header information. - * @style: Style to use for drawing the button. - * @font: Font for the button's text. - * @state: State of the table widget. - * @widget: The table widget. - * @gc: GC to use for drawing. - * @x: Leftmost coordinate of the button. - * @y: Topmost coordinate of the button. - * @width: Width of the region to draw. - * @height: Height of the region to draw. - * @button_width: Width for the complete button. - * @button_height: Height for the complete button. - * @arrow: Arrow type to use as a sort indicator. - * - * Draws a button suitable for a table header. - **/ -void -e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol, - GtkStyle *style, GdkFont *font, GtkStateType state, - GtkWidget *widget, GdkGC *gc, - int x, int y, int width, int height, - int button_width, int button_height, - ETableColArrow arrow) -{ - int xthick, ythick; - int inner_x, inner_y; - int inner_width, inner_height; - - g_return_if_fail (drawable != NULL); - g_return_if_fail (ecol != NULL); - g_return_if_fail (E_IS_TABLE_COL (ecol)); - g_return_if_fail (style != NULL); - g_return_if_fail (font != NULL); - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (button_width > 0 && button_height > 0); - - xthick = style->klass->xthickness; - ythick = style->klass->ythickness; - - /* Button bevel */ - - gtk_paint_box (style, drawable, state, GTK_SHADOW_OUT, - NULL, widget, "button", - x, y, button_width, button_height); - - /* Inside area */ - - inner_width = button_width - 2 * (xthick + HEADER_PADDING); - inner_height = button_height - 2 * (ythick + HEADER_PADDING); - - if (inner_width < 1 || inner_height < 1) - return; /* nothing fits */ - - inner_x = x + xthick + HEADER_PADDING; - inner_y = y + ythick + HEADER_PADDING; - - /* Arrow */ - - switch (arrow) { - case E_TABLE_COL_ARROW_NONE: - break; - - case E_TABLE_COL_ARROW_UP: - case E_TABLE_COL_ARROW_DOWN: { - int arrow_width, arrow_height; - - arrow_width = MIN (MIN_ARROW_SIZE, inner_width); - arrow_height = MIN (MIN_ARROW_SIZE, inner_height); - - gtk_paint_arrow (style, drawable, state, - GTK_SHADOW_IN, NULL, widget, "header", - (arrow == E_TABLE_COL_ARROW_UP) ? GTK_ARROW_UP : GTK_ARROW_DOWN, - TRUE, - inner_x + inner_width - arrow_width, - inner_y + (inner_height - arrow_height) / 2, - arrow_width, arrow_height); - - inner_width -= arrow_width + HEADER_PADDING; - break; - } - - default: - g_assert_not_reached (); - return; - } - - if (inner_width < 1) - return; /* nothing else fits */ - - /* Pixbuf or label */ - - if (ecol->is_pixbuf) { - int pwidth, pheight; - int clip_width, clip_height; - GdkPixmap *pixmap; - - g_assert (ecol->pixbuf != NULL); - - pwidth = gdk_pixbuf_get_width (ecol->pixbuf); - pheight = gdk_pixbuf_get_height (ecol->pixbuf); - - clip_width = MIN (pwidth, inner_width); - clip_height = MIN (pheight, inner_height); - - pixmap = make_composite_pixmap (drawable, gc, - ecol->pixbuf, &style->bg[state], - clip_width, clip_height, - inner_x, - inner_y + (inner_height - clip_height) / 2); - if (pixmap) { - gdk_draw_pixmap (drawable, gc, pixmap, - 0, 0, - inner_x, - inner_y + (inner_height - clip_height) / 2, - clip_width, clip_height); - gdk_pixmap_unref (pixmap); - } - } else { - int ypos; - - ypos = inner_y + (inner_height - font->ascent - font->descent) / 2 + font->ascent; - - e_table_draw_elided_string (drawable, font, gc, - inner_x, ypos, - ecol->text, inner_width, TRUE); - } -} - -/* Computes the length of a string that needs to be trimmed for elision */ -static int -compute_elision_length (GdkFont *font, const char *str, int max_width) -{ - int len; - int l = 0, left, right; - int rbearing; - - len = strlen (str); - - if (len <= 0) - return 0; - - left = 0; - right = len; - - while (left < right) { - l = (left + right) / 2; - gdk_text_extents (font, str, l, NULL, &rbearing, NULL, NULL, NULL); - - if (rbearing < max_width) - left = l + 1; - else if (rbearing > max_width) - right = l; - else - return l; - } - - if (rbearing > max_width) - return MAX (0, l - 1); - else - return l; -} - -/* Default width of the elision arrow in pixels */ -#define ARROW_WIDTH 4 - -/** - * e_table_draw_elided_string: - * @drawable: Destination drawable. - * @font: Font for the text. - * @gc: GC to use for drawing. - * @x: X insertion point for the string. - * @y: Y insertion point for the string's baseline. - * @str: String to draw. - * @max_width: Maximum width in which the string must fit. - * @center: Whether to center the string in the available area if it does fit. - * - * Draws a string, possibly trimming it so that it fits inside the specified - * maximum width. If it does not fit, an elision indicator is drawn after the - * last character that does fit. - **/ -void -e_table_draw_elided_string (GdkDrawable *drawable, GdkFont *font, GdkGC *gc, - int x, int y, const char *str, int max_width, gboolean center) -{ - int rbearing; - int width; - - g_return_if_fail (drawable != NULL); - g_return_if_fail (font != NULL); - g_return_if_fail (gc != NULL); - g_return_if_fail (str != NULL); - g_return_if_fail (max_width >= 0); - - gdk_string_extents (font, str, NULL, &rbearing, &width, NULL, NULL); - - if (rbearing <= max_width) { - int xpos; - - if (center) - xpos = x + (max_width - width) / 2; - else - xpos = x; - - gdk_draw_string (drawable, font, gc, xpos, y, str); - } else { - int arrow_width; - int len; - int i; - - if (max_width < ARROW_WIDTH + 1) - arrow_width = max_width - 1; - else - arrow_width = ARROW_WIDTH; - - len = compute_elision_length (font, str, max_width - arrow_width - 1); - gdk_draw_text (drawable, font, gc, x, y, str, len); - - gdk_text_extents (font, str, len, NULL, &rbearing, NULL, NULL, NULL); - - y -= font->ascent; - - for (i = 0; i < arrow_width; i++) { - int h; - - h = 2 * i + 1; - - gdk_draw_line (drawable, gc, - x + rbearing + arrow_width - i, - y + (font->ascent + font->descent - h) / 2, - x + rbearing + arrow_width - i, - y + (font->ascent + font->descent - h) / 2 + h - 1); - } - } -} diff --git a/widgets/table/e-table-header-utils.h b/widgets/table/e-table-header-utils.h deleted file mode 100644 index 62f66e4bd3..0000000000 --- a/widgets/table/e-table-header-utils.h +++ /dev/null @@ -1,65 +0,0 @@ -/* ETable widget - utilities for drawing table header buttons - * - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Chris Lahey <clahey@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef E_TABLE_HEADER_UTILS_H -#define E_TABLE_HEADER_UTILS_H - -#include <gal/e-table/e-table-col.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -double e_table_header_compute_height (ETableCol *ecol, - GtkStyle *style, - GdkFont *font); -double e_table_header_width_extras (GtkStyle *style); -void e_table_header_draw_button (GdkDrawable *drawable, - ETableCol *ecol, - GtkStyle *style, - GdkFont *font, - GtkStateType state, - GtkWidget *widget, - GdkGC *gc, - int x, - int y, - int width, - int height, - int button_width, - int button_height, - ETableColArrow arrow); -void e_table_draw_elided_string (GdkDrawable *drawable, - GdkFont *font, - GdkGC *gc, - int x, - int y, - const char *str, - int max_width, - gboolean center); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c deleted file mode 100644 index 58d60480cd..0000000000 --- a/widgets/table/e-table-header.c +++ /dev/null @@ -1,833 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-col-head.c: TableColHead implementation - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Ximian, Inc - */ -#include <config.h> -#include <string.h> -#include <gtk/gtkobject.h> -#include <gtk/gtksignal.h> -#include "e-table-header.h" -#include "e-table-defines.h" - -/* The arguments we take */ -enum { - ARG_0, - ARG_SORT_INFO, - ARG_WIDTH, - ARG_WIDTH_EXTRAS, -}; - -enum { - STRUCTURE_CHANGE, - DIMENSION_CHANGE, - REQUEST_WIDTH, - LAST_SIGNAL -}; - -static void eth_set_size (ETableHeader *eth, int idx, int size); -static void eth_calc_widths (ETableHeader *eth); - -static guint eth_signals [LAST_SIGNAL] = { 0, }; - -static GtkObjectClass *e_table_header_parent_class; - -struct two_ints { - int column; - int width; -}; - -static void -eth_set_width (ETableHeader *eth, int width) -{ - eth->width = width; -} - -static void -dequeue (ETableHeader *eth, int *column, int *width) -{ - GSList *head; - struct two_ints *store; - head = eth->change_queue; - eth->change_queue = eth->change_queue->next; - if (!eth->change_queue) - eth->change_tail = NULL; - store = head->data; - g_slist_free_1(head); - if (column) - *column = store->column; - if (width) - *width = store->width; - g_free(store); -} - -static gboolean -dequeue_idle (ETableHeader *eth) -{ - int column, width; - - dequeue (eth, &column, &width); - while (eth->change_queue && ((struct two_ints *) eth->change_queue->data)->column == column) - dequeue (eth, &column, &width); - - if (column == -1) - eth_set_width (eth, width); - else if (column < eth->col_count) - eth_set_size (eth, column, width); - if (eth->change_queue) - return TRUE; - else { - eth_calc_widths (eth); - eth->idle = 0; - return FALSE; - } -} - -static void -enqueue (ETableHeader *eth, int column, int width) -{ - struct two_ints *store; - store = g_new(struct two_ints, 1); - store->column = column; - store->width = width; - - eth->change_tail = g_slist_last(g_slist_append(eth->change_tail, store)); - if (!eth->change_queue) - eth->change_queue = eth->change_tail; - - if (!eth->idle) { - eth->idle = g_idle_add_full(G_PRIORITY_LOW, (GSourceFunc) dequeue_idle, eth, NULL); - } -} - -void -e_table_header_set_size (ETableHeader *eth, int idx, int size) -{ - g_return_if_fail (eth != NULL); - g_return_if_fail (E_IS_TABLE_HEADER (eth)); - - enqueue (eth, idx, size); -} - -static void -eth_do_remove (ETableHeader *eth, int idx, gboolean do_unref) -{ - if (do_unref) - gtk_object_unref (GTK_OBJECT (eth->columns [idx])); - - memmove (ð->columns [idx], ð->columns [idx+1], - sizeof (ETableCol *) * (eth->col_count - idx - 1)); - eth->col_count--; -} - -static void -eth_destroy (GtkObject *object) -{ - ETableHeader *eth = E_TABLE_HEADER (object); - const int cols = eth->col_count; - int i; - - if (eth->sort_info) { - if (eth->sort_info_group_change_id) - gtk_signal_disconnect(GTK_OBJECT(eth->sort_info), - eth->sort_info_group_change_id); - gtk_object_unref(GTK_OBJECT(eth->sort_info)); - } - - if (eth->idle) - g_source_remove(eth->idle); - g_slist_foreach(eth->change_queue, (GFunc) g_free, NULL); - g_slist_free(eth->change_queue); - - /* - * Destroy columns - */ - for (i = cols - 1; i >= 0; i--){ - eth_do_remove (eth, i, TRUE); - } - - if (e_table_header_parent_class->destroy) - e_table_header_parent_class->destroy (object); -} - -static void -eth_group_info_changed(ETableSortInfo *info, ETableHeader *eth) -{ - enqueue(eth, -1, eth->nominal_width); -} - -static void -eth_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableHeader *eth = E_TABLE_HEADER (object); - - switch (arg_id) { - case ARG_WIDTH: - eth->nominal_width = GTK_VALUE_DOUBLE (*arg); - enqueue(eth, -1, GTK_VALUE_DOUBLE (*arg)); - break; - case ARG_WIDTH_EXTRAS: - eth->width_extras = GTK_VALUE_DOUBLE (*arg); - enqueue(eth, -1, eth->nominal_width); - break; - case ARG_SORT_INFO: - if (eth->sort_info) { - if (eth->sort_info_group_change_id) - gtk_signal_disconnect(GTK_OBJECT(eth->sort_info), eth->sort_info_group_change_id); - gtk_object_unref(GTK_OBJECT(eth->sort_info)); - } - eth->sort_info = E_TABLE_SORT_INFO(GTK_VALUE_OBJECT (*arg)); - if (eth->sort_info) { - gtk_object_ref(GTK_OBJECT(eth->sort_info)); - eth->sort_info_group_change_id - = gtk_signal_connect(GTK_OBJECT(eth->sort_info), "group_info_changed", - GTK_SIGNAL_FUNC(eth_group_info_changed), eth); - } - enqueue(eth, -1, eth->nominal_width); - break; - default: - break; - } -} - -static void -eth_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableHeader *eth = E_TABLE_HEADER (object); - - switch (arg_id) { - case ARG_SORT_INFO: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(eth->sort_info); - break; - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = eth->nominal_width; - break; - case ARG_WIDTH_EXTRAS: - GTK_VALUE_DOUBLE (*arg) = eth->width_extras; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_table_header_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = eth_destroy; - object_class->set_arg = eth_set_arg; - object_class->get_arg = eth_get_arg; - - - e_table_header_parent_class = (gtk_type_class (gtk_object_get_type ())); - - gtk_object_add_arg_type ("ETableHeader::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableHeader::width_extras", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH_EXTRAS); - gtk_object_add_arg_type ("ETableHeader::sort_info", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_SORT_INFO); - - eth_signals [STRUCTURE_CHANGE] = - gtk_signal_new ("structure_change", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableHeaderClass, structure_change), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - eth_signals [DIMENSION_CHANGE] = - gtk_signal_new ("dimension_change", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableHeaderClass, dimension_change), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - eth_signals [REQUEST_WIDTH] = - gtk_signal_new ("request_width", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableHeaderClass, request_width), - gtk_marshal_INT__INT, - GTK_TYPE_INT, 1, GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, eth_signals, LAST_SIGNAL); -} - -static void -e_table_header_init (ETableHeader *eth) -{ - eth->col_count = 0; - eth->width = 0; - - eth->sort_info = NULL; - eth->sort_info_group_change_id = 0; - - eth->columns = NULL; - - eth->change_queue = NULL; - eth->change_tail = NULL; - - eth->width_extras = 0; -} - -/** - * e_table_header_new: - * - * Returns: A new @ETableHeader object. - */ -ETableHeader * -e_table_header_new (void) -{ - ETableHeader *eth; - - eth = gtk_type_new (e_table_header_get_type ()); - - return eth; -} - -static void -eth_update_offsets (ETableHeader *eth) -{ - int i; - int x = 0; - - for (i = 0; i < eth->col_count; i++){ - ETableCol *etc = eth->columns [i]; - - etc->x = x; - x += etc->width; - } -} - -static void -eth_do_insert (ETableHeader *eth, int pos, ETableCol *val) -{ - memmove (ð->columns [pos+1], ð->columns [pos], - sizeof (ETableCol *) * (eth->col_count - pos)); - eth->columns [pos] = val; - eth->col_count ++; -} - -/** - * e_table_header_add_column: - * @eth: the table header to add the column to. - * @tc: the ETableCol definition - * @pos: position where the ETableCol will go. - * - * This function adds the @tc ETableCol definition into the @eth ETableHeader - * at position @pos. This is the way you add new ETableCols to the - * ETableHeader. - * - * This function will emit the "structure_change" signal on the @eth object. - * The ETableCol is assumed - */ -void -e_table_header_add_column (ETableHeader *eth, ETableCol *tc, int pos) -{ - g_return_if_fail (eth != NULL); - g_return_if_fail (E_IS_TABLE_HEADER (eth)); - g_return_if_fail (tc != NULL); - g_return_if_fail (E_IS_TABLE_COL (tc)); - g_return_if_fail (pos >= -1 && pos <= eth->col_count); - - if (pos == -1) - pos = eth->col_count; - eth->columns = g_realloc (eth->columns, sizeof (ETableCol *) * (eth->col_count + 1)); - - /* - * We are the primary owners of the column - */ - gtk_object_ref (GTK_OBJECT (tc)); - gtk_object_sink (GTK_OBJECT (tc)); - - eth_do_insert (eth, pos, tc); - - enqueue(eth, -1, eth->nominal_width); - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]); -} - -/** - * e_table_header_get_column: - * @eth: the ETableHeader to query - * @column: the column inside the @eth. - * - * Returns: The ETableCol at @column in the @eth object - */ -ETableCol * -e_table_header_get_column (ETableHeader *eth, int column) -{ - g_return_val_if_fail (eth != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_HEADER (eth), NULL); - - if (column < 0) - return NULL; - - if (column >= eth->col_count) - return NULL; - - return eth->columns [column]; -} - -/** - * e_table_header_get_column_by_col_id: - * @eth: the ETableHeader to query - * @col_id: the col_id to search for. - * - * Returns: The ETableCol with col_idx = @col_idx in the @eth object - */ -ETableCol * -e_table_header_get_column_by_col_idx (ETableHeader *eth, int col_idx) -{ - int i; - g_return_val_if_fail (eth != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_HEADER (eth), NULL); - - for (i = 0; i < eth->col_count; i++) { - if (eth->columns[i]->col_idx == col_idx) { - return eth->columns [i]; - } - } - - return NULL; -} - -/** - * e_table_header_count: - * @eth: the ETableHeader to query - * - * Returns: the number of columns in this ETableHeader. - */ -int -e_table_header_count (ETableHeader *eth) -{ - g_return_val_if_fail (eth != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0); - - return eth->col_count; -} - -/** - * e_table_header_index: - * @eth: the ETableHeader to query - * @col: the column to fetch. - * - * ETableHeaders contain the visual list of columns that the user will - * view. The visible columns will typically map to different columns - * in the ETableModel (because the user reordered the data for - * example). - * - * Returns: the column in the model that the @col column - * in the ETableHeader points to. */ -int -e_table_header_index (ETableHeader *eth, int col) -{ - g_return_val_if_fail (eth != NULL, -1); - g_return_val_if_fail (E_IS_TABLE_HEADER (eth), -1); - g_return_val_if_fail (col >= 0 && col < eth->col_count, -1); - - return eth->columns [col]->col_idx; -} - -/** - * e_table_header_get_index_at: - * @eth: the ETableHeader to query - * @x_offset: a pixel count from the beginning of the ETableHeader - * - * This will return the ETableHeader column that would contain - * the @x_offset pixel. - * - * Returns: the column that contains pixel @x_offset, or -1 - * if no column inside this ETableHeader contains that pixel. - */ -int -e_table_header_get_index_at (ETableHeader *eth, int x_offset) -{ - int i, total; - - g_return_val_if_fail (eth != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0); - - total = 0; - for (i = 0; i < eth->col_count; i++){ - total += eth->columns [i]->width; - - if (x_offset < total) - return i; - } - - return -1; -} - -/** - * e_table_header_get_columns: - * @eth: The ETableHeader to query - * - * Returns: A NULL terminated array of the ETableCols - * contained in the ETableHeader @eth. Note that every - * returned ETableCol in the array has been referenced, to release - * this information you need to g_free the buffer returned - * and you need to gtk_object_unref every element returned - */ -ETableCol ** -e_table_header_get_columns (ETableHeader *eth) -{ - ETableCol **ret; - int i; - - g_return_val_if_fail (eth != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0); - - ret = g_new (ETableCol *, eth->col_count + 1); - memcpy (ret, eth->columns, sizeof (ETableCol *) * eth->col_count); - ret [eth->col_count] = NULL; - - for (i = 0; i < eth->col_count; i++) { - gtk_object_ref(GTK_OBJECT(ret[i])); - } - - return ret; -} - -/** - * e_table_header_get_selected: - * @eth: The ETableHeader to query - * - * Returns: The number of selected columns in the @eth object. - */ -int -e_table_header_get_selected (ETableHeader *eth) -{ - int i; - int selected = 0; - - g_return_val_if_fail (eth != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0); - - for (i = 0; i < eth->col_count; i++){ - if (eth->columns [i]->selected) - selected++; - } - - return selected; -} - -/** - * e_table_header_total_width: - * @eth: The ETableHeader to query - * - * Returns: the number of pixels used by the @eth object - * when rendered on screen - */ -int -e_table_header_total_width (ETableHeader *eth) -{ - int total, i; - - g_return_val_if_fail (eth != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0); - - total = 0; - for (i = 0; i < eth->col_count; i++) - total += eth->columns [i]->width; - - return total; -} - -/** - * e_table_header_move: - * @eth: The ETableHeader to operate on. - * @source_index: the source column to move. - * @target_index: the target location for the column - * - * This function moves the column @source_index to @target_index - * inside the @eth ETableHeader. The signals "dimension_change" - * and "structure_change" will be emmited - */ -void -e_table_header_move (ETableHeader *eth, int source_index, int target_index) -{ - ETableCol *old; - - g_return_if_fail (eth != NULL); - g_return_if_fail (E_IS_TABLE_HEADER (eth)); - g_return_if_fail (source_index >= 0); - g_return_if_fail (target_index >= 0); - g_return_if_fail (source_index < eth->col_count); - g_return_if_fail (target_index < eth->col_count + 1); /* Can be moved beyond the last item. */ - - if (source_index < target_index) - target_index --; - - old = eth->columns [source_index]; - eth_do_remove (eth, source_index, FALSE); - eth_do_insert (eth, target_index, old); - eth_update_offsets (eth); - - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]); - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]); -} - -/** - * e_table_header_remove: - * @eth: The ETableHeader to operate on. - * @idx: the index to the column to be removed. - * - * Removes the column at @idx position in the ETableHeader @eth. - * This emmits the "structure_change" signal on the @eth object. - */ -void -e_table_header_remove (ETableHeader *eth, int idx) -{ - g_return_if_fail (eth != NULL); - g_return_if_fail (E_IS_TABLE_HEADER (eth)); - g_return_if_fail (idx >= 0); - g_return_if_fail (idx < eth->col_count); - - eth_do_remove (eth, idx, TRUE); - enqueue(eth, -1, eth->nominal_width); - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]); -} - -/* - * FIXME: deprecated? - */ -void -e_table_header_set_selection (ETableHeader *eth, gboolean allow_selection) -{ - g_return_if_fail (eth != NULL); - g_return_if_fail (E_IS_TABLE_HEADER (eth)); -} - -static void -eth_set_size (ETableHeader *eth, int idx, int size) -{ - double expansion; - double old_expansion; - int min_width; - int left_width; - int total_extra; - int expandable_count; - int usable_width; - int i; - g_return_if_fail (eth != NULL); - g_return_if_fail (E_IS_TABLE_HEADER (eth)); - g_return_if_fail (idx >= 0); - g_return_if_fail (idx < eth->col_count); - - /* If this column is not resizable, don't do anything. */ - if (!eth->columns[idx]->resizeable) - return; - - expansion = 0; - min_width = 0; - left_width = 0; - expandable_count = -1; - - /* Calculate usable area. */ - for (i = 0; i < idx; i++) { - left_width += eth->columns[i]->width; - } - /* - 1 to account for the last pixel border. */ - usable_width = eth->width - left_width - 1; - - if (eth->sort_info) - usable_width -= e_table_sort_info_grouping_get_count(eth->sort_info) * GROUP_INDENT; - - /* Calculate minimum_width of stuff on the right as well as - * total usable expansion on the right. - */ - for (; i < eth->col_count; i++) { - min_width += eth->columns[i]->min_width + eth->width_extras; - if (eth->columns[i]->resizeable) { - expansion += eth->columns[i]->expansion; - expandable_count ++; - } - } - /* If there's no room for anything, don't change. */ - if (expansion == 0) - return; - - /* (1) If none of the columns to the right are expandable, use - * all the expansion space in this column. - */ - if(expandable_count == 0) { - eth->columns[idx]->expansion = expansion; - for (i = idx + 1; i < eth->col_count; i++) { - eth->columns[i]->expansion = 0; - } - return; - } - - total_extra = usable_width - min_width; - /* If there's no extra space, set all expansions to 0. */ - if (total_extra <= 0) { - for (i = idx; i < eth->col_count; i++) { - eth->columns[i]->expansion = 0; - } - return; - } - - /* If you try to resize smaller than the minimum width, it - * uses the minimum. */ - if (size < eth->columns[idx]->min_width + eth->width_extras) - size = eth->columns[idx]->min_width + eth->width_extras; - - /* If all the extra space will be used up in this column, use - * all the expansion and set all others to 0. - */ - if (size >= total_extra + eth->columns[idx]->min_width + eth->width_extras) { - eth->columns[idx]->expansion = expansion; - for (i = idx + 1; i < eth->col_count; i++) { - eth->columns[i]->expansion = 0; - } - return; - } - - /* The old_expansion used by columns to the right. */ - old_expansion = expansion; - old_expansion -= eth->columns[idx]->expansion; - /* Set the new expansion so that it will generate the desired size. */ - eth->columns[idx]->expansion = expansion * (((double)(size - (eth->columns[idx]->min_width + eth->width_extras)))/((double)total_extra)); - /* The expansion left for the columns on the right. */ - expansion -= eth->columns[idx]->expansion; - - /* (2) If the old columns to the right didn't have any - * expansion before, expand them evenly. old_expansion > 0 by - * expansion = SUM(i=idx to col_count -1, - * columns[i]->min_width) - columns[idx]->min_width) = - * SUM(non-negatives). - */ - if (old_expansion == 0) { - for (i = idx + 1; i < eth->col_count; i++) { - if (eth->columns[idx]->resizeable) { - /* expandable_count != 0 by (1) */ - eth->columns[i]->expansion = expansion / expandable_count; - } - } - return; - } - - /* Remove from total_extra the amount used for this column. */ - total_extra -= size - (eth->columns[idx]->min_width + eth->width_extras); - for (i = idx + 1; i < eth->col_count; i++) { - if (eth->columns[idx]->resizeable) { - /* old_expansion != 0 by (2) */ - eth->columns[i]->expansion *= expansion / old_expansion; - } - } -} - -/** - * e_table_header_col_diff: - * @eth: the ETableHeader to query. - * @start_col: the starting column - * @end_col: the ending column. - * - * Computes the number of pixels between the columns @start_col and - * @end_col. - * - * Returns: the number of pixels between @start_col and @end_col on the - * @eth ETableHeader object - */ -int -e_table_header_col_diff (ETableHeader *eth, int start_col, int end_col) -{ - int total, col; - - g_return_val_if_fail (eth != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0); - - if (start_col < 0) - start_col = 0; - if (end_col > eth->col_count) - end_col = eth->col_count; - - total = 0; - for (col = start_col; col < end_col; col++){ - - total += eth->columns [col]->width; - } - - return total; -} - -static void -eth_calc_widths (ETableHeader *eth) -{ - int i; - int extra; - double expansion; - int last_position = 0; - double next_position = 0; - int last_resizable = -1; - /* - 1 to account for the last pixel border. */ - extra = eth->width - 1; - expansion = 0; - for (i = 0; i < eth->col_count; i++) { - extra -= eth->columns[i]->min_width + eth->width_extras; - if (eth->columns[i]->resizeable && eth->columns[i]->expansion > 0) - last_resizable = i; - expansion += eth->columns[i]->resizeable ? eth->columns[i]->expansion : 0; - eth->columns[i]->width = eth->columns[i]->min_width + eth->width_extras; - } - if (eth->sort_info) - extra -= e_table_sort_info_grouping_get_count(eth->sort_info) * GROUP_INDENT; - if (expansion == 0 || extra <= 0) - return; - for (i = 0; i < last_resizable; i++) { - next_position += extra * (eth->columns[i]->resizeable ? eth->columns[i]->expansion : 0)/expansion; - eth->columns[i]->width += next_position - last_position; - last_position = next_position; - } - eth->columns[i]->width += extra - last_position; - - eth_update_offsets (eth); - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]); -} - -void -e_table_header_update_horizontal (ETableHeader *eth) -{ - int i; - int cols; - - cols = eth->col_count; - - for (i = 0; i < cols; i++) { - int width; - - gtk_signal_emit_by_name (GTK_OBJECT (eth), - "request_width", - i, &width); - eth->columns[i]->min_width = width + 10; - eth->columns[i]->expansion = 1; - } - enqueue(eth, -1, eth->nominal_width); -} - -GtkType -e_table_header_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETableHeader", - sizeof (ETableHeader), - sizeof (ETableHeaderClass), - (GtkClassInitFunc) e_table_header_class_init, - (GtkObjectInitFunc) e_table_header_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (gtk_object_get_type (), &info); - } - - return type; -} diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h deleted file mode 100644 index c186a8c48c..0000000000 --- a/widgets/table/e-table-header.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_COLUMN_H_ -#define _E_TABLE_COLUMN_H_ - -#include <gtk/gtkobject.h> -#include <gdk/gdk.h> -#include <gal/e-table/e-table-sort-info.h> -#include <gal/e-table/e-table-col.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef struct _ETableHeader ETableHeader; - -#define E_TABLE_HEADER_TYPE (e_table_header_get_type ()) -#define E_TABLE_HEADER(o) (GTK_CHECK_CAST ((o), E_TABLE_HEADER_TYPE, ETableHeader)) -#define E_TABLE_HEADER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_HEADER_TYPE, ETableHeaderClass)) -#define E_IS_TABLE_HEADER(o) (GTK_CHECK_TYPE ((o), E_TABLE_HEADER_TYPE)) -#define E_IS_TABLE_HEADER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_TYPE)) - -/* - * A Columnar header. - */ -struct _ETableHeader { - GtkObject base; - - int col_count; - int width; - int nominal_width; - int width_extras; - - ETableSortInfo *sort_info; - int sort_info_group_change_id; - - ETableCol **columns; - - GSList *change_queue, *change_tail; - gint idle; -}; - -typedef struct { - GtkObjectClass parent_class; - - void (*structure_change) (ETableHeader *eth); - void (*dimension_change) (ETableHeader *eth, int col); - int (*request_width) (ETableHeader *eth, int col); -} ETableHeaderClass; - -GtkType e_table_header_get_type (void); -ETableHeader *e_table_header_new (void); - -void e_table_header_add_column (ETableHeader *eth, - ETableCol *tc, - int pos); -ETableCol *e_table_header_get_column (ETableHeader *eth, - int column); -ETableCol *e_table_header_get_column_by_col_idx (ETableHeader *eth, - int col_idx); -int e_table_header_count (ETableHeader *eth); -int e_table_header_index (ETableHeader *eth, - int col); -int e_table_header_get_index_at (ETableHeader *eth, - int x_offset); -ETableCol **e_table_header_get_columns (ETableHeader *eth); -int e_table_header_get_selected (ETableHeader *eth); - -int e_table_header_total_width (ETableHeader *eth); -void e_table_header_move (ETableHeader *eth, - int source_index, - int target_index); -void e_table_header_remove (ETableHeader *eth, - int idx); -void e_table_header_set_size (ETableHeader *eth, - int idx, - int size); -void e_table_header_set_selection (ETableHeader *eth, - gboolean allow_selection); -int e_table_header_col_diff (ETableHeader *eth, - int start_col, - int end_col); - -void e_table_header_calc_widths (ETableHeader *eth); -GList *e_table_header_get_selected_indexes (ETableHeader *eth); - -void e_table_header_update_horizontal (ETableHeader *eth); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TABLE_HEADER_H_ */ - diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c deleted file mode 100644 index 3296287ce7..0000000000 --- a/widgets/table/e-table-item.c +++ /dev/null @@ -1,2676 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-item.c: A GnomeCanvasItem that is a view of an ETableModel. - * - * Author: - * Christopher James Lahey <clahey@ximian.com> - * Miguel de Icaza (miguel@gnu.org) - * - * Copyright 1999, 2000, 2001, Ximian, Inc. - * - * TODO: - * Add a border to the thing, so that focusing works properly. - * - */ -#include <config.h> -#include <stdio.h> -#include <gtk/gtksignal.h> -#include <gdk/gdkkeysyms.h> -#include <math.h> -#include "e-table-item.h" -#include "e-table-subset.h" -#include "e-cell.h" -#include "gal/widgets/e-canvas.h" -#include "gal/widgets/e-canvas-utils.h" -#include "gal/util/e-util.h" - -#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () - -#define FOCUSED_BORDER 2 - -static GnomeCanvasItemClass *eti_parent_class; - -enum { - CURSOR_CHANGE, - CURSOR_ACTIVATED, - DOUBLE_CLICK, - RIGHT_CLICK, - CLICK, - KEY_PRESS, - LAST_SIGNAL -}; - -static gint eti_signals [LAST_SIGNAL] = { 0, }; - -enum { - ARG_0, - ARG_TABLE_HEADER, - ARG_TABLE_MODEL, - ARG_TABLE_SELECTION_MODEL, - ARG_TABLE_DRAW_GRID, - ARG_TABLE_DRAW_FOCUS, - ARG_CURSOR_MODE, - ARG_LENGTH_THRESHOLD, - ARG_CURSOR_ROW, - - ARG_MINIMUM_WIDTH, - ARG_WIDTH, - ARG_HEIGHT, -}; - -#define DOUBLE_CLICK_TIME 250 -#define TRIPLE_CLICK_TIME 500 - - -static int eti_get_height (ETableItem *eti); -static int eti_get_minimum_width (ETableItem *eti); -static int eti_row_height (ETableItem *eti, int row); -static void e_table_item_focus (ETableItem *eti, int col, int row, GdkModifierType state); -static void eti_cursor_change (ETableSelectionModel *selection, int row, int col, ETableItem *eti); -static void eti_cursor_activated (ETableSelectionModel *selection, int row, int col, ETableItem *eti); -static void eti_selection_change (ETableSelectionModel *selection, ETableItem *eti); -#if 0 -static void eti_request_region_show (ETableItem *eti, - int start_col, int start_row, - int end_col, int end_row); -#endif -#define ETI_ROW_HEIGHT(eti,row) ((eti)->height_cache && (eti)->height_cache[(row)] != -1 ? (eti)->height_cache[(row)] : eti_row_height((eti),(row))) - -inline static gint -model_to_view_row(ETableItem *eti, int row) -{ - int i; - if (eti->uses_source_model) { - ETableSubset *etss = E_TABLE_SUBSET(eti->table_model); - if (eti->row_guess >= 0 && eti->row_guess < etss->n_map) { - if (etss->map_table[eti->row_guess] == row) { - return eti->row_guess; - } - } - for (i = 0; i < etss->n_map; i++) { - if (etss->map_table[i] == row) - return i; - } - return -1; - } else - return row; -} - -inline static gint -view_to_model_row(ETableItem *eti, int row) -{ - if (eti->uses_source_model) { - ETableSubset *etss = E_TABLE_SUBSET(eti->table_model); - if (row >= 0 && row < etss->n_map) - return etss->map_table[row]; - else - return -1; - } else - return row; -} - -inline static gint -model_to_view_col(ETableItem *eti, int col) -{ - int i; - for (i = 0; i < eti->cols; i++) { - ETableCol *ecol = e_table_header_get_column (eti->header, i); - if (ecol->col_idx == col) - return i; - } - return -1; -} - -inline static gint -view_to_model_col(ETableItem *eti, int col) -{ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - return ecol ? ecol->col_idx : -1; -} - -static gboolean -eti_editing (ETableItem *eti) -{ - if (eti->editing_col == -1) - return FALSE; - else - return TRUE; -} - -/* - * During realization, we have to invoke the per-ecell realize routine - * (On our current setup, we have one e-cell per column. - * - * We might want to optimize this to only realize the unique e-cells: - * ie, a strings-only table, uses the same e-cell for every column, and - * we might want to avoid realizing each e-cell. - */ -static void -eti_realize_cell_views (ETableItem *eti) -{ - int i; - - for (i = 0; i < eti->n_cells; i++) - e_cell_realize (eti->cell_views [i]); - eti->cell_views_realized = 1; -} - -static void -eti_attach_cell_views (ETableItem *eti) -{ - int i; - - g_assert (eti->header); - g_assert (eti->table_model); - - /* - * Now realize the various ECells - */ - eti->n_cells = eti->cols; - eti->cell_views = g_new (ECellView *, eti->n_cells); - - for (i = 0; i < eti->n_cells; i++){ - ETableCol *ecol = e_table_header_get_column (eti->header, i); - - eti->cell_views [i] = e_cell_new_view (ecol->ecell, eti->table_model, eti); - } - - eti->needs_compute_height = 1; - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); - eti->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti)); -} - -/* - * During unrealization: we invoke every e-cell (one per column in the current - * setup) to dispose all X resources allocated - */ -static void -eti_unrealize_cell_views (ETableItem *eti) -{ - int i; - - if (eti->cell_views_realized == 0) - return; - - for (i = 0; i < eti->n_cells; i++) - e_cell_unrealize (eti->cell_views [i]); - eti->cell_views_realized = 0; -} - -static void -eti_detach_cell_views (ETableItem *eti) -{ - int i; - - for (i = 0; i < eti->n_cells; i++){ - e_cell_kill_view (eti->cell_views [i]); - eti->cell_views [i] = NULL; - } - - g_free (eti->cell_views); - eti->cell_views = NULL; - eti->n_cells = 0; -} - -static void -eti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) -{ - double i2c [6]; - ArtPoint c1, c2, i1, i2; - ETableItem *eti = E_TABLE_ITEM (item); - - /* Wrong BBox's are the source of redraw nightmares */ - - gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (eti), i2c); - - i1.x = eti->x1; - i1.y = eti->y1; - i2.x = eti->x1 + eti->width; - i2.y = eti->y1 + eti->height; - art_affine_point (&c1, &i1, i2c); - art_affine_point (&c2, &i2, i2c); - - *x1 = c1.x; - *y1 = c1.y; - *x2 = c2.x + 1; - *y2 = c2.y + 1; -} - -static void -eti_reflow (GnomeCanvasItem *item, gint flags) -{ - ETableItem *eti = E_TABLE_ITEM (item); - - if (eti->needs_compute_height) { - int new_height = eti_get_height (eti); - - if (new_height != eti->height) { - eti->height = new_height; - e_canvas_item_request_parent_reflow (GNOME_CANVAS_ITEM (eti)); - eti->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti)); - } - eti->needs_compute_height = 0; - } - if (eti->needs_compute_width) { - int new_width = eti_get_minimum_width (eti); - new_width = MAX(new_width, eti->minimum_width); - if (new_width != eti->width) { - eti->width = new_width; - e_canvas_item_request_parent_reflow (GNOME_CANVAS_ITEM (eti)); - eti->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti)); - } - eti->needs_compute_width = 0; - } -} - -/* - * GnomeCanvasItem::update method - */ -static void -eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - ArtPoint o1, o2; - ETableItem *eti = E_TABLE_ITEM (item); - - if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update) - (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, affine, clip_path, flags); - - o1.x = item->x1; - o1.y = item->y1; - o2.x = item->x2; - o2.y = item->y2; - - eti_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2); - if (item->x1 != o1.x || - item->y1 != o1.y || - item->x2 != o2.x || - item->y2 != o2.y) { - gnome_canvas_request_redraw (item->canvas, o1.x, o1.y, o2.x, o2.y); - eti->needs_redraw = 1; - } - - if (eti->needs_redraw) { - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, - item->x2, item->y2); - eti->needs_redraw = 0; - } -} - -/* - * eti_remove_table_model: - * - * Invoked to release the table model associated with this ETableItem - */ -static void -eti_remove_table_model (ETableItem *eti) -{ - if (!eti->table_model) - return; - - gtk_signal_disconnect (GTK_OBJECT (eti->table_model), - eti->table_model_pre_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->table_model), - eti->table_model_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->table_model), - eti->table_model_row_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->table_model), - eti->table_model_cell_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->table_model), - eti->table_model_row_inserted_id); - gtk_signal_disconnect (GTK_OBJECT (eti->table_model), - eti->table_model_row_deleted_id); - gtk_object_unref (GTK_OBJECT (eti->table_model)); - if (eti->source_model) - gtk_object_unref (GTK_OBJECT (eti->source_model)); - - eti->table_model_pre_change_id = 0; - eti->table_model_change_id = 0; - eti->table_model_row_change_id = 0; - eti->table_model_cell_change_id = 0; - eti->table_model_row_inserted_id = 0; - eti->table_model_row_deleted_id = 0; - eti->table_model = NULL; - eti->source_model = NULL; - eti->uses_source_model = 0; -} - -/* - * eti_remove_table_model: - * - * Invoked to release the table model associated with this ETableItem - */ -static void -eti_remove_table_selection_model (ETableItem *eti) -{ - if (!eti->selection) - return; - - gtk_signal_disconnect (GTK_OBJECT (eti->selection), - eti->selection_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->selection), - eti->cursor_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->selection), - eti->cursor_activated_id); - gtk_object_unref (GTK_OBJECT (eti->selection)); - - eti->selection_change_id = 0; - eti->cursor_activated_id = 0; - eti->selection = NULL; -} - -/* - * eti_remove_header_model: - * - * Invoked to release the header model associated with this ETableItem - */ -static void -eti_remove_header_model (ETableItem *eti) -{ - if (!eti->header) - return; - - gtk_signal_disconnect (GTK_OBJECT (eti->header), - eti->header_structure_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->header), - eti->header_dim_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->header), - eti->header_request_width_id); - - if (eti->cell_views){ - eti_unrealize_cell_views (eti); - eti_detach_cell_views (eti); - } - gtk_object_unref (GTK_OBJECT (eti->header)); - - - eti->header_structure_change_id = 0; - eti->header_dim_change_id = 0; - eti->header_request_width_id = 0; - eti->header = NULL; -} - -/* - * eti_row_height_real: - * - * Returns the height used by row @row. This does not include the one-pixel - * used as a separator between rows - */ -static int -eti_row_height_real (ETableItem *eti, int row) -{ - const int cols = e_table_header_count (eti->header); - int col; - int h, max_h; - - g_assert (cols == 0 || eti->cell_views); - - max_h = 0; - - for (col = 0; col < cols; col++){ - h = e_cell_height (eti->cell_views [col], view_to_model_col(eti, col), col, row); - - if (h > max_h) - max_h = h; - } - return max_h; -} - -static gboolean -height_cache_idle(ETableItem *eti) -{ - int changed = 0; - int i; - if (!eti->height_cache) { - eti->height_cache = g_new(int, eti->rows); - } - for (i = eti->height_cache_idle_count; i < eti->rows; i++) { - if (eti->height_cache[i] == -1) { - eti_row_height(eti, i); - changed ++; - if (changed >= 20) - break; - } - } - if (changed >= 20) { - eti->height_cache_idle_count = i; - return TRUE; - } - eti->height_cache_idle_id = 0; - return FALSE; -} - -static void -free_height_cache (ETableItem *eti) -{ - if (eti->height_cache) - g_free (eti->height_cache); - eti->height_cache = NULL; - eti->height_cache_idle_count = 0; - - if (eti->height_cache_idle_id == 0) - eti->height_cache_idle_id = g_idle_add_full(G_PRIORITY_LOW, (GSourceFunc) height_cache_idle, eti, NULL); -} - -static void -calculate_height_cache (ETableItem *eti) -{ - int i; - free_height_cache(eti); - eti->height_cache = g_new(int, eti->rows); - for (i = 0; i < eti->rows; i++) { - eti->height_cache[i] = -1; - } -} - - -/* - * eti_row_height: - * - * Returns the height used by row @row. This does not include the one-pixel - * used as a separator between rows - */ -static int -eti_row_height (ETableItem *eti, int row) -{ - if (!eti->height_cache) { - calculate_height_cache (eti); - } - if (eti->height_cache[row] == -1) { - eti->height_cache[row] = eti_row_height_real(eti, row); - if (row > 0 && - eti->length_threshold != -1 && - eti->rows > eti->length_threshold && - eti->height_cache[row] != eti_row_height(eti, 0)) { - eti->needs_compute_height = 1; - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(eti)); - } - } - return eti->height_cache[row]; -} - -/* - * eti_get_height: - * - * Returns the height of the ETableItem. - * - * The ETableItem might compute the whole height by asking every row its - * size. There is a special mode (designed to work when there are too - * many rows in the table that performing the previous step could take - * too long) set by the ETableItem->length_threshold that would determine - * when the height is computed by using the first row as the size for - * every other row in the ETableItem. - */ -static int -eti_get_height (ETableItem *eti) -{ - const int rows = eti->rows; - int row; - int height; - - if (rows == 0) - return 0; - - if (eti->length_threshold != -1){ - if (rows > eti->length_threshold){ - int row_height = eti_row_height(eti, 0); - if (eti->height_cache) { - height = 0; - for (row = 0; row < rows; row++) { - if (eti->height_cache[row] == -1) { - height += (row_height + 1) * (rows - row); - break; - } - else - height += eti->height_cache[row] + 1; - } - } else - height = (eti_row_height (eti, 0) + 1) * rows; - - /* - * 1 pixel at the top - */ - return height + 1; - } - } - - height = 1; - for (row = 0; row < rows; row++) - height += eti_row_height (eti, row) + 1; - - return height; -} - -static int -eti_get_minimum_width (ETableItem *eti) -{ - int width = 0; - int col; - for (col = 0; col < eti->cols; col++){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - - width += ecol->min_width; - } - return width; -} - -static void -eti_item_region_redraw (ETableItem *eti, int x0, int y0, int x1, int y1) -{ - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti); - ArtDRect rect; - double i2c [6]; - - rect.x0 = x0; - rect.y0 = y0; - rect.x1 = x1; - rect.y1 = y1; - - gnome_canvas_item_i2c_affine (item, i2c); - art_drect_affine_transform (&rect, &rect, i2c); - - gnome_canvas_request_redraw (item->canvas, rect.x0, rect.y0, rect.x1, rect.y1); -} - -/* - * Callback routine: invoked before the ETableModel has suffers a change - */ -static void -eti_table_model_pre_change (ETableModel *table_model, ETableItem *eti) -{ - if (eti_editing (eti)) - e_table_item_leave_edit (eti); -} - -/* - * Callback routine: invoked when the ETableModel has suffered a change - */ -static void -eti_table_model_changed (ETableModel *table_model, ETableItem *eti) -{ -#if 0 - int view_row; -#endif - - eti->rows = e_table_model_row_count (eti->table_model); - - free_height_cache(eti); - - eti->needs_compute_height = 1; - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); - eti->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti)); - -#if 0 - view_row = model_to_view_row(eti, eti->cursor_row); - if (view_row >= 0 && eti->cursor_col >= 0) - eti_request_region_show (eti, eti->cursor_col, view_row, eti->cursor_col, view_row); -#endif -} - -/* - * Computes the distance between @start_row and @end_row in pixels - */ -int -e_table_item_row_diff (ETableItem *eti, int start_row, int end_row) -{ - int row, total; - - total = 0; - - for (row = start_row; row < end_row; row++) - total += eti_row_height (eti, row) + 1; - - return total; -} - -/* - * eti_request_region_redraw: - * - * Request a canvas redraw on the range (start_col, start_row) to (end_col, end_row). - * This is inclusive (ie, you can use: 0,0-0,0 to redraw the first cell). - * - * The @border argument is a number of pixels around the region that should also be queued - * for redraw. This is typically used by the focus routines to queue a redraw for the - * border as well. - */ -static void -eti_request_region_redraw (ETableItem *eti, - int start_col, int start_row, - int end_col, int end_row, int border) -{ - int x1, y1, width, height; - - if (eti->rows > 0) { - - x1 = e_table_header_col_diff (eti->header, 0, start_col); - y1 = e_table_item_row_diff (eti, 0, start_row); - width = e_table_header_col_diff (eti->header, start_col, end_col + 1); - height = e_table_item_row_diff (eti, start_row, end_row + 1); - - eti_item_region_redraw (eti, eti->x1 + x1 - border, - eti->y1 + y1 - border, - eti->x1 + x1 + width + 1 + border, - eti->y1 + y1 + height + 1 + border); - } -} - -/* - * eti_request_region_show - * - * Request a canvas show on the range (start_col, start_row) to (end_col, end_row). - * This is inclusive (ie, you can use: 0,0-0,0 to show the first cell). - */ -static void -eti_request_region_show (ETableItem *eti, - int start_col, int start_row, - int end_col, int end_row, int delay) -{ - int x1, y1, x2, y2; - - x1 = e_table_header_col_diff (eti->header, 0, start_col); - y1 = e_table_item_row_diff (eti, 0, start_row); - x2 = x1 + e_table_header_col_diff (eti->header, start_col, end_col + 1); - y2 = y1 + e_table_item_row_diff (eti, start_row, end_row + 1); - - if (delay) - e_canvas_item_show_area_delayed(GNOME_CANVAS_ITEM(eti), x1, y1, x2, y2, delay); - else - e_canvas_item_show_area(GNOME_CANVAS_ITEM(eti), x1, y1, x2, y2); -} - -static void -eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti) -{ - if (eti->renderers_can_change_size && - eti->height_cache && eti->height_cache[row] != -1 && - eti_row_height_real(eti, row) != eti->height_cache[row]) { - eti_table_model_changed (table_model, eti); - return; - } - - eti_request_region_redraw (eti, 0, row, eti->cols - 1, row, 0); -} - -static void -eti_table_model_cell_changed (ETableModel *table_model, int col, int row, ETableItem *eti) -{ - if (eti->renderers_can_change_size && - eti->height_cache && eti->height_cache[row] != -1 && - eti_row_height_real(eti, row) != eti->height_cache[row]) { - eti_table_model_changed (table_model, eti); - return; - } - - eti_request_region_redraw (eti, 0, row, eti->cols - 1, row, 0); -} - -static void -eti_table_model_row_inserted (ETableModel *table_model, int row, ETableItem *eti) -{ - eti->rows = e_table_model_row_count (eti->table_model); - - if (eti->height_cache) { - eti->height_cache = g_renew(int, eti->height_cache, eti->rows); - memmove(eti->height_cache + row + 1, eti->height_cache + row, (eti->rows - 1 - row) * sizeof(int)); - eti->height_cache[row] = -1; - } - - eti->needs_compute_height = 1; - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); - eti->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti)); -} - -static void -eti_table_model_row_deleted (ETableModel *table_model, int row, ETableItem *eti) -{ - eti->rows = e_table_model_row_count (eti->table_model); - - if (eti->height_cache) - memmove(eti->height_cache + row, eti->height_cache + row + 1, (eti->rows - row) * sizeof(int)); - - eti->needs_compute_height = 1; - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); - eti->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti)); -} - -/** - * e_table_item_redraw_range - * @eti: %ETableItem which will be redrawn - * @start_col: The first col to redraw. - * @start_row: The first row to redraw. - * @end_col: The last col to redraw. - * @end_row: The last row to redraw. - * - * This routine redraws the given %ETableItem in the range given. The - * range is inclusive at both ends. - */ -void -e_table_item_redraw_range (ETableItem *eti, - int start_col, int start_row, - int end_col, int end_row) -{ - int border; - int cursor_col, cursor_row; - - g_return_if_fail (eti != NULL); - g_return_if_fail (E_IS_TABLE_ITEM (eti)); - - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - "cursor_row", &cursor_row, - NULL); - - if ((start_col == cursor_col) || - (end_col == cursor_col) || - (view_to_model_row(eti, start_row) == cursor_row) || - (view_to_model_row(eti, end_row) == cursor_row)) - border = 2; - else - border = 0; - - eti_request_region_redraw(eti, start_col, start_row, end_col, end_row, border); -} - -static void -eti_add_table_model (ETableItem *eti, ETableModel *table_model) -{ - g_assert (eti->table_model == NULL); - - eti->table_model = table_model; - gtk_object_ref (GTK_OBJECT (eti->table_model)); - - eti->table_model_pre_change_id = gtk_signal_connect ( - GTK_OBJECT (table_model), "model_pre_change", - GTK_SIGNAL_FUNC (eti_table_model_pre_change), eti); - - eti->table_model_change_id = gtk_signal_connect ( - GTK_OBJECT (table_model), "model_changed", - GTK_SIGNAL_FUNC (eti_table_model_changed), eti); - - eti->table_model_row_change_id = gtk_signal_connect ( - GTK_OBJECT (table_model), "model_row_changed", - GTK_SIGNAL_FUNC (eti_table_model_row_changed), eti); - - eti->table_model_cell_change_id = gtk_signal_connect ( - GTK_OBJECT (table_model), "model_cell_changed", - GTK_SIGNAL_FUNC (eti_table_model_cell_changed), eti); - - eti->table_model_row_inserted_id = gtk_signal_connect ( - GTK_OBJECT (table_model), "model_row_inserted", - GTK_SIGNAL_FUNC (eti_table_model_row_inserted), eti); - - eti->table_model_row_deleted_id = gtk_signal_connect ( - GTK_OBJECT (table_model), "model_row_deleted", - GTK_SIGNAL_FUNC (eti_table_model_row_deleted), eti); - - if (eti->header) { - eti_detach_cell_views (eti); - eti_attach_cell_views (eti); - } - - if (E_IS_TABLE_SUBSET(table_model)) { - eti->uses_source_model = 1; - eti->source_model = E_TABLE_SUBSET(table_model)->source; - if (eti->source_model) - gtk_object_ref(GTK_OBJECT(eti->source_model)); - } - - eti_table_model_changed (table_model, eti); -} - -static void -eti_add_table_selection_model (ETableItem *eti, ETableSelectionModel *selection) -{ - g_assert (eti->selection == NULL); - - eti->selection = selection; - gtk_object_ref (GTK_OBJECT (eti->selection)); - - eti->selection_change_id = gtk_signal_connect ( - GTK_OBJECT (selection), "selection_changed", - GTK_SIGNAL_FUNC (eti_selection_change), eti); - - eti->cursor_change_id = gtk_signal_connect ( - GTK_OBJECT (selection), "cursor_changed", - GTK_SIGNAL_FUNC (eti_cursor_change), eti); - - eti->cursor_activated_id = gtk_signal_connect ( - GTK_OBJECT (selection), "cursor_activated", - GTK_SIGNAL_FUNC (eti_cursor_activated), eti); - - eti_selection_change(selection, eti); -} - -static void -eti_header_dim_changed (ETableHeader *eth, int col, ETableItem *eti) -{ - eti->needs_compute_width = 1; - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); -} - -static void -eti_header_structure_changed (ETableHeader *eth, ETableItem *eti) -{ - eti->cols = e_table_header_count (eti->header); - eti->width = e_table_header_total_width (eti->header); - - /* - * There should be at least one column - * BUT: then you can't remove all columns from a header and add new ones. - */ - /*g_assert (eti->cols != 0);*/ - - if (eti->cell_views){ - eti_unrealize_cell_views (eti); - eti_detach_cell_views (eti); - eti_attach_cell_views (eti); - eti_realize_cell_views (eti); - } else { - if (eti->table_model) { - eti_detach_cell_views (eti); - eti_attach_cell_views (eti); - } - } - eti->needs_compute_width = 1; - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); -} - -static int -eti_request_column_width (ETableHeader *eth, int col, ETableItem *eti) -{ - int width = 0; - - if (eti->cell_views) { - width = e_cell_max_width (eti->cell_views[col], view_to_model_col(eti, col), col); - } - - return width; -} - -static void -eti_add_header_model (ETableItem *eti, ETableHeader *header) -{ - g_assert (eti->header == NULL); - - eti->header = header; - gtk_object_ref (GTK_OBJECT (header)); - - eti_header_structure_changed (header, eti); - - eti->header_dim_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "dimension_change", - GTK_SIGNAL_FUNC (eti_header_dim_changed), eti); - - eti->header_structure_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "structure_change", - GTK_SIGNAL_FUNC (eti_header_structure_changed), eti); - - eti->header_request_width_id = gtk_signal_connect - (GTK_OBJECT (header), "request_width", - GTK_SIGNAL_FUNC (eti_request_column_width), eti); -} - -/* - * GtkObject::destroy method - */ -static void -eti_destroy (GtkObject *object) -{ - ETableItem *eti = E_TABLE_ITEM (object); - - eti_remove_header_model (eti); - eti_remove_table_model (eti); - eti_remove_table_selection_model (eti); - - if (eti->height_cache_idle_id) - g_source_remove(eti->height_cache_idle_id); - - if (eti->height_cache) - g_free (eti->height_cache); - eti->height_cache = NULL; - eti->height_cache_idle_count = 0; - - if (eti->tooltip->window) - gtk_widget_destroy (eti->tooltip->window); - if (eti->tooltip->timer) { - gtk_timeout_remove (eti->tooltip->timer); - eti->tooltip->timer = 0; - } - g_free (eti->tooltip); - - if (GTK_OBJECT_CLASS (eti_parent_class)->destroy) - (*GTK_OBJECT_CLASS (eti_parent_class)->destroy) (object); -} - -static void -eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - ETableItem *eti; - int cursor_col; - - item = GNOME_CANVAS_ITEM (o); - eti = E_TABLE_ITEM (o); - - switch (arg_id){ - case ARG_TABLE_HEADER: - eti_remove_header_model (eti); - eti_add_header_model (eti, E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg))); - break; - - case ARG_TABLE_MODEL: - eti_remove_table_model (eti); - eti_add_table_model (eti, E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg))); - break; - - case ARG_TABLE_SELECTION_MODEL: - eti_remove_table_selection_model (eti); - if (GTK_VALUE_OBJECT (*arg)) - eti_add_table_selection_model (eti, E_TABLE_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg))); - break; - - case ARG_LENGTH_THRESHOLD: - eti->length_threshold = GTK_VALUE_INT (*arg); - break; - - case ARG_TABLE_DRAW_GRID: - eti->draw_grid = GTK_VALUE_BOOL (*arg); - break; - - case ARG_TABLE_DRAW_FOCUS: - eti->draw_focus = GTK_VALUE_BOOL (*arg); - break; - - case ARG_CURSOR_MODE: - eti->cursor_mode = GTK_VALUE_INT (*arg); - break; - - case ARG_MINIMUM_WIDTH: - case ARG_WIDTH: - if (eti->minimum_width == eti->width && GTK_VALUE_DOUBLE (*arg) > eti->width) - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); - eti->minimum_width = GTK_VALUE_DOUBLE (*arg); - if (eti->minimum_width < eti->width) - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); - break; - case ARG_CURSOR_ROW: - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - NULL); - - e_table_item_focus (eti, cursor_col != -1 ? cursor_col : 0, view_to_model_row(eti, GTK_VALUE_INT (*arg)), 0); - break; - } - eti->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(eti)); -} - -static void -eti_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - ETableItem *eti; - int row; - - item = GNOME_CANVAS_ITEM (o); - eti = E_TABLE_ITEM (o); - - switch (arg_id){ - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = eti->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = eti->height; - break; - case ARG_MINIMUM_WIDTH: - GTK_VALUE_DOUBLE (*arg) = eti->minimum_width; - break; - case ARG_CURSOR_ROW: - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &row, - NULL); - GTK_VALUE_INT (*arg) = model_to_view_row(eti, row); - break; - default: - arg->type = GTK_TYPE_INVALID; - } -} - -static void -eti_init (GnomeCanvasItem *item) -{ - ETableItem *eti = E_TABLE_ITEM (item); - - eti->editing_col = -1; - eti->editing_row = -1; - eti->height = 0; - eti->width = 0; - eti->minimum_width = 0; - - eti->height_cache = NULL; - eti->height_cache_idle_id = 0; - eti->height_cache_idle_count = 0; - - eti->length_threshold = -1; - eti->renderers_can_change_size = 1; - - eti->uses_source_model = 0; - eti->source_model = NULL; - - eti->row_guess = -1; - eti->cursor_mode = E_CURSOR_SIMPLE; - - eti->selection_change_id = 0; - eti->cursor_change_id = 0; - eti->cursor_activated_id = 0; - eti->selection = NULL; - - eti->needs_redraw = 0; - eti->needs_compute_height = 0; - - eti->in_key_press = 0; - - eti->tooltip = g_new0 (ETableTooltip, 1); - eti->tooltip->timer = 0; - eti->tooltip->window = NULL; - eti->tooltip->eti = GNOME_CANVAS_ITEM (eti); - - eti->grabbed_col = -1; - eti->grabbed_row = -1; - - e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (eti), eti_reflow); -} - -#define gray50_width 2 -#define gray50_height 2 -static const char gray50_bits[] = { - 0x02, 0x01, }; - -#if 0 -static gint -eti_visibility_notify(GtkWidget *widget, - GdkEventVisibility *event, - ETableItem *eti) -{ - if (eti->tooltip->window) { - gtk_widget_destroy (eti->tooltip->window); - eti->tooltip->window = NULL; - } - - return FALSE; -} -#endif - -static void -eti_realize (GnomeCanvasItem *item) -{ - ETableItem *eti = E_TABLE_ITEM (item); - GtkWidget *canvas_widget = GTK_WIDGET (item->canvas); - GdkWindow *window; -#if 0 - GdkEventMask mask; -#endif - - if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize) - (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize)(item); - - /* - * Gdk Resource allocation - */ - window = canvas_widget->window; - - eti->fill_gc = gdk_gc_new (window); - - eti->grid_gc = gdk_gc_new (window); -#if 0 - /* This sets it to gray */ -/* gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); */ -#else - gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->dark [GTK_STATE_NORMAL]); -#endif - eti->focus_gc = gdk_gc_new (window); - gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); - gdk_gc_set_background (eti->focus_gc, &canvas_widget->style->fg [GTK_STATE_NORMAL]); - eti->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height); - gdk_gc_set_ts_origin (eti->focus_gc, 0, 0); - gdk_gc_set_stipple (eti->focus_gc, eti->stipple); - gdk_gc_set_fill (eti->focus_gc, GDK_OPAQUE_STIPPLED); - -#if 0 - mask = gtk_widget_get_events(GTK_WIDGET(item->canvas)); - mask |= GDK_VISIBILITY_NOTIFY_MASK; - gtk_widget_set_events(GTK_WIDGET(item->canvas), mask); - - gtk_signal_connect(GTK_OBJECT(item->canvas), "visibility_notify_event", - GTK_SIGNAL_FUNC(eti_visibility_notify), eti); -#endif - - if (eti->cell_views == NULL) - eti_attach_cell_views (eti); - - eti_realize_cell_views (eti); - - eti->needs_compute_height = 1; - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); - eti->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti)); -} - -static void -eti_unrealize (GnomeCanvasItem *item) -{ - ETableItem *eti = E_TABLE_ITEM (item); - - if (eti_editing (eti)) - e_table_item_leave_edit (eti); - - gdk_gc_unref (eti->fill_gc); - eti->fill_gc = NULL; - gdk_gc_unref (eti->grid_gc); - eti->grid_gc = NULL; - gdk_gc_unref (eti->focus_gc); - eti->focus_gc = NULL; - gdk_bitmap_unref (eti->stipple); - eti->stipple = NULL; - - eti_unrealize_cell_views (eti); - - eti->height = 0; - - if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->unrealize) - (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->unrealize)(item); -} - -static void -eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height) -{ - ETableItem *eti = E_TABLE_ITEM (item); - const int rows = eti->rows; - const int cols = eti->cols; - int row, col, y1, y2; - int first_col, last_col, x_offset; - int first_row, last_row, y_offset, yd; - int x1, x2; - int f_x1, f_x2, f_y1, f_y2; - gboolean f_found; - double i2c [6]; - ArtPoint eti_base, eti_base_item, lower_right; - GtkWidget *canvas = GTK_WIDGET(item->canvas); - GdkColor *background; - - /* - * Clear the background - */ -#if 0 - gdk_draw_rectangle ( - drawable, eti->fill_gc, TRUE, - eti->x1 - x, eti->y1 - y, eti->width, eti->height); -#endif - - /* - * Find out our real position after grouping - */ - gnome_canvas_item_i2c_affine (item, i2c); - eti_base_item.x = eti->x1; - eti_base_item.y = eti->y1; - art_affine_point (&eti_base, &eti_base_item, i2c); - - eti_base_item.x = eti->x1 + eti->width; - eti_base_item.y = eti->y1 + eti->height; - art_affine_point (&lower_right, &eti_base_item, i2c); - - /* - * First column to draw, last column to draw - */ - first_col = -1; - last_col = x_offset = 0; - x1 = x2 = floor (eti_base.x); - for (col = 0; col < cols; col++, x1 = x2){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - - x2 = x1 + ecol->width; - - if (x1 > (x + width)) - break; - if (x2 < x) - continue; - if (first_col == -1){ - x_offset = x1 - x; - first_col = col; - } - } - last_col = col; - - /* - * Nothing to paint - */ - if (first_col == -1) - return; - - /* - * Compute row span. - */ - first_row = -1; - y_offset = 0; - y1 = y2 = floor (eti_base.y) + 1; - for (row = 0; row < rows; row++, y1 = y2){ - - y2 += ETI_ROW_HEIGHT (eti, row) + 1; - - if (y1 > y + height) - break; - - if (y2 < y) - continue; - - if (first_row == -1){ - y_offset = y1 - y; - first_row = row; - } - } - last_row = row; - - if (first_row == -1) - return; - - /* - * Draw cells - */ - yd = y_offset; - f_x1 = f_x2 = f_y1 = f_y2 = -1; - f_found = FALSE; - - if (eti->draw_grid && first_row == 0){ - gdk_draw_line ( - drawable, eti->grid_gc, - eti_base.x - x, yd, eti_base.x + eti->width - x, yd); - } - yd++; - - for (row = first_row; row < last_row; row++){ - int xd, height; - gboolean selected; - gint cursor_col, cursor_row; - - height = ETI_ROW_HEIGHT (eti, row); - - xd = x_offset; -/* printf ("paint: %d %d\n", yd, yd + height); */ - - selected = e_selection_model_is_row_selected(E_SELECTION_MODEL (eti->selection), view_to_model_row(eti,row)); - - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - "cursor_row", &cursor_row, - NULL); - - for (col = first_col; col < last_col; col++){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - ECellView *ecell_view = eti->cell_views [col]; - gboolean col_selected = selected; - ECellFlags flags; - switch (eti->cursor_mode) { - case E_CURSOR_SIMPLE: - case E_CURSOR_SPREADSHEET: - if (cursor_col == ecol->col_idx && cursor_row == view_to_model_row(eti, row)) - col_selected = !col_selected; - break; - case E_CURSOR_LINE: - /* Nothing */ - break; - } - - if (col_selected){ - if (GTK_WIDGET_HAS_FOCUS(canvas)) - background = &canvas->style->bg [GTK_STATE_SELECTED]; - else - background = &canvas->style->bg [GTK_STATE_ACTIVE]; - } else { -#if 0 - if (row % 2) -#endif - background = &canvas->style->base [GTK_STATE_NORMAL]; -#if 0 - else - background = &canvas->style->base [GTK_STATE_SELECTED]; -#endif - } - - gdk_gc_set_foreground (eti->fill_gc, background); - gdk_draw_rectangle (drawable, eti->fill_gc, TRUE, - xd, yd, ecol->width, height); - - flags = col_selected ? E_CELL_SELECTED : 0; - flags |= GTK_WIDGET_HAS_FOCUS(canvas) ? E_CELL_FOCUSED : 0; - switch (ecol->justification) { - case GTK_JUSTIFY_LEFT: - flags |= E_CELL_JUSTIFY_LEFT; - break; - case GTK_JUSTIFY_RIGHT: - flags |= E_CELL_JUSTIFY_RIGHT; - break; - case GTK_JUSTIFY_CENTER: - flags |= E_CELL_JUSTIFY_CENTER; - break; - case GTK_JUSTIFY_FILL: - flags |= E_CELL_JUSTIFY_FILL; - break; - } - - e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, flags, - xd, yd, xd + ecol->width, yd + height); - - if (!f_found) { - switch (eti->cursor_mode) { - case E_CURSOR_LINE: - if (view_to_model_row(eti, row) == cursor_row) { - f_x1 = floor (eti_base.x) - x; - f_x2 = floor (lower_right.x) - x; - f_y1 = yd; - f_y2 = yd + height; - f_found = TRUE; - } - break; - case E_CURSOR_SIMPLE: - case E_CURSOR_SPREADSHEET: - if (view_to_model_col(eti, col) == cursor_col && view_to_model_row(eti, row) == cursor_row) { - f_x1 = xd; - f_x2 = xd + ecol->width; - f_y1 = yd; - f_y2 = yd + height; - f_found = TRUE; - } - break; - } - } - - xd += ecol->width; - } - yd += height; - - if (eti->draw_grid) - gdk_draw_line ( - drawable, eti->grid_gc, - eti_base.x - x, yd, eti_base.x + eti->width - x, yd); - yd++; - } - - if (eti->draw_grid){ - int xd = x_offset; - - for (col = first_col; col <= last_col; col++){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - - gdk_draw_line ( - drawable, eti->grid_gc, - xd, y_offset, xd, yd - 1); - - /* - * This looks wierd, but it is to draw the last line - */ - if (ecol) - xd += ecol->width; - } - } - - /* - * Draw focus - */ - if (eti->draw_focus && f_found) { - gdk_gc_set_ts_origin (eti->focus_gc, f_x1, f_y1); - gdk_draw_rectangle (drawable, eti->focus_gc, FALSE, - f_x1, f_y1, f_x2 - f_x1 - 1, f_y2 - f_y1 - 1); - } -} - -static double -eti_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - *actual_item = item; - - return 0.0; -} - -static gboolean -find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, double *x1_res, double *y1_res) -{ - const int cols = eti->cols; - const int rows = eti->rows; - gdouble x1, y1, x2, y2; - int col, row; - - /* FIXME: this routine is inneficient, fix later */ - - if (eti->grabbed_col >= 0 && eti->grabbed_row >= 0) { - *col_res = eti->grabbed_col; - *row_res = eti->grabbed_row; - *x1_res = x - eti->x1 - e_table_header_col_diff (eti->header, 0, eti->grabbed_col); - *y1_res = y - eti->y1 - e_table_item_row_diff (eti, 0, eti->grabbed_row); - return TRUE; - } - - if (cols == 0 || rows == 0) - return FALSE; - - x -= eti->x1; - y -= eti->y1; - - x1 = 0; - for (col = 0; col < cols - 1; col++, x1 = x2){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - - if (x < x1) - return FALSE; - - x2 = x1 + ecol->width; - - if (x <= x2) - break; - } - - y1 = y2 = 0; - for (row = 0; row < rows - 1; row++, y1 = y2){ - if (y < y1) - return FALSE; - - y2 += ETI_ROW_HEIGHT (eti, row) + 1; - - if (y <= y2) - break; - } - *col_res = col; - if (x1_res) - *x1_res = x - x1; - *row_res = row; - if (y1_res) - *y1_res = y - y1; - return TRUE; -} - -static void -eti_cursor_move (ETableItem *eti, gint row, gint column) -{ - e_table_item_leave_edit (eti); - e_table_item_focus (eti, view_to_model_col(eti, column), view_to_model_row(eti, row), 0); -} - -static void -eti_cursor_move_left (ETableItem *eti) -{ - int cursor_col, cursor_row; - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - "cursor_row", &cursor_row, - NULL); - - eti_cursor_move (eti, model_to_view_row(eti, cursor_row), model_to_view_col(eti, cursor_col) - 1); -} - -static void -eti_cursor_move_right (ETableItem *eti) -{ - int cursor_col, cursor_row; - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - "cursor_row", &cursor_row, - NULL); - - eti_cursor_move (eti, model_to_view_row(eti, cursor_row), model_to_view_col(eti, cursor_col) + 1); -} - -#if 0 -static void -eti_cursor_move_up (ETableItem *eti) -{ - int cursor_col, cursor_row; - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - "cursor_row", &cursor_row, - NULL); - - eti_cursor_move (eti, model_to_view_row(eti, cursor_row) - 1, model_to_view_col(eti, cursor_col)); -} - -static void -eti_cursor_move_down (ETableItem *eti) -{ - int cursor_col, cursor_row; - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - "cursor_row", &cursor_row, - NULL); - - eti_cursor_move (eti, model_to_view_row(eti, cursor_row) + 1, model_to_view_col(eti, cursor_col)); -} -#endif - -#if 0 -static int -_do_tooltip (ETableItem *eti) -{ - ECellView *ecell_view; - int x = 0, y = 0; - int i; - - if (eti->tooltip->window) { - gtk_widget_destroy (eti->tooltip->window); - eti->tooltip->window = NULL; - } - - if (eti_editing (eti)) - return FALSE; - - ecell_view = eti->cell_views[eti->tooltip->col]; - - for (i = 0; i < eti->tooltip->col; i++) - x += eti->header->columns[i]->width; - eti->tooltip->x = x; - - for (i = 0; i < eti->tooltip->row; i++) - y += (ETI_ROW_HEIGHT (eti, i) + 1); - eti->tooltip->y = y; - eti->tooltip->row_height = ETI_ROW_HEIGHT (eti, i); - - e_cell_show_tooltip (ecell_view, - view_to_model_col (eti, eti->tooltip->col), - eti->tooltip->col, - eti->tooltip->row, - eti->header->columns[eti->tooltip->col]->width, - eti->tooltip); - return FALSE; -} -#endif - -static gint -eti_e_cell_event (ETableItem *item, ECellView *ecell_view, GdkEvent *event, int time, int model_col, int view_col, int row, ECellFlags flags) -{ - ECellActions actions = 0; - gint ret_val; - - ret_val = e_cell_event (ecell_view, event, model_col, view_col, row, flags, &actions); - - if (actions & E_CELL_GRAB) { - gnome_canvas_item_grab(GNOME_CANVAS_ITEM(item), GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, time); - item->grabbed_col = view_col; - item->grabbed_row = row; - } - - if (actions & E_CELL_UNGRAB) { - gnome_canvas_item_ungrab(GNOME_CANVAS_ITEM(item), time); - item->grabbed_col = -1; - item->grabbed_row = -1; - } - - return ret_val; -} - -/* FIXME: cursor */ -static int -eti_event (GnomeCanvasItem *item, GdkEvent *e) -{ - ETableItem *eti = E_TABLE_ITEM (item); - ECellView *ecell_view; - gint return_val = TRUE; - - switch (e->type){ - case GDK_BUTTON_PRESS: { - double x1, y1; - GdkEventButton button; - int col, row; - gint cursor_row, cursor_col; - - if (eti->tooltip->timer) { - gtk_timeout_remove (eti->tooltip->timer); - eti->tooltip->timer = 0; - } - - switch (e->button.button) { - case 1: /* Fall through. */ - case 2: - e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti)); - gnome_canvas_item_w2i (item, &e->button.x, &e->button.y); - - if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1)) { - if (eti_editing (eti)) - e_table_item_leave_edit (eti); - return TRUE; - } - - ecell_view = eti->cell_views [col]; - button = *(GdkEventButton *)e; - button.x = x1; - button.y = y1; - - return_val = eti_e_cell_event (eti, ecell_view, (GdkEvent *) &button, button.time, view_to_model_col(eti, col), col, row, 0); - if (return_val) - return TRUE; - - return_val = FALSE; - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [CLICK], - row, view_to_model_col(eti, col), &button, &return_val); - if (return_val) - return TRUE; - - e_selection_model_do_something(E_SELECTION_MODEL (eti->selection), view_to_model_row(eti, row), view_to_model_col(eti, col), button.state); - - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); - - if (cursor_row == view_to_model_row(eti, row) && cursor_col == view_to_model_col(eti, col)){ - - if ((!eti_editing(eti)) && e_table_model_is_cell_editable(eti->selection->model, cursor_col, cursor_row)) { - e_table_item_enter_edit (eti, col, row); - } - - /* - * Adjust the event positions - */ - - return_val = eti_e_cell_event (eti, ecell_view, (GdkEvent *) &button, button.time, - view_to_model_col(eti, col), col, row, E_CELL_EDITING); - } - g_print("Single click\n"); - - break; - case 3: - e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti)); - gnome_canvas_item_w2i (item, &e->button.x, &e->button.y); - if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1)) - return TRUE; - - e_selection_model_maybe_do_something(E_SELECTION_MODEL (eti->selection), view_to_model_row(eti, row), view_to_model_col(eti, col), 0); - - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [RIGHT_CLICK], - row, view_to_model_col(eti, col), e, &return_val); - break; - case 4: - case 5: - return FALSE; - break; - - } - break; - } - - case GDK_BUTTON_RELEASE: { - double x1, y1; - int col, row; - gint cursor_row, cursor_col; - - if (eti->tooltip->timer) { - gtk_timeout_remove (eti->tooltip->timer); - eti->tooltip->timer = 0; - } - if (eti->tooltip->window) { - gtk_widget_destroy (eti->tooltip->window); - eti->tooltip->window = NULL; - } - switch (e->button.button) { - case 1: /* Fall through. */ - case 2: - gnome_canvas_item_w2i (item, &e->button.x, &e->button.y); - - if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1)) - return TRUE; - - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); - - if (cursor_row == view_to_model_row(eti, row) && cursor_col == view_to_model_col(eti, col)){ - - ecell_view = eti->cell_views [col]; - - /* - * Adjust the event positions - */ - e->button.x = x1; - e->button.y = y1; - - return_val = eti_e_cell_event (eti, ecell_view, e, e->button.time, - view_to_model_col(eti, col), col, row, E_CELL_EDITING); - } - g_print ("Release\n"); - break; - case 3: - case 4: - case 5: - return FALSE; - break; - - } - break; - } - - case GDK_2BUTTON_PRESS: { - int col, row; - GdkEventButton button; - - if (e->button.button == 5 || - e->button.button == 4) - return FALSE; - - gnome_canvas_item_w2i (item, &e->button.x, &e->button.y); - -#if 0 - if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1)) - return TRUE; -#endif - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &row, - "cursor_col", &col, - NULL); - -#if 0 - button = *(GdkEventButton *)e; - button.x = x1; - button.y = y1; -#endif - - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [DOUBLE_CLICK], - row, col, &button); - g_print("Double click\n"); - break; - } - case GDK_MOTION_NOTIFY: { - int col, row; - double x1, y1; - gint cursor_col, cursor_row; - - gnome_canvas_item_w2i (item, &e->motion.x, &e->motion.y); - - if (!find_cell (eti, e->motion.x, e->motion.y, &col, &row, &x1, &y1)) - return TRUE; - - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); - - if (eti->tooltip->window) { - gtk_widget_destroy (eti->tooltip->window); - eti->tooltip->window = NULL; - } - - if (eti->tooltip->timer > 0) - gtk_timeout_remove (eti->tooltip->timer); -#if 0 - eti->tooltip->col = col; - eti->tooltip->row = row; - eti->tooltip->cx = e->motion.x; - eti->tooltip->cy = e->motion.y; - eti->tooltip->timer = gtk_timeout_add (100, (GSourceFunc)_do_tooltip, eti); -#endif - - if (cursor_row == view_to_model_row(eti, row) && cursor_col == view_to_model_col(eti, col)){ - ecell_view = eti->cell_views [col]; - - /* - * Adjust the event positions - */ - e->motion.x = x1; - e->motion.y = y1; - - return_val = eti_e_cell_event (eti, ecell_view, e, e->motion.time, - view_to_model_col(eti, col), col, row, E_CELL_EDITING); - } - break; - } - - case GDK_KEY_PRESS: { - gint cursor_row, cursor_col; - gint handled = TRUE; - - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); - - if (eti->tooltip->window) { - gtk_widget_destroy (eti->tooltip->window); - eti->tooltip->window = NULL; - } - - if (cursor_col == -1) - return FALSE; - - eti->in_key_press = TRUE; - - switch (e->key.keyval){ - case GDK_Left: - if (eti_editing (eti)) { - handled = FALSE; - break; - } - - if (eti->cursor_mode != E_CURSOR_LINE && cursor_col != view_to_model_col(eti, 0)) - eti_cursor_move_left (eti); - break; - - case GDK_Right: - if (eti_editing (eti)) { - handled = FALSE; - break; - } - - if (eti->cursor_mode != E_CURSOR_LINE && cursor_col != view_to_model_col(eti, eti->cols - 1)) - eti_cursor_move_right (eti); - break; - - case GDK_Up: - case GDK_Down: - return_val = e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e); - break; -#if 0 - case GDK_Up: - if (cursor_row != view_to_model_row(eti, 0)) - eti_cursor_move_up (eti); - else - return_val = FALSE; - break; - - case GDK_Down: - if (cursor_row != view_to_model_row(eti, eti->rows - 1)) - eti_cursor_move_down (eti); - else - return_val = FALSE; - break; -#endif - case GDK_Home: - case GDK_KP_Home: - if (eti->cursor_mode != E_CURSOR_LINE) { - eti_cursor_move (eti, model_to_view_row(eti, cursor_row), 0); - return_val = TRUE; - } else - return_val = e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e); - break; - case GDK_End: - case GDK_KP_End: - if (eti->cursor_mode != E_CURSOR_LINE) { - eti_cursor_move (eti, model_to_view_row(eti, cursor_row), eti->cols - 1); - return_val = TRUE; - } else - return_val = e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e); - break; - case GDK_Tab: - case GDK_KP_Tab: - case GDK_ISO_Left_Tab: - if (eti->cursor_mode == E_CURSOR_SPREADSHEET) { - if ((e->key.state & GDK_SHIFT_MASK) != 0){ - /* shift tab */ - if (cursor_col != view_to_model_col(eti, 0)) - eti_cursor_move_left (eti); - else if (cursor_row != view_to_model_row(eti, 0)) - eti_cursor_move (eti, model_to_view_row(eti, cursor_row) - 1, eti->cols - 1); - else - return_val = FALSE; - } else { - if (cursor_col != view_to_model_col (eti, eti->cols - 1)) - eti_cursor_move_right (eti); - else if (cursor_row != view_to_model_row(eti, eti->rows - 1)) - eti_cursor_move (eti, model_to_view_row(eti, cursor_row) + 1, 0); - else - return_val = FALSE; - } - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); - - if (cursor_col >= 0 && cursor_row >= 0 && return_val && - (!eti_editing(eti)) && e_table_model_is_cell_editable(eti->selection->model, cursor_col, cursor_row)) { - e_table_item_enter_edit (eti, model_to_view_col(eti, cursor_col), model_to_view_row(eti, cursor_row)); - } - break; - } else { - /* Let tab send you to the next widget. */ - return_val = FALSE; - break; - } - - case GDK_Return: - case GDK_KP_Enter: - case GDK_ISO_Enter: - case GDK_3270_Enter: - if (eti_editing (eti)){ - e_table_item_leave_edit (eti); -#if 0 - ecell_view = eti->cell_views [eti->editing_col]; - return_val = eti_e_cell_event (eti, ecell_view, e, e->key.time, - view_to_model_col(eti, eti->editing_col), - eti->editing_col, eti->editing_row, E_CELL_EDITING); -#endif - } - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS], - model_to_view_row(eti, cursor_row), cursor_col, e, &return_val); - if (!return_val) - return_val = e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e); - break; - - default: - handled = FALSE; - break; - } - if (!handled) { - if (!eti_editing (eti)){ - gint col, row; - row = model_to_view_row(eti, cursor_row); - col = model_to_view_col(eti, cursor_col); - if (col != -1 && row != -1 && e_table_model_is_cell_editable(eti->selection->model, cursor_col, cursor_row)) { - e_table_item_enter_edit (eti, col, row); - } - } - if (!eti_editing (eti)){ - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS], - model_to_view_row(eti, cursor_row), cursor_col, e, &return_val); - if (!return_val) - e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e); - } else { - ecell_view = eti->cell_views [eti->editing_col]; - return_val = eti_e_cell_event (eti, ecell_view, e, e->key.time, - view_to_model_col(eti, eti->editing_col), - eti->editing_col, eti->editing_row, E_CELL_EDITING); - if (!return_val) - e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e); - } - } - eti->in_key_press = FALSE; - break; - } - - case GDK_KEY_RELEASE: { - gint cursor_row, cursor_col; - - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_row", &cursor_row, - "cursor_col", &cursor_col, - NULL); - - if (cursor_col == -1) - return FALSE; - - if (eti_editing (eti)){ - ecell_view = eti->cell_views [eti->editing_col]; - return_val = eti_e_cell_event (eti, ecell_view, e, e->key.time, - view_to_model_col(eti, eti->editing_col), - eti->editing_col, eti->editing_row, E_CELL_EDITING); - } - break; - } - - case GDK_LEAVE_NOTIFY: - case GDK_ENTER_NOTIFY: - if (eti->tooltip->timer > 0) - gtk_timeout_remove (eti->tooltip->timer); - eti->tooltip->timer = 0; - break; - - case GDK_FOCUS_CHANGE: - if (! e->focus_change.in) { - if (eti_editing (eti)) - e_table_item_leave_edit (eti); - } - - default: - return_val = FALSE; - } - return return_val; -} - -static void -eti_class_init (GtkObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableItemClass *eti_class = (ETableItemClass *) object_class; - - eti_parent_class = gtk_type_class (PARENT_OBJECT_TYPE); - - object_class->destroy = eti_destroy; - object_class->set_arg = eti_set_arg; - object_class->get_arg = eti_get_arg; - - item_class->update = eti_update; - item_class->realize = eti_realize; - item_class->unrealize = eti_unrealize; - item_class->draw = eti_draw; - item_class->point = eti_point; - item_class->event = eti_event; - - eti_class->cursor_change = NULL; - eti_class->cursor_activated = NULL; - eti_class->double_click = NULL; - eti_class->right_click = NULL; - eti_class->click = NULL; - eti_class->key_press = NULL; - - gtk_object_add_arg_type ("ETableItem::ETableHeader", E_TABLE_HEADER_TYPE, - GTK_ARG_WRITABLE, ARG_TABLE_HEADER); - gtk_object_add_arg_type ("ETableItem::ETableModel", E_TABLE_MODEL_TYPE, - GTK_ARG_WRITABLE, ARG_TABLE_MODEL); - gtk_object_add_arg_type ("ETableItem::table_selection_model", E_TABLE_SELECTION_MODEL_TYPE, - GTK_ARG_WRITABLE, ARG_TABLE_SELECTION_MODEL); - gtk_object_add_arg_type ("ETableItem::drawgrid", GTK_TYPE_BOOL, - GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID); - gtk_object_add_arg_type ("ETableItem::drawfocus", GTK_TYPE_BOOL, - GTK_ARG_WRITABLE, ARG_TABLE_DRAW_FOCUS); - gtk_object_add_arg_type ("ETableItem::cursor_mode", GTK_TYPE_INT, - GTK_ARG_WRITABLE, ARG_CURSOR_MODE); - gtk_object_add_arg_type ("ETableItem::length_threshold", GTK_TYPE_INT, - GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD); - - gtk_object_add_arg_type ("ETableItem::minimum_width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH); - gtk_object_add_arg_type ("ETableItem::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableItem::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("ETableItem::cursor_row", GTK_TYPE_INT, - GTK_ARG_READWRITE, ARG_CURSOR_ROW); - - eti_signals [CURSOR_CHANGE] = - gtk_signal_new ("cursor_change", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableItemClass, cursor_change), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - eti_signals [CURSOR_ACTIVATED] = - gtk_signal_new ("cursor_activated", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableItemClass, cursor_activated), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - eti_signals [DOUBLE_CLICK] = - gtk_signal_new ("double_click", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableItemClass, double_click), - gtk_marshal_NONE__INT_INT_POINTER, - GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); - - eti_signals [RIGHT_CLICK] = - gtk_signal_new ("right_click", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableItemClass, right_click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); - - eti_signals [CLICK] = - gtk_signal_new ("click", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableItemClass, click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); - - eti_signals [KEY_PRESS] = - gtk_signal_new ("key_press", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableItemClass, key_press), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, eti_signals, LAST_SIGNAL); - -} - -GtkType -e_table_item_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETableItem", - sizeof (ETableItem), - sizeof (ETableItemClass), - (GtkClassInitFunc) eti_class_init, - (GtkObjectInitFunc) eti_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_OBJECT_TYPE, &info); - } - - return type; -} - -/** - * e_table_item_set_cursor: - * @eti: %ETableItem which will have the cursor set. - * @col: Column to select. -1 means the last column. - * @row: Row to select. -1 means the last row. - * - * This routine sets the cursor of the %ETableItem canvas item. - */ -void -e_table_item_set_cursor (ETableItem *eti, int col, int row) -{ - e_table_item_focus(eti, col, view_to_model_row(eti, row), 0); -} - -static void -e_table_item_focus (ETableItem *eti, int col, int row, GdkModifierType state) -{ - g_return_if_fail (eti != NULL); - g_return_if_fail (E_IS_TABLE_ITEM (eti)); - - if (row == -1) { - row = view_to_model_row(eti, eti->rows - 1); - } - - if (col == -1) { - col = eti->cols - 1; - } - - if (row != -1) { - e_selection_model_do_something(E_SELECTION_MODEL (eti->selection), - row, col, - state); - } -} - -/** - * e_table_item_get_focused_column: - * @eti: %ETableItem which will have the cursor retrieved. - * - * This routine gets the cursor of the %ETableItem canvas item. - * - * Returns: The current cursor column. - */ -gint -e_table_item_get_focused_column (ETableItem *eti) -{ - int cursor_col; - - g_return_val_if_fail (eti != NULL, -1); - g_return_val_if_fail (E_IS_TABLE_ITEM (eti), -1); - - gtk_object_get(GTK_OBJECT(eti->selection), - "cursor_col", &cursor_col, - NULL); - - return cursor_col; -} - -static void -eti_cursor_change (ETableSelectionModel *selection, int row, int col, ETableItem *eti) -{ - int view_row = model_to_view_row(eti, row); - int view_col = model_to_view_col(eti, col); - - if (view_row == -1 || view_col == -1) { - e_table_item_leave_edit (eti); - return; - } - - if (!eti->in_key_press) { - eti_request_region_show (eti, view_col, view_row, view_col, view_row, DOUBLE_CLICK_TIME + 10); - } else { - eti_request_region_show (eti, view_col, view_row, view_col, view_row, 0); - } - - e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti)); - if (eti_editing(eti)) - e_table_item_leave_edit (eti); - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [CURSOR_CHANGE], - view_row); - eti->needs_redraw = TRUE; - gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti)); -} - -static void -eti_cursor_activated (ETableSelectionModel *selection, int row, int col, ETableItem *eti) -{ - int view_row = model_to_view_row(eti, row); - int view_col = model_to_view_col(eti, col); - - if (view_row == -1 || view_col == -1) { - e_table_item_leave_edit (eti); - return; - } - - if (eti_editing(eti)) - e_table_item_leave_edit (eti); - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [CURSOR_ACTIVATED], - view_row); -} - -static void -eti_selection_change (ETableSelectionModel *selection, ETableItem *eti) -{ - eti->needs_redraw = TRUE; - gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti)); -} - - -/** - * e_table_item_enter_edit - * @eti: %ETableItem which will start being edited - * @col: The view col to edit. - * @row: The view row to edit. - * - * This routine starts the given %ETableItem editing at the given view - * column and row. - */ -void -e_table_item_enter_edit (ETableItem *eti, int col, int row) -{ - g_return_if_fail (eti != NULL); - g_return_if_fail (E_IS_TABLE_ITEM (eti)); - - if (eti_editing (eti)) - e_table_item_leave_edit(eti); - - eti->editing_col = col; - eti->editing_row = row; - - eti->edit_ctx = e_cell_enter_edit (eti->cell_views [col], view_to_model_col(eti, col), col, row); -} - -/** - * e_table_item_leave_edit - * @eti: %ETableItem which will stop being edited - * - * This routine stops the given %ETableItem from editing. - */ -void -e_table_item_leave_edit (ETableItem *eti) -{ - int col, row; - void *edit_ctx; - - g_return_if_fail (eti != NULL); - g_return_if_fail (E_IS_TABLE_ITEM (eti)); - - if (!eti_editing (eti)) - return; - - col = eti->editing_col; - row = eti->editing_row; - edit_ctx = eti->edit_ctx; - - eti->editing_col = -1; - eti->editing_row = -1; - eti->edit_ctx = NULL; - - e_cell_leave_edit (eti->cell_views [col], - view_to_model_col(eti, col), - col, row, edit_ctx); -} - -/** - * e_table_item_compute_location - * @eti: %ETableItem to look in. - * @x: A pointer to the x location to find in the %ETableItem. - * @y: A pointer to the y location to find in the %ETableItem. - * @row: A pointer to the location to store the found row in. - * @col: A pointer to the location to store the found col in. - * - * This routine locates the pixel location (*x, *y) in the - * %ETableItem. If that location is in the %ETableItem, *row and *col - * are set to the view row and column where it was found. If that - * location is not in the %ETableItem, the height of the %ETableItem - * is removed from the value y points to. - */ -void -e_table_item_compute_location (ETableItem *eti, - int *x, - int *y, - int *row, - int *col) -{ - /* Save the grabbed row but make sure that we don't get flawed - results because the cursor is grabbed. */ - int grabbed_row = eti->grabbed_row; - eti->grabbed_row = -1; - - if (!find_cell (eti, *x, *y, col, row, NULL, NULL)) { - *y -= eti_get_height(eti); - } - - eti->grabbed_row = grabbed_row; -} - -typedef struct { - ETableItem *item; - int rows_printed; -} ETableItemPrintContext; - -static gdouble * -e_table_item_calculate_print_widths (ETableHeader *eth, gdouble width) -{ - int i; - double extra; - double expansion; - int last_resizable = -1; - gdouble scale = 300.0L / 70.0L; - gdouble *widths = g_new(gdouble, e_table_header_count(eth)); - /* - 1 to account for the last pixel border. */ - extra = width - 1; - expansion = 0; - for (i = 0; i < eth->col_count; i++) { - extra -= eth->columns[i]->min_width * scale; - if (eth->columns[i]->resizeable && eth->columns[i]->expansion > 0) - last_resizable = i; - expansion += eth->columns[i]->resizeable ? eth->columns[i]->expansion : 0; - widths[i] = eth->columns[i]->min_width * scale; - } - for (i = 0; i <= last_resizable; i++) { - widths[i] += extra * (eth->columns[i]->resizeable ? eth->columns[i]->expansion : 0)/expansion; - } - - return widths; -} - -static gdouble -eti_printed_row_height (ETableItem *eti, gdouble *widths, GnomePrintContext *context, gint row) -{ - int col; - int cols = eti->cols; - gdouble height = 0; - for (col = 0; col < cols; col++) { - ECellView *ecell_view = eti->cell_views [col]; - gdouble this_height = e_cell_print_height (ecell_view, context, view_to_model_col(eti, col), col, row, - widths[col] - 1); - if (this_height > height) - height = this_height; - } - return height; -} - -#define CHECK(x) if((x) == -1) return -1; - -static gint -gp_draw_rect (GnomePrintContext *context, gdouble x, gdouble y, gdouble width, gdouble height) -{ - CHECK(gnome_print_moveto(context, x, y)); - CHECK(gnome_print_lineto(context, x + width, y)); - CHECK(gnome_print_lineto(context, x + width, y - height)); - CHECK(gnome_print_lineto(context, x, y - height)); - CHECK(gnome_print_lineto(context, x, y)); - return gnome_print_fill(context); -} - -static void -e_table_item_print_page (EPrintable *ep, - GnomePrintContext *context, - gdouble width, - gdouble height, - gboolean quantize, - ETableItemPrintContext *itemcontext) -{ - ETableItem *eti = itemcontext->item; - const int rows = eti->rows; - const int cols = eti->cols; - int rows_printed = itemcontext->rows_printed; - gdouble *widths; - int row, col; - gdouble yd = height; - - widths = e_table_item_calculate_print_widths (itemcontext->item->header, width); - - /* - * Draw cells - */ - if (eti->draw_grid){ - gp_draw_rect(context, 0, yd, width, 1); - } - yd--; - - for (row = rows_printed; row < rows; row++){ - gdouble xd = 1, row_height; - - row_height = eti_printed_row_height(eti, widths, context, row); - if (quantize) { - if (yd - row_height - 1 < 0 && row != rows_printed) { - break; - } - } else { - if (yd < 0) { - break; - } - } - - for (col = 0; col < cols; col++){ - ECellView *ecell_view = eti->cell_views [col]; - - if (gnome_print_gsave(context) == -1) - /* FIXME */; - if (gnome_print_translate(context, xd, yd - row_height) == -1) - /* FIXME */; - - if (gnome_print_moveto(context, 0, 0) == -1) - /* FIXME */; - if (gnome_print_lineto(context, widths[col] - 1, 0) == -1) - /* FIXME */; - if (gnome_print_lineto(context, widths[col] - 1, row_height) == -1) - /* FIXME */; - if (gnome_print_lineto(context, 0, row_height) == -1) - /* FIXME */; - if (gnome_print_lineto(context, 0, 0) == -1) - /* FIXME */; - if (gnome_print_clip(context) == -1) - /* FIXME */; - - e_cell_print (ecell_view, context, view_to_model_col(eti, col), col, row, - widths[col] - 1, row_height); - - if (gnome_print_grestore(context) == -1) - /* FIXME */; - - xd += widths[col]; - } - yd -= row_height; - - if (eti->draw_grid){ - gp_draw_rect(context, 0, yd, width, 1); - } - yd--; - } - - itemcontext->rows_printed = row; - - if (eti->draw_grid){ - gdouble xd = 0; - - for (col = 0; col < cols; col++){ - gp_draw_rect(context, xd, height, 1, height - yd); - - xd += widths[col]; - } - gp_draw_rect(context, xd, height, 1, height - yd); - } - - g_free (widths); -} - -static gboolean -e_table_item_data_left (EPrintable *ep, - ETableItemPrintContext *itemcontext) -{ - ETableItem *item = itemcontext->item; - int rows_printed = itemcontext->rows_printed; - - gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "data_left"); - return rows_printed < item->rows; -} - -static void -e_table_item_reset (EPrintable *ep, - ETableItemPrintContext *itemcontext) -{ - itemcontext->rows_printed = 0; -} - -static gdouble -e_table_item_height (EPrintable *ep, - GnomePrintContext *context, - gdouble width, - gdouble max_height, - gboolean quantize, - ETableItemPrintContext *itemcontext) -{ - ETableItem *item = itemcontext->item; - const int rows = item->rows; - int rows_printed = itemcontext->rows_printed; - gdouble *widths; - int row; - gdouble yd = 0; - - widths = e_table_item_calculate_print_widths (itemcontext->item->header, width); - - /* - * Draw cells - */ - yd++; - - for (row = rows_printed; row < rows; row++){ - gdouble row_height; - - row_height = eti_printed_row_height(item, widths, context, row); - if (quantize) { - if (max_height != -1 && yd + row_height + 1 > max_height && row != rows_printed) { - break; - } - } else { - if (max_height != -1 && yd > max_height) { - break; - } - } - - yd += row_height; - - yd++; - } - - g_free (widths); - - if (max_height != -1 && (!quantize) && yd > max_height) - yd = max_height; - - gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "height"); - return yd; -} - -static gboolean -e_table_item_will_fit (EPrintable *ep, - GnomePrintContext *context, - gdouble width, - gdouble max_height, - gboolean quantize, - ETableItemPrintContext *itemcontext) -{ - ETableItem *item = itemcontext->item; - const int rows = item->rows; - int rows_printed = itemcontext->rows_printed; - gdouble *widths; - int row; - gdouble yd = 0; - gboolean ret_val = TRUE; - - widths = e_table_item_calculate_print_widths (itemcontext->item->header, width); - - /* - * Draw cells - */ - yd++; - - for (row = rows_printed; row < rows; row++){ - gdouble row_height; - - row_height = eti_printed_row_height(item, widths, context, row); - if (quantize) { - if (max_height != -1 && yd + row_height + 1 > max_height && row != rows_printed) { - ret_val = FALSE; - break; - } - } else { - if (max_height != -1 && yd > max_height) { - ret_val = FALSE; - break; - } - } - - yd += row_height; - - yd++; - } - - g_free (widths); - - gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "will_fit"); - return ret_val; -} - -static void -e_table_item_printable_destroy (GtkObject *object, - ETableItemPrintContext *itemcontext) -{ - gtk_object_unref(GTK_OBJECT(itemcontext->item)); - g_free(itemcontext); -} - -/** - * e_table_item_get_printable - * @eti: %ETableItem which will be printed - * - * This routine creates and returns an %EPrintable that can be used to - * print the given %ETableItem. - * - * Returns: The %EPrintable. - */ -EPrintable * -e_table_item_get_printable (ETableItem *item) -{ - EPrintable *printable = e_printable_new(); - ETableItemPrintContext *itemcontext; - - itemcontext = g_new(ETableItemPrintContext, 1); - itemcontext->item = item; - gtk_object_ref(GTK_OBJECT(item)); - itemcontext->rows_printed = 0; - - gtk_signal_connect (GTK_OBJECT(printable), - "print_page", - GTK_SIGNAL_FUNC(e_table_item_print_page), - itemcontext); - gtk_signal_connect (GTK_OBJECT(printable), - "data_left", - GTK_SIGNAL_FUNC(e_table_item_data_left), - itemcontext); - gtk_signal_connect (GTK_OBJECT(printable), - "reset", - GTK_SIGNAL_FUNC(e_table_item_reset), - itemcontext); - gtk_signal_connect (GTK_OBJECT(printable), - "height", - GTK_SIGNAL_FUNC(e_table_item_height), - itemcontext); - gtk_signal_connect (GTK_OBJECT(printable), - "will_fit", - GTK_SIGNAL_FUNC(e_table_item_will_fit), - itemcontext); - gtk_signal_connect (GTK_OBJECT(printable), - "destroy", - GTK_SIGNAL_FUNC(e_table_item_printable_destroy), - itemcontext); - - return printable; -} diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h deleted file mode 100644 index 3c29691c22..0000000000 --- a/widgets/table/e-table-item.h +++ /dev/null @@ -1,149 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_ITEM_H_ -#define _E_TABLE_ITEM_H_ - -#include <libgnomeui/gnome-canvas.h> -#include <gal/e-table/e-table-model.h> -#include <gal/e-table/e-table-header.h> -#include <gal/e-table/e-table-selection-model.h> -#include <gal/e-table/e-table-defines.h> -#include <gal/e-table/e-table-tooltip.h> -#include <gal/widgets/e-printable.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_ITEM_TYPE (e_table_item_get_type ()) -#define E_TABLE_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_ITEM_TYPE, ETableItem)) -#define E_TABLE_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_ITEM_TYPE, ETableItemClass)) -#define E_IS_TABLE_ITEM(o) (GTK_CHECK_TYPE ((o), E_TABLE_ITEM_TYPE)) -#define E_IS_TABLE_ITEM_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_ITEM_TYPE)) - -typedef struct { - GnomeCanvasItem parent; - ETableModel *table_model; - ETableHeader *header; - - ETableModel *source_model; - ETableSelectionModel *selection; - - int x1, y1; - int minimum_width, width, height; - - int cols, rows; - - /* - * Ids for the signals we connect to - */ - int header_dim_change_id; - int header_structure_change_id; - int header_request_width_id; - int table_model_pre_change_id; - int table_model_change_id; - int table_model_row_change_id; - int table_model_cell_change_id; - int table_model_row_inserted_id; - int table_model_row_deleted_id; - - int selection_change_id; - int cursor_change_id; - int cursor_activated_id; - - GdkGC *fill_gc; - GdkGC *grid_gc; - GdkGC *focus_gc; - GdkBitmap *stipple; - - guint draw_grid:1; - guint draw_focus:1; - guint renderers_can_change_size:1; - guint cell_views_realized:1; - - guint needs_redraw : 1; - guint needs_compute_height : 1; - guint needs_compute_width : 1; - - guint uses_source_model : 1; - - guint in_key_press : 1; - - /* - * Realized views, per column - */ - ECellView **cell_views; - int n_cells; - - int *height_cache; - int height_cache_idle_id; - int height_cache_idle_count; - - /* - * Lengh Threshold: above this, we stop computing correctly - * the size - */ - int length_threshold; - - gint row_guess; - ECursorMode cursor_mode; - - /* - * During editing - */ - int editing_col, editing_row; - void *edit_ctx; - - int grabbed_col, grabbed_row; - - /* - * Tooltip - */ - ETableTooltip *tooltip; - -} ETableItem; - -typedef struct { - GnomeCanvasItemClass parent_class; - - void (*cursor_change) (ETableItem *eti, int row); - void (*cursor_activated) (ETableItem *eti, int row); - void (*double_click) (ETableItem *eti, int row); - gint (*right_click) (ETableItem *eti, int row, int col, GdkEvent *event); - gint (*click) (ETableItem *eti, int row, int col, GdkEvent *event); - gint (*key_press) (ETableItem *eti, int row, int col, GdkEvent *event); -} ETableItemClass; -GtkType e_table_item_get_type (void); - - -/* - * Focus - */ -void e_table_item_set_cursor (ETableItem *eti, - int col, - int row); - -gint e_table_item_get_focused_column (ETableItem *eti); - -void e_table_item_leave_edit (ETableItem *eti); -void e_table_item_enter_edit (ETableItem *eti, - int col, - int row); - -void e_table_item_redraw_range (ETableItem *eti, - int start_col, - int start_row, - int end_col, - int end_row); - -EPrintable *e_table_item_get_printable (ETableItem *eti); -void e_table_item_compute_location (ETableItem *eti, - int *x, - int *y, - int *row, - int *col); - -int e_table_item_row_diff (ETableItem *eti, - int start_row, - int end_row); - -END_GNOME_DECLS - -#endif /* _E_TABLE_ITEM_H_ */ diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c deleted file mode 100644 index 41a55d1a8f..0000000000 --- a/widgets/table/e-table-model.c +++ /dev/null @@ -1,492 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-model.c: a Table Model - * - * Authors: - * Miguel de Icaza (miguel@gnu.org) - * Chris Lahey (clahey@ximian.com) - * - * (C) 1999, 2000 Ximian, Inc. - */ -#include <config.h> -#include <gtk/gtksignal.h> -#include "e-table-model.h" - -#define ETM_CLASS(e) ((ETableModelClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type () - -#define d(x) - -d(static gint depth = 0); - - -static GtkObjectClass *e_table_model_parent_class; - -enum { - MODEL_CHANGED, - MODEL_PRE_CHANGE, - MODEL_ROW_CHANGED, - MODEL_CELL_CHANGED, - MODEL_ROW_INSERTED, - MODEL_ROW_DELETED, - ROW_SELECTION, - LAST_SIGNAL -}; - -static guint e_table_model_signals [LAST_SIGNAL] = { 0, }; - -/** - * e_table_model_column_count: - * @e_table_model: The e-table-model to operate on - * - * Returns: the number of columns in the table model. - */ -int -e_table_model_column_count (ETableModel *e_table_model) -{ - g_return_val_if_fail (e_table_model != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), 0); - - return ETM_CLASS (e_table_model)->column_count (e_table_model); -} - - -/** - * e_table_model_row_count: - * @e_table_model: the e-table-model to operate on - * - * Returns: the number of rows in the Table model. - */ -int -e_table_model_row_count (ETableModel *e_table_model) -{ - g_return_val_if_fail (e_table_model != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), 0); - - return ETM_CLASS (e_table_model)->row_count (e_table_model); -} - -/** - * e_table_value_at: - * @e_table_model: the e-table-model to operate on - * @col: column in the model to pull data from. - * @row: row in the model to pull data from. - * - * Return value: This function returns the value that is stored - * by the @e_table_model in column @col and row @row. The data - * returned can be a pointer or any data value that can be stored - * inside a pointer. - * - * The data returned is typically used by an ECell renderer - */ -void * -e_table_model_value_at (ETableModel *e_table_model, int col, int row) -{ - g_return_val_if_fail (e_table_model != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL); - - return ETM_CLASS (e_table_model)->value_at (e_table_model, col, row); -} - -/** - * e_table_model_set_value_at: - * @e_table_model: the table model to operate on. - * @col: the column where the data will be stored in the model. - * @row: the row where the data will be stored in the model. - * @value: the data to be stored. - * - * This function instructs the model to store the value in @data in the - * the @e_table_model at column @col and row @row. The @data typically - * comes from one of the ECell rendering objects. - * - * There should be an agreement between the Table Model and the user - * of this function about the data being stored. Typically it will - * be a pointer to a set of data, or a datum that fits inside a void *. - */ -void -e_table_model_set_value_at (ETableModel *e_table_model, int col, int row, const void *value) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - ETM_CLASS (e_table_model)->set_value_at (e_table_model, col, row, value); -} - -/** - * e_table_model_is_cell_editable: - * @e_table_model: the table model to query. - * @col: column to query. - * @row: row to query. - * - * Returns: %TRUE if the cell in @e_table_model at @col,@row can be - * edited, %FALSE otherwise - */ -gboolean -e_table_model_is_cell_editable (ETableModel *e_table_model, int col, int row) -{ - g_return_val_if_fail (e_table_model != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE); - - return ETM_CLASS (e_table_model)->is_cell_editable (e_table_model, col, row); -} - -/** - * e_table_model_append_row: - * @e_table_model: the table model to append the a row to. - * @source: - * @row: - * - */ -void -e_table_model_append_row (ETableModel *e_table_model, ETableModel *source, int row) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - if (ETM_CLASS (e_table_model)->append_row) - ETM_CLASS (e_table_model)->append_row (e_table_model, source, row); -} - -const char * -e_table_model_row_sort_group(ETableModel *e_table_model, int row) -{ - g_return_val_if_fail (e_table_model != NULL, "/"); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), "/"); - - if (ETM_CLASS (e_table_model)->row_sort_group) - return ETM_CLASS (e_table_model)->row_sort_group (e_table_model, row); - else - return "/"; -} - -gboolean -e_table_model_has_sort_group(ETableModel *e_table_model) -{ - g_return_val_if_fail (e_table_model != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE); - - if (ETM_CLASS (e_table_model)->has_sort_group) - return ETM_CLASS (e_table_model)->has_sort_group (e_table_model); - else - return FALSE; -} - -void * -e_table_model_duplicate_value (ETableModel *e_table_model, int col, const void *value) -{ - g_return_val_if_fail (e_table_model != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL); - - if (ETM_CLASS (e_table_model)->duplicate_value) - return ETM_CLASS (e_table_model)->duplicate_value (e_table_model, col, value); - else - return NULL; -} - -void -e_table_model_free_value (ETableModel *e_table_model, int col, void *value) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - if (ETM_CLASS (e_table_model)->free_value) - ETM_CLASS (e_table_model)->free_value (e_table_model, col, value); -} - -void * -e_table_model_initialize_value (ETableModel *e_table_model, int col) -{ - g_return_val_if_fail (e_table_model != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL); - - if (ETM_CLASS (e_table_model)->initialize_value) - return ETM_CLASS (e_table_model)->initialize_value (e_table_model, col); - else - return NULL; -} - -gboolean -e_table_model_value_is_empty (ETableModel *e_table_model, int col, const void *value) -{ - g_return_val_if_fail (e_table_model != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE); - - if (ETM_CLASS (e_table_model)->value_is_empty) - return ETM_CLASS (e_table_model)->value_is_empty (e_table_model, col, value); - else - return FALSE; -} - -char * -e_table_model_value_to_string (ETableModel *e_table_model, int col, const void *value) -{ - g_return_val_if_fail (e_table_model != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL); - - if (ETM_CLASS (e_table_model)->value_to_string) - return ETM_CLASS (e_table_model)->value_to_string (e_table_model, col, value); - else - return g_strdup(""); -} - -static void -e_table_model_destroy (GtkObject *object) -{ - if (e_table_model_parent_class->destroy) - (*e_table_model_parent_class->destroy)(object); -} - -static void -e_table_model_class_init (GtkObjectClass *object_class) -{ - ETableModelClass *klass = E_TABLE_MODEL_CLASS(object_class); - e_table_model_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = e_table_model_destroy; - - e_table_model_signals [MODEL_CHANGED] = - gtk_signal_new ("model_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableModelClass, model_changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_table_model_signals [MODEL_PRE_CHANGE] = - gtk_signal_new ("model_pre_change", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableModelClass, model_pre_change), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_table_model_signals [MODEL_ROW_CHANGED] = - gtk_signal_new ("model_row_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableModelClass, model_row_changed), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - e_table_model_signals [MODEL_CELL_CHANGED] = - gtk_signal_new ("model_cell_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableModelClass, model_cell_changed), - gtk_marshal_NONE__INT_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); - - e_table_model_signals [MODEL_ROW_INSERTED] = - gtk_signal_new ("model_row_inserted", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableModelClass, model_row_inserted), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - e_table_model_signals [MODEL_ROW_DELETED] = - gtk_signal_new ("model_row_deleted", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableModelClass, model_row_deleted), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, e_table_model_signals, LAST_SIGNAL); - - klass->column_count = NULL; - klass->row_count = NULL; - klass->value_at = NULL; - klass->set_value_at = NULL; - klass->is_cell_editable = NULL; - klass->append_row = NULL; - - klass->row_sort_group = NULL; - klass->has_sort_group = NULL; - - klass->duplicate_value = NULL; - klass->free_value = NULL; - klass->initialize_value = NULL; - klass->value_is_empty = NULL; - klass->value_to_string = NULL; - klass->model_changed = NULL; - klass->model_row_changed = NULL; - klass->model_cell_changed = NULL; - klass->model_row_inserted = NULL; - klass->model_row_deleted = NULL; -} - - -guint -e_table_model_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "ETableModel", - sizeof (ETableModel), - sizeof (ETableModelClass), - (GtkClassInitFunc) e_table_model_class_init, - NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -#if d(!)0 -static void -print_tabs (void) -{ - int i; - for (i = 0; i < depth; i++) - g_print("\t"); -} -#endif - -void -e_table_model_pre_change (ETableModel *e_table_model) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - d(print_tabs()); - d(g_print("Emitting pre_change on model 0x%p.\n", e_table_model)); - d(depth++); - gtk_signal_emit (GTK_OBJECT (e_table_model), - e_table_model_signals [MODEL_PRE_CHANGE]); - d(depth--); -} - -/** - * e_table_model_changed: - * @e_table_model: the table model to notify of the change - * - * Use this function to notify any views of this table model that - * the contents of the table model have changed. This will emit - * the signal "model_changed" on the @e_table_model object. - * - * It is preferable to use the e_table_model_row_changed() and - * the e_table_model_cell_changed() to notify of smaller changes - * than to invalidate the entire model, as the views might have - * ways of caching the information they render from the model. - */ -void -e_table_model_changed (ETableModel *e_table_model) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - d(print_tabs()); - d(g_print("Emitting model_changed on model 0x%p.\n", e_table_model)); - d(depth++); - gtk_signal_emit (GTK_OBJECT (e_table_model), - e_table_model_signals [MODEL_CHANGED]); - d(depth--); -} - -/** - * e_table_model_row_changed: - * @e_table_model: the table model to notify of the change - * @row: the row that was changed in the model. - * - * Use this function to notify any views of the table model that - * the contents of row @row have changed in model. This function - * will emit the "model_row_changed" signal on the @e_table_model - * object - */ -void -e_table_model_row_changed (ETableModel *e_table_model, int row) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - d(print_tabs()); - d(g_print("Emitting row_changed on model 0x%p, row %d.\n", e_table_model, row)); - d(depth++); - gtk_signal_emit (GTK_OBJECT (e_table_model), - e_table_model_signals [MODEL_ROW_CHANGED], row); - d(depth--); -} - -/** - * e_table_model_cell_changed: - * @e_table_model: the table model to notify of the change - * @col: the column. - * @row: the row - * - * Use this function to notify any views of the table model that - * contents of the cell at @col,@row has changed. This will emit - * the "model_cell_changed" signal on the @e_table_model - * object - */ -void -e_table_model_cell_changed (ETableModel *e_table_model, int col, int row) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - d(print_tabs()); - d(g_print("Emitting cell_changed on model 0x%p, row %d, col %d.\n", e_table_model, row, col)); - d(depth++); - gtk_signal_emit (GTK_OBJECT (e_table_model), - e_table_model_signals [MODEL_CELL_CHANGED], col, row); - d(depth--); -} - -/** - * e_table_model_row_inserted: - * @e_table_model: the table model to notify of the change - * @row: the row that was inserted into the model. - * - * Use this function to notify any views of the table model that - * the row @row has been inserted into the model. This function - * will emit the "model_row_inserted" signal on the @e_table_model - * object - */ -void -e_table_model_row_inserted (ETableModel *e_table_model, int row) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - d(print_tabs()); - d(g_print("Emitting row_inserted on model 0x%p, row %d.\n", e_table_model, row)); - d(depth++); - gtk_signal_emit (GTK_OBJECT (e_table_model), - e_table_model_signals [MODEL_ROW_INSERTED], row); - d(depth--); -} - -/** - * e_table_model_row_deleted: - * @e_table_model: the table model to notify of the change - * @row: the row that was deleted - * - * Use this function to notify any views of the table model that - * the row @row has been deleted from the model. This function - * will emit the "model_row_deleted" signal on the @e_table_model - * object - */ -void -e_table_model_row_deleted (ETableModel *e_table_model, int row) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - d(print_tabs()); - d(g_print("Emitting row_deleted on model 0x%p, row %d.\n", e_table_model, row)); - d(depth++); - gtk_signal_emit (GTK_OBJECT (e_table_model), - e_table_model_signals [MODEL_ROW_DELETED], row); - d(depth--); -} diff --git a/widgets/table/e-table-model.h b/widgets/table/e-table-model.h deleted file mode 100644 index 21febaf992..0000000000 --- a/widgets/table/e-table-model.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_MODEL_H_ -#define _E_TABLE_MODEL_H_ - -#include <gtk/gtkobject.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_TABLE_MODEL_TYPE (e_table_model_get_type ()) -#define E_TABLE_MODEL(o) (GTK_CHECK_CAST ((o), E_TABLE_MODEL_TYPE, ETableModel)) -#define E_TABLE_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_MODEL_TYPE, ETableModelClass)) -#define E_IS_TABLE_MODEL(o) (GTK_CHECK_TYPE ((o), E_TABLE_MODEL_TYPE)) -#define E_IS_TABLE_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_MODEL_TYPE)) - -typedef struct { - GtkObject base; -} ETableModel; - -typedef struct { - GtkObjectClass parent_class; - - /* - * Virtual methods - */ - int (*column_count) (ETableModel *etm); - int (*row_count) (ETableModel *etm); - void *(*value_at) (ETableModel *etm, int col, int row); - void (*set_value_at) (ETableModel *etm, int col, int row, const void *value); - gboolean (*is_cell_editable) (ETableModel *etm, int col, int row); - void (*append_row) (ETableModel *etm, ETableModel *source, int row); - - /* the sort group id for this row */ - const char *(*row_sort_group) (ETableModel *etm, int row); - gboolean (*has_sort_group) (ETableModel *etm); - - /* Allocate a copy of the given value. */ - void *(*duplicate_value) (ETableModel *etm, int col, const void *value); - /* Free an allocated value. */ - void (*free_value) (ETableModel *etm, int col, void *value); - /* Return an allocated empty value. */ - void *(*initialize_value) (ETableModel *etm, int col); - /* Return TRUE if value is equivalent to an empty cell. */ - gboolean (*value_is_empty) (ETableModel *etm, int col, const void *value); - /* Return an allocated string. */ - char *(*value_to_string) (ETableModel *etm, int col, const void *value); - - /* - * Signals - */ - - /* - * These all come after the change has been made. - * Major structural changes: model_changed - * Changes only in a row: row_changed - * Only changes in a cell: cell_changed - * A row inserted: row_inserted - * A row deleted: row_deleted - */ - void (*model_pre_change) (ETableModel *etm); - - void (*model_changed) (ETableModel *etm); - void (*model_row_changed) (ETableModel *etm, int row); - void (*model_cell_changed) (ETableModel *etm, int col, int row); - void (*model_row_inserted) (ETableModel *etm, int row); - void (*model_row_deleted) (ETableModel *etm, int row); -} ETableModelClass; - -GtkType e_table_model_get_type (void); - -int e_table_model_column_count (ETableModel *e_table_model); -const char *e_table_model_column_name (ETableModel *e_table_model, int col); -int e_table_model_row_count (ETableModel *e_table_model); -void *e_table_model_value_at (ETableModel *e_table_model, int col, int row); -void e_table_model_set_value_at (ETableModel *e_table_model, int col, int row, const void *value); -gboolean e_table_model_is_cell_editable (ETableModel *e_table_model, int col, int row); -void e_table_model_append_row (ETableModel *e_table_model, ETableModel *source, int row); - -const char *e_table_model_row_sort_group (ETableModel *e_table_model, int row); -gboolean e_table_model_has_sort_group (ETableModel *e_table_model); - -void *e_table_model_duplicate_value (ETableModel *e_table_model, int col, const void *value); -void e_table_model_free_value (ETableModel *e_table_model, int col, void *value); -void *e_table_model_initialize_value (ETableModel *e_table_model, int col); -gboolean e_table_model_value_is_empty (ETableModel *e_table_model, int col, const void *value); -char *e_table_model_value_to_string (ETableModel *e_table_model, int col, const void *value); - -/* - * Routines for emitting signals on the e_table - */ -void e_table_model_pre_change (ETableModel *e_table_model); -void e_table_model_changed (ETableModel *e_table_model); -void e_table_model_row_changed (ETableModel *e_table_model, int row); -void e_table_model_cell_changed (ETableModel *e_table_model, int col, int row); -void e_table_model_row_inserted (ETableModel *e_table_model, int row); -void e_table_model_row_deleted (ETableModel *e_table_model, int row); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TABLE_MODEL_H_ */ diff --git a/widgets/table/e-table-one.c b/widgets/table/e-table-one.c deleted file mode 100644 index 524005cd6e..0000000000 --- a/widgets/table/e-table-one.c +++ /dev/null @@ -1,236 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-model.c: a one table model implementation that uses function - * pointers to simplify the creation of new, exotic and colorful tables in - * no time. - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Ximian, Inc. - */ - -#include <config.h> -#include "e-table-one.h" - -#define PARENT_TYPE e_table_model_get_type () - -static int -one_column_count (ETableModel *etm) -{ - ETableOne *one = E_TABLE_ONE(etm); - - if (one->source) - return e_table_model_column_count(one->source); - else - return 0; -} - -static int -one_row_count (ETableModel *etm) -{ - return 1; -} - -static void * -one_value_at (ETableModel *etm, int col, int row) -{ - ETableOne *one = E_TABLE_ONE(etm); - - if (one->data) - return one->data[col]; - else - return NULL; -} - -static void -one_set_value_at (ETableModel *etm, int col, int row, const void *val) -{ - ETableOne *one = E_TABLE_ONE(etm); - - if (one->data && one->source) { - e_table_model_free_value(one->source, col, one->data[col]); - one->data[col] = e_table_model_duplicate_value(one->source, col, val); - } -} - -static gboolean -one_is_cell_editable (ETableModel *etm, int col, int row) -{ - ETableOne *one = E_TABLE_ONE(etm); - - if (one->source) - return e_table_model_is_cell_editable(one->source, 0, row); - else - return FALSE; -} - -/* The default for one_duplicate_value is to return the raw value. */ -static void * -one_duplicate_value (ETableModel *etm, int col, const void *value) -{ - ETableOne *one = E_TABLE_ONE(etm); - - if (one->source) - return e_table_model_duplicate_value(one->source, col, value); - else - return (void *)value; -} - -static void -one_free_value (ETableModel *etm, int col, void *value) -{ - ETableOne *one = E_TABLE_ONE(etm); - - if (one->source) - e_table_model_free_value(one->source, col, value); -} - -static void * -one_initialize_value (ETableModel *etm, int col) -{ - ETableOne *one = E_TABLE_ONE(etm); - - if (one->source) - return e_table_model_initialize_value (one->source, col); - else - return NULL; -} - -static gboolean -one_value_is_empty (ETableModel *etm, int col, const void *value) -{ - ETableOne *one = E_TABLE_ONE(etm); - - if (one->source) - return e_table_model_value_is_empty (one->source, col, value); - else - return FALSE; -} - -static char * -one_value_to_string (ETableModel *etm, int col, const void *value) -{ - ETableOne *one = E_TABLE_ONE(etm); - - if (one->source) - return e_table_model_value_to_string (one->source, col, value); - else - return g_strdup(""); -} - -static void -one_destroy (GtkObject *object) -{ - ETableOne *one = E_TABLE_ONE(object); - - if (one->source) { - int i; - int col_count; - - col_count = e_table_model_column_count(one->source); - - if (one->data) { - for (i = 0; i < col_count; i++) { - e_table_model_free_value(one->source, i, one->data[i]); - } - } - - gtk_object_unref(GTK_OBJECT(one->source)); - } - - g_free(one->data); -} - -static void -e_table_one_class_init (GtkObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; - - model_class->column_count = one_column_count; - model_class->row_count = one_row_count; - model_class->value_at = one_value_at; - model_class->set_value_at = one_set_value_at; - model_class->is_cell_editable = one_is_cell_editable; - model_class->duplicate_value = one_duplicate_value; - model_class->free_value = one_free_value; - model_class->initialize_value = one_initialize_value; - model_class->value_is_empty = one_value_is_empty; - model_class->value_to_string = one_value_to_string; - - object_class->destroy = one_destroy; -} - -static void -e_table_one_init (GtkObject *object) -{ - ETableOne *one = E_TABLE_ONE(object); - - one->source = NULL; - one->data = NULL; -} - -GtkType -e_table_one_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETableOne", - sizeof (ETableOne), - sizeof (ETableOneClass), - (GtkClassInitFunc) e_table_one_class_init, - (GtkObjectInitFunc) e_table_one_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -ETableModel * -e_table_one_new (ETableModel *source) -{ - ETableOne *eto; - int col_count; - int i; - - eto = gtk_type_new (e_table_one_get_type ()); - - eto->source = source; - - col_count = e_table_model_column_count(source); - eto->data = g_new(void *, col_count); - for (i = 0; i < col_count; i++) { - eto->data[i] = e_table_model_initialize_value(source, i); - } - - if (source) - gtk_object_ref(GTK_OBJECT(source)); - - return (ETableModel *) eto; -} - -void -e_table_one_commit (ETableOne *one) -{ - if (one->source) { - int empty = TRUE; - int col; - int cols = e_table_model_column_count(one->source); - for (col = 0; col < cols; col++) { - if (!e_table_model_value_is_empty(one->source, col, one->data[col])) { - empty = FALSE; - break; - } - } - if (!empty) { - e_table_model_append_row(one->source, E_TABLE_MODEL(one), 0); - } - } -} diff --git a/widgets/table/e-table-one.h b/widgets/table/e-table-one.h deleted file mode 100644 index 2636f018ab..0000000000 --- a/widgets/table/e-table-one.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_ONE_H_ -#define _E_TABLE_ONE_H_ - -#include <gal/e-table/e-table-model.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define E_TABLE_ONE_TYPE (e_table_one_get_type ()) -#define E_TABLE_ONE(o) (GTK_CHECK_CAST ((o), E_TABLE_ONE_TYPE, ETableOne)) -#define E_TABLE_ONE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_ONE_TYPE, ETableOneClass)) -#define E_IS_TABLE_ONE(o) (GTK_CHECK_TYPE ((o), E_TABLE_ONE_TYPE)) -#define E_IS_TABLE_ONE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_ONE_TYPE)) - -typedef struct { - ETableModel parent; - - ETableModel *source; - void **data; -} ETableOne; - -typedef struct { - ETableModelClass parent_class; -} ETableOneClass; - -GtkType e_table_one_get_type (void); - -ETableModel *e_table_one_new (ETableModel *source); -void e_table_one_commit (ETableOne *one); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TABLE_ONE_H_ */ - diff --git a/widgets/table/e-table-scrolled.c b/widgets/table/e-table-scrolled.c deleted file mode 100644 index cd816a678c..0000000000 --- a/widgets/table/e-table-scrolled.c +++ /dev/null @@ -1,208 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-scrolled.c: A graphical view of a Table. - * - * Author: - * Chris Lahey <clahey@ximian.com> - * Miguel de Icaza (miguel@ximian.com) - * - * Copyright 2000, 1999, Ximian, Inc - */ -#include <config.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <stdio.h> -#include <libgnomeui/gnome-canvas.h> -#include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> - -#include "e-table.h" -#include "e-table-scrolled.h" - -#define COLUMN_HEADER_HEIGHT 16 - -#define PARENT_TYPE e_scroll_frame_get_type () - -static GtkObjectClass *parent_class; - -enum { - ARG_0, - ARG_TABLE, -}; - -static void -e_table_scrolled_init (GtkObject *object) -{ - ETableScrolled *ets; - EScrollFrame *scroll_frame; - - ets = E_TABLE_SCROLLED (object); - scroll_frame = E_SCROLL_FRAME (object); - - GTK_WIDGET_SET_FLAGS (ets, GTK_CAN_FOCUS); - - ets->table = gtk_type_new(e_table_get_type()); - - e_scroll_frame_set_policy (scroll_frame, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - e_scroll_frame_set_shadow_type (scroll_frame, GTK_SHADOW_IN); -} - -static void -e_table_scrolled_real_construct (ETableScrolled *ets) -{ - gtk_container_add(GTK_CONTAINER(ets), GTK_WIDGET(ets->table)); - - gtk_widget_show(GTK_WIDGET(ets->table)); -} - -ETableScrolled *e_table_scrolled_construct (ETableScrolled *ets, - ETableModel *etm, - ETableExtras *ete, - const char *spec, - const char *state) -{ - g_return_val_if_fail(ets != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE_SCROLLED(ets), NULL); - g_return_val_if_fail(etm != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL); - g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); - g_return_val_if_fail(spec != NULL, NULL); - - e_table_construct(ets->table, etm, ete, spec, state); - - e_table_scrolled_real_construct(ets); - - return ets; -} - -GtkWidget *e_table_scrolled_new (ETableModel *etm, - ETableExtras *ete, - const char *spec, - const char *state) -{ - ETableScrolled *ets; - - g_return_val_if_fail(etm != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL); - g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); - g_return_val_if_fail(spec != NULL, NULL); - - ets = E_TABLE_SCROLLED (gtk_widget_new (e_table_scrolled_get_type (), - "hadjustment", NULL, - "vadjustment", NULL, - NULL)); - - ets = e_table_scrolled_construct (ets, etm, ete, spec, state); - - return GTK_WIDGET (ets); -} - -ETableScrolled *e_table_scrolled_construct_from_spec_file (ETableScrolled *ets, - ETableModel *etm, - ETableExtras *ete, - const char *spec_fn, - const char *state_fn) -{ - g_return_val_if_fail(ets != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE_SCROLLED(ets), NULL); - g_return_val_if_fail(etm != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL); - g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); - g_return_val_if_fail(spec_fn != NULL, NULL); - - e_table_construct_from_spec_file(ets->table, etm, ete, spec_fn, state_fn); - - e_table_scrolled_real_construct(ets); - - return ets; -} - -GtkWidget *e_table_scrolled_new_from_spec_file (ETableModel *etm, - ETableExtras *ete, - const char *spec_fn, - const char *state_fn) -{ - ETableScrolled *ets; - - g_return_val_if_fail(etm != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL); - g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); - g_return_val_if_fail(spec_fn != NULL, NULL); - - ets = gtk_type_new (e_table_scrolled_get_type ()); - - ets = e_table_scrolled_construct_from_spec_file (ets, etm, ete, spec_fn, state_fn); - - return GTK_WIDGET (ets); -} - -ETable * -e_table_scrolled_get_table (ETableScrolled *ets) -{ - return ets->table; -} - -static void -ets_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ETableScrolled *ets = E_TABLE_SCROLLED (o); - - switch (arg_id){ - case ARG_TABLE: - if (ets->table) - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(ets->table); - else - GTK_VALUE_OBJECT (*arg) = NULL; - break; - } -} - -/* Grab_focus handler for the scrolled ETable */ -static void -ets_grab_focus (GtkWidget *widget) -{ - ETableScrolled *ets; - - ets = E_TABLE_SCROLLED (widget); - - gtk_widget_grab_focus (GTK_WIDGET (ets->table)); -} - -/* Focus handler for the scrolled ETable */ -static gint -ets_focus (GtkContainer *container, GtkDirectionType direction) -{ - ETableScrolled *ets; - - ets = E_TABLE_SCROLLED (container); - - return gtk_container_focus (GTK_CONTAINER (ets->table), direction); -} - -static void -e_table_scrolled_class_init (ETableScrolledClass *class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - GtkContainerClass *container_class; - - object_class = (GtkObjectClass *) class; - widget_class = (GtkWidgetClass *) class; - container_class = (GtkContainerClass *) class; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->get_arg = ets_get_arg; - - widget_class->grab_focus = ets_grab_focus; - - container_class->focus = ets_focus; - - gtk_object_add_arg_type ("ETableScrolled::table", GTK_TYPE_OBJECT, - GTK_ARG_READABLE, ARG_TABLE); -} - -E_MAKE_TYPE(e_table_scrolled, "ETableScrolled", ETableScrolled, e_table_scrolled_class_init, e_table_scrolled_init, PARENT_TYPE); - diff --git a/widgets/table/e-table-scrolled.h b/widgets/table/e-table-scrolled.h deleted file mode 100644 index 9b2d2a510e..0000000000 --- a/widgets/table/e-table-scrolled.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SCROLLED_H_ -#define _E_TABLE_SCROLLED_H_ - -#include <gal/widgets/e-scroll-frame.h> -#include <gal/e-table/e-table-model.h> -#include <gal/e-table/e-table-header.h> -#include <gal/e-table/e-table.h> -#include <gal/widgets/e-printable.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_SCROLLED_TYPE (e_table_scrolled_get_type ()) -#define E_TABLE_SCROLLED(o) (GTK_CHECK_CAST ((o), E_TABLE_SCROLLED_TYPE, ETableScrolled)) -#define E_TABLE_SCROLLED_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SCROLLED_TYPE, ETableScrolledClass)) -#define E_IS_TABLE_SCROLLED(o) (GTK_CHECK_TYPE ((o), E_TABLE_SCROLLED_TYPE)) -#define E_IS_TABLE_SCROLLED_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SCROLLED_TYPE)) - -typedef struct { - EScrollFrame parent; - - ETable *table; -} ETableScrolled; - -typedef struct { - EScrollFrameClass parent_class; -} ETableScrolledClass; - -GtkType e_table_scrolled_get_type (void); - -ETableScrolled *e_table_scrolled_construct (ETableScrolled *ets, - ETableModel *etm, - ETableExtras *ete, - const char *spec, - const char *state); -GtkWidget *e_table_scrolled_new (ETableModel *etm, - ETableExtras *ete, - const char *spec, - const char *state); - -ETableScrolled *e_table_scrolled_construct_from_spec_file (ETableScrolled *ets, - ETableModel *etm, - ETableExtras *ete, - const char *spec_fn, - const char *state_fn); -GtkWidget *e_table_scrolled_new_from_spec_file (ETableModel *etm, - ETableExtras *ete, - const char *spec_fn, - const char *state_fn); - -ETable *e_table_scrolled_get_table (ETableScrolled *ets); - -END_GNOME_DECLS - -#endif /* _E_TABLE_SCROLLED_H_ */ - diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c deleted file mode 100644 index a2a0f99aa9..0000000000 --- a/widgets/table/e-table-selection-model.c +++ /dev/null @@ -1,180 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-selection-model.c: a Table Selection Model - * - * Author: - * Christopher James Lahey <clahey@ximian.com> - * - * (C) 2000, 2001 Ximian, Inc. - */ -#include <config.h> -#include <gtk/gtksignal.h> -#include "e-table-selection-model.h" -#include "gal/util/e-util.h" -#include <gdk/gdkkeysyms.h> - -#define ETSM_CLASS(e) ((ETableSelectionModelClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE e_selection_model_get_type () - -static ESelectionModel *parent_class; - -static gint etsm_get_row_count (ESelectionModel *esm); - -enum { - ARG_0, - ARG_MODEL, -}; - -static void -model_changed(ETableModel *etm, ETableSelectionModel *etsm) -{ - e_selection_model_clear(E_SELECTION_MODEL(etsm)); -} - -#if 1 -static void -model_row_inserted(ETableModel *etm, int row, ETableSelectionModel *etsm) -{ - e_selection_model_insert_row(E_SELECTION_MODEL(etsm), row); -} - -static void -model_row_deleted(ETableModel *etm, int row, ETableSelectionModel *etsm) -{ - e_selection_model_delete_row(E_SELECTION_MODEL(etsm), row); -} - -#else - -static void -model_row_inserted(ETableModel *etm, int row, ETableSelectionModel *etsm) -{ - model_changed(etm, etsm); -} - -static void -model_row_deleted(ETableModel *etm, int row, ETableSelectionModel *etsm) -{ - model_changed(etm, etsm); -} -#endif - -inline static void -add_model(ETableSelectionModel *etsm, ETableModel *model) -{ - etsm->model = model; - if (model) { - gtk_object_ref(GTK_OBJECT(model)); - etsm->model_changed_id = gtk_signal_connect(GTK_OBJECT(model), "model_changed", - GTK_SIGNAL_FUNC(model_changed), etsm); - etsm->model_row_inserted_id = gtk_signal_connect(GTK_OBJECT(model), "model_row_inserted", - GTK_SIGNAL_FUNC(model_row_inserted), etsm); - etsm->model_row_deleted_id = gtk_signal_connect(GTK_OBJECT(model), "model_row_deleted", - GTK_SIGNAL_FUNC(model_row_deleted), etsm); - } -} - -inline static void -drop_model(ETableSelectionModel *etsm) -{ - if (etsm->model) { - gtk_signal_disconnect(GTK_OBJECT(etsm->model), - etsm->model_changed_id); - gtk_signal_disconnect(GTK_OBJECT(etsm->model), - etsm->model_row_inserted_id); - gtk_signal_disconnect(GTK_OBJECT(etsm->model), - etsm->model_row_deleted_id); - gtk_object_unref(GTK_OBJECT(etsm->model)); - } - etsm->model = NULL; -} - -static void -etsm_destroy (GtkObject *object) -{ - ETableSelectionModel *etsm; - - etsm = E_TABLE_SELECTION_MODEL (object); - - drop_model(etsm); - - if (GTK_OBJECT_CLASS(parent_class)->destroy) - GTK_OBJECT_CLASS(parent_class)->destroy (object); -} - -static void -etsm_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ETableSelectionModel *etsm = E_TABLE_SELECTION_MODEL (o); - - switch (arg_id){ - case ARG_MODEL: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etsm->model); - break; - } -} - -static void -etsm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ETableSelectionModel *etsm = E_TABLE_SELECTION_MODEL (o); - - switch (arg_id){ - case ARG_MODEL: - drop_model(etsm); - add_model(etsm, GTK_VALUE_OBJECT (*arg) ? E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg)) : NULL); - break; - } -} - -static void -e_table_selection_model_init (ETableSelectionModel *selection) -{ - selection->model = NULL; -} - -static void -e_table_selection_model_class_init (ETableSelectionModelClass *klass) -{ - GtkObjectClass *object_class; - ESelectionModelClass *esm_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class = GTK_OBJECT_CLASS(klass); - esm_class = E_SELECTION_MODEL_CLASS(klass); - - object_class->destroy = etsm_destroy; - object_class->get_arg = etsm_get_arg; - object_class->set_arg = etsm_set_arg; - - esm_class->get_row_count = etsm_get_row_count; - - gtk_object_add_arg_type ("ETableSelectionModel::model", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_MODEL); -} - -E_MAKE_TYPE(e_table_selection_model, "ETableSelectionModel", ETableSelectionModel, - e_table_selection_model_class_init, e_table_selection_model_init, PARENT_TYPE); - -/** - * e_table_selection_model_new - * - * This routine creates a new #ETableSelectionModel. - * - * Returns: The new #ETableSelectionModel. - */ -ETableSelectionModel * -e_table_selection_model_new (void) -{ - return gtk_type_new (e_table_selection_model_get_type ()); -} - -static gint -etsm_get_row_count (ESelectionModel *esm) -{ - ETableSelectionModel *etsm = E_TABLE_SELECTION_MODEL(esm); - - return e_table_model_row_count (etsm->model); -} diff --git a/widgets/table/e-table-selection-model.h b/widgets/table/e-table-selection-model.h deleted file mode 100644 index 42333b2493..0000000000 --- a/widgets/table/e-table-selection-model.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SELECTION_MODEL_H_ -#define _E_TABLE_SELECTION_MODEL_H_ - -#include <gtk/gtkobject.h> -#include <gal/widgets/e-selection-model.h> -#include <gal/e-table/e-table-model.h> -#include <gal/e-table/e-table-defines.h> -#include <gal/e-table/e-table-sorter.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_TABLE_SELECTION_MODEL_TYPE (e_table_selection_model_get_type ()) -#define E_TABLE_SELECTION_MODEL(o) (GTK_CHECK_CAST ((o), E_TABLE_SELECTION_MODEL_TYPE, ETableSelectionModel)) -#define E_TABLE_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SELECTION_MODEL_TYPE, ETableSelectionModelClass)) -#define E_IS_TABLE_SELECTION_MODEL(o) (GTK_CHECK_TYPE ((o), E_TABLE_SELECTION_MODEL_TYPE)) -#define E_IS_TABLE_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SELECTION_MODEL_TYPE)) - -typedef struct { - ESelectionModel base; - - ETableModel *model; - - guint model_changed_id; - guint model_row_inserted_id, model_row_deleted_id; - - guint frozen : 1; - guint selection_model_changed : 1; - guint group_info_changed : 1; -} ETableSelectionModel; - -typedef struct { - ESelectionModelClass parent_class; -} ETableSelectionModelClass; - -GtkType e_table_selection_model_get_type (void); -ETableSelectionModel *e_table_selection_model_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* _E_TABLE_SELECTION_MODEL_H_ */ diff --git a/widgets/table/e-table-simple.c b/widgets/table/e-table-simple.c deleted file mode 100644 index 82d29bd6c7..0000000000 --- a/widgets/table/e-table-simple.c +++ /dev/null @@ -1,269 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-model.c: a simple table model implementation that uses function - * pointers to simplify the creation of new, exotic and colorful tables in - * no time. - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999, 2000 Ximian, Inc. - */ - -#include <config.h> -#include "e-table-simple.h" - -enum { - ARG_0, - ARG_APPEND_ROW, -}; - -#define PARENT_TYPE e_table_model_get_type () - -static int -simple_column_count (ETableModel *etm) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - if (simple->col_count) - return simple->col_count (etm, simple->data); - else - return 0; -} - -static int -simple_row_count (ETableModel *etm) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - if (simple->row_count) - return simple->row_count (etm, simple->data); - else - return 0; -} - -static void * -simple_value_at (ETableModel *etm, int col, int row) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - if (simple->value_at) - return simple->value_at (etm, col, row, simple->data); - else - return NULL; -} - -static void -simple_set_value_at (ETableModel *etm, int col, int row, const void *val) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - if (simple->set_value_at) - simple->set_value_at (etm, col, row, val, simple->data); -} - -static gboolean -simple_is_cell_editable (ETableModel *etm, int col, int row) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - if (simple->is_cell_editable) - return simple->is_cell_editable (etm, col, row, simple->data); - else - return FALSE; -} - -/* The default for simple_duplicate_value is to return the raw value. */ -static void * -simple_duplicate_value (ETableModel *etm, int col, const void *value) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - if (simple->duplicate_value) - return simple->duplicate_value (etm, col, value, simple->data); - else - return (void *)value; -} - -static void -simple_free_value (ETableModel *etm, int col, void *value) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - if (simple->free_value) - simple->free_value (etm, col, value, simple->data); -} - -static void * -simple_initialize_value (ETableModel *etm, int col) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - if (simple->initialize_value) - return simple->initialize_value (etm, col, simple->data); - else - return NULL; -} - -static gboolean -simple_value_is_empty (ETableModel *etm, int col, const void *value) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - if (simple->value_is_empty) - return simple->value_is_empty (etm, col, value, simple->data); - else - return FALSE; -} - -static char * -simple_value_to_string (ETableModel *etm, int col, const void *value) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - if (simple->value_to_string) - return simple->value_to_string (etm, col, value, simple->data); - else - return g_strdup (""); -} - -static void -simple_append_row (ETableModel *etm, ETableModel *source, int row) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - if (simple->append_row) - simple->append_row (etm, source, row, simple->data); -} - -static void -simple_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ETableSimple *simple = E_TABLE_SIMPLE (o); - - switch (arg_id){ - case ARG_APPEND_ROW: - GTK_VALUE_POINTER(*arg) = simple->append_row; - break; - } -} - -static void -simple_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ETableSimple *simple = E_TABLE_SIMPLE (o); - - switch (arg_id){ - case ARG_APPEND_ROW: - simple->append_row = GTK_VALUE_POINTER(*arg); - break; - default: - arg->type = GTK_TYPE_INVALID; - } -} - -static void -e_table_simple_class_init (GtkObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; - - object_class->set_arg = simple_set_arg; - object_class->get_arg = simple_get_arg; - - model_class->column_count = simple_column_count; - model_class->row_count = simple_row_count; - model_class->value_at = simple_value_at; - model_class->set_value_at = simple_set_value_at; - model_class->is_cell_editable = simple_is_cell_editable; - model_class->duplicate_value = simple_duplicate_value; - model_class->free_value = simple_free_value; - model_class->initialize_value = simple_initialize_value; - model_class->value_is_empty = simple_value_is_empty; - model_class->value_to_string = simple_value_to_string; - model_class->append_row = simple_append_row; - - gtk_object_add_arg_type ("ETableSimple::append_row", GTK_TYPE_POINTER, - GTK_ARG_READWRITE, ARG_APPEND_ROW); -} - -GtkType -e_table_simple_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETableSimple", - sizeof (ETableSimple), - sizeof (ETableSimpleClass), - (GtkClassInitFunc) e_table_simple_class_init, - (GtkObjectInitFunc) NULL, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -/** - * e_table_simple_new: - * @col_count: - * @row_count: - * @value_at: - * @set_value_at: - * @is_cell_editable: - * @duplicate_value: - * @free_value: - * @initialize_value: - * @value_is_empty: - * @value_to_string: - * @data: closure pointer. - * - * This initializes a new ETableSimpleModel object. ETableSimpleModel is - * an implementaiton of the abstract class ETableModel. The ETableSimpleModel - * is designed to allow people to easily create ETableModels without having - * to create a new GtkType derived from ETableModel every time they need one. - * - * Instead, ETableSimpleModel uses a setup based in callback functions, every - * callback function signature mimics the signature of each ETableModel method - * and passes the extra @data pointer to each one of the method to provide them - * with any context they might want to use. - * - * Returns: An ETableSimpleModel object (which is also an ETableModel - * object). - */ -ETableModel * -e_table_simple_new (ETableSimpleColumnCountFn col_count, - ETableSimpleRowCountFn row_count, - ETableSimpleValueAtFn value_at, - ETableSimpleSetValueAtFn set_value_at, - ETableSimpleIsCellEditableFn is_cell_editable, - ETableSimpleDuplicateValueFn duplicate_value, - ETableSimpleFreeValueFn free_value, - ETableSimpleInitializeValueFn initialize_value, - ETableSimpleValueIsEmptyFn value_is_empty, - ETableSimpleValueToStringFn value_to_string, - void *data) -{ - ETableSimple *et; - - et = gtk_type_new (e_table_simple_get_type ()); - - et->col_count = col_count; - et->row_count = row_count; - et->value_at = value_at; - et->set_value_at = set_value_at; - et->is_cell_editable = is_cell_editable; - et->duplicate_value = duplicate_value; - et->free_value = free_value; - et->initialize_value = initialize_value; - et->value_is_empty = value_is_empty; - et->value_to_string = value_to_string; - et->data = data; - - return (ETableModel *) et; - } diff --git a/widgets/table/e-table-simple.h b/widgets/table/e-table-simple.h deleted file mode 100644 index cf5ec6d4f2..0000000000 --- a/widgets/table/e-table-simple.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SIMPLE_H_ -#define _E_TABLE_SIMPLE_H_ - -#include <gal/e-table/e-table-model.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_TABLE_SIMPLE_TYPE (e_table_simple_get_type ()) -#define E_TABLE_SIMPLE(o) (GTK_CHECK_CAST ((o), E_TABLE_SIMPLE_TYPE, ETableSimple)) -#define E_TABLE_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SIMPLE_TYPE, ETableSimpleClass)) -#define E_IS_TABLE_SIMPLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_SIMPLE_TYPE)) -#define E_IS_TABLE_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SIMPLE_TYPE)) - -typedef int (*ETableSimpleColumnCountFn) (ETableModel *etm, void *data); -typedef int (*ETableSimpleRowCountFn) (ETableModel *etm, void *data); -typedef void *(*ETableSimpleValueAtFn) (ETableModel *etm, int col, int row, void *data); -typedef void (*ETableSimpleSetValueAtFn) (ETableModel *etm, int col, int row, const void *val, void *data); -typedef gboolean (*ETableSimpleIsCellEditableFn) (ETableModel *etm, int col, int row, void *data); -typedef void (*ETableSimpleAppendRowFn) (ETableModel *etm, ETableModel *model, int row, void *data); -typedef void *(*ETableSimpleDuplicateValueFn) (ETableModel *etm, int col, const void *val, void *data); -typedef void (*ETableSimpleFreeValueFn) (ETableModel *etm, int col, void *val, void *data); -typedef void *(*ETableSimpleInitializeValueFn) (ETableModel *etm, int col, void *data); -typedef gboolean (*ETableSimpleValueIsEmptyFn) (ETableModel *etm, int col, const void *val, void *data); -typedef char *(*ETableSimpleValueToStringFn) (ETableModel *etm, int col, const void *val, void *data); - -typedef struct { - ETableModel parent; - - ETableSimpleColumnCountFn col_count; - ETableSimpleRowCountFn row_count; - ETableSimpleValueAtFn value_at; - ETableSimpleSetValueAtFn set_value_at; - ETableSimpleIsCellEditableFn is_cell_editable; - ETableSimpleDuplicateValueFn duplicate_value; - ETableSimpleFreeValueFn free_value; - ETableSimpleInitializeValueFn initialize_value; - ETableSimpleValueIsEmptyFn value_is_empty; - ETableSimpleValueToStringFn value_to_string; - ETableSimpleAppendRowFn append_row; - void *data; -} ETableSimple; - -typedef struct { - ETableModelClass parent_class; -} ETableSimpleClass; - -GtkType e_table_simple_get_type (void); - -ETableModel *e_table_simple_new (ETableSimpleColumnCountFn col_count, - ETableSimpleRowCountFn row_count, - ETableSimpleValueAtFn value_at, - ETableSimpleSetValueAtFn set_value_at, - ETableSimpleIsCellEditableFn is_cell_editable, - ETableSimpleDuplicateValueFn duplicate_value, - ETableSimpleFreeValueFn free_value, - ETableSimpleInitializeValueFn initialize_value, - ETableSimpleValueIsEmptyFn value_is_empty, - ETableSimpleValueToStringFn value_to_string, - void *data); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TABLE_SIMPLE_H_ */ - diff --git a/widgets/table/e-table-size-test.c b/widgets/table/e-table-size-test.c deleted file mode 100644 index acb6e4296d..0000000000 --- a/widgets/table/e-table-size-test.c +++ /dev/null @@ -1,287 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* This code is GPL. */ -#include <stdio.h> -#include <string.h> -#include <gnome.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include "gal/e-util/e-cursors.h" -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-cell-text.h" -#include "e-cell-checkbox.h" -#include "e-table.h" - -#include "table-test.h" - -/* - * One way in which we make it simpler to build an ETableModel is through - * the ETableSimple class. Instead of creating your own ETableModel - * class, you simply create a new object of the ETableSimple class. You - * give it a bunch of functions that act as callbacks. - * - * You also get to pass a void * to ETableSimple and it gets passed to - * your callbacks. This would be for having multiple models of the same - * type. This is just an example though, so we statically define all the - * data and ignore the void *data parameter. - * - * In our example we will be creating a table model with 6 columns and 10 - * rows. This corresponds to having 6 different types of information and - * 10 different sets of data in our database. - * - * The headers will be hard coded, as will be the example data. - * - */ - -/* - * There are two different meanings to the word "column". The first is - * the model column. A model column corresponds to a specific type of - * data. This is very much like the usage in a database table where a - * column is a field in the database. - * - * The second type of column is a view column. A view column - * corresponds to a visually displayed column. Each view column - * corresponds to a specific model column, though a model column may - * have any number of view columns associated with it, from zero to - * greater than one. - * - * Also, a view column doesn't necessarily depend on only one model - * column. In some cases, the view column renderer can be given a - * reference to another column to get extra information about its - * display. -*/ - -#define ROWS 5000 -#define COLS 4 - -#define IMPORTANCE_COLUMN 4 -#define COLOR_COLUMN 5 - -/* - * Here we define the initial layout of the table. This is an xml - * format that allows you to change the initial ordering of the - * columns or to do sorting or grouping initially. This specification - * shows all 5 columns, but moves the importance column nearer to the - * front. It also sorts by the "Full Name" column (ascending.) - * Sorting and grouping take the model column as their arguments - * (sorting is specified by the "column" argument to the leaf elemnt. - */ - -#define INITIAL_SPEC "<ETableSpecification> \ - <columns-shown> \ - <column> 0 </column> \ - <column> 4 </column> \ - <column> 1 </column> \ - <column> 2 </column> \ - <column> 3 </column> \ - </columns-shown> \ - <grouping> <leaf column=\"1\" ascending=\"true\"/> </grouping> \ -</ETableSpecification>" - -char *headers [COLS] = { - "Email", - "Full Name", - "Address", - "Phone" -}; - -/* - * Virtual Column list: - * 0 Email - * 1 Full Name - * 2 Address - * 3 Phone - */ - -/* - * ETableSimple callbacks - * These are the callbacks that define the behavior of our custom model. - */ - -/* - * Since our model is a constant size, we can just return its size in - * the column and row count fields. - */ - -/* This function returns the number of columns in our ETableModel. */ -static int -my_col_count (ETableModel *etc, void *data) -{ - return COLS; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -my_row_count (ETableModel *etc, void *data) -{ - return ROWS; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -my_value_at (ETableModel *etc, int col, int row, void *data) -{ - static guchar t[] = {'A', 0xc3, 0x84, 0xc3, 0x95, 0xc3, 0x94, 0xc3, 0xb5, 0x00}; - -#if 0 - if (col == 1) return "toshok@ximian.com"; -#else - if (col == 1) return t; -#endif - else if (col == 2) return "Chris Toshok"; - else if (col == 3) return "43 Vicksburg, SF"; - else if (col == 4) return "415-867-5309"; - else return NULL; -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -my_set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) -{ -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -my_is_cell_editable (ETableModel *etc, int col, int row, void *data) -{ - return FALSE; -} - -/* This function duplicates the value passed to it. */ -static void * -my_duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - return g_strdup (value); -} - -/* This function frees the value passed to it. */ -static void -my_free_value (ETableModel *etc, int col, void *value, void *data) -{ - g_free (value); -} - -/* This function creates an empty value. */ -static void * -my_initialize_value (ETableModel *etc, int col, void *data) -{ - return g_strdup (""); -} - -/* This function reports if a value is empty. */ -static gboolean -my_value_is_empty (ETableModel *etc, int col, const void *value, void *data) -{ - return !(value && *(char *)value); -} - -/* This function reports if a value is empty. */ -static char * -my_value_to_string (ETableModel *etc, int col, const void *value, void *data) -{ - return g_strdup(value); -} - -/* We create a window containing our new table. */ -static void -create_table (void) -{ - GtkWidget *e_table, *window, *frame; - ECell *cell_left_just; - ETableHeader *e_table_header; - ETableModel *e_table_model = NULL; - int i; - - /* Next we create our model. This uses the functions we defined - earlier. */ - e_table_model = e_table_simple_new ( - my_col_count, my_row_count, my_value_at, - my_set_value_at, my_is_cell_editable, - my_duplicate_value, my_free_value, - my_initialize_value, my_value_is_empty, - my_value_to_string, - NULL); - /* - * Next we create a header. The ETableHeader is used in two - * different way. The first is the full_header. This is the - * list of possible columns in the view. The second use is - * completely internal. Many of the ETableHeader functions are - * for that purpose. The only functions we really need are - * e_table_header_new and e_table_header_add_col. - * - * First we create the header. - */ - e_table_header = e_table_header_new (); - - /* - * Next we have to build renderers for all of the columns. - * Since all our columns are text columns, we can simply use - * the same renderer over and over again. If we had different - * types of columns, we could use a different renderer for - * each column. - */ - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT); - - /* - * Next we create a column object for each view column and add - * them to the header. We don't create a column object for - * the importance column since it will not be shown. - */ - for (i = 0; i < COLS; i++) { - /* Create the column. */ - ETableCol *ecol = e_table_col_new ( - i, headers [i], - 1.0, 20, cell_left_just, - g_str_compare, TRUE); - /* Add it to the header. */ - e_table_header_add_column (e_table_header, ecol, i); - } - - /* - * Here we create a window for our new table. This window - * will get shown and the person will be able to test their - * item. - */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - /* This frame is simply to get a bevel around our table. */ - frame = gtk_frame_new (NULL); - - /* - * Here we create the table. We give it the three pieces of - * the table we've created, the header, the model, and the - * initial layout. It does the rest. - */ - e_table = e_table_new (e_table_header, e_table_model, INITIAL_SPEC); - - /* Build the gtk widget hierarchy. */ - gtk_container_add (GTK_CONTAINER (frame), e_table); - gtk_container_add (GTK_CONTAINER (window), frame); - - /* Size the initial window. */ - gtk_widget_set_usize (window, 300, 200); - - /* Show it all. */ - gtk_widget_show_all (window); -} - -/* This is the main function which just initializes gnome and call our create_table function */ - -int -main (int argc, char *argv []) -{ - gnome_init ("TableExample", "TableExample", argc, argv); - e_cursors_init (); - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - create_table (); - - gtk_main (); - - e_cursors_shutdown (); - return 0; -} - diff --git a/widgets/table/e-table-sort-info.c b/widgets/table/e-table-sort-info.c deleted file mode 100644 index c723ded8d8..0000000000 --- a/widgets/table/e-table-sort-info.c +++ /dev/null @@ -1,447 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-sort-info.c: a Table Model - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * Chris Lahey (clahey@ximian.com) - * - * (C) 1999, 2000, 2001 Ximian, Inc. - */ -#include <config.h> -#include <gtk/gtksignal.h> -#include "e-table-sort-info.h" -#include "gal/util/e-util.h" -#include "gal/util/e-xml-utils.h" - -#define ETM_CLASS(e) ((ETableSortInfoClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type () - - -static GtkObjectClass *e_table_sort_info_parent_class; - -enum { - SORT_INFO_CHANGED, - GROUP_INFO_CHANGED, - LAST_SIGNAL -}; - -static guint e_table_sort_info_signals [LAST_SIGNAL] = { 0, }; - -static void -etsi_destroy (GtkObject *object) -{ - ETableSortInfo *etsi; - - etsi = E_TABLE_SORT_INFO (object); - - if (etsi->groupings) - g_free(etsi->groupings); - if (etsi->sortings) - g_free(etsi->sortings); -} - -static void -e_table_sort_info_init (ETableSortInfo *info) -{ - info->group_count = 0; - info->groupings = NULL; - info->sort_count = 0; - info->sortings = NULL; - info->frozen = 0; - info->sort_info_changed = 0; - info->group_info_changed = 0; -} - -static void -e_table_sort_info_class_init (ETableSortInfoClass *klass) -{ - GtkObjectClass *object_class; - - e_table_sort_info_parent_class = gtk_type_class (gtk_object_get_type ()); - - object_class = GTK_OBJECT_CLASS(klass); - - object_class->destroy = etsi_destroy; - - e_table_sort_info_signals [SORT_INFO_CHANGED] = - gtk_signal_new ("sort_info_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableSortInfoClass, sort_info_changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_table_sort_info_signals [GROUP_INFO_CHANGED] = - gtk_signal_new ("group_info_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableSortInfoClass, group_info_changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - klass->sort_info_changed = NULL; - klass->group_info_changed = NULL; - - gtk_object_class_add_signals (object_class, e_table_sort_info_signals, LAST_SIGNAL); -} - -E_MAKE_TYPE(e_table_sort_info, "ETableSortInfo", ETableSortInfo, - e_table_sort_info_class_init, e_table_sort_info_init, PARENT_TYPE); - -static void -e_table_sort_info_sort_info_changed (ETableSortInfo *info) -{ - g_return_if_fail (info != NULL); - g_return_if_fail (E_IS_TABLE_SORT_INFO (info)); - - if (info->frozen) { - info->sort_info_changed = 1; - } else { - gtk_signal_emit (GTK_OBJECT (info), - e_table_sort_info_signals [SORT_INFO_CHANGED]); - } -} - -static void -e_table_sort_info_group_info_changed (ETableSortInfo *info) -{ - g_return_if_fail (info != NULL); - g_return_if_fail (E_IS_TABLE_SORT_INFO (info)); - - if (info->frozen) { - info->group_info_changed = 1; - } else { - gtk_signal_emit (GTK_OBJECT (info), - e_table_sort_info_signals [GROUP_INFO_CHANGED]); - } -} - -/** - * e_table_sort_info_freeze: - * @info: The ETableSortInfo object - * - * This functions allows the programmer to cluster various changes to the - * ETableSortInfo (grouping and sorting) without having the object emit - * "group_info_changed" or "sort_info_changed" signals on each change. - * - * To thaw, invoke the e_table_sort_info_thaw() function, which will - * trigger any signals that might have been queued. - */ -void -e_table_sort_info_freeze (ETableSortInfo *info) -{ - info->frozen++; -} - -/** - * e_table_sort_info_thaw: - * @info: The ETableSortInfo object - * - * This functions allows the programmer to cluster various changes to the - * ETableSortInfo (grouping and sorting) without having the object emit - * "group_info_changed" or "sort_info_changed" signals on each change. - * - * This function will flush any pending signals that might be emited by - * this object. - */ -void -e_table_sort_info_thaw (ETableSortInfo *info) -{ - info->frozen--; - if (info->frozen != 0) - return; - - if (info->sort_info_changed) { - info->sort_info_changed = 0; - e_table_sort_info_sort_info_changed(info); - } - if (info->group_info_changed) { - info->group_info_changed = 0; - e_table_sort_info_group_info_changed(info); - } -} - -/** - * e_table_sort_info_grouping_get_count: - * @info: The ETableSortInfo object - * - * Returns: the number of grouping criteria in the object. - */ -guint -e_table_sort_info_grouping_get_count (ETableSortInfo *info) -{ - return info->group_count; -} - -static void -e_table_sort_info_grouping_real_truncate (ETableSortInfo *info, int length) -{ - if (length < info->group_count) { - info->group_count = length; - } - if (length > info->group_count) { - info->groupings = g_realloc(info->groupings, length * sizeof(ETableSortColumn)); - info->group_count = length; - } -} - -/** - * e_table_sort_info_grouping_truncate: - * @info: The ETableSortInfo object - * @lenght: position where the truncation happens. - * - * This routine can be used to reduce or grow the number of grouping - * criteria in the object. - */ -void -e_table_sort_info_grouping_truncate (ETableSortInfo *info, int length) -{ - e_table_sort_info_grouping_real_truncate(info, length); - e_table_sort_info_group_info_changed(info); -} - -/** - * e_table_sort_info_grouping_get_nth: - * @info: The ETableSortInfo object - * @n: Item information to fetch. - * - * Returns: the description of the @n-th grouping criteria in the @info object. - */ -ETableSortColumn -e_table_sort_info_grouping_get_nth (ETableSortInfo *info, int n) -{ - if (n < info->group_count) { - return info->groupings[n]; - } else { - ETableSortColumn fake = {0, 0}; - return fake; - } -} - -/** - * e_table_sort_info_grouping_set_nth: - * @info: The ETableSortInfo object - * @n: Item information to fetch. - * @column: new values for the grouping - * - * Sets the grouping criteria for index @n to be given by @column (a column number and - * whether it is ascending or descending). - */ -void -e_table_sort_info_grouping_set_nth (ETableSortInfo *info, int n, ETableSortColumn column) -{ - if (n >= info->group_count) { - e_table_sort_info_grouping_real_truncate(info, n + 1); - } - info->groupings[n] = column; - e_table_sort_info_group_info_changed(info); -} - - -/** - * e_table_sort_info_get_count: - * @info: The ETableSortInfo object - * - * Returns: the number of sorting criteria in the object. - */ -guint -e_table_sort_info_sorting_get_count (ETableSortInfo *info) -{ - return info->sort_count; -} - -static void -e_table_sort_info_sorting_real_truncate (ETableSortInfo *info, int length) -{ - if (length < info->sort_count) { - info->sort_count = length; - } - if (length > info->sort_count) { - info->sortings = g_realloc(info->sortings, length * sizeof(ETableSortColumn)); - info->sort_count = length; - } -} - -/** - * e_table_sort_info_sorting_truncate: - * @info: The ETableSortInfo object - * @lenght: position where the truncation happens. - * - * This routine can be used to reduce or grow the number of sort - * criteria in the object. - */ -void -e_table_sort_info_sorting_truncate (ETableSortInfo *info, int length) -{ - e_table_sort_info_sorting_real_truncate (info, length); - e_table_sort_info_sort_info_changed(info); -} - -/** - * e_table_sort_info_sorting_get_nth: - * @info: The ETableSortInfo object - * @n: Item information to fetch. - * - * Returns: the description of the @n-th grouping criteria in the @info object. - */ -ETableSortColumn -e_table_sort_info_sorting_get_nth (ETableSortInfo *info, int n) -{ - if (n < info->sort_count) { - return info->sortings[n]; - } else { - ETableSortColumn fake = {0, 0}; - return fake; - } -} - -/** - * e_table_sort_info_sorting_get_nth: - * @info: The ETableSortInfo object - * @n: Item information to fetch. - * @column: new values for the sorting - * - * Sets the sorting criteria for index @n to be given by @column (a - * column number and whether it is ascending or descending). - */ -void -e_table_sort_info_sorting_set_nth (ETableSortInfo *info, int n, ETableSortColumn column) -{ - if (n >= info->sort_count) { - e_table_sort_info_sorting_real_truncate(info, n + 1); - } - info->sortings[n] = column; - e_table_sort_info_sort_info_changed(info); -} - -/** - * e_table_sort_info_new: - * - * This creates a new e_table_sort_info object that contains no - * grouping and no sorting defined as of yet. This object is used - * to keep track of multi-level sorting and multi-level grouping of - * the ETable. - * - * Returns: A new %ETableSortInfo object - */ -ETableSortInfo * -e_table_sort_info_new (void) -{ - return gtk_type_new (e_table_sort_info_get_type ()); -} - -/** - * e_table_sort_info_load_from_node: - * @info: The ETableSortInfo object - * @node: pointer to the xmlNode that describes the sorting and grouping information - * @state_version: - * - * This loads the state for the %ETableSortInfo object @info from the - * xml node @node. - */ -void -e_table_sort_info_load_from_node (ETableSortInfo *info, - xmlNode *node, - gdouble state_version) -{ - int i; - xmlNode *grouping; - - if (state_version <= 0.05) { - i = 0; - for (grouping = node->childs; grouping && !strcmp (grouping->name, "group"); grouping = grouping->childs) { - ETableSortColumn column; - column.column = e_xml_get_integer_prop_by_name (grouping, "column"); - column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending"); - e_table_sort_info_grouping_set_nth(info, i++, column); - } - i = 0; - for (; grouping && !strcmp (grouping->name, "leaf"); grouping = grouping->childs) { - ETableSortColumn column; - column.column = e_xml_get_integer_prop_by_name (grouping, "column"); - column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending"); - e_table_sort_info_sorting_set_nth(info, i++, column); - } - } else { - i = 0; - for (grouping = node->childs; grouping && !strcmp (grouping->name, "group"); grouping = grouping->next) { - ETableSortColumn column; - column.column = e_xml_get_integer_prop_by_name (grouping, "column"); - column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending"); - e_table_sort_info_grouping_set_nth(info, i++, column); - } - i = 0; - for (; grouping && !strcmp (grouping->name, "leaf"); grouping = grouping->next) { - ETableSortColumn column; - column.column = e_xml_get_integer_prop_by_name (grouping, "column"); - column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending"); - e_table_sort_info_sorting_set_nth(info, i++, column); - } - } - gtk_signal_emit (GTK_OBJECT (info), - e_table_sort_info_signals [SORT_INFO_CHANGED]); - -} - -/** - * e_table_sort_info_save_to_node: - * @info: The ETableSortInfo object - * @parent: xmlNode that will be hosting the saved state of the @info object. - * - * This function is used - * - * Returns: the node that has been appended to @parent as a child containing - * the sorting and grouping information for this ETableSortInfo object. - */ -xmlNode * -e_table_sort_info_save_to_node (ETableSortInfo *info, - xmlNode *parent) -{ - xmlNode *grouping; - xmlNode *node; - int i; - const int sort_count = e_table_sort_info_sorting_get_count (info); - const int group_count = e_table_sort_info_grouping_get_count (info); - - grouping = xmlNewChild (parent, NULL, "grouping", NULL); - - for (i = 0; i < group_count; i++) { - ETableSortColumn column = e_table_sort_info_grouping_get_nth(info, i); - xmlNode *new_node = xmlNewChild(grouping, NULL, "group", NULL); - - e_xml_set_integer_prop_by_name (new_node, "column", column.column); - e_xml_set_bool_prop_by_name (new_node, "ascending", column.ascending); - node = new_node; - } - - for (i = 0; i < sort_count; i++) { - ETableSortColumn column = e_table_sort_info_sorting_get_nth(info, i); - xmlNode *new_node = xmlNewChild(grouping, NULL, "leaf", NULL); - - e_xml_set_integer_prop_by_name (new_node, "column", column.column); - e_xml_set_bool_prop_by_name (new_node, "ascending", column.ascending); - node = new_node; - } - - return grouping; -} - -ETableSortInfo * -e_table_sort_info_duplicate (ETableSortInfo *info) -{ - ETableSortInfo *new_info; - - new_info = e_table_sort_info_new(); - - new_info->group_count = info->group_count; - new_info->groupings = g_new(ETableSortColumn, new_info->group_count); - memmove(new_info->groupings, info->groupings, sizeof (ETableSortColumn) * new_info->group_count); - - new_info->sort_count = info->sort_count; - new_info->sortings = g_new(ETableSortColumn, new_info->sort_count); - memmove(new_info->sortings, info->sortings, sizeof (ETableSortColumn) * new_info->sort_count); - - return new_info; -} diff --git a/widgets/table/e-table-sort-info.h b/widgets/table/e-table-sort-info.h deleted file mode 100644 index a2cd4f43a0..0000000000 --- a/widgets/table/e-table-sort-info.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SORT_INFO_H_ -#define _E_TABLE_SORT_INFO_H_ - -#include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_TABLE_SORT_INFO_TYPE (e_table_sort_info_get_type ()) -#define E_TABLE_SORT_INFO(o) (GTK_CHECK_CAST ((o), E_TABLE_SORT_INFO_TYPE, ETableSortInfo)) -#define E_TABLE_SORT_INFO_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SORT_INFO_TYPE, ETableSortInfoClass)) -#define E_IS_TABLE_SORT_INFO(o) (GTK_CHECK_TYPE ((o), E_TABLE_SORT_INFO_TYPE)) -#define E_IS_TABLE_SORT_INFO_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SORT_INFO_TYPE)) - -typedef struct _ETableSortColumn ETableSortColumn; - -struct _ETableSortColumn { - guint column : 31; - guint ascending : 1; -}; - -typedef struct { - GtkObject base; - - gint group_count; - ETableSortColumn *groupings; - gint sort_count; - ETableSortColumn *sortings; - - guint frozen : 1; - guint sort_info_changed : 1; - guint group_info_changed : 1; -} ETableSortInfo; - -typedef struct { - GtkObjectClass parent_class; - - /* - * Signals - */ - void (*sort_info_changed) (ETableSortInfo *info); - void (*group_info_changed) (ETableSortInfo *info); -} ETableSortInfoClass; - -GtkType e_table_sort_info_get_type (void); - -void e_table_sort_info_freeze (ETableSortInfo *info); -void e_table_sort_info_thaw (ETableSortInfo *info); - -guint e_table_sort_info_grouping_get_count (ETableSortInfo *info); -void e_table_sort_info_grouping_truncate (ETableSortInfo *info, - int length); -ETableSortColumn e_table_sort_info_grouping_get_nth (ETableSortInfo *info, - int n); -void e_table_sort_info_grouping_set_nth (ETableSortInfo *info, - int n, - ETableSortColumn column); - -guint e_table_sort_info_sorting_get_count (ETableSortInfo *info); -void e_table_sort_info_sorting_truncate (ETableSortInfo *info, - int length); -ETableSortColumn e_table_sort_info_sorting_get_nth (ETableSortInfo *info, - int n); -void e_table_sort_info_sorting_set_nth (ETableSortInfo *info, - int n, - ETableSortColumn column); - -ETableSortInfo *e_table_sort_info_new (void); -void e_table_sort_info_load_from_node (ETableSortInfo *info, - xmlNode *node, - gdouble state_version); -xmlNode *e_table_sort_info_save_to_node (ETableSortInfo *info, - xmlNode *parent); -ETableSortInfo *e_table_sort_info_duplicate (ETableSortInfo *info); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TABLE_SORT_INFO_H_ */ diff --git a/widgets/table/e-table-sorted-variable.c b/widgets/table/e-table-sorted-variable.c deleted file mode 100644 index 665d5fd1d7..0000000000 --- a/widgets/table/e-table-sorted-variable.c +++ /dev/null @@ -1,210 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-sorted.c: Implements a table that sorts another table - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Ximian, Inc. - */ -#include <config.h> -#include <stdlib.h> -#include <gtk/gtksignal.h> -#include <string.h> -#include "gal/util/e-util.h" -#include "e-table-sorted-variable.h" -#include "e-table-sorting-utils.h" - -#define d(x) - -#define PARENT_TYPE E_TABLE_SUBSET_VARIABLE_TYPE - -#define INCREMENT_AMOUNT 100 - -/* maximum insertions between an idle event that we will do without scheduling an idle sort */ -#define ETSV_INSERT_MAX (4) - -static ETableSubsetVariableClass *etsv_parent_class; - -static void etsv_sort_info_changed (ETableSortInfo *info, ETableSortedVariable *etsv); -static void etsv_sort (ETableSortedVariable *etsv); -static void etsv_add (ETableSubsetVariable *etssv, gint row); -static void etsv_add_all (ETableSubsetVariable *etssv); - -static void -etsv_destroy (GtkObject *object) -{ - ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (object); - - gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info), - etsv->sort_info_changed_id); - - if (etsv->sort_idle_id) { - g_source_remove(etsv->sort_idle_id); - } - if (etsv->insert_idle_id) { - g_source_remove(etsv->insert_idle_id); - } - - if (etsv->sort_info) - gtk_object_unref(GTK_OBJECT(etsv->sort_info)); - if (etsv->full_header) - gtk_object_unref(GTK_OBJECT(etsv->full_header)); - - GTK_OBJECT_CLASS (etsv_parent_class)->destroy (object); -} - -static void -etsv_class_init (GtkObjectClass *object_class) -{ - ETableSubsetVariableClass *etssv_class = E_TABLE_SUBSET_VARIABLE_CLASS(object_class); - - etsv_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = etsv_destroy; - - etssv_class->add = etsv_add; - etssv_class->add_all = etsv_add_all; -} - -static void -etsv_init (ETableSortedVariable *etsv) -{ - etsv->full_header = NULL; - etsv->sort_info = NULL; - - etsv->sort_info_changed_id = 0; - - etsv->sort_idle_id = 0; - etsv->insert_count = 0; -} - -E_MAKE_TYPE(e_table_sorted_variable, "ETableSortedVariable", ETableSortedVariable, etsv_class_init, etsv_init, PARENT_TYPE); - -static gboolean -etsv_sort_idle(ETableSortedVariable *etsv) -{ - gtk_object_ref(GTK_OBJECT(etsv)); - etsv_sort(etsv); - etsv->sort_idle_id = 0; - etsv->insert_count = 0; - gtk_object_unref(GTK_OBJECT(etsv)); - return FALSE; -} - -static gboolean -etsv_insert_idle(ETableSortedVariable *etsv) -{ - etsv->insert_count = 0; - etsv->insert_idle_id = 0; - return FALSE; -} - - -static void -etsv_add (ETableSubsetVariable *etssv, - gint row) -{ - ETableModel *etm = E_TABLE_MODEL(etssv); - ETableSubset *etss = E_TABLE_SUBSET(etssv); - ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (etssv); - int i; - - if (etss->n_map + 1 > etssv->n_vals_allocated) { - etssv->n_vals_allocated += INCREMENT_AMOUNT; - etss->map_table = g_realloc (etss->map_table, (etssv->n_vals_allocated) * sizeof(int)); - } - i = etss->n_map; - if (etsv->sort_idle_id == 0) { - /* this is to see if we're inserting a lot of things between idle loops. - If we are, we're busy, its faster to just append and perform a full sort later */ - etsv->insert_count++; - if (etsv->insert_count > ETSV_INSERT_MAX) { - /* schedule a sort, and append instead */ - etsv->sort_idle_id = g_idle_add_full(50, (GSourceFunc) etsv_sort_idle, etsv, NULL); - } else { - /* make sure we have an idle handler to reset the count every now and then */ - if (etsv->insert_idle_id == 0) { - etsv->insert_idle_id = g_idle_add_full(40, (GSourceFunc) etsv_insert_idle, etsv, NULL); - } - i = e_table_sorting_utils_insert(etss->source, etsv->sort_info, etsv->full_header, etss->map_table, etss->n_map, row); - memmove(etss->map_table + i + 1, etss->map_table + i, (etss->n_map - i) * sizeof(int)); - } - } - etss->map_table[i] = row; - etss->n_map++; - - e_table_model_row_inserted (etm, i); -} - -static void -etsv_add_all (ETableSubsetVariable *etssv) -{ - ETableModel *etm = E_TABLE_MODEL(etssv); - ETableSubset *etss = E_TABLE_SUBSET(etssv); - ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (etssv); - int rows; - int i; - - e_table_model_pre_change(etm); - - rows = e_table_model_row_count(etss->source); - - if (etss->n_map + rows > etssv->n_vals_allocated){ - etssv->n_vals_allocated += MAX(INCREMENT_AMOUNT, rows); - etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int)); - } - for (i = 0; i < rows; i++) - etss->map_table[etss->n_map++] = i; - - if (etsv->sort_idle_id == 0) { - etsv->sort_idle_id = g_idle_add_full(50, (GSourceFunc) etsv_sort_idle, etsv, NULL); - } - - e_table_model_changed (etm); -} - -ETableModel * -e_table_sorted_variable_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info) -{ - ETableSortedVariable *etsv = gtk_type_new (E_TABLE_SORTED_VARIABLE_TYPE); - ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE (etsv); - - if (e_table_subset_variable_construct (etssv, source) == NULL){ - gtk_object_unref (GTK_OBJECT (etsv)); - return NULL; - } - - etsv->sort_info = sort_info; - gtk_object_ref(GTK_OBJECT(etsv->sort_info)); - etsv->full_header = full_header; - gtk_object_ref(GTK_OBJECT(etsv->full_header)); - - etsv->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed", - GTK_SIGNAL_FUNC (etsv_sort_info_changed), etsv); - - return E_TABLE_MODEL(etsv); -} - -static void -etsv_sort_info_changed (ETableSortInfo *info, ETableSortedVariable *etsv) -{ - etsv_sort(etsv); -} - -static void -etsv_sort(ETableSortedVariable *etsv) -{ - ETableSubset *etss = E_TABLE_SUBSET(etsv); - static int reentering = 0; - if (reentering) - return; - reentering = 1; - - e_table_model_pre_change(E_TABLE_MODEL(etsv)); - - e_table_sorting_utils_sort(etss->source, etsv->sort_info, etsv->full_header, etss->map_table, etss->n_map); - - e_table_model_changed (E_TABLE_MODEL(etsv)); - reentering = 0; -} diff --git a/widgets/table/e-table-sorted-variable.h b/widgets/table/e-table-sorted-variable.h deleted file mode 100644 index d326e26df8..0000000000 --- a/widgets/table/e-table-sorted-variable.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SORTED_VARIABLE_H_ -#define _E_TABLE_SORTED_VARIABLE_H_ - -#include <gtk/gtkobject.h> -#include <gal/e-table/e-table-model.h> -#include <gal/e-table/e-table-subset-variable.h> -#include <gal/e-table/e-table-sort-info.h> -#include <gal/e-table/e-table-header.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_TABLE_SORTED_VARIABLE_TYPE (e_table_sorted_variable_get_type ()) -#define E_TABLE_SORTED_VARIABLE(o) (GTK_CHECK_CAST ((o), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariable)) -#define E_TABLE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariableClass)) -#define E_IS_TABLE_SORTED_VARIABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_SORTED_VARIABLE_TYPE)) -#define E_IS_TABLE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SORTED_VARIABLE_TYPE)) - -typedef struct { - ETableSubsetVariable base; - - ETableSortInfo *sort_info; - - ETableHeader *full_header; - - int sort_info_changed_id; - int sort_idle_id; - int insert_idle_id; - int insert_count; - -} ETableSortedVariable; - -typedef struct { - ETableSubsetVariableClass parent_class; -} ETableSortedVariableClass; - -GtkType e_table_sorted_variable_get_type (void); -ETableModel *e_table_sorted_variable_new (ETableModel *etm, ETableHeader *header, ETableSortInfo *sort_info); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TABLE_SORTED_VARIABLE_H_ */ diff --git a/widgets/table/e-table-sorted.c b/widgets/table/e-table-sorted.c deleted file mode 100644 index a876ed385c..0000000000 --- a/widgets/table/e-table-sorted.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-sorted.c: Implements a table that sorts another table - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Ximian, Inc. - */ -#include <config.h> -#include <stdlib.h> -#include <gtk/gtksignal.h> -#include <string.h> -#include "gal/util/e-util.h" -#include "e-table-sorted.h" -#include "e-table-sorting-utils.h" - -#define d(x) - -#define PARENT_TYPE E_TABLE_SUBSET_TYPE - -#define INCREMENT_AMOUNT 100 - -/* maximum insertions between an idle event that we will do without scheduling an idle sort */ -#define ETS_INSERT_MAX (4) - -static ETableSubsetClass *ets_parent_class; - -static void ets_sort_info_changed (ETableSortInfo *info, ETableSorted *ets); -static void ets_sort (ETableSorted *ets); -static void ets_proxy_model_changed (ETableSubset *etss, ETableModel *source); -static void ets_proxy_model_row_changed (ETableSubset *etss, ETableModel *source, int row); -static void ets_proxy_model_cell_changed (ETableSubset *etss, ETableModel *source, int col, int row); -static void ets_proxy_model_row_inserted (ETableSubset *etss, ETableModel *source, int row); -static void ets_proxy_model_row_deleted (ETableSubset *etss, ETableModel *source, int row); - -static void -ets_destroy (GtkObject *object) -{ - ETableSorted *ets = E_TABLE_SORTED (object); - - if (ets->sort_idle_id) { - g_source_remove(ets->sort_idle_id); - } - if (ets->insert_idle_id) { - g_source_remove(ets->insert_idle_id); - } - - if (ets->sort_info) { - gtk_signal_disconnect (GTK_OBJECT (ets->sort_info), - ets->sort_info_changed_id); - gtk_object_unref(GTK_OBJECT(ets->sort_info)); - } - - if (ets->full_header) - gtk_object_unref(GTK_OBJECT(ets->full_header)); - - GTK_OBJECT_CLASS (ets_parent_class)->destroy (object); -} - -static void -ets_class_init (GtkObjectClass *object_class) -{ - ETableSubsetClass *etss_class = E_TABLE_SUBSET_CLASS(object_class); - - ets_parent_class = gtk_type_class (PARENT_TYPE); - - etss_class->proxy_model_changed = ets_proxy_model_changed; - etss_class->proxy_model_row_changed = ets_proxy_model_row_changed; - etss_class->proxy_model_cell_changed = ets_proxy_model_cell_changed; - etss_class->proxy_model_row_inserted = ets_proxy_model_row_inserted; - etss_class->proxy_model_row_deleted = ets_proxy_model_row_deleted; - - object_class->destroy = ets_destroy; -} - -static void -ets_init (ETableSorted *ets) -{ - ets->full_header = NULL; - ets->sort_info = NULL; - - ets->sort_info_changed_id = 0; - - ets->sort_idle_id = 0; - ets->insert_count = 0; -} - -E_MAKE_TYPE(e_table_sorted, "ETableSorted", ETableSorted, ets_class_init, ets_init, PARENT_TYPE); - -static gboolean -ets_sort_idle(ETableSorted *ets) -{ - gtk_object_ref(GTK_OBJECT(ets)); - ets_sort(ets); - ets->sort_idle_id = 0; - ets->insert_count = 0; - gtk_object_unref(GTK_OBJECT(ets)); - return FALSE; -} - -static gboolean -ets_insert_idle(ETableSorted *ets) -{ - ets->insert_count = 0; - ets->insert_idle_id = 0; - return FALSE; -} - -ETableModel * -e_table_sorted_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info) -{ - ETableSorted *ets = gtk_type_new (E_TABLE_SORTED_TYPE); - ETableSubset *etss = E_TABLE_SUBSET (ets); - - if (e_table_subset_construct (etss, source, 0) == NULL){ - gtk_object_unref (GTK_OBJECT (ets)); - return NULL; - } - - ets->sort_info = sort_info; - gtk_object_ref(GTK_OBJECT(ets->sort_info)); - ets->full_header = full_header; - gtk_object_ref(GTK_OBJECT(ets->full_header)); - - ets_proxy_model_changed(etss, source); - - ets->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed", - GTK_SIGNAL_FUNC (ets_sort_info_changed), ets); - - return E_TABLE_MODEL(ets); -} - -static void -ets_sort_info_changed (ETableSortInfo *info, ETableSorted *ets) -{ - ets_sort(ets); -} - -static void -ets_proxy_model_changed (ETableSubset *subset, ETableModel *source) -{ - int rows, i; - - rows = e_table_model_row_count(source); - - g_free(subset->map_table); - subset->n_map = rows; - subset->map_table = g_new(int, rows); - - for (i = 0; i < rows; i++) { - subset->map_table[i] = i; - } - - if (!E_TABLE_SORTED(subset)->sort_idle_id) - E_TABLE_SORTED(subset)->sort_idle_id = g_idle_add_full(50, (GSourceFunc) ets_sort_idle, subset, NULL); - - e_table_model_changed(E_TABLE_MODEL(subset)); -} - -static void -ets_proxy_model_row_changed (ETableSubset *subset, ETableModel *source, int row) -{ - if (!E_TABLE_SORTED(subset)->sort_idle_id) - E_TABLE_SORTED(subset)->sort_idle_id = g_idle_add_full(50, (GSourceFunc) ets_sort_idle, subset, NULL); - - if (ets_parent_class->proxy_model_row_changed) - (ets_parent_class->proxy_model_row_changed) (subset, source, row); -} - -static void -ets_proxy_model_cell_changed (ETableSubset *subset, ETableModel *source, int col, int row) -{ - ETableSorted *ets = E_TABLE_SORTED(subset); - if (e_table_sorting_utils_affects_sort(source, ets->sort_info, ets->full_header, col)) - ets_proxy_model_row_changed(subset, source, row); - else if (ets_parent_class->proxy_model_cell_changed) - (ets_parent_class->proxy_model_cell_changed) (subset, source, col, row); -} - -static void -ets_proxy_model_row_inserted (ETableSubset *etss, ETableModel *source, int row) -{ - ETableModel *etm = E_TABLE_MODEL(etss); - ETableSorted *ets = E_TABLE_SORTED(etss); - int i; - - e_table_model_pre_change (etm); - - for (i = 0; i < etss->n_map; i++) { - if (etss->map_table[i] >= row) - etss->map_table[i] ++; - } - - etss->map_table = g_realloc (etss->map_table, (etss->n_map + 1) * sizeof(int)); - - i = etss->n_map; - if (ets->sort_idle_id == 0) { - /* this is to see if we're inserting a lot of things between idle loops. - If we are, we're busy, its faster to just append and perform a full sort later */ - ets->insert_count++; - if (ets->insert_count > ETS_INSERT_MAX) { - /* schedule a sort, and append instead */ - ets->sort_idle_id = g_idle_add_full(50, (GSourceFunc) ets_sort_idle, ets, NULL); - } else { - /* make sure we have an idle handler to reset the count every now and then */ - if (ets->insert_idle_id == 0) { - ets->insert_idle_id = g_idle_add_full(40, (GSourceFunc) ets_insert_idle, ets, NULL); - } - i = e_table_sorting_utils_insert(etss->source, ets->sort_info, ets->full_header, etss->map_table, etss->n_map, row); - memmove(etss->map_table + i + 1, etss->map_table + i, (etss->n_map - i) * sizeof(int)); - } - } - etss->map_table[i] = row; - etss->n_map++; - - e_table_model_row_inserted (etm, i); - d(g_print("inserted row %d", row)); - d(e_table_subset_print_debugging(etss)); -} - -static void -ets_proxy_model_row_deleted (ETableSubset *etss, ETableModel *source, int row) -{ - ETableModel *etm = E_TABLE_MODEL(etss); - int i; - gboolean shift; - - shift = row == etss->n_map - 1; - - for (i = 0; i < etss->n_map; i++){ - if (etss->map_table[i] == row) { - e_table_model_pre_change (etm); - memmove (etss->map_table + i, etss->map_table + i + 1, (etss->n_map - i - 1) * sizeof(int)); - etss->n_map --; - if (shift) - e_table_model_row_deleted (etm, i); - } - } - if (!shift) { - for (i = 0; i < etss->n_map; i++) { - if (etss->map_table[i] >= row) - etss->map_table[i] --; - } - - e_table_model_changed (etm); - } - - d(g_print("deleted row %d", row)); - d(e_table_subset_print_debugging(etss)); -} - -static void -ets_sort(ETableSorted *ets) -{ - ETableSubset *etss = E_TABLE_SUBSET(ets); - static int reentering = 0; - if (reentering) - return; - reentering = 1; - - e_table_model_pre_change(E_TABLE_MODEL(ets)); - - e_table_sorting_utils_sort(etss->source, ets->sort_info, ets->full_header, etss->map_table, etss->n_map); - - e_table_model_changed (E_TABLE_MODEL(ets)); - reentering = 0; -} diff --git a/widgets/table/e-table-sorted.h b/widgets/table/e-table-sorted.h deleted file mode 100644 index a138cdeb04..0000000000 --- a/widgets/table/e-table-sorted.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SORTED_H_ -#define _E_TABLE_SORTED_H_ - -#include <gtk/gtkobject.h> -#include <gal/e-table/e-table-model.h> -#include <gal/e-table/e-table-subset.h> -#include <gal/e-table/e-table-sort-info.h> -#include <gal/e-table/e-table-header.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_TABLE_SORTED_TYPE (e_table_sorted_get_type ()) -#define E_TABLE_SORTED(o) (GTK_CHECK_CAST ((o), E_TABLE_SORTED_TYPE, ETableSorted)) -#define E_TABLE_SORTED_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SORTED_TYPE, ETableSortedClass)) -#define E_IS_TABLE_SORTED(o) (GTK_CHECK_TYPE ((o), E_TABLE_SORTED_TYPE)) -#define E_IS_TABLE_SORTED_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SORTED_TYPE)) - -typedef struct { - ETableSubset base; - - ETableSortInfo *sort_info; - - ETableHeader *full_header; - - int sort_info_changed_id; - int sort_idle_id; - int insert_idle_id; - int insert_count; - -} ETableSorted; - -typedef struct { - ETableSubsetClass parent_class; -} ETableSortedClass; - -GtkType e_table_sorted_get_type (void); -ETableModel *e_table_sorted_new (ETableModel *etm, ETableHeader *header, ETableSortInfo *sort_info); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TABLE_SORTED_H_ */ diff --git a/widgets/table/e-table-sorter.c b/widgets/table/e-table-sorter.c deleted file mode 100644 index 2dbbddf366..0000000000 --- a/widgets/table/e-table-sorter.c +++ /dev/null @@ -1,571 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-sorted.c: Implements a table that sorts another table - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Ximian, Inc. - */ -#include <config.h> -#include <stdlib.h> -#include <gtk/gtksignal.h> -#include <string.h> -#include "gal/util/e-util.h" -#include "e-table-sorter.h" - -#define d(x) - -/* The arguments we take */ -enum { - ARG_0, - ARG_SORT_INFO -}; - -#define PARENT_TYPE e_sorter_get_type() - -#define INCREMENT_AMOUNT 100 - -static ESorterClass *parent_class; - -static void ets_model_changed (ETableModel *etm, ETableSorter *ets); -static void ets_model_row_changed (ETableModel *etm, int row, ETableSorter *ets); -static void ets_model_cell_changed (ETableModel *etm, int col, int row, ETableSorter *ets); -static void ets_sort_info_changed (ETableSortInfo *info, ETableSorter *ets); -static void ets_clean (ETableSorter *ets); -static void ets_sort (ETableSorter *ets); -static void ets_backsort (ETableSorter *ets); - -static gint ets_model_to_sorted (ESorter *sorter, int row); -static gint ets_sorted_to_model (ESorter *sorter, int row); -static void ets_get_model_to_sorted_array (ESorter *sorter, int **array, int *count); -static void ets_get_sorted_to_model_array (ESorter *sorter, int **array, int *count); -static gboolean ets_needs_sorting (ESorter *ets); - -static void -ets_destroy (GtkObject *object) -{ - ETableSorter *ets = E_TABLE_SORTER (object); - - gtk_signal_disconnect (GTK_OBJECT (ets->source), - ets->table_model_changed_id); - gtk_signal_disconnect (GTK_OBJECT (ets->source), - ets->table_model_row_changed_id); - gtk_signal_disconnect (GTK_OBJECT (ets->source), - ets->table_model_cell_changed_id); - gtk_signal_disconnect (GTK_OBJECT (ets->sort_info), - ets->sort_info_changed_id); - - ets->table_model_changed_id = 0; - ets->table_model_row_changed_id = 0; - ets->table_model_cell_changed_id = 0; - ets->sort_info_changed_id = 0; - - if (ets->sort_info) - gtk_object_unref(GTK_OBJECT(ets->sort_info)); - if (ets->full_header) - gtk_object_unref(GTK_OBJECT(ets->full_header)); - if (ets->source) - gtk_object_unref(GTK_OBJECT(ets->source)); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -ets_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableSorter *ets = E_TABLE_SORTER (object); - - switch (arg_id) { - case ARG_SORT_INFO: - if (ets->sort_info) { - if (ets->sort_info_changed_id) - gtk_signal_disconnect(GTK_OBJECT(ets->sort_info), ets->sort_info_changed_id); - gtk_object_unref(GTK_OBJECT(ets->sort_info)); - } - - ets->sort_info = E_TABLE_SORT_INFO(GTK_VALUE_OBJECT (*arg)); - gtk_object_ref(GTK_OBJECT(ets->sort_info)); - ets->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (ets->sort_info), "sort_info_changed", - GTK_SIGNAL_FUNC (ets_sort_info_changed), ets); - - ets_clean (ets); - break; - default: - break; - } -} - -static void -ets_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableSorter *ets = E_TABLE_SORTER (object); - switch (arg_id) { - case ARG_SORT_INFO: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(ets->sort_info); - break; - } -} - -static void -ets_class_init (ETableSorterClass *klass) -{ - GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass); - ESorterClass *sorter_class = E_SORTER_CLASS(klass); - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = ets_destroy; - object_class->set_arg = ets_set_arg; - object_class->get_arg = ets_get_arg; - - sorter_class->model_to_sorted = ets_model_to_sorted ; - sorter_class->sorted_to_model = ets_sorted_to_model ; - sorter_class->get_model_to_sorted_array = ets_get_model_to_sorted_array ; - sorter_class->get_sorted_to_model_array = ets_get_sorted_to_model_array ; - sorter_class->needs_sorting = ets_needs_sorting ; - - gtk_object_add_arg_type ("ETableSorter::sort_info", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_SORT_INFO); -} - -static void -ets_init (ETableSorter *ets) -{ - ets->full_header = NULL; - ets->sort_info = NULL; - ets->source = NULL; - - ets->needs_sorting = -1; - - ets->table_model_changed_id = 0; - ets->table_model_row_changed_id = 0; - ets->table_model_cell_changed_id = 0; - ets->sort_info_changed_id = 0; -} - -E_MAKE_TYPE(e_table_sorter, "ETableSorter", ETableSorter, ets_class_init, ets_init, PARENT_TYPE); - -ETableSorter * -e_table_sorter_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info) -{ - ETableSorter *ets = gtk_type_new (E_TABLE_SORTER_TYPE); - - ets->sort_info = sort_info; - gtk_object_ref(GTK_OBJECT(ets->sort_info)); - ets->full_header = full_header; - gtk_object_ref(GTK_OBJECT(ets->full_header)); - ets->source = source; - gtk_object_ref(GTK_OBJECT(ets->source)); - - ets->table_model_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_changed", - GTK_SIGNAL_FUNC (ets_model_changed), ets); - ets->table_model_row_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_row_changed", - GTK_SIGNAL_FUNC (ets_model_row_changed), ets); - ets->table_model_cell_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_cell_changed", - GTK_SIGNAL_FUNC (ets_model_cell_changed), ets); - ets->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed", - GTK_SIGNAL_FUNC (ets_sort_info_changed), ets); - - return ets; -} - -static void -ets_model_changed (ETableModel *etm, ETableSorter *ets) -{ - ets_clean(ets); -} - -static void -ets_model_row_changed (ETableModel *etm, int row, ETableSorter *ets) -{ - ets_clean(ets); -} - -static void -ets_model_cell_changed (ETableModel *etm, int col, int row, ETableSorter *ets) -{ - ets_clean(ets); -} - -static void -ets_sort_info_changed (ETableSortInfo *info, ETableSorter *ets) -{ - printf ("sort info changed\n"); - ets_clean(ets); -} - -static ETableSorter *ets_closure; -static void **vals_closure; -static int cols_closure; -static int *ascending_closure; -static GCompareFunc *compare_closure; - -/* FIXME: Make it not cache the second and later columns (as if anyone cares.) */ - -static int -qsort_callback(const void *data1, const void *data2) -{ - gint row1 = *(int *)data1; - gint row2 = *(int *)data2; - int j; - int sort_count = e_table_sort_info_sorting_get_count(ets_closure->sort_info) + e_table_sort_info_grouping_get_count(ets_closure->sort_info); - int comp_val = 0; - int ascending = 1; - for (j = 0; j < sort_count; j++) { - comp_val = (*(compare_closure[j]))(vals_closure[cols_closure * row1 + j], vals_closure[cols_closure * row2 + j]); - ascending = ascending_closure[j]; - if (comp_val != 0) - break; - } - if (comp_val == 0) { - if (row1 < row2) - comp_val = -1; - if (row1 > row2) - comp_val = 1; - } - if (!ascending) - comp_val = -comp_val; - return comp_val; -} - -static void -ets_clean(ETableSorter *ets) -{ - g_free(ets->sorted); - ets->sorted = NULL; - - g_free(ets->backsorted); - ets->backsorted = NULL; - - ets->needs_sorting = -1; -} - -struct _group_info { - char *group; - int row; -}; - -struct _rowinfo { - int row; - struct _subinfo *subinfo; - struct _group_info *groupinfo; -}; - -struct _subinfo { - int start; - GArray *rowsort; /* an array of row info's */ -}; - -/* builds the info needed to sort everything */ -static struct _subinfo * -ets_sort_build_subset(ETableSorter *ets, struct _group_info *groupinfo, int start, int *end) -{ - int rows = e_table_model_row_count (ets->source); - int i, lastinsert; - GArray *rowsort = g_array_new(0, 0, sizeof(struct _rowinfo)); - struct _subinfo *subinfo, *newsub; - char *id, *newid; - int idlen, newidlen; - int cmp; - int cmplen; - - subinfo = g_malloc0(sizeof(*subinfo)); - subinfo->rowsort = rowsort; - subinfo->start = start; - lastinsert = -1; - id = groupinfo[start].group; - newid = strrchr(id, '/'); - idlen = strlen(id); - if (newid) - cmplen = newid-id; - else - cmplen = idlen; - d(printf("%d scanning level %s\n", start, id)); - for (i=start;i<rows;i++) { - newid = groupinfo[i].group; - newidlen = strlen(newid); - d(printf("%d checking group %s\n", start, newid)); - cmp = strncmp(id, newid, cmplen); - /* check for common parent */ - if (idlen == newidlen && cmp == 0) { - struct _rowinfo rowinfo; - - d(printf("%d Same parent\n", start)); - rowinfo.row = groupinfo[i].row; - rowinfo.subinfo = NULL; - rowinfo.groupinfo = &groupinfo[i]; - lastinsert = rowsort->len; - g_array_append_val(rowsort, rowinfo); -#ifdef DEBUG - total++; -#endif - } else if (newidlen > idlen) { - /* must be a new subtree */ - d(printf("%d checking subtree instead\n", start)); - newsub = ets_sort_build_subset(ets, groupinfo, i, &i); - d(printf("found %d nodes in subtree\n", newsub->rowsort->len)); - g_array_index(rowsort, struct _rowinfo, lastinsert).subinfo = newsub; - } else { - i--; - break; - } - } - if (end) - *end = i; - d(printf("finished level %s start was %d end was %d\n", id, start, i)); - return subinfo; -} - -/* sort each level, and then sort each level below that level (once we know - where the sublevel will fit in the overall list) */ -static int -ets_sort_subset(ETableSorter *ets, struct _subinfo *subinfo, int startoffset) -{ - GArray *rowsort = subinfo->rowsort; - int offset, i; - - d(printf("sorting subset start %d rows %d\n", startoffset, rowsort->len)); - - /* first, sort the actual data */ - qsort(rowsort->data, rowsort->len, sizeof(struct _rowinfo), qsort_callback); - - /* then put it back in the map table, where appropriate */ - offset = startoffset; - for (i=0;i<rowsort->len;i++) { - struct _rowinfo *rowinfo; - - d(printf("setting offset %d\n", offset)); - - rowinfo = &g_array_index(rowsort, struct _rowinfo, i); - ets->sorted[offset] = rowinfo->row; - if (rowinfo->subinfo) { - offset = ets_sort_subset(ets, rowinfo->subinfo, offset+1); - } else - offset += 1; - } - d(printf("end sort subset start %d\n", startoffset)); - - return offset; -} - -static void -ets_sort_free_subset(ETableSorter *ets, struct _subinfo *subinfo) -{ - int i; - - for (i=0;i<subinfo->rowsort->len;i++) { - struct _rowinfo *rowinfo; - - rowinfo = &g_array_index(subinfo->rowsort, struct _rowinfo, i); - if (rowinfo->subinfo) - ets_sort_free_subset(ets, rowinfo->subinfo); - } - g_array_free(subinfo->rowsort, TRUE); - g_free(subinfo); -} - -static int -sort_groups_compare(const void *ap, const void *bp) -{ - struct _group_info *a = (struct _group_info *)ap; - struct _group_info *b = (struct _group_info *)bp; - - return strcmp(a->group, b->group); -} - -/* use the sort group to select subsorts */ -static void -ets_sort_by_group (ETableSorter *ets) -{ - int rows = e_table_model_row_count (ets->source); - struct _group_info *groups; - struct _subinfo *subinfo; - int i; - - d(printf("sorting %d rows\n", rows)); - - if (rows == 0) - return; - - /* get all the rows' sort groups */ - groups = g_new(struct _group_info, rows); - for (i=0;i<rows;i++) { - groups[i].row = i; - groups[i].group = g_strdup(e_table_model_row_sort_group(ets->source, groups[i].row)); - } - - /* sort the group info */ - qsort(groups, rows, sizeof(struct _group_info), sort_groups_compare); - - d(printf("sorted groups:\n"); - for (i=0;i<rows;i++) { - printf(" %s\n", groups[i].group); - }); - - /* now sort based on the group info */ - subinfo = ets_sort_build_subset(ets, groups, 0, NULL); - for (i=0;i<rows;i++) { - g_free(groups[i].group); - } - g_free(groups); - ets_sort_subset(ets, subinfo, 0); - ets_sort_free_subset(ets, subinfo); -} - -static void -ets_sort(ETableSorter *ets) -{ - int rows; - int i; - int j; - int cols; - int group_cols; - - if (ets->sorted) - return; - - rows = e_table_model_row_count(ets->source); - group_cols = e_table_sort_info_grouping_get_count(ets->sort_info); - cols = e_table_sort_info_sorting_get_count(ets->sort_info) + group_cols; - - ets->sorted = g_new(int, rows); - for (i = 0; i < rows; i++) - ets->sorted[i] = i; - - cols_closure = cols; - ets_closure = ets; - - vals_closure = g_new(void *, rows * cols); - ascending_closure = g_new(int, cols); - compare_closure = g_new(GCompareFunc, cols); - - for (j = 0; j < cols; j++) { - ETableSortColumn column; - ETableCol *col; - - if (j < group_cols) - column = e_table_sort_info_grouping_get_nth(ets->sort_info, j); - else - column = e_table_sort_info_sorting_get_nth(ets->sort_info, j - group_cols); - - col = e_table_header_get_column_by_col_idx(ets->full_header, column.column); - if (col == NULL) - col = e_table_header_get_column (ets->full_header, e_table_header_count (ets->full_header) - 1); - - for (i = 0; i < rows; i++) { - vals_closure[i * cols + j] = e_table_model_value_at (ets->source, col->col_idx, i); - } - - compare_closure[j] = col->compare; - ascending_closure[j] = column.ascending; - } - - if (e_table_model_has_sort_group (ets->source)) { - ets_sort_by_group (ets); - } - else { - qsort(ets->sorted, rows, sizeof(int), qsort_callback); - } - - g_free(vals_closure); - g_free(ascending_closure); - g_free(compare_closure); -} - -static void -ets_backsort(ETableSorter *ets) -{ - int i, rows; - - if (ets->backsorted) - return; - - ets_sort(ets); - - rows = e_table_model_row_count(ets->source); - ets->backsorted = g_new0(int, rows); - - for (i = 0; i < rows; i++) { - ets->backsorted[ets->sorted[i]] = i; - } -} - - -static gint -ets_model_to_sorted (ESorter *es, int row) -{ - ETableSorter *ets = E_TABLE_SORTER(es); - int rows = e_table_model_row_count(ets->source); - - g_return_val_if_fail(row >= 0, -1); - g_return_val_if_fail(row < rows, -1); - - if (ets_needs_sorting(es)) - ets_backsort(ets); - - if (ets->backsorted) - return ets->backsorted[row]; - else - return row; -} - -static gint -ets_sorted_to_model (ESorter *es, int row) -{ - ETableSorter *ets = E_TABLE_SORTER(es); - int rows = e_table_model_row_count(ets->source); - - g_return_val_if_fail(row >= 0, -1); - g_return_val_if_fail(row < rows, -1); - - if (ets_needs_sorting(es)) - ets_sort(ets); - - if (ets->sorted) - return ets->sorted[row]; - else - return row; -} - -static void -ets_get_model_to_sorted_array (ESorter *es, int **array, int *count) -{ - ETableSorter *ets = E_TABLE_SORTER(es); - if (array || count) { - ets_backsort(ets); - - if (array) - *array = ets->backsorted; - if (count) - *count = e_table_model_row_count(ets->source); - } -} - -static void -ets_get_sorted_to_model_array (ESorter *es, int **array, int *count) -{ - ETableSorter *ets = E_TABLE_SORTER(es); - if (array || count) { - ets_sort(ets); - - if (array) - *array = ets->sorted; - if (count) - *count = e_table_model_row_count(ets->source); - } -} - - -static gboolean -ets_needs_sorting(ESorter *es) -{ - ETableSorter *ets = E_TABLE_SORTER(es); - if (ets->needs_sorting < 0) { - if (e_table_sort_info_sorting_get_count(ets->sort_info) + e_table_sort_info_grouping_get_count(ets->sort_info)) - ets->needs_sorting = 1; - else - ets->needs_sorting = 0; - } - return ets->needs_sorting; -} diff --git a/widgets/table/e-table-sorter.h b/widgets/table/e-table-sorter.h deleted file mode 100644 index a6c999f744..0000000000 --- a/widgets/table/e-table-sorter.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SORTER_H_ -#define _E_TABLE_SORTER_H_ - -#include <gtk/gtkobject.h> -#include <gal/util/e-sorter.h> -#include <gal/e-table/e-table-model.h> -#include <gal/e-table/e-table-subset-variable.h> -#include <gal/e-table/e-table-sort-info.h> -#include <gal/e-table/e-table-header.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_SORTER_TYPE (e_table_sorter_get_type ()) -#define E_TABLE_SORTER(o) (GTK_CHECK_CAST ((o), E_TABLE_SORTER_TYPE, ETableSorter)) -#define E_TABLE_SORTER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SORTER_TYPE, ETableSorterClass)) -#define E_IS_TABLE_SORTER(o) (GTK_CHECK_TYPE ((o), E_TABLE_SORTER_TYPE)) -#define E_IS_TABLE_SORTER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SORTER_TYPE)) - -typedef struct { - ESorter base; - - ETableModel *source; - ETableHeader *full_header; - ETableSortInfo *sort_info; - - /* If needs_sorting is 0, then model_to_sorted and sorted_to_model are no-ops. */ - int needs_sorting; - - int *sorted; - int *backsorted; - - int table_model_changed_id; - int table_model_row_changed_id; - int table_model_cell_changed_id; - int sort_info_changed_id; -} ETableSorter; - -typedef struct { - ESorterClass parent_class; -} ETableSorterClass; - -GtkType e_table_sorter_get_type (void); -ETableSorter *e_table_sorter_new (ETableModel *etm, - ETableHeader *full_header, - ETableSortInfo *sort_info); -END_GNOME_DECLS - -#endif /* _E_TABLE_SORTER_H_ */ diff --git a/widgets/table/e-table-sorting-utils.c b/widgets/table/e-table-sorting-utils.c deleted file mode 100644 index 364397d17f..0000000000 --- a/widgets/table/e-table-sorting-utils.c +++ /dev/null @@ -1,528 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#include <string.h> -#include <e-table-sorting-utils.h> - -#define d(x) - -/* This takes source rows. */ -static int -etsu_compare(ETableModel *source, ETableSortInfo *sort_info, ETableHeader *full_header, int row1, int row2) -{ - int j; - int sort_count = e_table_sort_info_sorting_get_count(sort_info); - int comp_val = 0; - int ascending = 1; - - for (j = 0; j < sort_count; j++) { - ETableSortColumn column = e_table_sort_info_sorting_get_nth(sort_info, j); - ETableCol *col; - col = e_table_header_get_column_by_col_idx(full_header, column.column); - if (col == NULL) - col = e_table_header_get_column (full_header, e_table_header_count (full_header) - 1); - comp_val = (*col->compare)(e_table_model_value_at (source, col->col_idx, row1), - e_table_model_value_at (source, col->col_idx, row2)); - ascending = column.ascending; - if (comp_val != 0) - break; - } - if (comp_val == 0) { - if (row1 < row2) - comp_val = -1; - if (row1 > row2) - comp_val = 1; - } - if (!ascending) - comp_val = -comp_val; - return comp_val; -} - -static ETableSortInfo *sort_info_closure; - -static void **vals_closure; -static int cols_closure; -static int *ascending_closure; -static GCompareFunc *compare_closure; - -/* FIXME: Make it not cache the second and later columns (as if anyone cares.) */ - -static int -qsort_callback(const void *data1, const void *data2) -{ - gint row1 = *(int *)data1; - gint row2 = *(int *)data2; - int j; - int sort_count = e_table_sort_info_sorting_get_count(sort_info_closure); - int comp_val = 0; - int ascending = 1; - for (j = 0; j < sort_count; j++) { - comp_val = (*(compare_closure[j]))(vals_closure[cols_closure * row1 + j], vals_closure[cols_closure * row2 + j]); - ascending = ascending_closure[j]; - if (comp_val != 0) - break; - } - if (comp_val == 0) { - if (row1 < row2) - comp_val = -1; - if (row1 > row2) - comp_val = 1; - } - if (!ascending) - comp_val = -comp_val; - return comp_val; -} - -struct _subinfo { - int start; - GArray *rowsort; /* an array of row info's */ -}; - -struct _rowinfo { - int row; - struct _subinfo *subinfo; - struct _group_info *groupinfo; -}; - -static int -qsort_callback_complex(const void *data1, const void *data2) -{ - gint row1 = ((struct _rowinfo *)data1)->row; - gint row2 = ((struct _rowinfo *)data2)->row; - int j; - int sort_count = e_table_sort_info_sorting_get_count(sort_info_closure); - int comp_val = 0; - int ascending = 1; - for (j = 0; j < sort_count; j++) { - comp_val = (*(compare_closure[j]))(vals_closure[cols_closure * row1 + j], vals_closure[cols_closure * row2 + j]); - ascending = ascending_closure[j]; - if (comp_val != 0) - break; - } - if (comp_val == 0) { - if (row1 < row2) - comp_val = -1; - if (row1 > row2) - comp_val = 1; - } - if (!ascending) - comp_val = -comp_val; - return comp_val; -} - -/* if sortgroup is like: -0 1 1 1 -1 1 2 2 -2 2 3 2 -3 2 4 3 -4 3 5 3 -5 2 6 1 -6 1 0 1 - - Want to sort the 1's first - Then sort each group of 2's, offsetting into the output by the new root 1 location - ... Recursively ... -*/ - -struct _group_info { - char *group; - int row; -}; - -#ifdef DEBUG -#undef DEBUG -#endif -/*#define DEBUG*/ - -#ifdef DEBUG -static int total=0; -static int total_sorted=0; -#endif - -/* builds the info needed to sort everything */ -static struct _subinfo * -etsu_sort_build_subset(int rows, struct _group_info *groupinfo, int start, int *end) -{ - int i, lastinsert; - GArray *rowsort = g_array_new(0, 0, sizeof(struct _rowinfo)); - struct _subinfo *subinfo, *newsub; - char *id, *newid; - int idlen, newidlen; - int cmp; - int cmplen; - - subinfo = g_malloc0(sizeof(*subinfo)); - subinfo->rowsort = rowsort; - subinfo->start = start; - lastinsert = -1; - id = groupinfo[start].group; - newid = strrchr(id, '/'); - idlen = strlen(id); - if (newid) - cmplen = newid-id; - else - cmplen = idlen; - d(printf("%d scanning level %s\n", start, id)); - for (i=start;i<rows;i++) { - newid = groupinfo[i].group; - newidlen = strlen(newid); - d(printf("%d checking group %s\n", start, newid)); - cmp = strncmp(id, newid, cmplen); - /* check for common parent */ - if (idlen == newidlen && cmp == 0) { - struct _rowinfo rowinfo; - - d(printf("%d Same parent\n", start)); - rowinfo.row = groupinfo[i].row; - rowinfo.subinfo = NULL; - rowinfo.groupinfo = &groupinfo[i]; - lastinsert = rowsort->len; - g_array_append_val(rowsort, rowinfo); -#ifdef DEBUG - total++; -#endif - } else if (newidlen > idlen) { - /* must be a new subtree */ - d(printf("%d checking subtree instead\n", start)); - newsub = etsu_sort_build_subset(rows, groupinfo, i, &i); - d(printf("found %d nodes in subtree\n", newsub->rowsort->len)); - g_array_index(rowsort, struct _rowinfo, lastinsert).subinfo = newsub; - } else { - i--; - break; - } - } - if (end) - *end = i; - d(printf("finished level %s start was %d end was %d\n", id, start, i)); - return subinfo; -} - -/* sort each level, and then sort each level below that level (once we know - where the sublevel will fit in the overall list) */ -static int -etsu_sort_subset(int *map_table, struct _subinfo *subinfo, int startoffset) -{ - GArray *rowsort = subinfo->rowsort; - int offset, i; - - d(printf("sorting subset start %d rows %d\n", startoffset, rowsort->len)); - - /* first, sort the actual data */ - qsort(rowsort->data, rowsort->len, sizeof(struct _rowinfo), qsort_callback_complex); - - /* then put it back in the map table, where appropriate */ - offset = startoffset; - for (i=0;i<rowsort->len;i++) { - struct _rowinfo *rowinfo; - - d(printf("setting offset %d\n", offset)); - - rowinfo = &g_array_index(rowsort, struct _rowinfo, i); - map_table[offset] = rowinfo->row; - if (rowinfo->subinfo) { - offset = etsu_sort_subset(map_table, rowinfo->subinfo, offset+1); - } else - offset += 1; - } - d(printf("end sort subset start %d\n", startoffset)); - - return offset; -} - -static void -etsu_sort_free_subset(struct _subinfo *subinfo) -{ - int i; - - for (i=0;i<subinfo->rowsort->len;i++) { - struct _rowinfo *rowinfo; - - rowinfo = &g_array_index(subinfo->rowsort, struct _rowinfo, i); - if (rowinfo->subinfo) - etsu_sort_free_subset(rowinfo->subinfo); - } - g_array_free(subinfo->rowsort, TRUE); - g_free(subinfo); -} - -static int -sort_groups_compare(const void *ap, const void *bp) -{ - struct _group_info *a = (struct _group_info *)ap; - struct _group_info *b = (struct _group_info *)bp; - - return strcmp(a->group, b->group); -} - -#ifdef DEBUG -static void -print_id(int key, int val, void *data) -{ - printf("gained id %d\n", key); -} -#endif - -/* use the sort group to select subsorts */ -static void -etsu_sort_by_group(ETableModel *source, int *map_table, int rows) -{ - struct _group_info *groups; - struct _subinfo *subinfo; - int i; -#ifdef DEBUG - GHashTable *members = g_hash_table_new(0, 0); - - total = 0; - total_sorted = 0; -#endif - - d(printf("sorting %d rows\n", rows)); - - if (rows == 0) - return; - - /* get the subset rows */ - groups = g_malloc(sizeof(struct _group_info) * rows); - for (i=0;i<rows;i++) { - groups[i].row = map_table[i]; - groups[i].group = g_strdup(e_table_model_row_sort_group(source, groups[i].row)); -#ifdef DEBUG - g_hash_table_insert(members, map_table[i], 1); - map_table[i] = 0; -#endif - } - - /* sort the group info */ - qsort(groups, rows, sizeof(struct _group_info), sort_groups_compare); - - d(printf("sorted groups:\n"); - for (i=0;i<rows;i++) { - printf(" %s\n", groups[i].group); - }); - - /* now sort based on the group info */ - subinfo = etsu_sort_build_subset(rows, groups, 0, NULL); - for (i=0;i<rows;i++) { - g_free(groups[i].group); - } - g_free(groups); - etsu_sort_subset(map_table, subinfo, 0); - etsu_sort_free_subset(subinfo); -#ifdef DEBUG - for (i=0;i<rows;i++) { - if (g_hash_table_lookup(members, map_table[i]) == 0) { - printf("lost id %d\n", map_table[i]); - } - g_hash_table_remove(members, map_table[i]); - } - g_hash_table_foreach(members, print_id, 0); - - printf("total rows = %d, total processed = %d, total sorted = %d\n", rows, total, total_sorted); -#endif - -} - -void -e_table_sorting_utils_sort(ETableModel *source, ETableSortInfo *sort_info, ETableHeader *full_header, int *map_table, int rows) -{ - int total_rows; - int i; - int j; - int cols; - - g_return_if_fail(source != NULL); - g_return_if_fail(E_IS_TABLE_MODEL(source)); - g_return_if_fail(sort_info != NULL); - g_return_if_fail(E_IS_TABLE_SORT_INFO(sort_info)); - g_return_if_fail(full_header != NULL); - g_return_if_fail(E_IS_TABLE_HEADER(full_header)); - - total_rows = e_table_model_row_count(source); - cols = e_table_sort_info_sorting_get_count(sort_info); - cols_closure = cols; - vals_closure = g_new(void *, total_rows * cols); - sort_info_closure = sort_info; - ascending_closure = g_new(int, cols); - compare_closure = g_new(GCompareFunc, cols); - for (j = 0; j < cols; j++) { - ETableSortColumn column = e_table_sort_info_sorting_get_nth(sort_info, j); - ETableCol *col; - col = e_table_header_get_column_by_col_idx(full_header, column.column); - if (col == NULL) - col = e_table_header_get_column (full_header, e_table_header_count (full_header) - 1); - for (i = 0; i < rows; i++) { - vals_closure[map_table[i] * cols + j] = e_table_model_value_at (source, col->col_idx, map_table[i]); - } - compare_closure[j] = col->compare; - ascending_closure[j] = column.ascending; - } - - if (e_table_model_has_sort_group(source)) { - etsu_sort_by_group(source, map_table, rows); - } else { - qsort(map_table, rows, sizeof(int), qsort_callback); - } - g_free(vals_closure); - g_free(ascending_closure); - g_free(compare_closure); -} - -gboolean -e_table_sorting_utils_affects_sort (ETableModel *source, - ETableSortInfo *sort_info, - ETableHeader *full_header, - int col) -{ - int j; - int cols; - - g_return_val_if_fail(source != NULL, TRUE); - g_return_val_if_fail(E_IS_TABLE_MODEL(source), TRUE); - g_return_val_if_fail(sort_info != NULL, TRUE); - g_return_val_if_fail(E_IS_TABLE_SORT_INFO(sort_info), TRUE); - g_return_val_if_fail(full_header != NULL, TRUE); - g_return_val_if_fail(E_IS_TABLE_HEADER(full_header), TRUE); - - cols = e_table_sort_info_sorting_get_count(sort_info); - - for (j = 0; j < cols; j++) { - ETableSortColumn column = e_table_sort_info_sorting_get_nth(sort_info, j); - ETableCol *tablecol; - tablecol = e_table_header_get_column_by_col_idx(full_header, column.column); - if (tablecol == NULL) - tablecol = e_table_header_get_column (full_header, e_table_header_count (full_header) - 1); - if (col == tablecol->col_idx) - return TRUE; - } - return FALSE; -} - - -int -e_table_sorting_utils_insert(ETableModel *source, ETableSortInfo *sort_info, ETableHeader *full_header, int *map_table, int rows, int row) -{ - int i; - - i = 0; - /* handle insertions when we have a 'sort group' */ - if (e_table_model_has_sort_group(source)) { - /* find the row this row maps to */ - char *group = g_strdup(e_table_model_row_sort_group(source, row)); - const char *newgroup; - int cmp, grouplen, newgrouplen; - - newgroup = strrchr(group, '/'); - grouplen = strlen(group); - if (newgroup) - cmp = newgroup-group; - else - cmp = grouplen; - - /* find first common parent */ - while (i < rows) { - newgroup = e_table_model_row_sort_group(source, map_table[i]); - if (strncmp(newgroup, group, cmp) == 0) { - break; - } - i++; - } - - /* check matching records */ - while (i<row) { - newgroup = e_table_model_row_sort_group(source, map_table[i]); - newgrouplen = strlen(newgroup); - if (strncmp(newgroup, group, cmp) == 0) { - /* common parent, check for same level */ - if (grouplen == newgrouplen) { - if (etsu_compare(source, sort_info, full_header, map_table[i], row) >= 0) - break; - } else if (strncmp(newgroup + cmp, group + cmp, grouplen - cmp) == 0) - /* Found a child of the inserted node. Insert here. */ - break; - } else { - /* ran out of common parents, insert here */ - break; - } - i++; - } - g_free(group); - } else { - while (i < rows && etsu_compare(source, sort_info, full_header, map_table[i], row) < 0) - i++; - } - - return i; -} - -#if 0 -void *bsearch(const void *key, const void *base, size_t nmemb, - size_t size, int (*compar)(const void *, const void *, void *), gpointer user_data) -{ - -} - -int -e_table_sorting_utils_check_position (ETableModel *source, ETableSortInfo *sort_info, ETableHeader *full_header, int *map_table, int rows, int view_row) -{ - int i; - int row; - - i = view_row; - row = map_table[i]; - /* handle insertions when we have a 'sort group' */ - if (e_table_model_has_sort_group(source)) { - /* find the row this row maps to */ - char *group = g_strdup(e_table_model_row_sort_group(source, row)); - const char *newgroup; - int cmp, grouplen, newgrouplen; - - newgroup = strrchr(group, '/'); - grouplen = strlen(group); - if (newgroup) - cmp = newgroup-group; - else - cmp = grouplen; - - /* find first common parent */ - while (i < rows) { - newgroup = e_table_model_row_sort_group(source, map_table[i]); - if (strncmp(newgroup, group, cmp) == 0) { - break; - } - i++; - } - - /* check matching records */ - while (i < row) { - newgroup = e_table_model_row_sort_group(source, map_table[i]); - newgrouplen = strlen(newgroup); - if (strncmp(newgroup, group, cmp) == 0) { - /* common parent, check for same level */ - if (grouplen == newgrouplen) { - if (etsu_compare(source, sort_info, full_header, map_table[i], row) >= 0) - break; - } else if (strncmp(newgroup + cmp, group + cmp, grouplen - cmp) == 0) - /* Found a child of the inserted node. Insert here. */ - break; - } else { - /* ran out of common parents, insert here */ - break; - } - i++; - } - g_free(group); - } else { - i = view_row; - if (i < rows && etsu_compare(source, sort_info, full_header, map_table[i + 1], row) < 0) { - i ++; - while (i < rows - 1 && etsu_compare(source, sort_info, full_header, map_table[i], row) < 0) - i ++; - } else if (i > 0 && etsu_compare(source, sort_info, full_header, map_table[i - 1], row) > 0) { - i --; - while (i > 0 && etsu_compare(source, sort_info, full_header, map_table[i], row) > 0) - i --; - } - } - return i; -} -#endif diff --git a/widgets/table/e-table-sorting-utils.h b/widgets/table/e-table-sorting-utils.h deleted file mode 100644 index f65f7c49ce..0000000000 --- a/widgets/table/e-table-sorting-utils.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SORTING_UTILS_H_ -#define _E_TABLE_SORTING_UTILS_H_ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include <gal/e-table/e-table-model.h> -#include <gal/e-table/e-table-sort-info.h> -#include <gal/e-table/e-table-header.h> - -void e_table_sorting_utils_sort (ETableModel *source, - ETableSortInfo *sort_info, - ETableHeader *full_header, - int *map_table, - int rows); - -gboolean e_table_sorting_utils_affects_sort (ETableModel *source, - ETableSortInfo *sort_info, - ETableHeader *full_header, - int col); - -int e_table_sorting_utils_insert (ETableModel *source, - ETableSortInfo *sort_info, - ETableHeader *full_header, - int *map_table, - int rows, - int row); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TABLE_SORTING_UTILS_H_ */ diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c deleted file mode 100644 index cfeda97b68..0000000000 --- a/widgets/table/e-table-specification.c +++ /dev/null @@ -1,364 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-specification.c: Implements a savable description of the inital state of a table. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * Miguel de Icaza (miguel@ximian.com) - * - * (C) 2000, 2001 Ximian, Inc. - */ -#include <config.h> -#include <stdlib.h> -#include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> -#include "gal/util/e-util.h" -#include "gal/util/e-xml-utils.h" -#include "e-table-specification.h" - -#define PARENT_TYPE (gtk_object_get_type ()) - -static GtkObjectClass *etsp_parent_class; - -static void -etsp_destroy (GtkObject *object) -{ - ETableSpecification *etsp = E_TABLE_SPECIFICATION (object); - int i; - - if (etsp->columns) { - for (i = 0; etsp->columns[i]; i++) { - gtk_object_unref (GTK_OBJECT (etsp->columns[i])); - } - g_free (etsp->columns); - } - - if (etsp->state) - gtk_object_unref (GTK_OBJECT (etsp->state)); - g_free (etsp->click_to_add_message); - - etsp->columns = NULL; - etsp->state = NULL; - etsp->click_to_add_message = NULL; - - GTK_OBJECT_CLASS (etsp_parent_class)->destroy (object); -} - -static void -etsp_class_init (GtkObjectClass *klass) -{ - etsp_parent_class = gtk_type_class (PARENT_TYPE); - - klass->destroy = etsp_destroy; -} - -static void -etsp_init (ETableSpecification *etsp) -{ - etsp->columns = NULL; - etsp->state = NULL; - - etsp->no_headers = FALSE; - etsp->click_to_add = FALSE; - etsp->draw_grid = FALSE; - etsp->draw_focus = TRUE; - etsp->horizontal_scrolling = FALSE; - - etsp->cursor_mode = E_CURSOR_SIMPLE; - etsp->selection_mode = GTK_SELECTION_MULTIPLE; - - etsp->click_to_add_message = NULL; -} - -E_MAKE_TYPE (e_table_specification, "ETableSpecification", ETableSpecification, etsp_class_init, etsp_init, PARENT_TYPE); - -/** - * e_table_specification_new: - * - * Creates a new %ETableSpecification object. This object is used to hold the - * information about the rendering information for ETable. - * - * Returns: a newly created %ETableSpecification object. - */ -ETableSpecification * -e_table_specification_new (void) -{ - ETableSpecification *etsp = gtk_type_new (E_TABLE_SPECIFICATION_TYPE); - - return (ETableSpecification *) etsp; -} - -/** - * e_table_specification_load_from_file: - * @specification: An ETableSpecification that you want to modify - * @filename: a filename that contains an ETableSpecification - * - * This routine modifies @specification to reflect the state described - * by the file @filename. - * - * Returns: TRUE on success, FALSE on failure. - */ -gboolean -e_table_specification_load_from_file (ETableSpecification *specification, - const char *filename) -{ - xmlDoc *doc; - doc = xmlParseFile (filename); - if (doc) { - xmlNode *node = xmlDocGetRootElement (doc); - e_table_specification_load_from_node (specification, node); - xmlFreeDoc (doc); - return TRUE; - } - return FALSE; -} - -/** - * e_table_specification_load_from_string: - * @specification: An ETableSpecification that you want to modify - * @xml: a stringified representation of an ETableSpecification description. - * - * This routine modifies @specification to reflect the state described - * by @xml. @xml is typically returned by e_table_specification_save_to_string - * or it can be embedded in your source code. - * - * Returns: TRUE on success, FALSE on failure. - */ -gboolean -e_table_specification_load_from_string (ETableSpecification *specification, - const char *xml) -{ - xmlDoc *doc; - doc = xmlParseMemory ( (char *) xml, strlen (xml)); - if (doc) { - xmlNode *node = xmlDocGetRootElement (doc); - e_table_specification_load_from_node (specification, node); - xmlFreeDoc (doc); - return TRUE; - } - - return FALSE; -} - -/** - * e_table_specification_load_from_node: - * @specification: An ETableSpecification that you want to modify - * @node: an xmlNode with an XML ETableSpecification description. - * - * This routine modifies @specification to reflect the state described - * by @node. - */ -void -e_table_specification_load_from_node (ETableSpecification *specification, - const xmlNode *node) -{ - char *temp; - xmlNode *children; - GList *list = NULL, *list2; - int i; - - specification->no_headers = e_xml_get_bool_prop_by_name (node, "no-headers"); - specification->click_to_add = e_xml_get_bool_prop_by_name (node, "click-to-add"); - specification->draw_grid = e_xml_get_bool_prop_by_name (node, "draw-grid"); - specification->draw_focus = e_xml_get_bool_prop_by_name_with_default (node, "draw-focus", TRUE); - specification->horizontal_scrolling = e_xml_get_bool_prop_by_name_with_default (node, "horizontal-scrolling", FALSE); - - specification->selection_mode = GTK_SELECTION_MULTIPLE; - temp = e_xml_get_string_prop_by_name (node, "selection-mode"); - if (temp && !strcasecmp (temp, "single")) { - specification->selection_mode = GTK_SELECTION_SINGLE; - } else if (temp && !strcasecmp (temp, "browse")) { - specification->selection_mode = GTK_SELECTION_BROWSE; - } else if (temp && !strcasecmp (temp, "extended")) { - specification->selection_mode = GTK_SELECTION_EXTENDED; - } - g_free (temp); - - specification->cursor_mode = E_CURSOR_SIMPLE; - temp = e_xml_get_string_prop_by_name (node, "cursor-mode"); - if (temp && !strcasecmp (temp, "line")) { - specification->cursor_mode = E_CURSOR_LINE; - } else if (temp && !strcasecmp (temp, "spreadsheet")) { - specification->cursor_mode = E_CURSOR_SPREADSHEET; - } - g_free (temp); - g_free (specification->click_to_add_message); - - specification->click_to_add_message = - e_xml_get_string_prop_by_name ( - node, "_click-to-add-message"); - - if (specification->state) - gtk_object_unref (GTK_OBJECT (specification->state)); - specification->state = NULL; - if (specification->columns) { - for (i = 0; specification->columns[i]; i++) { - gtk_object_unref (GTK_OBJECT (specification->columns[i])); - } - g_free (specification->columns); - } - specification->columns = NULL; - - for (children = node->xmlChildrenNode; children; children = children->next) { - if (!strcmp (children->name, "ETableColumn")) { - ETableColumnSpecification *col_spec = e_table_column_specification_new (); - - e_table_column_specification_load_from_node (col_spec, children); - list = g_list_append (list, col_spec); - } else if (specification->state == NULL && !strcmp (children->name, "ETableState")) { - specification->state = e_table_state_new (); - e_table_state_load_from_node (specification->state, children); - } - } - - specification->columns = g_new (ETableColumnSpecification *, g_list_length (list) + 1); - for (list2 = list, i = 0; list2; list2 = g_list_next (list2), i++) { - specification->columns[i] = list2->data; - } - specification->columns[i] = NULL; - g_list_free (list); -} - -/** - * e_table_specification_save_to_file: - * @specification: An %ETableSpecification that you want to save - * @filename: a file name to store the specification. - * - * This routine stores the @specification into @filename. - * - * Returns: the number of bytes written or -1 on error. - */ -int -e_table_specification_save_to_file (ETableSpecification *specification, - const char *filename) -{ - xmlDoc *doc; - - g_return_val_if_fail (specification != NULL, -1); - g_return_val_if_fail (filename != NULL, -1); - g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), -1); - - doc = xmlNewDoc ("1.0"); - xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc)); - return xmlSaveFile (filename, doc); -} - -/** - * e_table_specification_save_to_string: - * @specification: An %ETableSpecification that you want to stringify - * - * Saves the state of @specification to a string. - * - * Returns: an g_alloc() allocated string containing the stringified - * representation of @specification. This stringified representation - * uses XML as a convenience. - */ -char * -e_table_specification_save_to_string (ETableSpecification *specification) -{ - char *ret_val; - xmlChar *string; - int length; - xmlDoc *doc; - - g_return_val_if_fail (specification != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), NULL); - - doc = xmlNewDoc ("1.0"); - xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc)); - xmlDocDumpMemory (doc, &string, &length); - - ret_val = g_strdup (string); - xmlFree (string); - return ret_val; -} - -/** - * e_table_specification_save_to_node: - * @specification: An ETableSpecification that you want to store. - * @doc: Node where the specification is saved - * - * This routine saves the %ETableSpecification state in the object @specification - * into the xmlDoc represented by @doc. - * - * Returns: The node that has been attached to @doc with the contents - * of the ETableSpecification. - */ -xmlNode * -e_table_specification_save_to_node (ETableSpecification *specification, - xmlDoc *doc) -{ - xmlNode *node; - char *s; - - g_return_val_if_fail (doc != NULL, NULL); - g_return_val_if_fail (specification != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), NULL); - - node = xmlNewNode (NULL, "ETableSpecification"); - e_xml_set_bool_prop_by_name (node, "no-headers", specification->no_headers); - e_xml_set_bool_prop_by_name (node, "click-to-add", specification->click_to_add); - e_xml_set_bool_prop_by_name (node, "draw-grid", specification->draw_grid); - e_xml_set_bool_prop_by_name (node, "draw-focus", specification->draw_focus); - e_xml_set_bool_prop_by_name (node, "horizontal-scrolling", specification->horizontal_scrolling); - - switch (specification->selection_mode){ - case GTK_SELECTION_SINGLE: - s = "single"; - break; - case GTK_SELECTION_BROWSE: - s = "browse"; - break; - default: - case GTK_SELECTION_EXTENDED: - s = "extended"; - } - xmlSetProp (node, "selection-mode", s); - if (specification->cursor_mode == E_CURSOR_LINE) - s = "line"; - else - s = "cell"; - xmlSetProp (node, "cursor-mode", s); - - xmlSetProp (node, "_click-to-add-message", specification->click_to_add_message); - - if (specification->columns){ - int i; - - for (i = 0; specification->columns [i]; i++) - e_table_column_specification_save_to_node ( - specification->columns [i], - node); - } - - if (specification->state) - e_table_state_save_to_node (specification->state, node); - - return node; -} - -/** - * e_table_specification_duplicate: - * @spec: specification to duplicate - * - * This creates a copy of the %ETableSpecification @spec - * - * Returns: The duplicated %ETableSpecification. - */ -ETableSpecification * -e_table_specification_duplicate (ETableSpecification *spec) -{ - ETableSpecification *new_spec; - char *spec_str; - - g_return_val_if_fail (spec != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (spec), NULL); - - new_spec = e_table_specification_new (); - spec_str = e_table_specification_save_to_string (spec); - e_table_specification_load_from_string (new_spec, spec_str); - g_free (spec_str); - - return new_spec; -} diff --git a/widgets/table/e-table-specification.h b/widgets/table/e-table-specification.h deleted file mode 100644 index c6cbb27dcf..0000000000 --- a/widgets/table/e-table-specification.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SPECIFICATION_H_ -#define _E_TABLE_SPECIFICATION_H_ - -#include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> -#include <gal/widgets/e-selection-model.h> -#include <gal/e-table/e-table-state.h> -#include <gal/e-table/e-table-column-specification.h> -#include <gal/e-table/e-table-defines.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_TABLE_SPECIFICATION_TYPE (e_table_specification_get_type ()) -#define E_TABLE_SPECIFICATION(o) (GTK_CHECK_CAST ((o), E_TABLE_SPECIFICATION_TYPE, ETableSpecification)) -#define E_TABLE_SPECIFICATION_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SPECIFICATION_TYPE, ETableSpecificationClass)) -#define E_IS_TABLE_SPECIFICATION(o) (GTK_CHECK_TYPE ((o), E_TABLE_SPECIFICATION_TYPE)) -#define E_IS_TABLE_SPECIFICATION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SPECIFICATION_TYPE)) - -typedef struct { - GtkObject base; - - ETableColumnSpecification **columns; - ETableState *state; - - guint no_headers : 1; - guint click_to_add : 1; - guint draw_grid : 1; - guint draw_focus : 1; - guint horizontal_scrolling : 1; - GtkSelectionMode selection_mode; - ECursorMode cursor_mode; - - char *click_to_add_message; -} ETableSpecification; - -typedef struct { - GtkObjectClass parent_class; -} ETableSpecificationClass; - -GtkType e_table_specification_get_type (void); -ETableSpecification *e_table_specification_new (void); - -gboolean e_table_specification_load_from_file (ETableSpecification *specification, - const char *filename); -gboolean e_table_specification_load_from_string (ETableSpecification *specification, - const char *xml); -void e_table_specification_load_from_node (ETableSpecification *specification, - const xmlNode *node); - -int e_table_specification_save_to_file (ETableSpecification *specification, - const char *filename); -char *e_table_specification_save_to_string (ETableSpecification *specification); -xmlNode *e_table_specification_save_to_node (ETableSpecification *specification, - xmlDoc *doc); -ETableSpecification *e_table_specification_duplicate (ETableSpecification *spec); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TABLE_SPECIFICATION_H_ */ diff --git a/widgets/table/e-table-state.c b/widgets/table/e-table-state.c deleted file mode 100644 index c978487368..0000000000 --- a/widgets/table/e-table-state.c +++ /dev/null @@ -1,232 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-state.c: Savable state of a table. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * Miguel de Icaza (miguel@ximian.com) - * - * (C) 2000 Ximian, Inc. - */ -#include <config.h> -#include <stdlib.h> -#include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> -#include "gal/util/e-util.h" -#include "gal/util/e-xml-utils.h" -#include "e-table-state.h" - -#define PARENT_TYPE (gtk_object_get_type()) - -#define STATE_VERSION 0.1 - -static GtkObjectClass *etst_parent_class; - -static void -etst_destroy (GtkObject *object) -{ - ETableState *etst = E_TABLE_STATE (object); - - if (etst->columns) - g_free (etst->columns); - - GTK_OBJECT_CLASS (etst_parent_class)->destroy (object); -} - -static void -etst_class_init (GtkObjectClass *klass) -{ - etst_parent_class = gtk_type_class (PARENT_TYPE); - - klass->destroy = etst_destroy; -} - -static void -etst_init (ETableState *state) -{ - state->columns = NULL; - state->expansions = NULL; - state->sort_info = e_table_sort_info_new(); -} - -E_MAKE_TYPE(e_table_state, "ETableState", ETableState, etst_class_init, etst_init, PARENT_TYPE); - -ETableState * -e_table_state_new (void) -{ - ETableState *etst = gtk_type_new (E_TABLE_STATE_TYPE); - - return (ETableState *) etst; -} - -gboolean -e_table_state_load_from_file (ETableState *state, - const char *filename) -{ - xmlDoc *doc; - doc = xmlParseFile (filename); - if (doc) { - xmlNode *node = xmlDocGetRootElement(doc); - e_table_state_load_from_node(state, node); - xmlFreeDoc(doc); - return TRUE; - } - return FALSE; -} - -void -e_table_state_load_from_string (ETableState *state, - const char *xml) -{ - xmlDoc *doc; - doc = xmlParseMemory ((char *) xml, strlen(xml)); - if (doc) { - xmlNode *node = xmlDocGetRootElement(doc); - e_table_state_load_from_node(state, node); - xmlFreeDoc(doc); - } -} - -typedef struct { - int column; - double expansion; -} int_and_double; - -void -e_table_state_load_from_node (ETableState *state, - const xmlNode *node) -{ - xmlNode *children; - GList *list = NULL, *iterator; - gdouble state_version; - int i; - - state_version = e_xml_get_double_prop_by_name_with_default ( - node, "state-version", STATE_VERSION); - - if (state->sort_info) - gtk_object_unref (GTK_OBJECT(state->sort_info)); - - state->sort_info = NULL; - children = node->xmlChildrenNode; - for (; children; children = children->next) { - if (!strcmp (children->name, "column")) { - int_and_double *column_info = g_new(int_and_double, 1); - - column_info->column = e_xml_get_integer_prop_by_name( - children, "source"); - column_info->expansion = - e_xml_get_double_prop_by_name_with_default( - children, "expansion", -2); - - list = g_list_append (list, column_info); - } else if (state->sort_info == NULL && - !strcmp (children->name, "grouping")) { - state->sort_info = e_table_sort_info_new(); - e_table_sort_info_load_from_node( - state->sort_info, children, state_version); - } - } - g_free(state->columns); - g_free(state->expansions); - state->col_count = g_list_length(list); - state->columns = g_new(int, state->col_count); - state->expansions = g_new(double, state->col_count); - - for (iterator = list, i = 0; iterator; i++) { - int_and_double *column_info = iterator->data; - - state->columns [i] = column_info->column; - state->expansions [i] = column_info->expansion; - g_free (column_info); - iterator = g_list_next (iterator); - } - g_list_free(list); -} - -void -e_table_state_save_to_file (ETableState *state, - const char *filename) -{ - xmlDoc *doc; - doc = xmlNewDoc("1.0"); - xmlDocSetRootElement(doc, e_table_state_save_to_node(state, NULL)); - xmlSaveFile(filename, doc); - xmlFreeDoc(doc); -} - -char * -e_table_state_save_to_string (ETableState *state) -{ - char *ret_val; - xmlChar *string; - int length; - xmlDoc *doc; - - doc = xmlNewDoc("1.0"); - xmlDocSetRootElement(doc, e_table_state_save_to_node(state, NULL)); - xmlDocDumpMemory(doc, &string, &length); - xmlFreeDoc(doc); - - ret_val = g_strdup(string); - xmlFree(string); - return ret_val; -} - -xmlNode * -e_table_state_save_to_node (ETableState *state, - xmlNode *parent) -{ - int i; - xmlNode *node; - - if (parent) - node = xmlNewChild (parent, NULL, "ETableState", NULL); - else - node = xmlNewNode (NULL, "ETableState"); - - e_xml_set_double_prop_by_name(node, "state-version", STATE_VERSION); - - for (i = 0; i < state->col_count; i++) { - int column = state->columns[i]; - double expansion = state->expansions[i]; - xmlNode *new_node; - - new_node = xmlNewChild(node, NULL, "column", NULL); - e_xml_set_integer_prop_by_name (new_node, "source", column); - if (expansion >= -1) - e_xml_set_double_prop_by_name(new_node, "expansion", expansion); - } - - - e_table_sort_info_save_to_node(state->sort_info, node); - - return node; -} - -/** - * e_table_state_duplicate: - * @state: The ETableState to duplicate - * - * This creates a copy of the %ETableState @state - * - * Returns: The duplicated %ETableState. - */ -ETableState * -e_table_state_duplicate (ETableState *state) -{ - ETableState *new_state; - char *copy; - - g_return_val_if_fail (state != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_STATE (state), NULL); - - new_state = e_table_state_new (); - copy = e_table_state_save_to_string (state); - e_table_state_load_from_string (new_state, copy); - g_free (copy); - - return new_state; -} - diff --git a/widgets/table/e-table-state.h b/widgets/table/e-table-state.h deleted file mode 100644 index 446d560fff..0000000000 --- a/widgets/table/e-table-state.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_STATE_H_ -#define _E_TABLE_STATE_H_ - -#include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> -#include <gal/e-table/e-table-sort-info.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define E_TABLE_STATE_TYPE (e_table_state_get_type ()) -#define E_TABLE_STATE(o) (GTK_CHECK_CAST ((o), E_TABLE_STATE_TYPE, ETableState)) -#define E_TABLE_STATE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_STATE_TYPE, ETableStateClass)) -#define E_IS_TABLE_STATE(o) (GTK_CHECK_TYPE ((o), E_TABLE_STATE_TYPE)) -#define E_IS_TABLE_STATE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_STATE_TYPE)) - -typedef struct { - GtkObject base; - - ETableSortInfo *sort_info; - int col_count; - int *columns; - double *expansions; -} ETableState; - -typedef struct { - GtkObjectClass parent_class; -} ETableStateClass; - -GtkType e_table_state_get_type (void); -ETableState *e_table_state_new (void); - -gboolean e_table_state_load_from_file (ETableState *state, - const char *filename); -void e_table_state_load_from_string (ETableState *state, - const char *xml); -void e_table_state_load_from_node (ETableState *state, - const xmlNode *node); - -void e_table_state_save_to_file (ETableState *state, - const char *filename); -char *e_table_state_save_to_string (ETableState *state); -xmlNode *e_table_state_save_to_node (ETableState *state, - xmlNode *parent); -ETableState *e_table_state_duplicate (ETableState *state); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TABLE_STATE_H_ */ diff --git a/widgets/table/e-table-subset-variable.c b/widgets/table/e-table-subset-variable.c deleted file mode 100644 index a60aec1ac8..0000000000 --- a/widgets/table/e-table-subset-variable.c +++ /dev/null @@ -1,227 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-subset.c: Implements a table that contains a subset of another table. - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Ximian, Inc. - */ -#include <config.h> -#include <stdlib.h> -#include <gtk/gtksignal.h> -#include <string.h> -#include "gal/util/e-util.h" -#include "e-table-subset-variable.h" - -#define ETSSV_CLASS(e) ((ETableSubsetVariableClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE E_TABLE_SUBSET_TYPE - -#define INCREMENT_AMOUNT 10 - -static ETableSubsetClass *etssv_parent_class; - -static void -etssv_add (ETableSubsetVariable *etssv, - gint row) -{ - ETableModel *etm = E_TABLE_MODEL(etssv); - ETableSubset *etss = E_TABLE_SUBSET(etssv); - - e_table_model_pre_change(etm); - - if (etss->n_map + 1 > etssv->n_vals_allocated){ - etssv->n_vals_allocated += INCREMENT_AMOUNT; - etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int)); - } - - etss->map_table[etss->n_map++] = row; - - e_table_model_row_inserted (etm, etss->n_map - 1); -} - -static void -etssv_add_array (ETableSubsetVariable *etssv, - const gint *array, - gint count) -{ - ETableModel *etm = E_TABLE_MODEL(etssv); - ETableSubset *etss = E_TABLE_SUBSET(etssv); - int i; - - e_table_model_pre_change(etm); - - if (etss->n_map + count > etssv->n_vals_allocated){ - etssv->n_vals_allocated += MAX(INCREMENT_AMOUNT, count); - etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int)); - } - for (i = 0; i < count; i++) - etss->map_table[etss->n_map++] = array[i]; - - e_table_model_changed (etm); -} - -static void -etssv_add_all (ETableSubsetVariable *etssv) -{ - ETableModel *etm = E_TABLE_MODEL(etssv); - ETableSubset *etss = E_TABLE_SUBSET(etssv); - int rows; - int i; - - e_table_model_pre_change(etm); - - rows = e_table_model_row_count(etss->source); - if (etss->n_map + rows > etssv->n_vals_allocated){ - etssv->n_vals_allocated += MAX(INCREMENT_AMOUNT, rows); - etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int)); - } - for (i = 0; i < rows; i++) - etss->map_table[etss->n_map++] = i; - - e_table_model_changed (etm); -} - -static gboolean -etssv_remove (ETableSubsetVariable *etssv, - gint row) -{ - ETableModel *etm = E_TABLE_MODEL(etssv); - ETableSubset *etss = E_TABLE_SUBSET(etssv); - int i; - - for (i = 0; i < etss->n_map; i++){ - if (etss->map_table[i] == row) { - e_table_model_pre_change (etm); - memmove (etss->map_table + i, etss->map_table + i + 1, (etss->n_map - i - 1) * sizeof(int)); - etss->n_map --; - - e_table_model_row_deleted (etm, i); - return TRUE; - } - } - return FALSE; -} - -static void -etssv_class_init (GtkObjectClass *object_class) -{ - ETableSubsetVariableClass *klass = E_TABLE_SUBSET_VARIABLE_CLASS(object_class); - etssv_parent_class = gtk_type_class (PARENT_TYPE); - - klass->add = etssv_add; - klass->add_array = etssv_add_array; - klass->add_all = etssv_add_all; - klass->remove = etssv_remove; -} - -E_MAKE_TYPE(e_table_subset_variable, "ETableSubsetVariable", ETableSubsetVariable, etssv_class_init, NULL, PARENT_TYPE); - -ETableModel * -e_table_subset_variable_construct (ETableSubsetVariable *etssv, - ETableModel *source) -{ - if (e_table_subset_construct (E_TABLE_SUBSET(etssv), source, 1) == NULL) - return NULL; - E_TABLE_SUBSET(etssv)->n_map = 0; - - return E_TABLE_MODEL (etssv); -} - -ETableModel * -e_table_subset_variable_new (ETableModel *source) -{ - ETableSubsetVariable *etssv = gtk_type_new (E_TABLE_SUBSET_VARIABLE_TYPE); - - if (e_table_subset_variable_construct (etssv, source) == NULL){ - gtk_object_unref (GTK_OBJECT (etssv)); - return NULL; - } - - return (ETableModel *) etssv; -} - -void -e_table_subset_variable_add (ETableSubsetVariable *etssv, - gint row) -{ - g_return_if_fail (etssv != NULL); - g_return_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv)); - - if (ETSSV_CLASS(etssv)->add) - ETSSV_CLASS (etssv)->add (etssv, row); -} - -void -e_table_subset_variable_add_array (ETableSubsetVariable *etssv, - const gint *array, - gint count) -{ - g_return_if_fail (etssv != NULL); - g_return_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv)); - - if (ETSSV_CLASS(etssv)->add_array) - ETSSV_CLASS (etssv)->add_array (etssv, array, count); -} - -void -e_table_subset_variable_add_all (ETableSubsetVariable *etssv) -{ - g_return_if_fail (etssv != NULL); - g_return_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv)); - - if (ETSSV_CLASS(etssv)->add_all) - ETSSV_CLASS (etssv)->add_all (etssv); -} - -gboolean -e_table_subset_variable_remove (ETableSubsetVariable *etssv, - gint row) -{ - g_return_val_if_fail (etssv != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv), FALSE); - - if (ETSSV_CLASS(etssv)->remove) - return ETSSV_CLASS (etssv)->remove (etssv, row); - else - return FALSE; -} - -void -e_table_subset_variable_increment (ETableSubsetVariable *etssv, - gint position, - gint amount) -{ - int i; - ETableSubset *etss = E_TABLE_SUBSET(etssv); - for (i = 0; i < etss->n_map; i++) { - if (etss->map_table[i] >= position) - etss->map_table[i] += amount; - } -} - -void -e_table_subset_variable_decrement (ETableSubsetVariable *etssv, - gint position, - gint amount) -{ - int i; - ETableSubset *etss = E_TABLE_SUBSET(etssv); - for (i = 0; i < etss->n_map; i++) { - if (etss->map_table[i] >= position) - etss->map_table[i] -= amount; - } -} - -void -e_table_subset_variable_set_allocation (ETableSubsetVariable *etssv, - gint total) -{ - ETableSubset *etss = E_TABLE_SUBSET(etssv); - if (total <= 0) - total = 1; - if (total > etss->n_map){ - etss->map_table = g_realloc (etss->map_table, total * sizeof(int)); - } -} diff --git a/widgets/table/e-table-subset-variable.h b/widgets/table/e-table-subset-variable.h deleted file mode 100644 index f09c612f13..0000000000 --- a/widgets/table/e-table-subset-variable.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SUBSET_VARIABLE_H_ -#define _E_TABLE_SUBSET_VARIABLE_H_ - -#include <gtk/gtkobject.h> -#include <gal/e-table/e-table-subset.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_TABLE_SUBSET_VARIABLE_TYPE (e_table_subset_variable_get_type ()) -#define E_TABLE_SUBSET_VARIABLE(o) (GTK_CHECK_CAST ((o), E_TABLE_SUBSET_VARIABLE_TYPE, ETableSubsetVariable)) -#define E_TABLE_SUBSET_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SUBSET_VARIABLE_TYPE, ETableSubsetVariableClass)) -#define E_IS_TABLE_SUBSET_VARIABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_SUBSET_VARIABLE_TYPE)) -#define E_IS_TABLE_SUBSET_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SUBSET_VARIABLE_TYPE)) - -typedef struct { - ETableSubset base; - - int n_vals_allocated; -} ETableSubsetVariable; - -typedef struct { - ETableSubsetClass parent_class; - - void (*add) (ETableSubsetVariable *ets, - gint row); - void (*add_array) (ETableSubsetVariable *ets, - const gint *array, - gint count); - void (*add_all) (ETableSubsetVariable *ets); - gboolean (*remove) (ETableSubsetVariable *ets, - gint row); -} ETableSubsetVariableClass; - -GtkType e_table_subset_variable_get_type (void); -ETableModel *e_table_subset_variable_new (ETableModel *etm); -ETableModel *e_table_subset_variable_construct (ETableSubsetVariable *etssv, - ETableModel *source); -void e_table_subset_variable_add (ETableSubsetVariable *ets, - gint row); -void e_table_subset_variable_add_array (ETableSubsetVariable *ets, - const gint *array, - gint count); -void e_table_subset_variable_add_all (ETableSubsetVariable *ets); -gboolean e_table_subset_variable_remove (ETableSubsetVariable *ets, - gint row); -void e_table_subset_variable_increment (ETableSubsetVariable *ets, - gint position, - gint amount); -void e_table_subset_variable_decrement (ETableSubsetVariable *ets, - gint position, - gint amount); -void e_table_subset_variable_set_allocation (ETableSubsetVariable *ets, - gint total); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* _E_TABLE_SUBSET_VARIABLE_H_ */ - diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c deleted file mode 100644 index 4b3d1e5d3b..0000000000 --- a/widgets/table/e-table-subset.c +++ /dev/null @@ -1,390 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-subset.c: Implements a table that contains a subset of another table. - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Ximian, Inc. - */ -#include <config.h> -#include <stdlib.h> -#include <gtk/gtksignal.h> -#include "gal/util/e-util.h" -#include "e-table-subset.h" - -static void etss_proxy_model_pre_change_real (ETableSubset *etss, ETableModel *etm); -static void etss_proxy_model_changed_real (ETableSubset *etss, ETableModel *etm); -static void etss_proxy_model_row_changed_real (ETableSubset *etss, ETableModel *etm, int row); -static void etss_proxy_model_cell_changed_real (ETableSubset *etss, ETableModel *etm, int col, int row); - -#define PARENT_TYPE E_TABLE_MODEL_TYPE -#define d(x) - -static ETableModelClass *etss_parent_class; - -#define ETSS_CLASS(object) (E_TABLE_SUBSET_CLASS(GTK_OBJECT(object)->klass)) - -static void -etss_destroy (GtkObject *object) -{ - ETableSubset *etss = E_TABLE_SUBSET (object); - - if (etss->source) { - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_pre_change_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_row_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_cell_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_row_inserted_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_row_deleted_id); - - gtk_object_unref (GTK_OBJECT (etss->source)); - etss->source = NULL; - - etss->table_model_changed_id = 0; - etss->table_model_row_changed_id = 0; - etss->table_model_cell_changed_id = 0; - etss->table_model_row_inserted_id = 0; - etss->table_model_row_deleted_id = 0; - } - - g_free (etss->map_table); - - GTK_OBJECT_CLASS (etss_parent_class)->destroy (object); -} - -static int -etss_column_count (ETableModel *etm) -{ - ETableSubset *etss = (ETableSubset *)etm; - - return e_table_model_column_count (etss->source); -} - -static int -etss_row_count (ETableModel *etm) -{ - ETableSubset *etss = (ETableSubset *)etm; - - return etss->n_map; -} - -static void * -etss_value_at (ETableModel *etm, int col, int row) -{ - ETableSubset *etss = (ETableSubset *)etm; - - etss->last_access = row; - d(g_print("g) Setting last_access to %d\n", row)); - return e_table_model_value_at (etss->source, col, etss->map_table [row]); -} - -static void -etss_set_value_at (ETableModel *etm, int col, int row, const void *val) -{ - ETableSubset *etss = (ETableSubset *)etm; - - etss->last_access = row; - d(g_print("h) Setting last_access to %d\n", row)); - return e_table_model_set_value_at (etss->source, col, etss->map_table [row], val); -} - -static gboolean -etss_is_cell_editable (ETableModel *etm, int col, int row) -{ - ETableSubset *etss = (ETableSubset *)etm; - - return e_table_model_is_cell_editable (etss->source, col, etss->map_table [row]); -} - -static void -etss_append_row (ETableModel *etm, ETableModel *source, int row) -{ - ETableSubset *etss = (ETableSubset *)etm; - e_table_model_append_row (etss->source, source, row); -} - -static void * -etss_duplicate_value (ETableModel *etm, int col, const void *value) -{ - ETableSubset *etss = (ETableSubset *)etm; - - return e_table_model_duplicate_value (etss->source, col, value); -} - -static void -etss_free_value (ETableModel *etm, int col, void *value) -{ - ETableSubset *etss = (ETableSubset *)etm; - - e_table_model_free_value (etss->source, col, value); -} - -static void * -etss_initialize_value (ETableModel *etm, int col) -{ - ETableSubset *etss = (ETableSubset *)etm; - - return e_table_model_initialize_value (etss->source, col); -} - -static gboolean -etss_value_is_empty (ETableModel *etm, int col, const void *value) -{ - ETableSubset *etss = (ETableSubset *)etm; - - return e_table_model_value_is_empty (etss->source, col, value); -} - -static char * -etss_value_to_string (ETableModel *etm, int col, const void *value) -{ - ETableSubset *etss = (ETableSubset *)etm; - - return e_table_model_value_to_string (etss->source, col, value); -} - -static void -etss_class_init (GtkObjectClass *object_class) -{ - ETableSubsetClass *klass = (ETableSubsetClass *) object_class; - ETableModelClass *table_class = (ETableModelClass *) object_class; - - etss_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = etss_destroy; - - table_class->column_count = etss_column_count; - table_class->row_count = etss_row_count; - table_class->value_at = etss_value_at; - table_class->set_value_at = etss_set_value_at; - table_class->is_cell_editable = etss_is_cell_editable; - table_class->append_row = etss_append_row; - table_class->duplicate_value = etss_duplicate_value; - table_class->free_value = etss_free_value; - table_class->initialize_value = etss_initialize_value; - table_class->value_is_empty = etss_value_is_empty; - table_class->value_to_string = etss_value_to_string; - - klass->proxy_model_pre_change = etss_proxy_model_pre_change_real; - klass->proxy_model_changed = etss_proxy_model_changed_real; - klass->proxy_model_row_changed = etss_proxy_model_row_changed_real; - klass->proxy_model_cell_changed = etss_proxy_model_cell_changed_real; - klass->proxy_model_row_inserted = NULL; - klass->proxy_model_row_deleted = NULL; -} - -static void -etss_init (ETableSubset *etss) -{ - etss->last_access = 0; -} - -E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, etss_init, PARENT_TYPE); - -static void -etss_proxy_model_pre_change_real (ETableSubset *etss, ETableModel *etm) -{ - e_table_model_pre_change (E_TABLE_MODEL (etss)); -} - -static void -etss_proxy_model_changed_real (ETableSubset *etss, ETableModel *etm) -{ - e_table_model_changed (E_TABLE_MODEL (etss)); -} - -static void -etss_proxy_model_row_changed_real (ETableSubset *etss, ETableModel *etm, int row) -{ - int limit; - const int n = etss->n_map; - const int * const map_table = etss->map_table; - int i; - - limit = MIN(n, etss->last_access + 10); - for (i = etss->last_access; i < limit; i++) { - if (map_table [i] == row){ - e_table_model_row_changed (E_TABLE_MODEL (etss), i); - d(g_print("a) Found %d from %d\n", i, etss->last_access)); - etss->last_access = i; - return; - } - } - - limit = MAX(0, etss->last_access - 10); - for (i = etss->last_access - 1; i >= limit; i--) { - if (map_table [i] == row){ - e_table_model_row_changed (E_TABLE_MODEL (etss), i); - d(g_print("b) Found %d from %d\n", i, etss->last_access)); - etss->last_access = i; - return; - } - } - - for (i = 0; i < n; i++){ - if (map_table [i] == row){ - e_table_model_row_changed (E_TABLE_MODEL (etss), i); - d(g_print("c) Found %d from %d\n", i, etss->last_access)); - etss->last_access = i; - return; - } - } -} - -static void -etss_proxy_model_cell_changed_real (ETableSubset *etss, ETableModel *etm, int col, int row) -{ - int limit; - const int n = etss->n_map; - const int * const map_table = etss->map_table; - int i; - - limit = MIN(n, etss->last_access + 10); - for (i = etss->last_access; i < limit; i++) { - if (map_table [i] == row){ - e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); - d(g_print("d) Found %d from %d\n", i, etss->last_access)); - etss->last_access = i; - return; - } - } - - limit = MAX(0, etss->last_access - 10); - for (i = etss->last_access - 1; i >= limit; i--) { - if (map_table [i] == row){ - e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); - d(g_print("e) Found %d from %d\n", i, etss->last_access)); - etss->last_access = i; - return; - } - } - - for (i = 0; i < n; i++){ - if (map_table [i] == row){ - e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); - d(g_print("f) Found %d from %d\n", i, etss->last_access)); - etss->last_access = i; - return; - } - } -} - -static void -etss_proxy_model_pre_change (ETableModel *etm, ETableSubset *etss) -{ - if (ETSS_CLASS(etss)->proxy_model_pre_change) - (ETSS_CLASS(etss)->proxy_model_pre_change) (etss, etm); -} - -static void -etss_proxy_model_changed (ETableModel *etm, ETableSubset *etss) -{ - if (ETSS_CLASS(etss)->proxy_model_changed) - (ETSS_CLASS(etss)->proxy_model_changed) (etss, etm); -} - -static void -etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss) -{ - if (ETSS_CLASS(etss)->proxy_model_row_changed) - (ETSS_CLASS(etss)->proxy_model_row_changed) (etss, etm, row); -} - -static void -etss_proxy_model_cell_changed (ETableModel *etm, int row, int col, ETableSubset *etss) -{ - if (ETSS_CLASS(etss)->proxy_model_cell_changed) - (ETSS_CLASS(etss)->proxy_model_cell_changed) (etss, etm, col, row); -} - -static void -etss_proxy_model_row_inserted (ETableModel *etm, int row, ETableSubset *etss) -{ - if (ETSS_CLASS(etss)->proxy_model_row_inserted) - (ETSS_CLASS(etss)->proxy_model_row_inserted) (etss, etm, row); -} - -static void -etss_proxy_model_row_deleted (ETableModel *etm, int row, ETableSubset *etss) -{ - if (ETSS_CLASS(etss)->proxy_model_row_deleted) - (ETSS_CLASS(etss)->proxy_model_row_deleted) (etss, etm, row); -} - -ETableModel * -e_table_subset_construct (ETableSubset *etss, ETableModel *source, int nvals) -{ - unsigned int *buffer; - int i; - - if (nvals) { - buffer = (unsigned int *) g_malloc (sizeof (unsigned int) * nvals); - if (buffer == NULL) - return NULL; - } else - buffer = NULL; - etss->map_table = buffer; - etss->n_map = nvals; - etss->source = source; - gtk_object_ref (GTK_OBJECT (source)); - - /* Init */ - for (i = 0; i < nvals; i++) - etss->map_table [i] = i; - - etss->table_model_pre_change_id = gtk_signal_connect (GTK_OBJECT (source), "model_pre_change", - GTK_SIGNAL_FUNC (etss_proxy_model_pre_change), etss); - etss->table_model_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_changed", - GTK_SIGNAL_FUNC (etss_proxy_model_changed), etss); - etss->table_model_row_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_row_changed", - GTK_SIGNAL_FUNC (etss_proxy_model_row_changed), etss); - etss->table_model_cell_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_cell_changed", - GTK_SIGNAL_FUNC (etss_proxy_model_cell_changed), etss); - etss->table_model_row_inserted_id = gtk_signal_connect (GTK_OBJECT (source), "model_row_inserted", - GTK_SIGNAL_FUNC (etss_proxy_model_row_inserted), etss); - etss->table_model_row_deleted_id = gtk_signal_connect (GTK_OBJECT (source), "model_row_deleted", - GTK_SIGNAL_FUNC (etss_proxy_model_row_deleted), etss); - - return E_TABLE_MODEL (etss); -} - -ETableModel * -e_table_subset_new (ETableModel *source, const int nvals) -{ - ETableSubset *etss = gtk_type_new (E_TABLE_SUBSET_TYPE); - - if (e_table_subset_construct (etss, source, nvals) == NULL){ - gtk_object_unref (GTK_OBJECT (etss)); - return NULL; - } - - return (ETableModel *) etss; -} - -ETableModel * -e_table_subset_get_toplevel (ETableSubset *table) -{ - g_return_val_if_fail (table != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_SUBSET (table), NULL); - - if (E_IS_TABLE_SUBSET (table->source)) - return e_table_subset_get_toplevel (E_TABLE_SUBSET (table->source)); - else - return table->source; -} - -void -e_table_subset_print_debugging (ETableSubset *table_model) -{ - int i; - for (i = 0; i < table_model->n_map; i++) { - g_print("%8d\n", table_model->map_table[i]); - } -} diff --git a/widgets/table/e-table-subset.h b/widgets/table/e-table-subset.h deleted file mode 100644 index 0ab2fa5be7..0000000000 --- a/widgets/table/e-table-subset.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SUBSET_H_ -#define _E_TABLE_SUBSET_H_ - -#include <gtk/gtkobject.h> -#include <gal/e-table/e-table-model.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_TABLE_SUBSET_TYPE (e_table_subset_get_type ()) -#define E_TABLE_SUBSET(o) (GTK_CHECK_CAST ((o), E_TABLE_SUBSET_TYPE, ETableSubset)) -#define E_TABLE_SUBSET_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SUBSET_TYPE, ETableSubsetClass)) -#define E_IS_TABLE_SUBSET(o) (GTK_CHECK_TYPE ((o), E_TABLE_SUBSET_TYPE)) -#define E_IS_TABLE_SUBSET_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SUBSET_TYPE)) - -typedef struct { - ETableModel base; - - ETableModel *source; - int n_map; - int *map_table; - - int last_access; - - int table_model_pre_change_id; - int table_model_changed_id; - int table_model_row_changed_id; - int table_model_cell_changed_id; - int table_model_row_inserted_id; - int table_model_row_deleted_id; -} ETableSubset; - -typedef struct { - ETableModelClass parent_class; - - void (*proxy_model_pre_change) (ETableSubset *etss, ETableModel *etm); - void (*proxy_model_changed) (ETableSubset *etss, ETableModel *etm); - void (*proxy_model_row_changed) (ETableSubset *etss, ETableModel *etm, int row); - void (*proxy_model_cell_changed) (ETableSubset *etss, ETableModel *etm, int col, int row); - void (*proxy_model_row_inserted) (ETableSubset *etss, ETableModel *etm, int row); - void (*proxy_model_row_deleted) (ETableSubset *etss, ETableModel *etm, int row); -} ETableSubsetClass; - -GtkType e_table_subset_get_type (void); -ETableModel *e_table_subset_new (ETableModel *etm, - int n_vals); -ETableModel *e_table_subset_construct (ETableSubset *ets, - ETableModel *source, - int nvals); - -ETableModel *e_table_subset_get_toplevel (ETableSubset *table_model); - -void e_table_subset_print_debugging (ETableSubset *table_model); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TABLE_SUBSET_H_ */ - diff --git a/widgets/table/e-table-tooltip.h b/widgets/table/e-table-tooltip.h deleted file mode 100644 index 3a100af5ab..0000000000 --- a/widgets/table/e-table-tooltip.h +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_TOOLTIP_H_ -#define _E_TABLE_TOOLTIP_H_ - -#include <libgnomeui/gnome-canvas.h> - -BEGIN_GNOME_DECLS - -typedef struct { - GtkWidget *window; - gint timer; - int col, row; - int row_height; - int x, y; - int cx, cy; - GnomeCanvasItem *eti; -} ETableTooltip; - -END_GNOME_DECLS - -#endif diff --git a/widgets/table/e-table-tree.h b/widgets/table/e-table-tree.h deleted file mode 100644 index ab0378473a..0000000000 --- a/widgets/table/e-table-tree.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _E_TABLE_TREE_H_ -#define _E_TABLE_TREE_H_ - -BEGIN_GNOME_DECLS - -typedef struct { - char *title; - - union { - ETableModel *table; - GList *children; - } u; - - guint expanded :1; - guint is_leaf :1; -} ETableGroup; - -ETableGroup *e_table_group_new (const char *title, ETableModel *table); -ETableGroup *e_table_group_new_leaf (const char *title); - -END_GNOME_DECLS - -#endif /* _E_TABLE_TREE_H_ */ diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c deleted file mode 100644 index a740dd8ecd..0000000000 --- a/widgets/table/e-table.c +++ /dev/null @@ -1,2303 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table.c: A graphical view of a Table. - * - * Author: - * Miguel de Icaza (miguel@ximian.com) - * Chris Lahey <clahey@ximian.com> - * - * Copyright 1999, 2000, 2001, Ximian, Inc - */ -#include <config.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <stdio.h> -#include "gal/util/e-i18n.h" -#include <libgnomeui/gnome-canvas.h> -#include <gtk/gtksignal.h> - -#include "gal/util/e-util.h" -#include "gal/widgets/e-canvas.h" -#include "gal/widgets/e-canvas-vbox.h" -#include "e-table.h" -#include "e-table-header-item.h" -#include "e-table-header-utils.h" -#include "e-table-subset.h" -#include "e-table-item.h" -#include "e-table-group.h" -#include "e-table-group-leaf.h" -#include "e-table-click-to-add.h" -#include "e-table-specification.h" -#include "e-table-state.h" -#include "e-table-column-specification.h" - -#define COLUMN_HEADER_HEIGHT 16 - -#define PARENT_TYPE gtk_table_get_type () - -static GtkObjectClass *e_table_parent_class; - -enum { - CURSOR_CHANGE, - CURSOR_ACTIVATED, - SELECTION_CHANGE, - DOUBLE_CLICK, - RIGHT_CLICK, - CLICK, - KEY_PRESS, - - TABLE_DRAG_BEGIN, - TABLE_DRAG_END, - TABLE_DRAG_DATA_GET, - TABLE_DRAG_DATA_DELETE, - - TABLE_DRAG_LEAVE, - TABLE_DRAG_MOTION, - TABLE_DRAG_DROP, - TABLE_DRAG_DATA_RECEIVED, - - LAST_SIGNAL -}; - -enum { - ARG_0, - ARG_LENGTH_THRESHOLD, -}; - -static gint et_signals [LAST_SIGNAL] = { 0, }; - -static void e_table_fill_table (ETable *e_table, ETableModel *model); -static gboolean changed_idle (gpointer data); - -static void et_grab_focus (GtkWidget *widget); - -static void et_drag_begin (GtkWidget *widget, - GdkDragContext *context, - ETable *et); -static void et_drag_end (GtkWidget *widget, - GdkDragContext *context, - ETable *et); -static void et_drag_data_get(GtkWidget *widget, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time, - ETable *et); -static void et_drag_data_delete(GtkWidget *widget, - GdkDragContext *context, - ETable *et); - -static void et_drag_leave(GtkWidget *widget, - GdkDragContext *context, - guint time, - ETable *et); -static gboolean et_drag_motion(GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint time, - ETable *et); -static gboolean et_drag_drop(GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint time, - ETable *et); -static void et_drag_data_received(GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *selection_data, - guint info, - guint time, - ETable *et); -static gint e_table_drag_source_event_cb (GtkWidget *widget, - GdkEvent *event, - ETable *table); - -static gint et_focus (GtkContainer *container, GtkDirectionType direction); - -static void -et_disconnect_model (ETable *et) -{ - if (et->model == NULL) - return; - - if (et->table_model_change_id != 0) - gtk_signal_disconnect (GTK_OBJECT (et->model), - et->table_model_change_id); - if (et->table_row_change_id != 0) - gtk_signal_disconnect (GTK_OBJECT (et->model), - et->table_row_change_id); - if (et->table_cell_change_id != 0) - gtk_signal_disconnect (GTK_OBJECT (et->model), - et->table_cell_change_id); - if (et->table_row_inserted_id != 0) - gtk_signal_disconnect (GTK_OBJECT (et->model), - et->table_row_inserted_id); - if (et->table_row_deleted_id != 0) - gtk_signal_disconnect (GTK_OBJECT (et->model), - et->table_row_deleted_id); - - et->table_model_change_id = 0; - et->table_row_change_id = 0; - et->table_cell_change_id = 0; - et->table_row_inserted_id = 0; - et->table_row_deleted_id = 0; -} - -static void -et_destroy (GtkObject *object) -{ - ETable *et = E_TABLE (object); - - et_disconnect_model (et); - - if (et->group_info_change_id) - gtk_signal_disconnect (GTK_OBJECT (et->sort_info), - et->group_info_change_id); - - if (et->reflow_idle_id) - g_source_remove(et->reflow_idle_id); - et->reflow_idle_id = 0; - - gtk_object_unref (GTK_OBJECT (et->model)); - gtk_object_unref (GTK_OBJECT (et->full_header)); - gtk_object_unref (GTK_OBJECT (et->header)); - gtk_object_unref (GTK_OBJECT (et->sort_info)); - gtk_object_unref (GTK_OBJECT (et->sorter)); - gtk_object_unref (GTK_OBJECT (et->selection)); - if (et->spec) - gtk_object_unref (GTK_OBJECT (et->spec)); - - if (et->header_canvas != NULL) - gtk_widget_destroy (GTK_WIDGET (et->header_canvas)); - - gtk_widget_destroy (GTK_WIDGET (et->table_canvas)); - - if (et->rebuild_idle_id) { - g_source_remove (et->rebuild_idle_id); - et->rebuild_idle_id = 0; - } - - g_free(et->click_to_add_message); - - (*e_table_parent_class->destroy)(object); -} - -static void -e_table_init (GtkObject *object) -{ - ETable *e_table = E_TABLE (object); - GtkTable *gtk_table = GTK_TABLE (object); - - GTK_WIDGET_SET_FLAGS (e_table, GTK_CAN_FOCUS); - - gtk_table->homogeneous = FALSE; - - e_table->sort_info = NULL; - e_table->group_info_change_id = 0; - e_table->reflow_idle_id = 0; - - e_table->draw_grid = 1; - e_table->draw_focus = 1; - e_table->cursor_mode = E_CURSOR_SIMPLE; - e_table->length_threshold = 200; - - e_table->need_rebuild = 0; - e_table->rebuild_idle_id = 0; - - e_table->horizontal_scrolling = FALSE; - - e_table->click_to_add_message = NULL; - - e_table->drag_get_data_row = -1; - e_table->drag_get_data_col = -1; - e_table->drop_row = -1; - e_table->drop_col = -1; - e_table->site = NULL; - e_table->drag_source_button_press_event_id = 0; - e_table->drag_source_motion_notify_event_id = 0; - - e_table->sorter = NULL; - e_table->selection = e_table_selection_model_new(); - e_table->cursor_loc = E_TABLE_CURSOR_LOC_NONE; - e_table->spec = NULL; -} - -/* Grab_focus handler for the ETable */ -static void -et_grab_focus (GtkWidget *widget) -{ - ETable *e_table; - - e_table = E_TABLE (widget); - - gtk_widget_grab_focus (GTK_WIDGET (e_table->table_canvas)); -} - -/* Focus handler for the ETable */ -static gint -et_focus (GtkContainer *container, GtkDirectionType direction) -{ - ETable *e_table; - - e_table = E_TABLE (container); - - if (container->focus_child) { - gtk_container_set_focus_child (container, NULL); - return FALSE; - } - - return gtk_container_focus (GTK_CONTAINER (e_table->table_canvas), direction); -} - -static void -header_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table) -{ - gnome_canvas_set_scroll_region ( - GNOME_CANVAS (e_table->header_canvas), - 0, 0, alloc->width - 1, /* COLUMN_HEADER_HEIGHT - 1 */ - E_TABLE_HEADER_ITEM (e_table->header_item)->height - 1); - - /* When the header item is created ->height == 0, - as the font is only created when everything is realized. - So we set the usize here as well, so that the size of the - header is correct */ - if (GTK_WIDGET (e_table->header_canvas)->allocation.height != - E_TABLE_HEADER_ITEM (e_table->header_item)->height) - gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -1, - E_TABLE_HEADER_ITEM (e_table->header_item)->height); -} - -static void -sort_info_changed (ETableSortInfo *info, ETable *et) -{ - gboolean will_be_grouped = e_table_sort_info_grouping_get_count(info) > 0; - if (et->is_grouped || will_be_grouped) { - et->need_rebuild = TRUE; - if (!et->rebuild_idle_id) - et->rebuild_idle_id = g_idle_add_full (20, changed_idle, et, NULL); - } -} - -static void -e_table_setup_header (ETable *e_table) -{ - char *pointer; - e_table->header_canvas = GNOME_CANVAS (e_canvas_new ()); - GTK_WIDGET_UNSET_FLAGS (e_table->header_canvas, GTK_CAN_FOCUS); - - gtk_widget_show (GTK_WIDGET (e_table->header_canvas)); - - pointer = g_strdup_printf("%p", e_table); - - e_table->header_item = gnome_canvas_item_new ( - gnome_canvas_root (e_table->header_canvas), - e_table_header_item_get_type (), - "ETableHeader", e_table->header, - "full_header", e_table->full_header, - "sort_info", e_table->sort_info, - "dnd_code", pointer, - "table", e_table, - NULL); - - g_free(pointer); - - gtk_signal_connect ( - GTK_OBJECT (e_table->header_canvas), "size_allocate", - GTK_SIGNAL_FUNC (header_canvas_size_allocate), e_table); - - gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -1, - E_TABLE_HEADER_ITEM (e_table->header_item)->height); -} - -static gboolean -table_canvas_reflow_idle (ETable *e_table) -{ - gdouble height, width; - gdouble item_height; - GtkAllocation *alloc = &(GTK_WIDGET (e_table->table_canvas)->allocation); - - gtk_object_get (GTK_OBJECT (e_table->canvas_vbox), - "height", &height, - "width", &width, - NULL); - item_height = height; - height = MAX ((int)height, alloc->height); - width = MAX((int)width, alloc->width); - /* I have no idea why this needs to be -1, but it works. */ - gnome_canvas_set_scroll_region ( - GNOME_CANVAS (e_table->table_canvas), - 0, 0, width - 1, height - 1); - gtk_object_set (GTK_OBJECT (e_table->white_item), - "y1", item_height + 1, - "x2", width, - "y2", height, - NULL); - e_table->reflow_idle_id = 0; - return FALSE; -} - -static void -table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, - ETable *e_table) -{ - gdouble width; - gdouble height; - gdouble item_height; - - width = alloc->width; - gtk_object_get (GTK_OBJECT (e_table->canvas_vbox), - "height", &height, - NULL); - item_height = height; - height = MAX ((int)height, alloc->height); - - gtk_object_set (GTK_OBJECT (e_table->canvas_vbox), - "width", width, - NULL); - gtk_object_set (GTK_OBJECT (e_table->header), - "width", width, - NULL); - gtk_object_set (GTK_OBJECT (e_table->white_item), - "y1", item_height + 1, - "x2", width, - "y2", height, - NULL); - if (e_table->reflow_idle_id) - g_source_remove(e_table->reflow_idle_id); - table_canvas_reflow_idle(e_table); -} - -static void -table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table) -{ - if (!e_table->reflow_idle_id) - e_table->reflow_idle_id = g_idle_add_full (400, (GSourceFunc) table_canvas_reflow_idle, e_table, NULL); -} - -static void -click_to_add_cursor_change (ETableClickToAdd *etcta, int row, int col, ETable *et) -{ - if (et->cursor_loc == E_TABLE_CURSOR_LOC_TABLE) { - e_selection_model_clear(E_SELECTION_MODEL (et->selection)); - } - et->cursor_loc = E_TABLE_CURSOR_LOC_ETCTA; -} - -static void -group_cursor_change (ETableGroup *etg, int row, ETable *et) -{ - if (et->cursor_loc == E_TABLE_CURSOR_LOC_ETCTA && et->click_to_add) { - e_table_click_to_add_commit(E_TABLE_CLICK_TO_ADD(et->click_to_add)); - } - et->cursor_loc = E_TABLE_CURSOR_LOC_TABLE; - gtk_signal_emit (GTK_OBJECT (et), - et_signals [CURSOR_CHANGE], - row); -} - -static void -group_cursor_activated (ETableGroup *etg, int row, ETable *et) -{ - gtk_signal_emit (GTK_OBJECT (et), - et_signals [CURSOR_ACTIVATED], - row); -} - -static void -group_double_click (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et) -{ - gtk_signal_emit (GTK_OBJECT (et), - et_signals [DOUBLE_CLICK], - row, col, event); -} - -static gint -group_right_click (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et) -{ - int return_val = 0; - gtk_signal_emit (GTK_OBJECT (et), - et_signals [RIGHT_CLICK], - row, col, event, &return_val); - return return_val; -} - -static gint -group_click (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et) -{ - int return_val = 0; - gtk_signal_emit (GTK_OBJECT (et), - et_signals [CLICK], - row, col, event, &return_val); - return return_val; -} - -static gint -group_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et) -{ - int return_val = 0; - GdkEventKey *key = (GdkEventKey *) event; - GdkEventButton click; - switch (key->keyval) { - case GDK_Page_Down: - gtk_adjustment_set_value( - gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas)), - CLAMP(gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->value + - (gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size - 20), - 0, - gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->upper - - gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size)); - click.type = GDK_BUTTON_PRESS; - click.window = GTK_LAYOUT (et->table_canvas)->bin_window; - click.send_event = key->send_event; - click.time = key->time; - click.x = 30; - click.y = gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size - 1; - click.state = key->state; - click.button = 1; - gtk_widget_event(GTK_WIDGET(et->table_canvas), - (GdkEvent *) &click); - return_val = 1; - break; - case GDK_Page_Up: - gtk_adjustment_set_value( - gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas)), - gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->value - - (gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size - 20)); - click.type = GDK_BUTTON_PRESS; - click.window = GTK_LAYOUT (et->table_canvas)->bin_window; - click.send_event = key->send_event; - click.time = key->time; - click.x = 30; - click.y = 1; - click.state = key->state; - click.button = 1; - gtk_widget_event(GTK_WIDGET(et->table_canvas), - (GdkEvent *) &click); - return_val = 1; - break; - default: - gtk_signal_emit (GTK_OBJECT (et), - et_signals [KEY_PRESS], - row, col, event, &return_val); - break; - } - return return_val; -} - -static void -et_table_model_changed (ETableModel *model, ETable *et) -{ - et->need_rebuild = TRUE; - if (!et->rebuild_idle_id) - et->rebuild_idle_id = g_idle_add_full (20, changed_idle, et, NULL); -} - -static void -et_table_row_changed (ETableModel *table_model, int row, ETable *et) -{ - if (!et->need_rebuild) { - if (e_table_group_remove (et->group, row)) - e_table_group_add (et->group, row); - if (et->horizontal_scrolling) - e_table_header_update_horizontal(et->header); - } -} - -static void -et_table_cell_changed (ETableModel *table_model, int view_col, int row, ETable *et) -{ - et_table_row_changed (table_model, row, et); -} - -static void -et_table_row_inserted (ETableModel *table_model, int row, ETable *et) -{ - /* This number has already been decremented. */ - int row_count = e_table_model_row_count(table_model); - if (!et->need_rebuild) { - if (row != row_count - 1) - e_table_group_increment(et->group, row, 1); - e_table_group_add (et->group, row); - if (et->horizontal_scrolling) - e_table_header_update_horizontal(et->header); - } -} - -static void -et_table_row_deleted (ETableModel *table_model, int row, ETable *et) -{ - int row_count = e_table_model_row_count(table_model); - if (!et->need_rebuild) { - e_table_group_remove (et->group, row); - if (row != row_count) - e_table_group_decrement(et->group, row, 1); - if (et->horizontal_scrolling) - e_table_header_update_horizontal(et->header); - } -} - -static void -et_build_groups (ETable *et) -{ - gboolean was_grouped = et->is_grouped; - - et->is_grouped = e_table_sort_info_grouping_get_count(et->sort_info) > 0; - - et->group = e_table_group_new (GNOME_CANVAS_GROUP (et->canvas_vbox), - et->full_header, - et->header, - et->model, - et->sort_info, - 0); - e_canvas_vbox_add_item(E_CANVAS_VBOX(et->canvas_vbox), GNOME_CANVAS_ITEM(et->group)); - gnome_canvas_item_set(GNOME_CANVAS_ITEM(et->group), - "drawgrid", et->draw_grid, - "drawfocus", et->draw_focus, - "cursor_mode", et->cursor_mode, - "length_threshold", et->length_threshold, - "table_selection_model", et->selection, - NULL); - - gtk_signal_connect (GTK_OBJECT (et->group), "cursor_change", - GTK_SIGNAL_FUNC (group_cursor_change), et); - gtk_signal_connect (GTK_OBJECT (et->group), "cursor_activated", - GTK_SIGNAL_FUNC (group_cursor_activated), et); - gtk_signal_connect (GTK_OBJECT (et->group), "double_click", - GTK_SIGNAL_FUNC (group_double_click), et); - gtk_signal_connect (GTK_OBJECT (et->group), "right_click", - GTK_SIGNAL_FUNC (group_right_click), et); - gtk_signal_connect (GTK_OBJECT (et->group), "click", - GTK_SIGNAL_FUNC (group_click), et); - gtk_signal_connect (GTK_OBJECT (et->group), "key_press", - GTK_SIGNAL_FUNC (group_key_press), et); - - - if (!(et->is_grouped) && was_grouped) - et_disconnect_model (et); - - if (et->is_grouped && (!was_grouped)) { - et->table_model_change_id = gtk_signal_connect (GTK_OBJECT (et->model), "model_changed", - GTK_SIGNAL_FUNC (et_table_model_changed), et); - - et->table_row_change_id = gtk_signal_connect (GTK_OBJECT (et->model), "model_row_changed", - GTK_SIGNAL_FUNC (et_table_row_changed), et); - - et->table_cell_change_id = gtk_signal_connect (GTK_OBJECT (et->model), "model_cell_changed", - GTK_SIGNAL_FUNC (et_table_cell_changed), et); - - et->table_row_inserted_id = gtk_signal_connect (GTK_OBJECT (et->model), "model_row_inserted", - GTK_SIGNAL_FUNC (et_table_row_inserted), et); - - et->table_row_deleted_id = gtk_signal_connect (GTK_OBJECT (et->model), "model_row_deleted", - GTK_SIGNAL_FUNC (et_table_row_deleted), et); - - } - - if (et->is_grouped) - e_table_fill_table (et, et->model); -} - -static gboolean -changed_idle (gpointer data) -{ - ETable *et = E_TABLE (data); - - if (et->need_rebuild) { - gtk_object_destroy (GTK_OBJECT (et->group)); - et_build_groups(et); - gtk_object_set (GTK_OBJECT (et->canvas_vbox), - "width", (double) GTK_WIDGET (et->table_canvas)->allocation.width, - NULL); - - if (GTK_WIDGET_REALIZED(et->table_canvas)) - table_canvas_size_allocate (GTK_WIDGET(et->table_canvas), >K_WIDGET(et->table_canvas)->allocation, et); - } - - et->need_rebuild = 0; - et->rebuild_idle_id = 0; - - if (et->horizontal_scrolling) - e_table_header_update_horizontal(et->header); - - return FALSE; -} - -static void -et_canvas_realize (GtkWidget *canvas, ETable *e_table) -{ - gnome_canvas_item_set( - e_table->white_item, - "fill_color_gdk", >K_WIDGET(e_table->table_canvas)->style->base[GTK_STATE_NORMAL], - NULL); -} - -static void -et_canvas_button_press (GtkWidget *canvas, GdkEvent *event, ETable *e_table) -{ - if (GTK_WIDGET_HAS_FOCUS(canvas)) { - GnomeCanvasItem *item = GNOME_CANVAS(canvas)->focused_item; - - if (E_IS_TABLE_ITEM(item)) { - e_table_item_leave_edit(E_TABLE_ITEM(item)); - } - } -} - -static void -e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *header, - ETableModel *model) -{ - e_table->table_canvas = GNOME_CANVAS (e_canvas_new ()); - gtk_signal_connect ( - GTK_OBJECT (e_table->table_canvas), "size_allocate", - GTK_SIGNAL_FUNC (table_canvas_size_allocate), e_table); - gtk_signal_connect ( - GTK_OBJECT (e_table->table_canvas), "focus_in_event", - GTK_SIGNAL_FUNC (gtk_widget_queue_draw), e_table); - gtk_signal_connect ( - GTK_OBJECT (e_table->table_canvas), "focus_out_event", - GTK_SIGNAL_FUNC (gtk_widget_queue_draw), e_table); - - gtk_signal_connect ( - GTK_OBJECT (e_table), "drag_begin", - GTK_SIGNAL_FUNC (et_drag_begin), e_table); - gtk_signal_connect ( - GTK_OBJECT (e_table), "drag_end", - GTK_SIGNAL_FUNC (et_drag_end), e_table); - gtk_signal_connect ( - GTK_OBJECT (e_table), "drag_data_get", - GTK_SIGNAL_FUNC (et_drag_data_get), e_table); - gtk_signal_connect ( - GTK_OBJECT (e_table), "drag_data_delete", - GTK_SIGNAL_FUNC (et_drag_data_delete), e_table); - gtk_signal_connect ( - GTK_OBJECT (e_table), "drag_motion", - GTK_SIGNAL_FUNC (et_drag_motion), e_table); - gtk_signal_connect ( - GTK_OBJECT (e_table), "drag_leave", - GTK_SIGNAL_FUNC (et_drag_leave), e_table); - gtk_signal_connect ( - GTK_OBJECT (e_table), "drag_drop", - GTK_SIGNAL_FUNC (et_drag_drop), e_table); - gtk_signal_connect ( - GTK_OBJECT (e_table), "drag_data_received", - GTK_SIGNAL_FUNC (et_drag_data_received), e_table); - - gtk_signal_connect (GTK_OBJECT(e_table->table_canvas), "reflow", - GTK_SIGNAL_FUNC (table_canvas_reflow), e_table); - - gtk_widget_show (GTK_WIDGET (e_table->table_canvas)); - - - e_table->white_item = gnome_canvas_item_new( - gnome_canvas_root(e_table->table_canvas), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color_gdk", >K_WIDGET(e_table->table_canvas)->style->base[GTK_STATE_NORMAL], - NULL); - - gtk_signal_connect ( - GTK_OBJECT(e_table->table_canvas), "realize", - GTK_SIGNAL_FUNC(et_canvas_realize), e_table); - gtk_signal_connect ( - GTK_OBJECT(e_table->table_canvas), "button_press_event", - GTK_SIGNAL_FUNC(et_canvas_button_press), e_table); - e_table->canvas_vbox = gnome_canvas_item_new( - gnome_canvas_root(e_table->table_canvas), - e_canvas_vbox_get_type(), - "spacing", 10.0, - NULL); - - if (e_table->use_click_to_add) { - e_table->click_to_add = gnome_canvas_item_new ( - GNOME_CANVAS_GROUP(e_table->canvas_vbox), - e_table_click_to_add_get_type (), - "header", e_table->header, - "model", e_table->model, - "message", e_table->click_to_add_message, - NULL); - - e_canvas_vbox_add_item ( - E_CANVAS_VBOX(e_table->canvas_vbox), - e_table->click_to_add); - gtk_signal_connect ( - GTK_OBJECT (e_table->click_to_add), "cursor_change", - GTK_SIGNAL_FUNC(click_to_add_cursor_change), e_table); - } - - et_build_groups(e_table); -} - -static void -e_table_fill_table (ETable *e_table, ETableModel *model) -{ - e_table_group_add_all (e_table->group); -} - -static ETableCol * -et_col_spec_to_col (ETable *e_table, - ETableColumnSpecification *col_spec, - ETableExtras *ete) -{ - ETableCol *col = NULL; - ECell *cell; - GCompareFunc compare; - - cell = e_table_extras_get_cell(ete, col_spec->cell); - compare = e_table_extras_get_compare(ete, col_spec->compare); - - if (cell && compare) { - if (col_spec->pixbuf && *col_spec->pixbuf) { - GdkPixbuf *pixbuf; - - pixbuf = e_table_extras_get_pixbuf( - ete, col_spec->pixbuf); - if (pixbuf) { - col = e_table_col_new_with_pixbuf ( - col_spec->model_col, gettext (col_spec->title), - pixbuf, col_spec->expansion, - col_spec->minimum_width, - cell, compare, col_spec->resizable); - } - } - if (col == NULL && col_spec->title && *col_spec->title) { - col = e_table_col_new ( - col_spec->model_col, gettext (col_spec->title), - col_spec->expansion, col_spec->minimum_width, - cell, compare, col_spec->resizable); - } - } - return col; -} - -static ETableHeader * -et_spec_to_full_header (ETable *e_table, - ETableSpecification *spec, - ETableExtras *ete) -{ - ETableHeader *nh; - int column; - - g_return_val_if_fail (e_table, NULL); - g_return_val_if_fail (spec, NULL); - g_return_val_if_fail (ete, NULL); - - nh = e_table_header_new (); - - for (column = 0; spec->columns[column]; column++) { - ETableCol *col = et_col_spec_to_col ( - e_table, spec->columns[column], ete); - - if (col) - e_table_header_add_column (nh, col, -1); - } - - return nh; -} - -static ETableHeader * -et_state_to_header (ETable *e_table, ETableHeader *full_header, ETableState *state) -{ - ETableHeader *nh; - const int max_cols = e_table_header_count (full_header); - int column; - - g_return_val_if_fail (e_table, NULL); - g_return_val_if_fail (full_header, NULL); - g_return_val_if_fail (state, NULL); - - nh = e_table_header_new (); - - gtk_object_set(GTK_OBJECT(nh), - "width_extras", e_table_header_width_extras(GTK_WIDGET(e_table)->style), - NULL); - - for (column = 0; column < state->col_count; column++) { - int col; - double expansion; - ETableCol *table_col; - - col = state->columns[column]; - expansion = state->expansions[column]; - - if (col >= max_cols) - continue; - - table_col = e_table_header_get_column (full_header, col); - - if (expansion >= -1) - table_col->expansion = expansion; - - e_table_header_add_column (nh, table_col, -1); - } - - return nh; -} - -void -e_table_set_state_object(ETable *e_table, ETableState *state) -{ - if (e_table->header) - gtk_object_unref(GTK_OBJECT(e_table->header)); - e_table->header = et_state_to_header (e_table, e_table->full_header, state); - if (e_table->header) - gtk_object_ref(GTK_OBJECT(e_table->header)); - - if (e_table->sort_info) { - if (e_table->group_info_change_id) - gtk_signal_disconnect (GTK_OBJECT (e_table->sort_info), - e_table->group_info_change_id); - gtk_object_unref(GTK_OBJECT(e_table->sort_info)); - } - if (state->sort_info) { - e_table->sort_info = e_table_sort_info_duplicate(state->sort_info); - e_table->group_info_change_id = - gtk_signal_connect (GTK_OBJECT (e_table->sort_info), - "group_info_changed", - GTK_SIGNAL_FUNC (sort_info_changed), - e_table); - } - else - e_table->sort_info = NULL; - - if (e_table->sorter) - gtk_object_set(GTK_OBJECT(e_table->sorter), - "sort_info", e_table->sort_info, - NULL); - if (e_table->header_item) - gtk_object_set(GTK_OBJECT(e_table->header_item), - "ETableHeader", e_table->header, - "sort_info", e_table->sort_info, - NULL); - if (e_table->click_to_add) - gtk_object_set(GTK_OBJECT(e_table->click_to_add), - "header", e_table->header, - NULL); - - e_table->need_rebuild = TRUE; - if (!e_table->rebuild_idle_id) - e_table->rebuild_idle_id = g_idle_add_full (20, changed_idle, e_table, NULL); -} - -/** - * e_table_set_state: - * @e_table: %ETable object that will be modified - * @state_str: a string with the XML representation of the ETableState. - * - * This routine sets the state (as described by %ETableState) of the - * %ETable object. - */ -void -e_table_set_state (ETable *e_table, - const gchar *state_str) -{ - ETableState *state; - - g_return_if_fail(e_table != NULL); - g_return_if_fail(E_IS_TABLE(e_table)); - g_return_if_fail(state_str != NULL); - - state = e_table_state_new(); - e_table_state_load_from_string(state, state_str); - - if (state->col_count > 0) - e_table_set_state_object(e_table, state); - - gtk_object_unref(GTK_OBJECT(state)); -} - -/** - * e_table_load_state: - * @e_table: %ETable object that will be modified - * @filename: name of the file containing the state to be loaded into the %ETable - * - * An %ETableState will be loaded form the file pointed by @filename into the - * @e_table object. - */ -void -e_table_load_state (ETable *e_table, - const gchar *filename) -{ - ETableState *state; - - g_return_if_fail(e_table != NULL); - g_return_if_fail(E_IS_TABLE(e_table)); - g_return_if_fail(filename != NULL); - - state = e_table_state_new(); - e_table_state_load_from_file(state, filename); - - if (state->col_count > 0) - e_table_set_state_object(e_table, state); - - gtk_object_unref(GTK_OBJECT(state)); -} - -/** - * e_table_get_state_object: - * @e_table: %ETable object that will be modified - * - * Returns: the %ETableState object that encapsulates the current - * state of the @e_table object - */ -ETableState * -e_table_get_state_object (ETable *e_table) -{ - ETableState *state; - int full_col_count; - int i, j; - - state = e_table_state_new(); - state->sort_info = e_table->sort_info; - gtk_object_ref(GTK_OBJECT(state->sort_info)); - - - state->col_count = e_table_header_count (e_table->header); - full_col_count = e_table_header_count (e_table->full_header); - state->columns = g_new(int, state->col_count); - state->expansions = g_new(double, state->col_count); - for (i = 0; i < state->col_count; i++) { - ETableCol *col = e_table_header_get_column(e_table->header, i); - state->columns[i] = -1; - for (j = 0; j < full_col_count; j++) { - if (col->col_idx == e_table_header_index(e_table->full_header, j)) { - state->columns[i] = j; - break; - } - } - state->expansions[i] = col->expansion; - } - - return state; -} - -gchar *e_table_get_state (ETable *e_table) -{ - ETableState *state; - gchar *string; - - state = e_table_get_state_object(e_table); - string = e_table_state_save_to_string(state); - gtk_object_unref(GTK_OBJECT(state)); - return string; -} - -/** - * e_table_save_state: - * @e_table: %ETable object that will be modified - * @filename: name of the file containing the state to be loaded into the %ETable - * - * This routine saves the state of the @e_table object into the file pointed - * by @filename - */ -void -e_table_save_state (ETable *e_table, - const gchar *filename) -{ - ETableState *state; - - state = e_table_get_state_object(e_table); - e_table_state_save_to_file(state, filename); - gtk_object_unref(GTK_OBJECT(state)); -} - -static void -et_selection_model_selection_change (ETableGroup *etg, ETable *et) -{ - gtk_signal_emit (GTK_OBJECT (et), - et_signals [SELECTION_CHANGE]); -} - -static ETable * -et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, - ETableSpecification *specification, ETableState *state) -{ - int row = 0; - - if (ete) - gtk_object_ref(GTK_OBJECT(ete)); - else - ete = e_table_extras_new(); - - e_table->use_click_to_add = specification->click_to_add; - e_table->click_to_add_message = g_strdup (gettext (specification->click_to_add_message)); - e_table->draw_grid = specification->draw_grid; - e_table->draw_focus = specification->draw_focus; - e_table->cursor_mode = specification->cursor_mode; - e_table->full_header = et_spec_to_full_header(e_table, specification, ete); - - gtk_object_set(GTK_OBJECT(e_table->selection), - "selection_mode", specification->selection_mode, - "cursor_mode", specification->cursor_mode, - NULL); - - e_table->model = etm; - gtk_object_ref (GTK_OBJECT (etm)); - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - e_table->header = et_state_to_header (e_table, e_table->full_header, state); - e_table->horizontal_scrolling = specification->horizontal_scrolling; - - e_table->sort_info = state->sort_info; - - e_table->group_info_change_id = - gtk_signal_connect (GTK_OBJECT (e_table->sort_info), "group_info_changed", - GTK_SIGNAL_FUNC (sort_info_changed), e_table); - - - gtk_object_set(GTK_OBJECT(e_table->header), - "sort_info", e_table->sort_info, - NULL); - - e_table->sorter = e_table_sorter_new(etm, e_table->full_header, e_table->sort_info); - - gtk_object_set (GTK_OBJECT (e_table->selection), - "model", etm, - "sorter", e_table->sorter, - NULL); - - gtk_signal_connect(GTK_OBJECT(e_table->selection), "selection_changed", - GTK_SIGNAL_FUNC(et_selection_model_selection_change), e_table); - - if (!specification->no_headers) { - e_table_setup_header (e_table); - } - e_table_setup_table (e_table, e_table->full_header, e_table->header, etm); - e_table_fill_table (e_table, etm); - - gtk_layout_get_vadjustment (GTK_LAYOUT (e_table->table_canvas))->step_increment = 20; - gtk_adjustment_changed(gtk_layout_get_vadjustment (GTK_LAYOUT (e_table->table_canvas))); - - if (!specification->no_headers) { - /* - * The header - */ - gtk_table_attach (GTK_TABLE (e_table), GTK_WIDGET (e_table->header_canvas), - 0, 1, 0 + row, 1 + row, - GTK_FILL | GTK_EXPAND, - GTK_FILL, 0, 0); - row ++; - } - gtk_table_attach (GTK_TABLE (e_table), GTK_WIDGET (e_table->table_canvas), - 0, 1, 0 + row, 1 + row, - GTK_FILL | GTK_EXPAND, - GTK_FILL | GTK_EXPAND, - 0, 0); - - gtk_widget_pop_colormap (); - gtk_widget_pop_visual (); - - gtk_object_unref(GTK_OBJECT(ete)); - - return e_table; -} - -ETable * -e_table_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, - const char *spec_str, const char *state_str) -{ - ETableSpecification *specification; - ETableState *state; - - g_return_val_if_fail(e_table != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE(e_table), NULL); - g_return_val_if_fail(etm != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL); - g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); - g_return_val_if_fail(spec_str != NULL, NULL); - - specification = e_table_specification_new(); - e_table_specification_load_from_string(specification, spec_str); - if (state_str) { - state = e_table_state_new(); - e_table_state_load_from_string(state, state_str); - if (state->col_count <= 0) { - gtk_object_unref(GTK_OBJECT(state)); - state = specification->state; - gtk_object_ref(GTK_OBJECT(state)); - } - } else { - state = specification->state; - gtk_object_ref(GTK_OBJECT(state)); - } - - e_table = et_real_construct (e_table, etm, ete, specification, state); - - e_table->spec = specification; - gtk_object_unref(GTK_OBJECT(state)); - - return e_table; -} - -ETable * -e_table_construct_from_spec_file (ETable *e_table, ETableModel *etm, ETableExtras *ete, - const char *spec_fn, const char *state_fn) -{ - ETableSpecification *specification; - ETableState *state; - - g_return_val_if_fail(e_table != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE(e_table), NULL); - g_return_val_if_fail(etm != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL); - g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); - g_return_val_if_fail(spec_fn != NULL, NULL); - - specification = e_table_specification_new(); - if (!e_table_specification_load_from_file(specification, spec_fn)) { - gtk_object_unref(GTK_OBJECT(specification)); - return NULL; - } - - if (state_fn) { - state = e_table_state_new(); - if (!e_table_state_load_from_file(state, state_fn)) { - gtk_object_unref(GTK_OBJECT(state)); - state = specification->state; - gtk_object_ref(GTK_OBJECT(state)); - } - if (state->col_count <= 0) { - gtk_object_unref(GTK_OBJECT(state)); - state = specification->state; - gtk_object_ref(GTK_OBJECT(state)); - } - } else { - state = specification->state; - gtk_object_ref(GTK_OBJECT(state)); - } - - e_table = et_real_construct (e_table, etm, ete, specification, state); - - e_table->spec = specification; - gtk_object_unref(GTK_OBJECT(state)); - - return e_table; -} - -GtkWidget * -e_table_new (ETableModel *etm, ETableExtras *ete, const char *spec, const char *state) -{ - ETable *e_table; - - g_return_val_if_fail(etm != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL); - g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); - g_return_val_if_fail(spec != NULL, NULL); - - e_table = gtk_type_new (e_table_get_type ()); - - e_table = e_table_construct (e_table, etm, ete, spec, state); - - return GTK_WIDGET (e_table); -} - -GtkWidget * -e_table_new_from_spec_file (ETableModel *etm, ETableExtras *ete, const char *spec_fn, const char *state_fn) -{ - ETable *e_table; - - g_return_val_if_fail(etm != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL); - g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); - g_return_val_if_fail(spec_fn != NULL, NULL); - - e_table = gtk_type_new (e_table_get_type ()); - - e_table = e_table_construct_from_spec_file (e_table, etm, ete, spec_fn, state_fn); - - return GTK_WIDGET (e_table); -} - -#if 0 -static xmlNode * -et_build_column_spec (ETable *e_table) -{ - xmlNode *columns_shown; - gint i; - gint col_count; - - columns_shown = xmlNewNode (NULL, "columns-shown"); - - col_count = e_table_header_count (e_table->header); - for (i = 0; i < col_count; i++){ - gchar *text = g_strdup_printf ("%d", e_table_header_index(e_table->header, i)); - xmlNewChild (columns_shown, NULL, "column", text); - g_free (text); - } - - return columns_shown; -} - -static xmlNode * -et_build_grouping_spec (ETable *e_table) -{ - xmlNode *node; - xmlNode *grouping; - int i; - const int sort_count = e_table_sort_info_sorting_get_count (e_table->sort_info); - const int group_count = e_table_sort_info_grouping_get_count (e_table->sort_info); - - grouping = xmlNewNode (NULL, "grouping"); - node = grouping; - - for (i = 0; i < group_count; i++) { - ETableSortColumn column = e_table_sort_info_grouping_get_nth(e_table->sort_info, i); - xmlNode *new_node = xmlNewChild(node, NULL, "group", NULL); - - e_xml_set_integer_prop_by_name (new_node, "column", column.column); - e_xml_set_integer_prop_by_name (new_node, "ascending", column.ascending); - node = new_node; - } - - for (i = 0; i < sort_count; i++) { - ETableSortColumn column = e_table_sort_info_sorting_get_nth(e_table->sort_info, i); - xmlNode *new_node = xmlNewChild(node, NULL, "leaf", NULL); - - e_xml_set_integer_prop_by_name (new_node, "column", column.column); - e_xml_set_integer_prop_by_name (new_node, "ascending", column.ascending); - node = new_node; - } - - return grouping; -} - -static xmlDoc * -et_build_tree (ETable *e_table) -{ - xmlDoc *doc; - xmlNode *root; - - doc = xmlNewDoc ("1.0"); - if (doc == NULL) - return NULL; - - root = xmlNewDocNode (doc, NULL, "ETableSpecification", NULL); - xmlDocSetRootElement (doc, root); - xmlAddChild (root, et_build_column_spec (e_table)); - xmlAddChild (root, et_build_grouping_spec (e_table)); - - return doc; -} - -gchar * -e_table_get_specification (ETable *e_table) -{ - xmlDoc *doc; - xmlChar *buffer; - gint size; - - g_return_val_if_fail(e_table != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE(e_table), NULL); - - doc = et_build_tree (e_table); - xmlDocDumpMemory (doc, &buffer, &size); - xmlFreeDoc (doc); - - return buffer; -} - -int -e_table_set_specification (ETable *e_table, const char *spec) -{ - xmlDoc *xmlSpec; - int ret; - - g_return_val_if_fail(e_table != NULL, -1); - g_return_val_if_fail(E_IS_TABLE(e_table), -1); - g_return_val_if_fail(spec != NULL, -1); - - /* doesn't work yet, sigh */ - xmlSpec = xmlParseMemory ((char *)spec, strlen(spec)); - ret = et_real_set_specification(e_table, xmlSpec); - xmlFreeDoc (xmlSpec); - - return ret; -} - -void -e_table_save_specification (ETable *e_table, gchar *filename) -{ - xmlDoc *doc = et_build_tree (e_table); - - g_return_if_fail(e_table != NULL); - g_return_if_fail(E_IS_TABLE(e_table)); - g_return_if_fail(filename != NULL); - - xmlSaveFile (filename, doc); - xmlFreeDoc (doc); -} - -int -e_table_load_specification (ETable *e_table, gchar *filename) -{ - xmlDoc *xmlSpec; - int ret; - - g_return_val_if_fail(e_table != NULL, -1); - g_return_val_if_fail(E_IS_TABLE(e_table), -1); - g_return_val_if_fail(filename != NULL, -1); - - /* doesn't work yet, yay */ - xmlSpec = xmlParseFile (filename); - ret = et_real_set_specification(e_table, xmlSpec); - xmlFreeDoc (xmlSpec); - - return ret; -} -#endif - -void -e_table_set_cursor_row (ETable *e_table, int row) -{ - g_return_if_fail(e_table != NULL); - g_return_if_fail(E_IS_TABLE(e_table)); - g_return_if_fail(row >= 0); - - gtk_object_set(GTK_OBJECT(e_table->selection), - "cursor_row", row, - NULL); -} - -int -e_table_get_cursor_row (ETable *e_table) -{ - int row; - g_return_val_if_fail(e_table != NULL, -1); - g_return_val_if_fail(E_IS_TABLE(e_table), -1); - - gtk_object_get(GTK_OBJECT(e_table->selection), - "cursor_row", &row, - NULL); - return row; -} - -void -e_table_selected_row_foreach (ETable *e_table, - EForeachFunc callback, - gpointer closure) -{ - g_return_if_fail(e_table != NULL); - g_return_if_fail(E_IS_TABLE(e_table)); - - e_selection_model_foreach(E_SELECTION_MODEL (e_table->selection), - callback, - closure); -} - -gint -e_table_selected_count (ETable *e_table) -{ - g_return_val_if_fail(e_table != NULL, -1); - g_return_val_if_fail(E_IS_TABLE(e_table), -1); - - return e_selection_model_selected_count(E_SELECTION_MODEL (e_table->selection)); -} - -void -e_table_select_all (ETable *table) -{ - g_return_if_fail (table != NULL); - g_return_if_fail (E_IS_TABLE (table)); - - e_selection_model_select_all (E_SELECTION_MODEL (table->selection)); -} - -void -e_table_invert_selection (ETable *table) -{ - g_return_if_fail (table != NULL); - g_return_if_fail (E_IS_TABLE (table)); - - e_selection_model_invert_selection (E_SELECTION_MODEL (table->selection)); -} - - -EPrintable * -e_table_get_printable (ETable *e_table) -{ - g_return_val_if_fail(e_table != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE(e_table), NULL); - - return e_table_group_get_printable(e_table->group); -} - -static void -et_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - switch (arg_id){ - default: - break; - } -} - -typedef struct { - char *arg; - gboolean setting; -} bool_closure; - -static void -et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ETable *etable = E_TABLE (o); - - switch (arg_id){ - case ARG_LENGTH_THRESHOLD: - etable->length_threshold = GTK_VALUE_INT (*arg); - if (etable->group) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM(etable->group), - "length_threshold", GTK_VALUE_INT (*arg), - NULL); - } - break; - - } -} - -static void -set_scroll_adjustments (ETable *table, - GtkAdjustment *hadjustment, - GtkAdjustment *vadjustment) -{ - if (vadjustment != NULL) { - vadjustment->step_increment = 20; - gtk_adjustment_changed(vadjustment); - } - - gtk_layout_set_hadjustment (GTK_LAYOUT(table->table_canvas), - hadjustment); - gtk_layout_set_vadjustment (GTK_LAYOUT(table->table_canvas), - vadjustment); - - if (table->header_canvas != NULL) - gtk_layout_set_hadjustment (GTK_LAYOUT(table->header_canvas), - hadjustment); -} - -gint -e_table_get_next_row (ETable *e_table, - gint model_row) -{ - g_return_val_if_fail(e_table != NULL, -1); - g_return_val_if_fail(E_IS_TABLE(e_table), -1); - - if (e_table->sorter) { - int i; - i = e_sorter_model_to_sorted(E_SORTER (e_table->sorter), model_row); - i++; - if (i < e_table_model_row_count(e_table->model)) { - return e_sorter_sorted_to_model(E_SORTER (e_table->sorter), i); - } else - return -1; - } else - if (model_row < e_table_model_row_count(e_table->model) - 1) - return model_row + 1; - else - return -1; -} - -gint -e_table_get_prev_row (ETable *e_table, - gint model_row) -{ - g_return_val_if_fail(e_table != NULL, -1); - g_return_val_if_fail(E_IS_TABLE(e_table), -1); - - if (e_table->sorter) { - int i; - i = e_sorter_model_to_sorted(E_SORTER (e_table->sorter), model_row); - i--; - if (i >= 0) - return e_sorter_sorted_to_model(E_SORTER (e_table->sorter), i); - else - return -1; - } else - return model_row - 1; -} - -gint -e_table_model_to_view_row (ETable *e_table, - gint model_row) -{ - g_return_val_if_fail(e_table != NULL, -1); - g_return_val_if_fail(E_IS_TABLE(e_table), -1); - - if (e_table->sorter) - return e_sorter_model_to_sorted(E_SORTER (e_table->sorter), model_row); - else - return model_row; -} - -gint -e_table_view_to_model_row (ETable *e_table, - gint view_row) -{ - g_return_val_if_fail(e_table != NULL, -1); - g_return_val_if_fail(E_IS_TABLE(e_table), -1); - - if (e_table->sorter) - return e_sorter_sorted_to_model (E_SORTER (e_table->sorter), view_row); - else - return view_row; -} - -/** - * e_table_get_cell_at: - * @table: An ETable widget - * @x: X coordinate for the pixel - * @y: Y coordinate for the pixel - * @row_return: Pointer to return the row value - * @col_return: Pointer to return the column value - * - * Return the row and column for the cell in which the pixel at (@x, @y) is - * contained. - **/ -void -e_table_get_cell_at (ETable *table, - int x, int y, - int *row_return, int *col_return) -{ - g_return_if_fail (table != NULL); - g_return_if_fail (E_IS_TABLE (table)); - g_return_if_fail (row_return != NULL); - g_return_if_fail (col_return != NULL); - - /* FIXME it would be nice if it could handle a NULL row_return or - * col_return gracefully. */ - - x += GTK_LAYOUT(table->table_canvas)->hadjustment->value; - y += GTK_LAYOUT(table->table_canvas)->vadjustment->value; - e_table_group_compute_location(table->group, &x, &y, row_return, col_return); -} - -struct _ETableDragSourceSite -{ - GdkModifierType start_button_mask; - GtkTargetList *target_list; /* Targets for drag data */ - GdkDragAction actions; /* Possible actions */ - GdkColormap *colormap; /* Colormap for drag icon */ - GdkPixmap *pixmap; /* Icon for drag data */ - GdkBitmap *mask; - - /* Stored button press information to detect drag beginning */ - gint state; - gint x, y; - gint row, col; -}; - -typedef enum -{ - GTK_DRAG_STATUS_DRAG, - GTK_DRAG_STATUS_WAIT, - GTK_DRAG_STATUS_DROP -} GtkDragStatus; - -typedef struct _GtkDragDestInfo GtkDragDestInfo; -typedef struct _GtkDragSourceInfo GtkDragSourceInfo; - -struct _GtkDragDestInfo -{ - GtkWidget *widget; /* Widget in which drag is in */ - GdkDragContext *context; /* Drag context */ - GtkDragSourceInfo *proxy_source; /* Set if this is a proxy drag */ - GtkSelectionData *proxy_data; /* Set while retrieving proxied data */ - gboolean dropped : 1; /* Set after we receive a drop */ - guint32 proxy_drop_time; /* Timestamp for proxied drop */ - gboolean proxy_drop_wait : 1; /* Set if we are waiting for a - * status reply before sending - * a proxied drop on. - */ - gint drop_x, drop_y; /* Position of drop */ -}; - -struct _GtkDragSourceInfo -{ - GtkWidget *widget; - GtkTargetList *target_list; /* Targets for drag data */ - GdkDragAction possible_actions; /* Actions allowed by source */ - GdkDragContext *context; /* drag context */ - GtkWidget *icon_window; /* Window for drag */ - GtkWidget *ipc_widget; /* GtkInvisible for grab, message passing */ - GdkCursor *cursor; /* Cursor for drag */ - gint hot_x, hot_y; /* Hot spot for drag */ - gint button; /* mouse button starting drag */ - - GtkDragStatus status; /* drag status */ - GdkEvent *last_event; /* motion event waiting for response */ - - gint start_x, start_y; /* Initial position */ - gint cur_x, cur_y; /* Current Position */ - - GList *selections; /* selections we've claimed */ - - GtkDragDestInfo *proxy_dest; /* Set if this is a proxy drag */ - - guint drop_timeout; /* Timeout for aborting drop */ - guint destroy_icon : 1; /* If true, destroy icon_window - */ -}; - -/* Drag & drop stuff. */ -/* Target */ -void -e_table_drag_get_data (ETable *table, - int row, - int col, - GdkDragContext *context, - GdkAtom target, - guint32 time) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(E_IS_TABLE(table)); - - table->drag_get_data_row = row; - table->drag_get_data_col = col; - gtk_drag_get_data(GTK_WIDGET(table), - context, - target, - time); - -} - -/** - * e_table_drag_highlight: - * @table: - * @row: - * @col: - * - * Set col to -1 to highlight the entire row. - */ -void -e_table_drag_highlight (ETable *table, - int row, - int col) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(E_IS_TABLE(table)); -} - -void -e_table_drag_unhighlight (ETable *table) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(E_IS_TABLE(table)); -} - -void e_table_drag_dest_set (ETable *table, - GtkDestDefaults flags, - const GtkTargetEntry *targets, - gint n_targets, - GdkDragAction actions) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(E_IS_TABLE(table)); - - gtk_drag_dest_set(GTK_WIDGET(table), - flags, - targets, - n_targets, - actions); -} - -void e_table_drag_dest_set_proxy (ETable *table, - GdkWindow *proxy_window, - GdkDragProtocol protocol, - gboolean use_coordinates) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(E_IS_TABLE(table)); - - gtk_drag_dest_set_proxy(GTK_WIDGET(table), - proxy_window, - protocol, - use_coordinates); -} - -/* - * There probably should be functions for setting the targets - * as a GtkTargetList - */ - -void -e_table_drag_dest_unset (GtkWidget *widget) -{ - g_return_if_fail(widget != NULL); - g_return_if_fail(E_IS_TABLE(widget)); - - gtk_drag_dest_unset(widget); -} - -/* Source side */ - -void -e_table_drag_source_set (ETable *table, - GdkModifierType start_button_mask, - const GtkTargetEntry *targets, - gint n_targets, - GdkDragAction actions) -{ - ETableDragSourceSite *site; - GtkWidget *canvas; - - g_return_if_fail(table != NULL); - g_return_if_fail(E_IS_TABLE(table)); - - canvas = GTK_WIDGET(table->table_canvas); - site = table->site; - - gtk_widget_add_events (canvas, - gtk_widget_get_events (canvas) | - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | - GDK_BUTTON_MOTION_MASK | GDK_STRUCTURE_MASK); - - if (site) { - if (site->target_list) - gtk_target_list_unref (site->target_list); - } else { - site = g_new0 (ETableDragSourceSite, 1); - - table->drag_source_button_press_event_id = - gtk_signal_connect (GTK_OBJECT (canvas), "button_press_event", - GTK_SIGNAL_FUNC (e_table_drag_source_event_cb), - table); - table->drag_source_motion_notify_event_id = - gtk_signal_connect (GTK_OBJECT (canvas), "motion_notify_event", - GTK_SIGNAL_FUNC (e_table_drag_source_event_cb), - table); - - table->site = site; - } - - site->start_button_mask = start_button_mask; - - if (targets) - site->target_list = gtk_target_list_new (targets, n_targets); - else - site->target_list = NULL; - - site->actions = actions; -} - -void -e_table_drag_source_unset (ETable *table) -{ - ETableDragSourceSite *site; - - g_return_if_fail (table != NULL); - g_return_if_fail (E_IS_TABLE(table)); - - site = table->site; - - if (site) { - gtk_signal_disconnect ( - GTK_OBJECT (table->table_canvas), - table->drag_source_button_press_event_id); - gtk_signal_disconnect ( - GTK_OBJECT (table->table_canvas), - table->drag_source_motion_notify_event_id); - g_free (site); - table->site = NULL; - } -} - -/* There probably should be functions for setting the targets - * as a GtkTargetList - */ - -GdkDragContext * -e_table_drag_begin (ETable *table, - int row, - int col, - GtkTargetList *targets, - GdkDragAction actions, - gint button, - GdkEvent *event) -{ - g_return_val_if_fail (table != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE(table), NULL); - - table->drag_row = row; - table->drag_col = col; - - return gtk_drag_begin(GTK_WIDGET(table), - targets, - actions, - button, - event); -} - -static void -et_drag_begin (GtkWidget *widget, - GdkDragContext *context, - ETable *et) -{ - gtk_signal_emit (GTK_OBJECT (et), - et_signals [TABLE_DRAG_BEGIN], - et->drag_row, - et->drag_col, - context); -} - -static void -et_drag_end (GtkWidget *widget, - GdkDragContext *context, - ETable *et) -{ - gtk_signal_emit (GTK_OBJECT (et), - et_signals [TABLE_DRAG_END], - et->drag_row, - et->drag_col, - context); -} - -static void -et_drag_data_get(GtkWidget *widget, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time, - ETable *et) -{ - gtk_signal_emit (GTK_OBJECT (et), - et_signals [TABLE_DRAG_DATA_GET], - et->drag_row, - et->drag_col, - context, - selection_data, - info, - time); -} - -static void -et_drag_data_delete(GtkWidget *widget, - GdkDragContext *context, - ETable *et) -{ - gtk_signal_emit (GTK_OBJECT (et), - et_signals [TABLE_DRAG_DATA_DELETE], - et->drag_row, - et->drag_col, - context); -} - -static void -et_drag_leave(GtkWidget *widget, - GdkDragContext *context, - guint time, - ETable *et) -{ - gtk_signal_emit (GTK_OBJECT (et), - et_signals [TABLE_DRAG_LEAVE], - et->drop_row, - et->drop_col, - context, - time); - et->drop_row = -1; - et->drop_col = -1; -} - -static gboolean -et_drag_motion(GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint time, - ETable *et) -{ - gboolean ret_val; - int row, col; - - e_table_get_cell_at (et, x, y, &row, &col); - - if (et->drop_row >= 0 && et->drop_col >= 0 && - row != et->drop_row && col != et->drop_row) { - gtk_signal_emit (GTK_OBJECT (et), - et_signals [TABLE_DRAG_LEAVE], - et->drop_row, - et->drop_col, - context, - time); - } - et->drop_row = row; - et->drop_col = col; - if (row >= 0 && col >= 0) - gtk_signal_emit (GTK_OBJECT (et), - et_signals [TABLE_DRAG_MOTION], - et->drop_row, - et->drop_col, - context, - x, - y, - time, - &ret_val); - return ret_val; -} - -static gboolean -et_drag_drop(GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint time, - ETable *et) -{ - gboolean ret_val; - int row, col; - - e_table_get_cell_at (et, x, y, &row, &col); - - if (et->drop_row >= 0 && et->drop_col >= 0 && - row != et->drop_row && col != et->drop_row) { - gtk_signal_emit (GTK_OBJECT (et), - et_signals [TABLE_DRAG_LEAVE], - et->drop_row, - et->drop_col, - context, - time); - if (row >= 0 && col >= 0) - gtk_signal_emit (GTK_OBJECT (et), - et_signals [TABLE_DRAG_MOTION], - row, - col, - context, - x, - y, - time, - &ret_val); - } - et->drop_row = row; - et->drop_col = col; - if (row >= 0 && col >= 0) - gtk_signal_emit (GTK_OBJECT (et), - et_signals [TABLE_DRAG_DROP], - et->drop_row, - et->drop_col, - context, - x, - y, - time, - &ret_val); - et->drop_row = -1; - et->drop_col = -1; - return ret_val; -} - -static void -et_drag_data_received(GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *selection_data, - guint info, - guint time, - ETable *et) -{ - int row, col; - - e_table_get_cell_at (et, x, y, &row, &col); - - gtk_signal_emit (GTK_OBJECT (et), - et_signals [TABLE_DRAG_DATA_RECEIVED], - row, - col, - context, - x, - y, - selection_data, - info, - time); -} - -static gint -e_table_drag_source_event_cb (GtkWidget *widget, - GdkEvent *event, - ETable *table) -{ - ETableDragSourceSite *site; - site = table->site; - - switch (event->type) { - case GDK_BUTTON_PRESS: - if ((GDK_BUTTON1_MASK << (event->button.button - 1)) & site->start_button_mask) { - int row, col; - e_table_get_cell_at (table, event->button.x, event->button.y, &row, &col); - if (row >= 0 && col >= 0) { - site->state |= (GDK_BUTTON1_MASK << (event->button.button - 1)); - site->x = event->button.x; - site->y = event->button.y; - site->row = row; - site->col = col; - } - } - break; - - case GDK_BUTTON_RELEASE: - if ((GDK_BUTTON1_MASK << (event->button.button - 1)) & site->start_button_mask) { - site->state &= ~(GDK_BUTTON1_MASK << (event->button.button - 1)); - } - break; - - case GDK_MOTION_NOTIFY: - if (site->state & event->motion.state & site->start_button_mask) { - /* FIXME: This is really broken and can leave us - * with a stuck grab - */ - int i; - for (i=1; i<6; i++) { - if (site->state & event->motion.state & - GDK_BUTTON1_MASK << (i - 1)) - break; - } - - if (MAX (abs (site->x - event->motion.x), - abs (site->y - event->motion.y)) > 3) { - GtkDragSourceInfo *info; - GdkDragContext *context; - - site->state = 0; - context = e_table_drag_begin (table, site->row, site->col, - site->target_list, - site->actions, - i, event); - - - info = g_dataset_get_data (context, "gtk-info"); - - if (!info->icon_window) { - if (site->pixmap) - gtk_drag_set_icon_pixmap (context, - site->colormap, - site->pixmap, - site->mask, -2, -2); - else - gtk_drag_set_icon_default (context); - } - - return TRUE; - } - } - break; - - default: /* hit for 2/3BUTTON_PRESS */ - break; - } - return FALSE; -} - -static void -e_table_class_init (ETableClass *class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - GtkContainerClass *container_class; - - object_class = (GtkObjectClass *) class; - widget_class = (GtkWidgetClass *) class; - container_class = (GtkContainerClass *) class; - - e_table_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = et_destroy; - object_class->set_arg = et_set_arg; - object_class->get_arg = et_get_arg; - - widget_class->grab_focus = et_grab_focus; - - container_class->focus = et_focus; - - class->cursor_change = NULL; - class->cursor_activated = NULL; - class->selection_change = NULL; - class->double_click = NULL; - class->right_click = NULL; - class->click = NULL; - class->key_press = NULL; - - class->table_drag_begin = NULL; - class->table_drag_end = NULL; - class->table_drag_data_get = NULL; - class->table_drag_data_delete = NULL; - - class->table_drag_leave = NULL; - class->table_drag_motion = NULL; - class->table_drag_drop = NULL; - class->table_drag_data_received = NULL; - - et_signals [CURSOR_CHANGE] = - gtk_signal_new ("cursor_change", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, cursor_change), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - et_signals [CURSOR_ACTIVATED] = - gtk_signal_new ("cursor_activated", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, cursor_activated), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - et_signals [SELECTION_CHANGE] = - gtk_signal_new ("selection_change", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, selection_change), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - et_signals [DOUBLE_CLICK] = - gtk_signal_new ("double_click", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, double_click), - gtk_marshal_NONE__INT_INT_POINTER, - GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); - - et_signals [RIGHT_CLICK] = - gtk_signal_new ("right_click", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, right_click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); - - et_signals [CLICK] = - gtk_signal_new ("click", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); - - et_signals [KEY_PRESS] = - gtk_signal_new ("key_press", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, key_press), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); - - et_signals[TABLE_DRAG_BEGIN] = - gtk_signal_new ("table_drag_begin", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, table_drag_begin), - gtk_marshal_NONE__INT_INT_POINTER, - GTK_TYPE_NONE, 3, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); - et_signals[TABLE_DRAG_END] = - gtk_signal_new ("table_drag_end", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, table_drag_end), - gtk_marshal_NONE__INT_INT_POINTER, - GTK_TYPE_NONE, 3, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); - et_signals[TABLE_DRAG_DATA_GET] = - gtk_signal_new ("table_drag_data_get", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, table_drag_data_get), - e_marshal_NONE__INT_INT_POINTER_POINTER_UINT_UINT, - GTK_TYPE_NONE, 6, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, - GTK_TYPE_SELECTION_DATA, - GTK_TYPE_UINT, - GTK_TYPE_UINT); - et_signals[TABLE_DRAG_DATA_DELETE] = - gtk_signal_new ("table_drag_data_delete", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, table_drag_data_delete), - gtk_marshal_NONE__INT_INT_POINTER, - GTK_TYPE_NONE, 3, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); - - et_signals[TABLE_DRAG_LEAVE] = - gtk_signal_new ("table_drag_leave", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, table_drag_leave), - e_marshal_NONE__INT_INT_POINTER_UINT, - GTK_TYPE_NONE, 4, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, - GTK_TYPE_UINT); - et_signals[TABLE_DRAG_MOTION] = - gtk_signal_new ("table_drag_motion", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, table_drag_motion), - e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT, - GTK_TYPE_BOOL, 6, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_UINT); - et_signals[TABLE_DRAG_DROP] = - gtk_signal_new ("table_drag_drop", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, table_drag_drop), - e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT, - GTK_TYPE_BOOL, 6, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_UINT); - et_signals[TABLE_DRAG_DATA_RECEIVED] = - gtk_signal_new ("table_drag_data_received", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, table_drag_data_received), - e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_UINT_UINT, - GTK_TYPE_NONE, 8, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_SELECTION_DATA, - GTK_TYPE_UINT, - GTK_TYPE_UINT); - - gtk_object_class_add_signals (object_class, et_signals, LAST_SIGNAL); - - class->set_scroll_adjustments = set_scroll_adjustments; - - widget_class->set_scroll_adjustments_signal = - gtk_signal_new ("set_scroll_adjustments", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableClass, set_scroll_adjustments), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); - - gtk_object_add_arg_type ("ETable::length_threshold", GTK_TYPE_INT, - GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD); -} - -E_MAKE_TYPE(e_table, "ETable", ETable, e_table_class_init, e_table_init, PARENT_TYPE); diff --git a/widgets/table/e-table.dia b/widgets/table/e-table.dia Binary files differdeleted file mode 100644 index 5aeb01228c..0000000000 --- a/widgets/table/e-table.dia +++ /dev/null diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h deleted file mode 100644 index 17cee2f70b..0000000000 --- a/widgets/table/e-table.h +++ /dev/null @@ -1,285 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_H_ -#define _E_TABLE_H_ - -#include <libgnomeui/gnome-canvas.h> -#include <gtk/gtktable.h> -#include <gnome-xml/tree.h> -#include <gal/e-table/e-table-model.h> -#include <gal/e-table/e-table-header.h> -#include <gal/e-table/e-table-group.h> -#include <gal/e-table/e-table-sort-info.h> -#include <gal/e-table/e-table-item.h> -#include <gal/e-table/e-table-selection-model.h> -#include <gal/e-table/e-table-extras.h> -#include <gal/e-table/e-table-specification.h> -#include <gal/widgets/e-printable.h> -#include <gal/e-table/e-table-state.h> - -BEGIN_GNOME_DECLS - -#define E_TABLE_TYPE (e_table_get_type ()) -#define E_TABLE(o) (GTK_CHECK_CAST ((o), E_TABLE_TYPE, ETable)) -#define E_TABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_TYPE, ETableClass)) -#define E_IS_TABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_TYPE)) -#define E_IS_TABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_TYPE)) - -typedef struct _ETableDragSourceSite ETableDragSourceSite; - -typedef enum { - E_TABLE_CURSOR_LOC_NONE = 0, - E_TABLE_CURSOR_LOC_ETCTA = 1 << 0, - E_TABLE_CURSOR_LOC_TABLE = 1 << 1, -} ETableCursorLoc; - -typedef struct { - GtkTable parent; - - ETableModel *model; - - ETableHeader *full_header, *header; - - GnomeCanvasItem *canvas_vbox; - ETableGroup *group; - - ETableSortInfo *sort_info; - ETableSorter *sorter; - - ETableSelectionModel *selection; - ETableCursorLoc cursor_loc; - ETableSpecification *spec; - - int table_model_change_id; - int table_row_change_id; - int table_cell_change_id; - int table_row_inserted_id; - int table_row_deleted_id; - - int group_info_change_id; - - int reflow_idle_id; - - GnomeCanvas *header_canvas, *table_canvas; - - GnomeCanvasItem *header_item, *root; - - GnomeCanvasItem *white_item; - - gint length_threshold; - - gint rebuild_idle_id; - guint need_rebuild:1; - - /* - * Configuration settings - */ - guint draw_grid : 1; - guint draw_focus : 1; - guint row_selection_active : 1; - - guint horizontal_scrolling : 1; - - guint is_grouped : 1; - - char *click_to_add_message; - GnomeCanvasItem *click_to_add; - gboolean use_click_to_add; - - ECursorMode cursor_mode; - - int drag_get_data_row; - int drag_get_data_col; - - int drop_row; - int drop_col; - - int drag_row; - int drag_col; - ETableDragSourceSite *site; - - int drag_source_button_press_event_id; - int drag_source_motion_notify_event_id; -} ETable; - -typedef struct { - GtkTableClass parent_class; - - void (*cursor_change) (ETable *et, int row); - void (*cursor_activated) (ETable *et, int row); - void (*selection_change) (ETable *et); - void (*double_click) (ETable *et, int row, int col, GdkEvent *event); - gint (*right_click) (ETable *et, int row, int col, GdkEvent *event); - gint (*click) (ETable *et, int row, int col, GdkEvent *event); - gint (*key_press) (ETable *et, int row, int col, GdkEvent *event); - - void (*set_scroll_adjustments) (ETable *table, - GtkAdjustment *hadjustment, - GtkAdjustment *vadjustment); - - /* Source side drag signals */ - void (* table_drag_begin) (ETable *table, - int row, - int col, - GdkDragContext *context); - void (* table_drag_end) (ETable *table, - int row, - int col, - GdkDragContext *context); - void (* table_drag_data_get) (ETable *table, - int row, - int col, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time); - void (* table_drag_data_delete) (ETable *table, - int row, - int col, - GdkDragContext *context); - - /* Target side drag signals */ - void (* table_drag_leave) (ETable *table, - int row, - int col, - GdkDragContext *context, - guint time); - gboolean (* table_drag_motion) (ETable *table, - int row, - int col, - GdkDragContext *context, - gint x, - gint y, - guint time); - gboolean (* table_drag_drop) (ETable *table, - int row, - int col, - GdkDragContext *context, - gint x, - gint y, - guint time); - void (* table_drag_data_received) (ETable *table, - int row, - int col, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *selection_data, - guint info, - guint time); -} ETableClass; - -GtkType e_table_get_type (void); - -ETable *e_table_construct (ETable *e_table, - ETableModel *etm, - ETableExtras *ete, - const char *spec, - const char *state); -GtkWidget *e_table_new (ETableModel *etm, - ETableExtras *ete, - const char *spec, - const char *state); - -/* Create an ETable using files. */ -ETable *e_table_construct_from_spec_file (ETable *e_table, - ETableModel *etm, - ETableExtras *ete, - const char *spec_fn, - const char *state_fn); -GtkWidget *e_table_new_from_spec_file (ETableModel *etm, - ETableExtras *ete, - const char *spec_fn, - const char *state_fn); - -/* To save the state */ -gchar *e_table_get_state (ETable *e_table); -void e_table_save_state (ETable *e_table, - const gchar *filename); -ETableState *e_table_get_state_object (ETable *e_table); - -/* note that it is more efficient to provide the state at creation time */ -void e_table_set_state (ETable *e_table, - const gchar *state); -void e_table_set_state_object (ETable *e_table, - ETableState *state); -void e_table_load_state (ETable *e_table, - const gchar *filename); - -void e_table_set_cursor_row (ETable *e_table, - int row); - -/* -1 means we don't have the cursor. */ -int e_table_get_cursor_row (ETable *e_table); -void e_table_selected_row_foreach (ETable *e_table, - EForeachFunc callback, - gpointer closure); -gint e_table_selected_count (ETable *e_table); -EPrintable *e_table_get_printable (ETable *e_table); - -gint e_table_get_next_row (ETable *e_table, - gint model_row); -gint e_table_get_prev_row (ETable *e_table, - gint model_row); - -gint e_table_model_to_view_row (ETable *e_table, - gint model_row); -gint e_table_view_to_model_row (ETable *e_table, - gint view_row); -void e_table_get_cell_at (ETable *table, - int x, int y, - int *row_return, int *col_return); - -/* Drag & drop stuff. */ -/* Target */ -void e_table_drag_get_data (ETable *table, - int row, - int col, - GdkDragContext *context, - GdkAtom target, - guint32 time); -void e_table_drag_highlight (ETable *table, - int row, - int col); /* col == -1 to highlight entire row. */ -void e_table_drag_unhighlight (ETable *table); -void e_table_drag_dest_set (ETable *table, - GtkDestDefaults flags, - const GtkTargetEntry *targets, - gint n_targets, - GdkDragAction actions); -void e_table_drag_dest_set_proxy (ETable *table, - GdkWindow *proxy_window, - GdkDragProtocol protocol, - gboolean use_coordinates); - -/* There probably should be functions for setting the targets - * as a GtkTargetList - */ -void e_table_drag_dest_unset (GtkWidget *widget); - -/* Source side */ -void e_table_drag_source_set (ETable *table, - GdkModifierType start_button_mask, - const GtkTargetEntry *targets, - gint n_targets, - GdkDragAction actions); -void e_table_drag_source_unset (ETable *table); - -/* There probably should be functions for setting the targets - * as a GtkTargetList - */ -GdkDragContext *e_table_drag_begin (ETable *table, - int row, - int col, - GtkTargetList *targets, - GdkDragAction actions, - gint button, - GdkEvent *event); - -/* selection stuff */ -void e_table_select_all (ETable *table); -void e_table_invert_selection (ETable *table); - -END_GNOME_DECLS - -#endif /* _E_TABLE_H_ */ - diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c deleted file mode 100644 index 0658cef7db..0000000000 --- a/widgets/table/e-tree-model.c +++ /dev/null @@ -1,1811 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-tree-model.c: a Tree Model - * - * Author: - * Chris Toshok (toshok@ximian.com) - * - * Adapted from the gtree code and ETableModel. - * - * (C) 2000 Ximian, Inc. - */ -#include <config.h> - -#include <stdio.h> -#include <errno.h> -#include <unistd.h> -#include <fcntl.h> - -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> - -#include <gtk/gtksignal.h> -#include <stdlib.h> -#include "gal/util/e-util.h" -#include "gal/util/e-xml-utils.h" -#include "e-tree-model.h" - -#define ETM_CLASS(e) ((ETreeModelClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE E_TABLE_MODEL_TYPE - -#define TREEPATH_CHUNK_AREA_SIZE (30 * sizeof (ETreePath)) - -static ETableModel *e_tree_model_parent_class; - -struct ETreeModelPriv { - GMemChunk *node_chunk; - ETreePath *root; - gboolean root_visible; - GArray *row_array; /* used in the mapping between ETable and our tree */ - GHashTable *expanded_state; /* used for loading/saving expanded state */ - GString *sort_group; /* for caching the last sort group info */ - gboolean expanded_default; /* whether nodes are created expanded or collapsed by default */ - gint frozen; -}; - -struct ETreePath { - gboolean expanded; - gboolean expanded_set; - guint visible_descendents; - char *save_id; - ETreePathCompareFunc compare; - gpointer node_data; - - /* parent/child/sibling pointers */ - ETreePath *parent; - ETreePath *next_sibling; - ETreePath *prev_sibling; - ETreePath *first_child; - ETreePath *last_child; - guint32 num_children; -}; - -enum { - NODE_CHANGED, - NODE_INSERTED, - NODE_REMOVED, - NODE_COLLAPSED, - NODE_EXPANDED, - LAST_SIGNAL -}; - -static guint e_tree_model_signals [LAST_SIGNAL] = {0, }; - -static void add_visible_descendents_to_array (ETreeModel *etm, ETreePath *node, int *row, int *count); - - -/* ETreePath functions */ - -static int -e_tree_path_depth (ETreePath *path) -{ - int depth = 0; - while (path) { - depth ++; - path = path->parent; - } - return depth; -} - -static void -e_tree_path_insert (ETreePath *parent, int position, ETreePath *child) -{ - g_return_if_fail (position <= parent->num_children || position == -1); - - child->parent = parent; - - if (parent->first_child == NULL) - parent->first_child = child; - - if (position == -1 || position == parent->num_children) { - child->prev_sibling = parent->last_child; - if (parent->last_child) - parent->last_child->next_sibling = child; - parent->last_child = child; - } - else { - ETreePath *c; - for (c = parent->first_child; c; c = c->next_sibling) { - if (position == 0) { - child->next_sibling = c; - child->prev_sibling = c->prev_sibling; - - if (child->next_sibling) - child->next_sibling->prev_sibling = child; - if (child->prev_sibling) - child->prev_sibling->next_sibling = child; - - if (parent->first_child == c) - parent->first_child = child; - break; - } - position --; - } - } - - parent->num_children++; -} - -static void -e_tree_path_unlink (ETreePath *path) -{ - ETreePath *parent = path->parent; - - /* unlink first/last child if applicable */ - if (parent) { - if (path == parent->first_child) - parent->first_child = path->next_sibling; - if (path == parent->last_child) - parent->last_child = path->prev_sibling; - - parent->num_children --; - } - - /* unlink prev/next sibling links */ - if (path->next_sibling) - path->next_sibling->prev_sibling = path->prev_sibling; - if (path->prev_sibling) - path->prev_sibling->next_sibling = path->next_sibling; - - path->parent = NULL; - path->next_sibling = NULL; - path->prev_sibling = NULL; -} - -/** - * e_tree_model_node_traverse: - * @model: - * @path: - * @func: - * @data: - * - * - **/ -void -e_tree_model_node_traverse (ETreeModel *model, ETreePath *path, ETreePathFunc func, gpointer data) -{ - ETreePath *child; - - g_return_if_fail (path); - - child = path->first_child; - - while (child) { - ETreePath *next_child = child->next_sibling; - e_tree_model_node_traverse (model, child, func, data); - if (func (model, child, data) == TRUE) - return; - - child = next_child; - } -} - - - -/** - * e_tree_model_freeze: - * @etm: the ETreeModel to freeze. - * - * This function prepares an ETreeModel for a period of much change. - * All signals regarding changes to the tree are deferred until we - * thaw the tree. - * - **/ -void -e_tree_model_freeze(ETreeModel *etm) -{ - ETreeModelPriv *priv = etm->priv; - - priv->frozen ++; -} - -/** - * e_tree_model_thaw: - * @etm: the ETreeModel to thaw. - * - * This function thaws an ETreeModel. All the defered signals can add - * up to a lot, we don't know - so we just emit a model_changed - * signal. - * - **/ -void -e_tree_model_thaw(ETreeModel *etm) -{ - ETreeModelPriv *priv = etm->priv; - - if (priv->frozen > 0) - priv->frozen --; - if (priv->frozen == 0) { - e_table_model_changed(E_TABLE_MODEL(etm)); - } -} - - -/* virtual methods */ - -static void -etree_destroy (GtkObject *object) -{ - ETreeModel *etree = E_TREE_MODEL (object); - ETreeModelPriv *priv = etree->priv; - - /* XXX lots of stuff to free here */ - - if (priv->root) - e_tree_model_node_remove (etree, priv->root); - - g_array_free (priv->row_array, TRUE); - g_hash_table_destroy (priv->expanded_state); - - g_string_free(priv->sort_group, TRUE); - - g_free (priv); - - GTK_OBJECT_CLASS (e_tree_model_parent_class)->destroy (object); -} - -static ETreePath* -etree_get_root (ETreeModel *etm) -{ - ETreeModelPriv *priv = etm->priv; - return priv->root; -} - -static ETreePath* -etree_get_parent (ETreeModel *etm, ETreePath *path) -{ - g_return_val_if_fail (path, NULL); - - return path->parent; -} - -static ETreePath* -etree_get_next (ETreeModel *etm, ETreePath *node) -{ - g_return_val_if_fail (node, NULL); - - return node->next_sibling; -} - -static ETreePath* -etree_get_prev (ETreeModel *etm, ETreePath *node) -{ - g_return_val_if_fail (node, NULL); - - return node->prev_sibling; -} - -static ETreePath* -etree_get_first_child (ETreeModel *etm, ETreePath *node) -{ - g_return_val_if_fail (node, NULL); - - return node->first_child; -} - -static ETreePath* -etree_get_last_child (ETreeModel *etm, ETreePath *node) -{ - g_return_val_if_fail (node, NULL); - - return node->last_child; -} - -static guint -etree_get_children (ETreeModel *etm, ETreePath* node, ETreePath ***paths) -{ - guint n_children; - - g_return_val_if_fail (node, 0); - - n_children = node->num_children; - - if (paths) { - ETreePath *p; - int i = 0; - (*paths) = g_malloc (sizeof (ETreePath*) * n_children); - for (p = node->first_child; p; p = p->next_sibling) { - (*paths)[i++] = p; - } - } - - return n_children; -} - -static gboolean -etree_is_expanded (ETreeModel *etm, ETreePath* node) -{ - g_return_val_if_fail (node, FALSE); - - return node->expanded; -} - -static gboolean -etree_is_visible (ETreeModel *etm, ETreePath* node) -{ - g_return_val_if_fail (node, FALSE); - - for (node = node->parent; node; node = node->parent) { - if (!node->expanded) - return FALSE; - } - - return TRUE; -} - -static void -etree_set_expanded (ETreeModel *etm, ETreePath* node, gboolean expanded) -{ - ETreeModelPriv *priv = etm->priv; - ETreePath *child; - int row; - - g_return_if_fail (node); - - node->expanded_set = TRUE; - - if (node->expanded == expanded) - return; - - if (expanded) { - gboolean allow_expand = TRUE; - e_tree_model_node_expanded (etm, node, &allow_expand); - if (!allow_expand) - return; - } - - node->expanded = expanded; - if (node->save_id) { - g_hash_table_insert (priv->expanded_state, node->save_id, (gpointer)expanded); - } - - /* if the node wasn't visible at present */ - if ((row = e_tree_model_row_of_node (etm, node)) == -1) { - if (!expanded) { - e_tree_model_node_collapsed (etm, node); - } - return; - } - - row++; - - if (expanded) { - ETreePath *parent; - - if (e_tree_model_node_is_visible (etm, node)) { - node->visible_descendents = 0; - for (child = node->first_child; child; - child = child->next_sibling) { - add_visible_descendents_to_array (etm, child, &row, &node->visible_descendents); - } - } - /* now iterate back up the tree, adding to our - ancestors' visible descendents */ - - for (parent = node->parent; parent; parent = parent->parent) { - parent->visible_descendents += node->visible_descendents; - } - } - else { - int i; - ETreePath *parent; - - if (e_tree_model_node_is_visible (etm, node)) { - for (i = 0; i < node->visible_descendents; i ++) { - priv->row_array = g_array_remove_index (priv->row_array, row); - e_table_model_row_deleted (E_TABLE_MODEL (etm), row); - } - } - /* now iterate back up the tree, subtracting from our - ancestors' visible descendents */ - - for (parent = node->parent; parent; parent = parent->parent) { - parent->visible_descendents -= node->visible_descendents; - } - - node->visible_descendents = 0; - - e_tree_model_node_collapsed (etm, node); - } -} - -/** - * e_tree_model_set_expanded_default: - * @etree: The ETreeModel we're setting the default expanded behavior on. - * @expanded: Whether or not newly inserted parent nodes should be expanded by default. - * - * - **/ -void -e_tree_model_show_node (ETreeModel *etm, ETreePath* node) -{ - ETreePath *parent; - - parent = e_tree_model_node_get_parent(etm, node); - if (parent) { - e_tree_model_show_node(etm, parent); - e_tree_model_node_set_expanded(etm, parent, TRUE); - } -} - -void -e_tree_model_set_expanded_default (ETreeModel *etree, - gboolean expanded) -{ - ETreeModelPriv *priv = etree->priv; - - priv->expanded_default = expanded; -} - -/* fairly naive implementation */ -static void -etree_set_expanded_recurse (ETreeModel *etm, ETreePath* node, gboolean expanded) -{ - ETreePath *child; - - e_tree_model_node_set_expanded (etm, node, expanded); - - for (child = node->first_child; child; child = child->next_sibling) - e_tree_model_node_set_expanded_recurse (etm, child, expanded); -} - -static ETreePath * -etree_node_at_row (ETreeModel *etree, int row) -{ - ETreeModelPriv *priv = etree->priv; - - g_return_val_if_fail (row < priv->row_array->len, NULL); - - return g_array_index (priv->row_array, ETreePath*, row); -} - - -/* ETable analogs */ -static void* -etree_value_at (ETreeModel *etm, ETreePath* node, int col) -{ - /* shouldn't be called */ - g_assert (0); - return NULL; -} - -static GdkPixbuf* -etree_icon_at (ETreeModel *etm, ETreePath* node) -{ - /* shouldn't be called */ - g_assert (0); - return NULL; -} - -static void -etree_set_value_at (ETreeModel *etm, ETreePath* node, int col, const void *val) -{ - /* shouldn't be called */ - g_assert (0); -} - -static gboolean -etree_is_editable (ETreeModel *etm, ETreePath* node, int col) -{ - /* shouldn't be called */ - g_assert(0); - return FALSE; -} - - -/* ETable virtual functions we map */ -static int -etable_row_count (ETableModel *etm) -{ - ETreeModel *tree = E_TREE_MODEL (etm); - ETreeModelPriv *priv = tree->priv; - return priv->row_array->len; -} - -static void * -etable_value_at (ETableModel *etm, int col, int row) -{ - ETreeModel *etree = E_TREE_MODEL(etm); - ETreeModelClass *et_class = ETM_CLASS(etm); - ETreePath* node = e_tree_model_node_at_row (etree, row); - - if (node == NULL) - g_warning ("node is NULL for row %d in etable_value_at\n", row); - - if (col == -1) - return node; - else if (col == -2) - return etm; - else - return et_class->value_at (etree, node, col); -} - -static void -etable_set_value_at (ETableModel *etm, int col, int row, const void *val) -{ - ETreeModel *etree = E_TREE_MODEL(etm); - ETreeModelClass *et_class = ETM_CLASS(etm); - ETreePath* node = e_tree_model_node_at_row (etree, row); - - g_return_if_fail (node); - - et_class->set_value_at (etree, node, col, val); -} - -static gboolean -etable_is_cell_editable (ETableModel *etm, int col, int row) -{ - ETreeModel *etree = E_TREE_MODEL(etm); - ETreeModelClass *et_class = ETM_CLASS(etm); - ETreePath* node = e_tree_model_node_at_row (etree, row); - - g_return_val_if_fail (node, FALSE); - - return et_class->is_editable (etree, node, col); -} - -static void -build_sort_group(GString *out, ETreePath *node) -{ - if (node->parent) { - build_sort_group(out, node->parent); - } - g_string_sprintfa(out, "/%p", node); -} - -static const char * -etable_row_sort_group(ETableModel *etm, int row) -{ - ETreeModel *etree = E_TREE_MODEL(etm); - ETreeModelPriv *priv = etree->priv; - ETreePath* node = e_tree_model_node_at_row (etree, row); - - g_return_val_if_fail (node, ""); - - g_string_truncate(priv->sort_group, 0); - if (node) - build_sort_group(priv->sort_group, node); - - return priv->sort_group->str; -} - -static gboolean -etable_has_sort_group(ETableModel *etm) -{ - /* could optimise for the flat &/or unexpanded tree case */ - return TRUE; -} - - -static void -e_tree_model_class_init (GtkObjectClass *klass) -{ - ETableModelClass *table_class = (ETableModelClass *) klass; - ETreeModelClass *tree_class = (ETreeModelClass *) klass; - - e_tree_model_parent_class = gtk_type_class (PARENT_TYPE); - - klass->destroy = etree_destroy; - - e_tree_model_signals [NODE_CHANGED] = - gtk_signal_new ("node_changed", - GTK_RUN_LAST, - klass->type, - GTK_SIGNAL_OFFSET (ETreeModelClass, node_changed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, GTK_TYPE_POINTER); - - e_tree_model_signals [NODE_INSERTED] = - gtk_signal_new ("node_inserted", - GTK_RUN_LAST, - klass->type, - GTK_SIGNAL_OFFSET (ETreeModelClass, node_inserted), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER); - - e_tree_model_signals [NODE_REMOVED] = - gtk_signal_new ("node_removed", - GTK_RUN_LAST, - klass->type, - GTK_SIGNAL_OFFSET (ETreeModelClass, node_removed), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER); - - e_tree_model_signals [NODE_COLLAPSED] = - gtk_signal_new ("node_collapsed", - GTK_RUN_LAST, - klass->type, - GTK_SIGNAL_OFFSET (ETreeModelClass, node_collapsed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, GTK_TYPE_POINTER); - - e_tree_model_signals [NODE_EXPANDED] = - gtk_signal_new ("node_expanded", - GTK_RUN_LAST, - klass->type, - GTK_SIGNAL_OFFSET (ETreeModelClass, node_expanded), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER); - - gtk_object_class_add_signals (klass, e_tree_model_signals, LAST_SIGNAL); - - table_class->row_count = etable_row_count; - table_class->value_at = etable_value_at; - table_class->set_value_at = etable_set_value_at; - table_class->is_cell_editable = etable_is_cell_editable; -#if 0 - /* XX need to pass these through */ - table_class->duplicate_value = etable_duplicate_value; - table_class->free_value = etable_free_value; - table_class->initialize_value = etable_initialize_value; - table_class->value_is_empty = etable_value_is_empty; - table_class->value_to_string = etable_value_to_string; - table_class->thaw = etable_thaw; -#endif - - table_class->row_sort_group = etable_row_sort_group; - table_class->has_sort_group = etable_has_sort_group; - - tree_class->get_root = etree_get_root; - tree_class->get_prev = etree_get_prev; - tree_class->get_next = etree_get_next; - tree_class->get_first_child = etree_get_first_child; - tree_class->get_last_child = etree_get_last_child; - tree_class->get_parent = etree_get_parent; - - tree_class->value_at = etree_value_at; - tree_class->icon_at = etree_icon_at; - tree_class->set_value_at = etree_set_value_at; - tree_class->is_editable = etree_is_editable; - - tree_class->get_children = etree_get_children; - tree_class->is_expanded = etree_is_expanded; - tree_class->is_visible = etree_is_visible; - tree_class->set_expanded = etree_set_expanded; - tree_class->set_expanded_recurse = etree_set_expanded_recurse; - tree_class->node_at_row = etree_node_at_row; -} - -static void -e_tree_init (GtkObject *object) -{ - ETreeModel *etree = (ETreeModel *)object; - e_tree_model_construct (etree); -} - -E_MAKE_TYPE(e_tree_model, "ETreeModel", ETreeModel, e_tree_model_class_init, e_tree_init, PARENT_TYPE) - - -/* signals */ - -/** - * e_tree_model_node_changed: - * @tree_model: - * @node: - * - * - * - * Return value: - **/ -void -e_tree_model_node_changed (ETreeModel *tree_model, ETreePath *node) -{ - int row; - g_return_if_fail (tree_model != NULL); - g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - - row = e_tree_model_row_of_node (tree_model, node); - if (row != -1) - e_table_model_row_changed (E_TABLE_MODEL (tree_model), row); - - gtk_signal_emit (GTK_OBJECT (tree_model), - e_tree_model_signals [NODE_CHANGED], node); -} - -/** - * e_tree_model_node_inserted: - * @tree_model: - * @parent_node: - * @inserted_node: - * - * - **/ -void -e_tree_model_node_inserted (ETreeModel *tree_model, - ETreePath *parent_node, - ETreePath *inserted_node) -{ - int row; - g_return_if_fail (tree_model != NULL); - g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - - row = e_tree_model_row_of_node (tree_model, inserted_node); - if (row != -1) - e_table_model_row_inserted (E_TABLE_MODEL (tree_model), row); - - gtk_signal_emit (GTK_OBJECT (tree_model), - e_tree_model_signals [NODE_INSERTED], - parent_node, inserted_node); -} - -/** - * e_tree_model_node_removed: - * @tree_model: - * @parent_node: - * @removed_node: - * - * - **/ -void -e_tree_model_node_removed (ETreeModel *tree_model, ETreePath *parent_node, ETreePath *removed_node) -{ - int row; - - g_return_if_fail (tree_model != NULL); - g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - - row = e_tree_model_row_of_node (tree_model, removed_node); - if (row != -1) - e_table_model_row_deleted (E_TABLE_MODEL (tree_model), row); - - gtk_signal_emit (GTK_OBJECT (tree_model), - e_tree_model_signals [NODE_REMOVED], - parent_node, removed_node); -} - -/** - * e_tree_model_node_collapsed: - * @tree_model: - * @node: - * - * - **/ -void -e_tree_model_node_collapsed (ETreeModel *tree_model, ETreePath *node) -{ - g_return_if_fail (tree_model != NULL); - g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - - gtk_signal_emit (GTK_OBJECT (tree_model), - e_tree_model_signals [NODE_COLLAPSED], - node); -} - -/** - * e_tree_model_node_expanded: - * @tree_model: - * @node: - * @allow_expand: - * - * - **/ -void -e_tree_model_node_expanded (ETreeModel *tree_model, ETreePath *node, gboolean *allow_expand) -{ - g_return_if_fail (tree_model != NULL); - g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - - gtk_signal_emit (GTK_OBJECT (tree_model), - e_tree_model_signals [NODE_EXPANDED], - node, allow_expand); -} - - - -/** - * e_tree_model_construct: - * @etree: - * - * - **/ -void -e_tree_model_construct (ETreeModel *etree) -{ - ETreeModelPriv *priv; - - g_return_if_fail (etree != NULL); - g_return_if_fail (E_IS_TREE_MODEL (etree)); - - priv = g_new0 (ETreeModelPriv, 1); - etree->priv = priv; - - priv->node_chunk = g_mem_chunk_create (ETreePath, TREEPATH_CHUNK_AREA_SIZE, G_ALLOC_AND_FREE); - priv->root = NULL; - priv->root_visible = TRUE; - priv->row_array = g_array_new (FALSE, FALSE, sizeof(ETreePath*)); - priv->expanded_state = g_hash_table_new (g_str_hash, g_str_equal); - priv->sort_group = g_string_new(""); - priv->frozen = 0; -} - -/** - * e_tree_model_new - * - * XXX docs here. - * - * return values: a newly constructed ETreeModel. - */ -ETreeModel * -e_tree_model_new () -{ - ETreeModel *et; - - et = gtk_type_new (e_tree_model_get_type ()); - - return et; -} - -/** - * e_tree_model_get_root - * @etree: the ETreeModel of which we want the root node. - * - * Accessor for the root node of @etree. - * - * return values: the ETreePath corresponding to the root node. - */ -ETreePath * -e_tree_model_get_root (ETreeModel *etree) -{ - g_return_val_if_fail (etree != NULL, NULL); - g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); - - return ETM_CLASS(etree)->get_root(etree); -} - -/** - * e_tree_model_node_at_row - * @etree: the ETreeModel. - * @row: - * - * XXX docs here. - * - * return values: the ETreePath corresponding to @row. - */ -ETreePath * -e_tree_model_node_at_row (ETreeModel *etree, int row) -{ - g_return_val_if_fail (etree != NULL, NULL); - g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); - - return ETM_CLASS(etree)->node_at_row (etree, row); -} - -/** - * e_tree_model_icon_of_node - * @etree: The ETreeModel. - * @path: The ETreePath to the node we're getting the icon of. - * - * XXX docs here. - * - * return values: the GdkPixbuf associated with this node. - */ -GdkPixbuf * -e_tree_model_icon_of_node (ETreeModel *etree, ETreePath *path) -{ - g_return_val_if_fail (etree != NULL, NULL); - g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); - - return ETM_CLASS(etree)->icon_at (etree, path); -} - -/** - * e_tree_model_row_of_node - * @etree: The ETreeModel. - * @node: The node whose row we're looking up. - * - * return values: an int. - */ -int -e_tree_model_row_of_node (ETreeModel *etree, ETreePath *node) -{ - ETreeModelPriv *priv; - int i; - - g_return_val_if_fail (etree != NULL, 0); - g_return_val_if_fail (E_IS_TREE_MODEL (etree), 0); - - priv = etree->priv; - for (i = 0; i < priv->row_array->len; i ++) - if (g_array_index (priv->row_array, ETreePath*, i) == node) - return i; - - return -1; -} - -/** - * e_tree_model_root_node_set_visible - * - * return values: none - */ -void -e_tree_model_root_node_set_visible (ETreeModel *etm, gboolean visible) -{ - ETreeModelPriv *priv; - - g_return_if_fail (etm != NULL); - g_return_if_fail (E_IS_TREE_MODEL (etm)); - - priv = etm->priv; - if (visible != priv->root_visible) { - priv->root_visible = visible; - if (priv->root) { - if (visible) { - priv->row_array = g_array_insert_val (priv->row_array, 0, priv->root); - } - else { - ETreePath *root_path = e_tree_model_get_root (etm); - e_tree_model_node_set_expanded (etm, root_path, TRUE); - priv->row_array = g_array_remove_index (priv->row_array, 0); - } - - e_table_model_changed (E_TABLE_MODEL (etm)); - } - } -} - -/** - * e_tree_model_root_node_is_visible: - * @etm: - * - * - * - * Return value: - **/ -gboolean -e_tree_model_root_node_is_visible (ETreeModel *etm) -{ - ETreeModelPriv *priv; - - g_return_val_if_fail (etm != NULL, FALSE); - g_return_val_if_fail (E_IS_TREE_MODEL (etm), FALSE); - - priv = etm->priv; - return priv->root_visible; -} - -/** - * e_tree_model_node_get_first_child: - * @etree: - * @node: - * - * - * - * Return value: - **/ -ETreePath * -e_tree_model_node_get_first_child (ETreeModel *etree, ETreePath *node) -{ - g_return_val_if_fail (etree != NULL, NULL); - g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); - - return ETM_CLASS(etree)->get_first_child(etree, node); -} - -/** - * e_tree_model_node_get_last_child: - * @etree: - * @node: - * - * - * - * Return value: - **/ -ETreePath * -e_tree_model_node_get_last_child (ETreeModel *etree, ETreePath *node) -{ - g_return_val_if_fail (etree != NULL, NULL); - g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); - - return ETM_CLASS(etree)->get_last_child(etree, node); -} - - -/** - * e_tree_model_node_get_next: - * @etree: - * @node: - * - * - * - * Return value: - **/ -ETreePath * -e_tree_model_node_get_next (ETreeModel *etree, ETreePath *node) -{ - g_return_val_if_fail (etree != NULL, NULL); - g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); - - return ETM_CLASS(etree)->get_next(etree, node); -} - -/** - * e_tree_model_node_get_prev: - * @etree: - * @node: - * - * - * - * Return value: - **/ -ETreePath * -e_tree_model_node_get_prev (ETreeModel *etree, ETreePath *node) -{ - g_return_val_if_fail (etree != NULL, NULL); - g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); - - return ETM_CLASS(etree)->get_prev(etree, node); -} - -/** - * e_tree_model_node_depth: - * @etree: - * @path: - * - * - * - * Return value: - **/ -guint -e_tree_model_node_depth (ETreeModel *etree, ETreePath *path) -{ - g_return_val_if_fail (etree != NULL, 0); - g_return_val_if_fail (E_IS_TREE_MODEL (etree), 0); - - return e_tree_path_depth (path) - 1; -} - -/** - * e_tree_model_node_get_parent: - * @etree: - * @path: - * - * - * - * Return value: - **/ -ETreePath * -e_tree_model_node_get_parent (ETreeModel *etree, ETreePath *path) -{ - g_return_val_if_fail(etree != NULL, NULL); - return ETM_CLASS(etree)->get_parent(etree, path); -} - -/** - * e_tree_model_node_is_root: - * @etree: - * @path: - * - * - * - * Return value: - **/ -gboolean -e_tree_model_node_is_root (ETreeModel *etree, ETreePath *path) -{ - g_return_val_if_fail(etree != NULL, FALSE); - return (e_tree_model_node_depth (etree, path) == 0); -} - -/** - * e_tree_model_node_is_expandable: - * @etree: - * @path: - * - * - * - * Return value: - **/ -gboolean -e_tree_model_node_is_expandable (ETreeModel *etree, ETreePath *path) -{ - g_return_val_if_fail(etree != NULL, FALSE); - return (e_tree_model_node_get_children (etree, path, NULL) > 0); -} - -/** - * e_tree_model_node_is_expanded: - * @etree: - * @path: - * - * - * - * Return value: - **/ -gboolean -e_tree_model_node_is_expanded (ETreeModel *etree, ETreePath *path) -{ - g_return_val_if_fail(etree != NULL, FALSE); - return ETM_CLASS(etree)->is_expanded (etree, path); -} - -/** - * e_tree_model_node_is_visible: - * @etree: - * @path: - * - * - * - * Return value: - **/ -gboolean -e_tree_model_node_is_visible (ETreeModel *etree, ETreePath *path) -{ - g_return_val_if_fail(etree != NULL, FALSE); - return ETM_CLASS(etree)->is_visible (etree, path); -} - -/** - * e_tree_model_node_set_expanded: - * @etree: - * @path: - * @expanded: - * - * - **/ -void -e_tree_model_node_set_expanded (ETreeModel *etree, ETreePath *path, gboolean expanded) -{ - g_return_if_fail(etree != NULL); - ETM_CLASS(etree)->set_expanded (etree, path, expanded); -} - -/** - * e_tree_model_node_set_expanded_recurse: - * @etree: - * @path: - * @expanded: - * - * - **/ -void -e_tree_model_node_set_expanded_recurse (ETreeModel *etree, ETreePath *path, gboolean expanded) -{ - g_return_if_fail(etree != NULL); - ETM_CLASS(etree)->set_expanded_recurse (etree, path, expanded); -} - -guint -e_tree_model_node_get_children (ETreeModel *etree, ETreePath *path, ETreePath ***paths) -{ - g_return_val_if_fail(etree != NULL, 0); - return ETM_CLASS(etree)->get_children (etree, path, paths); -} - -/** - * e_tree_model_node_num_visible_descendents: - * @etm: - * @node: - * - * - * - * Return value: - **/ -guint -e_tree_model_node_num_visible_descendents (ETreeModel *etm, ETreePath *node) -{ - g_return_val_if_fail(node != NULL, 0); - return node->visible_descendents; -} - -/** - * e_tree_model_node_get_data: - * @etm: - * @node: - * - * - * - * Return value: - **/ -gpointer -e_tree_model_node_get_data (ETreeModel *etm, ETreePath *node) -{ - g_return_val_if_fail (node, NULL); - - return node->node_data; -} - -/** - * e_tree_model_node_set_data: - * @etm: - * @node: - * @node_data: - * - * - **/ -void -e_tree_model_node_set_data (ETreeModel *etm, ETreePath *node, gpointer node_data) -{ - g_return_if_fail (node); - - node->node_data = node_data; -} - -/** - * e_tree_model_node_insert: - * @tree_model: - * @parent_path: - * @position: - * @node_data: - * - * - * - * Return value: - **/ -ETreePath* -e_tree_model_node_insert (ETreeModel *tree_model, - ETreePath *parent_path, - int position, - gpointer node_data) -{ - ETreeModelPriv *priv; - ETreePath *new_path; - - g_return_val_if_fail(tree_model != NULL, NULL); - - priv = tree_model->priv; - - g_return_val_if_fail (parent_path != NULL || priv->root == NULL, NULL); - - priv = tree_model->priv; - - new_path = g_chunk_new0 (ETreePath, priv->node_chunk); - - new_path->expanded = FALSE; - new_path->node_data = node_data; - - if (parent_path != NULL) { - - if (parent_path->first_child == NULL - && !parent_path->expanded_set) { - e_tree_model_node_set_expanded (tree_model, - parent_path, - priv->expanded_default); - } - - e_tree_path_insert (parent_path, position, new_path); - - if (e_tree_model_node_is_visible (tree_model, new_path)) { - int parent_row, child_offset = 0; - ETreePath *n; - - /* we need to iterate back up to the root, incrementing the number of visible - descendents */ - for (n = parent_path; n; n = n->parent) { - n->visible_descendents ++; - } - - /* determine if we are inserting at the end of this parent */ - if (position == -1 || position == parent_path->num_children) { - position = e_tree_model_node_num_visible_descendents (tree_model, parent_path) - 1; - } else { - /* if we're not inserting at the end of the array, position is the child node we're - inserting at, not the absolute row position - need to count expanded nodes before it too */ - int i = position; - - n = e_tree_model_node_get_first_child(tree_model, parent_path); - while (n != NULL && i > 0) { - child_offset += n->visible_descendents; - n = n->next_sibling; - i--; - } - } - - - /* if the parent is the root, no need to search for its position since it aint there */ - if (parent_path->parent == NULL) { - parent_row = -1; - } else { - parent_row = e_tree_model_row_of_node (tree_model, parent_path); - } - - e_table_model_pre_change(E_TABLE_MODEL(tree_model)); - - priv->row_array = g_array_insert_val (priv->row_array, - parent_row + position + 1 + child_offset, new_path); - - /* only do this if we know a changed signal isn't coming later on */ - if (priv->frozen == 0) - e_table_model_row_inserted (E_TABLE_MODEL(tree_model), parent_row + position + 1 + child_offset); - } - - if (parent_path->compare) - e_tree_model_node_sort (tree_model, parent_path); - } - else { - priv->root = new_path; - if (priv->root_visible) { - priv->row_array = g_array_insert_val (priv->row_array, 0, priv->root); - e_table_model_row_inserted (E_TABLE_MODEL (tree_model), 0); - } - else { - /* need to mark the new node as expanded or - we'll never see it's children */ - new_path->expanded = TRUE; - new_path->expanded_set = TRUE; - } - } - - return new_path; -} - -/** - * e_tree_model_node_insert_id: - * @tree_model: - * @parent_path: - * @position: - * @node_data: - * @save_id: - * - * - * - * Return value: - **/ -ETreePath* -e_tree_model_node_insert_id (ETreeModel *tree_model, - ETreePath *parent_path, - int position, - gpointer node_data, - const char *save_id) -{ - ETreePath *path; - - g_return_val_if_fail(tree_model != NULL, NULL); - - path = e_tree_model_node_insert (tree_model, parent_path, position, node_data); - - e_tree_model_node_set_save_id (tree_model, path, save_id); - - return path; -} - -/** - * e_tree_model_node_insert_before: - * @etree: - * @parent: - * @sibling: - * @node_data: - * - * - * - * Return value: - **/ -ETreePath * -e_tree_model_node_insert_before (ETreeModel *etree, - ETreePath *parent, - ETreePath *sibling, - gpointer node_data) -{ - ETreePath *child; - int position = 0; - - g_return_val_if_fail(etree != NULL, NULL); - - for (child = parent->first_child; child; child = child->next_sibling) { - if (child == sibling) - break; - position ++; - } - return e_tree_model_node_insert (etree, parent, position, node_data); -} - -/* just blows away child data, doesn't take into account unlinking/etc */ -static void -child_free(ETreeModel *etree, ETreePath *node) -{ - ETreePath *child, *next; - ETreeModelPriv *priv = etree->priv; - - child = node->first_child; - while (child) { - next = child->next_sibling; - child_free(etree, child); - child = next; - } - - if (node->save_id) { - g_hash_table_remove(priv->expanded_state, node->save_id); - g_free(node->save_id); - } - g_chunk_free(node, priv->node_chunk); -} - -/** - * e_tree_model_node_remove: - * @etree: - * @path: - * - * - * - * Return value: - **/ -gpointer -e_tree_model_node_remove (ETreeModel *etree, ETreePath *path) -{ - ETreeModelPriv *priv = etree->priv; - ETreePath *parent = path->parent; - gpointer ret = path->node_data; - int row, visible = 0, base = 0; - gboolean dochanged; - - g_return_val_if_fail(etree != NULL, NULL); - - /* work out what range of visible rows to remove */ - if (parent) { - if (e_tree_model_node_is_visible(etree, path)) { - base = e_tree_model_row_of_node(etree, path); - visible = path->visible_descendents + 1; - } - } else if (path == priv->root) { - priv->root = NULL; - if (priv->root_visible) { - base = 0; - visible = path->visible_descendents + 1; - } else { - base = 0; - visible = path->visible_descendents; - } - } else { - g_warning("Trying to remove invalid path %p", path); - return NULL; - } - - /* unlink this node - we only have to unlink the root node being removed, - since the others are only references from this node */ - e_tree_path_unlink (path); - - /*printf("removing %d nodes from position %d\n", visible, base);*/ - - if (visible > 0) { - /* fix up the parent visible counts */ - for (; parent; parent = parent->parent) { - parent->visible_descendents -= visible; - } - - /* if we have a lot of nodes to remove, then we dont row_deleted each one */ - /* could probably be tuned, but this'll do, since its normally only when we - remove the whole lot do we really care */ - dochanged = (visible > 1000) || (visible > (priv->row_array->len / 4)); - - e_table_model_pre_change(E_TABLE_MODEL (etree)); - - /* and physically remove them */ - if (visible == priv->row_array->len) { - g_array_set_size(priv->row_array, 0); - } else { - memmove(&g_array_index(priv->row_array, ETreePath *, base), - &g_array_index(priv->row_array, ETreePath *, base+visible), - (priv->row_array->len - (base+visible)) * sizeof(ETreePath *)); - g_array_set_size(priv->row_array, priv->row_array->len - visible); - } - - /* tell the system we've removed (these) nodes */ - if (priv->frozen == 0) { - if (dochanged) { - e_table_model_changed(E_TABLE_MODEL(etree)); - } else { - for (row=visible-1;row>=0;row--) { - e_table_model_row_deleted(E_TABLE_MODEL(etree), row+base); - } - } - } - } - - child_free(etree, path); - - return ret; -} - -static void -add_visible_descendents_to_array (ETreeModel *etm, ETreePath *node, int *row, int *count) -{ - ETreeModelPriv *priv = etm->priv; - - /* add a row for this node */ - e_table_model_pre_change(E_TABLE_MODEL (etm)); - priv->row_array = g_array_insert_val (priv->row_array, (*row), node); - if (priv->frozen == 0) - e_table_model_row_inserted (E_TABLE_MODEL (etm), (*row)); - (*row) ++; - (*count) ++; - - /* then loop over its children, calling this routine for each - of them */ - if (node->expanded) { - ETreePath *child; - for (child = node->first_child; child; - child = child->next_sibling) { - add_visible_descendents_to_array (etm, child, row, count); - } - } -} - -static void -save_expanded_state_func (char *key, gboolean expanded, gpointer user_data) -{ - if (expanded) { - xmlNode *root = (xmlNode*)user_data; - xmlNode *node_root = xmlNewNode (NULL, (xmlChar*) "node"); - - xmlAddChild (root, node_root); - xmlNewChild (node_root, NULL, (xmlChar *) "id", (xmlChar*) key); - } -} - -/** - * e_tree_model_save_expanded_state: - * @etm: - * @filename: - * - * - * - * Return value: - **/ -gboolean -e_tree_model_save_expanded_state (ETreeModel *etm, const char *filename) -{ - xmlDoc *doc; - xmlNode *root; - int fd, rv; - xmlChar *buf; - int buf_size; - ETreeModelPriv *priv = etm->priv; - - g_return_val_if_fail(etm != NULL, FALSE); - - doc = xmlNewDoc ((xmlChar*) "1.0"); - root = xmlNewDocNode (doc, NULL, - (xmlChar *) "expanded_state", - NULL); - xmlDocSetRootElement (doc, root); - - g_hash_table_foreach (priv->expanded_state, - (GHFunc)save_expanded_state_func, - root); - - fd = open (filename, O_CREAT | O_TRUNC | O_WRONLY, 0777); - - xmlDocDumpMemory (doc, &buf, &buf_size); - - if (buf == NULL) { - g_error ("Failed to write %s: xmlBufferCreate() == NULL", filename); - return FALSE; - } - - rv = write (fd, buf, buf_size); - xmlFree (buf); - close (fd); - - if (0 > rv) { - g_error ("Failed to write new %s: %d\n", filename, errno); - unlink (filename); - return FALSE; - } - - return TRUE; -} - -static char * -get_string_value (xmlNode *node, - const char *name) -{ - xmlNode *p; - xmlChar *xml_string; - char *retval; - - p = e_xml_get_child_by_name (node, (xmlChar *) name); - if (p == NULL) - return NULL; - - p = e_xml_get_child_by_name (p, (xmlChar *) "text"); - if (p == NULL) /* there's no text between the tags, return the empty string */ - return g_strdup(""); - - xml_string = xmlNodeListGetString (node->doc, p, 1); - retval = g_strdup ((char *) xml_string); - xmlFree (xml_string); - - return retval; -} - -/** - * e_tree_model_load_expanded_state: - * @etm: - * @filename: - * - * - * - * Return value: - **/ -gboolean -e_tree_model_load_expanded_state (ETreeModel *etm, const char *filename) -{ - ETreeModelPriv *priv = etm->priv; - xmlDoc *doc; - xmlNode *root; - xmlNode *child; - - g_return_val_if_fail(etm != NULL, FALSE); - - doc = xmlParseFile (filename); - if (!doc) - return FALSE; - - root = xmlDocGetRootElement (doc); - if (root == NULL || strcmp (root->name, "expanded_state")) { - xmlFreeDoc (doc); - return FALSE; - } - - for (child = root->childs; child; child = child->next) { - char *id; - - if (strcmp (child->name, "node")) { - g_warning ("unknown node '%s' in %s", child->name, filename); - continue; - } - - id = get_string_value (child, "id"); - - g_hash_table_insert (priv->expanded_state, id, (gpointer)TRUE); - } - - xmlFreeDoc (doc); - - return TRUE; -} - - -/** - * e_tree_model_node_set_save_id: - * @etm: - * @node: - * @id: - * - * - **/ -void -e_tree_model_node_set_save_id (ETreeModel *etm, ETreePath *node, const char *id) -{ - char *key; - gboolean expanded_state; - ETreeModelPriv *priv; - - g_return_if_fail(etm != NULL); - g_return_if_fail (E_TREE_MODEL (etm)); - g_return_if_fail (node); - - priv = etm->priv; - - if (g_hash_table_lookup_extended (priv->expanded_state, - id, (gpointer*)&key, (gpointer*)&expanded_state)) { - - e_tree_model_node_set_expanded (etm, node, - expanded_state); - - /* important that this comes after the e_tree_model_node_set_expanded */ - node->save_id = key; - } - else { - node->save_id = g_strdup (id); - - g_hash_table_insert (priv->expanded_state, node->save_id, (gpointer)node->expanded); - } -} - - - -/** - * e_tree_model_node_set_compare_function: - * @tree_model: - * @node: - * @compare: - * - * - **/ -void -e_tree_model_node_set_compare_function (ETreeModel *tree_model, - ETreePath *node, - ETreePathCompareFunc compare) -{ - gboolean need_sort; - - g_return_if_fail (tree_model != NULL); - g_return_if_fail (E_TREE_MODEL (tree_model)); - g_return_if_fail (node); - - need_sort = (compare != node->compare); - - node->compare = compare; - - if (need_sort) - e_tree_model_node_sort (tree_model, node); -} - -typedef struct { - ETreeModel *model; - ETreePath *path; - ETreePathCompareFunc compare; - gboolean was_expanded; -} ETreeSortInfo; - -static gint -e_tree_model_node_compare (ETreeSortInfo *info1, ETreeSortInfo *info2) -{ - return info1->compare (info1->model, info1->path, info2->path); -} - -/** - * e_tree_model_node_sort: - * @tree_model: - * @node: - * - * - **/ -void -e_tree_model_node_sort (ETreeModel *tree_model, - ETreePath *node) -{ - int num_nodes = node->num_children; - ETreeSortInfo *sort_info; - int i; - int child_index; - gboolean node_expanded; - ETreeModelPriv *priv = tree_model->priv;; - - node_expanded = e_tree_model_node_is_expanded (tree_model, node); - - g_return_if_fail (tree_model != NULL); - g_return_if_fail (E_TREE_MODEL (tree_model)); - g_return_if_fail (node); - - g_return_if_fail (node->compare); - - if (num_nodes == 0) - return; - - e_table_model_pre_change(E_TABLE_MODEL (tree_model)); - - sort_info = g_new (ETreeSortInfo, num_nodes); - - child_index = e_tree_model_row_of_node (tree_model, node) + 1; - - /* collect our info and remove the children */ - for (i = 0; i < num_nodes; i ++) { - sort_info[i].path = node->first_child; - sort_info[i].was_expanded = e_tree_model_node_is_expanded (tree_model, sort_info[i].path); - sort_info[i].model = tree_model; - sort_info[i].compare = node->compare; - - e_tree_model_node_set_expanded(tree_model, sort_info[i].path, FALSE); - if (node_expanded) - priv->row_array = g_array_remove_index (priv->row_array, child_index); - e_tree_path_unlink (sort_info[i].path); - } - - /* sort things */ - qsort (sort_info, num_nodes, sizeof(ETreeSortInfo), (GCompareFunc)e_tree_model_node_compare); - - /* reinsert the children nodes into the tree in the sorted order */ - for (i = 0; i < num_nodes; i ++) { - e_tree_path_insert (node, i, sort_info[i].path); - if (node_expanded) - priv->row_array = g_array_insert_val (priv->row_array, child_index + i, - sort_info[i].path); - } - - /* make another pass expanding the children as needed. - - XXX this used to be in the loop above, but a recent change - (either here or in the etable code) causes an assertion and - a crash */ - for (i = 0; i < num_nodes; i ++) { - e_tree_model_node_set_expanded (tree_model, sort_info[i].path, sort_info[i].was_expanded); - } - - g_free (sort_info); - - if (priv->frozen == 0) - e_table_model_changed (E_TABLE_MODEL (tree_model)); -} - diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h deleted file mode 100644 index 50bd8064a5..0000000000 --- a/widgets/table/e-tree-model.h +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TREE_MODEL_H_ -#define _E_TREE_MODEL_H_ - -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <gal/e-table/e-table-model.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define E_TREE_MODEL_TYPE (e_tree_model_get_type ()) -#define E_TREE_MODEL(o) (GTK_CHECK_CAST ((o), E_TREE_MODEL_TYPE, ETreeModel)) -#define E_TREE_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_MODEL_TYPE, ETreeModelClass)) -#define E_IS_TREE_MODEL(o) (GTK_CHECK_TYPE ((o), E_TREE_MODEL_TYPE)) -#define E_IS_TREE_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_MODEL_TYPE)) - -typedef struct ETreePath ETreePath; -typedef struct ETreeModel ETreeModel; -typedef struct ETreeModelPriv ETreeModelPriv; -typedef struct ETreeModelClass ETreeModelClass; -typedef gint (*ETreePathCompareFunc)(ETreeModel *model, ETreePath *path1, ETreePath *path2); -typedef gboolean (*ETreePathFunc)(ETreeModel *model, ETreePath *path, gpointer data); - -struct ETreeModel { - ETableModel base; - ETreeModelPriv *priv; -}; - -struct ETreeModelClass { - ETableModelClass parent_class; - - /* - * Virtual methods - */ - ETreePath *(*get_root) (ETreeModel *etm); - - ETreePath *(*get_parent) (ETreeModel *etm, ETreePath* node); - ETreePath *(*get_first_child) (ETreeModel *etm, ETreePath* node); - ETreePath *(*get_last_child) (ETreeModel *etm, ETreePath* node); - ETreePath *(*get_next) (ETreeModel *etm, ETreePath* node); - ETreePath *(*get_prev) (ETreeModel *etm, ETreePath* node); - guint (*get_children) (ETreeModel *etm, ETreePath* node, ETreePath ***paths); - - gboolean (*is_expanded) (ETreeModel *etm, ETreePath* node); - gboolean (*is_visible) (ETreeModel *etm, ETreePath* node); - void (*set_expanded) (ETreeModel *etm, ETreePath* node, gboolean expanded); - void (*set_expanded_recurse) (ETreeModel *etm, ETreePath *node, gboolean expanded); - void (*set_expanded_level) (ETreeModel *etm, ETreePath *node, gboolean expanded, int level); - - GdkPixbuf *(*icon_at) (ETreeModel *etm, ETreePath* node); - ETreePath* (*node_at_row) (ETreeModel *etm, int row); - - /* - * ETable analogs - */ - void *(*value_at) (ETreeModel *etm, ETreePath* node, int col); - void (*set_value_at) (ETreeModel *etm, ETreePath* node, int col, const void *val); - gboolean (*is_editable) (ETreeModel *etm, ETreePath* node, int col); - - - /* - * Signals - */ - void (*node_changed) (ETreeModel *etm, ETreePath *node); - void (*node_inserted) (ETreeModel *etm, ETreePath *parent, ETreePath *inserted_node); - void (*node_removed) (ETreeModel *etm, ETreePath *parent, ETreePath *removed_node); - void (*node_collapsed) (ETreeModel *etm, ETreePath *node); - void (*node_expanded) (ETreeModel *etm, ETreePath *node, gboolean *allow_expand); - -}; - -GtkType e_tree_model_get_type (void); -void e_tree_model_construct (ETreeModel *etree); -ETreeModel *e_tree_model_new (void); - -/* tree traversal operations */ -ETreePath *e_tree_model_get_root (ETreeModel *etree); -ETreePath *e_tree_model_node_get_parent (ETreeModel *etree, ETreePath *path); -ETreePath *e_tree_model_node_get_first_child (ETreeModel *etree, ETreePath *path); -ETreePath *e_tree_model_node_get_last_child (ETreeModel *etree, ETreePath *path); -ETreePath *e_tree_model_node_get_next (ETreeModel *etree, ETreePath *path); -ETreePath *e_tree_model_node_get_prev (ETreeModel *etree, ETreePath *path); - -/* node operations */ -ETreePath *e_tree_model_node_insert (ETreeModel *etree, ETreePath *parent, int position, gpointer node_data); -ETreePath *e_tree_model_node_insert_before (ETreeModel *etree, ETreePath *parent, ETreePath *sibling, gpointer node_data); -gpointer e_tree_model_node_remove (ETreeModel *etree, ETreePath *path); - -/* Freeze and thaw */ -void e_tree_model_freeze (ETreeModel *etree); -void e_tree_model_thaw (ETreeModel *etree); - -/* node accessors */ -gboolean e_tree_model_node_is_root (ETreeModel *etree, ETreePath *path); -gboolean e_tree_model_node_is_expandable (ETreeModel *etree, ETreePath *path); -gboolean e_tree_model_node_is_expanded (ETreeModel *etree, ETreePath *path); -gboolean e_tree_model_node_is_visible (ETreeModel *etree, ETreePath *path); -void e_tree_model_set_expanded_default (ETreeModel *etree, gboolean expanded); -void e_tree_model_node_set_expanded (ETreeModel *etree, ETreePath *path, gboolean expanded); -void e_tree_model_node_set_expanded_recurse (ETreeModel *etree, ETreePath *path, gboolean expanded); -guint e_tree_model_node_get_children (ETreeModel *etree, ETreePath *path, ETreePath ***paths); -guint e_tree_model_node_depth (ETreeModel *etree, ETreePath *path); -guint e_tree_model_node_num_visible_descendents (ETreeModel *etm, ETreePath *node); -gpointer e_tree_model_node_get_data (ETreeModel *etm, ETreePath *node); -void e_tree_model_node_set_data (ETreeModel *etm, ETreePath *node, gpointer node_data); - -/* display oriented routines */ -ETreePath *e_tree_model_node_at_row (ETreeModel *etree, int row); -GdkPixbuf *e_tree_model_icon_of_node (ETreeModel *etree, ETreePath *path); -int e_tree_model_row_of_node (ETreeModel *etree, ETreePath *path); -void e_tree_model_root_node_set_visible (ETreeModel *etree, gboolean visible); -gboolean e_tree_model_root_node_is_visible (ETreeModel *etree); - -/* sort routine, analogous to gtk_ctree_node_sort */ -void e_tree_model_node_set_compare_function (ETreeModel *tree_model, ETreePath *node, ETreePathCompareFunc compare); -void e_tree_model_node_sort (ETreeModel *tree_model, ETreePath *node); - -/* -** Routines for emitting signals on the ETreeModel -*/ -void e_tree_model_node_changed (ETreeModel *tree_model, ETreePath *node); -void e_tree_model_node_inserted (ETreeModel *tree_model, ETreePath *parent_node, ETreePath *inserted_node); -void e_tree_model_node_removed (ETreeModel *tree_model, ETreePath *parent_node, ETreePath *removed_node); -void e_tree_model_node_collapsed (ETreeModel *tree_model, ETreePath *node); -void e_tree_model_node_expanded (ETreeModel *tree_model, ETreePath *node, gboolean *allow_expand); - -/* expanded state saving stuff */ -gboolean e_tree_model_save_expanded_state (ETreeModel *etm, const char *filename); -gboolean e_tree_model_load_expanded_state (ETreeModel *etm, const char *filename); -void e_tree_model_node_set_save_id (ETreeModel *etm, ETreePath *node, const char *id); -ETreePath* e_tree_model_node_insert_id (ETreeModel *tree_model, ETreePath *parent_path, - int position, gpointer node_data, const char *save_id); - -/* depth first traversal of path's descendents, calling func on each one */ -void e_tree_model_node_traverse (ETreeModel *model, ETreePath *path, ETreePathFunc func, gpointer data); - -void e_tree_model_show_node (ETreeModel *etm, ETreePath* node); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TREE_MODEL_H */ diff --git a/widgets/table/e-tree-simple.c b/widgets/table/e-tree-simple.c deleted file mode 100644 index 5741d1cf0f..0000000000 --- a/widgets/table/e-tree-simple.c +++ /dev/null @@ -1,202 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-tree-simple.c: a Tree Model that offers a function pointer - * interface to using ETreeModel, similar to ETableSimple. - * - * Author: - * Chris Toshok (toshok@ximian.com) - * - * (C) 2000 Ximian, Inc. */ - -#include <config.h> -#include <gtk/gtksignal.h> -#include "gal/util/e-util.h" -#include "e-tree-simple.h" - -#define PARENT_TYPE E_TREE_MODEL_TYPE - -static int -simple_column_count (ETableModel *etm) -{ - ETreeSimple *simple = E_TREE_SIMPLE(etm); - - if (simple->col_count) - return simple->col_count (etm, simple->model_data); - else - return 0; -} - -/* The default for simple_duplicate_value is to return the raw value. */ -static void * -simple_duplicate_value (ETableModel *etm, int col, const void *value) -{ - ETreeSimple *simple = E_TREE_SIMPLE(etm); - - if (simple->duplicate_value) - return simple->duplicate_value (etm, col, value, simple->model_data); - else - return (void *)value; -} - -static void -simple_free_value (ETableModel *etm, int col, void *value) -{ - ETreeSimple *simple = E_TREE_SIMPLE(etm); - - if (simple->free_value) - simple->free_value (etm, col, value, simple->model_data); -} - -static void * -simple_initialize_value (ETableModel *etm, int col) -{ - ETreeSimple *simple = E_TREE_SIMPLE(etm); - - if (simple->initialize_value) - return simple->initialize_value (etm, col, simple->model_data); - else - return NULL; -} - -static gboolean -simple_value_is_empty (ETableModel *etm, int col, const void *value) -{ - ETreeSimple *simple = E_TREE_SIMPLE(etm); - - if (simple->value_is_empty) - return simple->value_is_empty (etm, col, value, simple->model_data); - else - return FALSE; -} - -static char * -simple_value_to_string (ETableModel *etm, int col, const void *value) -{ - ETreeSimple *simple = E_TREE_SIMPLE(etm); - - if (simple->value_to_string) - return simple->value_to_string (etm, col, value, simple->model_data); - else - return g_strdup (""); -} - -static void * -simple_value_at (ETreeModel *etm, ETreePath *node, int col) -{ - ETreeSimple *simple = E_TREE_SIMPLE(etm); - - return simple->value_at (etm, node, col, simple->model_data); -} - -static GdkPixbuf * -simple_icon_at (ETreeModel *etm, ETreePath *node) -{ - ETreeSimple *simple = E_TREE_SIMPLE(etm); - - return simple->icon_at (etm, node, simple->model_data); -} - -static void -simple_set_value_at (ETreeModel *etm, ETreePath *node, int col, const void *val) -{ - ETreeSimple *simple = E_TREE_SIMPLE(etm); - - simple->set_value_at (etm, node, col, val, simple->model_data); -} - -static gboolean -simple_is_editable (ETreeModel *etm, ETreePath *node, int col) -{ - ETreeSimple *simple = E_TREE_SIMPLE(etm); - - return simple->is_editable (etm, node, col, simple->model_data); -} - -static void -e_tree_simple_class_init (GtkObjectClass *object_class) -{ - ETreeModelClass *model_class = (ETreeModelClass *) object_class; - ETableModelClass *table_model_class = (ETableModelClass *) object_class; - - table_model_class->column_count = simple_column_count; - table_model_class->duplicate_value = simple_duplicate_value; - table_model_class->free_value = simple_free_value; - table_model_class->initialize_value = simple_initialize_value; - table_model_class->value_is_empty = simple_value_is_empty; - table_model_class->value_to_string = simple_value_to_string; - - model_class ->icon_at = simple_icon_at; - model_class ->value_at = simple_value_at; - model_class ->set_value_at = simple_set_value_at; - model_class ->is_editable = simple_is_editable; -} - -E_MAKE_TYPE(e_tree_simple, "ETreeSimple", ETreeSimple, e_tree_simple_class_init, NULL, PARENT_TYPE) - -/** - * e_tree_simple_new: - * @col_count: - * @duplicate_value: - * @free_value: - * @initialize_value: - * @value_is_empty: - * @value_to_string: - * @icon_at: - * @value_at: - * @set_value_at: - * @is_editable: - * @model_data: - * - * This initializes a new ETreeSimpleModel object. ETreeSimpleModel is - * an implementaiton of the abstract class ETreeModel. The ETreeSimpleModel - * is designed to allow people to easily create ETreeModels without having - * to create a new GtkType derived from ETreeModel every time they need one. - * - * Instead, ETreeSimpleModel uses a setup based in callback functions, every - * callback function signature mimics the signature of each ETreeModel method - * and passes the extra @data pointer to each one of the method to provide them - * with any context they might want to use. - * - * ETreeSimple is to ETreeModel as ETableSimple is to ETableModel. - * - * Return value: An ETreeSimple object (which is also an ETreeModel - * object). - **/ -ETreeModel * -e_tree_simple_new (ETableSimpleColumnCountFn col_count, - ETableSimpleDuplicateValueFn duplicate_value, - ETableSimpleFreeValueFn free_value, - ETableSimpleInitializeValueFn initialize_value, - ETableSimpleValueIsEmptyFn value_is_empty, - ETableSimpleValueToStringFn value_to_string, - - ETreeSimpleIconAtFn icon_at, - ETreeSimpleValueAtFn value_at, - ETreeSimpleSetValueAtFn set_value_at, - ETreeSimpleIsEditableFn is_editable, - - gpointer model_data) -{ - ETreeSimple *etg; - - etg = gtk_type_new (e_tree_simple_get_type ()); - - e_tree_model_construct (E_TREE_MODEL (etg)); - - etg->col_count = col_count; - etg->duplicate_value = duplicate_value; - etg->free_value = free_value; - etg->initialize_value = initialize_value; - etg->value_is_empty = value_is_empty; - etg->value_to_string = value_to_string; - - etg->icon_at = icon_at; - etg->value_at = value_at; - etg->set_value_at = set_value_at; - etg->is_editable = is_editable; - - etg->model_data = model_data; - - return (ETreeModel*)etg; -} - diff --git a/widgets/table/e-tree-simple.h b/widgets/table/e-tree-simple.h deleted file mode 100644 index 797de7c8a7..0000000000 --- a/widgets/table/e-tree-simple.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#ifndef _E_TREE_SIMPLE_H_ -#define _E_TREE_SIMPLE_H_ - -#include <gal/e-table/e-tree-model.h> -#include <gal/e-table/e-table-simple.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_TREE_SIMPLE_TYPE (e_tree_simple_get_type ()) -#define E_TREE_SIMPLE(o) (GTK_CHECK_CAST ((o), E_TREE_SIMPLE_TYPE, ETreeSimple)) -#define E_TREE_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_SIMPLE_TYPE, ETreeSimpleClass)) -#define E_IS_TREE_SIMPLE(o) (GTK_CHECK_TYPE ((o), E_TREE_SIMPLE_TYPE)) -#define E_IS_TREE_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_SIMPLE_TYPE)) - - -typedef GdkPixbuf* (*ETreeSimpleIconAtFn) (ETreeModel *etree, ETreePath *path, void *model_data); -typedef void* (*ETreeSimpleValueAtFn) (ETreeModel *etree, ETreePath *path, int col, void *model_data); -typedef void (*ETreeSimpleSetValueAtFn) (ETreeModel *etree, ETreePath *path, int col, const void *val, void *model_data); -typedef gboolean (*ETreeSimpleIsEditableFn) (ETreeModel *etree, ETreePath *path, int col, void *model_data); - -typedef struct { - ETreeModel parent; - - /* Table methods */ - ETableSimpleColumnCountFn col_count; - ETableSimpleDuplicateValueFn duplicate_value; - ETableSimpleFreeValueFn free_value; - ETableSimpleInitializeValueFn initialize_value; - ETableSimpleValueIsEmptyFn value_is_empty; - ETableSimpleValueToStringFn value_to_string; - - /* Tree methods */ - ETreeSimpleIconAtFn icon_at; - ETreeSimpleValueAtFn value_at; - ETreeSimpleSetValueAtFn set_value_at; - ETreeSimpleIsEditableFn is_editable; - - gpointer model_data; -} ETreeSimple; - -typedef struct { - ETreeModelClass parent_class; -} ETreeSimpleClass; - -GtkType e_tree_simple_get_type (void); - -ETreeModel *e_tree_simple_new (ETableSimpleColumnCountFn col_count, - ETableSimpleDuplicateValueFn duplicate_value, - ETableSimpleFreeValueFn free_value, - ETableSimpleInitializeValueFn initialize_value, - ETableSimpleValueIsEmptyFn value_is_empty, - ETableSimpleValueToStringFn value_to_string, - ETreeSimpleIconAtFn icon_at, - ETreeSimpleValueAtFn value_at, - ETreeSimpleSetValueAtFn set_value_at, - ETreeSimpleIsEditableFn is_editable, - gpointer model_data); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_TREE_SIMPLE_H_ */ diff --git a/widgets/table/e-tree-sorted-variable.c b/widgets/table/e-tree-sorted-variable.c deleted file mode 100644 index 754876de27..0000000000 --- a/widgets/table/e-tree-sorted-variable.c +++ /dev/null @@ -1,458 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-tree-sorted-variable.c: Implements a table that sorts another table - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Ximian, Inc. - */ -#include <config.h> -#include <stdlib.h> -#include <gtk/gtksignal.h> -#include <string.h> -#include "gal/util/e-util.h" -#include "e-tree-sorted-variable.h" - -#define d(x) - -#define PARENT_TYPE E_TREE_MODEL_TYPE - -#define INCREMENT_AMOUNT 100 - -/* maximum insertions between an idle event that we will do without scheduling an idle sort */ -#define ETSV_INSERT_MAX (4) - -static ETreeModelClass *etsv_parent_class; - -struct ETreePath { - GNode node; -}; - -struct ETreeSortedVariablePrivate { - GNode *root; -}; - -static void etsv_proxy_model_changed (ETableModel *etm, ETreeSortedVariable *etsv); -#if 0 -static void etsv_proxy_model_row_changed (ETableModel *etm, int row, ETreeSortedVariable *etsv); -static void etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETreeSortedVariable *etsv); -#endif -static void etsv_sort_info_changed (ETableSortInfo *info, ETreeSortedVariable *etsv); -static void etsv_sort (ETreeSortedVariable *etsv); -static void etsv_add (ETreeSortedVariable *etsv, gint row); -static void etsv_add_all (ETreeSortedVariable *etsv); - -static void -etsv_destroy (GtkObject *object) -{ - ETreeSortedVariable *etsv = E_TREE_SORTED_VARIABLE (object); - - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etsv->table_model_changed_id); -#if 0 - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etsv->table_model_row_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etsv->table_model_cell_changed_id); -#endif - gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info), - etsv->sort_info_changed_id); - - if (etsv->sort_idle_id) { - g_source_remove(etsv->sort_idle_id); - } - if (etsv->insert_idle_id) { - g_source_remove(etsv->insert_idle_id); - } - - etsv->table_model_changed_id = 0; - etsv->table_model_row_changed_id = 0; - etsv->table_model_cell_changed_id = 0; - - if (etsv->sort_info) - gtk_object_unref(GTK_OBJECT(etsv->sort_info)); - if (etsv->full_header) - gtk_object_unref(GTK_OBJECT(etsv->full_header)); - - GTK_OBJECT_CLASS (etsv_parent_class)->destroy (object); -} - -static void -etsv_class_init (GtkObjectClass *object_class) -{ - ETreeSortedVariableClass *etsv_class = E_TREE_MODEL_CLASS(object_class); - - etsv_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = etsv_destroy; - - etsv_class->add = etsv_add; - etsv_class->add_all = etsv_add_all; -} - -static void -etsv_init (ETreeSortedVariable *etsv) -{ - etsv->full_header = NULL; - etsv->sort_info = NULL; - - etsv->table_model_changed_id = 0; - etsv->table_model_row_changed_id = 0; - etsv->table_model_cell_changed_id = 0; - etsv->sort_info_changed_id = 0; - - etsv->sort_idle_id = 0; - etsv->insert_count = 0; -} - -E_MAKE_TYPE(e_tree_sorted_variable, "ETreeSortedVariable", ETreeSortedVariable, etsv_class_init, etsv_init, PARENT_TYPE); - -static gboolean -etsv_sort_idle(ETreeSortedVariable *etsv) -{ - gtk_object_ref(GTK_OBJECT(etsv)); - etsv_sort(etsv); - etsv->sort_idle_id = 0; - etsv->insert_count = 0; - gtk_object_unref(GTK_OBJECT(etsv)); - return FALSE; -} - -static gboolean -etsv_insert_idle(ETreeSortedVariable *etsv) -{ - etsv->insert_count = 0; - etsv->insert_idle_id = 0; - return FALSE; -} - - -ETableModel * -e_tree_sorted_variable_new (ETreeModel *source, ETableHeader *full_header, ETableSortInfo *sort_info) -{ - ETreeSortedVariable *etsv = gtk_type_new (E_TREE_SORTED_VARIABLE_TYPE); - ETreeSortedVariable *etsv = E_TABLE_SUBSET_VARIABLE (etsv); - - if (e_table_subset_variable_construct (etsv, source) == NULL){ - gtk_object_unref (GTK_OBJECT (etsv)); - return NULL; - } - - etsv->sort_info = sort_info; - gtk_object_ref(GTK_OBJECT(etsv->sort_info)); - etsv->full_header = full_header; - gtk_object_ref(GTK_OBJECT(etsv->full_header)); - - etsv->table_model_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_changed", - GTK_SIGNAL_FUNC (etsv_proxy_model_changed), etsv); -#if 0 - etsv->table_model_row_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_row_changed", - GTK_SIGNAL_FUNC (etsv_proxy_model_row_changed), etsv); - etsv->table_model_cell_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_cell_changed", - GTK_SIGNAL_FUNC (etsv_proxy_model_cell_changed), etsv); -#endif - etsv->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed", - GTK_SIGNAL_FUNC (etsv_sort_info_changed), etsv); - - return E_TABLE_MODEL(etsv); -} - -static void -etsv_proxy_model_changed (ETableModel *etm, ETreeSortedVariable *etsv) -{ - /* FIXME: do_resort (); */ -} -#if 0 -static void -etsv_proxy_model_row_changed (ETableModel *etm, int row, ETreeSortedVariable *etsv) -{ - ETreeSortedVariable *etsv = E_TABLE_SUBSET_VARIABLE(etsv); - - if (e_table_subset_variable_remove(etsv, row)) - e_table_subset_variable_add (etsv, row); -} - -static void -etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETreeSortedVariable *etsv) -{ - ETreeSortedVariable *etsv = E_TABLE_SUBSET_VARIABLE(etsv); - - if (e_table_subset_variable_remove(etsv, row)) - e_table_subset_variable_add (etsv, row); -} -#endif - -static void -etsv_sort_info_changed (ETableSortInfo *info, ETreeSortedVariable *etsv) -{ - etsv_sort(etsv); -} - -/* This takes source rows. */ -static int -etsv_compare(ETreeSortedVariable *etsv, const ETreePath *path1, const ETreePath *path2) -{ - int j; - int sort_count = e_table_sort_info_sorting_get_count(etsv->sort_info); - int comp_val = 0; - int ascending = 1; - - for (j = 0; j < sort_count; j++) { - ETableSortColumn column = e_table_sort_info_sorting_get_nth(etsv->sort_info, j); - ETableCol *col; - col = e_table_header_get_column_by_col_idx(etsv->full_header, column.column); - if (col == NULL) - col = e_table_header_get_column (etsv->full_header, e_table_header_count (etsv->full_header) - 1); - comp_val = (*col->compare)(e_tree_model_value_at (etsv->source, path1, col->col_idx), - e_tree_model_value_at (etsv->source, path2, col->col_idx)); - ascending = column.ascending; - if (comp_val != 0) - break; - } - if (comp_val == 0) { - if (row1 < row2) - comp_val = -1; - if (row1 > row2) - comp_val = 1; - } - if (!ascending) - comp_val = -comp_val; - return comp_val; -} - - -static ETreeSortedVariable *etsv_closure; -int cols_closure; -int *ascending_closure; -int *col_idx_closure; -GCompareFunc *compare_closure; - -static int -etsv_compare_closure(const ETreePath *path1, const ETreePath *path2) -{ - int j; - int sort_count = e_table_sort_info_sorting_get_count(etsv_closure->sort_info); - int comp_val = 0; - int ascending = 1; - for (j = 0; j < sort_count; j++) { - - comp_val = (*(compare_closure[j]))(e_tree_model_value_at (etsv_closure->source, path1, col_idx_closure[j]), - e_tree_model_value_at (etsv_closure->source, path2, col_idx_closure[j])); - ascending = ascending_closure[j]; - if (comp_val != 0) - break; - } - if (comp_val == 0) { - if (row1 < row2) - comp_val = -1; - if (row1 > row2) - comp_val = 1; - } - if (!ascending) - comp_val = -comp_val; - return comp_val; -} - -static int -qsort_callback(const void *data1, const void *data2) -{ - GNode *node1 = *(GNode **)data1; - GNode *node2 = *(GNode **)data2; - return etsv_compare_closure(node1->data, node2->data); -} - -static int -qsort_callback_source(const void *data1, const void *data2) -{ - return etsv_compare_closure(data1, data2); -} - -static void -etsv_setup_closures(ETreeSortedVariable *etsv) -{ - int j; - int cols; - - cols = e_table_sort_info_sorting_get_count(etsv->sort_info); - cols_closure = cols; - etsv_closure = etsv; - - ascending_closure = g_new(int, cols); - col_idx_closure = g_new(int, cols); - compare_closure = g_new(GCompareFunc, cols); - - for (j = 0; j < cols; j++) { - ETableSortColumn column = e_table_sort_info_sorting_get_nth(etsv->sort_info, j); - ETableCol *col; - - col = e_table_header_get_column_by_col_idx(etsv->full_header, column.column); - if (col == NULL) { - col = e_table_header_get_column (etsv->full_header, e_table_header_count (etsv->full_header) - 1); - } - - ascending_closure[j] = column.ascending; - col_idx_closure[j] = col->col_idx; - compare_closure[j] = col->compare; - } -} - -static void -etsv_free_closures(ETreeSortedVariable *etsv) -{ - g_free(ascending_closure); - g_free(col_idx_closure); - g_free(compare_closure); - -} - -static void -etsv_sort_node(ETreeSortedVariable *etsv, GNode *node) -{ - gint n; - gint i; - GNode **children; - GNode *child; - GNode *prev; - - n = g_node_n_children(node); - children = g_new(GNode *, n); - for (i = 0, child = node->children; child && i; child = child->next, i++) { - children[i] = child; - } - qsort(children, n, sizeof(GNode *), qsort_callback); - - prev = NULL; - for (i = 0; i < n; i++) { - children[i]->prev = prev; - if (prev) prev->next = children[i]; - prev = children[i]; - children[i]->next = NULL; - } -} - -static void -etsv_sort_tree(ETreeSortedVariable *etsv, GNode *root) -{ - GNode *childr; - - etsv_sort_node(etsv, node); - - for (child = node->child; child; child = child->next) { - etsv_sort_tree(etsv, child); - } -} - -static void -etsv_sort(ETreeSortedVariable *etsv) -{ - static int reentering = 0; - if (reentering) - return; - reentering = 1; - - e_table_model_pre_change(E_TABLE_MODEL(etsv)); - - etsv_setup_closures(etsv); - - etsv_sort_tree(etsv, etsv->root); - - etsv_free_closures(etsv); - - e_table_model_changed (E_TABLE_MODEL(etsv)); - reentering = 0; -} - -static void -etsv_add_node (ETreeSortedVariable *etsv, ETreePath *path, GNode *root) -{ - GNode *node; - GNode *new_node; - for (node = root; node; node = node->next) { - if (e_tree_model_node_is_ancestor(etsv->source, path, node->data)) { - etsv_add_node(etsv, path, node->data); - return; - } - } - new_node = g_node_new(path); - for (node = root; node; ) { - if (e_tree_model_node_is_ancestor(etsv->source, node->data, path)) { - GNode *next; - next = node->next; - g_node_unlink(node); - g_node_prepend(new_node, node); - node = next; - } else - node = node->next; - } - - etsv_sort_node(etsv, new_node); - - -#if 0 - g_node_prepend(root, new_node); - etsv_sort_node(etsv, root); -#else - /* Insert sort to be a bit faster than the above prepend and then sort. */ - for (node = root; node; node = node->next) { - if (etsv_compare(etsv, path, node->data) > 0) { - g_node_insert_before (root, node, new_node); - return; - } - } - g_node_append(root, new_node); -#endif -} - -etsv_add(ETreeSortedVariable *etsv, gint row) -{ - ETreeModel *source = etsv->source; - ETreePath *path; - - path = e_table_model_value_at (E_TABLE_MODEL(source), -1, row); - etsv_add_node(etsv, path, etsv->root); -} - -/* Optimize by doing the qsorts as we build. But we'll do that later. */ -static void -etsv_add_all_node (ETreeSortedVariable *etsv, ETreePath *path, GNode *node) -{ - ETreeModel *source = etsv->source; - ETreePath **children; - int n; - int i; - - n = e_tree_model_node_get_children(source, path, &children); - qsort(children, n, sizeof(ETreePath *), qsort_callback_source); - - for (i = n - 1; i >= 0; i--) { - GNode *new_child = g_node_new(children[i]); - g_node_prepend(path, new_child); - etsv_add_all_node (etsv, children[i], new_child) - } - - g_free(children); -} - -static void -etsv_add_all (ETreeSortedVariable *etsv) -{ - GNode *node; - ETreePath *path; - - e_table_model_pre_change(etm); - - if (etsv->root) - g_node_destroy(etsv->root); - - etsv_setup_closures(etsv); - - path = e_tree_model_get_root(etsv->source); - node = g_node_new(path); - etsv_add_all_node(etsv, path, node); - etsv->root = node; - - etsv_free_closures(etsv); - - e_tree_model_node_changed (etsv, etsv->root); -} diff --git a/widgets/table/e-tree-sorted-variable.h b/widgets/table/e-tree-sorted-variable.h deleted file mode 100644 index a86ea9f602..0000000000 --- a/widgets/table/e-tree-sorted-variable.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TREE_SORTED_VARIABLE_H_ -#define _E_TREE_SORTED_VARIABLE_H_ - -#include <gtk/gtkobject.h> -#include <gal/e-tree/e-tree-model.h> -#include <gal/e-table/e-table-subset-variable.h> -#include <gal/e-table/e-table-sort-info.h> -#include <gal/e-table/e-table-header.h> - -BEGIN_GNOME_DECLS - -#define E_TREE_SORTED_VARIABLE_TYPE (e_tree_sorted_variable_get_type ()) -#define E_TREE_SORTED_VARIABLE(o) (GTK_CHECK_CAST ((o), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariable)) -#define E_TREE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariableClass)) -#define E_IS_TREE_SORTED_VARIABLE(o) (GTK_CHECK_TYPE ((o), E_TREE_SORTED_VARIABLE_TYPE)) -#define E_IS_TREE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_SORTED_VARIABLE_TYPE)) - -typedef struct { - ETreeModel base; - - ETableSortInfo *sort_info; - - ETableHeader *full_header; - - int table_model_changed_id; - int table_model_row_changed_id; - int table_model_cell_changed_id; - int sort_info_changed_id; - int sort_idle_id; - int insert_idle_id; - int insert_count; - -} ETreeSortedVariable; - -typedef struct { - ETreeModelClass parent_class; -} ETreeSortedVariableClass; - -GtkType e_tree_sorted_variable_get_type (void); -ETableModel *e_tree_sorted_variable_new (ETreeModel *etm, - ETableHeader *header, - ETableSortInfo *sort_info); - -ETreeModel *e_tree_sorted_get_toplevel (ETreeSortedVariable *tree_model); - -void e_tree_sorted_variable_add (ETreeSortedVariable *ets, - gint row); -void e_tree_sorted_variable_add_all (ETreeSortedVariable *ets); -gboolean e_tree_sorted_variable_remove (ETreeSortedVariable *ets, - gint row); -void e_tree_sorted_variable_increment (ETreeSortedVariable *ets, - gint position, - gint amount); -void e_tree_sorted_variable_decrement (ETreeSortedVariable *ets, - gint position, - gint amount); -void e_tree_sorted_variable_set_allocation (ETreeSortedVariable *ets, - gint total); -END_GNOME_DECLS - -#endif /* _E_TREE_SORTED_VARIABLE_H_ */ diff --git a/widgets/table/image1.png b/widgets/table/image1.png Binary files differdeleted file mode 100644 index 8326ac241f..0000000000 --- a/widgets/table/image1.png +++ /dev/null diff --git a/widgets/table/image2.png b/widgets/table/image2.png Binary files differdeleted file mode 100644 index e6a4c75dbe..0000000000 --- a/widgets/table/image2.png +++ /dev/null diff --git a/widgets/table/image3.png b/widgets/table/image3.png Binary files differdeleted file mode 100644 index 50e16e8620..0000000000 --- a/widgets/table/image3.png +++ /dev/null diff --git a/widgets/table/remove-col.xpm b/widgets/table/remove-col.xpm deleted file mode 100644 index ff1024f0c9..0000000000 --- a/widgets/table/remove-col.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static char * remove_col_xpm[] = { -"16 16 3 1", -" c None", -". c #000000", -"+ c #FF0000", -"... ...", -".++. .++.", -".+++. .+++.", -" .+++. .+++. ", -" .+++. .+++. ", -" .+++..+++. ", -" .++++++. ", -" .++++. ", -" .++++. ", -" .++++++. ", -" .+++..+++. ", -" .+++. .+++. ", -" .+++. .+++. ", -".+++. .+++.", -".++. .++.", -"... ..."}; diff --git a/widgets/table/sample.table b/widgets/table/sample.table deleted file mode 100644 index 45c8ff0691..0000000000 --- a/widgets/table/sample.table +++ /dev/null @@ -1,11 +0,0 @@ -Col1 Col2 Address Title Dorks -c1.a c2.a a.a tit-1 DorkA -c1.b c2.b a.b tit-2 DDork -c1.c c2.c a.c tit-1 DorkB -c1.d c2.d a.d tit-2 ADork -c1.e c2.e a.e tit-1 DorkC -c1.f c2.f a.f tit-2 UDork -c1.g c2.g a.g tit-3 Dork--- -j k k tit-1 DorkA - - diff --git a/widgets/table/spec.xml b/widgets/table/spec.xml deleted file mode 100644 index a8e524484c..0000000000 --- a/widgets/table/spec.xml +++ /dev/null @@ -1,21 +0,0 @@ -<ETableSpecification no-headers="false" click-to-add="false" - draw-grid="true" cursor-mode="simple" - _click-to-add-message=""> - <ETableColumn model_col="0" _title="Email" expansion="1.0" minimum_width="20" resizable="true" cell="cell_left_just" compare="string"/> - <ETableColumn model_col="1" _title="Full Name" expansion="1.0" minimum_width="20" resizable="true" cell="cell_left_just" compare="string"/> - <ETableColumn model_col="2" _title="Address" expansion="1.0" minimum_width="20" resizable="true" cell="cell_left_just" compare="string"/> - <ETableColumn model_col="3" _title="Phone" expansion="1.0" minimum_width="20" resizable="true" cell="cell_left_just" compare="string"/> - <ETableState> - <column source="0"/> - <column source="3"/> - <column source="1"/> - <column source="2"/> - <grouping> - <group column="2" ascending="true"> - <leaf column="1" ascending="true"/> - </group> - </grouping> - <!-- Column that's been added by hand. Not implemented yet. - <ETableColumn model_col="custom-string" _title="Custom" expansion="1.0" minimum_widgth="20" resizable="true" cell="string" compare="string"/> --> - </ETableState> -</ETableSpecification> diff --git a/widgets/table/table-test.c b/widgets/table/table-test.c deleted file mode 100644 index dd0dee4d24..0000000000 --- a/widgets/table/table-test.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Test code for the ETable package - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - */ -#include <config.h> -#include <stdio.h> -#include <string.h> -#include <fcntl.h> -#include <gnome.h> -#include "gal/e-util/e-cursors.h" -#include "table-test.h" - -int -main (int argc, char *argv []) -{ - - if (isatty (0)){ - int fd; - - close (0); - fd = open ("sample.table", O_RDONLY); - if (fd == -1){ - fprintf (stderr, "Could not find sample.table, try feeding a table on stdin"); - exit (1); - } - dup2 (fd, 0); - } - - gnome_init ("TableTest", "TableTest", argc, argv); - e_cursors_init (); - - -/* table_browser_test (); */ -/* multi_cols_test (); */ -/* check_test (); */ - - e_table_test (); - - gtk_main (); - - e_cursors_shutdown (); - return 0; -} diff --git a/widgets/table/table-test.h b/widgets/table/table-test.h deleted file mode 100644 index ad8cfcc083..0000000000 --- a/widgets/table/table-test.h +++ /dev/null @@ -1,4 +0,0 @@ -void table_browser_test (void); -void multi_cols_test (void); -void check_test (void); -void e_table_test (void); diff --git a/widgets/table/test-check.c b/widgets/table/test-check.c deleted file mode 100644 index 0cf1baf48a..0000000000 --- a/widgets/table/test-check.c +++ /dev/null @@ -1,206 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Test code for the ETable package - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - */ -#include <config.h> -#include <stdio.h> -#include <string.h> -#include <gnome.h> -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "gal/widgets/e-cursors.h" -#include "gal/widgets/e-canvas-utils.h" -#include "gal/widgets/e-canvas.h" -#include "gal/util/e-util.h" -#include "e-cell-text.h" -#include "e-cell-checkbox.h" - -#include "table-test.h" - -#define LINES 4 - -static struct { - int value; - char *string; -} my_table [LINES] = { - { 0, "Buy food" }, - { 1, "Breathe " }, - { 0, "Cancel gdb session with shrink" }, - { 1, "Make screenshots" }, -}; -/* - * ETableSimple callbacks - */ -static int -col_count (ETableModel *etc, void *data) -{ - return 2; -} - -static int -row_count (ETableModel *etc, void *data) -{ - return LINES; -} - -static void * -value_at (ETableModel *etc, int col, int row, void *data) -{ - g_assert (col < 2); - g_assert (row < LINES); - - if (col == 0) - return GINT_TO_POINTER (my_table [row].value); - else - return my_table [row].string; - -} - -static void -set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) -{ - g_assert (col < 2); - g_assert (row < LINES); - - if (col == 0) { - my_table [row].value = GPOINTER_TO_INT (val); - printf ("Value at %d,%d set to %d\n", col, row, GPOINTER_TO_INT (val)); - } else { - my_table [row].string = g_strdup (val); - printf ("Value at %d,%d set to %s\n", col, row, (char *) val); - } -} - -static gboolean -is_cell_editable (ETableModel *etc, int col, int row, void *data) -{ - return TRUE; -} - -static void * -duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) { - return (void *) value; - } else { - return g_strdup (value); - } -} - -static void -free_value (ETableModel *etc, int col, void *value, void *data) -{ - if (col != 0) { - g_free (value); - } -} - -static void * -initialize_value (ETableModel *etc, int col, void *data) -{ - if (col == 0) - return NULL; - else - return g_strdup (""); -} - -static gboolean -value_is_empty (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return value == NULL; - else - return !(value && *(char *)value); -} - -static char * -value_to_string (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return g_strdup_printf("%d", (int) value); - else - return g_strdup(value); -} - -static void -set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) -{ - gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); -} - -void -check_test (void) -{ - GtkWidget *canvas, *window; - ETableModel *e_table_model; - ETableHeader *e_table_header; - ETableCol *col_0, *col_1; - ECell *cell_left_just, *cell_image_check; - GdkPixbuf *pixbuf; - GnomeCanvasItem *item; - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - e_table_model = e_table_simple_new ( - col_count, row_count, value_at, - set_value_at, is_cell_editable, - duplicate_value, free_value, - initialize_value, value_is_empty, - value_to_string, - NULL); - - /* - * Header - */ - e_table_header = e_table_header_new (); - - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT); - - cell_image_check = e_cell_checkbox_new (); - pixbuf = gdk_pixbuf_new_from_file ("clip.png"); - col_0 = e_table_col_new_with_pixbuf (0, pixbuf, 0.0, 18, cell_image_check, g_int_compare, TRUE); - gdk_pixbuf_unref (pixbuf); - e_table_header_add_column (e_table_header, col_0, 0); - - col_1 = e_table_col_new (1, "Item Name", 1.0, 20, cell_left_just, g_str_compare, TRUE); - e_table_header_add_column (e_table_header, col_1, 1); - e_table_col_set_arrow (col_1, E_TABLE_COL_ARROW_DOWN); - - /* - * GUI - */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - canvas = e_canvas_new (); - - gtk_signal_connect (GTK_OBJECT (canvas), "size_allocate", - GTK_SIGNAL_FUNC (set_canvas_size), NULL); - - gtk_container_add (GTK_CONTAINER (window), canvas); - gtk_widget_show_all (window); - gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_header_item_get_type (), - "ETableHeader", e_table_header, - NULL); - - item = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_item_get_type (), - "ETableHeader", e_table_header, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, -#if 0 - "spreadsheet", TRUE, -#endif - "cursor_mode", E_TABLE_CURSOR_SIMPLE, - NULL); - e_canvas_item_move_absolute (item, 0, 30); -} - diff --git a/widgets/table/test-cols.c b/widgets/table/test-cols.c deleted file mode 100644 index a82dae639a..0000000000 --- a/widgets/table/test-cols.c +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Test code for the ETable package - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - */ -#include <config.h> -#include <stdio.h> -#include <string.h> -#include <gnome.h> -#include "gal/widgets/e-canvas-utils.h" -#include "gal/widgets/e-canvas.h" -#include "gal/widgets/e-cursors.h" -#include "gal/util/e-util.h" -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-cell-text.h" -#include "e-cell-toggle.h" - -#include "table-test.h" - -#define LINES 4 - -static struct { - int value; - char *string; -} my_table [LINES] = { - { 0, "You are not" }, - { 1, "A beautiful and unique " }, - { 0, "Snowflake" }, - { 2, "You are not your wallet" }, -}; -/* - * ETableSimple callbacks - */ -static int -col_count (ETableModel *etc, void *data) -{ - return 2; -} - -static int -row_count (ETableModel *etc, void *data) -{ - return LINES; -} - -static void * -value_at (ETableModel *etc, int col, int row, void *data) -{ - g_assert (col < 2); - g_assert (row < LINES); - - if (col == 0) - return GINT_TO_POINTER (my_table [row].value); - else - return my_table [row].string; - -} - -static void -set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) -{ - g_assert (col < 2); - g_assert (row < LINES); - - if (col == 0){ - my_table [row].value = GPOINTER_TO_INT (val); - printf ("Value at %d,%d set to %d\n", col, row, GPOINTER_TO_INT (val)); - } else { - my_table [row].string = g_strdup (val); - printf ("Value at %d,%d set to %s\n", col, row, (char *) val); - } -} - -static gboolean -is_cell_editable (ETableModel *etc, int col, int row, void *data) -{ - return TRUE; -} - -static void * -duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0){ - return (void *)value; - } else { - return g_strdup (value); - } -} - -static void -free_value (ETableModel *etc, int col, void *value, void *data) -{ - if (col != 0){ - g_free (value); - } -} - -static void * -initialize_value (ETableModel *etc, int col, void *data) -{ - if (col == 0) - return NULL; - else - return g_strdup (""); -} - -static gboolean -value_is_empty (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return value == NULL; - else - return !(value && *(char *)value); -} - -static char * -value_to_string (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0) - return g_strdup_printf("%d", (int) value); - else - return g_strdup(value); -} - -static void -set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) -{ - gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); -} - -void -multi_cols_test (void) -{ - GtkWidget *canvas, *window; - ETableModel *e_table_model; - ETableHeader *e_table_header, *e_table_header_multiple; - ETableCol *col_0, *col_1; - ECell *cell_left_just, *cell_image_toggle; - GnomeCanvasItem *item; - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - e_table_model = e_table_simple_new ( - col_count, row_count, value_at, - set_value_at, is_cell_editable, - duplicate_value, free_value, - initialize_value, value_is_empty, - value_to_string, - NULL); - - /* - * Header - */ - e_table_header = e_table_header_new (); - - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT); - - { - GdkPixbuf **images = g_new (GdkPixbuf *, 3); - int i; - - images [0] = gdk_pixbuf_new_from_file ("image1.png"); - images [1] = gdk_pixbuf_new_from_file ("image2.png"); - images [2] = gdk_pixbuf_new_from_file ("image3.png"); - - cell_image_toggle = e_cell_toggle_new (0, 3, images); - - for (i = 0; i < 3; i++) - gdk_pixbuf_unref (images [i]); - - g_free (images); - } - - col_1 = e_table_col_new (1, "Item Name", 1.0, 20, cell_left_just, g_str_compare, TRUE); - e_table_header_add_column (e_table_header, col_1, 0); - - col_0 = e_table_col_new (0, "A", 0.0, 48, cell_image_toggle, g_int_compare, TRUE); - e_table_header_add_column (e_table_header, col_0, 1); - - /* - * Second test - */ - e_table_header_multiple = e_table_header_new (); - e_table_header_add_column (e_table_header_multiple, col_0, 0); - e_table_header_add_column (e_table_header_multiple, col_1, 1); - e_table_header_add_column (e_table_header_multiple, col_1, 2); - - /* - * GUI - */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - canvas = e_canvas_new (); - - gtk_signal_connect (GTK_OBJECT (canvas), "size_allocate", - GTK_SIGNAL_FUNC (set_canvas_size), NULL); - - gtk_container_add (GTK_CONTAINER (window), canvas); - gtk_widget_show_all (window); - - gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_header_item_get_type (), - "ETableHeader", e_table_header, - NULL); - - item = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_item_get_type (), - "ETableHeader", e_table_header, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, - "cursor_mode", E_TABLE_CURSOR_SIMPLE, -#if 0 - "spreadsheet", TRUE, -#endif - NULL); - - e_canvas_item_move_absolute (item, 0, 30); - - gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_header_item_get_type (), - "ETableHeader", e_table_header_multiple, - NULL); - item = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_item_get_type (), - "ETableHeader", e_table_header_multiple, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, -#if 0 - "spreadsheet", TRUE, -#endif - "cursor_mode", E_TABLE_CURSOR_SIMPLE, - NULL); - e_canvas_item_move_absolute (item, 300, 30); -} - - - - - diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c deleted file mode 100644 index 314df1000e..0000000000 --- a/widgets/table/test-table.c +++ /dev/null @@ -1,394 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Test code for the ETable package - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - */ -#include <config.h> -#include <stdio.h> -#include <string.h> -#include <gnome.h> -#include "gal/widgets/e-cursors.h" -#include "gal/widgets/e-canvas.h" -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-cell-text.h" -#include "e-table.h" -#include "e-table-config.h" - -#include "table-test.h" - -char buffer [1024]; -char **column_labels; -char ***table_data; -int cols = 0; -int lines = 0; -int lines_alloc = 0; - -static void -parse_headers () -{ - char *p, *s; - int in_value = 0, i; - - fgets (buffer, sizeof (buffer)-1, stdin); - - for (p = buffer; *p; p++){ - if (*p == ' ' || *p == '\t'){ - if (in_value){ - cols++; - in_value = 0; - } - } else - in_value = 1; - } - if (in_value) - cols++; - - if (!cols){ - fprintf (stderr, "No columns in first row\n"); - exit (1); - } - - column_labels = g_new0 (char *, cols); - - p = buffer; - for (i = 0; (s = strtok (p, " \t")) != NULL; i++){ - column_labels [i] = g_strdup (s); - if (strchr (column_labels [i], '\n')) - *strchr (column_labels [i], '\n') = 0; - p = NULL; - } - - printf ("%d headers:\n", cols); - for (i = 0; i < cols; i++){ - printf ("header %d: %s\n", i, column_labels [i]); - } -} - -static char ** -load_line (char *buffer, int cols) -{ - char **line = g_new0 (char *, cols); - char *p; - int i; - - for (i = 0; i < cols; i++){ - p = strtok (buffer, " \t\n"); - if (p == NULL){ - for (; i < cols; i++) - line [i] = g_strdup (""); - return line; - } else - line [i] = g_strdup (p); - buffer = NULL; - } - return line; -} - -static void -append_line (char **line) -{ - if (lines <= lines_alloc){ - lines_alloc = lines + 50; - table_data = g_renew (char **, table_data, lines_alloc); - } - table_data [lines] = line; - lines++; -} - -static void -load_data () -{ - int i; - - { - static int loaded; - - if (loaded) - return; - - loaded = TRUE; - } - - - parse_headers (); - - while (fgets (buffer, sizeof (buffer)-1, stdin) != NULL){ - char **line; - - if (buffer [0] == '\n') - continue; - line = load_line (buffer, cols); - append_line (line); - } - - for (i = 0; i < lines; i++){ - int j; - - printf ("Line %d: ", i); - for (j = 0; j < cols; j++) - printf ("[%s] ", table_data [i][j]); - printf ("\n"); - } -} - -/* - * ETableSimple callbacks - */ -static int -col_count (ETableModel *etc, void *data) -{ - return cols; -} - -static int -row_count (ETableModel *etc, void *data) -{ - return lines; -} - -static void * -value_at (ETableModel *etc, int col, int row, void *data) -{ - g_assert (col < cols); - g_assert (row < lines); - - return (void *) table_data [row][col]; -} - -static void -set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) -{ - g_assert (col < cols); - g_assert (row < lines); - - g_free (table_data [row][col]); - table_data [row][col] = g_strdup (val); - - printf ("Value at %d,%d set to %s\n", col, row, (char *) val); -} - -static gboolean -is_cell_editable (ETableModel *etc, int col, int row, void *data) -{ - return TRUE; -} - -static void * -duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - return g_strdup (value); -} - -static void -free_value (ETableModel *etc, int col, void *value, void *data) -{ - g_free (value); -} - -static void * -initialize_value (ETableModel *etc, int col, void *data) -{ - return g_strdup (""); -} - -static gboolean -value_is_empty (ETableModel *etc, int col, const void *value, void *data) -{ - return !(value && *(char *)value); -} - -static char * -value_to_string (ETableModel *etc, int col, const void *value, void *data) -{ - return g_strdup(value); -} - -static void -set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) -{ - gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); -} - -void -table_browser_test (void) -{ - GtkWidget *canvas, *window; - ETableModel *e_table_model; - ETableHeader *e_table_header; - ECell *cell_left_just; - GnomeCanvasItem *group; - int i; - - load_data (); - - /* - * Data model - */ - e_table_model = e_table_simple_new ( - col_count, row_count, value_at, - set_value_at, is_cell_editable, - duplicate_value, free_value, - initialize_value, value_is_empty, - value_to_string, - NULL); - - /* - * Header - */ - e_table_header = e_table_header_new (); - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT); - - for (i = 0; i < cols; i++){ - ETableCol *ecol = e_table_col_new ( - i, column_labels [i], - 1.0, 20, cell_left_just, - g_str_compare, TRUE); - - e_table_header_add_column (e_table_header, ecol, i); - } - - /* - * Setup GUI - */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - canvas = e_canvas_new (); - - gtk_signal_connect (GTK_OBJECT (canvas), "size_allocate", - GTK_SIGNAL_FUNC (set_canvas_size), NULL); - - gtk_container_add (GTK_CONTAINER (window), canvas); - gtk_widget_show_all (window); - gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_header_item_get_type (), - "ETableHeader", e_table_header, - NULL); - - group = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - gnome_canvas_group_get_type (), - "x", 30.0, - "y", 30.0, - NULL); - - gnome_canvas_item_new ( - GNOME_CANVAS_GROUP (group), - e_table_item_get_type (), - "ETableHeader", e_table_header, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, -#if 0 - "spreadsheet", TRUE, -#endif - NULL); -} - -static void -save_spec (GtkWidget *button, ETable *e_table) -{ - e_table_save_specification (e_table, "e-table-test.xml"); -} - -static void -row_selection_test (ETable *table, int row, gboolean selected) -{ - if (selected) - g_print ("Row %d selected\n", row); - else - g_print ("Row %d unselected\n", row); -} - -static void -toggle_grid (void *nothing, ETable *etable) -{ - static gboolean shown; - - gtk_object_get (GTK_OBJECT (etable), "drawgrid", &shown, NULL); - gtk_object_set (GTK_OBJECT (etable), "drawgrid", !shown, NULL); -} - -static void -do_e_table_demo (const char *spec) -{ - GtkWidget *e_table, *window, *frame, *vbox, *button, *bhide; - ECell *cell_left_just; - ETableHeader *full_header; - int i; - - /* - * Data model - */ - static ETableModel *e_table_model = NULL; - - if (e_table_model == NULL) - e_table_model = - e_table_simple_new (col_count, row_count, value_at, - set_value_at, is_cell_editable, - duplicate_value, free_value, - initialize_value, value_is_empty, - value_to_string, - NULL); - - full_header = e_table_header_new (); - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT); - - for (i = 0; i < cols; i++){ - ETableCol *ecol = e_table_col_new ( - i, column_labels [i], - 1.0, 20, cell_left_just, - g_str_compare, TRUE); - - e_table_header_add_column (full_header, ecol, i); - } - - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - frame = gtk_frame_new (NULL); - e_table = e_table_new (full_header, e_table_model, spec); - gtk_signal_connect (GTK_OBJECT(e_table), "row_selection", - GTK_SIGNAL_FUNC(row_selection_test), NULL); - - vbox = gtk_vbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (vbox), e_table, TRUE, TRUE, 0); - gtk_container_add (GTK_CONTAINER (frame), vbox); - gtk_container_add (GTK_CONTAINER (window), frame); - - /* - * gadgets - */ - button = gtk_button_new_with_label ("Save spec"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (save_spec), e_table); - gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - - bhide = gtk_button_new_with_label ("Toggle Grid"); - gtk_signal_connect (GTK_OBJECT (bhide), "clicked", - GTK_SIGNAL_FUNC (toggle_grid), e_table); - gtk_box_pack_start (GTK_BOX (vbox), bhide, FALSE, FALSE, 0); - - gtk_widget_set_usize (window, 200, 200); - gtk_widget_show_all (window); - - if (getenv ("TEST")){ - e_table_do_gui_config (NULL, E_TABLE(e_table)); - } -} - -void -e_table_test (void) -{ - load_data (); - - if (1){/*getenv ("DO")){*/ - do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <leaf column=\"3\" ascending=\"true\"/> </grouping> </ETableSpecification>"); - do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"3\" ascending=\"true\"> <group column=\"4\" ascending=\"false\"> <leaf column=\"2\" ascending=\"true\"/> </group> </group> </grouping> </ETableSpecification>"); - } - do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"4\" ascending=\"true\"> <leaf column=\"2\" ascending=\"true\"/> </group> </grouping> </ETableSpecification>"); - do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"3\" ascending=\"true\"> <leaf column=\"2\" ascending=\"true\"/> </group> </grouping> </ETableSpecification>"); -} diff --git a/widgets/table/tree-expanded.xpm b/widgets/table/tree-expanded.xpm deleted file mode 100644 index d9bda3694d..0000000000 --- a/widgets/table/tree-expanded.xpm +++ /dev/null @@ -1,23 +0,0 @@ -/* XPM */ -static char * tree_expanded_xpm[] = { -"16 16 4 1", -" c None", -". c #FFFFFF", -"* c #000000", -"+ c #666666", -" ", -" ", -" ", -" ", -" +++++++++ ", -" +.......+ ", -" +.......+ ", -" +.......+ ", -" +.*****.+ ", -" +.......+ ", -" +.......+ ", -" +.......+ ", -" +++++++++ ", -" ", -" ", -" "}; diff --git a/widgets/table/tree-unexpanded.xpm b/widgets/table/tree-unexpanded.xpm deleted file mode 100644 index e1b48448ba..0000000000 --- a/widgets/table/tree-unexpanded.xpm +++ /dev/null @@ -1,23 +0,0 @@ -/* XPM */ -static char * tree_unexpanded_xpm[] = { -"16 16 4 1", -" c None", -". c #FFFFFF", -"* c #000000", -"+ c #666666", -" ", -" ", -" ", -" ", -" +++++++++ ", -" +.......+ ", -" +...*...+ ", -" +...*...+ ", -" +.*****.+ ", -" +...*...+ ", -" +...*...+ ", -" +.......+ ", -" +++++++++ ", -" ", -" ", -" "}; diff --git a/widgets/text/.cvsignore b/widgets/text/.cvsignore deleted file mode 100644 index 8b2af4d9bf..0000000000 --- a/widgets/text/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -e-text-test -e-entry-test -e-text-model-test diff --git a/widgets/text/e-completion-test.c b/widgets/text/e-completion-test.c deleted file mode 100644 index 626842cb51..0000000000 --- a/widgets/text/e-completion-test.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - ECompleteTest -*/ - -#include <gnome.h> -#include "e-completion.h" -#include "e-entry.h" - -#define TIMEOUT 50 - -/* Dictionary Lookup test */ - -static gint word_count = 0; -static gchar **word_array = NULL; - -static void -read_dict (void) -{ - FILE *in = fopen ("/usr/share/dict/words", "r"); - gchar buffer[128]; - GList *word_list = NULL, *iter; - gint i; - - while (fgets (buffer, 128, in)) { - gint len = strlen (buffer); - if (len > 0 && buffer[len-1] == '\n') - buffer[len-1] = '\0'; - word_list = g_list_prepend (word_list, g_strdup (buffer)); - ++word_count; - } - fclose (in); - - word_array = g_new (gchar *, word_count); - i = word_count-1; - for (iter = word_list; iter != NULL; iter = g_list_next (iter)) { - word_array[i] = (gchar *)iter->data; - --i; - } -} - -static gint -find_word (const gchar *str) -{ - gint a, b; - - if (word_array == NULL) - read_dict (); - - a = 0; - b = word_count-1; - - while (b-a > 1) { - gint m = (a+b)/2; - gint cmp = g_strcasecmp (str, word_array[m]); - - if (cmp < 0) - b = m; - else if (cmp > 0) - a = m; - else - return m; - }; - - return b; -} - -struct { - ECompletion *complete; - const gchar *txt; - gint start; - gint current; - gint len; - gint limit; -} dict_info; -static guint dict_tag = 0; - -static gboolean -dict_check (gpointer ptr) -{ - gint limit = dict_info.limit; - gint i; - - /* If this is the first iteration, do the binary search in our word list to figure out - where to start. We do less work on the first iteration, to give more of a sense of - immediate feedback. */ - if (dict_info.start < 0) { - dict_info.start = dict_info.current = find_word (dict_info.txt); - } - - i = dict_info.current; - while (limit > 0 && i < word_count && g_strncasecmp (dict_info.txt, word_array[i], dict_info.len) == 0) { - e_completion_found_match_full (dict_info.complete, word_array[i], - dict_info.len / (double)strlen (word_array[i]), - NULL, NULL); - ++i; - --limit; - } - dict_info.current = i; - dict_info.limit = MIN (dict_info.limit*2, 200); - - if (limit != 0) { - dict_tag = 0; - e_completion_end_search (dict_info.complete); - return FALSE; - } - - - - return TRUE; -} - -static void -begin_dict_search (ECompletion *complete, const gchar *txt, gint pos, gint limit, gpointer user_data) -{ - gint len = strlen (txt); - - if (dict_tag != 0) { - gtk_timeout_remove (dict_tag); - dict_tag = 0; - } - - if (len > 0) { - dict_info.complete = complete; - dict_info.txt = txt; - dict_info.start = -1; - dict_info.current = -1; - dict_info.len = len; - dict_info.limit = 20; - dict_tag = gtk_timeout_add (TIMEOUT, dict_check, NULL); - } else { - g_message ("halting"); - e_completion_end_search (complete); - } -} - -static void -end_dict_search (ECompletion *complete, gpointer user_data) -{ - if (dict_tag != 0) { - gtk_timeout_remove (dict_tag); - dict_tag = 0; - } -} - -static void -popup_cb (EEntry *popup, GdkEventButton *ev, gint pos, gpointer user_data) -{ - g_print ("popup at pos %d\n", pos); -} - -int -main (int argc, gchar **argv) -{ - ECompletion* complete; - GtkWidget *entry; - GtkWidget *win; - - gnome_init ("ETextModelTest", "0.0", argc, argv); - - read_dict (); - - complete = e_completion_new (); - gtk_signal_connect (GTK_OBJECT (complete), - "begin_completion", - GTK_SIGNAL_FUNC (begin_dict_search), - NULL); - gtk_signal_connect (GTK_OBJECT (complete), - "end_completion", - GTK_SIGNAL_FUNC (end_dict_search), - NULL); - gtk_signal_connect (GTK_OBJECT (complete), - "cancel_completion", - GTK_SIGNAL_FUNC (end_dict_search), - NULL); - - win = gtk_window_new (GTK_WINDOW_TOPLEVEL); - entry = e_entry_new (); - e_entry_enable_completion_full (E_ENTRY (entry), complete, 0, NULL); - e_entry_set_editable (E_ENTRY (entry), TRUE); - - gtk_signal_connect (GTK_OBJECT (entry), - "popup", - GTK_SIGNAL_FUNC (popup_cb), - NULL); - - gtk_container_add (GTK_CONTAINER (win), entry); - gtk_widget_show_all (win); - - gtk_main (); - - return 0; -} diff --git a/widgets/text/e-completion-view.c b/widgets/text/e-completion-view.c deleted file mode 100644 index 825e7c5e11..0000000000 --- a/widgets/text/e-completion-view.c +++ /dev/null @@ -1,691 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * ECompletionView - A text completion selection widget - * Copyright (C) 2000, 2001 Ximian, Inc. - * - * Author: Jon Trowbridge <trow@ximian.com> - * Adapted from code by Miguel de Icaza <miguel@ximian.com> - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - -#include <config.h> -#include <math.h> -#include <gdk/gdkkeysyms.h> -#include <gal/e-table/e-table-simple.h> -#include <gal/e-table/e-table-scrolled.h> -#include "e-completion-view.h" - -enum { - E_COMPLETION_VIEW_NONEMPTY, - E_COMPLETION_VIEW_ADDED, - E_COMPLETION_VIEW_FULL, - E_COMPLETION_VIEW_BROWSE, - E_COMPLETION_VIEW_UNBROWSE, - E_COMPLETION_VIEW_ACTIVATE, - E_COMPLETION_VIEW_LAST_SIGNAL -}; - -static guint e_completion_view_signals[E_COMPLETION_VIEW_LAST_SIGNAL] = { 0 }; - -static void e_completion_view_disconnect (ECompletionView *cv); -static ETable *e_completion_view_table (ECompletionView *cv); -static void e_completion_view_clear_choices (ECompletionView *cv); -static void e_completion_view_set_cursor_row (ECompletionView *cv, gint r); -static void e_completion_view_select (ECompletionView *cv, gint r); - -static gint e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpointer user_data); - -static void e_completion_view_class_init (ECompletionViewClass *klass); -static void e_completion_view_init (ECompletionView *completion); -static void e_completion_view_destroy (GtkObject *object); - -static GtkObjectClass *parent_class; - - - -static gint -e_completion_view_local_key_press_handler (GtkWidget *w, GdkEventKey *ev) -{ - return e_completion_view_key_press_handler (w, ev, w); -} - -GtkType -e_completion_view_get_type (void) -{ - static GtkType completion_view_type = 0; - - if (!completion_view_type) { - GtkTypeInfo completion_view_info = { - "ECompletionView", - sizeof (ECompletionView), - sizeof (ECompletionViewClass), - (GtkClassInitFunc) e_completion_view_class_init, - (GtkObjectInitFunc) e_completion_view_init, - NULL, NULL, /* reserved */ - (GtkClassInitFunc) NULL - }; - - completion_view_type = gtk_type_unique (gtk_event_box_get_type (), &completion_view_info); - } - - return completion_view_type; -} - -static void -e_completion_view_class_init (ECompletionViewClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - parent_class = GTK_OBJECT_CLASS (gtk_type_class (gtk_event_box_get_type ())); - - e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY] = - gtk_signal_new ("nonempty", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECompletionViewClass, nonempty), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_completion_view_signals[E_COMPLETION_VIEW_ADDED] = - gtk_signal_new ("added", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECompletionViewClass, added), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_completion_view_signals[E_COMPLETION_VIEW_FULL] = - gtk_signal_new ("full", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECompletionViewClass, full), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_completion_view_signals[E_COMPLETION_VIEW_BROWSE] = - gtk_signal_new ("browse", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECompletionViewClass, browse), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE] = - gtk_signal_new ("unbrowse", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECompletionViewClass, unbrowse), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE] = - gtk_signal_new ("activate", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECompletionViewClass, activate), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, e_completion_view_signals, E_COMPLETION_VIEW_LAST_SIGNAL); - - object_class->destroy = e_completion_view_destroy; - widget_class->key_press_event = e_completion_view_local_key_press_handler; -} - -static void -e_completion_view_init (ECompletionView *completion) -{ -} - -static void -e_completion_view_destroy (GtkObject *object) -{ - ECompletionView *cv = E_COMPLETION_VIEW (object); - - e_completion_view_disconnect (cv); - e_completion_view_clear_choices (cv); - - if (cv->key_widget) { - gtk_signal_disconnect (GTK_OBJECT (cv->key_widget), cv->key_signal_id); - gtk_object_unref (GTK_OBJECT (cv->key_widget)); - } - - if (cv->completion) - gtk_object_unref (GTK_OBJECT (cv->completion)); - - - if (parent_class->destroy) - (parent_class->destroy) (object); -} - -static void -e_completion_view_disconnect (ECompletionView *cv) -{ - g_return_if_fail (cv != NULL); - g_return_if_fail (E_IS_COMPLETION_VIEW (cv)); - - if (cv->begin_signal_id) - gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->begin_signal_id); - if (cv->comp_signal_id) - gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->comp_signal_id); - if (cv->restart_signal_id) - gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->restart_signal_id); - if (cv->cancel_signal_id) - gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->cancel_signal_id); - if (cv->end_signal_id) - gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->end_signal_id); - - cv->begin_signal_id = 0; - cv->comp_signal_id = 0; - cv->restart_signal_id = 0; - cv->end_signal_id = 0; -} - -static ETable * -e_completion_view_table (ECompletionView *cv) -{ - return e_table_scrolled_get_table (E_TABLE_SCROLLED (cv->table)); -} - -static void -e_completion_view_clear_choices (ECompletionView *cv) -{ - GList *i; - - g_return_if_fail (cv != NULL); - g_return_if_fail (E_IS_COMPLETION_VIEW (cv)); - - for (i = cv->choices; i != NULL; i = g_list_next (i)) - g_free (i->data); - - g_list_free (cv->choices); - cv->choices = NULL; - - cv->choice_count = 0; -} - -static void -e_completion_view_set_cursor_row (ECompletionView *cv, gint r) -{ - ETable *table; - GtkAdjustment *adj; - gint x, y1, y2, r1, r2, c; - double fracline; - gint iteration_count=0; - - g_return_if_fail (cv != NULL); - g_return_if_fail (E_IS_COMPLETION_VIEW (cv)); - g_return_if_fail (r < cv->choice_count); - - adj = e_scroll_frame_get_vadjustment (E_SCROLL_FRAME (cv->table)); - - table = e_completion_view_table (cv); - - if (r < 0) { - e_selection_model_clear (E_SELECTION_MODEL(table->selection)); - - /* Move back to the top when we clear the selection */ - gtk_adjustment_set_value (adj, adj->lower); - return; - } - - e_table_set_cursor_row (table, r); - - /* OK, now the tricky bit. We try to insure that this row is - visible. */ - - /* If we are selecting the first or last row, then it is easy. We just - cram the vadjustment all the way up/down. */ - if (r == 0) { - gtk_adjustment_set_value (adj, adj->lower); - return; - } else if (r == cv->choice_count - 1) { - gtk_adjustment_set_value (adj, adj->upper - adj->page_size); - return; - } - - fracline = ((adj->upper - adj->lower - adj->page_size) / cv->choice_count) / 4; - - while (iteration_count < 100) { - x = GTK_LAYOUT(table->table_canvas)->hadjustment->value; - y1 = GTK_LAYOUT(table->table_canvas)->vadjustment->value; - - y2 = y1 + cv->table->allocation.height; - - e_table_group_compute_location (e_completion_view_table (cv)->group, &x, &y1, &r1, &c); - e_table_group_compute_location (e_completion_view_table (cv)->group, &x, &y2, &r2, &c); - - if (r <= r1) { - gtk_adjustment_set_value (adj, adj->value - fracline); - } else if (r >= r2) { - gtk_adjustment_set_value (adj, adj->value + fracline); - } else - return; - - ++iteration_count; - } - - g_assert_not_reached (); -} - -static void -e_completion_view_select (ECompletionView *cv, gint r) -{ - const gchar *sel = (const gchar *) g_list_nth_data (cv->choices, r); - gpointer extra = e_completion_find_extra_data (cv->completion, sel); - - cv->selection = r; - e_completion_view_set_cursor_row (cv, r); - gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE], sel, extra); -} - -static gint -e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpointer user_data) -{ - ECompletionView *cv = E_COMPLETION_VIEW (user_data); - gint dir = 0; - gboolean key_handled = TRUE; - - /* Start up a completion.*/ - if (cv->complete_key && key_event->keyval == cv->complete_key && !cv->editable) { - gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_BROWSE], NULL); - goto stop_emission; - } - - /* Stop our completion. */ - if (cv->uncomplete_key && key_event->keyval == cv->uncomplete_key && cv->editable && cv->selection < 0) { - e_completion_view_set_cursor_row (cv, -1); - gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]); - goto stop_emission; - } - - if (!cv->editable) - return FALSE; - - switch (key_event->keyval) { - case GDK_Down: - case GDK_KP_Down: - dir = 1; - break; - - case GDK_Up: - case GDK_KP_Up: - dir = -1; - break; - - case GDK_Tab: - /* Unbrowse, unhandled. */ - cv->selection = -1; - dir = 0; - key_handled = FALSE; - break; - - case GDK_Return: - case GDK_KP_Enter: - case GDK_space: - case GDK_KP_Space: - /* Only handle these key presses if we have an active selection; - otherwise, pass them on. */ - if (cv->selection >= 0) { - e_completion_view_select (cv, cv->selection); - goto stop_emission; - } - return FALSE; - - case GDK_Escape: - /* Unbrowse hack */ - cv->selection = -1; - dir = 0; - break; - - default: - return FALSE; - } - - cv->selection += dir; - - if (cv->selection >= cv->choice_count) { - cv->selection = cv->choice_count - 1; - /* Don't re-emit the browse signal */ - goto stop_emission; - } - - e_completion_view_set_cursor_row (cv, cv->selection); - - if (cv->selection >= 0) - gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_BROWSE], - g_list_nth_data (cv->choices, cv->selection)); - else - gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]); - - stop_emission: - if (key_handled) - gtk_signal_emit_stop_by_name (GTK_OBJECT (w), "key_press_event"); - - return key_handled; -} - -static void -begin_completion_cb (ECompletion *completion, const gchar *txt, gint pos, gint limit, gpointer user_data) -{ - ECompletionView *cv = E_COMPLETION_VIEW (user_data); - - e_completion_view_clear_choices (cv); - cv->have_all_choices = FALSE; - - e_table_model_changed (cv->model); -} - -static void -restart_completion_cb (ECompletion *completion, gpointer user_data) -{ - /* For now, handle restarts like the beginning of a new completion. */ - begin_completion_cb (completion, NULL, 0, 0, user_data); -} - -static void -cancel_completion_cb (ECompletion *completion, gpointer user_data) -{ - ECompletionView *cv = E_COMPLETION_VIEW (user_data); - - /* On a cancel, clear our choices and issue an "unbrowse" signal. */ - e_completion_view_clear_choices (cv); - cv->have_all_choices = TRUE; - e_completion_view_set_cursor_row (cv, -1); - e_table_model_changed (cv->model); - - gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]); -} - -static void -completion_cb (ECompletion *completion, const gchar *text, gpointer extra_data, gpointer user_data) -{ - ECompletionView *cv = E_COMPLETION_VIEW (user_data); - gint r = cv->choice_count; - gboolean first = (cv->choices == NULL); - - cv->choices = g_list_append (cv->choices, g_strdup (text)); - ++cv->choice_count; - - e_table_model_row_inserted (cv->model, r); - - if (first) - gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY]); - - gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_ADDED]); -} - -static void -end_completion_cb (ECompletion *completion, gpointer user_data) -{ - ECompletionView *cv = E_COMPLETION_VIEW (user_data); - - /* Do a final refresh of the table. */ - e_table_model_changed (cv->model); - - cv->have_all_choices = TRUE; - gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_FULL]); -} - -/*** Table Callbacks ***/ - -static char *simple_spec = -"<ETableSpecification no-headers=\"true\" draw-grid=\"false\" cursor-mode=\"line\"> " -" <ETableColumn model_col=\"0\" _title=\"Node\" expansion=\"1.0\" " -" minimum_width=\"16\" resizable=\"true\" cell=\"string\" " -" compare=\"string\"/> " -" <ETableState> " -" <column source=\"0\"/> " -" <grouping></grouping> " -" </ETableState> " -"</ETableSpecification>"; - -static gint -table_col_count (ETableModel *etm, gpointer data) -{ - return 1; -} - -static gint -table_row_count (ETableModel *etm, gpointer data) -{ - ECompletionView *cv = E_COMPLETION_VIEW (data); - return cv->choice_count; -} - -static gboolean -table_is_cell_editable (ETableModel *etm, gint c, gint r, gpointer data) -{ - return FALSE; -} - -static gpointer -table_value_at (ETableModel *etm, gint c, gint r, gpointer data) -{ - ECompletionView *cv = E_COMPLETION_VIEW (data); - gpointer p; - - p = g_list_nth_data (cv->choices, r); - - return p; -} - -static gchar * -table_value_to_string (ETableModel *em, gint col, gconstpointer val, gpointer data) -{ - return (gchar *) val; -} - -static void -table_click_cb (ETable *et, gint r, gint c, GdkEvent *ev, gpointer data) -{ - ECompletionView *cv = E_COMPLETION_VIEW (data); - - e_completion_view_select (cv, r); -} - -void -e_completion_view_construct (ECompletionView *cv, ECompletion *completion) -{ - GtkWidget *frame; - - g_return_if_fail (cv != NULL); - g_return_if_fail (E_IS_COMPLETION_VIEW (cv)); - g_return_if_fail (completion != NULL); - g_return_if_fail (E_IS_COMPLETION (completion)); - - /* Make sure we don't call construct twice. */ - g_return_if_fail (cv->completion == NULL); - - cv->completion = completion; - gtk_object_ref (GTK_OBJECT (completion)); - - cv->begin_signal_id = gtk_signal_connect (GTK_OBJECT (completion), - "begin_completion", - GTK_SIGNAL_FUNC (begin_completion_cb), - cv); - cv->comp_signal_id = gtk_signal_connect (GTK_OBJECT (completion), - "completion", - GTK_SIGNAL_FUNC (completion_cb), - cv); - cv->restart_signal_id = gtk_signal_connect (GTK_OBJECT (completion), - "restart_completion", - GTK_SIGNAL_FUNC (restart_completion_cb), - cv); - cv->cancel_signal_id = gtk_signal_connect (GTK_OBJECT (completion), - "cancel_completion", - GTK_SIGNAL_FUNC (cancel_completion_cb), - cv); - cv->end_signal_id = gtk_signal_connect (GTK_OBJECT (completion), - "end_completion", - GTK_SIGNAL_FUNC (end_completion_cb), - cv); - - cv->model = e_table_simple_new (table_col_count, - table_row_count, - table_value_at, - NULL, - table_is_cell_editable, - NULL, NULL, NULL, NULL, - table_value_to_string, - cv); - - cv->table = e_table_scrolled_new (cv->model, NULL, simple_spec, NULL); - - e_scroll_frame_set_policy (E_SCROLL_FRAME (cv->table), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - - frame = gtk_frame_new (NULL); - - gtk_container_add (GTK_CONTAINER (cv), frame); - gtk_container_add (GTK_CONTAINER (frame), cv->table); - gtk_widget_show_all (frame); - - gtk_signal_connect (GTK_OBJECT (e_completion_view_table (cv)), - "click", - GTK_SIGNAL_FUNC (table_click_cb), - cv); - - cv->selection = -1; -} - -GtkWidget * -e_completion_view_new (ECompletion *completion) -{ - gpointer p; - - g_return_val_if_fail (completion != NULL, NULL); - g_return_val_if_fail (E_IS_COMPLETION (completion), NULL); - - p = gtk_type_new (e_completion_view_get_type ()); - - e_completion_view_construct (E_COMPLETION_VIEW (p), completion); - - return GTK_WIDGET (p); -} - -void -e_completion_view_connect_keys (ECompletionView *cv, GtkWidget *w) -{ - g_return_if_fail (cv != NULL); - g_return_if_fail (E_IS_COMPLETION_VIEW (cv)); - g_return_if_fail (w == NULL || GTK_IS_WIDGET (w)); - - if (cv->key_widget) { - gtk_signal_disconnect (GTK_OBJECT (cv->key_widget), cv->key_signal_id); - gtk_object_unref (GTK_OBJECT (cv->key_widget)); - } - - if (w) { - cv->key_widget = w; - gtk_object_ref (GTK_OBJECT (w)); - - cv->key_signal_id = gtk_signal_connect (GTK_OBJECT (w), - "key_press_event", - GTK_SIGNAL_FUNC (e_completion_view_key_press_handler), - cv); - } else { - cv->key_widget = NULL; - cv->key_signal_id = 0; - } -} - -void -e_completion_view_set_complete_key (ECompletionView *cv, gint keyval) -{ - g_return_if_fail (cv != NULL); - g_return_if_fail (E_IS_COMPLETION_VIEW (cv)); - - cv->complete_key = keyval; -} - -void -e_completion_view_set_uncomplete_key (ECompletionView *cv, gint keyval) -{ - g_return_if_fail (cv != NULL); - g_return_if_fail (E_IS_COMPLETION_VIEW (cv)); - - cv->uncomplete_key = keyval; -} - -void -e_completion_view_set_width (ECompletionView *cv, gint width) -{ - GtkWidget *w; - gint y, r, dummy, line_height; - double drop_room, lines; - - g_return_if_fail (cv != NULL); - g_return_if_fail (E_IS_COMPLETION_VIEW (cv)); - g_return_if_fail (width > 0); - - w = GTK_WIDGET (cv); - - if (! GTK_WIDGET_REALIZED (w)) { - gtk_widget_set_usize (w, width, -1); - return; - } - - /* A Horrible Hack(tm) to figure out the height of a single table row */ - - for (line_height=5, r=0; r == 0 && line_height < 1000; line_height += 2) { - dummy = 0; - e_table_group_compute_location (e_completion_view_table (cv)->group, - &dummy, &line_height, &r, &dummy); - } - - if (line_height >= 1000) { - /* Something went wrong, so we make a (possibly very lame) guess */ - line_height = 30; - } - - - gdk_window_get_origin (w->window, NULL, &y); - y += w->allocation.y; - - lines = 5; /* default maximum */ - lines = MIN (lines, cv->choice_count); - - drop_room = (gdk_screen_height () - y) / (double)line_height; - drop_room = MAX (drop_room, 1); - - lines = MIN (lines, drop_room); - - /* We reduce the total height by a bit; in practice, this seems to work out well. */ - gtk_widget_set_usize (w, width, (gint) floor (line_height * lines * 0.97)); -} - -void -e_completion_view_set_editable (ECompletionView *cv, gboolean x) -{ - g_return_if_fail (cv != NULL); - g_return_if_fail (E_IS_COMPLETION_VIEW (cv)); - - if (x == cv->editable) - return; - - cv->editable = x; - cv->selection = -1; - e_completion_view_set_cursor_row (cv, -1); -} - diff --git a/widgets/text/e-completion-view.h b/widgets/text/e-completion-view.h deleted file mode 100644 index 57268125c5..0000000000 --- a/widgets/text/e-completion-view.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * ECompletionView - A text completion selection widget - * Copyright (C) 2000, 2001 Ximian, Inc. - * - * Author: Jon Trowbridge <trow@ximian.com> - * Adapted from code by Miguel de Icaza <miguel@ximian.com> - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - -#ifndef E_COMPLETION_VIEW_H -#define E_COMPLETION_VIEW_H - -#include <libgnome/gnome-defs.h> -#include <gtk/gtk.h> -#include <gal/e-table/e-table.h> -#include "e-completion.h" - -BEGIN_GNOME_DECLS - -#define E_COMPLETION_VIEW_TYPE (e_completion_view_get_type ()) -#define E_COMPLETION_VIEW(o) (GTK_CHECK_CAST ((o), E_COMPLETION_VIEW_TYPE, ECompletionView)) -#define E_COMPLETION_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_COMPLETION_VIEW_TYPE, ECompletionViewClass)) -#define E_IS_COMPLETION_VIEW(o) (GTK_CHECK_TYPE ((o), E_COMPLETION_VIEW_TYPE)) -#define E_IS_COMPLETION_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_COMPLETION_VIEW_TYPE)) - -typedef struct _ECompletionView ECompletionView; -typedef struct _ECompletionViewClass ECompletionViewClass; - -struct _ECompletionView { - GtkEventBox parent; - - ETableModel *model; - GtkWidget *table; - - ECompletion *completion; - guint begin_signal_id; - guint comp_signal_id; - guint restart_signal_id; - guint cancel_signal_id; - guint end_signal_id; - - GtkWidget *key_widget; - guint key_signal_id; - - gint complete_key; - gint uncomplete_key; - - GList *choices; - gint choice_count; - gboolean have_all_choices; - - gboolean editable; - gint selection; -}; - -struct _ECompletionViewClass { - GtkEventBoxClass parent_class; - - /* Signals */ - void (*nonempty) (ECompletionView *cv); - void (*added) (ECompletionView *cv); - void (*full) (ECompletionView *cv); - void (*browse) (ECompletionView *cv, const gchar *text); - void (*unbrowse) (ECompletionView *cv); - void (*activate) (ECompletionView *cv, const gchar *text, gpointer extra_data); -}; - -GtkType e_completion_view_get_type (void); - -void e_completion_view_construct (ECompletionView *cv, ECompletion *completion); -GtkWidget *e_completion_view_new (ECompletion *completion); - -void e_completion_view_connect_keys (ECompletionView *cv, GtkWidget *w); - -void e_completion_view_set_complete_key (ECompletionView *cv, gint keyval); -void e_completion_view_set_uncomplete_key (ECompletionView *cv, gint keyval); - -void e_completion_view_set_width (ECompletionView *cv, gint width); -void e_completion_view_set_editable (ECompletionView *cv, gboolean); - -END_GNOME_DECLS - - -#endif /* E_COMPLETION_H */ diff --git a/widgets/text/e-completion.c b/widgets/text/e-completion.c deleted file mode 100644 index bf12d6a365..0000000000 --- a/widgets/text/e-completion.c +++ /dev/null @@ -1,477 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* ECompletion - A base class for text completion. - * Copyright (C) 2000, 2001 Ximian, Inc. - * - * Author: Miguel de Icaza <miguel@ximian.com> - * Adapted by Jon Trowbridge <trow@ximian.com> - * - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - -#include <config.h> -#include <gtk/gtk.h> -#include "e-completion.h" - -enum { - E_COMPLETION_BEGIN_COMPLETION, - E_COMPLETION_COMPLETION, - E_COMPLETION_RESTART_COMPLETION, - E_COMPLETION_CANCEL_COMPLETION, - E_COMPLETION_END_COMPLETION, - E_COMPLETION_LAST_SIGNAL -}; - -static guint e_completion_signals[E_COMPLETION_LAST_SIGNAL] = { 0 }; - -typedef struct _Match Match; -struct _Match { - gchar *text; - double score; - gpointer extra_data; - GtkDestroyNotify extra_destroy; -}; - -struct _ECompletionPrivate { - gboolean searching; - gchar *search_text; - gint pos; - gint limit; - gint match_count; - GList *matches; - double min_score, max_score; -}; - -static void e_completion_class_init (ECompletionClass *klass); -static void e_completion_init (ECompletion *complete); -static void e_completion_destroy (GtkObject *object); - -static Match *match_new (const gchar *txt, double score, gpointer extra_data, GtkDestroyNotify extra_destroy); -static void match_free (Match *); -static void match_list_free (GList *); - -static void e_completion_add_match (ECompletion *complete, const gchar *txt, double score, gpointer extra_data, GtkDestroyNotify); -static void e_completion_clear_matches (ECompletion *complete); -static gboolean e_completion_sort_by_score (ECompletion *complete); -static void e_completion_restart (ECompletion *complete); - -static GtkObjectClass *parent_class; - - - -GtkType -e_completion_get_type (void) -{ - static GtkType complete_type = 0; - - if (!complete_type) { - GtkTypeInfo complete_info = { - "ECompletion", - sizeof (ECompletion), - sizeof (ECompletionClass), - (GtkClassInitFunc) e_completion_class_init, - (GtkObjectInitFunc) e_completion_init, - NULL, NULL, /* reserved */ - (GtkClassInitFunc) NULL - }; - - complete_type = gtk_type_unique (gtk_object_get_type (), &complete_info); - } - - return complete_type; -} - -static void -e_completion_class_init (ECompletionClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - parent_class = GTK_OBJECT_CLASS (gtk_type_class (gtk_object_get_type ())); - - e_completion_signals[E_COMPLETION_BEGIN_COMPLETION] = - gtk_signal_new ("begin_completion", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECompletionClass, begin_completion), - gtk_marshal_NONE__POINTER_INT_INT, - GTK_TYPE_NONE, 3, - GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_INT); - - e_completion_signals[E_COMPLETION_COMPLETION] = - gtk_signal_new ("completion", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECompletionClass, completion), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, GTK_TYPE_POINTER); - - e_completion_signals[E_COMPLETION_RESTART_COMPLETION] = - gtk_signal_new ("restart_completion", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECompletionClass, restart_completion), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_completion_signals[E_COMPLETION_CANCEL_COMPLETION] = - gtk_signal_new ("cancel_completion", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECompletionClass, cancel_completion), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_completion_signals[E_COMPLETION_END_COMPLETION] = - gtk_signal_new ("end_completion", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECompletionClass, end_completion), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_completion_signals, E_COMPLETION_LAST_SIGNAL); - - object_class->destroy = e_completion_destroy; -} - -static void -e_completion_init (ECompletion *complete) -{ - complete->priv = g_new0 (struct _ECompletionPrivate, 1); -} - -static void -e_completion_destroy (GtkObject *object) -{ - ECompletion *complete = E_COMPLETION (object); - - g_free (complete->priv->search_text); - complete->priv->search_text = NULL; - - e_completion_clear_matches (complete); - - g_free (complete->priv); - complete->priv = NULL; - - if (parent_class->destroy) - (parent_class->destroy) (object); -} - -static Match * -match_new (const gchar *text, double score, gpointer extra_data, GtkDestroyNotify extra_destroy) -{ - Match *m; - - if (text == NULL) - return NULL; - - m = g_new (Match, 1); - m->text = g_strdup (text); - m->score = score; - m->extra_data = extra_data; - m->extra_destroy = extra_destroy; - - return m; -} - -static void -match_free (Match *m) -{ - if (m) { - g_free (m->text); - if (m->extra_destroy) - m->extra_destroy (m->extra_data); - g_free (m); - } -} - -static void -match_list_free (GList *i) -{ - while (i) { - match_free ( (Match *) i->data ); - i = g_list_next (i); - } -} - -static void -e_completion_add_match (ECompletion *complete, const gchar *txt, double score, gpointer extra_data, GtkDestroyNotify extra_destroy) -{ - complete->priv->matches = g_list_append (complete->priv->matches, match_new (txt, score, extra_data, extra_destroy)); - - if (complete->priv->match_count == 0) { - - complete->priv->min_score = complete->priv->max_score = score; - - } else { - - complete->priv->min_score = MIN (complete->priv->min_score, score); - complete->priv->max_score = MAX (complete->priv->max_score, score); - - } - - ++complete->priv->match_count; -} - -static void -e_completion_clear_matches (ECompletion *complete) -{ - match_list_free (complete->priv->matches); - g_list_free (complete->priv->matches); - complete->priv->matches = NULL; - - complete->priv->match_count = 0; - - complete->priv->min_score = 0; - complete->priv->max_score = 0; -} - -void -e_completion_begin_search (ECompletion *complete, const gchar *text, gint pos, gint limit) -{ - g_return_if_fail (complete != NULL); - g_return_if_fail (E_IS_COMPLETION (complete)); - g_return_if_fail (text != NULL); - - /* Stop any prior search. */ - if (complete->priv->searching) - e_completion_cancel_search (complete); - - g_free (complete->priv->search_text); - complete->priv->search_text = g_strdup (text); - - complete->priv->pos = pos; - complete->priv->searching = TRUE; - - e_completion_clear_matches (complete); - - complete->priv->limit = limit > 0 ? limit : G_MAXINT; - - gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], text, pos, limit); -} - -void -e_completion_cancel_search (ECompletion *complete) -{ - g_return_if_fail (complete != NULL); - g_return_if_fail (E_IS_COMPLETION (complete)); - - /* If there is no search to cancel, just silently return. */ - if (!complete->priv->searching) - return; - - gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_CANCEL_COMPLETION]); - - complete->priv->searching = FALSE; -} - -gboolean -e_completion_searching (ECompletion *complete) -{ - g_return_val_if_fail (complete != NULL, FALSE); - g_return_val_if_fail (E_IS_COMPLETION (complete), FALSE); - - return complete->priv->searching; -} - -const gchar * -e_completion_search_text (ECompletion *complete) -{ - g_return_val_if_fail (complete != NULL, NULL); - g_return_val_if_fail (E_IS_COMPLETION (complete), NULL); - - return complete->priv->search_text; -} - -gint -e_completion_search_text_pos (ECompletion *complete) -{ - g_return_val_if_fail (complete != NULL, -1); - g_return_val_if_fail (E_IS_COMPLETION (complete), -1); - - return complete->priv->pos; -} - -gint -e_completion_match_count (ECompletion *complete) -{ - g_return_val_if_fail (complete != NULL, 0); - g_return_val_if_fail (E_IS_COMPLETION (complete), 0); - - return complete->priv->match_count; -} - -void -e_completion_foreach_match (ECompletion *complete, ECompletionMatchFn fn, gpointer user_data) -{ - GList *i; - - g_return_if_fail (complete != NULL); - g_return_if_fail (E_IS_COMPLETION (complete)); - - if (fn == NULL) - return; - - for (i = complete->priv->matches; i != NULL; i = g_list_next (i)) { - Match *m = (Match *) i->data; - fn (m->text, m->score, m->extra_data, user_data); - } -} - -gpointer -e_completion_find_extra_data (ECompletion *complete, const gchar *text) -{ - GList *i; - - g_return_val_if_fail (complete != NULL, NULL); - g_return_val_if_fail (E_IS_COMPLETION (complete), NULL); - - for (i = complete->priv->matches; i != NULL; i = g_list_next (i)) { - Match *m = (Match *) i->data; - if (strcmp (m->text, text) == 0) - return m->extra_data; - } - - return NULL; -} - -ECompletion * -e_completion_new (void) -{ - return E_COMPLETION (gtk_type_new (e_completion_get_type ())); -} - -static gint -score_cmp_fn (gconstpointer a, gconstpointer b) -{ - double sa = ((const Match *) a)->score; - double sb = ((const Match *) b)->score; - gint cmp = (sa < sb) - (sb < sa); - if (cmp == 0) - cmp = g_strcasecmp (((const Match *) a)->text, ((const Match *) b)->text); - return cmp; -} - -static gboolean -e_completion_sort_by_score (ECompletion *complete) -{ - GList *sort_list = NULL, *i, *j; - gboolean diff; - gint count; - - /* If all scores are equal, there is nothing to do. */ - if (complete->priv->min_score == complete->priv->max_score) - return FALSE; - - for (i = complete->priv->matches; i != NULL; i = g_list_next (i)) { - sort_list = g_list_append (sort_list, i->data); - } - - sort_list = g_list_sort (sort_list, score_cmp_fn); - - - diff = FALSE; - count = 0; - i = complete->priv->matches; - j = sort_list; - while (i && j && !diff && count < complete->priv->limit) { - - if (i->data != j->data) - diff = TRUE; - - i = g_list_next (i); - j = g_list_next (j); - ++count; - } - - g_list_free (complete->priv->matches); - complete->priv->matches = sort_list; - - return diff; -} - -/* Emit a restart signal and re-declare our matches, up to the limit. */ -static void -e_completion_restart (ECompletion *complete) -{ - GList *i; - gint count = 0; - - gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_RESTART_COMPLETION]); - - i = complete->priv->matches; - while (i != NULL && count < complete->priv->limit) { - Match *m = (Match *) i->data; - gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_COMPLETION], m->text, m->extra_data); - - i = g_list_next (i); - ++count; - } -} - -void -e_completion_found_match (ECompletion *complete, const gchar *text) -{ - g_return_if_fail (complete); - g_return_if_fail (E_IS_COMPLETION (complete)); - g_return_if_fail (text != NULL); - - e_completion_found_match_full (complete, text, 0, NULL, NULL); -} - -void -e_completion_found_match_full (ECompletion *complete, const gchar *text, double score, gpointer extra_data, GtkDestroyNotify extra_destroy) -{ - g_return_if_fail (complete); - g_return_if_fail (E_IS_COMPLETION (complete)); - g_return_if_fail (text != NULL); - - if (! complete->priv->searching) { - g_warning ("e_completion_found_match(...,\"%s\",...) called outside of a search", text); - return; - } - - e_completion_add_match (complete, text, score, extra_data, extra_destroy); - - /* For now, do nothing when we hit the limit --- just don't announce the incoming matches. */ - if (complete->priv->match_count >= complete->priv->limit) { - return; - } - - gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_COMPLETION], text, extra_data); -} - -void -e_completion_end_search (ECompletion *complete) -{ - g_return_if_fail (complete != NULL); - g_return_if_fail (E_IS_COMPLETION (complete)); - g_return_if_fail (complete->priv->searching); - - /* If sorting by score accomplishes anything, issue a restart right before we end. */ - if (e_completion_sort_by_score (complete)) - e_completion_restart (complete); - - gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_END_COMPLETION]); - - complete->priv->searching = FALSE; -} - diff --git a/widgets/text/e-completion.h b/widgets/text/e-completion.h deleted file mode 100644 index e101d6aa55..0000000000 --- a/widgets/text/e-completion.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* ECompletion - A base class for text completion. - * Copyright (C) 2000, 2001 Ximian, Inc. - * - * Author: Miguel de Icaza <miguel@ximian.com> - * Adapted by Jon Trowbridge <trow@ximian.com> - * - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef E_COMPLETION_H -#define E_COMPLETION_H - -#include <libgnome/gnome-defs.h> -#include <gtk/gtkobject.h> - -BEGIN_GNOME_DECLS - -#define E_COMPLETION_TYPE (e_completion_get_type ()) -#define E_COMPLETION(o) (GTK_CHECK_CAST ((o), E_COMPLETION_TYPE, ECompletion)) -#define E_COMPLETION_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_COMPLETION_TYPE, ECompletionClass)) -#define E_IS_COMPLETION(o) (GTK_CHECK_TYPE ((o), E_COMPLETION_TYPE)) -#define E_IS_COMPLETION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_COMPLETION_TYPE)) - -typedef struct _ECompletion ECompletion; -typedef struct _ECompletionClass ECompletionClass; -struct _ECompletionPrivate; - -typedef void (*ECompletionMatchFn) (const gchar *text, double score, gpointer extra_data, gpointer user_data); - -struct _ECompletion { - GtkObject parent; - - struct _ECompletionPrivate *priv; -}; - -struct _ECompletionClass { - GtkObjectClass parent_class; - - /* Signals */ - void (*begin_completion) (ECompletion *comp, const gchar *search_text, gint pos, gint limit); - void (*completion) (ECompletion *comp, const gchar *match_text, gpointer extra_data); - void (*restart_completion) (ECompletion *comp); - void (*cancel_completion) (ECompletion *comp); - void (*end_completion) (ECompletion *comp); -}; - -GtkType e_completion_get_type (void); - -void e_completion_begin_search (ECompletion *comp, const gchar *text, gint pos, gint limit); -void e_completion_cancel_search (ECompletion *comp); - -gboolean e_completion_searching (ECompletion *comp); -const gchar *e_completion_search_text (ECompletion *comp); -gint e_completion_search_text_pos (ECompletion *comp); -gint e_completion_match_count (ECompletion *comp); -void e_completion_foreach_match (ECompletion *comp, ECompletionMatchFn fn, gpointer user_data); -gpointer e_completion_find_extra_data (ECompletion *comp, const gchar *text); - -ECompletion *e_completion_new (void); - - - -/* These functions should only be called by derived classes or search callbacks, - or very bad things might happen. */ - -void e_completion_found_match (ECompletion *comp, const gchar *completion_text); -void e_completion_found_match_full (ECompletion *comp, const gchar *completion_text, double score, - gpointer extra_data, GtkDestroyNotify extra_data_destructor); -void e_completion_end_search (ECompletion *comp); - -END_GNOME_DECLS - - -#endif /* E_COMPLETION_H */ - diff --git a/widgets/text/e-entry-test.c b/widgets/text/e-entry-test.c deleted file mode 100644 index 411e8d693c..0000000000 --- a/widgets/text/e-entry-test.c +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-minicard.c - * - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - - - -#include "config.h" - -#include <gnome.h> -#include "e-entry.h" - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey <clahey@umich.edu>", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Minicard Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the minicard canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *entry; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "EEntry Test", VERSION, argc, argv); - app = gnome_app_new("EEntry Test", NULL); - - entry = e_entry_new(); - gtk_object_set(GTK_OBJECT(entry), - "editable", TRUE, - "use_ellipsis", TRUE, - NULL); - gnome_app_set_contents( GNOME_APP( app ), entry ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/widgets/text/e-entry.c b/widgets/text/e-entry.c deleted file mode 100644 index 64255c435e..0000000000 --- a/widgets/text/e-entry.c +++ /dev/null @@ -1,1133 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * EEntry: An EText-based entry widget - * - * Authors: - * Miguel de Icaza <miguel@helixcode.com> - * Chris Lahey <clahey@helixcode.com> - * Jon Trowbridge <trow@ximian.com> - * - * Copyright (C) 1999, 2000, 2001 Ximian Inc. - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#include <config.h> -#include <math.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <ctype.h> -#ifdef HAVE_ALLOCA_H -#include <alloca.h> -#endif -#include <stdio.h> -#include <libgnomeui/gnome-canvas.h> -#include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include "gal/util/e-util.h" -#include "gal/widgets/e-canvas.h" -#include "gal/widgets/e-canvas-utils.h" -#include "e-completion-view.h" -#include "e-text.h" -#include "e-entry.h" - -#define MIN_ENTRY_WIDTH 150 -#define INNER_BORDER 2 - -#define PARENT_TYPE gtk_table_get_type () - -static GtkObjectClass *parent_class; - -enum { - E_ENTRY_CHANGED, - E_ENTRY_ACTIVATE, - E_ENTRY_POPUP, - E_ENTRY_LAST_SIGNAL -}; - -static guint e_entry_signals[E_ENTRY_LAST_SIGNAL] = { 0 }; - -/* Object argument IDs */ -enum { - ARG_0, - ARG_MODEL, - ARG_EVENT_PROCESSOR, - ARG_TEXT, - ARG_FONT, - ARG_FONTSET, - ARG_FONT_GDK, - ARG_ANCHOR, - ARG_JUSTIFICATION, - ARG_X_OFFSET, - ARG_Y_OFFSET, - ARG_FILL_COLOR, - ARG_FILL_COLOR_GDK, - ARG_FILL_COLOR_RGBA, - ARG_FILL_STIPPLE, - ARG_EDITABLE, - ARG_USE_ELLIPSIS, - ARG_ELLIPSIS, - ARG_LINE_WRAP, - ARG_BREAK_CHARACTERS, - ARG_MAX_LINES, - ARG_ALLOW_NEWLINES, - ARG_DRAW_BORDERS, - ARG_DRAW_BACKGROUND, - ARG_CURSOR_POS -}; - -typedef struct _EEntryPrivate EEntryPrivate; -struct _EEntryPrivate { - GnomeCanvas *canvas; - EText *item; - GtkJustification justification; - - guint changed_proxy_tag; - guint activate_proxy_tag; - guint popup_proxy_tag; - - /* Data related to completions */ - ECompletion *completion; - EEntryCompletionHandler handler; - GtkWidget *completion_view; - guint nonempty_signal_id; - guint added_signal_id; - guint full_signal_id; - guint browse_signal_id; - guint unbrowse_signal_id; - guint activate_signal_id; - GtkWidget *completion_view_popup; - gboolean popup_is_visible; - gchar *pre_browse_text; - gint completion_delay; - guint completion_delay_tag; - gboolean ptr_grab; - gboolean changed_since_keypress; - guint changed_since_keypress_tag; - gint last_completion_pos; - - guint draw_borders : 1; -}; - -static gboolean e_entry_is_empty (EEntry *entry); -static void e_entry_show_popup (EEntry *entry, gboolean x); -static void e_entry_start_completion (EEntry *entry); -static void e_entry_start_delayed_completion (EEntry *entry, gint delay); -static void e_entry_cancel_delayed_completion (EEntry *entry); - -static void -canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, - EEntry *entry) -{ - gint xthick; - gint ythick; - gnome_canvas_set_scroll_region (entry->priv->canvas, - 0, 0, alloc->width, alloc->height); - gtk_object_set (GTK_OBJECT (entry->priv->item), - "clip_width", (double) (alloc->width), - "clip_height", (double) (alloc->height), - NULL); - - if (entry->priv->draw_borders) { - xthick = 0; - ythick = 0; - } else { - xthick = widget->style->klass->xthickness; - ythick = widget->style->klass->ythickness; - } - - switch (entry->priv->justification) { - case GTK_JUSTIFY_RIGHT: - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->priv->item), - alloc->width - xthick, ythick); - break; - case GTK_JUSTIFY_CENTER: - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->priv->item), - alloc->width / 2, ythick); - break; - default: - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->priv->item), - xthick, ythick); - break; - } -} - -static void -canvas_size_request (GtkWidget *widget, GtkRequisition *requisition, - EEntry *entry) -{ - int border; - - g_return_if_fail (widget != NULL); - g_return_if_fail (GNOME_IS_CANVAS (widget)); - g_return_if_fail (requisition != NULL); - - if (entry->priv->draw_borders) - border = INNER_BORDER; - else - border = 0; - - requisition->width = MIN_ENTRY_WIDTH + (widget->style->klass->xthickness + border) * 2; - requisition->height = (widget->style->font->ascent + - widget->style->font->descent + - (widget->style->klass->ythickness + border) * 2); -} - -static gint -canvas_focus_in_event (GtkWidget *widget, GdkEventFocus *focus, EEntry *entry) -{ - if (entry->priv->canvas->focused_item != GNOME_CANVAS_ITEM(entry->priv->item)) - gnome_canvas_item_grab_focus(GNOME_CANVAS_ITEM(entry->priv->item)); - - return 0; -} - -static void -e_entry_text_keypress (EText *text, guint keyval, guint state, EEntry *entry) -{ - if (entry->priv->changed_since_keypress_tag) { - gtk_timeout_remove (entry->priv->changed_since_keypress_tag); - entry->priv->changed_since_keypress_tag = 0; - } - - if (entry->priv->changed_since_keypress - || (entry->priv->popup_is_visible && e_entry_get_position (entry) != entry->priv->last_completion_pos)) { - if (e_entry_is_empty (entry)) { - e_entry_cancel_delayed_completion (entry); - e_entry_show_popup (entry, FALSE); - } else if (entry->priv->popup_is_visible) { - e_entry_start_delayed_completion (entry, 1); - } else if (entry->priv->completion) - e_entry_start_delayed_completion (entry, entry->priv->completion_delay); - } - entry->priv->changed_since_keypress = FALSE; -} - -static gint -changed_since_keypress_timeout_fn (gpointer user_data) -{ - EEntry *entry = E_ENTRY (user_data); - entry->priv->changed_since_keypress = FALSE; - entry->priv->changed_since_keypress_tag = 0; - return FALSE; -} - -static void -e_entry_proxy_changed (EText *text, EEntry *entry) -{ - if (entry->priv->changed_since_keypress_tag) - gtk_timeout_remove (entry->priv->changed_since_keypress_tag); - entry->priv->changed_since_keypress = TRUE; - entry->priv->changed_since_keypress_tag = gtk_timeout_add (20, changed_since_keypress_timeout_fn, entry); - - gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals [E_ENTRY_CHANGED]); -} - -static void -e_entry_proxy_activate (EText *text, EEntry *entry) -{ - gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals [E_ENTRY_ACTIVATE]); -} - -static void -e_entry_proxy_popup (EText *text, GdkEventButton *ev, gint pos, EEntry *entry) -{ - gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals [E_ENTRY_POPUP], ev, pos); -} - -static void -e_entry_init (GtkObject *object) -{ - EEntry *entry = E_ENTRY (object); - GtkTable *gtk_table = GTK_TABLE (object); - - entry->priv = g_new0 (EEntryPrivate, 1); - - entry->priv->canvas = GNOME_CANVAS (e_canvas_new ()); - - gtk_signal_connect (GTK_OBJECT (entry->priv->canvas), - "size_allocate", - GTK_SIGNAL_FUNC (canvas_size_allocate), - entry); - - gtk_signal_connect (GTK_OBJECT (entry->priv->canvas), - "size_request", - GTK_SIGNAL_FUNC (canvas_size_request), - entry); - - gtk_signal_connect(GTK_OBJECT (entry->priv->canvas), - "focus_in_event", - GTK_SIGNAL_FUNC(canvas_focus_in_event), - entry); - - entry->priv->draw_borders = TRUE; - - entry->priv->item = E_TEXT(gnome_canvas_item_new(gnome_canvas_root (entry->priv->canvas), - e_text_get_type(), - "clip", TRUE, - "fill_clip_rectangle", TRUE, - "anchor", GTK_ANCHOR_NW, - "draw_borders", TRUE, - "draw_background", TRUE, - "max_lines", 1, - "editable", TRUE, - NULL)); - - gtk_signal_connect (GTK_OBJECT (entry->priv->item), - "keypress", - GTK_SIGNAL_FUNC (e_entry_text_keypress), - entry); - - entry->priv->justification = GTK_JUSTIFY_LEFT; - gtk_table_attach (gtk_table, GTK_WIDGET (entry->priv->canvas), - 0, 1, 0, 1, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, - 0, 0); - gtk_widget_show (GTK_WIDGET (entry->priv->canvas)); - - /* - * Proxy functions: we proxy the changed and activate signals - * from the item to ourselves - */ - entry->priv->changed_proxy_tag = gtk_signal_connect (GTK_OBJECT (entry->priv->item), - "changed", - GTK_SIGNAL_FUNC (e_entry_proxy_changed), - entry); - entry->priv->activate_proxy_tag = gtk_signal_connect (GTK_OBJECT (entry->priv->item), - "activate", - GTK_SIGNAL_FUNC (e_entry_proxy_activate), - entry); - entry->priv->popup_proxy_tag = gtk_signal_connect (GTK_OBJECT (entry->priv->item), - "popup", - GTK_SIGNAL_FUNC (e_entry_proxy_popup), - entry); - - entry->priv->completion_delay = 1; -} - -/** - * e_entry_construct - * - * Constructs the given EEntry. - * - **/ -void -e_entry_construct (EEntry *entry) -{ - /* Do nothing */ -} - - -/** - * e_entry_new - * - * Creates a new EEntry. - * - * Returns: The new EEntry - **/ -GtkWidget * -e_entry_new (void) -{ - EEntry *entry; - entry = gtk_type_new (e_entry_get_type ()); - e_entry_construct (entry); - - return GTK_WIDGET (entry); -} - -const gchar * -e_entry_get_text (EEntry *entry) -{ - g_return_val_if_fail (entry != NULL && E_IS_ENTRY (entry), NULL); - - return e_text_model_get_text (entry->priv->item->model); -} - -void -e_entry_set_text (EEntry *entry, const gchar *txt) -{ - g_return_if_fail (entry != NULL && E_IS_ENTRY (entry)); - - e_text_model_set_text (entry->priv->item->model, txt); -} - -static void -e_entry_set_text_quiet (EEntry *entry, const gchar *txt) -{ - g_return_if_fail (entry != NULL && E_IS_ENTRY (entry)); - - gtk_signal_handler_block (GTK_OBJECT (entry->priv->item), entry->priv->changed_proxy_tag); - e_entry_set_text (entry, txt); - gtk_signal_handler_unblock (GTK_OBJECT (entry->priv->item), entry->priv->changed_proxy_tag); -} - - -void -e_entry_set_editable (EEntry *entry, gboolean am_i_editable) -{ - g_return_if_fail (entry != NULL && E_IS_ENTRY (entry)); - - gtk_object_set (GTK_OBJECT (entry->priv->item), "editable", am_i_editable, NULL); -} - -gint -e_entry_get_position (EEntry *entry) -{ - g_return_val_if_fail (entry != NULL && E_IS_ENTRY (entry), -1); - - return entry->priv->item->selection_start; -} - -void -e_entry_set_position (EEntry *entry, gint pos) -{ - g_return_if_fail (entry != NULL && E_IS_ENTRY (entry)); - if (pos < 0) - pos = 0; - else if (pos > e_text_model_get_text_length (entry->priv->item->model)) - pos = e_text_model_get_text_length (entry->priv->item->model); - - entry->priv->item->selection_start = entry->priv->item->selection_end = pos; -} - -void -e_entry_select_region (EEntry *entry, gint pos1, gint pos2) -{ - gint len; - - g_return_if_fail (entry != NULL && E_IS_ENTRY (entry)); - - len = e_text_model_get_text_length (entry->priv->item->model); - pos1 = CLAMP (pos1, 0, len); - pos2 = CLAMP (pos2, 0, len); - - entry->priv->item->selection_start = MIN (pos1, pos2); - entry->priv->item->selection_end = MAX (pos1, pos2); -} - -/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ - -/*** Completion-related code ***/ - -static gboolean -e_entry_is_empty (EEntry *entry) -{ - const gchar *txt = e_entry_get_text (entry); - - if (txt == NULL) - return TRUE; - - while (*txt) { - if (!isspace ((gint) *txt)) - return FALSE; - ++txt; - } - - return TRUE; -} - -static void -e_entry_show_popup (EEntry *entry, gboolean visible) -{ - GtkWidget *pop = entry->priv->completion_view_popup; - - if (pop == NULL) - return; - - if (visible) { - GtkAllocation *dim = &(GTK_WIDGET (entry)->allocation); - gint x, y, fudge; - const GdkEventMask grab_mask = (GdkEventMask)GDK_BUTTON_PRESS_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_RELEASE_MASK; - - /* Figure out where to put our popup. */ - gdk_window_get_origin (GTK_WIDGET (entry)->window, &x, &y); - x += dim->x; - y += dim->height + dim->y; - - /* Put our popup slightly to the right and up, to try to give a visual cue that this popup - is tied to this entry. Otherwise one-row popups can sort of "blend" with an entry - directly below. */ - fudge = MAX (dim->height/10, 3); /* just in case we are using a really big font, etc. */ - x += 2*fudge; - y -= fudge; - - gtk_widget_set_uposition (pop, x, y); - e_completion_view_set_width (E_COMPLETION_VIEW (entry->priv->completion_view), dim->width); - - gtk_widget_show (pop); - - - if (! entry->priv->ptr_grab) { - entry->priv->ptr_grab = gdk_pointer_grab (GTK_WIDGET (entry->priv->completion_view)->window, TRUE, - grab_mask, NULL, NULL, GDK_CURRENT_TIME); - if (entry->priv->ptr_grab) - gtk_grab_add (GTK_WIDGET (entry->priv->completion_view)); - } - - } else { - - gtk_widget_hide (pop); - - if (entry->priv->ptr_grab) { - gdk_pointer_ungrab (GDK_CURRENT_TIME); - gtk_grab_remove (GTK_WIDGET (entry->priv->completion_view)); - } - - entry->priv->ptr_grab = FALSE; - - entry->priv->last_completion_pos = -1; - - - } - - e_completion_view_set_editable (E_COMPLETION_VIEW (entry->priv->completion_view), visible); - entry->priv->popup_is_visible = visible; -} - -static void -e_entry_refresh_popup (EEntry *entry) -{ - if (entry->priv->popup_is_visible) - e_entry_show_popup (entry, TRUE); -} - -static void -e_entry_start_completion (EEntry *entry) -{ - if (entry->priv->completion == NULL) - return; - - e_entry_cancel_delayed_completion (entry); - - if (e_entry_is_empty (entry)) - return; - - e_completion_begin_search (entry->priv->completion, - e_entry_get_text (entry), - entry->priv->last_completion_pos = e_entry_get_position (entry), - 0); /* No limit. Probably a bad idea. */ -} - -static gboolean -start_delayed_cb (gpointer user_data) -{ - EEntry *entry = E_ENTRY (user_data); - entry->priv->completion_delay_tag = 0; - e_entry_start_completion (entry); - return FALSE; -} - -static void -e_entry_start_delayed_completion (EEntry *entry, gint delay) -{ - if (delay < 0) - return; - - e_entry_cancel_delayed_completion (entry); - entry->priv->completion_delay_tag = gtk_timeout_add (MAX (delay, 1), start_delayed_cb, entry); -} - -static void -e_entry_cancel_delayed_completion (EEntry *entry) -{ - if (entry->priv->completion == NULL) - return; - - if (entry->priv->completion_delay_tag) { - gtk_timeout_remove (entry->priv->completion_delay_tag); - entry->priv->completion_delay_tag = 0; - } -} - -static void -nonempty_cb (ECompletionView *view, gpointer user_data) -{ - EEntry *entry = E_ENTRY (user_data); - - e_entry_show_popup (entry, TRUE); -} - -static void -added_cb (ECompletionView *view, gpointer user_data) -{ - EEntry *entry = E_ENTRY (user_data); - e_entry_refresh_popup (entry); -} - -static void -full_cb (ECompletionView *view, gpointer user_data) -{ - EEntry *entry = E_ENTRY (user_data); - - e_entry_show_popup (entry, view->choice_count > 0); -} - -static void -browse_cb (ECompletionView *view, const gchar *txt, gpointer user_data) -{ - EEntry *entry = E_ENTRY (user_data); - - if (txt == NULL) { - /* Requesting a completion. */ - e_entry_start_completion (entry); - return; - } - - if (entry->priv->pre_browse_text == NULL) - entry->priv->pre_browse_text = g_strdup (e_entry_get_text (entry)); - - /* If there is no other handler in place, echo the selected completion in - the entry. */ - if (entry->priv->handler == NULL) - e_entry_set_text_quiet (entry, txt); -} - -static void -unbrowse_cb (ECompletionView *view, gpointer user_data) -{ - EEntry *entry = E_ENTRY (user_data); - - if (entry->priv->pre_browse_text) { - - if (entry->priv->handler == NULL) - e_entry_set_text_quiet (entry, entry->priv->pre_browse_text); - - g_free (entry->priv->pre_browse_text); - entry->priv->pre_browse_text = NULL; - } - - e_entry_show_popup (entry, FALSE); -} - -static void -activate_cb (ECompletionView *view, const gchar *txt, gpointer extra_data, gpointer user_data) -{ - EEntry *entry = E_ENTRY (user_data); - - e_entry_cancel_delayed_completion (entry); - - g_free (entry->priv->pre_browse_text); - entry->priv->pre_browse_text = NULL; - e_entry_show_popup (entry, FALSE); - - if (entry->priv->handler) - entry->priv->handler (entry, txt, extra_data); - else - e_entry_set_text (entry, txt); - - e_entry_cancel_delayed_completion (entry); -} - -void -e_entry_enable_completion (EEntry *entry, ECompletion *completion) -{ - g_return_if_fail (entry != NULL && E_IS_ENTRY (entry)); - g_return_if_fail (completion != NULL && E_IS_COMPLETION (completion)); - - e_entry_enable_completion_full (entry, completion, -1, NULL); -} - -static void -button_press_cb (GtkWidget *w, GdkEvent *ev, gpointer user_data) -{ - EEntry *entry = E_ENTRY (user_data); - GtkWidget *child; - - /* Bail out if our click happened inside of our widget. */ - child = gtk_get_event_widget (ev); - if (child != w) { - while (child) { - if (child == w) - return; - child = child->parent; - } - } - - /* Treat this as an unbrowse */ - unbrowse_cb (E_COMPLETION_VIEW (w), entry); -} - -void -e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint delay, EEntryCompletionHandler handler) -{ - g_return_if_fail (entry != NULL && E_IS_ENTRY (entry)); - g_return_if_fail (completion != NULL && E_IS_COMPLETION (completion)); - - /* For now, completion can't be changed mid-stream. */ - g_return_if_fail (entry->priv->completion == NULL); - - entry->priv->completion = completion; - gtk_object_ref (GTK_OBJECT (completion)); - gtk_object_sink (GTK_OBJECT (completion)); - - entry->priv->completion_delay = delay; - entry->priv->handler = handler; - - entry->priv->completion_view = e_completion_view_new (completion); - /* Make the up and down keys enable and disable completions. */ - e_completion_view_set_complete_key (E_COMPLETION_VIEW (entry->priv->completion_view), GDK_Down); - e_completion_view_set_uncomplete_key (E_COMPLETION_VIEW (entry->priv->completion_view), GDK_Up); - - gtk_signal_connect_after (GTK_OBJECT (entry->priv->completion_view), - "button_press_event", - GTK_SIGNAL_FUNC (button_press_cb), - entry); - - entry->priv->nonempty_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view), - "nonempty", - GTK_SIGNAL_FUNC (nonempty_cb), - entry); - - entry->priv->added_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view), - "added", - GTK_SIGNAL_FUNC (added_cb), - entry); - - entry->priv->full_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view), - "full", - GTK_SIGNAL_FUNC (full_cb), - entry); - - entry->priv->browse_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view), - "browse", - GTK_SIGNAL_FUNC (browse_cb), - entry); - - entry->priv->unbrowse_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view), - "unbrowse", - GTK_SIGNAL_FUNC (unbrowse_cb), - entry); - - entry->priv->activate_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view), - "activate", - GTK_SIGNAL_FUNC (activate_cb), - entry); - - entry->priv->completion_view_popup = gtk_window_new (GTK_WINDOW_POPUP); - - gtk_object_ref (GTK_OBJECT (entry->priv->completion_view_popup)); - gtk_object_sink (GTK_OBJECT (entry->priv->completion_view_popup)); - gtk_window_set_policy (GTK_WINDOW (entry->priv->completion_view_popup), FALSE, TRUE, FALSE); - gtk_container_add (GTK_CONTAINER (entry->priv->completion_view_popup), entry->priv->completion_view); - gtk_widget_show (entry->priv->completion_view); - - e_completion_view_connect_keys (E_COMPLETION_VIEW (entry->priv->completion_view), GTK_WIDGET (entry->priv->canvas)); -} - -/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ - -static void -et_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EEntry *entry = E_ENTRY (o); - GtkObject *item = GTK_OBJECT (entry->priv->item); - - switch (arg_id){ - case ARG_MODEL: - gtk_object_get(item, - "model", >K_VALUE_OBJECT (*arg), - NULL); - break; - - case ARG_EVENT_PROCESSOR: - gtk_object_get(item, - "event_processor", >K_VALUE_OBJECT (*arg), - NULL); - break; - - case ARG_TEXT: - gtk_object_get(item, - "text", >K_VALUE_STRING (*arg), - NULL); - break; - - case ARG_FONT_GDK: - gtk_object_get(item, - "font_gdk", >K_VALUE_BOXED (*arg), - NULL); - break; - - case ARG_JUSTIFICATION: - gtk_object_get(item, - "justification", >K_VALUE_ENUM (*arg), - NULL); - break; - - case ARG_FILL_COLOR_GDK: - gtk_object_get(item, - "fill_color_gdk", >K_VALUE_BOXED (*arg), - NULL); - break; - - case ARG_FILL_COLOR_RGBA: - gtk_object_get(item, - "fill_color_rgba", >K_VALUE_UINT (*arg), - NULL); - break; - - case ARG_FILL_STIPPLE: - gtk_object_get(item, - "fill_stiple", >K_VALUE_BOXED (*arg), - NULL); - break; - - case ARG_EDITABLE: - gtk_object_get(item, - "editable", >K_VALUE_BOOL (*arg), - NULL); - break; - - case ARG_USE_ELLIPSIS: - gtk_object_get(item, - "use_ellipsis", >K_VALUE_BOOL (*arg), - NULL); - break; - - case ARG_ELLIPSIS: - gtk_object_get(item, - "ellipsis", >K_VALUE_STRING (*arg), - NULL); - break; - - case ARG_LINE_WRAP: - gtk_object_get(item, - "line_wrap", >K_VALUE_BOOL (*arg), - NULL); - break; - - case ARG_BREAK_CHARACTERS: - gtk_object_get(item, - "break_characters", >K_VALUE_STRING (*arg), - NULL); - break; - - case ARG_MAX_LINES: - gtk_object_get(item, - "max_lines", >K_VALUE_INT (*arg), - NULL); - break; - case ARG_ALLOW_NEWLINES: - gtk_object_get(item, - "allow_newlines", >K_VALUE_BOOL (*arg), - NULL); - break; - - case ARG_DRAW_BORDERS: - GTK_VALUE_BOOL (*arg) = entry->priv->draw_borders; - break; - - case ARG_DRAW_BACKGROUND: - gtk_object_get (item, - "draw_background", >K_VALUE_BOOL (*arg), - NULL); - break; - - case ARG_CURSOR_POS: - gtk_object_get (item, - "cursor_pos", >K_VALUE_INT (*arg), - NULL); - - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EEntry *entry = E_ENTRY (o); - GtkObject *item = GTK_OBJECT (entry->priv->item); - GtkAnchorType anchor; - double width, height; - gint xthick; - gint ythick; - GtkWidget *widget = GTK_WIDGET(entry->priv->canvas); - - switch (arg_id){ - case ARG_MODEL: - gtk_object_set(item, - "model", GTK_VALUE_OBJECT (*arg), - NULL); - break; - - case ARG_EVENT_PROCESSOR: - gtk_object_set(item, - "event_processor", GTK_VALUE_OBJECT (*arg), - NULL); - break; - - case ARG_TEXT: - - gtk_object_set(item, - "text", GTK_VALUE_STRING (*arg), - NULL); - break; - - case ARG_FONT: - gtk_object_set(item, - "font", GTK_VALUE_STRING (*arg), - NULL); - break; - - case ARG_FONTSET: - gtk_object_set(item, - "fontset", GTK_VALUE_STRING (*arg), - NULL); - break; - - case ARG_FONT_GDK: - gtk_object_set(item, - "font_gdk", GTK_VALUE_BOXED (*arg), - NULL); - break; - - case ARG_JUSTIFICATION: - entry->priv->justification = GTK_VALUE_ENUM (*arg); - gtk_object_get(item, - "clip_width", &width, - "clip_height", &height, - NULL); - - if (entry->priv->draw_borders) { - xthick = 0; - ythick = 0; - } else { - xthick = widget->style->klass->xthickness; - ythick = widget->style->klass->ythickness; - } - - switch (entry->priv->justification) { - case GTK_JUSTIFY_CENTER: - anchor = GTK_ANCHOR_N; - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->priv->item), width / 2, ythick); - break; - case GTK_JUSTIFY_RIGHT: - anchor = GTK_ANCHOR_NE; - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->priv->item), width - xthick, ythick); - break; - default: - anchor = GTK_ANCHOR_NW; - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->priv->item), xthick, ythick); - break; - } - gtk_object_set(item, - "justification", entry->priv->justification, - "anchor", anchor, - NULL); - break; - - case ARG_FILL_COLOR: - gtk_object_set(item, - "fill_color", GTK_VALUE_STRING (*arg), - NULL); - break; - - case ARG_FILL_COLOR_GDK: - gtk_object_set(item, - "fill_color_gdk", GTK_VALUE_BOXED (*arg), - NULL); - break; - - case ARG_FILL_COLOR_RGBA: - gtk_object_set(item, - "fill_color_rgba", GTK_VALUE_UINT (*arg), - NULL); - break; - - case ARG_FILL_STIPPLE: - gtk_object_set(item, - "fill_stiple", GTK_VALUE_BOXED (*arg), - NULL); - break; - - case ARG_EDITABLE: - gtk_object_set(item, - "editable", GTK_VALUE_BOOL (*arg), - NULL); - break; - - case ARG_USE_ELLIPSIS: - gtk_object_set(item, - "use_ellipsis", GTK_VALUE_BOOL (*arg), - NULL); - break; - - case ARG_ELLIPSIS: - gtk_object_set(item, - "ellipsis", GTK_VALUE_STRING (*arg), - NULL); - break; - - case ARG_LINE_WRAP: - gtk_object_set(item, - "line_wrap", GTK_VALUE_BOOL (*arg), - NULL); - break; - - case ARG_BREAK_CHARACTERS: - gtk_object_set(item, - "break_characters", GTK_VALUE_STRING (*arg), - NULL); - break; - - case ARG_MAX_LINES: - gtk_object_set(item, - "max_lines", GTK_VALUE_INT (*arg), - NULL); - break; - - case ARG_ALLOW_NEWLINES: - gtk_object_set(item, - "allow_newlines", GTK_VALUE_BOOL (*arg), - NULL); - break; - - case ARG_DRAW_BORDERS: { - gboolean need_queue; - - need_queue = (entry->priv->draw_borders ^ GTK_VALUE_BOOL (*arg)); - gtk_object_set (item, "draw_borders", GTK_VALUE_BOOL (*arg), NULL); - entry->priv->draw_borders = GTK_VALUE_BOOL (*arg); - if (need_queue) - gtk_widget_queue_resize (GTK_WIDGET (entry)); - break; - } - - case ARG_CURSOR_POS: - gtk_object_set (item, - "cursor_pos", GTK_VALUE_INT (*arg), NULL); - break; - - case ARG_DRAW_BACKGROUND: - gtk_object_set (item, "draw_background", - GTK_VALUE_BOOL (*arg), NULL); - break; - } -} - -static void -e_entry_destroy (GtkObject *object) -{ - EEntry *entry = E_ENTRY (object); - - if (entry->priv->completion_delay_tag) - gtk_timeout_remove (entry->priv->completion_delay_tag); - - if (entry->priv->completion) - gtk_object_unref (GTK_OBJECT (entry->priv->completion)); - if (entry->priv->completion_view_popup) - gtk_widget_destroy (entry->priv->completion_view_popup); - g_free (entry->priv->pre_browse_text); - - if (entry->priv->changed_since_keypress_tag) - gtk_timeout_remove (entry->priv->changed_since_keypress_tag); - - if (entry->priv->ptr_grab) - gdk_pointer_ungrab (GDK_CURRENT_TIME); - - g_free (entry->priv); - entry->priv = NULL; -} - -static void -e_entry_class_init (GtkObjectClass *object_class) -{ - EEntryClass *klass = E_ENTRY_CLASS(object_class); - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->set_arg = et_set_arg; - object_class->get_arg = et_get_arg; - object_class->destroy = e_entry_destroy; - - klass->changed = NULL; - klass->activate = NULL; - - e_entry_signals[E_ENTRY_CHANGED] = gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EEntryClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_entry_signals[E_ENTRY_ACTIVATE] = gtk_signal_new ("activate", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EEntryClass, activate), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_entry_signals[E_ENTRY_POPUP] = gtk_signal_new ("popup", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EEntryClass, popup), - gtk_marshal_NONE__POINTER_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT); - - - gtk_object_class_add_signals (object_class, e_entry_signals, E_ENTRY_LAST_SIGNAL); - - gtk_object_add_arg_type ("EEntry::model", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_MODEL); - gtk_object_add_arg_type ("EEntry::event_processor", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_EVENT_PROCESSOR); - gtk_object_add_arg_type ("EEntry::text", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT); - gtk_object_add_arg_type ("EEntry::font", - GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONT); - gtk_object_add_arg_type ("EEntry::fontset", - GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONTSET); - gtk_object_add_arg_type ("EEntry::font_gdk", - GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_FONT_GDK); - gtk_object_add_arg_type ("EEntry::justification", - GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFICATION); - gtk_object_add_arg_type ("EEntry::fill_color", - GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FILL_COLOR); - gtk_object_add_arg_type ("EEntry::fill_color_gdk", - GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_FILL_COLOR_GDK); - gtk_object_add_arg_type ("EEntry::fill_color_rgba", - GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_FILL_COLOR_RGBA); - gtk_object_add_arg_type ("EEntry::fill_stipple", - GTK_TYPE_GDK_WINDOW, GTK_ARG_READWRITE, ARG_FILL_STIPPLE); - gtk_object_add_arg_type ("EEntry::editable", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE); - gtk_object_add_arg_type ("EEntry::use_ellipsis", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_USE_ELLIPSIS); - gtk_object_add_arg_type ("EEntry::ellipsis", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ELLIPSIS); - gtk_object_add_arg_type ("EEntry::line_wrap", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_LINE_WRAP); - gtk_object_add_arg_type ("EEntry::break_characters", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_BREAK_CHARACTERS); - gtk_object_add_arg_type ("EEntry::max_lines", - GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_MAX_LINES); - gtk_object_add_arg_type ("EEntry::allow_newlines", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_NEWLINES); - gtk_object_add_arg_type ("EEntry::draw_borders", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BORDERS); - gtk_object_add_arg_type ("EEntry::draw_background", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BACKGROUND); - gtk_object_add_arg_type ("EEntry::cursor_pos", - GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_CURSOR_POS); -} - -E_MAKE_TYPE(e_entry, "EEntry", EEntry, e_entry_class_init, e_entry_init, PARENT_TYPE); diff --git a/widgets/text/e-entry.h b/widgets/text/e-entry.h deleted file mode 100644 index 64b6fb7875..0000000000 --- a/widgets/text/e-entry.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * EEntry: An EText-based entry widget - * - * Authors: - * Miguel de Icaza <miguel@helixcode.com> - * Chris Lahey <clahey@helixcode.com> - * Jon Trowbridge <trow@ximian.com> - * - * Copyright (C) 1999, 2000, 2001 Ximian Inc. - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - -#ifndef _E_ENTRY_H_ -#define _E_ENTRY_H_ - -#include <gtk/gtktable.h> -#include <gnome-xml/tree.h> -#include "e-completion.h" - -BEGIN_GNOME_DECLS - -#define E_ENTRY_TYPE (e_entry_get_type ()) -#define E_ENTRY(o) (GTK_CHECK_CAST ((o), E_ENTRY_TYPE, EEntry)) -#define E_ENTRY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_ENTRY_TYPE, EEntryClass)) -#define E_IS_ENTRY(o) (GTK_CHECK_TYPE ((o), E_ENTRY_TYPE)) -#define E_IS_ENTRY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_ENTRY_TYPE)) - -typedef struct _EEntry EEntry; -typedef struct _EEntryClass EEntryClass; -struct _EEntryPrivate; - -typedef void (*EEntryCompletionHandler) (EEntry *entry, const gchar *text, gpointer extra_data); - -struct _EEntry { - GtkTable parent; - struct _EEntryPrivate *priv; -}; - -struct _EEntryClass { - GtkTableClass parent_class; - - void (* changed) (EEntry *entry); - void (* activate) (EEntry *entry); - void (* popup) (EEntry *entry, GdkEventButton *ev, gint pos); -}; - -GtkType e_entry_get_type (void); - -void e_entry_construct (EEntry *entry); -GtkWidget *e_entry_new (void); - -const gchar *e_entry_get_text (EEntry *entry); -void e_entry_set_text (EEntry *entry, const gchar *text); - -gint e_entry_get_position (EEntry *entry); -void e_entry_set_position (EEntry *entry, gint); -void e_entry_select_region (EEntry *entry, gint start, gint end); - -void e_entry_set_editable (EEntry *entry, gboolean editable); - -void e_entry_enable_completion (EEntry *entry, ECompletion *completion); -void e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint autocomplete_delay, - EEntryCompletionHandler handler); - -END_GNOME_DECLS - -#endif /* _E_ENTRY_H_ */ diff --git a/widgets/text/e-table-text-model.c b/widgets/text/e-table-text-model.c deleted file mode 100644 index 7320c48e36..0000000000 --- a/widgets/text/e-table-text-model.c +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ETableTextModel - Text item model for evolution. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Chris Lahey <clahey@umich.edu> - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena <federico@nuclecu.unam.mx> */ - -#include <config.h> -#include <ctype.h> -#include "e-table-text-model.h" - -static void e_table_text_model_class_init (ETableTextModelClass *class); -static void e_table_text_model_init (ETableTextModel *model); -static void e_table_text_model_destroy (GtkObject *object); - -static const gchar *e_table_text_model_get_text (ETextModel *model); -static void e_table_text_model_set_text (ETextModel *model, const gchar *text); -static void e_table_text_model_insert (ETextModel *model, gint postion, const gchar *text); -static void e_table_text_model_insert_length (ETextModel *model, gint postion, const gchar *text, gint length); -static void e_table_text_model_delete (ETextModel *model, gint postion, gint length); - -static GtkObject *parent_class; - - - -/** - * e_table_text_model_get_type: - * @void: - * - * Registers the &ETableTextModel class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ETableTextModel class. - **/ -GtkType -e_table_text_model_get_type (void) -{ - static GtkType model_type = 0; - - if (!model_type) { - GtkTypeInfo model_info = { - "ETableTextModel", - sizeof (ETableTextModel), - sizeof (ETableTextModelClass), - (GtkClassInitFunc) e_table_text_model_class_init, - (GtkObjectInitFunc) e_table_text_model_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - model_type = gtk_type_unique (e_text_model_get_type (), &model_info); - } - - return model_type; -} - -/* Class initialization function for the text item */ -static void -e_table_text_model_class_init (ETableTextModelClass *klass) -{ - GtkObjectClass *object_class; - ETextModelClass *model_class; - - object_class = (GtkObjectClass *) klass; - model_class = (ETextModelClass *) klass; - - parent_class = gtk_type_class (e_text_model_get_type ()); - - model_class->get_text = e_table_text_model_get_text; - model_class->set_text = e_table_text_model_set_text; - model_class->insert = e_table_text_model_insert; - model_class->insert_length = e_table_text_model_insert_length; - model_class->delete = e_table_text_model_delete; - - object_class->destroy = e_table_text_model_destroy; -} - -/* Object initialization function for the text item */ -static void -e_table_text_model_init (ETableTextModel *model) -{ - model->model = NULL; - model->row = 0; - model->model_col = 0; - model->cell_changed_signal_id = 0; - model->row_changed_signal_id = 0; -} - -/* Destroy handler for the text item */ -static void -e_table_text_model_destroy (GtkObject *object) -{ - ETableTextModel *model; - - g_return_if_fail (object != NULL); - g_return_if_fail (E_IS_TABLE_TEXT_MODEL (object)); - - model = E_TABLE_TEXT_MODEL (object); - - if (model->model) - g_assert (GTK_IS_OBJECT (model->model)); - - if (model->cell_changed_signal_id) - gtk_signal_disconnect (GTK_OBJECT(model->model), - model->cell_changed_signal_id); - - if (model->row_changed_signal_id) - gtk_signal_disconnect (GTK_OBJECT(model->model), - model->row_changed_signal_id); - - if (model->model) - gtk_object_unref (GTK_OBJECT(model->model)); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} -static const gchar * -e_table_text_model_get_text (ETextModel *text_model) -{ - ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model); - if (model->model) - return (gchar *)e_table_model_value_at (model->model, model->model_col, model->row); - else - return ""; -} - -static void -e_table_text_model_set_text (ETextModel *text_model, const gchar *text) -{ - ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model); - if (model->model) - e_table_model_set_value_at (model->model, model->model_col, model->row, (void *) text); -} - -static void -e_table_text_model_insert (ETextModel *text_model, gint position, const gchar *text) -{ - ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model); - if (model->model){ - gchar *temp = (gchar *)e_table_model_value_at (model->model, model->model_col, model->row); - temp = g_strdup_printf ("%.*s%s%s", position, temp, text, temp + position); - e_table_model_set_value_at (model->model, model->model_col, model->row, temp); - g_free (temp); - } -} - -static void -e_table_text_model_insert_length (ETextModel *text_model, gint position, const gchar *text, gint length) -{ - ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model); - if (model->model){ - gchar *temp = (gchar *)e_table_model_value_at (model->model, model->model_col, model->row); - temp = g_strdup_printf ("%.*s%.*s%s", position, temp, length, text, temp + position); - e_table_model_set_value_at (model->model, model->model_col, model->row, temp); - g_free (temp); - } -} - -static void -e_table_text_model_delete (ETextModel *text_model, gint position, gint length) -{ - ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model); - if (model->model){ - gchar *temp = (gchar *)e_table_model_value_at (model->model, model->model_col, model->row); - temp = g_strdup_printf ("%.*s%s", position, temp, temp + position + length); - e_table_model_set_value_at (model->model, model->model_col, model->row, temp); - g_free (temp); - } -} - -static void -cell_changed (ETableModel *table_model, int model_col, int row, ETableTextModel *model) -{ - if (model->model_col == model_col && - model->row == row) - e_text_model_changed (E_TEXT_MODEL(model)); -} - -static void -row_changed (ETableModel *table_model, int row, ETableTextModel *model) -{ - if (model->row == row) - e_text_model_changed (E_TEXT_MODEL(model)); -} - -ETableTextModel * -e_table_text_model_new (ETableModel *table_model, int row, int model_col) -{ - ETableTextModel *model; - - g_return_val_if_fail(table_model != NULL, NULL); - g_return_val_if_fail(E_IS_TABLE_MODEL(table_model), NULL); - - model = gtk_type_new (e_table_text_model_get_type ()); - model->model = table_model; - if (model->model){ - gtk_object_ref (GTK_OBJECT(model->model)); - model->cell_changed_signal_id = - gtk_signal_connect (GTK_OBJECT(model->model), - "model_cell_changed", - GTK_SIGNAL_FUNC(cell_changed), - model); - model->row_changed_signal_id = - gtk_signal_connect (GTK_OBJECT(model->model), - "model_row_changed", - GTK_SIGNAL_FUNC(row_changed), - model); - } - model->row = row; - model->model_col = model_col; - return model; -} - diff --git a/widgets/text/e-table-text-model.h b/widgets/text/e-table-text-model.h deleted file mode 100644 index 5cf0b8a231..0000000000 --- a/widgets/text/e-table-text-model.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ETableTextModel - Text item for evolution. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Chris Lahey <clahey@umich.edu> - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena <federico@nuclecu.unam.mx> */ - -#ifndef E_TABLE_TEXT_MODEL_H -#define E_TABLE_TEXT_MODEL_H - -#include <gnome.h> -#include <gal/e-text/e-text-model.h> -#include <gal/e-table/e-table-model.h> - - -BEGIN_GNOME_DECLS - -#define E_TYPE_TABLE_TEXT_MODEL (e_table_text_model_get_type ()) -#define E_TABLE_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TABLE_TEXT_MODEL, ETableTextModel)) -#define E_TABLE_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TABLE_TEXT_MODEL, ETableTextModelClass)) -#define E_IS_TABLE_TEXT_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TABLE_TEXT_MODEL)) -#define E_IS_TABLE_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TABLE_TEXT_MODEL)) - -typedef struct _ETableTextModel ETableTextModel; -typedef struct _ETableTextModelClass ETableTextModelClass; - -struct _ETableTextModel { - ETextModel parent; - - ETableModel *model; - int row; - int model_col; - - int cell_changed_signal_id; - int row_changed_signal_id; -}; - -struct _ETableTextModelClass { - ETextModelClass parent_class; - -}; - - -/* Standard Gtk function */ -GtkType e_table_text_model_get_type (void); -ETableTextModel *e_table_text_model_new (ETableModel *table_model, int row, int model_col); - -END_GNOME_DECLS - -#endif diff --git a/widgets/text/e-text-model-repos.c b/widgets/text/e-text-model-repos.c deleted file mode 100644 index 407a661b05..0000000000 --- a/widgets/text/e-text-model-repos.c +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* Standard ETextModelReposFn definitions - * - * Copyright (C) 2001 Ximian Inc. - * - * Author: Jon Trowbridge <trow@ximian.com> - */ - -#include "e-text-model-repos.h" - -#define MODEL_CLAMP(model, pos) (CLAMP((pos), 0, strlen((model)->text))) - -gint -e_repos_shift (gint pos, gpointer data) -{ - EReposShift *info = (EReposShift *) data; - g_return_val_if_fail (data, -1); - - return e_text_model_validate_position (info->model, pos + info->change); -} - -gint -e_repos_absolute (gint pos, gpointer data) -{ - EReposAbsolute *info = (EReposAbsolute *) data; - g_return_val_if_fail (data, -1); - - pos = info->pos; - if (pos < 0) { - gint len = e_text_model_get_text_length (info->model); - pos += len + 1; - } - - return e_text_model_validate_position (info->model, pos); -} - -gint -e_repos_insert_shift (gint pos, gpointer data) -{ - EReposInsertShift *info = (EReposInsertShift *) data; - g_return_val_if_fail (data, -1); - - if (pos >= info->pos) - pos += info->len; - - return e_text_model_validate_position (info->model, pos); -} - -gint -e_repos_delete_shift (gint pos, gpointer data) -{ - EReposDeleteShift *info = (EReposDeleteShift *) data; - g_return_val_if_fail (data, -1); - - if (pos > info->pos + info->len) - pos -= info->len; - else if (pos > info->pos) - pos = info->pos; - - return e_text_model_validate_position (info->model, pos); -} - -gint -e_repos_clamp (gint pos, gpointer data) -{ - ETextModel *model; - - g_return_val_if_fail (data != NULL && E_IS_TEXT_MODEL (data), -1); - model = E_TEXT_MODEL (data); - - return e_text_model_validate_position (model, pos); -} diff --git a/widgets/text/e-text-model-repos.h b/widgets/text/e-text-model-repos.h deleted file mode 100644 index 620e41a415..0000000000 --- a/widgets/text/e-text-model-repos.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* Standard ETextModelReposFn definitions - * - * Copyright (C) 2001 Ximian Inc. - * - * Author: Jon Trowbridge <trow@ximian.com> - */ - -#ifndef E_TEXT_MODEL_REPOS_H -#define E_TEXT_MODEL_REPOS_H - -#include "e-text-model.h" - -typedef struct { - ETextModel *model; - gint change; /* Relative change to position. */ -} EReposShift; - -gint e_repos_shift (gint pos, gpointer data); - - -typedef struct { - ETextModel *model; - gint pos; /* Position to move to. Negative values count from the end buffer. - (i.e. -1 puts cursor at the end, -2 one character from end, etc.) */ -} EReposAbsolute; - -gint e_repos_absolute (gint pos, gpointer data); - - -typedef struct { - ETextModel *model; - gint pos; /* Location of first inserted character. */ - gint len; /* Number of characters inserted. */ -} EReposInsertShift; - -gint e_repos_insert_shift (gint pos, gpointer data); - - -typedef struct { - ETextModel *model; - gint pos; /* Location of first deleted character. */ - gint len; /* Number of characters deleted. */ -} EReposDeleteShift; - -gint e_repos_delete_shift (gint pos, gpointer data); - - -/* For e_repos_clamp, data is a pointer to an ETextModel. The only repositioning - that occurs is to avoid buffer overruns. */ - -gint e_repos_clamp (gint pos, gpointer data); - -#endif diff --git a/widgets/text/e-text-model-test.c b/widgets/text/e-text-model-test.c deleted file mode 100644 index 9bf73962b0..0000000000 --- a/widgets/text/e-text-model-test.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - ETextModelTest -*/ - -#include <gnome.h> -#include <gal/widgets/e-canvas.h> -#include "e-text-model.h" -#include "e-text-model-uri.h" -#include "e-text.h" -#include <gal/util/e-util.h> - -#if 0 -static void -describe_model (ETextModel *model) -{ - gint i, N; - g_return_if_fail (E_IS_TEXT_MODEL (model)); - - N = e_text_model_object_count (model); - - g_print ("text: %s\n", e_text_model_get_text (model)); - g_print ("objs: %d\n", N); - - for (i=0; i<N; ++i) { - gchar *s = e_text_model_strdup_nth_object (model, i); - g_print ("obj%d: %s\n", i, s); - g_free (s); - } -} -#endif - -int -main (int argc, gchar **argv) -{ - GtkWidget *win[2], *canvas[2]; - GnomeCanvasItem *item[2]; - ETextModel *model; - gint i; - - gnome_init ("ETextModelTest", "0.0", argc, argv); - - model = e_text_model_uri_new (); - - e_text_model_set_text (model, "My favorite website is http://www.ximian.com. My next favorite www.assbarn.com."); - - // describe_model (model); - - for (i=0; i<2; ++i) { - win[i] = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - canvas[i] = e_canvas_new (); - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); - - item[i] = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas[i])), - e_text_get_type (), - "model", model, - "font", "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1", - "anchor", GTK_ANCHOR_NORTH, - "line_wrap", TRUE, - "width", 150.0, - "editable", TRUE, - NULL); - - gtk_container_add (GTK_CONTAINER (win[i]), canvas[i]); - gtk_widget_show_all (win[i]); - } - - gtk_main (); - - return 0; -} diff --git a/widgets/text/e-text-model-uri.c b/widgets/text/e-text-model-uri.c deleted file mode 100644 index 55b293016f..0000000000 --- a/widgets/text/e-text-model-uri.c +++ /dev/null @@ -1,341 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* ETextModelURI - A Text Model w/ clickable URIs - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Jon Trowbridge <trow@gnu.org> - * - */ - -#include <config.h> -#include <ctype.h> -#include <sys/types.h> -#include <regex.h> -#include "e-text-model-uri.h" - -static void e_text_model_uri_class_init (ETextModelURIClass *class); -static void e_text_model_uri_init (ETextModelURI *model); -static void e_text_model_uri_destroy (GtkObject *object); - -static void objectify_uris (ETextModelURI *model); - -static void e_text_model_uri_objectify (ETextModel *model); -static gint e_text_model_uri_validate_pos (ETextModel *model, gint pos); -static gint e_text_model_uri_get_obj_count (ETextModel *model); -static const gchar *e_text_model_uri_get_nth_object (ETextModel *model, gint i, gint *len); -static void e_text_model_uri_activate_nth_object (ETextModel *model, gint); - -typedef struct _ObjInfo ObjInfo; -struct _ObjInfo { - gint offset, len; -}; - -static GtkObject *parent_class; - -GtkType -e_text_model_uri_get_type (void) -{ - static GtkType model_uri_type = 0; - - if (!model_uri_type) { - GtkTypeInfo model_uri_info = { - "ETextModelURI", - sizeof (ETextModelURI), - sizeof (ETextModelURIClass), - (GtkClassInitFunc) e_text_model_uri_class_init, - (GtkObjectInitFunc) e_text_model_uri_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - model_uri_type = gtk_type_unique (e_text_model_get_type (), &model_uri_info); - } - - return model_uri_type; -} - -static void -e_text_model_uri_class_init (ETextModelURIClass *klass) -{ - GtkObjectClass *object_class; - ETextModelClass *model_class; - - object_class = (GtkObjectClass *) klass; - model_class = E_TEXT_MODEL_CLASS (klass); - - parent_class = gtk_type_class (e_text_model_get_type ()); - - object_class->destroy = e_text_model_uri_destroy; - - model_class->object_activated = e_text_model_uri_activate_nth_object; - - model_class->objectify = e_text_model_uri_objectify; - model_class->validate_pos = e_text_model_uri_validate_pos; - model_class->obj_count = e_text_model_uri_get_obj_count; - model_class->get_nth_obj = e_text_model_uri_get_nth_object; - -} - -static void -e_text_model_uri_init (ETextModelURI *model) -{ - -} - -static void -e_text_model_uri_destroy (GtkObject *object) -{ - ETextModelURI *model_uri = E_TEXT_MODEL_URI (object); - GList *iter; - - if (model_uri->objectify_idle) { - gtk_idle_remove (model_uri->objectify_idle); - model_uri->objectify_idle = 0; - } - - for (iter = model_uri->uris; iter != NULL; iter = g_list_next (iter)) - g_free (iter->data); - g_list_free (model_uri->uris); - model_uri->uris = NULL; - - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); - -} - -static const gchar *uri_regex[] = { - "(((news|telnet|nttp|file|http|ftp|https)://)|(www|ftp))[-A-Za-z0-9\\.]+(:[0-9]*)?/[-A-Za-z0-9_\\$\\.\\+\\!\\*\\(\\),;:@&=\\?/~\\#\\%]*[^]'\\.}>\\) ,\\\"]", - "(((news|telnet|nttp|file|http|ftp|https)://)|(www|ftp))[-A-Za-z0-9\\.]+[-A-Za-z0-9](:[0-9]*)?", - "mailto:[A-Za-z0-9_]+@[-A-Za-z0-9_]+\\.[-A-Za-z0-9\\.]+[-A-Za-z0-9]", - NULL -}; -static gint regex_count = 0; -static regex_t *regex_compiled = NULL; - -static void -regex_init (void) -{ - gint i; - - if (regex_count != 0) - return; - - while (uri_regex[regex_count]) ++regex_count; - - regex_compiled = g_new0 (regex_t, regex_count); - - for (i=0; i<regex_count; ++i) { - if (regcomp (®ex_compiled[i], uri_regex[i], REG_EXTENDED)) - g_error ("Bad regex?: %s", uri_regex[i]); - } -} - - -static void -objectify_uris (ETextModelURI *model_uri) -{ - static gboolean objectifying = FALSE; - - ETextModel *model = E_TEXT_MODEL (model_uri); - const gchar *txt; - GList *iter, *old_uris; - gint offset, len; - gboolean found_match; - regmatch_t match; - gboolean changed; - - if (objectifying) - return; - - objectifying = TRUE; - - if (regex_count == 0) - regex_init (); - - txt = e_text_model_get_text (model); - len = e_text_model_get_text_length (model); - - old_uris = model_uri->uris; - model_uri->uris = NULL; - - if (txt) { - offset = 0; - found_match = TRUE; - - while (offset < len && found_match) { - - gint i, so=-1, eo=-1; - - found_match = FALSE; - - for (i=0; i<regex_count; ++i) { - - if (regexec (®ex_compiled[i], txt+offset, 1, &match, 0) == 0) { - - /* Take earliest match possible. In case of a tie, take the - largest possible match. */ - if (!found_match - || match.rm_so < so - || (match.rm_so == so && match.rm_eo > eo)) { - so = match.rm_so; - eo = match.rm_eo; - } - found_match = TRUE; - } - } - - if (found_match) { - - ObjInfo *info = g_new0 (ObjInfo, 1); - info->offset = offset + so; - info->len = eo - so; - - model_uri->uris = g_list_append (model_uri->uris, info); - - offset += eo; - } - } - } - - changed = (g_list_length (old_uris) != g_list_length (model_uri->uris)); - - if (!changed) { - /* Check that there is a 1-1 correspondence between object positions. */ - GList *jter; - - for (iter = model_uri->uris; iter != NULL && !changed; iter = g_list_next (iter)) { - ObjInfo *info = (ObjInfo *) iter->data; - found_match = FALSE; - for (jter = old_uris; jter != NULL && !found_match; jter = g_list_next (jter)) { - ObjInfo *jnfo = (ObjInfo *) jter->data; - - if (info->offset == jnfo->offset && info->len == jnfo->len) - found_match = TRUE; - } - changed = !found_match; - } - } - - if (changed) - e_text_model_changed (model); - - /* Free old uris */ - for (iter = old_uris; iter != NULL; iter = g_list_next (iter)) - g_free (iter->data); - g_list_free (old_uris); - - objectifying = FALSE; -} - -static gboolean -objectify_idle_cb (gpointer ptr) -{ - ETextModelURI *model_uri = E_TEXT_MODEL_URI (ptr); - - g_assert (model_uri->objectify_idle); - objectify_uris (model_uri); - model_uri->objectify_idle = 0; - - return FALSE; -} - -static void -e_text_model_uri_objectify (ETextModel *model) -{ - ETextModelURI *model_uri = E_TEXT_MODEL_URI (model); - - if (model_uri->objectify_idle == 0) - model_uri->objectify_idle = gtk_idle_add (objectify_idle_cb, model); - - if (E_TEXT_MODEL_CLASS(parent_class)->objectify) - E_TEXT_MODEL_CLASS(parent_class)->objectify (model); -} - -static void -objectify_idle_flush (ETextModelURI *model_uri) -{ - if (model_uri->objectify_idle) { - gtk_idle_remove (model_uri->objectify_idle); - model_uri->objectify_idle = 0; - objectify_uris (model_uri); - } -} - -static gint -e_text_model_uri_validate_pos (ETextModel *model, gint pos) -{ - gint obj_num; - - /* Cause us to skip over objects */ - - obj_num = e_text_model_get_object_at_offset (model, pos); - if (obj_num != -1) { - gint pos0, pos1, mp; - e_text_model_get_nth_object_bounds (model, obj_num, &pos0, &pos1); - mp = (pos0 + pos1)/2; - if (pos0 < pos && pos < mp) - pos = pos1; - else if (mp <= pos && pos < pos1) - pos = pos0; - } - - - - if (E_TEXT_MODEL_CLASS (parent_class)->validate_pos) - pos = E_TEXT_MODEL_CLASS (parent_class)->validate_pos (model, pos); - - return pos; -} - -static gint -e_text_model_uri_get_obj_count (ETextModel *model) -{ - ETextModelURI *model_uri = E_TEXT_MODEL_URI (model); - - objectify_idle_flush (model_uri); - - return g_list_length (model_uri->uris); -} - -static const gchar * -e_text_model_uri_get_nth_object (ETextModel *model, gint i, gint *len) -{ - ETextModelURI *model_uri = E_TEXT_MODEL_URI (model); - ObjInfo *info; - const gchar *txt; - - objectify_idle_flush (model_uri); - - txt = e_text_model_get_text (model); - - info = (ObjInfo *) g_list_nth_data (model_uri->uris, i); - g_return_val_if_fail (info != NULL, NULL); - - - if (len) - *len = info->len; - return txt + info->offset; -} - -static void -e_text_model_uri_activate_nth_object (ETextModel *model, gint i) -{ - gchar *obj_str; - - objectify_idle_flush (E_TEXT_MODEL_URI (model)); - - obj_str = e_text_model_strdup_nth_object (model, i); - gnome_url_show (obj_str); - g_free (obj_str); -} - -ETextModel * -e_text_model_uri_new (void) -{ - return E_TEXT_MODEL (gtk_type_new (e_text_model_uri_get_type ())); -} - - -/* $Id$ */ diff --git a/widgets/text/e-text-model-uri.h b/widgets/text/e-text-model-uri.h deleted file mode 100644 index d070e34f53..0000000000 --- a/widgets/text/e-text-model-uri.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* ETextModelURI - A Text Model w/ clickable URIs - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Jon Trowbridge <trow@gnu.org> - * - */ - -#ifndef E_TEXT_MODEL_URI_H -#define E_TEXT_MODEL_URI_H - -#include <gnome.h> -#include <gal/e-text/e-text-model.h> - -BEGIN_GNOME_DECLS - -#define E_TYPE_TEXT_MODEL_URI (e_text_model_get_type ()) -#define E_TEXT_MODEL_URI(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT_MODEL_URI, ETextModelURI)) -#define E_TEXT_MODEL_URI_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL_URI, ETextModelURIClass)) -#define E_IS_TEXT_MODEL_URI(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT_MODEL_URI)) -#define E_IS_TEXT_MODEL_URI_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL_URI)) - -typedef struct _ETextModelURI ETextModelURI; -typedef struct _ETextModelURIClass ETextModelURIClass; - -struct _ETextModelURI { - ETextModel item; - GList *uris; - - guint objectify_idle; -}; - -struct _ETextModelURIClass { - ETextModelClass parent_class; -}; - -GtkType e_text_model_uri_get_type (void); -ETextModel *e_text_model_uri_new (void); - -END_GNOME_DECLS - -#endif diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c deleted file mode 100644 index 29c6ffb6b1..0000000000 --- a/widgets/text/e-text-model.c +++ /dev/null @@ -1,590 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ETextModel - Text item model for evolution. - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Chris Lahey <clahey@umich.edu> - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena <federico@nuclecu.unam.mx> */ - -#undef PARANOID_DEBUGGING - -#include <config.h> -#include <ctype.h> -#include "e-text-model-repos.h" -#include "e-text-model.h" - -#define CLASS(obj) (E_TEXT_MODEL_CLASS (GTK_OBJECT (obj)->klass)) - -enum { - E_TEXT_MODEL_CHANGED, - E_TEXT_MODEL_REPOSITION, - E_TEXT_MODEL_OBJECT_ACTIVATED, - E_TEXT_MODEL_LAST_SIGNAL -}; - -static guint e_text_model_signals[E_TEXT_MODEL_LAST_SIGNAL] = { 0 }; - -struct _ETextModelPrivate { - gchar *text; - gint len; -}; - -static void e_text_model_class_init (ETextModelClass *class); -static void e_text_model_init (ETextModel *model); -static void e_text_model_destroy (GtkObject *object); - -static gint e_text_model_real_validate_position (ETextModel *, gint pos); -static const gchar *e_text_model_real_get_text (ETextModel *model); -static gint e_text_model_real_get_text_length (ETextModel *model); -static void e_text_model_real_set_text (ETextModel *model, const gchar *text); -static void e_text_model_real_insert (ETextModel *model, gint postion, const gchar *text); -static void e_text_model_real_insert_length (ETextModel *model, gint postion, const gchar *text, gint length); -static void e_text_model_real_delete (ETextModel *model, gint postion, gint length); - -static GtkObject *parent_class; - - - -/** - * e_text_model_get_type: - * @void: - * - * Registers the &ETextModel class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ETextModel class. - **/ -GtkType -e_text_model_get_type (void) -{ - static GtkType model_type = 0; - - if (!model_type) { - GtkTypeInfo model_info = { - "ETextModel", - sizeof (ETextModel), - sizeof (ETextModelClass), - (GtkClassInitFunc) e_text_model_class_init, - (GtkObjectInitFunc) e_text_model_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - model_type = gtk_type_unique (gtk_object_get_type (), &model_info); - } - - return model_type; -} - -/* Class initialization function for the text item */ -static void -e_text_model_class_init (ETextModelClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) klass; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - e_text_model_signals[E_TEXT_MODEL_CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextModelClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_text_model_signals[E_TEXT_MODEL_REPOSITION] = - gtk_signal_new ("reposition", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextModelClass, reposition), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, GTK_TYPE_POINTER); - - e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED] = - gtk_signal_new ("object_activated", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextModelClass, object_activated), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, - GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, e_text_model_signals, E_TEXT_MODEL_LAST_SIGNAL); - - /* No default signal handlers. */ - klass->changed = NULL; - klass->reposition = NULL; - klass->object_activated = NULL; - - klass->validate_pos = e_text_model_real_validate_position; - - klass->get_text = e_text_model_real_get_text; - klass->get_text_len = e_text_model_real_get_text_length; - klass->set_text = e_text_model_real_set_text; - klass->insert = e_text_model_real_insert; - klass->insert_length = e_text_model_real_insert_length; - klass->delete = e_text_model_real_delete; - - /* We explicitly don't define default handlers for these. */ - klass->objectify = NULL; - klass->obj_count = NULL; - klass->get_nth_obj = NULL; - - object_class->destroy = e_text_model_destroy; -} - -/* Object initialization function for the text item */ -static void -e_text_model_init (ETextModel *model) -{ - model->priv = g_new0 (struct _ETextModelPrivate, 1); - model->priv->text = g_strdup (""); - model->priv->len = 0; -} - -/* Destroy handler for the text item */ -static void -e_text_model_destroy (GtkObject *object) -{ - ETextModel *model; - - g_return_if_fail (object != NULL); - g_return_if_fail (E_IS_TEXT_MODEL (object)); - - model = E_TEXT_MODEL (object); - - g_free (model->priv->text); - - g_free (model->priv); - model->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static gint -e_text_model_real_validate_position (ETextModel *model, gint pos) -{ - gint len; - - if (pos < 0) - pos = 0; - else if (pos > ( len = e_text_model_get_text_length (model) )) - pos = len; - - return pos; -} - -static const gchar * -e_text_model_real_get_text (ETextModel *model) -{ - if (model->priv->text) - return model->priv->text; - else - return ""; -} - -static gint -e_text_model_real_get_text_length (ETextModel *model) -{ - if (model->priv->len < 0) - model->priv->len = strlen (e_text_model_get_text (model)); - - return model->priv->len; -} - -static void -e_text_model_real_set_text (ETextModel *model, const gchar *text) -{ - EReposAbsolute repos; - gboolean changed = FALSE; - - if (text == NULL) { - - changed = (model->priv->text != NULL); - - g_free (model->priv->text); - model->priv->text = NULL; - model->priv->len = -1; - - } else if (model->priv->text == NULL || strcmp (model->priv->text, text)) { - - g_free (model->priv->text); - model->priv->text = g_strdup (text); - model->priv->len = -1; - - changed = TRUE; - } - - if (changed) { - e_text_model_changed (model); - repos.model = model; - repos.pos = -1; - e_text_model_reposition (model, e_repos_absolute, &repos); - } -} - -static void -e_text_model_real_insert (ETextModel *model, gint position, const gchar *text) -{ - EReposInsertShift repos; - gchar *new_text; - gint ins_len; - - new_text = g_strdup_printf ("%.*s%s%s", position, model->priv->text, text, model->priv->text + position); - ins_len = strlen (text); - - if (model->priv->text) - g_free (model->priv->text); - - model->priv->text = new_text; - - if (model->priv->len >= 0) - model->priv->len += ins_len; - - e_text_model_changed (model); - - repos.model = model; - repos.pos = position; - repos.len = ins_len; - - e_text_model_reposition (model, e_repos_insert_shift, &repos); -} - -static void -e_text_model_real_insert_length (ETextModel *model, gint position, const gchar *text, gint length) -{ - EReposInsertShift repos; - gchar *new_text = g_strdup_printf ("%.*s%.*s%s", position, model->priv->text, length, text, model->priv->text + position); - - if (model->priv->text) - g_free (model->priv->text); - model->priv->text = new_text; - - if (model->priv->len >= 0) - model->priv->len += length; - - e_text_model_changed (model); - - repos.model = model; - repos.pos = position; - repos.len = length; - - e_text_model_reposition (model, e_repos_insert_shift, &repos); -} - -static void -e_text_model_real_delete (ETextModel *model, gint position, gint length) -{ - EReposDeleteShift repos; - - memmove (model->priv->text + position, model->priv->text + position + length, strlen (model->priv->text + position + length) + 1); - - if (model->priv->len >= 0) - model->priv->len -= length; - - e_text_model_changed (model); - - repos.model = model; - repos.pos = position; - repos.len = length; - - e_text_model_reposition (model, e_repos_delete_shift, &repos); -} - -void -e_text_model_changed (ETextModel *model) -{ - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_TEXT_MODEL (model)); - - /* - Objectify before emitting any signal. - While this method could, in theory, do pretty much anything, it is meant - for scanning objects and converting substrings into embedded objects. - */ - if (CLASS (model)->objectify) - CLASS (model)->objectify (model); - - gtk_signal_emit (GTK_OBJECT (model), - e_text_model_signals[E_TEXT_MODEL_CHANGED]); -} - -void -e_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data) -{ - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_TEXT_MODEL (model)); - g_return_if_fail (fn != NULL); - - gtk_signal_emit (GTK_OBJECT (model), - e_text_model_signals[E_TEXT_MODEL_REPOSITION], - fn, repos_data); -} - -gint -e_text_model_validate_position (ETextModel *model, gint pos) -{ - g_return_val_if_fail (model != NULL, 0); - g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0); - - if (CLASS (model)->validate_pos) - pos = CLASS (model)->validate_pos (model, pos); - - return pos; -} - -const gchar * -e_text_model_get_text (ETextModel *model) -{ - g_return_val_if_fail (model != NULL, NULL); - g_return_val_if_fail (E_IS_TEXT_MODEL (model), NULL); - - if (CLASS (model)->get_text) - return CLASS (model)->get_text (model); - - return ""; -} - -gint -e_text_model_get_text_length (ETextModel *model) -{ - g_return_val_if_fail (model != NULL, 0); - g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0); - - if (CLASS (model)->get_text_len (model)) { - - gint len = CLASS (model)->get_text_len (model); - -#ifdef PARANOID_DEBUGGING - const gchar *str = e_text_model_get_text (model); - gint len2 = str ? strlen (str) : 0; - if (len != len) - g_error ("\"%s\" length reported as %d, not %d.", str, len, len2); -#endif - - return len; - - } else { - /* Calculate length the old-fashioned way... */ - const gchar *str = e_text_model_get_text (model); - return str ? strlen (str) : 0; - } -} - -void -e_text_model_set_text (ETextModel *model, const gchar *text) -{ - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_TEXT_MODEL (model)); - - if (CLASS (model)->set_text) - CLASS (model)->set_text (model, text); -} - -void -e_text_model_insert (ETextModel *model, gint position, const gchar *text) -{ - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_TEXT_MODEL (model)); - - if (text == NULL) - return; - - if (CLASS (model)->insert) - CLASS (model)->insert (model, position, text); -} - -void -e_text_model_insert_length (ETextModel *model, gint position, const gchar *text, gint length) -{ - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_TEXT_MODEL (model)); - g_return_if_fail (length >= 0); - - - if (text == NULL || length == 0) - return; - - if (CLASS (model)->insert_length) - CLASS (model)->insert_length (model, position, text, length); -} - -void -e_text_model_prepend (ETextModel *model, const gchar *text) -{ - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_TEXT_MODEL (model)); - - if (text == NULL) - return; - - e_text_model_insert (model, 0, text); -} - -void -e_text_model_append (ETextModel *model, const gchar *text) -{ - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_TEXT_MODEL (model)); - - if (text == NULL) - return; - - e_text_model_insert (model, e_text_model_get_text_length (model), text); -} - -void -e_text_model_delete (ETextModel *model, gint position, gint length) -{ - gint txt_len; - - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_TEXT_MODEL (model)); - g_return_if_fail (length >= 0); - - txt_len = e_text_model_get_text_length (model); - if (position + length > txt_len) - length = txt_len - position; - - if (length <= 0) - return; - - if (CLASS (model)->delete) - CLASS (model)->delete (model, position, length); -} - -gint -e_text_model_object_count (ETextModel *model) -{ - g_return_val_if_fail (model != NULL, 0); - g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0); - - if (CLASS (model)->obj_count) - return CLASS (model)->obj_count (model); - - return 0; -} - -const gchar * -e_text_model_get_nth_object (ETextModel *model, gint n, gint *len) -{ - g_return_val_if_fail (model != NULL, NULL); - g_return_val_if_fail (E_IS_TEXT_MODEL (model), NULL); - - if (n < 0 || n >= e_text_model_object_count (model)) - return NULL; - - if (CLASS (model)->get_nth_obj) - return CLASS (model)->get_nth_obj (model, n, len); - - return NULL; -} - -gchar * -e_text_model_strdup_nth_object (ETextModel *model, gint n) -{ - const gchar *obj; - gint len = 0; - - g_return_val_if_fail (model != NULL, NULL); - g_return_val_if_fail (E_IS_TEXT_MODEL (model), NULL); - - obj = e_text_model_get_nth_object (model, n, &len); - - return obj ? g_strndup (obj, n) : NULL; -} - -void -e_text_model_get_nth_object_bounds (ETextModel *model, gint n, gint *start, gint *end) -{ - const gchar *txt = NULL, *obj = NULL; - gint len = 0; - - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_TEXT_MODEL (model)); - - txt = e_text_model_get_text (model); - obj = e_text_model_get_nth_object (model, n, &len); - - g_return_if_fail (obj != NULL); - - if (start) - *start = obj - txt; - if (end) - *end = obj - txt + len; -} - -gint -e_text_model_get_object_at_offset (ETextModel *model, gint offset) -{ - g_return_val_if_fail (model != NULL, -1); - g_return_val_if_fail (E_IS_TEXT_MODEL (model), -1); - - if (offset < 0 || offset >= e_text_model_get_text_length (model)) - return -1; - - /* If an optimized version has been provided, we use it. */ - if (CLASS (model)->obj_at_offset) { - - return CLASS (model)->obj_at_offset (model, offset); - - } else { - /* If not, we fake it.*/ - - gint i, N, pos0, pos1; - - N = e_text_model_object_count (model); - - for (i = 0; i < N; ++i) { - e_text_model_get_nth_object_bounds (model, i, &pos0, &pos1); - if (pos0 <= offset && offset < pos1) - return i; - } - - } - - return -1; -} - -gint -e_text_model_get_object_at_pointer (ETextModel *model, const gchar *s) -{ - g_return_val_if_fail (model != NULL, -1); - g_return_val_if_fail (E_IS_TEXT_MODEL (model), -1); - g_return_val_if_fail (s != NULL, -1); - - return e_text_model_get_object_at_offset (model, s - e_text_model_get_text (model)); -} - -void -e_text_model_activate_nth_object (ETextModel *model, gint n) -{ - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_TEXT_MODEL (model)); - g_return_if_fail (n >= 0); - g_return_if_fail (n < e_text_model_object_count (model)); - - gtk_signal_emit (GTK_OBJECT (model), e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED], n); -} - -ETextModel * -e_text_model_new (void) -{ - ETextModel *model = gtk_type_new (e_text_model_get_type ()); - return model; -} diff --git a/widgets/text/e-text-model.h b/widgets/text/e-text-model.h deleted file mode 100644 index afd9b79960..0000000000 --- a/widgets/text/e-text-model.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ETextModel - Text item for evolution. - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Chris Lahey <clahey@umich.edu> - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena <federico@nuclecu.unam.mx> */ - - -#ifndef E_TEXT_MODEL_H -#define E_TEXT_MODEL_H - -#include <gnome.h> - - -BEGIN_GNOME_DECLS - -#define E_TYPE_TEXT_MODEL (e_text_model_get_type ()) -#define E_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT_MODEL, ETextModel)) -#define E_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL, ETextModelClass)) -#define E_IS_TEXT_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT_MODEL)) -#define E_IS_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL)) - -typedef struct _ETextModel ETextModel; -typedef struct _ETextModelClass ETextModelClass; - -struct _ETextModelPrivate; - -typedef gint (*ETextModelReposFn) (gint, gpointer); - -struct _ETextModel { - GtkObject item; - - struct _ETextModelPrivate *priv; -}; - -struct _ETextModelClass { - GtkObjectClass parent_class; - - /* Signal */ - void (* changed) (ETextModel *model); - void (* reposition) (ETextModel *model, ETextModelReposFn fn, gpointer repos_fn_data); - void (* object_activated) (ETextModel *model, gint obj_num); - - /* Virtual methods */ - - gint (* validate_pos) (ETextModel *model, gint pos); - - const char *(* get_text) (ETextModel *model); - gint (* get_text_len) (ETextModel *model); - void (* set_text) (ETextModel *model, const gchar *text); - void (* insert) (ETextModel *model, gint position, const gchar *text); - void (* insert_length) (ETextModel *model, gint position, const gchar *text, gint length); - void (* delete) (ETextModel *model, gint position, gint length); - - void (* objectify) (ETextModel *model); - gint (* obj_count) (ETextModel *model); - const gchar *(* get_nth_obj) (ETextModel *model, gint n, gint *len); - gint (* obj_at_offset) (ETextModel *model, gint offset); -}; - -GtkType e_text_model_get_type (void); - -ETextModel *e_text_model_new (void); - -void e_text_model_changed (ETextModel *model); - -void e_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data); -gint e_text_model_validate_position (ETextModel *model, gint pos); - - -/* Functions for manipulating the underlying text. */ - -const gchar *e_text_model_get_text (ETextModel *model); -gint e_text_model_get_text_length (ETextModel *model); -void e_text_model_set_text (ETextModel *model, const gchar *text); -void e_text_model_insert (ETextModel *model, gint position, const gchar *text); -void e_text_model_insert_length (ETextModel *model, gint position, const gchar *text, gint length); -void e_text_model_prepend (ETextModel *model, const gchar *text); -void e_text_model_append (ETextModel *model, const gchar *text); -void e_text_model_delete (ETextModel *model, gint position, gint length); - - -/* Functions for accessing embedded objects. */ - -gint e_text_model_object_count (ETextModel *model); -const gchar *e_text_model_get_nth_object (ETextModel *model, gint n, gint *len); -gchar *e_text_model_strdup_nth_object (ETextModel *model, gint n); -void e_text_model_get_nth_object_bounds (ETextModel *model, gint n, gint *start_pos, gint *end_pos); -gint e_text_model_get_object_at_offset (ETextModel *model, gint offset); -gint e_text_model_get_object_at_pointer (ETextModel *model, const gchar *c); -void e_text_model_activate_nth_object (ETextModel *model, gint n); - - - - - - - -END_GNOME_DECLS - -#endif diff --git a/widgets/text/e-text-test.c b/widgets/text/e-text-test.c deleted file mode 100644 index e3931da02f..0000000000 --- a/widgets/text/e-text-test.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - ETextTest: E-Text item test program - Copyright (C)2000: Iain Holmes <ih@csd.abdn.ac.uk> - - This code is licensed under the GPL -*/ - -#include "e-text.h" -#include <gnome.h> -#include "gal/widgets/e-canvas.h" -#include "gal/widgets/e-unicode.h" - -GnomeCanvasItem *rect; - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, GnomeCanvasItem *item) -{ - double height; - gnome_canvas_item_set( item, - "width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(item), - "height", &height, - NULL); - height = MAX(height, allocation->height); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, height ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) height, - NULL ); -} - -static void -reflow (GtkWidget *canvas, GnomeCanvasItem *item) -{ - double height; - gtk_object_get(GTK_OBJECT(item), - "height", &height, - NULL); - height = MAX(height, canvas->allocation.height); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, canvas->allocation.width, height ); - gnome_canvas_item_set( rect, - "x2", (double) canvas->allocation.width, - "y2", (double) height, - NULL ); -} - -static void -quit_cb (GtkWidget *widget, - gpointer data) -{ - gtk_main_quit (); -} - -static void -change_text_cb (GtkEntry *entry, - EText *text) -{ - gchar *str; - - str = e_utf8_gtk_entry_get_text (entry); - gnome_canvas_item_set (GNOME_CANVAS_ITEM (text), - "text", str, - NULL); -} - -static void -change_font_cb (GtkEntry *entry, - EText *text) -{ - gchar *font; - - font = gtk_entry_get_text (entry); - gnome_canvas_item_set (GNOME_CANVAS_ITEM (text), - "font", font, - NULL); -} - -int -main (int argc, - char **argv) -{ - GtkWidget *window, *canvas, *scroller, *vbox, *text, *font; - GtkWidget *frame; - GnomeCanvasItem *item; - - gnome_init ("ETextTest", "0.0.1", argc, argv); - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window), "EText Test"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (quit_cb), NULL); - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - canvas = e_canvas_new (); - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); - scroller = gtk_scrolled_window_new (NULL, NULL); - vbox = gtk_vbox_new (FALSE, 2); - - gtk_container_add (GTK_CONTAINER (window), vbox); - gtk_box_pack_start (GTK_BOX (vbox), scroller, TRUE, TRUE, 2); - gtk_container_add (GTK_CONTAINER (scroller), canvas); - - frame = gtk_frame_new ("Text"); - text = gtk_entry_new (); - gtk_entry_set_text(GTK_ENTRY(text), "Hello World! This is a really long string to test out the ellipsis stuff."); - gtk_container_add (GTK_CONTAINER (frame), text); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); - - frame = gtk_frame_new ("Font"); - font = gtk_entry_new (); - gtk_entry_set_text(GTK_ENTRY(font), "fixed"); - gtk_container_add (GTK_CONTAINER (frame), font); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); - - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - - item = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), - e_text_get_type (), - "text", "Hello World! This is a really long string to test out the ellipsis stuff.", - "font", "fixed", - "fill_color", "black", - "anchor", GTK_ANCHOR_NW, - "clip", TRUE, - "use_ellipsis", TRUE, - "editable", TRUE, - "line_wrap", TRUE, - "max_lines", 2, - "width", 150.0, - NULL); - - gtk_signal_connect (GTK_OBJECT (text), "activate", - GTK_SIGNAL_FUNC (change_text_cb), item); - gtk_signal_connect (GTK_OBJECT (font), "activate", - GTK_SIGNAL_FUNC (change_font_cb), item); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - item ); - gtk_signal_connect( GTK_OBJECT( canvas ), "reflow", - GTK_SIGNAL_FUNC( reflow ), - item ); - gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, 400.0, 400.0); - gtk_widget_show_all (window); - gtk_main (); - - return 0; -} diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c deleted file mode 100644 index e6e11750eb..0000000000 --- a/widgets/text/e-text.c +++ /dev/null @@ -1,3822 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* EText - Text item for evolution. - * Copyright (C) 2000, 2001 Ximian Inc. - * - * Author: Chris Lahey <clahey@ximian.com> - * Further hacking by Jon Trowbridge <trow@ximian.com> - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena <federico@nuclecu.unam.mx> */ - -#include <config.h> -#include <math.h> -#include <ctype.h> -#include <gdk/gdkx.h> /* for BlackPixel */ -#include <unicode.h> -#include <gtk/gtkinvisible.h> -#include "e-text.h" -#include "gal/widgets/e-canvas.h" -#include "gal/widgets/e-canvas-utils.h" -#include "gal/widgets/e-unicode.h" -#include <libart_lgpl/art_affine.h> -#include <libart_lgpl/art_rgb.h> -#include <libart_lgpl/art_rgb_bitmap_affine.h> - -#include "gal/util/e-text-event-processor-emacs-like.h" - -#define BORDER_INDENT 4 - -enum { - E_TEXT_CHANGED, - E_TEXT_ACTIVATE, - E_TEXT_KEYPRESS, - E_TEXT_POPUP, - E_TEXT_LAST_SIGNAL -}; - -static guint e_text_signals[E_TEXT_LAST_SIGNAL] = { 0 }; - - - -/* This defines a line of text */ -struct line { - const char *text; /* Line's text, it is a pointer into the text->text string */ - int length; /* Line's length IN BYTES */ - int width; /* Line's width in pixels */ - int ellipsis_length; /* Length before adding ellipsis */ -}; - -/* Object argument IDs */ -enum { - ARG_0, - ARG_MODEL, - ARG_EVENT_PROCESSOR, - ARG_TEXT, - ARG_FONT, - ARG_FONTSET, - ARG_FONT_GDK, - ARG_FONT_E, - ARG_ANCHOR, - ARG_JUSTIFICATION, - ARG_CLIP_WIDTH, - ARG_CLIP_HEIGHT, - ARG_CLIP, - ARG_FILL_CLIP_RECTANGLE, - ARG_X_OFFSET, - ARG_Y_OFFSET, - ARG_FILL_COLOR, - ARG_FILL_COLOR_GDK, - ARG_FILL_COLOR_RGBA, - ARG_FILL_STIPPLE, - ARG_TEXT_WIDTH, - ARG_TEXT_HEIGHT, - ARG_EDITABLE, - ARG_USE_ELLIPSIS, - ARG_ELLIPSIS, - ARG_LINE_WRAP, - ARG_BREAK_CHARACTERS, - ARG_MAX_LINES, - ARG_WIDTH, - ARG_HEIGHT, - ARG_DRAW_BORDERS, - ARG_ALLOW_NEWLINES, - ARG_DRAW_BACKGROUND, - ARG_CURSOR_POS -}; - - -enum { - E_SELECTION_PRIMARY, - E_SELECTION_CLIPBOARD -}; -enum { - TARGET_STRING, - TARGET_TEXT, - TARGET_COMPOUND_TEXT -}; - -static void e_text_class_init (ETextClass *class); -static void e_text_init (EText *text); -static void e_text_destroy (GtkObject *object); -static void e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static void e_text_reflow (GnomeCanvasItem *item, int flags); -static void e_text_update (GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags); -static void e_text_realize (GnomeCanvasItem *item); -static void e_text_unrealize (GnomeCanvasItem *item); -static void e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static double e_text_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item); -static void e_text_bounds (GnomeCanvasItem *item, - double *x1, double *y1, double *x2, double *y2); -static void e_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); -static gint e_text_event (GnomeCanvasItem *item, GdkEvent *event); - -static void e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data); - -static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time); -static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length); - -static void e_text_text_model_changed(ETextModel *model, EText *text); -static void e_text_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data, gpointer data); - -static void _get_tep(EText *text); - -static GtkWidget *e_text_get_invisible(EText *text); -static void _selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - EText *text); -static void _selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - EText *text); -static void _selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - EText *text); - -#if 0 -static ETextSuckFont *e_suck_font (GdkFont *font); -static void e_suck_font_free (ETextSuckFont *suckfont); -#endif - -static void e_text_free_lines(EText *text); - -static gint text_width_with_objects (ETextModel *model, - EFont *font, EFontStyle style, - const gchar *text, gint bytelen); - -static void calc_height (EText *text); -static void calc_line_widths (EText *text); -static void split_into_lines (EText *text); - -static GnomeCanvasItemClass *parent_class; -static GdkAtom clipboard_atom = GDK_NONE; - - - -/** - * e_text_get_type: - * @void: - * - * Registers the &EText class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &EText class. - **/ -GtkType -e_text_get_type (void) -{ - static GtkType text_type = 0; - - if (!text_type) { - GtkTypeInfo text_info = { - "EText", - sizeof (EText), - sizeof (ETextClass), - (GtkClassInitFunc) e_text_class_init, - (GtkObjectInitFunc) e_text_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - text_type = gtk_type_unique (gnome_canvas_item_get_type (), &text_info); - } - - return text_type; -} - -/* Class initialization function for the text item */ -static void -e_text_class_init (ETextClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass *) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_item_get_type ()); - - e_text_signals[E_TEXT_CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_text_signals[E_TEXT_ACTIVATE] = - gtk_signal_new ("activate", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextClass, activate), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_text_signals[E_TEXT_KEYPRESS] = - gtk_signal_new ("keypress", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextClass, keypress), - gtk_marshal_NONE__INT_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_UINT, GTK_TYPE_UINT); - - e_text_signals[E_TEXT_POPUP] = - gtk_signal_new ("popup", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextClass, popup), - gtk_marshal_NONE__POINTER_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, e_text_signals, E_TEXT_LAST_SIGNAL); - - - gtk_object_add_arg_type ("EText::model", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_MODEL); - gtk_object_add_arg_type ("EText::event_processor", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_EVENT_PROCESSOR); - gtk_object_add_arg_type ("EText::text", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT); - gtk_object_add_arg_type ("EText::font", - GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONT); - gtk_object_add_arg_type ("EText::fontset", - GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONTSET); - gtk_object_add_arg_type ("EText::font_gdk", - GTK_TYPE_GDK_FONT, GTK_ARG_WRITABLE, ARG_FONT_GDK); - gtk_object_add_arg_type ("EText::font_e", - GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_FONT_E); - gtk_object_add_arg_type ("EText::anchor", - GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_ANCHOR); - gtk_object_add_arg_type ("EText::justification", - GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFICATION); - gtk_object_add_arg_type ("EText::clip_width", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_CLIP_WIDTH); - gtk_object_add_arg_type ("EText::clip_height", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_CLIP_HEIGHT); - gtk_object_add_arg_type ("EText::clip", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CLIP); - gtk_object_add_arg_type ("EText::fill_clip_rectangle", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_FILL_CLIP_RECTANGLE); - gtk_object_add_arg_type ("EText::x_offset", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X_OFFSET); - gtk_object_add_arg_type ("EText::y_offset", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_Y_OFFSET); - gtk_object_add_arg_type ("EText::fill_color", - GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FILL_COLOR); - gtk_object_add_arg_type ("EText::fill_color_gdk", - GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_FILL_COLOR_GDK); - gtk_object_add_arg_type ("EText::fill_color_rgba", - GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_FILL_COLOR_RGBA); - gtk_object_add_arg_type ("EText::fill_stipple", - GTK_TYPE_GDK_WINDOW, GTK_ARG_READWRITE, ARG_FILL_STIPPLE); - gtk_object_add_arg_type ("EText::text_width", - GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_TEXT_WIDTH); - gtk_object_add_arg_type ("EText::text_height", - GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_TEXT_HEIGHT); - gtk_object_add_arg_type ("EText::editable", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE); - gtk_object_add_arg_type ("EText::use_ellipsis", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_USE_ELLIPSIS); - gtk_object_add_arg_type ("EText::ellipsis", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ELLIPSIS); - gtk_object_add_arg_type ("EText::line_wrap", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_LINE_WRAP); - gtk_object_add_arg_type ("EText::break_characters", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_BREAK_CHARACTERS); - gtk_object_add_arg_type ("EText::max_lines", - GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_MAX_LINES); - gtk_object_add_arg_type ("EText::width", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("EText::height", - GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("EText::draw_borders", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BORDERS); - gtk_object_add_arg_type ("EText::allow_newlines", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_NEWLINES); - gtk_object_add_arg_type ("EText::draw_background", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BACKGROUND); - gtk_object_add_arg_type ("EText::cursor_pos", - GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_CURSOR_POS); - - if (!clipboard_atom) - clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); - - - - klass->changed = NULL; - klass->activate = NULL; - - object_class->destroy = e_text_destroy; - object_class->set_arg = e_text_set_arg; - object_class->get_arg = e_text_get_arg; - - item_class->update = e_text_update; - item_class->realize = e_text_realize; - item_class->unrealize = e_text_unrealize; - item_class->draw = e_text_draw; - item_class->point = e_text_point; - item_class->bounds = e_text_bounds; - item_class->render = e_text_render; - item_class->event = e_text_event; -} - -/* Object initialization function for the text item */ -static void -e_text_init (EText *text) -{ - text->model = e_text_model_new (); - text->text = e_text_model_get_text (text->model); - - gtk_object_ref (GTK_OBJECT (text->model)); - gtk_object_sink (GTK_OBJECT (text->model)); - - text->model_changed_signal_id = - gtk_signal_connect (GTK_OBJECT (text->model), - "changed", - GTK_SIGNAL_FUNC (e_text_text_model_changed), - text); - text->model_repos_signal_id = - gtk_signal_connect (GTK_OBJECT (text->model), - "reposition", - GTK_SIGNAL_FUNC (e_text_text_model_reposition), - text); - - text->anchor = GTK_ANCHOR_CENTER; - text->justification = GTK_JUSTIFY_LEFT; - text->clip_width = -1.0; - text->clip_height = -1.0; - text->xofs = 0.0; - text->yofs = 0.0; - - text->ellipsis = NULL; - text->use_ellipsis = FALSE; - text->ellipsis_width = 0; - - text->editable = FALSE; - text->editing = FALSE; - text->xofs_edit = 0; - text->yofs_edit = 0; - - text->selection_start = 0; - text->selection_end = 0; - text->select_by_word = FALSE; - - text->timeout_id = 0; - text->timer = NULL; - - text->lastx = 0; - text->lasty = 0; - text->last_state = 0; - - text->scroll_start = 0; - text->show_cursor = TRUE; - text->button_down = FALSE; - - text->tep = NULL; - text->tep_command_id = 0; - - text->has_selection = FALSE; - - text->invisible = NULL; - text->primary_selection = NULL; - text->primary_length = 0; - text->clipboard_selection = NULL; - text->clipboard_length = 0; - - text->pointer_in = FALSE; - text->default_cursor_shown = TRUE; - - text->line_wrap = FALSE; - text->break_characters = NULL; - text->max_lines = -1; - - text->tooltip_timeout = 0; - text->tooltip_count = 0; - - text->dbl_timeout = 0; - text->tpl_timeout = 0; - - text->draw_background = FALSE; - - e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(text), e_text_reflow); -} - -/* Destroy handler for the text item */ -static void -e_text_destroy (GtkObject *object) -{ - EText *text; - - g_return_if_fail (object != NULL); - g_return_if_fail (E_IS_TEXT (object)); - - text = E_TEXT (object); - - if (text->model_changed_signal_id) - gtk_signal_disconnect (GTK_OBJECT (text->model), - text->model_changed_signal_id); - - if (text->model_repos_signal_id) - gtk_signal_disconnect (GTK_OBJECT (text->model), - text->model_repos_signal_id); - - if (text->model) - gtk_object_unref(GTK_OBJECT(text->model)); - - if (text->tep_command_id) - gtk_signal_disconnect(GTK_OBJECT(text->tep), - text->tep_command_id); - - if (text->tep) - gtk_object_unref (GTK_OBJECT(text->tep)); - - if (text->invisible) - gtk_object_unref (GTK_OBJECT(text->invisible)); - - if (text->lines) - g_free (text->lines); - - if (text->font) - e_font_unref (text->font); - -#if 0 - if (text->suckfont) - e_suck_font_free (text->suckfont); -#endif - - if (text->stipple) - gdk_bitmap_unref (text->stipple); - - if (text->timeout_id) { - g_source_remove(text->timeout_id); - text->timeout_id = 0; - } - - if (text->timer) { - g_timer_stop(text->timer); - g_timer_destroy(text->timer); - text->timer = NULL; - } - - if ( text->tooltip_timeout ) { - gtk_timeout_remove (text->tooltip_timeout); - text->tooltip_timeout = 0; - } - - if ( text->dbl_timeout ) { - gtk_timeout_remove (text->dbl_timeout); - text->dbl_timeout = 0; - } - - if ( text->tpl_timeout ) { - gtk_timeout_remove (text->tpl_timeout); - text->tpl_timeout = 0; - } - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -static void -e_text_text_model_changed (ETextModel *model, EText *text) -{ - text->text = e_text_model_get_text(model); - e_text_free_lines(text); - gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_CHANGED]); - text->needs_split_into_lines = 1; - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(text)); -} - -static void -e_text_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data, gpointer user_data) -{ - EText *text = E_TEXT (user_data); - gint model_len = e_text_model_get_text_length (model); - - text->selection_start = fn (text->selection_start, repos_data); - text->selection_end = fn (text->selection_end, repos_data); - - /* Our repos function should make sure we don't overrun the buffer, but it never - hurts to be paranoid. */ - text->selection_start = CLAMP (text->selection_start, 0, model_len); - text->selection_end = CLAMP (text->selection_end, 0, model_len); - - if (text->selection_start > text->selection_end) { - gint tmp = text->selection_start; - text->selection_start = text->selection_end; - text->selection_end = tmp; - } -} - -static void -get_bounds_item_relative (EText *text, double *px1, double *py1, double *px2, double *py2) -{ - GnomeCanvasItem *item; - double x, y; - double clip_x, clip_y; - int old_height; - - item = GNOME_CANVAS_ITEM (text); - - x = 0; - y = 0; - - clip_x = x; - clip_y = y; - - /* Calculate text dimensions */ - - old_height = text->height; - - if (text->text && text->font) - text->height = (e_font_height (text->font)) * text->num_lines; - else - text->height = 0; - - if (old_height != text->height) - e_canvas_item_request_parent_reflow(item); - - /* Anchor text */ - - switch (text->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_W: - case GTK_ANCHOR_SW: - break; - - case GTK_ANCHOR_N: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_S: - x -= text->max_width / 2; - if ( text->clip_width >= 0) - clip_x -= text->clip_width / 2; - else - clip_x -= text->width / 2; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - x -= text->max_width; - if (text->clip_width >= 0) - clip_x -= text->clip_width; - else - clip_x -= text->width; - break; - } - - switch (text->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_N: - case GTK_ANCHOR_NE: - break; - - case GTK_ANCHOR_W: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_E: - y -= text->height / 2; - if ( text->clip_height >= 0 ) - clip_y -= text->clip_height / 2; - else - clip_y -= text->height / 2; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - y -= text->height; - if ( text->clip_height >= 0 ) - clip_y -= text->clip_height; - else - clip_y -= text->height; - break; - } - - /* Bounds */ - - if (text->clip) { - /* maybe do bbox intersection here? */ - *px1 = clip_x; - *py1 = clip_y; - if (text->clip_width >= 0) - *px2 = clip_x + text->clip_width; - else - *px2 = clip_x + text->width; - - if ( text->clip_height >= 0 ) - *py2 = clip_y + text->clip_height; - else - *py2 = clip_y + text->height; - } else { - *px1 = x; - *py1 = y; - *px2 = x + text->max_width; - *py2 = y + text->height; - } -} - -static void -get_bounds (EText *text, double *px1, double *py1, double *px2, double *py2) -{ - GnomeCanvasItem *item; - double wx, wy, clip_width; - - item = GNOME_CANVAS_ITEM (text); - - /* Get canvas pixel coordinates for text position */ - - wx = 0; - wy = 0; - gnome_canvas_item_i2w (item, &wx, &wy); - gnome_canvas_w2c (item->canvas, wx + text->xofs, wy + text->yofs, &text->cx, &text->cy); - - /* Calculate the width and heights */ - calc_height (text); - calc_line_widths (text); - - if (text->clip_width < 0) - clip_width = text->max_width; - else - clip_width = text->clip_width; - - /* Get canvas pixel coordinates for clip rectangle position */ - gnome_canvas_w2c (item->canvas, wx, wy, &text->clip_cx, &text->clip_cy); - text->clip_cwidth = clip_width * item->canvas->pixels_per_unit; - if ( text->clip_height >= 0 ) - text->clip_cheight = text->clip_height * item->canvas->pixels_per_unit; - else - text->clip_cheight = text->height * item->canvas->pixels_per_unit; - - /* Anchor text */ - - switch (text->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_W: - case GTK_ANCHOR_SW: - break; - - case GTK_ANCHOR_N: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_S: - text->cx -= text->max_width / 2; - text->clip_cx -= text->clip_cwidth / 2; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - text->cx -= text->max_width; - text->clip_cx -= text->clip_cwidth; - break; - } - - switch (text->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_N: - case GTK_ANCHOR_NE: - break; - - case GTK_ANCHOR_W: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_E: - text->cy -= text->height / 2; - text->clip_cy -= text->clip_cheight / 2; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - text->cy -= text->height; - text->clip_cy -= text->clip_cheight; - break; - } - - /* Bounds */ - - if (text->clip) { - *px1 = text->clip_cx; - *py1 = text->clip_cy; - *px2 = text->clip_cx + text->clip_cwidth; - *py2 = text->clip_cy + text->clip_cheight; - } else { - *px1 = text->cx; - *py1 = text->cy; - *px2 = text->cx + text->max_width; - *py2 = text->cy + text->height; - } -} - -static void -calc_height (EText *text) -{ - GnomeCanvasItem *item; - int old_height; - - item = GNOME_CANVAS_ITEM (text); - - /* Calculate text dimensions */ - - old_height = text->height; - - /* Make sure the text is split into lines first */ - if (text->text && text->num_lines == 0) - split_into_lines (text); - - if (text->text && text->font) - text->height = e_font_height (text->font) * text->num_lines; - else - text->height = 0; - - if (old_height != text->height) - e_canvas_item_request_parent_reflow(item); -} - -static void -calc_ellipsis (EText *text) -{ - if (text->font) - text->ellipsis_width = - e_font_utf8_text_width (text->font, E_FONT_PLAIN, - text->ellipsis ? text->ellipsis : "...", - text->ellipsis ? strlen (text->ellipsis) : 3); -} - -/* Calculates the line widths (in pixels) of the text's splitted lines */ -static void -calc_line_widths (EText *text) -{ - struct line *lines; - int i; - gdouble clip_width; - const gchar *p; - - /* Make sure line has been split */ - if (text->text && text->num_lines == 0) - split_into_lines (text); - - lines = text->lines; - text->max_width = 0; - - clip_width = text->clip_width; - if (clip_width >= 0 && text->draw_borders) { - clip_width -= 6; - if (clip_width < 0) - clip_width = 0; - } - - - if (!lines) - return; - - for (i = 0; i < text->num_lines; i++) { - if (lines->length != 0) { - if (text->font) { - lines->width = text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, lines->length); - lines->ellipsis_length = 0; - } else { - lines->width = 0; - } - - if (text->clip && - text->use_ellipsis && - ! text->editing && - lines->width > clip_width && - clip_width >= 0) { - if (text->font) { - lines->ellipsis_length = 0; - for (p = lines->text; p && *p && (p - lines->text) < lines->length; p = unicode_next_utf8 (p)) { - gint text_width = text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, p - lines->text); - if (clip_width >= text_width + text->ellipsis_width) - lines->ellipsis_length = p - lines->text; - else - break; - } - } - else - lines->ellipsis_length = 0; - lines->width = text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, lines->ellipsis_length) + - text->ellipsis_width; - } - else - lines->ellipsis_length = lines->length; - - if (lines->width > text->max_width) - text->max_width = lines->width; - } - - lines++; - } -} - -static void -e_text_free_lines(EText *text) -{ - if (text->lines) - g_free (text->lines); - - text->lines = NULL; - text->num_lines = 0; -} - -static gint -text_width_with_objects (ETextModel *model, - EFont *font, EFontStyle style, - const gchar *text, gint numbytes) -{ - return e_font_utf8_text_width (font, style, text, numbytes); -} - -static void -text_draw_with_objects (ETextModel *model, - GdkDrawable *drawable, - EFont *font, EFontStyle style, - GdkGC *gc, - gint x, gint y, - const gchar *text, gint numbytes) -{ - const gchar *c; - - while (*text && numbytes > 0) { - gint obj_num = -1; - - c = text; - - while (*c - && (obj_num = e_text_model_get_object_at_pointer (model, c)) == -1 - && numbytes > 0) { - ++c; - --numbytes; - } - - e_font_draw_utf8_text (drawable, font, style, gc, x, y, text, c-text); - x += e_font_utf8_text_width (font, style, text, c-text); - - if (obj_num != -1 && numbytes > 0) { - gint len; - gint start_x = x; - - e_text_model_get_nth_object (model, obj_num, &len); - - if (len > numbytes) - len = numbytes; - e_font_draw_utf8_text (drawable, font, style, gc, x, y, c, len); - x += e_font_utf8_text_width (font, style, c, len); - - /* We underline our objects. */ - gdk_draw_line (drawable, gc, start_x, y+1, x, y+1); - - c += len; - numbytes -= len; - } - - text = c; - } -} - -#define IS_BREAKCHAR(text,c) ((text)->break_characters && unicode_strchr ((text)->break_characters, (c))) -/* Splits the text of the text item into lines */ -static void -split_into_lines (EText *text) -{ - const char *p, *cp; - struct line *lines; - int len; - int line_num; - const char *laststart; - const char *lastend; - const char *linestart; - double clip_width; - unicode_char_t unival; - - /* Free old array of lines */ - e_text_free_lines(text); - - if (!text->text) - return; - - /* First, count the number of lines */ - - lastend = text->text; - laststart = text->text; - linestart = text->text; - - clip_width = text->clip_width; - if (clip_width >= 0 && text->draw_borders) { - clip_width -= 6; - if (clip_width < 0) - clip_width = 0; - } - - cp = text->text; - - for (p = unicode_get_utf8 (cp, &unival); (unival && p); cp = p, p = unicode_get_utf8 (p, &unival)) { - if (text->line_wrap - && (unicode_isspace (unival) || unival == '\n') - && e_text_model_get_object_at_pointer (text->model, cp) == -1) { /* don't break mid-object */ - if (laststart != lastend - && clip_width < text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - linestart, cp - linestart)) { - text->num_lines ++; - - linestart = laststart; - laststart = p; - lastend = cp; - } else if (unicode_isspace (unival)) { - laststart = p; - lastend = cp; - } - } else if (text->line_wrap - && IS_BREAKCHAR (text, unival)) { - - if (laststart != lastend - && unicode_index_to_offset (linestart, cp - linestart) != 1 - && clip_width < text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - linestart, p - linestart)) { - text->num_lines ++; - - linestart = laststart; - laststart = p; - lastend = p; - } else { - laststart = p; - lastend = p; - } - } - - if (unival == '\n') { - text->num_lines ++; - - lastend = p; - laststart = p; - linestart = p; - } - } - - if ( text->line_wrap - && p - && laststart != lastend - && clip_width < text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - linestart, cp - linestart)) { - text->num_lines ++; - } - - text->num_lines++; - - if ( (!text->editing) && text->max_lines != -1 && text->num_lines > text->max_lines ) { - text->num_lines = text->max_lines; - } - - /* Allocate array of lines and calculate split positions */ - - text->lines = lines = g_new0 (struct line, text->num_lines); - len = 0; - line_num = 1; - lastend = text->text; - laststart = text->text; - - cp = text->text; - - for (p = unicode_get_utf8 (cp, &unival); p && unival && line_num < text->num_lines; cp = p, p = unicode_get_utf8 (p, &unival)) { - gboolean handled = FALSE; - - if (len == 0) - lines->text = cp; - if (text->line_wrap - && (unicode_isspace (unival) || unival == '\n') - && e_text_model_get_object_at_pointer (text->model, cp) == -1) { /* don't break mid-object */ - if (clip_width < text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, cp - lines->text) - && laststart != lastend) { - - lines->length = lastend - lines->text; - - lines++; - line_num++; - len = cp - laststart; - lines->text = laststart; - laststart = p; - lastend = cp; - } else if (unicode_isspace (unival)) { - laststart = p; - lastend = cp; - len ++; - } - handled = TRUE; - } else if (text->line_wrap - && IS_BREAKCHAR(text, unival) - && e_text_model_get_object_at_pointer (text->model, cp) == -1) { - if (laststart != lastend - && unicode_index_to_offset (lines->text, cp - lines->text) != 1 - && clip_width < text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, p - lines->text)) { - - lines->length = lastend - lines->text; - - lines++; - line_num++; - len = p - laststart; - lines->text = laststart; - laststart = p; - lastend = p; - } else { - laststart = p; - lastend = p; - len ++; - } - } - if (line_num >= text->num_lines) - break; - if (unival == '\n') { - - lines->length = cp - lines->text; - - lines++; - line_num++; - len = 0; - lastend = p; - laststart = p; - handled = TRUE; - } - if (!handled) - len++; - } - - if ( line_num < text->num_lines && text->line_wrap ) { - if (clip_width < text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, cp - lines->text) - && laststart != lastend ) { - - lines->length = lastend - lines->text; - - lines++; - line_num++; - len = cp - laststart; - lines->text = laststart; - laststart = p; - lastend = cp; - } - } - - if (len == 0) - lines->text = cp; - lines->length = strlen (lines->text); -} - -/* Convenience function to set the text's GC's foreground color */ -static void -set_text_gc_foreground (EText *text) -{ - if (!text->gc) - return; - - gdk_gc_set_foreground (text->gc, &text->color); -} - -/* Sets the stipple pattern for the text */ -static void -set_stipple (EText *text, GdkBitmap *stipple, int reconfigure) -{ - if (text->stipple && !reconfigure) - gdk_bitmap_unref (text->stipple); - - text->stipple = stipple; - if (stipple && !reconfigure) - gdk_bitmap_ref (stipple); - - if (text->gc) { - if (stipple) { - gdk_gc_set_stipple (text->gc, stipple); - gdk_gc_set_fill (text->gc, GDK_STIPPLED); - } else - gdk_gc_set_fill (text->gc, GDK_SOLID); - } -} - -/* Set_arg handler for the text item */ -static void -e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EText *text; - GdkColor color = { 0, 0, 0, 0, }; - GdkColor *pcolor; - gboolean color_changed; - int have_pixel; - - gboolean needs_update = 0; - gboolean needs_reflow = 0; - - item = GNOME_CANVAS_ITEM (object); - text = E_TEXT (object); - - color_changed = FALSE; - have_pixel = FALSE; - - switch (arg_id) { - case ARG_MODEL: - - if ( text->model_changed_signal_id ) - gtk_signal_disconnect (GTK_OBJECT (text->model), - text->model_changed_signal_id); - - if ( text->model_repos_signal_id ) - gtk_signal_disconnect (GTK_OBJECT (text->model), - text->model_repos_signal_id); - - gtk_object_unref (GTK_OBJECT (text->model)); - text->model = E_TEXT_MODEL (GTK_VALUE_OBJECT (*arg)); - gtk_object_ref (GTK_OBJECT (text->model)); - - text->model_changed_signal_id = - gtk_signal_connect (GTK_OBJECT (text->model), - "changed", - GTK_SIGNAL_FUNC (e_text_text_model_changed), - text); - - text->model_repos_signal_id = - gtk_signal_connect (GTK_OBJECT (text->model), - "reposition", - GTK_SIGNAL_FUNC (e_text_text_model_reposition), - text); - - e_text_free_lines(text); - - text->text = e_text_model_get_text(text->model); - gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_CHANGED]); - - text->needs_split_into_lines = 1; - needs_reflow = 1; - break; - - case ARG_EVENT_PROCESSOR: - if ( text->tep && text->tep_command_id ) - gtk_signal_disconnect(GTK_OBJECT(text->tep), - text->tep_command_id); - if ( text->tep ) { - gtk_object_unref(GTK_OBJECT(text->tep)); - } - text->tep = E_TEXT_EVENT_PROCESSOR(GTK_VALUE_OBJECT (*arg)); - gtk_object_ref(GTK_OBJECT(text->tep)); - text->tep_command_id = - gtk_signal_connect(GTK_OBJECT(text->tep), - "command", - GTK_SIGNAL_FUNC(e_text_command), - text); - break; - - case ARG_TEXT: - text->num_lines = 1; - e_text_model_set_text(text->model, GTK_VALUE_STRING (*arg)); - break; - - case ARG_FONT: - if (text->font) - e_font_unref (text->font); - - text->font = e_font_from_gdk_name (GTK_VALUE_STRING (*arg)); - -#if 0 - if (item->canvas->aa) { - if (text->suckfont) - e_suck_font_free (text->suckfont); - - text->suckfont = e_suck_font (text->font); - } -#endif - - calc_ellipsis (text); - if ( text->line_wrap ) - text->needs_split_into_lines = 1; - else - text->needs_calc_line_widths = 1; - needs_reflow = 1; - break; - - case ARG_FONTSET: - if (text->font) - e_font_unref (text->font); - - text->font = e_font_from_gdk_name (GTK_VALUE_STRING (*arg)); - -#if 0 - if (item->canvas->aa) { - if (text->suckfont) - e_suck_font_free (text->suckfont); - - text->suckfont = e_suck_font (text->font); - } -#endif - - calc_ellipsis (text); - if ( text->line_wrap ) - text->needs_split_into_lines = 1; - else - text->needs_calc_line_widths = 1; - needs_reflow = 1; - break; - - case ARG_FONT_GDK: - /* Ref the font in case it was the font that is stored - in the e-font */ - gdk_font_ref (GTK_VALUE_POINTER (*arg)); - if (text->font) - e_font_unref (text->font); - - text->font = e_font_from_gdk_font (GTK_VALUE_POINTER (*arg)); -#if 0 - if (item->canvas->aa) { - if (text->suckfont) - e_suck_font_free (text->suckfont); - - text->suckfont = e_suck_font (text->font); - } -#endif - - calc_ellipsis (text); - if ( text->line_wrap ) - text->needs_split_into_lines = 1; - else - text->needs_calc_line_widths = 1; - needs_reflow = 1; - break; - case ARG_FONT_E: - if (text->font) - e_font_unref (text->font); - - text->font = GTK_VALUE_POINTER (*arg); - - calc_ellipsis (text); - if (text->line_wrap) - text->needs_split_into_lines = 1; - else - text->needs_calc_line_widths = 1; - needs_reflow = 1; - break; - case ARG_ANCHOR: - text->anchor = GTK_VALUE_ENUM (*arg); - text->needs_recalc_bounds = 1; - needs_update = 1; - break; - - case ARG_JUSTIFICATION: - text->justification = GTK_VALUE_ENUM (*arg); - text->needs_redraw = 1; - needs_update = 1; - break; - - case ARG_CLIP_WIDTH: - text->clip_width = fabs (GTK_VALUE_DOUBLE (*arg)); - calc_ellipsis (text); - if ( text->line_wrap ) - text->needs_split_into_lines = 1; - else - text->needs_calc_line_widths = 1; - needs_reflow = 1; - break; - - case ARG_CLIP_HEIGHT: - text->clip_height = fabs (GTK_VALUE_DOUBLE (*arg)); - text->needs_recalc_bounds = 1; - needs_reflow = 1; - break; - - case ARG_CLIP: - text->clip = GTK_VALUE_BOOL (*arg); - calc_ellipsis (text); - if ( text->line_wrap ) - text->needs_split_into_lines = 1; - else - text->needs_calc_line_widths = 1; - needs_reflow = 1; - break; - - case ARG_FILL_CLIP_RECTANGLE: - text->fill_clip_rectangle = GTK_VALUE_BOOL (*arg); - needs_update = 1; - break; - - case ARG_X_OFFSET: - text->xofs = GTK_VALUE_DOUBLE (*arg); - text->needs_recalc_bounds = 1; - needs_update = 1; - break; - - case ARG_Y_OFFSET: - text->yofs = GTK_VALUE_DOUBLE (*arg); - text->needs_recalc_bounds = 1; - needs_update = 1; - break; - - case ARG_FILL_COLOR: - if (GTK_VALUE_STRING (*arg)) - gdk_color_parse (GTK_VALUE_STRING (*arg), &color); - - text->rgba = ((color.red & 0xff00) << 16 | - (color.green & 0xff00) << 8 | - (color.blue & 0xff00) | - 0xff); - text->color = color; - color_changed = TRUE; - text->needs_redraw = 1; - needs_update = 1; - break; - - case ARG_FILL_COLOR_GDK: - pcolor = GTK_VALUE_BOXED (*arg); - if (pcolor) { - color = *pcolor; - } - - text->rgba = ((color.red & 0xff00) << 16 | - (color.green & 0xff00) << 8 | - (color.blue & 0xff00) | - 0xff); - text->color = color; - color_changed = TRUE; - text->needs_redraw = 1; - needs_update = 1; - break; - - case ARG_FILL_COLOR_RGBA: - text->rgba = GTK_VALUE_UINT (*arg); - color_changed = TRUE; - text->needs_redraw = 1; - needs_update = 1; - break; - - case ARG_FILL_STIPPLE: - set_stipple (text, GTK_VALUE_BOXED (*arg), FALSE); - text->needs_redraw = 1; - needs_update = 1; - break; - - case ARG_EDITABLE: - text->editable = GTK_VALUE_BOOL (*arg); - text->needs_redraw = 1; - needs_update = 1; - break; - - case ARG_USE_ELLIPSIS: - text->use_ellipsis = GTK_VALUE_BOOL (*arg); - text->needs_calc_line_widths = 1; - needs_reflow = 1; - break; - - case ARG_ELLIPSIS: - if (text->ellipsis) - g_free (text->ellipsis); - - text->ellipsis = g_strdup (GTK_VALUE_STRING (*arg)); - calc_ellipsis (text); - text->needs_calc_line_widths = 1; - needs_reflow = 1; - break; - - case ARG_LINE_WRAP: - text->line_wrap = GTK_VALUE_BOOL (*arg); - text->needs_split_into_lines = 1; - needs_reflow = 1; - break; - - case ARG_BREAK_CHARACTERS: - if ( text->break_characters ) { - g_free(text->break_characters); - text->break_characters = NULL; - } - if ( GTK_VALUE_STRING (*arg) ) - text->break_characters = g_strdup( GTK_VALUE_STRING (*arg) ); - text->needs_split_into_lines = 1; - needs_reflow = 1; - break; - - case ARG_MAX_LINES: - text->max_lines = GTK_VALUE_INT (*arg); - text->needs_split_into_lines = 1; - needs_reflow = 1; - break; - - case ARG_WIDTH: - text->clip_width = fabs (GTK_VALUE_DOUBLE (*arg)); - calc_ellipsis (text); - if ( text->line_wrap ) - text->needs_split_into_lines = 1; - else - text->needs_calc_line_widths = 1; - needs_reflow = 1; - break; - - case ARG_DRAW_BORDERS: - if (text->draw_borders != GTK_VALUE_BOOL (*arg)) { - text->draw_borders = GTK_VALUE_BOOL (*arg); - text->needs_calc_height = 1; - text->needs_redraw = 1; - needs_reflow = 1; - needs_update = 1; - } - break; - - case ARG_DRAW_BACKGROUND: - if (text->draw_background != GTK_VALUE_BOOL (*arg)){ - text->draw_background = GTK_VALUE_BOOL (*arg); - text->needs_redraw = 1; - } - break; - - case ARG_ALLOW_NEWLINES: - _get_tep(text); - gtk_object_set (GTK_OBJECT (text->tep), - "allow_newlines", GTK_VALUE_BOOL (*arg), - NULL); - break; - - case ARG_CURSOR_POS: { - ETextEventProcessorCommand command; - - command.action = E_TEP_MOVE; - command.position = E_TEP_VALUE; - command.value = GTK_VALUE_INT (*arg); - command.time = GDK_CURRENT_TIME; - e_text_command (text->tep, &command, text); - break; - } - - default: - return; - } - - if (color_changed) { - if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(item)) - gdk_color_context_query_color (item->canvas->cc, &color); - - if (!item->canvas->aa) - set_text_gc_foreground (text); - - } - - if ( needs_reflow ) - e_canvas_item_request_reflow (item); - if ( needs_update ) - gnome_canvas_item_request_update (item); -} - -/* Get_arg handler for the text item */ -static void -e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EText *text; - GdkColor *color; - - text = E_TEXT (object); - - switch (arg_id) { - case ARG_MODEL: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(text->model); - break; - - case ARG_EVENT_PROCESSOR: - _get_tep(text); - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(text->tep); - break; - - case ARG_TEXT: - GTK_VALUE_STRING (*arg) = g_strdup (text->text); - break; - - case ARG_FONT_E: - GTK_VALUE_BOXED (*arg) = text->font; - break; - - case ARG_ANCHOR: - GTK_VALUE_ENUM (*arg) = text->anchor; - break; - - case ARG_JUSTIFICATION: - GTK_VALUE_ENUM (*arg) = text->justification; - break; - - case ARG_CLIP_WIDTH: - GTK_VALUE_DOUBLE (*arg) = text->clip_width; - break; - - case ARG_CLIP_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = text->clip_height; - break; - - case ARG_CLIP: - GTK_VALUE_BOOL (*arg) = text->clip; - break; - - case ARG_FILL_CLIP_RECTANGLE: - GTK_VALUE_BOOL (*arg) = text->fill_clip_rectangle; - break; - - case ARG_X_OFFSET: - GTK_VALUE_DOUBLE (*arg) = text->xofs; - break; - - case ARG_Y_OFFSET: - GTK_VALUE_DOUBLE (*arg) = text->yofs; - break; - - case ARG_FILL_COLOR_GDK: - color = g_new (GdkColor, 1); - *color = text->color; - GTK_VALUE_BOXED (*arg) = color; - break; - - case ARG_FILL_COLOR_RGBA: - GTK_VALUE_UINT (*arg) = text->rgba; - break; - - case ARG_FILL_STIPPLE: - GTK_VALUE_BOXED (*arg) = text->stipple; - break; - - case ARG_TEXT_WIDTH: - GTK_VALUE_DOUBLE (*arg) = text->max_width / text->item.canvas->pixels_per_unit; - break; - - case ARG_TEXT_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = text->height / text->item.canvas->pixels_per_unit; - break; - - case ARG_EDITABLE: - GTK_VALUE_BOOL (*arg) = text->editable; - break; - - case ARG_USE_ELLIPSIS: - GTK_VALUE_BOOL (*arg) = text->use_ellipsis; - break; - - case ARG_ELLIPSIS: - GTK_VALUE_STRING (*arg) = g_strdup (text->ellipsis); - break; - - case ARG_LINE_WRAP: - GTK_VALUE_BOOL (*arg) = text->line_wrap; - break; - - case ARG_BREAK_CHARACTERS: - GTK_VALUE_STRING (*arg) = g_strdup (text->break_characters); - break; - - case ARG_MAX_LINES: - GTK_VALUE_INT (*arg) = text->max_lines; - break; - - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = text->clip_width; - break; - - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = text->clip && text->clip_height != -1 ? text->clip_height : text->height / text->item.canvas->pixels_per_unit; - break; - - case ARG_DRAW_BORDERS: - GTK_VALUE_BOOL (*arg) = text->draw_borders; - break; - - case ARG_DRAW_BACKGROUND: - GTK_VALUE_BOOL (*arg) = text->draw_background; - break; - - case ARG_ALLOW_NEWLINES: - { - gboolean allow_newlines; - _get_tep(text); - gtk_object_get (GTK_OBJECT (text->tep), - "allow_newlines", &allow_newlines, - NULL); - GTK_VALUE_BOOL (*arg) = allow_newlines; - } - break; - - case ARG_CURSOR_POS: - GTK_VALUE_INT (*arg) = text->selection_start; - break; - - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -/* Update handler for the text item */ -static void -e_text_reflow (GnomeCanvasItem *item, int flags) -{ - EText *text; - - text = E_TEXT (item); - - if ( text->needs_split_into_lines ) { - split_into_lines(text); - text->needs_split_into_lines = 0; - text->needs_calc_line_widths = 1; - } - if ( text->needs_calc_line_widths ) { - int x; - int i; - struct line *lines; - gdouble clip_width; - calc_line_widths(text); - text->needs_calc_line_widths = 0; - text->needs_calc_height = 1; - text->needs_redraw = 1; - - lines = text->lines; - if ( !lines ) - return; - - for (lines = text->lines, i = 0; i < text->num_lines ; i++, lines ++) { - if ((lines->text - text->text) > text->selection_end) { - break; - } - } - lines --; - i--; - x = text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, - text->selection_end - (lines->text - text->text)); - - - if (x < text->xofs_edit) { - text->xofs_edit = x; - } - - clip_width = text->clip_width; - if (clip_width >= 0 && text->draw_borders) { - clip_width -= 6; - if (clip_width < 0) - clip_width = 0; - } - - if (2 + x - clip_width > text->xofs_edit) { - text->xofs_edit = 2 + x - clip_width; - } - - if (e_font_height (text->font) * i < text->yofs_edit) - text->yofs_edit = e_font_height (text->font) * i; - - if (e_font_height (text->font) * (i + 1) - - (text->clip_height != -1 ? text->clip_height : text->height) > text->yofs_edit) - text->yofs_edit = e_font_height (text->font) * (i + 1) - - (text->clip_height != -1 ? text->clip_height : text->height); - } - if ( text->needs_calc_height ) { - calc_height (text); - gnome_canvas_item_request_update(item); - text->needs_calc_height = 0; - text->needs_recalc_bounds = 1; - } -} - -/* Update handler for the text item */ -static void -e_text_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - EText *text; - double x1, y1, x2, y2; - ArtDRect i_bbox, c_bbox; - int i; - - text = E_TEXT (item); - - if (parent_class->update) - (* parent_class->update) (item, affine, clip_path, flags); - - if ( text->needs_recalc_bounds - || (flags & GNOME_CANVAS_UPDATE_AFFINE)) { - if (!item->canvas->aa) { - set_text_gc_foreground (text); - set_stipple (text, text->stipple, TRUE); - get_bounds (text, &x1, &y1, &x2, &y2); - if ( item->x1 != x1 || - item->x2 != x2 || - item->y1 != y1 || - item->y2 != y2 ) { - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); - item->x1 = x1; - item->y1 = y1; - item->x2 = x2; - item->y2 = y2; - text->needs_redraw = 1; - } - } else { - /* aa rendering */ - for (i = 0; i < 6; i++) - text->affine[i] = affine[i]; - get_bounds_item_relative (text, &i_bbox.x0, &i_bbox.y0, &i_bbox.x1, &i_bbox.y1); - art_drect_affine_transform (&c_bbox, &i_bbox, affine); - } - text->needs_recalc_bounds = 0; - } - if ( text->needs_redraw ) { - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); - text->needs_redraw = 0; - } -} - -/* Realize handler for the text item */ -static void -e_text_realize (GnomeCanvasItem *item) -{ - EText *text; - - text = E_TEXT (item); - - if (parent_class->realize) - (* parent_class->realize) (item); - - text->gc = gdk_gc_new (item->canvas->layout.bin_window); - gdk_color_context_query_color (item->canvas->cc, &text->color); - gdk_gc_set_foreground (text->gc, &text->color); - - text->i_cursor = gdk_cursor_new (GDK_XTERM); - text->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); - if (text->font == NULL) { - gdk_font_ref (GTK_WIDGET (item->canvas)->style->font); - text->font = e_font_from_gdk_font (GTK_WIDGET (item->canvas)->style->font); - } -} - -/* Unrealize handler for the text item */ -static void -e_text_unrealize (GnomeCanvasItem *item) -{ - EText *text; - - text = E_TEXT (item); - - gdk_gc_unref (text->gc); - text->gc = NULL; - - gdk_cursor_destroy (text->i_cursor); - text->i_cursor = NULL; - gdk_cursor_destroy (text->default_cursor); - text->default_cursor = NULL; - - if (parent_class->unrealize) - (* parent_class->unrealize) (item); -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static double -get_line_xpos_item_relative (EText *text, struct line *line) -{ - double x; - - x = 0; - - switch (text->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_W: - case GTK_ANCHOR_SW: - break; - - case GTK_ANCHOR_N: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_S: - x -= text->max_width / 2; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - x -= text->max_width; - break; - } - - switch (text->justification) { - case GTK_JUSTIFY_RIGHT: - x += text->max_width - line->width; - break; - - case GTK_JUSTIFY_CENTER: - x += (text->max_width - line->width) * 0.5; - break; - - default: - if (text->draw_borders) - x += BORDER_INDENT; - - /* For GTK_JUSTIFY_LEFT, we don't have to do anything. We do not support - * GTK_JUSTIFY_FILL, yet. - */ - break; - } - - return x; -} - -#if 0 -/* Calculates the y position of the first line of text. */ -static double -get_line_ypos_item_relative (EText *text) -{ - double y; - - y = 0; - - switch (text->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_N: - case GTK_ANCHOR_NE: - break; - - case GTK_ANCHOR_W: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_E: - y -= text->height / 2; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - y -= text->height; - break; - } - - return y; -} -#endif - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_xpos (EText *text, struct line *line) -{ - int x; - - x = text->cx; - - switch (text->justification) { - case GTK_JUSTIFY_RIGHT: - x += text->max_width - line->width; - break; - - case GTK_JUSTIFY_CENTER: - x += (text->max_width - line->width) / 2; - break; - - default: - if (text->draw_borders) - x += BORDER_INDENT; - /* For GTK_JUSTIFY_LEFT, we don't have to do anything. We do not support - * GTK_JUSTIFY_FILL, yet. - */ - break; - } - - - return x; -} - -static void -_get_tep(EText *text) -{ - if (!text->tep) { - text->tep = e_text_event_processor_emacs_like_new(); - gtk_object_ref (GTK_OBJECT (text->tep)); - gtk_object_sink (GTK_OBJECT (text->tep)); - text->tep_command_id = - gtk_signal_connect(GTK_OBJECT(text->tep), - "command", - GTK_SIGNAL_FUNC(e_text_command), - (gpointer) text); - } -} - -/* Draw handler for the text item */ -static void -e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) -{ - EText *text; - GdkRectangle rect, *clip_rect; - struct line *lines; - int i; - int xpos, ypos; - int start_char, end_char; - int sel_start, sel_end; - GdkRectangle sel_rect; - GdkGC *fg_gc; - GnomeCanvas *canvas; - GtkWidget *widget; - - text = E_TEXT (item); - canvas = GNOME_CANVAS_ITEM(text)->canvas; - widget = GTK_WIDGET(canvas); - - fg_gc = widget->style->fg_gc[text->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE]; - - if (text->draw_borders || text->draw_background) { - gdouble thisx = item->x1 - x; - gdouble thisy = item->y1 - y; - gdouble thiswidth, thisheight; - GtkWidget *widget = GTK_WIDGET(item->canvas); - - gtk_object_get(GTK_OBJECT(text), - "width", &thiswidth, - "height", &thisheight, - NULL); - - if (text->draw_borders){ - - if (text->editing) { - thisx += 1; - thisy += 1; - thiswidth -= 2; - thisheight -= 2; - } - - gtk_paint_shadow (widget->style, drawable, - GTK_STATE_NORMAL, GTK_SHADOW_IN, - NULL, widget, "entry", - thisx, thisy, thiswidth, thisheight); - - if (text->editing) { - thisx -= 1; - thisy -= 1; - thiswidth += 2; - thisheight += 2; - /* - * Chris: I am here "filling in" for the additions - * and substractions done in the previous if (text->editing). - * but you might have other plans for this. Please enlighten - * me as to whether it should be: - * thiswidth + 2 or thiswidth + 1. - */ - gtk_paint_focus (widget->style, drawable, - NULL, widget, "entry", - thisx, thisy, thiswidth - 1, thisheight - 1); - } - } - - if (text->draw_background) { - gtk_paint_flat_box (widget->style, drawable, - GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE, - NULL, widget, "entry_bg", - thisx + widget->style->klass->xthickness, - thisy + widget->style->klass->ythickness, - thiswidth - widget->style->klass->xthickness * 2, - thisheight - widget->style->klass->ythickness * 2); - } - } - - if (!text->text || !text->font) - return; - - lines = text->lines; - if ( !lines ) { - text->needs_split_into_lines = 1; - e_canvas_item_request_reflow (item); - return; - } - - clip_rect = NULL; - if (text->clip) { - rect.x = text->clip_cx - x; - rect.y = text->clip_cy - y; - rect.width = text->clip_cwidth; - rect.height = text->clip_cheight; - - gdk_gc_set_clip_rectangle (text->gc, &rect); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ - } - ypos = text->cy + e_font_ascent (text->font); - if (text->draw_borders) - ypos += BORDER_INDENT; - - if (text->editing) - ypos -= text->yofs_edit; - - if (text->stipple) - gnome_canvas_set_stipple_origin (item->canvas, text->gc); - - for (i = 0; i < text->num_lines; i++) { - - xpos = get_line_xpos (text, lines); - if (text->editing) { - xpos -= text->xofs_edit; - start_char = lines->text - text->text; - end_char = start_char + lines->length; - sel_start = text->selection_start; - sel_end = text->selection_end; - if (sel_start > sel_end ) { - sel_start ^= sel_end; - sel_end ^= sel_start; - sel_start ^= sel_end; - } - if ( sel_start < start_char ) - sel_start = start_char; - if ( sel_end > end_char ) - sel_end = end_char; - if ( sel_start < sel_end ) { - sel_rect.x = xpos - x + text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, - sel_start - start_char); - sel_rect.y = ypos - y - e_font_ascent (text->font); - sel_rect.width = text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text + sel_start - start_char, - sel_end - sel_start); - sel_rect.height = e_font_height (text->font); - gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style, - drawable, - text->has_selection ? - GTK_STATE_SELECTED : - GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - clip_rect, - GTK_WIDGET(item->canvas), - "text", - sel_rect.x, - sel_rect.y, - sel_rect.width, - sel_rect.height); - text_draw_with_objects (text->model, - drawable, - text->font, E_FONT_PLAIN, - text->gc, - xpos - x, - ypos - y, - lines->text, - sel_start - start_char); - text_draw_with_objects (text->model, - drawable, - text->font, E_FONT_PLAIN, - fg_gc, - xpos - x + text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, - sel_start - start_char), - ypos - y, - lines->text + sel_start - start_char, - sel_end - sel_start); - text_draw_with_objects (text->model, - drawable, - text->font, E_FONT_PLAIN, - text->gc, - xpos - x + text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, - sel_end - start_char), - ypos - y, - lines->text + sel_end - start_char, - end_char - sel_end); - } else { - text_draw_with_objects (text->model, - drawable, - text->font, E_FONT_PLAIN, - text->gc, - xpos - x, - ypos - y, - lines->text, - lines->length); - } - if (text->selection_start == text->selection_end && - text->selection_start >= start_char && - text->selection_start <= end_char && - text->show_cursor) { - gdk_draw_rectangle (drawable, - text->gc, - TRUE, - xpos - x + text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, - sel_start - start_char), - ypos - y - e_font_ascent (text->font), - 1, - e_font_height (text->font)); - } - } else { - if (text->clip && text->use_ellipsis && lines->ellipsis_length < lines->length) { - text_draw_with_objects (text->model, - drawable, - text->font, E_FONT_PLAIN, - text->gc, - xpos - x, - ypos - y, - lines->text, - lines->ellipsis_length); - e_font_draw_utf8_text (drawable, - text->font, E_FONT_PLAIN, - text->gc, - xpos - x + lines->width - text->ellipsis_width, - ypos - y, - text->ellipsis ? text->ellipsis : "...", - text->ellipsis ? strlen (text->ellipsis) : 3); - } else - text_draw_with_objects (text->model, - drawable, - text->font, E_FONT_PLAIN, - text->gc, - xpos - x, - ypos - y, - lines->text, - lines->length); - } - - ypos += e_font_height (text->font); - lines++; - } - - if (text->clip) { - gdk_gc_set_clip_rectangle (text->gc, NULL); - gdk_gc_set_clip_rectangle (fg_gc, NULL); - } -} - -/* Render handler for the text item */ -static void -e_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) -{ -#if 0 - EText *text; - guint32 fg_color; - double xpos, ypos; - struct line *lines; - int i, j; - double affine[6]; - int dx, dy; - ArtPoint start_i, start_c; - - text = E_TEXT (item); - - if (!text->text || !text->font || !text->suckfont) - return; - - suckfont = text->suckfont; - - fg_color = text->rgba; - - gnome_canvas_buf_ensure_buf (buf); - - lines = text->lines; - if ( !lines ) - return; - - start_i.y = get_line_ypos_item_relative (text); - - art_affine_scale (affine, item->canvas->pixels_per_unit, item->canvas->pixels_per_unit); - for (i = 0; i < 6; i++) - affine[i] = text->affine[i]; - - for (i = 0; i < text->num_lines; i++) { - if (lines->length != 0) { - start_i.x = get_line_xpos_item_relative (text, lines); - art_affine_point (&start_c, &start_i, text->affine); - xpos = start_c.x; - ypos = start_c.y; - - for (j = 0; j < lines->length; j++) { - ETextSuckChar *ch; - - ch = &suckfont->chars[(unsigned char)((lines->text)[j])]; - - affine[4] = xpos; - affine[5] = ypos; - art_rgb_bitmap_affine ( - buf->buf, - buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1, - buf->buf_rowstride, - suckfont->bitmap + (ch->bitmap_offset >> 3), - ch->width, - suckfont->bitmap_height, - suckfont->bitmap_width >> 3, - fg_color, - affine, - ART_FILTER_NEAREST, NULL); - - dx = ch->left_sb + ch->width + ch->right_sb; - xpos += dx * affine[0]; - ypos += dx * affine[1]; - } - } - - dy = text->font->ascent + text->font->descent; - start_i.y += dy; - lines++; - } - - buf->is_bg = 0; -#endif -} - -/* Point handler for the text item */ -static double -e_text_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) -{ - EText *text; - int i; - struct line *lines; - int x1, y1, x2, y2; - int font_height; - int dx, dy; - double dist, best; - - text = E_TEXT (item); - - *actual_item = item; - - /* The idea is to build bounding rectangles for each of the lines of - * text (clipped by the clipping rectangle, if it is activated) and see - * whether the point is inside any of these. If it is, we are done. - * Otherwise, calculate the distance to the nearest rectangle. - */ - - if (text->font) - font_height = e_font_height (text->font); - else - font_height = 0; - - best = 1.0e36; - - lines = text->lines; - - if (text->fill_clip_rectangle) { - double clip_width; - double clip_height; - - /* Calculate the width and heights */ - calc_height (text); - calc_line_widths (text); - - if (text->clip_width < 0) - clip_width = text->max_width; - else - clip_width = text->clip_width; - - /* Get canvas pixel coordinates for clip rectangle position */ - clip_width = clip_width * item->canvas->pixels_per_unit; - if ( text->clip_height >= 0 ) - clip_height = text->clip_height * item->canvas->pixels_per_unit; - else - clip_height = text->height * item->canvas->pixels_per_unit; - - if (cx >= text->clip_cx && - cx <= text->clip_cx + clip_width && - cy >= text->clip_cy && - cy <= text->clip_cy + clip_height) - return 0; - else - return 1; - } - - for (i = 0; i < text->num_lines; i++) { - /* Compute the coordinates of rectangle for the current line, - * clipping if appropriate. - */ - - x1 = get_line_xpos (text, lines); - y1 = text->cy + i * font_height; - x2 = x1 + lines->width; - y2 = y1 + font_height; - - if (text->clip) { - if (x1 < text->clip_cx) - x1 = text->clip_cx; - - if (y1 < text->clip_cy) - y1 = text->clip_cy; - - if ( text->clip_width >= 0 ) { - if (x2 > (text->clip_cx + text->clip_width)) - x2 = text->clip_cx + text->clip_width; - } - - if ( text->clip_height >= 0 ) { - if (y2 > (text->clip_cy + text->clip_height)) - y2 = text->clip_cy + text->clip_height; - } - - if ((x1 >= x2) || (y1 >= y2)) - continue; - } - - /* Calculate distance from point to rectangle */ - - if (cx < x1) - dx = x1 - cx; - else if (cx >= x2) - dx = cx - x2 + 1; - else - dx = 0; - - if (cy < y1) - dy = y1 - cy; - else if (cy >= y2) - dy = cy - y2 + 1; - else - dy = 0; - - if ((dx == 0) && (dy == 0)) - return 0.0; - - dist = sqrt (dx * dx + dy * dy); - if (dist < best) - best = dist; - - /* Next! */ - - lines++; - } - - return best / item->canvas->pixels_per_unit; -} - -/* Bounds handler for the text item */ -static void -e_text_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) -{ - EText *text; - double width, height; - - text = E_TEXT (item); - - *x1 = 0; - *y1 = 0; - - if (text->clip) { - width = text->clip_width; - if ( text->clip_height >= 0 ) - height = text->clip_height; - else height = text->height; - } else { - width = text->max_width / item->canvas->pixels_per_unit; - height = text->height / item->canvas->pixels_per_unit; - } - - switch (text->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_W: - case GTK_ANCHOR_SW: - break; - - case GTK_ANCHOR_N: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_S: - *x1 -= width / 2.0; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - *x1 -= width; - break; - } - - switch (text->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_N: - case GTK_ANCHOR_NE: - break; - - case GTK_ANCHOR_W: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_E: - *y1 -= height / 2.0; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - *y1 -= height; - break; - } - - *x2 = *x1 + width; - *y2 = *y1 + height; -} - -static void -_get_xy_from_position (EText *text, gint position, gint *xp, gint *yp) -{ - if ( !text->lines ) - return; - if (xp || yp) { - struct line *lines = NULL; - int x, y; - double xd, yd; - int j; - x = get_line_xpos_item_relative (text, lines); - y = text->yofs; - y -= text->yofs_edit; - for (j = 0, lines = text->lines; j < text->num_lines; lines++, j++) { - if (lines->text > text->text + position) - break; - y += e_font_height (text->font); - } - lines --; - y -= e_font_descent (text->font); - - x += text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, - position - (lines->text - text->text)); - x -= text->xofs_edit; - - xd = x; yd = y; - gnome_canvas_item_i2w (GNOME_CANVAS_ITEM(text), &xd, &yd); - gnome_canvas_w2c (GNOME_CANVAS_ITEM(text)->canvas, xd, yd, &x, &y); - - if (xp) - *xp = x; - if (yp) - *yp = y; - } -} - -static gint -_get_position_from_xy (EText *text, gint x, gint y) -{ - int i, j; - int ypos = text->yofs; - int xpos; - double xd, yd; - const char *p; - unicode_char_t unival; - gint font_ht, adjust=0; - struct line *lines; - - xd = x; yd = y; - gnome_canvas_c2w (GNOME_CANVAS_ITEM(text)->canvas, xd, yd, &xd, &yd); - gnome_canvas_item_w2i (GNOME_CANVAS_ITEM(text), &xd, &yd); - x = xd; y = yd; - - y += text->yofs_edit; - font_ht = e_font_height (text->font); - - if (text->draw_borders) - ypos += BORDER_INDENT; - - switch (text->anchor) { - case GTK_ANCHOR_WEST: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_EAST: - y += (text->num_lines * font_ht)/2; - break; - case GTK_ANCHOR_SOUTH: - case GTK_ANCHOR_SOUTH_EAST: - case GTK_ANCHOR_SOUTH_WEST: - y += text->num_lines * font_ht; - default: - /* Do nothing */ - } - - - j = 0; - while (y > ypos) { - ypos += font_ht; - j ++; - } - j--; - if (j >= text->num_lines) - j = text->num_lines - 1; - if (j < 0) - j = 0; - i = 0; - lines = text->lines; - - if ( !lines ) - return 0; - - lines += j; - x += text->xofs_edit; - xpos = get_line_xpos_item_relative (text, lines); - - for (i = 0, p = lines->text; p && i < lines->length; i++, p = unicode_get_utf8 (p, &unival)) { - int charwidth; - int step1, step2; - -#if 0 - if (unival == '\1') { - const gchar *obj_str = NULL; /*e_text_model_get_nth_object (text->model, object_num);*/ - charwidth = e_font_utf8_text_width (text->font, E_FONT_PLAIN, obj_str, strlen (obj_str)); - ++object_num; - - step1 = charwidth; - step2 = 0; - adjust = -1; - - } else { -#endif - charwidth = e_font_utf8_char_width (text->font, E_FONT_PLAIN, (gchar *) p); - - step1 = charwidth / 2; - step2 = (charwidth + 1) / 2; - adjust = 0; -#if 0 - } -#endif - - xpos += step1; - if (xpos > x) { - break; - } - xpos += step2; - } - - if (!p) return 0; - - return MAX (p - text->text + adjust, 0); -} - -#define SCROLL_WAIT_TIME 30000 - -static gboolean -_blink_scroll_timeout (gpointer data) -{ - EText *text = E_TEXT(data); - gulong current_time; - gboolean scroll = FALSE; - gboolean redraw = FALSE; - - g_timer_elapsed(text->timer, ¤t_time); - - if (text->scroll_start + SCROLL_WAIT_TIME > 1000000) { - if (current_time > text->scroll_start - (1000000 - SCROLL_WAIT_TIME) && - current_time < text->scroll_start) - scroll = TRUE; - } else { - if (current_time > text->scroll_start + SCROLL_WAIT_TIME || - current_time < text->scroll_start) - scroll = TRUE; - } - if (scroll && text->button_down) { - if (text->lastx - text->clip_cx > text->clip_cwidth && - text->xofs_edit < text->max_width - text->clip_cwidth) { - text->xofs_edit += 4; - if (text->xofs_edit > text->max_width - text->clip_cwidth + 1) - text->xofs_edit = text->max_width - text->clip_cwidth + 1; - redraw = TRUE; - } - if (text->lastx - text->clip_cx < 0 && - text->xofs_edit > 0) { - text->xofs_edit -= 4; - if (text->xofs_edit < 0) - text->xofs_edit = 0; - redraw = TRUE; - } - - if (text->lasty - text->clip_cy > text->clip_cheight && - text->yofs_edit < text->height - text->clip_cheight) { - text->yofs_edit += 4; - if (text->yofs_edit > text->height - text->clip_cheight + 1) - text->yofs_edit = text->height - text->clip_cheight + 1; - redraw = TRUE; - } - if (text->lasty - text->clip_cy < 0 && - text->yofs_edit > 0) { - text->yofs_edit -= 4; - if (text->yofs_edit < 0) - text->yofs_edit = 0; - redraw = TRUE; - } - - if (redraw) { - ETextEventProcessorEvent e_tep_event; - e_tep_event.type = GDK_MOTION_NOTIFY; - e_tep_event.motion.state = text->last_state; - e_tep_event.motion.time = 0; - e_tep_event.motion.position = _get_position_from_xy(text, text->lastx, text->lasty); - _get_tep(text); - e_text_event_processor_handle_event (text->tep, - &e_tep_event); - text->scroll_start = current_time; - } - } - - if (!((current_time / 500000) % 2)) { - if (!text->show_cursor) - redraw = TRUE; - text->show_cursor = TRUE; - } else { - if (text->show_cursor) - redraw = TRUE; - text->show_cursor = FALSE; - } - if (redraw) { - text->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); - } - return TRUE; -} - -static gboolean -tooltip_event(GtkWidget *tooltip, GdkEvent *event, EText *text) -{ - gint ret_val = FALSE; - switch (event->type) { - case GDK_LEAVE_NOTIFY: - if (text->tooltip_window) { - gtk_widget_destroy (text->tooltip_window); - text->tooltip_window = NULL; - } - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - if (event->type == GDK_BUTTON_RELEASE) { - if (text->tooltip_window) { - gtk_widget_destroy (text->tooltip_window); - text->tooltip_window = NULL; - } - } - /* Forward events to the text item */ - gtk_signal_emit_by_name (GTK_OBJECT (text), "event", event, - &ret_val); - default: - break; - } - return ret_val; -} - -static gboolean -_do_tooltip (gpointer data) -{ - EText *text = E_TEXT (data); - struct line *lines; - GtkWidget *canvas; - int i; - gdouble max_width; - gboolean cut_off; - double i2c[6]; - ArtPoint origin = {0, 0}; - ArtPoint pixel_origin; - int canvas_x, canvas_y; - GnomeCanvasItem *tooltip_text; - double tooltip_width; - double tooltip_height; - double tooltip_x; - double tooltip_y; -#if 0 - double x1, x2, y1, y2; -#endif - GnomeCanvasItem *rect; - - text->tooltip_count = 0; - - lines = text->lines; - - if (text->tooltip_window || text->editing || (!lines)) { - text->tooltip_timeout = 0; - return FALSE; - } - - cut_off = FALSE; - for ( lines = text->lines, i = 0; i < text->num_lines; lines++, i++ ) { - if (lines->length > lines->ellipsis_length) { - cut_off = TRUE; - break; - } - } - if ( ! cut_off ) { - text->tooltip_timeout = 0; - return FALSE; - } - - gnome_canvas_item_i2c_affine(GNOME_CANVAS_ITEM(text), i2c); - art_affine_point (&pixel_origin, &origin, i2c); - - gdk_window_get_origin (GTK_WIDGET(GNOME_CANVAS_ITEM(text)->canvas)->window, &canvas_x, &canvas_y); - pixel_origin.x += canvas_x; - pixel_origin.y += canvas_y; - pixel_origin.x -= (int) gtk_layout_get_hadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(text)->canvas))->value; - pixel_origin.y -= (int) gtk_layout_get_vadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(text)->canvas))->value; - - text->tooltip_window = gtk_window_new (GTK_WINDOW_POPUP); - gtk_container_set_border_width (GTK_CONTAINER (text->tooltip_window), 1); - - canvas = e_canvas_new (); - - gtk_container_add (GTK_CONTAINER (text->tooltip_window), canvas); - - /* Get the longest line length */ - max_width = 0.0; - for (lines = text->lines, i = 0; i < text->num_lines; lines++, i++) { - gdouble line_width; - - line_width = text_width_with_objects (text->model, text->font, E_FONT_PLAIN, lines->text, lines->length); - max_width = MAX (max_width, line_width); - } - - rect = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), - gnome_canvas_rect_get_type (), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) max_width + 4, - "y2", (double) text->height + 4, - "fill_color", "light gray", - NULL); - - /* Ref the font so that it is not destroyed - when the tooltip text is destroyed */ - e_font_ref (text->font); - tooltip_text = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), - e_text_get_type (), - "anchor", GTK_ANCHOR_NW, - "font_e", text->font, - "text", text->text, - "editable", FALSE, - "clip_width", text->max_lines != 1 ? text->clip_width : max_width, - "clip_height", text->max_lines != 1 ? -1 : (double)text->height, - "clip", TRUE, - "line_wrap", text->line_wrap, - "justification", text->justification, - NULL); - - - - if (text->draw_borders) - e_canvas_item_move_absolute(tooltip_text, 1 + BORDER_INDENT, 1 + BORDER_INDENT); - else - e_canvas_item_move_absolute(tooltip_text, 1, 1); - - - calc_height(E_TEXT(tooltip_text)); - calc_line_widths(E_TEXT(tooltip_text)); - gnome_canvas_item_set (tooltip_text, - "clip_height", (double) E_TEXT(tooltip_text)->height, - "clip_width", (double) E_TEXT(tooltip_text)->max_width, - NULL); - tooltip_width = E_TEXT(tooltip_text)->max_width; - tooltip_height = E_TEXT(tooltip_text)->height; - tooltip_x = 0; - tooltip_y = 0; - switch(E_TEXT(tooltip_text)->justification) { - case GTK_JUSTIFY_CENTER: - tooltip_x = - tooltip_width / 2; - break; - case GTK_JUSTIFY_RIGHT: - tooltip_x = tooltip_width / 2; - break; - case GTK_JUSTIFY_FILL: - case GTK_JUSTIFY_LEFT: - tooltip_x = 0; - break; - } - switch(text->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_N: - case GTK_ANCHOR_NE: - break; - - case GTK_ANCHOR_W: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_E: - tooltip_y -= tooltip_height / 2.0; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - tooltip_y -= tooltip_height; - break; - } - switch(E_TEXT(tooltip_text)->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_W: - case GTK_ANCHOR_SW: - break; - - case GTK_ANCHOR_N: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_S: - tooltip_x -= tooltip_width / 2.0; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - tooltip_x -= tooltip_width; - break; - } -#if 0 - get_bounds(text, &x1, &y1, &x2, &y2); - if ( x1 < tooltip_x ) { - gnome_canvas_item_move(tooltip_text, tooltip_x - x1, 0); - tooltip_x = x1; - } - if ( y1 < tooltip_y ) { - gnome_canvas_item_move(tooltip_text, 0, tooltip_y - y1); - tooltip_y = y1; - } - if ( x2 > tooltip_x + tooltip_width ) - tooltip_width = x2 - tooltip_x; - if ( y2 > tooltip_y + tooltip_height ) - tooltip_height = y2 - tooltip_y; -#endif - - gnome_canvas_item_set(rect, - "x2", (double) tooltip_width + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0), - "y2", (double) tooltip_height + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0), - NULL); - - gtk_widget_set_usize (text->tooltip_window, - tooltip_width + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0), - tooltip_height + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0)); - gnome_canvas_set_scroll_region (GNOME_CANVAS(canvas), 0.0, 0.0, - tooltip_width + (text->draw_borders ? BORDER_INDENT * 2 : 0), - (double)tooltip_height + (text->draw_borders ? BORDER_INDENT * 2 : 0)); - gtk_widget_show (canvas); - gtk_widget_realize (text->tooltip_window); - gtk_signal_connect (GTK_OBJECT(text->tooltip_window), "event", - GTK_SIGNAL_FUNC(tooltip_event), text); - - gtk_widget_popup (text->tooltip_window, pixel_origin.x - 2 + tooltip_x, pixel_origin.y - 2 + tooltip_y); - - text->tooltip_timeout = 0; - return FALSE; -} - -static gboolean -_click (gpointer data) -{ - *(gint *)data = 0; - return FALSE; -} - -static gint -e_text_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EText *text = E_TEXT(item); - ETextEventProcessorEvent e_tep_event; - - gint return_val = 0; - - if (GTK_OBJECT_DESTROYED (item)) - return FALSE; - - e_tep_event.type = event->type; - switch (event->type) { - case GDK_FOCUS_CHANGE: - if (text->editable) { - GdkEventFocus *focus_event; - focus_event = (GdkEventFocus *) event; - if (focus_event->in) { - if(!text->editing) { - text->editing = TRUE; - if ( text->pointer_in ) { - if ( text->default_cursor_shown && (!text->draw_borders)) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->i_cursor); - text->default_cursor_shown = FALSE; - } - } - text->select_by_word = FALSE; - text->xofs_edit = 0; - text->yofs_edit = 0; - if (text->timeout_id == 0) - text->timeout_id = g_timeout_add(10, _blink_scroll_timeout, text); - text->timer = g_timer_new(); - g_timer_elapsed(text->timer, &(text->scroll_start)); - g_timer_start(text->timer); - } - } else { - text->editing = FALSE; - if ( (!text->default_cursor_shown) && (!text->draw_borders) ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->default_cursor); - text->default_cursor_shown = TRUE; - } - if (text->timeout_id) { - g_source_remove(text->timeout_id); - text->timeout_id = 0; - } - if (text->timer) { - g_timer_stop(text->timer); - g_timer_destroy(text->timer); - text->timer = NULL; - } - } - if ( text->line_wrap ) - text->needs_split_into_lines = 1; - else - text->needs_calc_line_widths = 1; - e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(text)); - } - return_val = 0; - break; - case GDK_KEY_PRESS: /* Fall Through */ - case GDK_KEY_RELEASE: - if (text->editing) { - GdkEventKey key = event->key; - gint ret; - - e_tep_event.key.time = key.time; - e_tep_event.key.state = key.state; - e_tep_event.key.keyval = key.keyval; - - // g_print ("etext got keyval \"%s\"\n", gdk_keyval_name (key.keyval)); - - /* This is probably ugly hack, but we have to handle UTF-8 input somehow */ -#if 0 - e_tep_event.key.length = key.length; - e_tep_event.key.string = key.string; -#else - e_tep_event.key.string = e_utf8_from_gtk_event_key (GTK_WIDGET (item->canvas), key.keyval, key.string); - if (e_tep_event.key.string != NULL) { - e_tep_event.key.length = strlen (e_tep_event.key.string); - } else { - e_tep_event.key.length = 0; - } -#endif - _get_tep(text); - ret = e_text_event_processor_handle_event (text->tep, &e_tep_event); - - if (e_tep_event.key.string) g_free (e_tep_event.key.string); - - if (event->type == GDK_KEY_PRESS) - gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_KEYPRESS], - e_tep_event.key.keyval, e_tep_event.key.state); - - return ret; - } - else - return 0; - break; - case GDK_BUTTON_PRESS: /* Fall Through */ - case GDK_BUTTON_RELEASE: - if (text->tooltip_timeout) { - gtk_timeout_remove (text->tooltip_timeout); - text->tooltip_timeout = 0; - } - if (text->tooltip_window) { - gtk_widget_destroy (text->tooltip_window); - text->tooltip_window = NULL; - } -#if 0 - if ((!text->editing) - && text->editable - && event->type == GDK_BUTTON_RELEASE - && event->button.button == 1) { - GdkEventButton button = event->button; - - e_canvas_item_grab_focus (item); - - e_tep_event.type = GDK_BUTTON_RELEASE; - e_tep_event.button.time = button.time; - e_tep_event.button.state = button.state; - e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy(text, button.x, button.y); - _get_tep(text); - return_val = e_text_event_processor_handle_event (text->tep, - &e_tep_event); - e_tep_event.type = GDK_BUTTON_RELEASE; - } -#else - if ((!text->editing) - && text->editable - && (event->button.button == 1 || - event->button.button == 2)) { - e_canvas_item_grab_focus (item); - } -#endif - - /* We follow convention and emit popup events on right-clicks. */ - if (event->type == GDK_BUTTON_PRESS && event->button.button == 3) { - gtk_signal_emit (GTK_OBJECT (text), - e_text_signals[E_TEXT_POPUP], - &(event->button), - _get_position_from_xy (text, event->button.x, event->button.y)); - - break; - } - - /* Create our own double and triple click events, - as gnome-canvas doesn't forward them to us */ - if (event->type == GDK_BUTTON_PRESS) { - if (text->dbl_timeout == 0 && - text->tpl_timeout == 0) { - text->dbl_timeout = gtk_timeout_add (200, - _click, - &(text->dbl_timeout)); - } else { - if (text->tpl_timeout == 0) { - e_tep_event.type = GDK_2BUTTON_PRESS; - text->tpl_timeout = gtk_timeout_add (200, _click, &(text->tpl_timeout)); - } else { - e_tep_event.type = GDK_3BUTTON_PRESS; - } - } - } - - if (text->editing) { - GdkEventButton button = event->button; - e_tep_event.button.time = button.time; - e_tep_event.button.state = button.state; - e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy(text, button.x, button.y); - _get_tep(text); - return_val = e_text_event_processor_handle_event (text->tep, - &e_tep_event); - if (event->button.button == 1) { - if (event->type == GDK_BUTTON_PRESS) - text->button_down = TRUE; - else - text->button_down = FALSE; - } - text->lastx = button.x; - text->lasty = button.y; - text->last_state = button.state; - } - break; - case GDK_MOTION_NOTIFY: - if (text->editing) { - GdkEventMotion motion = event->motion; - e_tep_event.motion.time = motion.time; - e_tep_event.motion.state = motion.state; - e_tep_event.motion.position = _get_position_from_xy(text, motion.x, motion.y); - _get_tep(text); - return_val = e_text_event_processor_handle_event (text->tep, - &e_tep_event); - text->lastx = motion.x; - text->lasty = motion.y; - text->last_state = motion.state; - } - break; - case GDK_ENTER_NOTIFY: - { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double x1, y1, x2, y2; - get_bounds (text, &x1, &y1, &x2, &y2); - if (crossing->x >= x1 && - crossing->y >= y1 && - crossing->x <= x2 && - crossing->y <= y2) { - if ( text->tooltip_count == 0 && text->clip) { - if (!text->tooltip_timeout) - text->tooltip_timeout = gtk_timeout_add (1000, _do_tooltip, text); - } - text->tooltip_count ++; - } - } - - text->pointer_in = TRUE; - if (text->editing || text->draw_borders) { - if ( text->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->i_cursor); - text->default_cursor_shown = FALSE; - } - } - break; - case GDK_LEAVE_NOTIFY: - if (text->tooltip_count > 0) - text->tooltip_count --; - if ( text->tooltip_count == 0 && text->clip) { - if ( text->tooltip_timeout ) { - gtk_timeout_remove (text->tooltip_timeout); - text->tooltip_timeout = 0; - } - } - - text->pointer_in = FALSE; - if (text->editing || text->draw_borders) { - if ( ! text->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->default_cursor); - text->default_cursor_shown = TRUE; - } - } - break; - default: - break; - } - if (return_val) - return return_val; - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event); - else - return 0; -} - -/* fixme: */ - -static int -_get_position(EText *text, ETextEventProcessorCommand *command) -{ - int length, obj_num; - int x, y; - unicode_char_t unival; - char *p = NULL; - gint new_pos = 0; - - switch (command->position) { - - case E_TEP_VALUE: - new_pos = command->value; - break; - - case E_TEP_SELECTION: - new_pos = text->selection_end; - break; - - case E_TEP_START_OF_BUFFER: - new_pos = 0; - break; - - case E_TEP_END_OF_BUFFER: - new_pos = unicode_strlen (text->text, -1); - break; - - case E_TEP_START_OF_LINE: - - new_pos = 0; - - if (text->selection_end >= 1) { - - p = unicode_previous_utf8 (text->text, text->text + text->selection_end); - if (p != text->text) { - p = unicode_previous_utf8 (text->text, p); - - while (p && p > text->text && !new_pos) { - if (*p == '\n') - new_pos = p - text->text + 1; - p = unicode_previous_utf8 (text->text, p); - } - } - } - - break; - - case E_TEP_END_OF_LINE: - new_pos = -1; - length = strlen (text->text); - - if (text->selection_end >= length) { - new_pos = length; - } else { - - p = unicode_next_utf8 (text->text + text->selection_end); - - while (p && *p) { - if (*p == '\n') { - new_pos = p - text->text; - p = NULL; - } else - p = unicode_next_utf8 (p); - } - } - - if (new_pos == -1) - new_pos = p - text->text; - - break; - - case E_TEP_FORWARD_CHARACTER: - length = strlen (text->text); - - if (text->selection_end >= length) { - new_pos = length; - } else { - p = unicode_next_utf8 (text->text + text->selection_end); - new_pos = p - text->text; - } - - break; - - case E_TEP_BACKWARD_CHARACTER: - new_pos = 0; - if (text->selection_end >= 1) { - p = unicode_previous_utf8 (text->text, text->text + text->selection_end); - - if (p != NULL) - new_pos = p - text->text; - } - - break; - - case E_TEP_FORWARD_WORD: - new_pos = -1; - length = strlen (text->text); - - if (text->selection_end >= length) { - new_pos = length; - } else { - - p = unicode_next_utf8 (text->text + text->selection_end); - - while (p && *p) { - unicode_get_utf8 (p, &unival); - if (unicode_isspace (unival)) { - new_pos = p - text->text; - p = NULL; - } else - p = unicode_next_utf8 (p); - } - } - - if (new_pos == -1) - new_pos = p - text->text; - - break; - - case E_TEP_BACKWARD_WORD: - new_pos = 0; - if (text->selection_end >= 1) { - p = unicode_previous_utf8 (text->text, text->text + text->selection_end); - if (p != text->text) { - p = unicode_previous_utf8 (text->text, p); - - while (p && p > text->text) { - unicode_get_utf8 (p, &unival); - if (unicode_isspace (unival)) { - new_pos = unicode_next_utf8 (p) - text->text; - p = NULL; - } else - p = unicode_previous_utf8 (text->text, p); - } - } - } - - break; - - case E_TEP_FORWARD_LINE: - _get_xy_from_position(text, text->selection_end, &x, &y); - y += e_font_height (text->font); - new_pos = _get_position_from_xy(text, x, y); - break; - - case E_TEP_BACKWARD_LINE: - _get_xy_from_position(text, text->selection_end, &x, &y); - y -= e_font_height (text->font); - new_pos = _get_position_from_xy(text, x, y); - break; - - case E_TEP_SELECT_WORD: - - /* This is a silly hack to cause double-clicking on an object - to activate that object. - (Normally, double click == select word, which is why this is here.) */ - - obj_num = e_text_model_get_object_at_offset (text->model, text->selection_start); - if (obj_num != -1) { - e_text_model_activate_nth_object (text->model, obj_num); - new_pos = text->selection_start; - break; - } - - - if (text->selection_end < 1) { - new_pos = 0; - break; - } - - p = unicode_previous_utf8 (text->text, text->text + text->selection_end); - if (p == text->text) { - new_pos = 0; - break; - } - p = unicode_previous_utf8 (text->text, p); - - while (p && p > text->text) { - unicode_get_utf8 (p, &unival); - if (unicode_isspace (unival)) { - p = unicode_next_utf8 (p); - break; - } - p = unicode_previous_utf8 (text->text, p); - } - - if (!p) - text->selection_start = 0; - else - text->selection_start = p - text->text; - - - text->selection_start = e_text_model_validate_position (text->model, text->selection_start); - - length = strlen (text->text); - if (text->selection_end >= length) { - new_pos = length; - break; - } - - p = unicode_next_utf8 (text->text + text->selection_end); - - while (p && *p) { - unicode_get_utf8 (p, &unival); - if (unicode_isspace (unival)) { - new_pos = p - text->text; - p = NULL; - } else - p = unicode_next_utf8 (p); - } - - if (p) - new_pos = p - text->text; - - return new_pos; - - case E_TEP_SELECT_ALL: - text->selection_start = 0; - new_pos = strlen (text->text); - break; - - case E_TEP_FORWARD_PARAGRAPH: - case E_TEP_BACKWARD_PARAGRAPH: - - case E_TEP_FORWARD_PAGE: - case E_TEP_BACKWARD_PAGE: - new_pos = text->selection_end; - break; - - default: - new_pos = text->selection_end; - } - - new_pos = e_text_model_validate_position (text->model, new_pos); - - return new_pos; -} - -static void -_delete_selection(EText *text) -{ - if ( text->selection_start < text->selection_end ) { - e_text_model_delete(text->model, text->selection_start, text->selection_end - text->selection_start); -#if 0 - text->selection_end = text->selection_start; -#endif - } else { - e_text_model_delete(text->model, text->selection_end, text->selection_start - text->selection_end); -#if 0 - text->selection_start = text->selection_end; -#endif - } -} - -static void -_insert(EText *text, char *string, int value) -{ - if (value > 0) { - e_text_model_insert_length(text->model, text->selection_start, string, value); - -#if 0 - text->selection_start += value; - text->selection_end = text->selection_start; -#endif - } -} - -static void -e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data) -{ - EText *text = E_TEXT(data); - int sel_start, sel_end; - - switch (command->action) { - case E_TEP_MOVE: - text->selection_start = _get_position(text, command); - text->selection_end = text->selection_start; - if (text->timer) { - g_timer_reset(text->timer); - } - - break; - case E_TEP_SELECT: - text->selection_start = e_text_model_validate_position (text->model, text->selection_start); /* paranoia */ - text->selection_end = _get_position(text, command); - - sel_start = MIN(text->selection_start, text->selection_end); - sel_end = MAX(text->selection_start, text->selection_end); - - sel_start = e_text_model_validate_position (text->model, sel_start); - - if (sel_start != sel_end) { - e_text_supply_selection (text, command->time, GDK_SELECTION_PRIMARY, - (guchar *) text->text + sel_start, sel_end - sel_start); - } else if (text->timer) { - g_timer_reset(text->timer); - } - - break; - case E_TEP_DELETE: - if (text->selection_end == text->selection_start) { - text->selection_end = _get_position(text, command); - } - _delete_selection(text); - if (text->timer) { - g_timer_reset(text->timer); - } - break; - - case E_TEP_INSERT: - if (text->selection_end != text->selection_start) { - _delete_selection(text); - } - _insert(text, command->string, command->value); - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_COPY: - sel_start = MIN(text->selection_start, text->selection_end); - sel_end = MAX(text->selection_start, text->selection_end); - if (sel_start != sel_end) { - e_text_supply_selection (text, command->time, clipboard_atom, - (guchar *) text->text + sel_start, sel_end - sel_start); - } - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_PASTE: - e_text_get_selection (text, clipboard_atom, command->time); - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_GET_SELECTION: - e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time); - break; - case E_TEP_ACTIVATE: - gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_ACTIVATE]); - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_SET_SELECT_BY_WORD: - text->select_by_word = command->value; - break; - case E_TEP_GRAB: - gnome_canvas_item_grab (GNOME_CANVAS_ITEM(text), - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - text->i_cursor, - command->time); - break; - case E_TEP_UNGRAB: - gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM(text), command->time); - break; - case E_TEP_NOP: - break; - } - - if (!text->button_down) { - int x; - int i; - struct line *lines = text->lines; - gdouble clip_width; - if ( !lines ) - return; - - for (lines = text->lines, i = 0; i < text->num_lines ; i++, lines ++) { - if ((lines->text - text->text) > text->selection_end) { - break; - } - } - lines --; - i --; - x = text_width_with_objects (text->model, - text->font, E_FONT_PLAIN, - lines->text, - text->selection_end - (lines->text - text->text)); - - - if (x < text->xofs_edit) { - text->xofs_edit = x; - } - - clip_width = text->clip_width; - if (clip_width >= 0 && text->draw_borders) { - clip_width -= 6; - if (clip_width < 0) - clip_width = 0; - } - - if (2 + x - clip_width > text->xofs_edit) { - text->xofs_edit = 2 + x - clip_width; - } - - if (e_font_height (text->font) * i < text->yofs_edit) - text->yofs_edit = e_font_height (text->font) * i; - - if (e_font_height (text->font) * (i + 1) - (text->clip_height != -1 ? text->clip_height : text->height) > text->yofs_edit) - text->yofs_edit = e_font_height (text->font) * (i + 1) - (text->clip_height != -1 ? text->clip_height : text->height); - } - - text->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); -} - -static void -_invisible_destroy (GtkInvisible *invisible, - EText *text) -{ - text->invisible = NULL; -} - -static GtkWidget * -e_text_get_invisible(EText *text) -{ - GtkWidget *invisible; - if (text->invisible) { - invisible = text->invisible; - } else { - invisible = gtk_invisible_new(); - text->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - gtk_signal_connect (GTK_OBJECT(invisible), "selection_get", - GTK_SIGNAL_FUNC (_selection_get), - text); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_clear_event", - GTK_SIGNAL_FUNC (_selection_clear_event), - text); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_received", - GTK_SIGNAL_FUNC (_selection_received), - text); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - text); - } - return invisible; -} - -static void -_selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - EText *text) -{ - if (event->selection == GDK_SELECTION_PRIMARY) { - g_free (text->primary_selection); - text->primary_selection = NULL; - text->primary_length = 0; - - text->has_selection = FALSE; - text->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); - - } else if (event->selection == clipboard_atom) { - g_free (text->clipboard_selection); - text->clipboard_selection = NULL; - text->clipboard_length = 0; - } -} - -static void -_selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - EText *text) -{ - switch (info) { - case E_SELECTION_PRIMARY: - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, text->primary_selection, text->primary_length); - break; - case E_SELECTION_CLIPBOARD: - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, text->clipboard_selection, text->clipboard_length); - break; - } -} - -static void -_selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - EText *text) -{ - if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { - return; - } else { - ETextEventProcessorCommand command; - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.string = selection_data->data; - command.value = selection_data->length; - command.time = time; - e_text_command(text->tep, &command, text); - } -} - -static void -e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length) -{ - gboolean successful; - GtkWidget *invisible; - - invisible = e_text_get_invisible(text); - - if (selection == GDK_SELECTION_PRIMARY ) { - if (text->primary_selection) { - g_free (text->primary_selection); - } - text->primary_selection = g_strndup(data, length); - text->primary_length = length; - } else if (selection == clipboard_atom) { - if (text->clipboard_selection) { - g_free (text->clipboard_selection); - } - text->clipboard_selection = g_strndup(data, length); - text->clipboard_length = length; - } - - successful = gtk_selection_owner_set (invisible, - selection, - time); - - if (selection == GDK_SELECTION_PRIMARY) - text->has_selection = successful; -} - -static void -e_text_get_selection(EText *text, GdkAtom selection, guint32 time) -{ - GtkWidget *invisible; - invisible = e_text_get_invisible(text); - gtk_selection_convert(invisible, - selection, - GDK_SELECTION_TYPE_STRING, - time); -} - -#if 0 -static void -e_text_real_copy_clipboard (EText *text) -{ - guint32 time; - gint selection_start_pos; - gint selection_end_pos; - - g_return_if_fail (text != NULL); - g_return_if_fail (E_IS_TEXT (text)); - - time = gtk_text_get_event_time (text); - selection_start_pos = MIN (text->selection_start, text->selection_end); - selection_end_pos = MAX (text->selection_start, text->selection_end); - - if (selection_start_pos != selection_end_pos) - { - if (gtk_selection_owner_set (GTK_WIDGET (text->canvas), - clipboard_atom, - time)) - text->clipboard_text = ""; - } -} - -static void -e_text_real_paste_clipboard (EText *text) -{ - guint32 time; - - g_return_if_fail (text != NULL); - g_return_if_fail (E_IS_TEXT (text)); - - time = e_text_get_event_time (text); - if (text->editable) - gtk_selection_convert (GTK_WIDGET(text->widget), - clipboard_atom, - gdk_atom_intern ("COMPOUND_TEXT", FALSE), time); -} -#endif - - -#if 0 -/* Routines for sucking fonts from the X server */ - -static ETextSuckFont * -e_suck_font (GdkFont *font) -{ - ETextSuckFont *suckfont; - int i; - int x, y; - char text[1]; - int lbearing, rbearing, ch_width, ascent, descent; - GdkPixmap *pixmap; - GdkColor black, white; - GdkImage *image; - GdkGC *gc; - guchar *line; - int width, height; - int black_pixel, pixel; - - if (!font) - return NULL; - - suckfont = g_new (ETextSuckFont, 1); - - height = font->ascent + font->descent; - x = 0; - for (i = 0; i < 256; i++) { - text[0] = i; - gdk_text_extents (font, text, 1, - &lbearing, &rbearing, &ch_width, &ascent, &descent); - suckfont->chars[i].left_sb = lbearing; - suckfont->chars[i].right_sb = ch_width - rbearing; - suckfont->chars[i].width = rbearing - lbearing; - suckfont->chars[i].ascent = ascent; - suckfont->chars[i].descent = descent; - suckfont->chars[i].bitmap_offset = x; - x += (ch_width + 31) & -32; - } - - width = x; - - suckfont->bitmap_width = width; - suckfont->bitmap_height = height; - suckfont->ascent = font->ascent; - - pixmap = gdk_pixmap_new (NULL, suckfont->bitmap_width, - suckfont->bitmap_height, 1); - gc = gdk_gc_new (pixmap); - gdk_gc_set_font (gc, font); - - black_pixel = BlackPixel (gdk_display, DefaultScreen (gdk_display)); - black.pixel = black_pixel; - white.pixel = WhitePixel (gdk_display, DefaultScreen (gdk_display)); - gdk_gc_set_foreground (gc, &white); - gdk_draw_rectangle (pixmap, gc, 1, 0, 0, width, height); - - gdk_gc_set_foreground (gc, &black); - for (i = 0; i < 256; i++) { - text[0] = i; - gdk_draw_text (pixmap, font, gc, - suckfont->chars[i].bitmap_offset - suckfont->chars[i].left_sb, - font->ascent, - text, 1); - } - - /* The handling of the image leaves me with distinct unease. But this - * is more or less copied out of gimp/app/text_tool.c, so it _ought_ to - * work. -RLL - */ - - image = gdk_image_get (pixmap, 0, 0, width, height); - suckfont->bitmap = g_malloc0 ((width >> 3) * height); - - line = suckfont->bitmap; - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - pixel = gdk_image_get_pixel (image, x, y); - if (pixel == black_pixel) - line[x >> 3] |= 128 >> (x & 7); - } - line += width >> 3; - } - - gdk_image_destroy (image); - - /* free the pixmap */ - gdk_pixmap_unref (pixmap); - - /* free the gc */ - gdk_gc_destroy (gc); - - return suckfont; -} - -static void -e_suck_font_free (ETextSuckFont *suckfont) -{ - g_free (suckfont->bitmap); - g_free (suckfont); -} -#endif - - - - - - - diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h deleted file mode 100644 index eae84af102..0000000000 --- a/widgets/text/e-text.h +++ /dev/null @@ -1,232 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* EText - Text item for evolution. - * Copyright (C) 2000, 2001 Ximian Inc. - * - * Author: Chris Lahey <clahey@ximian.com> - * Further hacking by Jon Trowbridge <trow@ximian.com> - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena <federico@nuclecu.unam.mx> */ - -#ifndef E_TEXT_H -#define E_TEXT_H - -#include <gnome.h> -#include <gal/widgets/e-font.h> -#include <gal/util/e-text-event-processor.h> -#include <gal/e-text/e-text-model.h> - - -BEGIN_GNOME_DECLS - - -/* Text item for the canvas. Text items are positioned by an anchor point and an anchor direction. - * - * A clipping rectangle may be specified for the text. The rectangle is anchored at the text's anchor - * point, and is specified by clipping width and height parameters. If the clipping rectangle is - * enabled, it will clip the text. - * - * In addition, x and y offset values may be specified. These specify an offset from the anchor - * position. If used in conjunction with the clipping rectangle, these could be used to implement - * simple scrolling of the text within the clipping rectangle. - * - * The following object arguments are available: - * - * name type read/write description - * ------------------------------------------------------------------------------------------ - * text string RW The string of the text label - * font string W X logical font descriptor - * fontset string W X logical fontset descriptor - * font_gdk GdkFont* RW Pointer to a GdkFont - * anchor GtkAnchorType RW Anchor side for the text - * justification GtkJustification RW Justification for multiline text - * fill_color string W X color specification for text - * fill_color_gdk GdkColor* RW Pointer to an allocated GdkColor - * fill_stipple GdkBitmap* RW Stipple pattern for filling the text - * clip_width double RW Width of clip rectangle - * clip_height double RW Height of clip rectangle - * clip boolean RW Use clipping rectangle? - * fill_clip_rect boolean RW Whether the text item represents itself as being the size of the clipping rectangle. - * x_offset double RW Horizontal offset distance from anchor position - * y_offset double RW Vertical offset distance from anchor position - * text_width double R Used to query the width of the rendered text - * text_height double R Used to query the rendered height of the text - * width double RW A synonym for clip_width - * height double R A synonym for text_height - * - * These are currently ignored in the AA version: - * editable boolean RW Can this item be edited - * use_ellipsis boolean RW Whether to use ellipsises if text gets cut off. Meaningless if clip == false. - * ellipsis string RW The characters to use as ellipsis. NULL = "...". - * line_wrap boolean RW Line wrap when not editing. - * break_characters string RW List of characters to optionally break on. - * max_lines int RW Number of lines possible when doing line wrap. - * draw_borders boolean RW Whether to draw borders. - * draw_background boolean RW Whether to draw the background. - */ - -#define E_TYPE_TEXT (e_text_get_type ()) -#define E_TEXT(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT, EText)) -#define E_TEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT, ETextClass)) -#define E_IS_TEXT(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT)) -#define E_IS_TEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT)) - - -typedef struct _EText EText; -typedef struct _ETextClass ETextClass; - -#if 0 -typedef struct _ETextSuckFont ETextSuckFont; -typedef struct _ETextSuckChar ETextSuckChar; - -struct _ETextSuckChar { - int left_sb; - int right_sb; - int width; - int ascent; - int descent; - int bitmap_offset; /* in pixels */ -}; - -struct _ETextSuckFont { - guchar *bitmap; - gint bitmap_width; - gint bitmap_height; - gint ascent; - ETextSuckChar chars[256]; -}; -#endif - -struct _EText { - GnomeCanvasItem item; - - ETextModel *model; - gint model_changed_signal_id; - gint model_repos_signal_id; - - const gchar *text; /* Text to display --- from the ETextModel */ - gpointer lines; /* Text split into lines (private field) */ - int num_lines; /* Number of lines of text */ - -#if 0 - GdkFont *font; /* Font for text */ -#else - EFont *font; -#endif - GtkAnchorType anchor; /* Anchor side for text */ - GtkJustification justification; /* Justification for text */ - - double clip_width; /* Width of optional clip rectangle */ - double clip_height; /* Height of optional clip rectangle */ - - double xofs, yofs; /* Text offset distance from anchor position */ - - GdkColor color; /* Fill color */ - GdkBitmap *stipple; /* Stipple for text */ - GdkGC *gc; /* GC for drawing text */ - - int cx, cy; /* Top-left canvas coordinates for text */ - int clip_cx, clip_cy; /* Top-left canvas coordinates for clip rectangle */ - int clip_cwidth, clip_cheight; /* Size of clip rectangle in pixels */ - int max_width; /* Maximum width of text lines */ - int width; /* Rendered text width in pixels */ - int height; /* Rendered text height in pixels */ - - guint clip : 1; /* Use clip rectangle? */ - guint fill_clip_rectangle : 1; /* Fill the clipping rectangle. */ - - /* Antialiased specific stuff follows */ -#if 0 - ETextSuckFont *suckfont; /* Sucked font */ -#endif - guint32 rgba; /* RGBA color for text */ - double affine[6]; /* The item -> canvas affine */ - - char *ellipsis; /* The ellipsis characters. NULL = "...". */ - double ellipsis_width; /* The width of the ellipsis. */ - gboolean use_ellipsis; /* Whether to use the ellipsis. */ - - gboolean editable; /* Item is editable */ - gboolean editing; /* Item is currently being edited */ - - int xofs_edit; /* Offset because of editing */ - int yofs_edit; /* Offset because of editing */ - - /* This needs to be reworked a bit once we get line wrapping. */ - int selection_start; /* Start of selection IN BYTES */ - int selection_end; /* End of selection IN BYTES */ - gboolean select_by_word; /* Current selection is by word */ - - /* This section is for drag scrolling and blinking cursor. */ - gint timeout_id; /* Current timeout id for scrolling */ - GTimer *timer; /* Timer for blinking cursor and scrolling */ - - gint lastx, lasty; /* Last x and y motion events */ - gint last_state; /* Last state */ - gulong scroll_start; /* Starting time for scroll (microseconds) */ - - gint show_cursor; /* Is cursor currently shown */ - gboolean button_down; /* Is mouse button 1 down */ - - ETextEventProcessor *tep; /* Text Event Processor */ - gint tep_command_id; - - GtkWidget *invisible; /* For selection handling */ - gboolean has_selection; /* TRUE if we have the selection */ - gchar *primary_selection; /* Primary selection text */ - gint primary_length; /* Primary selection text length */ - gchar *clipboard_selection; /* Clipboard selection text */ - gint clipboard_length; /* Clipboard selection text length*/ - - guint pointer_in : 1; /* Is the pointer currently over us? */ - guint default_cursor_shown : 1; /* Is the default cursor currently shown? */ - guint draw_borders : 1; /* Draw borders? */ - guint draw_background : 1; /* Draw background? */ - - guint line_wrap : 1; /* Do line wrap */ - gchar *break_characters; /* Characters to optionally break after */ - - gint max_lines; /* Max number of lines (-1 = infinite) */ - - GdkCursor *default_cursor; /* Default cursor (arrow) */ - GdkCursor *i_cursor; /* I beam cursor */ - - gint tooltip_timeout; /* Timeout for the tooltip */ - GtkWidget *tooltip_window; /* GtkWindow for displaying the tooltip */ - gint tooltip_count; /* GDK_ENTER_NOTIFY count. */ - - guint needs_redraw : 1; /* Needs redraw */ - guint needs_recalc_bounds : 1; /* Need recalc_bounds */ - guint needs_calc_height : 1; /* Need calc_height */ - guint needs_calc_line_widths : 1; /* Needs calc_line_widths */ - guint needs_split_into_lines : 1; /* Needs split_into_lines */ - - gint dbl_timeout; /* Double click timeout */ - gint tpl_timeout; /* Triple click timeout */ -}; - -struct _ETextClass { - GnomeCanvasItemClass parent_class; - - void (* changed) (EText *text); - void (* activate) (EText *text); - void (* keypress) (EText *text, guint keyval, guint state); - void (* popup) (EText *text, GdkEventButton *ev, gint pos); -}; - - -/* Standard Gtk function */ -GtkType e_text_get_type (void); - -END_GNOME_DECLS - -#endif |